diff --git a/.gitignore b/.gitignore index a547bf3..251ce6d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ pnpm-debug.log* lerna-debug.log* node_modules -dist dist-ssr *.local diff --git a/dist/2023-12-01.csv.gz b/dist/2023-12-01.csv.gz new file mode 100644 index 0000000..c410a36 Binary files /dev/null and b/dist/2023-12-01.csv.gz differ diff --git a/dist/2023-12-02.csv.gz b/dist/2023-12-02.csv.gz new file mode 100644 index 0000000..c410a36 Binary files /dev/null and b/dist/2023-12-02.csv.gz differ diff --git a/dist/assets/index-9alGvXI7.js b/dist/assets/index-9alGvXI7.js new file mode 100644 index 0000000..88f14a6 --- /dev/null +++ b/dist/assets/index-9alGvXI7.js @@ -0,0 +1,1690 @@ +var zN=Object.defineProperty;var zE=t=>{throw TypeError(t)};var $N=(t,e,n)=>e in t?zN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var M=(t,e,n)=>$N(t,typeof e!="symbol"?e+"":e,n),ov=(t,e,n)=>e.has(t)||zE("Cannot "+n);var G=(t,e,n)=>(ov(t,e,"read from private field"),n?n.call(t):e.get(t)),St=(t,e,n)=>e.has(t)?zE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Xe=(t,e,n,r)=>(ov(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Wt=(t,e,n)=>(ov(t,e,"access private method"),n);var Jd=(t,e,n,r)=>({set _(i){Xe(t,e,i,n)},get _(){return G(t,e,r)}});function VN(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function by(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lv={exports:{}},Du={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var $E;function HN(){if($E)return Du;$E=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,a){var l=null;if(a!==void 0&&(l=""+a),i.key!==void 0&&(l=""+i.key),"key"in i){a={};for(var u in i)u!=="key"&&(a[u]=i[u])}else a=i;return i=a.ref,{$$typeof:t,type:r,key:l,ref:i!==void 0?i:null,props:a}}return Du.Fragment=e,Du.jsx=n,Du.jsxs=n,Du}var VE;function jN(){return VE||(VE=1,lv.exports=HN()),lv.exports}var Vr=jN(),Uf=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Uo=typeof window>"u"||"Deno"in globalThis;function xi(){}function WN(t,e){return typeof t=="function"?t(e):t}function v0(t){return typeof t=="number"&&t>=0&&t!==1/0}function zA(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Gl(t,e){return typeof t=="function"?t(e):t}function Yi(t,e){return typeof t=="function"?t(e):t}function HE(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:a,queryKey:l,stale:u}=t;if(l){if(r){if(e.queryHash!==Sy(l,e.options))return!1}else if(!hf(e.queryKey,l))return!1}if(n!=="all"){const f=e.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||a&&!a(e))}function jE(t,e){const{exact:n,status:r,predicate:i,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(df(e.options.mutationKey)!==df(a))return!1}else if(!hf(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Sy(t,e){return((e==null?void 0:e.queryKeyHashFn)||df)(t)}function df(t){return JSON.stringify(t,(e,n)=>y0(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function hf(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!hf(t[n],e[n])):!1}function $A(t,e){if(t===e)return t;const n=WE(t)&&WE(e);if(n||y0(t)&&y0(e)){const r=n?t:Object.keys(t),i=r.length,a=n?e:Object.keys(e),l=a.length,u=n?[]:{};let f=0;for(let h=0;h{setTimeout(e,t)})}function b0(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?$A(t,e):e}function qN(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function YN(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Ey=Symbol();function VA(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Ey?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var wo,Ca,sc,OA,KN=(OA=class extends Uf{constructor(){super();St(this,wo);St(this,Ca);St(this,sc);Xe(this,sc,e=>{if(!Uo&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){G(this,Ca)||this.setEventListener(G(this,sc))}onUnsubscribe(){var e;this.hasListeners()||((e=G(this,Ca))==null||e.call(this),Xe(this,Ca,void 0))}setEventListener(e){var n;Xe(this,sc,e),(n=G(this,Ca))==null||n.call(this),Xe(this,Ca,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){G(this,wo)!==e&&(Xe(this,wo,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof G(this,wo)=="boolean"?G(this,wo):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},wo=new WeakMap,Ca=new WeakMap,sc=new WeakMap,OA),wy=new KN,ac,Aa,oc,PA,ZN=(PA=class extends Uf{constructor(){super();St(this,ac,!0);St(this,Aa);St(this,oc);Xe(this,oc,e=>{if(!Uo&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){G(this,Aa)||this.setEventListener(G(this,oc))}onUnsubscribe(){var e;this.hasListeners()||((e=G(this,Aa))==null||e.call(this),Xe(this,Aa,void 0))}setEventListener(e){var n;Xe(this,oc,e),(n=G(this,Aa))==null||n.call(this),Xe(this,Aa,e(this.setOnline.bind(this)))}setOnline(e){G(this,ac)!==e&&(Xe(this,ac,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return G(this,ac)}},ac=new WeakMap,Aa=new WeakMap,oc=new WeakMap,PA),Lh=new ZN;function S0(){let t,e;const n=new Promise((i,a)=>{t=i,e=a});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function QN(t){return Math.min(1e3*2**t,3e4)}function HA(t){return(t??"online")==="online"?Lh.isOnline():!0}var jA=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function cv(t){return t instanceof jA}function WA(t){let e=!1,n=0,r=!1,i;const a=S0(),l=E=>{var b;r||(v(new jA(E)),(b=t.abort)==null||b.call(t))},u=()=>{e=!0},f=()=>{e=!1},h=()=>wy.isFocused()&&(t.networkMode==="always"||Lh.isOnline())&&t.canRun(),g=()=>HA(t.networkMode)&&t.canRun(),m=E=>{var b;r||(r=!0,(b=t.onSuccess)==null||b.call(t,E),i==null||i(),a.resolve(E))},v=E=>{var b;r||(r=!0,(b=t.onError)==null||b.call(t,E),i==null||i(),a.reject(E))},S=()=>new Promise(E=>{var b;i=C=>{(r||h())&&E(C)},(b=t.onPause)==null||b.call(t)}).then(()=>{var E;i=void 0,r||(E=t.onContinue)==null||E.call(t)}),w=()=>{if(r)return;let E;const b=n===0?t.initialPromise:void 0;try{E=b??t.fn()}catch(C){E=Promise.reject(C)}Promise.resolve(E).then(m).catch(C=>{var N;if(r)return;const T=t.retry??(Uo?0:3),A=t.retryDelay??QN,O=typeof A=="function"?A(n,C):A,x=T===!0||typeof T=="number"&&nh()?void 0:S()).then(()=>{e?v(C):w()})})};return{promise:a,cancel:l,continue:()=>(i==null||i(),a),cancelRetry:u,continueRetry:f,canStart:g,start:()=>(g()?w():S().then(w),a)}}function GN(){let t=[],e=0,n=u=>{u()},r=u=>{u()},i=u=>setTimeout(u,0);const a=u=>{e?t.push(u):i(()=>{n(u)})},l=()=>{const u=t;t=[],u.length&&i(()=>{r(()=>{u.forEach(f=>{n(f)})})})};return{batch:u=>{let f;e++;try{f=u()}finally{e--,e||l()}return f},batchCalls:u=>(...f)=>{a(()=>{u(...f)})},schedule:a,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var Rr=GN(),To,NA,XA=(NA=class{constructor(){St(this,To)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),v0(this.gcTime)&&Xe(this,To,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Uo?1/0:5*60*1e3))}clearGcTimeout(){G(this,To)&&(clearTimeout(G(this,To)),Xe(this,To,void 0))}},To=new WeakMap,NA),lc,cc,Ri,Co,Dr,Df,Ao,ji,zs,IA,JN=(IA=class extends XA{constructor(e){super();St(this,ji);St(this,lc);St(this,cc);St(this,Ri);St(this,Co);St(this,Dr);St(this,Df);St(this,Ao);Xe(this,Ao,!1),Xe(this,Df,e.defaultOptions),this.setOptions(e.options),this.observers=[],Xe(this,Co,e.client),Xe(this,Ri,G(this,Co).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Xe(this,lc,eI(this.options)),this.state=e.state??G(this,lc),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=G(this,Dr))==null?void 0:e.promise}setOptions(e){this.options={...G(this,Df),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&G(this,Ri).remove(this)}setData(e,n){const r=b0(this.state.data,e,this.options);return Wt(this,ji,zs).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Wt(this,ji,zs).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=G(this,Dr))==null?void 0:r.promise;return(i=G(this,Dr))==null||i.cancel(e),n?n.then(xi).catch(xi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(G(this,lc))}isActive(){return this.observers.some(e=>Yi(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ey||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!zA(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=G(this,Dr))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=G(this,Dr))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),G(this,Ri).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(G(this,Dr)&&(G(this,Ao)?G(this,Dr).cancel({revert:!0}):G(this,Dr).cancelRetry()),this.scheduleGc()),G(this,Ri).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Wt(this,ji,zs).call(this,{type:"invalidate"})}fetch(e,n){var f,h,g;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(G(this,Dr))return G(this,Dr).continueRetry(),G(this,Dr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(v=>v.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(Xe(this,Ao,!0),r.signal)})},a=()=>{const m=VA(this.options,n),v={client:G(this,Co),queryKey:this.queryKey,meta:this.meta};return i(v),Xe(this,Ao,!1),this.options.persister?this.options.persister(m,v,this):m(v)},l={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:G(this,Co),state:this.state,fetchFn:a};i(l),(f=this.options.behavior)==null||f.onFetch(l,this),Xe(this,cc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=l.fetchOptions)==null?void 0:h.meta))&&Wt(this,ji,zs).call(this,{type:"fetch",meta:(g=l.fetchOptions)==null?void 0:g.meta});const u=m=>{var v,S,w,E;cv(m)&&m.silent||Wt(this,ji,zs).call(this,{type:"error",error:m}),cv(m)||((S=(v=G(this,Ri).config).onError)==null||S.call(v,m,this),(E=(w=G(this,Ri).config).onSettled)==null||E.call(w,this.state.data,m,this)),this.scheduleGc()};return Xe(this,Dr,WA({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var v,S,w,E;if(m===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(b){u(b);return}(S=(v=G(this,Ri).config).onSuccess)==null||S.call(v,m,this),(E=(w=G(this,Ri).config).onSettled)==null||E.call(w,m,this.state.error,this),this.scheduleGc()},onError:u,onFail:(m,v)=>{Wt(this,ji,zs).call(this,{type:"failed",failureCount:m,error:v})},onPause:()=>{Wt(this,ji,zs).call(this,{type:"pause"})},onContinue:()=>{Wt(this,ji,zs).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),G(this,Dr).start()}},lc=new WeakMap,cc=new WeakMap,Ri=new WeakMap,Co=new WeakMap,Dr=new WeakMap,Df=new WeakMap,Ao=new WeakMap,ji=new WeakSet,zs=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...qA(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return cv(i)&&i.revert&&G(this,cc)?{...G(this,cc),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Rr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),G(this,Ri).notify({query:this,type:"updated",action:e})})},IA);function qA(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:HA(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function eI(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var fs,DA,tI=(DA=class extends Uf{constructor(e={}){super();St(this,fs);this.config=e,Xe(this,fs,new Map)}build(e,n,r){const i=n.queryKey,a=n.queryHash??Sy(i,n);let l=this.get(a);return l||(l=new JN({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){G(this,fs).has(e.queryHash)||(G(this,fs).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=G(this,fs).get(e.queryHash);n&&(e.destroy(),n===e&&G(this,fs).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Rr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return G(this,fs).get(e)}getAll(){return[...G(this,fs).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>HE(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>HE(e,r)):n}notify(e){Rr.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Rr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Rr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},fs=new WeakMap,DA),ds,zr,Ro,hs,ba,FA,nI=(FA=class extends XA{constructor(e){super();St(this,hs);St(this,ds);St(this,zr);St(this,Ro);this.mutationId=e.mutationId,Xe(this,zr,e.mutationCache),Xe(this,ds,[]),this.state=e.state||rI(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){G(this,ds).includes(e)||(G(this,ds).push(e),this.clearGcTimeout(),G(this,zr).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Xe(this,ds,G(this,ds).filter(n=>n!==e)),this.scheduleGc(),G(this,zr).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){G(this,ds).length||(this.state.status==="pending"?this.scheduleGc():G(this,zr).remove(this))}continue(){var e;return((e=G(this,Ro))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,a,l,u,f,h,g,m,v,S,w,E,b,C,T,A,O,x,N,F;Xe(this,Ro,WA({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(L,D)=>{Wt(this,hs,ba).call(this,{type:"failed",failureCount:L,error:D})},onPause:()=>{Wt(this,hs,ba).call(this,{type:"pause"})},onContinue:()=>{Wt(this,hs,ba).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>G(this,zr).canRun(this)}));const n=this.state.status==="pending",r=!G(this,Ro).canStart();try{if(!n){Wt(this,hs,ba).call(this,{type:"pending",variables:e,isPaused:r}),await((a=(i=G(this,zr).config).onMutate)==null?void 0:a.call(i,e,this));const D=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,e));D!==this.state.context&&Wt(this,hs,ba).call(this,{type:"pending",context:D,variables:e,isPaused:r})}const L=await G(this,Ro).start();return await((h=(f=G(this,zr).config).onSuccess)==null?void 0:h.call(f,L,e,this.state.context,this)),await((m=(g=this.options).onSuccess)==null?void 0:m.call(g,L,e,this.state.context)),await((S=(v=G(this,zr).config).onSettled)==null?void 0:S.call(v,L,null,this.state.variables,this.state.context,this)),await((E=(w=this.options).onSettled)==null?void 0:E.call(w,L,null,e,this.state.context)),Wt(this,hs,ba).call(this,{type:"success",data:L}),L}catch(L){try{throw await((C=(b=G(this,zr).config).onError)==null?void 0:C.call(b,L,e,this.state.context,this)),await((A=(T=this.options).onError)==null?void 0:A.call(T,L,e,this.state.context)),await((x=(O=G(this,zr).config).onSettled)==null?void 0:x.call(O,void 0,L,this.state.variables,this.state.context,this)),await((F=(N=this.options).onSettled)==null?void 0:F.call(N,void 0,L,e,this.state.context)),L}finally{Wt(this,hs,ba).call(this,{type:"error",error:L})}}finally{G(this,zr).runNext(this)}}},ds=new WeakMap,zr=new WeakMap,Ro=new WeakMap,hs=new WeakSet,ba=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Rr.batch(()=>{G(this,ds).forEach(r=>{r.onMutationUpdate(e)}),G(this,zr).notify({mutation:this,type:"updated",action:e})})},FA);function rI(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $s,Wi,Ff,kA,iI=(kA=class extends Uf{constructor(e={}){super();St(this,$s);St(this,Wi);St(this,Ff);this.config=e,Xe(this,$s,new Set),Xe(this,Wi,new Map),Xe(this,Ff,0)}build(e,n,r){const i=new nI({mutationCache:this,mutationId:++Jd(this,Ff)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){G(this,$s).add(e);const n=eh(e);if(typeof n=="string"){const r=G(this,Wi).get(n);r?r.push(e):G(this,Wi).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(G(this,$s).delete(e)){const n=eh(e);if(typeof n=="string"){const r=G(this,Wi).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&G(this,Wi).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=eh(e);if(typeof n=="string"){const r=G(this,Wi).get(n),i=r==null?void 0:r.find(a=>a.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=eh(e);if(typeof n=="string"){const i=(r=G(this,Wi).get(n))==null?void 0:r.find(a=>a!==e&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Rr.batch(()=>{G(this,$s).forEach(e=>{this.notify({type:"removed",mutation:e})}),G(this,$s).clear(),G(this,Wi).clear()})}getAll(){return Array.from(G(this,$s))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>jE(n,r))}findAll(e={}){return this.getAll().filter(n=>jE(e,n))}notify(e){Rr.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Rr.batch(()=>Promise.all(e.map(n=>n.continue().catch(xi))))}},$s=new WeakMap,Wi=new WeakMap,Ff=new WeakMap,kA);function eh(t){var e;return(e=t.options.scope)==null?void 0:e.id}function qE(t){return{onFetch:(e,n)=>{var g,m,v,S,w;const r=e.options,i=(v=(m=(g=e.fetchOptions)==null?void 0:g.meta)==null?void 0:m.fetchMore)==null?void 0:v.direction,a=((S=e.state.data)==null?void 0:S.pages)||[],l=((w=e.state.data)==null?void 0:w.pageParams)||[];let u={pages:[],pageParams:[]},f=0;const h=async()=>{let E=!1;const b=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(e.signal.aborted?E=!0:e.signal.addEventListener("abort",()=>{E=!0}),e.signal)})},C=VA(e.options,e.fetchOptions),T=async(A,O,x)=>{if(E)return Promise.reject();if(O==null&&A.pages.length)return Promise.resolve(A);const N={client:e.client,queryKey:e.queryKey,pageParam:O,direction:x?"backward":"forward",meta:e.options.meta};b(N);const F=await C(N),{maxPages:L}=e.options,D=x?YN:qN;return{pages:D(A.pages,F,L),pageParams:D(A.pageParams,O,L)}};if(i&&a.length){const A=i==="backward",O=A?sI:YE,x={pages:a,pageParams:l},N=O(r,x);u=await T(x,N,A)}else{const A=t??a.length;do{const O=f===0?l[0]??r.initialPageParam:YE(r,u);if(f>0&&O==null)break;u=await T(u,O),f++}while(f{var E,b;return(b=(E=e.options).persister)==null?void 0:b.call(E,h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=h}}}function YE(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function sI(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Yn,Ra,xa,uc,fc,Ma,dc,hc,BA,aI=(BA=class{constructor(t={}){St(this,Yn);St(this,Ra);St(this,xa);St(this,uc);St(this,fc);St(this,Ma);St(this,dc);St(this,hc);Xe(this,Yn,t.queryCache||new tI),Xe(this,Ra,t.mutationCache||new iI),Xe(this,xa,t.defaultOptions||{}),Xe(this,uc,new Map),Xe(this,fc,new Map),Xe(this,Ma,0)}mount(){Jd(this,Ma)._++,G(this,Ma)===1&&(Xe(this,dc,wy.subscribe(async t=>{t&&(await this.resumePausedMutations(),G(this,Yn).onFocus())})),Xe(this,hc,Lh.subscribe(async t=>{t&&(await this.resumePausedMutations(),G(this,Yn).onOnline())})))}unmount(){var t,e;Jd(this,Ma)._--,G(this,Ma)===0&&((t=G(this,dc))==null||t.call(this),Xe(this,dc,void 0),(e=G(this,hc))==null||e.call(this),Xe(this,hc,void 0))}isFetching(t){return G(this,Yn).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return G(this,Ra).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=G(this,Yn).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=G(this,Yn).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Gl(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return G(this,Yn).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=G(this,Yn).get(r.queryHash),a=i==null?void 0:i.state.data,l=WN(e,a);if(l!==void 0)return G(this,Yn).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(t,e,n){return Rr.batch(()=>G(this,Yn).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=G(this,Yn).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=G(this,Yn);Rr.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=G(this,Yn),r={type:"active",...t};return Rr.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Rr.batch(()=>G(this,Yn).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(xi).catch(xi)}invalidateQueries(t,e={}){return Rr.batch(()=>{if(G(this,Yn).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none")return Promise.resolve();const n={...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"};return this.refetchQueries(n,e)})}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Rr.batch(()=>G(this,Yn).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let a=i.fetch(void 0,n);return n.throwOnError||(a=a.catch(xi)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(xi)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=G(this,Yn).build(this,e);return n.isStaleByTime(Gl(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(xi).catch(xi)}fetchInfiniteQuery(t){return t.behavior=qE(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(xi).catch(xi)}ensureInfiniteQueryData(t){return t.behavior=qE(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Lh.isOnline()?G(this,Ra).resumePausedMutations():Promise.resolve()}getQueryCache(){return G(this,Yn)}getMutationCache(){return G(this,Ra)}getDefaultOptions(){return G(this,xa)}setDefaultOptions(t){Xe(this,xa,t)}setQueryDefaults(t,e){G(this,uc).set(df(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...G(this,uc).values()],n={};return e.forEach(r=>{hf(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){G(this,fc).set(df(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...G(this,fc).values()];let n={};return e.forEach(r=>{hf(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...G(this,xa).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Sy(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Ey&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...G(this,xa).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){G(this,Yn).clear(),G(this,Ra).clear()}},Yn=new WeakMap,Ra=new WeakMap,xa=new WeakMap,uc=new WeakMap,fc=new WeakMap,Ma=new WeakMap,dc=new WeakMap,hc=new WeakMap,BA),Yr,Xt,kf,$r,xo,gc,Oa,gs,Bf,pc,mc,Mo,Oo,Pa,vc,on,Wu,E0,w0,T0,C0,A0,R0,x0,YA,UA,oI=(UA=class extends Uf{constructor(e,n){super();St(this,on);St(this,Yr);St(this,Xt);St(this,kf);St(this,$r);St(this,xo);St(this,gc);St(this,Oa);St(this,gs);St(this,Bf);St(this,pc);St(this,mc);St(this,Mo);St(this,Oo);St(this,Pa);St(this,vc,new Set);this.options=n,Xe(this,Yr,e),Xe(this,gs,null),Xe(this,Oa,S0()),this.options.experimental_prefetchInRender||G(this,Oa).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(G(this,Xt).addObserver(this),KE(G(this,Xt),this.options)?Wt(this,on,Wu).call(this):this.updateResult(),Wt(this,on,C0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return M0(G(this,Xt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return M0(G(this,Xt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Wt(this,on,A0).call(this),Wt(this,on,R0).call(this),G(this,Xt).removeObserver(this)}setOptions(e,n){const r=this.options,i=G(this,Xt);if(this.options=G(this,Yr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Yi(this.options.enabled,G(this,Xt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Wt(this,on,x0).call(this),G(this,Xt).setOptions(this.options),r._defaulted&&!_0(this.options,r)&&G(this,Yr).getQueryCache().notify({type:"observerOptionsUpdated",query:G(this,Xt),observer:this});const a=this.hasListeners();a&&ZE(G(this,Xt),i,this.options,r)&&Wt(this,on,Wu).call(this),this.updateResult(n),a&&(G(this,Xt)!==i||Yi(this.options.enabled,G(this,Xt))!==Yi(r.enabled,G(this,Xt))||Gl(this.options.staleTime,G(this,Xt))!==Gl(r.staleTime,G(this,Xt)))&&Wt(this,on,E0).call(this);const l=Wt(this,on,w0).call(this);a&&(G(this,Xt)!==i||Yi(this.options.enabled,G(this,Xt))!==Yi(r.enabled,G(this,Xt))||l!==G(this,Pa))&&Wt(this,on,T0).call(this,l)}getOptimisticResult(e){const n=G(this,Yr).getQueryCache().build(G(this,Yr),e),r=this.createResult(n,e);return cI(this,r)&&(Xe(this,$r,r),Xe(this,gc,this.options),Xe(this,xo,G(this,Xt).state)),r}getCurrentResult(){return G(this,$r)}trackResult(e,n){const r={};return Object.keys(e).forEach(i=>{Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),n==null||n(i),e[i])})}),r}trackProp(e){G(this,vc).add(e)}getCurrentQuery(){return G(this,Xt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=G(this,Yr).defaultQueryOptions(e),r=G(this,Yr).getQueryCache().build(G(this,Yr),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Wt(this,on,Wu).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),G(this,$r)))}createResult(e,n){var L;const r=G(this,Xt),i=this.options,a=G(this,$r),l=G(this,xo),u=G(this,gc),h=e!==r?e.state:G(this,kf),{state:g}=e;let m={...g},v=!1,S;if(n._optimisticResults){const D=this.hasListeners(),V=!D&&KE(e,n),B=D&&ZE(e,r,n,i);(V||B)&&(m={...m,...qA(g.data,e.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:w,errorUpdatedAt:E,status:b}=m;if(n.select&&m.data!==void 0)if(a&&m.data===(l==null?void 0:l.data)&&n.select===G(this,Bf))S=G(this,pc);else try{Xe(this,Bf,n.select),S=n.select(m.data),S=b0(a==null?void 0:a.data,S,n),Xe(this,pc,S),Xe(this,gs,null)}catch(D){Xe(this,gs,D)}else S=m.data;if(n.placeholderData!==void 0&&S===void 0&&b==="pending"){let D;if(a!=null&&a.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData))D=a.data;else if(D=typeof n.placeholderData=="function"?n.placeholderData((L=G(this,mc))==null?void 0:L.state.data,G(this,mc)):n.placeholderData,n.select&&D!==void 0)try{D=n.select(D),Xe(this,gs,null)}catch(V){Xe(this,gs,V)}D!==void 0&&(b="success",S=b0(a==null?void 0:a.data,D,n),v=!0)}G(this,gs)&&(w=G(this,gs),S=G(this,pc),E=Date.now(),b="error");const C=m.fetchStatus==="fetching",T=b==="pending",A=b==="error",O=T&&C,x=S!==void 0,F={status:b,fetchStatus:m.fetchStatus,isPending:T,isSuccess:b==="success",isError:A,isInitialLoading:O,isLoading:O,data:S,dataUpdatedAt:m.dataUpdatedAt,error:w,errorUpdatedAt:E,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>h.dataUpdateCount||m.errorUpdateCount>h.errorUpdateCount,isFetching:C,isRefetching:C&&!T,isLoadingError:A&&!x,isPaused:m.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:A&&x,isStale:Ty(e,n),refetch:this.refetch,promise:G(this,Oa)};if(this.options.experimental_prefetchInRender){const D=W=>{F.status==="error"?W.reject(F.error):F.data!==void 0&&W.resolve(F.data)},V=()=>{const W=Xe(this,Oa,F.promise=S0());D(W)},B=G(this,Oa);switch(B.status){case"pending":e.queryHash===r.queryHash&&D(B);break;case"fulfilled":(F.status==="error"||F.data!==B.value)&&V();break;case"rejected":(F.status!=="error"||F.error!==B.reason)&&V();break}}return F}updateResult(e){const n=G(this,$r),r=this.createResult(G(this,Xt),this.options);if(Xe(this,xo,G(this,Xt).state),Xe(this,gc,this.options),G(this,xo).data!==void 0&&Xe(this,mc,G(this,Xt)),_0(r,n))return;Xe(this,$r,r);const i={},a=()=>{if(!n)return!0;const{notifyOnChangeProps:l}=this.options,u=typeof l=="function"?l():l;if(u==="all"||!u&&!G(this,vc).size)return!0;const f=new Set(u??G(this,vc));return this.options.throwOnError&&f.add("error"),Object.keys(G(this,$r)).some(h=>{const g=h;return G(this,$r)[g]!==n[g]&&f.has(g)})};(e==null?void 0:e.listeners)!==!1&&a()&&(i.listeners=!0),Wt(this,on,YA).call(this,{...i,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Wt(this,on,C0).call(this)}},Yr=new WeakMap,Xt=new WeakMap,kf=new WeakMap,$r=new WeakMap,xo=new WeakMap,gc=new WeakMap,Oa=new WeakMap,gs=new WeakMap,Bf=new WeakMap,pc=new WeakMap,mc=new WeakMap,Mo=new WeakMap,Oo=new WeakMap,Pa=new WeakMap,vc=new WeakMap,on=new WeakSet,Wu=function(e){Wt(this,on,x0).call(this);let n=G(this,Xt).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(xi)),n},E0=function(){Wt(this,on,A0).call(this);const e=Gl(this.options.staleTime,G(this,Xt));if(Uo||G(this,$r).isStale||!v0(e))return;const r=zA(G(this,$r).dataUpdatedAt,e)+1;Xe(this,Mo,setTimeout(()=>{G(this,$r).isStale||this.updateResult()},r))},w0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(G(this,Xt)):this.options.refetchInterval)??!1},T0=function(e){Wt(this,on,R0).call(this),Xe(this,Pa,e),!(Uo||Yi(this.options.enabled,G(this,Xt))===!1||!v0(G(this,Pa))||G(this,Pa)===0)&&Xe(this,Oo,setInterval(()=>{(this.options.refetchIntervalInBackground||wy.isFocused())&&Wt(this,on,Wu).call(this)},G(this,Pa)))},C0=function(){Wt(this,on,E0).call(this),Wt(this,on,T0).call(this,Wt(this,on,w0).call(this))},A0=function(){G(this,Mo)&&(clearTimeout(G(this,Mo)),Xe(this,Mo,void 0))},R0=function(){G(this,Oo)&&(clearInterval(G(this,Oo)),Xe(this,Oo,void 0))},x0=function(){const e=G(this,Yr).getQueryCache().build(G(this,Yr),this.options);if(e===G(this,Xt))return;const n=G(this,Xt);Xe(this,Xt,e),Xe(this,kf,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},YA=function(e){Rr.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(G(this,$r))}),G(this,Yr).getQueryCache().notify({query:G(this,Xt),type:"observerResultsUpdated"})})},UA);function lI(t,e){return Yi(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function KE(t,e){return lI(t,e)||t.state.data!==void 0&&M0(t,e,e.refetchOnMount)}function M0(t,e,n){if(Yi(e.enabled,t)!==!1){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Ty(t,e)}return!1}function ZE(t,e,n,r){return(t!==e||Yi(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Ty(t,n)}function Ty(t,e){return Yi(e.enabled,t)!==!1&&t.isStaleByTime(Gl(e.staleTime,t))}function cI(t,e){return!_0(t.getCurrentResult(),e)}var uv={exports:{}},At={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var QE;function uI(){if(QE)return At;QE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.iterator;function v(P){return P===null||typeof P!="object"?null:(P=m&&P[m]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,E={};function b(P,$,ie){this.props=P,this.context=$,this.refs=E,this.updater=ie||S}b.prototype.isReactComponent={},b.prototype.setState=function(P,$){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,$,"setState")},b.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function C(){}C.prototype=b.prototype;function T(P,$,ie){this.props=P,this.context=$,this.refs=E,this.updater=ie||S}var A=T.prototype=new C;A.constructor=T,w(A,b.prototype),A.isPureReactComponent=!0;var O=Array.isArray,x={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function F(P,$,ie,se,q,ce){return ie=ce.ref,{$$typeof:t,type:P,key:$,ref:ie!==void 0?ie:null,props:ce}}function L(P,$){return F(P.type,$,void 0,void 0,void 0,P.props)}function D(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function V(P){var $={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(ie){return $[ie]})}var B=/\/+/g;function W(P,$){return typeof P=="object"&&P!==null&&P.key!=null?V(""+P.key):$.toString(36)}function X(){}function Y(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(X,X):(P.status="pending",P.then(function($){P.status==="pending"&&(P.status="fulfilled",P.value=$)},function($){P.status==="pending"&&(P.status="rejected",P.reason=$)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function ae(P,$,ie,se,q){var ce=typeof P;(ce==="undefined"||ce==="boolean")&&(P=null);var fe=!1;if(P===null)fe=!0;else switch(ce){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(P.$$typeof){case t:case e:fe=!0;break;case g:return fe=P._init,ae(fe(P._payload),$,ie,se,q)}}if(fe)return q=q(P),fe=se===""?"."+W(P,0):se,O(q)?(ie="",fe!=null&&(ie=fe.replace(B,"$&/")+"/"),ae(q,$,ie,"",function(Ce){return Ce})):q!=null&&(D(q)&&(q=L(q,ie+(q.key==null||P&&P.key===q.key?"":(""+q.key).replace(B,"$&/")+"/")+fe)),$.push(q)),1;fe=0;var ye=se===""?".":se+":";if(O(P))for(var Ee=0;Ee{const e=_.useContext(KA);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},dI=({client:t,children:e})=>(_.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),Vr.jsx(KA.Provider,{value:t,children:e})),ZA=_.createContext(!1),hI=()=>_.useContext(ZA);ZA.Provider;function gI(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var pI=_.createContext(gI()),mI=()=>_.useContext(pI);function vI(t,e){return typeof t=="function"?t(...e):!!t}function JE(){}var _I=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},yI=t=>{_.useEffect(()=>{t.clearReset()},[t])},bI=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||vI(n,[t.error,r])),SI=t=>{const e=t.staleTime;t.suspense&&(t.staleTime=typeof e=="function"?(...n)=>Math.max(e(...n),1e3):Math.max(e??1e3,1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},EI=(t,e)=>t.isLoading&&t.isFetching&&!e,wI=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,ew=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function TI(t,e,n){var m,v,S,w,E;const r=fI(),i=hI(),a=mI(),l=r.defaultQueryOptions(t);(v=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||v.call(m,l),l._optimisticResults=i?"isRestoring":"optimistic",SI(l),_I(l,a),yI(a);const u=!r.getQueryCache().get(l.queryHash),[f]=_.useState(()=>new e(r,l)),h=f.getOptimisticResult(l),g=!i&&t.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(b=>{const C=g?f.subscribe(Rr.batchCalls(b)):JE;return f.updateResult(),C},[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),_.useEffect(()=>{f.setOptions(l,{listeners:!1})},[l,f]),wI(l,h))throw ew(l,f,a);if(bI({result:h,errorResetBoundary:a,throwOnError:l.throwOnError,query:r.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw h.error;if((w=(S=r.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,l,h),l.experimental_prefetchInRender&&!Uo&&EI(h,i)){const b=u?ew(l,f,a):(E=r.getQueryCache().get(l.queryHash))==null?void 0:E.promise;b==null||b.catch(JE).finally(()=>{f.updateResult()})}return l.notifyOnChangeProps?h:f.trackResult(h)}function CI(t,e){return TI(t,oI)}const AI="modulepreload",RI=function(t){return"/"+t},tw={},xI=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=Promise.allSettled(n.map(f=>{if(f=RI(f),f in tw)return;tw[f]=!0;const h=f.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":AI,h||(m.as="script"),m.crossOrigin="",m.href=f,u&&m.setAttribute("nonce",u),document.head.appendChild(m),h)return new Promise((v,S)=>{m.addEventListener("load",v),m.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function a(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return i.then(l=>{for(const u of l||[])u.status==="rejected"&&a(u.reason);return e().catch(a)})};var MI=function(){return null},fv={exports:{}},Fu={},dv={exports:{}},hv={};/** + * @license React + * scheduler.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var nw;function OI(){return nw||(nw=1,function(t){function e(U,z){var j=U.length;U.push(z);e:for(;0>>1,P=U[Z];if(0>>1;Z<$;){var ie=2*(Z+1)-1,se=U[ie],q=ie+1,ce=U[q];if(0>i(se,j))qi(ce,se)?(U[Z]=ce,U[q]=j,Z=q):(U[Z]=se,U[ie]=j,Z=ie);else if(qi(ce,j))U[Z]=ce,U[q]=j,Z=q;else break e}}return z}function i(U,z){var j=U.sortIndex-z.sortIndex;return j!==0?j:U.id-z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();t.unstable_now=function(){return l.now()-u}}var f=[],h=[],g=1,m=null,v=3,S=!1,w=!1,E=!1,b=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function A(U){for(var z=n(h);z!==null;){if(z.callback===null)r(h);else if(z.startTime<=U)r(h),z.sortIndex=z.expirationTime,e(f,z);else break;z=n(h)}}function O(U){if(E=!1,A(U),!w)if(n(f)!==null)w=!0,Y();else{var z=n(h);z!==null&&ae(O,z.startTime-U)}}var x=!1,N=-1,F=5,L=-1;function D(){return!(t.unstable_now()-LU&&D());){var Z=m.callback;if(typeof Z=="function"){m.callback=null,v=m.priorityLevel;var P=Z(m.expirationTime<=U);if(U=t.unstable_now(),typeof P=="function"){m.callback=P,A(U),z=!0;break t}m===n(f)&&r(f),A(U)}else r(f);m=n(f)}if(m!==null)z=!0;else{var $=n(h);$!==null&&ae(O,$.startTime-U),z=!1}}break e}finally{m=null,v=j,S=!1}z=void 0}}finally{z?B():x=!1}}}var B;if(typeof T=="function")B=function(){T(V)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,X=W.port2;W.port1.onmessage=V,B=function(){X.postMessage(null)}}else B=function(){b(V,0)};function Y(){x||(x=!0,B())}function ae(U,z){N=b(function(){U(t.unstable_now())},z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(U){U.callback=null},t.unstable_continueExecution=function(){w||S||(w=!0,Y())},t.unstable_forceFrameRate=function(U){0>U||125Z?(U.sortIndex=j,e(h,U),n(f)===null&&U===n(h)&&(E?(C(N),N=-1):E=!0,ae(O,j-Z))):(U.sortIndex=P,e(f,U),w||S||(w=!0,Y())),U},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(U){var z=v;return function(){var j=v;v=z;try{return U.apply(this,arguments)}finally{v=j}}}}(hv)),hv}var rw;function PI(){return rw||(rw=1,dv.exports=OI()),dv.exports}var gv={exports:{}},Nr={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var iw;function NI(){if(iw)return Nr;iw=1;var t=Cy();function e(f){var h="https://react.dev/errors/"+f;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),gv.exports=NI(),gv.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var aw;function II(){if(aw)return Fu;aw=1;var t=PI(),e=Cy(),n=QA();function r(s){var o="https://react.dev/errors/"+s;if(1)":-1p||H[d]!==ee[p]){var pe=` +`+H[d].replace(" at new "," at ");return s.displayName&&pe.includes("")&&(pe=pe.replace("",s.displayName)),pe}while(1<=d&&0<=p);break}}}finally{Y=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?X(c):""}function U(s){switch(s.tag){case 26:case 27:case 5:return X(s.type);case 16:return X("Lazy");case 13:return X("Suspense");case 19:return X("SuspenseList");case 0:case 15:return s=ae(s.type,!1),s;case 11:return s=ae(s.type.render,!1),s;case 1:return s=ae(s.type,!0),s;default:return""}}function z(s){try{var o="";do o+=U(s),s=s.return;while(s);return o}catch(c){return` +Error generating stack: `+c.message+` +`+c.stack}}function j(s){var o=s,c=s;if(s.alternate)for(;o.return;)o=o.return;else{s=o;do o=s,o.flags&4098&&(c=o.return),s=o.return;while(s)}return o.tag===3?c:null}function Z(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function P(s){if(j(s)!==s)throw Error(r(188))}function $(s){var o=s.alternate;if(!o){if(o=j(s),o===null)throw Error(r(188));return o!==s?null:s}for(var c=s,d=o;;){var p=c.return;if(p===null)break;var y=p.alternate;if(y===null){if(d=p.return,d!==null){c=d;continue}break}if(p.child===y.child){for(y=p.child;y;){if(y===c)return P(p),s;if(y===d)return P(p),o;y=y.sibling}throw Error(r(188))}if(c.return!==d.return)c=p,d=y;else{for(var R=!1,I=p.child;I;){if(I===c){R=!0,c=p,d=y;break}if(I===d){R=!0,d=p,c=y;break}I=I.sibling}if(!R){for(I=y.child;I;){if(I===c){R=!0,c=y,d=p;break}if(I===d){R=!0,d=y,c=p;break}I=I.sibling}if(!R)throw Error(r(189))}}if(c.alternate!==d)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:o}function ie(s){var o=s.tag;if(o===5||o===26||o===27||o===6)return s;for(s=s.child;s!==null;){if(o=ie(s),o!==null)return o;s=s.sibling}return null}var se=Array.isArray,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},fe=[],ye=-1;function Ee(s){return{current:s}}function Ce(s){0>ye||(s.current=fe[ye],fe[ye]=null,ye--)}function Te(s,o){ye++,fe[ye]=s.current,s.current=o}var ve=Ee(null),ge=Ee(null),_e=Ee(null),Ie=Ee(null);function we(s,o){switch(Te(_e,o),Te(ge,s),Te(ve,null),s=o.nodeType,s){case 9:case 11:o=(o=o.documentElement)&&(o=o.namespaceURI)?pE(o):0;break;default:if(s=s===8?o.parentNode:o,o=s.tagName,s=s.namespaceURI)s=pE(s),o=mE(s,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Ce(ve),Te(ve,o)}function xe(){Ce(ve),Ce(ge),Ce(_e)}function Ve(s){s.memoizedState!==null&&Te(Ie,s);var o=ve.current,c=mE(o,s.type);o!==c&&(Te(ge,s),Te(ve,c))}function Fe(s){ge.current===s&&(Ce(ve),Ce(ge)),Ie.current===s&&(Ce(Ie),Mu._currentValue=ce)}var Be=Object.prototype.hasOwnProperty,nt=t.unstable_scheduleCallback,He=t.unstable_cancelCallback,Ge=t.unstable_shouldYield,Pe=t.unstable_requestPaint,Me=t.unstable_now,dt=t.unstable_getCurrentPriorityLevel,rt=t.unstable_ImmediatePriority,it=t.unstable_UserBlockingPriority,st=t.unstable_NormalPriority,at=t.unstable_LowPriority,Je=t.unstable_IdlePriority,lt=t.log,ft=t.unstable_setDisableYieldValue,ct=null,mt=null;function xt(s){if(mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(ct,s,void 0,(s.current.flags&128)===128)}catch{}}function Bt(s){if(typeof lt=="function"&&ft(s),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(ct,s)}catch{}}var ht=Math.clz32?Math.clz32:wn,Vt=Math.log,qt=Math.LN2;function wn(s){return s>>>=0,s===0?32:31-(Vt(s)/qt|0)|0}var Mn=128,Ut=4194304;function It(s){var o=s&42;if(o!==0)return o;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Lt(s,o){var c=s.pendingLanes;if(c===0)return 0;var d=0,p=s.suspendedLanes,y=s.pingedLanes,R=s.warmLanes;s=s.finishedLanes!==0;var I=c&134217727;return I!==0?(c=I&~p,c!==0?d=It(c):(y&=I,y!==0?d=It(y):s||(R=I&~R,R!==0&&(d=It(R))))):(I=c&~p,I!==0?d=It(I):y!==0?d=It(y):s||(R=c&~R,R!==0&&(d=It(R)))),d===0?0:o!==0&&o!==d&&!(o&p)&&(p=d&-d,R=o&-o,p>=R||p===32&&(R&4194176)!==0)?o:d}function Jt(s,o){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&o)===0}function Mt(s,o){switch(s){case 1:case 2:case 4:case 8:return o+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qe(){var s=Mn;return Mn<<=1,!(Mn&4194176)&&(Mn=128),s}function ke(){var s=Ut;return Ut<<=1,!(Ut&62914560)&&(Ut=4194304),s}function Ne(s){for(var o=[],c=0;31>c;c++)o.push(s);return o}function Et(s,o){s.pendingLanes|=o,o!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function en(s,o,c,d,p,y){var R=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var I=s.entanglements,H=s.expirationTimes,ee=s.hiddenUpdates;for(c=R&~c;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Pn={},Bn={};function Or(s){return Be.call(Bn,s)?!0:Be.call(Pn,s)?!1:Vn.test(s)?Bn[s]=!0:(Pn[s]=!0,!1)}function er(s,o,c){if(Or(o))if(c===null)s.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(o);return;case"boolean":var d=o.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(o);return}}s.setAttribute(o,""+c)}}function Un(s,o,c){if(c===null)s.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttribute(o,""+c)}}function Tn(s,o,c,d){if(d===null)s.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(o,c,""+d)}}function Qn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ii(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function jr(s){var o=Ii(s)?"checked":"value",c=Object.getOwnPropertyDescriptor(s.constructor.prototype,o),d=""+s[o];if(!s.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,y=c.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return p.call(this)},set:function(R){d=""+R,y.call(this,R)}}),Object.defineProperty(s,o,{enumerable:c.enumerable}),{getValue:function(){return d},setValue:function(R){d=""+R},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function Di(s){s._valueTracker||(s._valueTracker=jr(s))}function Fi(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var c=o.getValue(),d="";return s&&(d=Ii(s)?s.checked?"true":"false":s.value),s=d,s!==c?(o.setValue(s),!0):!1}function Tt(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var yt=/[\n"\\]/g;function nn(s){return s.replace(yt,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Hn(s,o,c,d,p,y,R,I){s.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?s.type=R:s.removeAttribute("type"),o!=null?R==="number"?(o===0&&s.value===""||s.value!=o)&&(s.value=""+Qn(o)):s.value!==""+Qn(o)&&(s.value=""+Qn(o)):R!=="submit"&&R!=="reset"||s.removeAttribute("value"),o!=null?Nn(s,R,Qn(o)):c!=null?Nn(s,R,Qn(c)):d!=null&&s.removeAttribute("value"),p==null&&y!=null&&(s.defaultChecked=!!y),p!=null&&(s.checked=p&&typeof p!="function"&&typeof p!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.name=""+Qn(I):s.removeAttribute("name")}function Cn(s,o,c,d,p,y,R,I){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.type=y),o!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||o!=null))return;c=c!=null?""+Qn(c):"",o=o!=null?""+Qn(o):c,I||o===s.value||(s.value=o),s.defaultValue=o}d=d??p,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=I?s.checked:!!d,s.defaultChecked=!!d,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(s.name=R)}function Nn(s,o,c){o==="number"&&Tt(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function tr(s,o,c,d){if(s=s.options,o){o={};for(var p=0;p=qc),Ib=" ",Db=!1;function Fb(s,o){switch(s){case"keyup":return uP.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kb(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var nl=!1;function dP(s,o){switch(s){case"compositionend":return kb(o);case"keypress":return o.which!==32?null:(Db=!0,Ib);case"textInput":return s=o.data,s===Ib&&Db?null:s;default:return null}}function hP(s,o){if(nl)return s==="compositionend"||!vp&&Fb(s,o)?(s=tl(),ws=An=fn=null,nl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:c,offset:o-s};s=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=jb(c)}}function Xb(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?Xb(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function qb(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var o=Tt(s.document);o instanceof s.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)s=o.contentWindow;else break;o=Tt(s.document)}return o}function bp(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}function SP(s,o){var c=qb(o);o=s.focusedElem;var d=s.selectionRange;if(c!==o&&o&&o.ownerDocument&&Xb(o.ownerDocument.documentElement,o)){if(d!==null&&bp(o)){if(s=d.start,c=d.end,c===void 0&&(c=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(c,o.value.length);else if(c=(s=o.ownerDocument||document)&&s.defaultView||window,c.getSelection){c=c.getSelection();var p=o.textContent.length,y=Math.min(d.start,p);d=d.end===void 0?y:Math.min(d.end,p),!c.extend&&y>d&&(p=d,d=y,y=p),p=Wb(o,y);var R=Wb(o,d);p&&R&&(c.rangeCount!==1||c.anchorNode!==p.node||c.anchorOffset!==p.offset||c.focusNode!==R.node||c.focusOffset!==R.offset)&&(s=s.createRange(),s.setStart(p.node,p.offset),c.removeAllRanges(),y>d?(c.addRange(s),c.extend(R.node,R.offset)):(s.setEnd(R.node,R.offset),c.addRange(s)))}}for(s=[],c=o;c=c.parentNode;)c.nodeType===1&&s.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,rl=null,Sp=null,Qc=null,Ep=!1;function Yb(s,o,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ep||rl==null||rl!==Tt(d)||(d=rl,"selectionStart"in d&&bp(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Qc&&Zc(Qc,d)||(Qc=d,d=Ud(Sp,"onSelect"),0>=R,p-=R,Cs=1<<32-ht(o)+p|c<vt?(vr=ot,ot=null):vr=ot.sibling;var Gt=ue(re,ot,le[vt],me);if(Gt===null){ot===null&&(ot=vr);break}s&&ot&&Gt.alternate===null&&o(re,ot),Q=y(Gt,Q,vt),Dt===null?Ke=Gt:Dt.sibling=Gt,Dt=Gt,ot=vr}if(vt===le.length)return c(re,ot),Qt&&Ya(re,vt),Ke;if(ot===null){for(;vtvt?(vr=ot,ot=null):vr=ot.sibling;var ga=ue(re,ot,Gt.value,me);if(ga===null){ot===null&&(ot=vr);break}s&&ot&&ga.alternate===null&&o(re,ot),Q=y(ga,Q,vt),Dt===null?Ke=ga:Dt.sibling=ga,Dt=ga,ot=vr}if(Gt.done)return c(re,ot),Qt&&Ya(re,vt),Ke;if(ot===null){for(;!Gt.done;vt++,Gt=le.next())Gt=Se(re,Gt.value,me),Gt!==null&&(Q=y(Gt,Q,vt),Dt===null?Ke=Gt:Dt.sibling=Gt,Dt=Gt);return Qt&&Ya(re,vt),Ke}for(ot=d(ot);!Gt.done;vt++,Gt=le.next())Gt=he(ot,re,vt,Gt.value,me),Gt!==null&&(s&&Gt.alternate!==null&&ot.delete(Gt.key===null?vt:Gt.key),Q=y(Gt,Q,vt),Dt===null?Ke=Gt:Dt.sibling=Gt,Dt=Gt);return s&&ot.forEach(function(LN){return o(re,LN)}),Qt&&Ya(re,vt),Ke}function Xn(re,Q,le,me){if(typeof le=="object"&&le!==null&&le.type===f&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case l:e:{for(var Ke=le.key;Q!==null;){if(Q.key===Ke){if(Ke=le.type,Ke===f){if(Q.tag===7){c(re,Q.sibling),me=p(Q,le.props.children),me.return=re,re=me;break e}}else if(Q.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===T&&f1(Ke)===Q.type){c(re,Q.sibling),me=p(Q,le.props),iu(me,le),me.return=re,re=me;break e}c(re,Q);break}else o(re,Q);Q=Q.sibling}le.type===f?(me=so(le.props.children,re.mode,me,le.key),me.return=re,re=me):(me=xd(le.type,le.key,le.props,null,re.mode,me),iu(me,le),me.return=re,re=me)}return R(re);case u:e:{for(Ke=le.key;Q!==null;){if(Q.key===Ke)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){c(re,Q.sibling),me=p(Q,le.children||[]),me.return=re,re=me;break e}else{c(re,Q);break}else o(re,Q);Q=Q.sibling}me=Tm(le,re.mode,me),me.return=re,re=me}return R(re);case T:return Ke=le._init,le=Ke(le._payload),Xn(re,Q,le,me)}if(se(le))return tt(re,Q,le,me);if(N(le)){if(Ke=N(le),typeof Ke!="function")throw Error(r(150));return le=Ke.call(le),wt(re,Q,le,me)}if(typeof le.then=="function")return Xn(re,Q,cd(le),me);if(le.$$typeof===S)return Xn(re,Q,Cd(re,le),me);ud(re,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,Q!==null&&Q.tag===6?(c(re,Q.sibling),me=p(Q,le),me.return=re,re=me):(c(re,Q),me=wm(le,re.mode,me),me.return=re,re=me),R(re)):c(re,Q)}return function(re,Q,le,me){try{ru=0;var Ke=Xn(re,Q,le,me);return cl=null,Ke}catch(ot){if(ot===tu)throw ot;var Dt=Si(29,ot,null,re.mode);return Dt.lanes=me,Dt.return=re,Dt}finally{}}}var Za=d1(!0),h1=d1(!1),ul=Ee(null),fd=Ee(0);function g1(s,o){s=Bs,Te(fd,s),Te(ul,o),Bs=s|o.baseLanes}function Op(){Te(fd,Bs),Te(ul,ul.current)}function Pp(){Bs=fd.current,Ce(ul),Ce(fd)}var _i=Ee(null),rs=null;function Zs(s){var o=s.alternate;Te(lr,lr.current&1),Te(_i,s),rs===null&&(o===null||ul.current!==null||o.memoizedState!==null)&&(rs=s)}function p1(s){if(s.tag===22){if(Te(lr,lr.current),Te(_i,s),rs===null){var o=s.alternate;o!==null&&o.memoizedState!==null&&(rs=s)}}else Qs()}function Qs(){Te(lr,lr.current),Te(_i,_i.current)}function Rs(s){Ce(_i),rs===s&&(rs=null),Ce(lr)}var lr=Ee(0);function dd(s){for(var o=s;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if(o.flags&128)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var AP=typeof AbortController<"u"?AbortController:function(){var s=[],o=this.signal={aborted:!1,addEventListener:function(c,d){s.push(d)}};this.abort=function(){o.aborted=!0,s.forEach(function(c){return c()})}},RP=t.unstable_scheduleCallback,xP=t.unstable_NormalPriority,cr={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Np(){return{controller:new AP,data:new Map,refCount:0}}function su(s){s.refCount--,s.refCount===0&&RP(xP,function(){s.controller.abort()})}var au=null,Ip=0,fl=0,dl=null;function MP(s,o){if(au===null){var c=au=[];Ip=0,fl=Lm(),dl={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Ip++,o.then(m1,m1),o}function m1(){if(--Ip===0&&au!==null){dl!==null&&(dl.status="fulfilled");var s=au;au=null,fl=0,dl=null;for(var o=0;oy?y:8;var R=D.T,I={};D.T=I,Zp(s,!1,o,c);try{var H=p(),ee=D.S;if(ee!==null&&ee(I,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var pe=OP(H,d);cu(s,o,pe,ri(s))}else cu(s,o,d,ri(s))}catch(Se){cu(s,o,{then:function(){},status:"rejected",reason:Se},ri())}finally{q.p=y,D.T=R}}function FP(){}function Yp(s,o,c,d){if(s.tag!==5)throw Error(r(476));var p=q1(s).queue;X1(s,p,o,ce,c===null?FP:function(){return Y1(s),c(d)})}function q1(s){var o=s.memoizedState;if(o!==null)return o;o={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:ce},next:null};var c={};return o.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:c},next:null},s.memoizedState=o,s=s.alternate,s!==null&&(s.memoizedState=o),o}function Y1(s){var o=q1(s).next.queue;cu(s,o,{},ri())}function Kp(){return Pr(Mu)}function K1(){return rr().memoizedState}function Z1(){return rr().memoizedState}function kP(s){for(var o=s.return;o!==null;){switch(o.tag){case 24:case 3:var c=ri();s=na(c);var d=ra(o,s,c);d!==null&&(Lr(d,o,c),du(d,o,c)),o={cache:Np()},s.payload=o;return}o=o.return}}function BP(s,o,c){var d=ri();c={lane:d,revertLane:0,action:c,hasEagerState:!1,eagerState:null,next:null},Sd(s)?G1(o,c):(c=Cp(s,o,c,d),c!==null&&(Lr(c,s,d),J1(c,o,d)))}function Q1(s,o,c){var d=ri();cu(s,o,c,d)}function cu(s,o,c,d){var p={lane:d,revertLane:0,action:c,hasEagerState:!1,eagerState:null,next:null};if(Sd(s))G1(o,p);else{var y=s.alternate;if(s.lanes===0&&(y===null||y.lanes===0)&&(y=o.lastRenderedReducer,y!==null))try{var R=o.lastRenderedState,I=y(R,c);if(p.hasEagerState=!0,p.eagerState=I,Jr(I,R))return id(s,o,p,0),Rn===null&&rd(),!1}catch{}finally{}if(c=Cp(s,o,p,d),c!==null)return Lr(c,s,d),J1(c,o,d),!0}return!1}function Zp(s,o,c,d){if(d={lane:2,revertLane:Lm(),action:d,hasEagerState:!1,eagerState:null,next:null},Sd(s)){if(o)throw Error(r(479))}else o=Cp(s,c,d,2),o!==null&&Lr(o,s,2)}function Sd(s){var o=s.alternate;return s===Pt||o!==null&&o===Pt}function G1(s,o){hl=gd=!0;var c=s.pending;c===null?o.next=o:(o.next=c.next,c.next=o),s.pending=o}function J1(s,o,c){if(c&4194176){var d=o.lanes;d&=s.pendingLanes,c|=d,o.lanes=c,Oe(s,c)}}var is={readContext:Pr,use:vd,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useLayoutEffect:Gn,useInsertionEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useSyncExternalStore:Gn,useId:Gn};is.useCacheRefresh=Gn,is.useMemoCache=Gn,is.useHostTransitionStatus=Gn,is.useFormState=Gn,is.useActionState=Gn,is.useOptimistic=Gn;var Ja={readContext:Pr,use:vd,useCallback:function(s,o){return qr().memoizedState=[s,o===void 0?null:o],s},useContext:Pr,useEffect:U1,useImperativeHandle:function(s,o,c){c=c!=null?c.concat([s]):null,yd(4194308,4,$1.bind(null,o,s),c)},useLayoutEffect:function(s,o){return yd(4194308,4,s,o)},useInsertionEffect:function(s,o){yd(4,2,s,o)},useMemo:function(s,o){var c=qr();o=o===void 0?null:o;var d=s();if(Ga){Bt(!0);try{s()}finally{Bt(!1)}}return c.memoizedState=[d,o],d},useReducer:function(s,o,c){var d=qr();if(c!==void 0){var p=c(o);if(Ga){Bt(!0);try{c(o)}finally{Bt(!1)}}}else p=o;return d.memoizedState=d.baseState=p,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:p},d.queue=s,s=s.dispatch=BP.bind(null,Pt,s),[d.memoizedState,s]},useRef:function(s){var o=qr();return s={current:s},o.memoizedState=s},useState:function(s){s=Hp(s);var o=s.queue,c=Q1.bind(null,Pt,o);return o.dispatch=c,[s.memoizedState,c]},useDebugValue:Xp,useDeferredValue:function(s,o){var c=qr();return qp(c,s,o)},useTransition:function(){var s=Hp(!1);return s=X1.bind(null,Pt,s.queue,!0,!1),qr().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,o,c){var d=Pt,p=qr();if(Qt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=o(),Rn===null)throw Error(r(349));Kt&60||E1(d,o,c)}p.memoizedState=c;var y={value:c,getSnapshot:o};return p.queue=y,U1(T1.bind(null,d,y,s),[s]),d.flags|=2048,pl(9,w1.bind(null,d,y,c,o),{destroy:void 0},null),c},useId:function(){var s=qr(),o=Rn.identifierPrefix;if(Qt){var c=As,d=Cs;c=(d&~(1<<32-ht(d)-1)).toString(32)+c,o=":"+o+"R"+c,c=pd++,0 title"))),Tr(y,d,c),y[bt]=s,be(y),d=y;break e;case"link":var R=AE("link","href",p).get(d+(c.href||""));if(R){for(var I=0;I<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof d.is=="string"?p.createElement("select",{is:d.is}):p.createElement("select"),d.multiple?s.multiple=!0:d.size&&(s.size=d.size);break;default:s=typeof d.is=="string"?p.createElement(c,{is:d.is}):p.createElement(c)}}s[bt]=o,s[_t]=d;e:for(p=o.child;p!==null;){if(p.tag===5||p.tag===6)s.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===o)break e;for(;p.sibling===null;){if(p.return===null||p.return===o)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}o.stateNode=s;e:switch(Tr(s,c,d),c){case"button":case"input":case"select":case"textarea":s=!!d.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Fs(o)}}return Ln(o),o.flags&=-16777217,null;case 6:if(s&&o.stateNode!=null)s.memoizedProps!==d&&Fs(o);else{if(typeof d!="string"&&o.stateNode===null)throw Error(r(166));if(s=_e.current,Gc(o)){if(s=o.stateNode,c=o.memoizedProps,d=null,p=Ur,p!==null)switch(p.tag){case 27:case 5:d=p.memoizedProps}s[bt]=o,s=!!(s.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||gE(s.nodeValue,c)),s||Ka(o)}else s=zd(s).createTextNode(d),s[bt]=o,o.stateNode=s}return Ln(o),null;case 13:if(d=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(p=Gc(o),d!==null&&d.dehydrated!==null){if(s===null){if(!p)throw Error(r(318));if(p=o.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[bt]=o}else Jc(),!(o.flags&128)&&(o.memoizedState=null),o.flags|=4;Ln(o),p=!1}else Li!==null&&(Nm(Li),Li=null),p=!0;if(!p)return o.flags&256?(Rs(o),o):(Rs(o),null)}if(Rs(o),o.flags&128)return o.lanes=c,o;if(c=d!==null,s=s!==null&&s.memoizedState!==null,c){d=o.child,p=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(p=d.alternate.memoizedState.cachePool.pool);var y=null;d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==p&&(d.flags|=2048)}return c!==s&&c&&(o.child.flags|=8192),Md(o,o.updateQueue),Ln(o),null;case 4:return xe(),s===null&&Hm(o.stateNode.containerInfo),Ln(o),null;case 10:return Ps(o.type),Ln(o),null;case 19:if(Ce(lr),p=o.memoizedState,p===null)return Ln(o),null;if(d=(o.flags&128)!==0,y=p.rendering,y===null)if(d)yu(p,!1);else{if(Wn!==0||s!==null&&s.flags&128)for(s=o.child;s!==null;){if(y=dd(s),y!==null){for(o.flags|=128,yu(p,!1),s=y.updateQueue,o.updateQueue=s,Md(o,s),o.subtreeFlags=0,s=c,c=o.child;c!==null;)VS(c,s),c=c.sibling;return Te(lr,lr.current&1|2),o.child}s=s.sibling}p.tail!==null&&Me()>Od&&(o.flags|=128,d=!0,yu(p,!1),o.lanes=4194304)}else{if(!d)if(s=dd(y),s!==null){if(o.flags|=128,d=!0,s=s.updateQueue,o.updateQueue=s,Md(o,s),yu(p,!0),p.tail===null&&p.tailMode==="hidden"&&!y.alternate&&!Qt)return Ln(o),null}else 2*Me()-p.renderingStartTime>Od&&c!==536870912&&(o.flags|=128,d=!0,yu(p,!1),o.lanes=4194304);p.isBackwards?(y.sibling=o.child,o.child=y):(s=p.last,s!==null?s.sibling=y:o.child=y,p.last=y)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=Me(),o.sibling=null,s=lr.current,Te(lr,d?s&1|2:s&1),o):(Ln(o),null);case 22:case 23:return Rs(o),Pp(),d=o.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?c&536870912&&!(o.flags&128)&&(Ln(o),o.subtreeFlags&6&&(o.flags|=8192)):Ln(o),c=o.updateQueue,c!==null&&Md(o,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==c&&(o.flags|=2048),s!==null&&Ce(Qa),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),o.memoizedState.cache!==c&&(o.flags|=2048),Ps(cr),Ln(o),null;case 25:return null}throw Error(r(156,o.tag))}function jP(s,o){switch(Rp(o),o.tag){case 1:return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return Ps(cr),xe(),s=o.flags,s&65536&&!(s&128)?(o.flags=s&-65537|128,o):null;case 26:case 27:case 5:return Fe(o),null;case 13:if(Rs(o),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(r(340));Jc()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return Ce(lr),null;case 4:return xe(),null;case 10:return Ps(o.type),null;case 22:case 23:return Rs(o),Pp(),s!==null&&Ce(Qa),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 24:return Ps(cr),null;case 25:return null;default:return null}}function WS(s,o){switch(Rp(o),o.tag){case 3:Ps(cr),xe();break;case 26:case 27:case 5:Fe(o);break;case 4:xe();break;case 13:Rs(o);break;case 19:Ce(lr);break;case 10:Ps(o.type);break;case 22:case 23:Rs(o),Pp(),s!==null&&Ce(Qa);break;case 24:Ps(cr)}}var WP={getCacheForType:function(s){var o=Pr(cr),c=o.data.get(s);return c===void 0&&(c=s(),o.data.set(s,c)),c}},XP=typeof WeakMap=="function"?WeakMap:Map,zn=0,Rn=null,$t=null,Kt=0,xn=0,ni=null,ks=!1,yl=!1,Cm=!1,Bs=0,Wn=0,la=0,ao=0,Am=0,Ei=0,bl=0,bu=null,ss=null,Rm=!1,xm=0,Od=1/0,Pd=null,ca=null,Nd=!1,oo=null,Su=0,Mm=0,Om=null,Eu=0,Pm=null;function ri(){if(zn&2&&Kt!==0)return Kt&-Kt;if(D.T!==null){var s=fl;return s!==0?s:Lm()}return Ye()}function XS(){Ei===0&&(Ei=!(Kt&536870912)||Qt?qe():536870912);var s=_i.current;return s!==null&&(s.flags|=32),Ei}function Lr(s,o,c){(s===Rn&&xn===2||s.cancelPendingCommit!==null)&&(Sl(s,0),Us(s,Kt,Ei,!1)),Et(s,c),(!(zn&2)||s!==Rn)&&(s===Rn&&(!(zn&2)&&(ao|=c),Wn===4&&Us(s,Kt,Ei,!1)),as(s))}function qS(s,o,c){if(zn&6)throw Error(r(327));var d=!c&&(o&60)===0&&(o&s.expiredLanes)===0||Jt(s,o),p=d?KP(s,o):Fm(s,o,!0),y=d;do{if(p===0){yl&&!d&&Us(s,o,0,!1);break}else if(p===6)Us(s,o,0,!ks);else{if(c=s.current.alternate,y&&!qP(c)){p=Fm(s,o,!1),y=!1;continue}if(p===2){if(y=o,s.errorRecoveryDisabledLanes&y)var R=0;else R=s.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){o=R;e:{var I=s;p=bu;var H=I.current.memoizedState.isDehydrated;if(H&&(Sl(I,R).flags|=256),R=Fm(I,R,!1),R!==2){if(Cm&&!H){I.errorRecoveryDisabledLanes|=y,ao|=y,p=4;break e}y=ss,ss=p,y!==null&&Nm(y)}p=R}if(y=!1,p!==2)continue}}if(p===1){Sl(s,0),Us(s,o,0,!0);break}e:{switch(d=s,p){case 0:case 1:throw Error(r(345));case 4:if((o&4194176)===o){Us(d,o,Ei,!ks);break e}break;case 2:ss=null;break;case 3:case 5:break;default:throw Error(r(329))}if(d.finishedWork=c,d.finishedLanes=o,(o&62914560)===o&&(y=xm+300-Me(),10c?32:c,D.T=null,oo===null)var y=!1;else{c=Om,Om=null;var R=oo,I=Su;if(oo=null,Su=0,zn&6)throw Error(r(331));var H=zn;if(zn|=4,zS(R.current),BS(R,R.current,I,c),zn=H,wu(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(ct,R)}catch{}y=!0}return y}finally{q.p=p,D.T=d,nE(s,o)}}return!1}function rE(s,o,c){o=pi(c,o),o=Jp(s.stateNode,o,2),s=ra(s,o,2),s!==null&&(Et(s,2),as(s))}function yn(s,o,c){if(s.tag===3)rE(s,s,c);else for(;o!==null;){if(o.tag===3){rE(o,s,c);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ca===null||!ca.has(d))){s=pi(c,s),c=aS(2),d=ra(o,c,2),d!==null&&(oS(c,d,o,s),Et(d,2),as(d));break}}o=o.return}}function km(s,o,c){var d=s.pingCache;if(d===null){d=s.pingCache=new XP;var p=new Set;d.set(o,p)}else p=d.get(o),p===void 0&&(p=new Set,d.set(o,p));p.has(c)||(Cm=!0,p.add(c),s=GP.bind(null,s,o,c),o.then(s,s))}function GP(s,o,c){var d=s.pingCache;d!==null&&d.delete(o),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Rn===s&&(Kt&c)===c&&(Wn===4||Wn===3&&(Kt&62914560)===Kt&&300>Me()-xm?!(zn&2)&&Sl(s,0):Am|=c,bl===Kt&&(bl=0)),as(s)}function iE(s,o){o===0&&(o=ke()),s=Ks(s,o),s!==null&&(Et(s,o),as(s))}function JP(s){var o=s.memoizedState,c=0;o!==null&&(c=o.retryLane),iE(s,c)}function eN(s,o){var c=0;switch(s.tag){case 13:var d=s.stateNode,p=s.memoizedState;p!==null&&(c=p.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(o),iE(s,c)}function tN(s,o){return nt(s,o)}var Fd=null,Tl=null,Bm=!1,kd=!1,Um=!1,lo=0;function as(s){s!==Tl&&s.next===null&&(Tl===null?Fd=Tl=s:Tl=Tl.next=s),kd=!0,Bm||(Bm=!0,rN(nN))}function wu(s,o){if(!Um&&kd){Um=!0;do for(var c=!1,d=Fd;d!==null;){if(s!==0){var p=d.pendingLanes;if(p===0)var y=0;else{var R=d.suspendedLanes,I=d.pingedLanes;y=(1<<31-ht(42|s)+1)-1,y&=p&~(R&~I),y=y&201326677?y&201326677|1:y?y|2:0}y!==0&&(c=!0,oE(d,y))}else y=Kt,y=Lt(d,d===Rn?y:0),!(y&3)||Jt(d,y)||(c=!0,oE(d,y));d=d.next}while(c);Um=!1}}function nN(){kd=Bm=!1;var s=0;lo!==0&&(fN()&&(s=lo),lo=0);for(var o=Me(),c=null,d=Fd;d!==null;){var p=d.next,y=sE(d,o);y===0?(d.next=null,c===null?Fd=p:c.next=p,p===null&&(Tl=c)):(c=d,(s!==0||y&3)&&(kd=!0)),d=p}wu(s)}function sE(s,o){for(var c=s.suspendedLanes,d=s.pingedLanes,p=s.expirationTimes,y=s.pendingLanes&-62914561;0"u"?null:document;function EE(s,o,c){var d=Al;if(d&&typeof o=="string"&&o){var p=nn(o);p='link[rel="'+s+'"][href="'+p+'"]',typeof c=="string"&&(p+='[crossorigin="'+c+'"]'),SE.has(p)||(SE.add(p),s={rel:s,crossOrigin:c,href:o},d.querySelector(p)===null&&(o=d.createElement("link"),Tr(o,"link",s),be(o),d.head.appendChild(o)))}}function yN(s){Ls.D(s),EE("dns-prefetch",s,null)}function bN(s,o){Ls.C(s,o),EE("preconnect",s,o)}function SN(s,o,c){Ls.L(s,o,c);var d=Al;if(d&&s&&o){var p='link[rel="preload"][as="'+nn(o)+'"]';o==="image"&&c&&c.imageSrcSet?(p+='[imagesrcset="'+nn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(p+='[imagesizes="'+nn(c.imageSizes)+'"]')):p+='[href="'+nn(s)+'"]';var y=p;switch(o){case"style":y=Rl(s);break;case"script":y=xl(s)}wi.has(y)||(s=V({rel:"preload",href:o==="image"&&c&&c.imageSrcSet?void 0:s,as:o},c),wi.set(y,s),d.querySelector(p)!==null||o==="style"&&d.querySelector(Au(y))||o==="script"&&d.querySelector(Ru(y))||(o=d.createElement("link"),Tr(o,"link",s),be(o),d.head.appendChild(o)))}}function EN(s,o){Ls.m(s,o);var c=Al;if(c&&s){var d=o&&typeof o.as=="string"?o.as:"script",p='link[rel="modulepreload"][as="'+nn(d)+'"][href="'+nn(s)+'"]',y=p;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=xl(s)}if(!wi.has(y)&&(s=V({rel:"modulepreload",href:s},o),wi.set(y,s),c.querySelector(p)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ru(y)))return}d=c.createElement("link"),Tr(d,"link",s),be(d),c.head.appendChild(d)}}}function wN(s,o,c){Ls.S(s,o,c);var d=Al;if(d&&s){var p=De(d).hoistableStyles,y=Rl(s);o=o||"default";var R=p.get(y);if(!R){var I={loading:0,preload:null};if(R=d.querySelector(Au(y)))I.loading=5;else{s=V({rel:"stylesheet",href:s,"data-precedence":o},c),(c=wi.get(y))&&Gm(s,c);var H=R=d.createElement("link");be(H),Tr(H,"link",s),H._p=new Promise(function(ee,pe){H.onload=ee,H.onerror=pe}),H.addEventListener("load",function(){I.loading|=1}),H.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Vd(R,o,d)}R={type:"stylesheet",instance:R,count:1,state:I},p.set(y,R)}}}function TN(s,o){Ls.X(s,o);var c=Al;if(c&&s){var d=De(c).hoistableScripts,p=xl(s),y=d.get(p);y||(y=c.querySelector(Ru(p)),y||(s=V({src:s,async:!0},o),(o=wi.get(p))&&Jm(s,o),y=c.createElement("script"),be(y),Tr(y,"link",s),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(p,y))}}function CN(s,o){Ls.M(s,o);var c=Al;if(c&&s){var d=De(c).hoistableScripts,p=xl(s),y=d.get(p);y||(y=c.querySelector(Ru(p)),y||(s=V({src:s,async:!0,type:"module"},o),(o=wi.get(p))&&Jm(s,o),y=c.createElement("script"),be(y),Tr(y,"link",s),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(p,y))}}function wE(s,o,c,d){var p=(p=_e.current)?$d(p):null;if(!p)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(o=Rl(c.href),c=De(p).hoistableStyles,d=c.get(o),d||(d={type:"style",instance:null,count:0,state:null},c.set(o,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Rl(c.href);var y=De(p).hoistableStyles,R=y.get(s);if(R||(p=p.ownerDocument||p,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(s,R),(y=p.querySelector(Au(s)))&&!y._p&&(R.instance=y,R.state.loading=5),wi.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},wi.set(s,c),y||AN(p,s,c,R.state))),o&&d===null)throw Error(r(528,""));return R}if(o&&d!==null)throw Error(r(529,""));return null;case"script":return o=c.async,c=c.src,typeof c=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=xl(c),c=De(p).hoistableScripts,d=c.get(o),d||(d={type:"script",instance:null,count:0,state:null},c.set(o,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Rl(s){return'href="'+nn(s)+'"'}function Au(s){return'link[rel="stylesheet"]['+s+"]"}function TE(s){return V({},s,{"data-precedence":s.precedence,precedence:null})}function AN(s,o,c,d){s.querySelector('link[rel="preload"][as="style"]['+o+"]")?d.loading=1:(o=s.createElement("link"),d.preload=o,o.addEventListener("load",function(){return d.loading|=1}),o.addEventListener("error",function(){return d.loading|=2}),Tr(o,"link",c),be(o),s.head.appendChild(o))}function xl(s){return'[src="'+nn(s)+'"]'}function Ru(s){return"script[async]"+s}function CE(s,o,c){if(o.count++,o.instance===null)switch(o.type){case"style":var d=s.querySelector('style[data-href~="'+nn(c.href)+'"]');if(d)return o.instance=d,be(d),d;var p=V({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),be(d),Tr(d,"style",p),Vd(d,c.precedence,s),o.instance=d;case"stylesheet":p=Rl(c.href);var y=s.querySelector(Au(p));if(y)return o.state.loading|=4,o.instance=y,be(y),y;d=TE(c),(p=wi.get(p))&&Gm(d,p),y=(s.ownerDocument||s).createElement("link"),be(y);var R=y;return R._p=new Promise(function(I,H){R.onload=I,R.onerror=H}),Tr(y,"link",d),o.state.loading|=4,Vd(y,c.precedence,s),o.instance=y;case"script":return y=xl(c.src),(p=s.querySelector(Ru(y)))?(o.instance=p,be(p),p):(d=c,(p=wi.get(y))&&(d=V({},c),Jm(d,p)),s=s.ownerDocument||s,p=s.createElement("script"),be(p),Tr(p,"link",d),s.head.appendChild(p),o.instance=p);case"void":return null;default:throw Error(r(443,o.type))}else o.type==="stylesheet"&&!(o.state.loading&4)&&(d=o.instance,o.state.loading|=4,Vd(d,c.precedence,s));return o.instance}function Vd(s,o,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=d.length?d[d.length-1]:null,y=p,R=0;R title"):null)}function RN(s,o,c){if(c===1||o.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return s=o.disabled,typeof o.precedence=="string"&&s==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function xE(s){return!(s.type==="stylesheet"&&!(s.state.loading&3))}var xu=null;function xN(){}function MN(s,o,c){if(xu===null)throw Error(r(475));var d=xu;if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&!(o.state.loading&4)){if(o.instance===null){var p=Rl(c.href),y=s.querySelector(Au(p));if(y){s=y._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(d.count++,d=jd.bind(d),s.then(d,d)),o.state.loading|=4,o.instance=y,be(y);return}y=s.ownerDocument||s,c=TE(c),(p=wi.get(p))&&Gm(c,p),y=y.createElement("link"),be(y);var R=y;R._p=new Promise(function(I,H){R.onload=I,R.onerror=H}),Tr(y,"link",c),o.instance=y}d.stylesheets===null&&(d.stylesheets=new Map),d.stylesheets.set(o,s),(s=o.state.preload)&&!(o.state.loading&3)&&(d.count++,o=jd.bind(d),s.addEventListener("load",o),s.addEventListener("error",o))}}function ON(){if(xu===null)throw Error(r(475));var s=xu;return s.stylesheets&&s.count===0&&ev(s,s.stylesheets),0"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),fv.exports=II(),fv.exports}var FI=DI();function zh(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const Ay=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),lw=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);lw&&parseFloat(lw[1]);const th=globalThis,Ml=globalThis.process||{},kI=globalThis.navigator||{};function GA(t){var r,i;if(typeof window<"u"&&((r=window.process)==null?void 0:r.type)==="renderer"||typeof process<"u"&&((i=process.versions)!=null&&i.electron))return!0;const n=typeof navigator<"u"&&navigator.userAgent;return!!(n&&n.indexOf("Electron")>=0)}function Ho(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||GA()}function BI(t){return Ho()?GA()?"Electron":(kI.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const JA="4.1.0";function UI(t){try{const e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch{return null}}class LI{constructor(e,n,r="sessionStorage"){this.storage=UI(r),this.id=e,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let e={};if(this.storage){const n=this.storage.getItem(this.id);e=n?JSON.parse(n):{}}return Object.assign(this.config,e),this}}function zI(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function $I(t,e=8){const n=Math.max(e-t.length,0);return`${" ".repeat(n)}${t}`}var $h;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})($h||($h={}));const VI=10;function cw(t){return typeof t!="string"?t:(t=t.toUpperCase(),$h[t]||$h.WHITE)}function HI(t,e,n){return!Ho&&typeof t=="string"&&(e&&(t=`\x1B[${cw(e)}m${t}\x1B[39m`),n&&(t=`\x1B[${cw(n)+VI}m${t}\x1B[49m`)),t}function jI(t,e=["constructor"]){const n=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(n),i=t;for(const a of r){const l=i[a];typeof l=="function"&&(e.find(u=>a===u)||(i[a]=l.bind(t)))}}function Ry(t,e){if(!t)throw new Error("Assertion failed")}function Ol(){var e,n,r;let t;if(Ho()&&th.performance)t=(n=(e=th==null?void 0:th.performance)==null?void 0:e.now)==null?void 0:n.call(e);else if("hrtime"in Ml){const i=(r=Ml==null?void 0:Ml.hrtime)==null?void 0:r.call(Ml);t=i[0]*1e3+i[1]/1e6}else t=Date.now();return t}const Pl={debug:Ho()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},WI={enabled:!0,level:0};function Nl(){}const uw={},fw={once:!0};class Lf{constructor({id:e}={id:""}){this.VERSION=JA,this._startTs=Ol(),this._deltaTs=Ol(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new LI(`__probe-${this.id}__`,WI),this.timeStamp(`${this.id} started`),jI(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Ol()-this._startTs).toPrecision(10))}getDelta(){return Number((Ol()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,n){this._storage.setConfiguration({[e]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,n){if(!e)throw new Error(n||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Pl.warn,arguments,fw)}error(e){return this._getLogFunction(0,e,Pl.error,arguments)}deprecated(e,n){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(e,n){return this.error(`\`${e}\` has been removed. Use \`${n}\` instead`)}probe(e,n){return this._getLogFunction(e,n,Pl.log,arguments,{time:!0,once:!0})}log(e,n){return this._getLogFunction(e,n,Pl.debug,arguments)}info(e,n){return this._getLogFunction(e,n,console.info,arguments)}once(e,n){return this._getLogFunction(e,n,Pl.debug||Pl.info,arguments,fw)}table(e,n,r){return n?this._getLogFunction(e,n,console.table||Nl,r&&[r],{tag:qI(n)}):Nl}time(e,n){return this._getLogFunction(e,n,console.time?console.time:console.info)}timeEnd(e,n){return this._getLogFunction(e,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,n){return this._getLogFunction(e,n,console.timeStamp||Nl)}group(e,n,r={collapsed:!1}){const i=dw({logLevel:e,message:n,opts:r}),{collapsed:a}=r;return i.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,n,r={}){return this.group(e,n,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Nl)}withGroup(e,n,r){this.group(e,n)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=eR(e)}_getLogFunction(e,n,r,i,a){if(this._shouldLog(e)){a=dw({logLevel:e,message:n,args:i,opts:a}),r=r||a.method,Ry(r),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=Ol();const l=a.tag||a.message;if(a.once&&l)if(!uw[l])uw[l]=Ol();else return Nl;return n=XI(this.id,a.message,a),r.bind(console,n,...a.args)}return Nl}}Lf.VERSION=JA;function eR(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Ry(Number.isFinite(e)&&e>=0),e}function dw(t){const{logLevel:e,message:n}=t;t.logLevel=eR(e);const r=t.args?Array.from(t.args):[];for(;r.length&&r.shift()!==n;);switch(typeof e){case"string":case"function":n!==void 0&&r.unshift(n),t.message=e;break;case"object":Object.assign(t,e);break}typeof t.message=="function"&&(t.message=t.message());const i=typeof t.message;return Ry(i==="string"||i==="object"),Object.assign(t,{args:r},t.opts)}function XI(t,e,n){if(typeof e=="string"){const r=n.time?$I(zI(n.total)):"";e=n.time?`${t}: ${r} ${e}`:`${t}: ${e}`,e=HI(e,n.color,n.background)}return e}function qI(t){for(const e in t)for(const n in t[e])return n||"untitled";return"empty"}const pv="4.3.2",YI=pv[0]>="0"&&pv[0]<="9"?`v${pv}`:"";function KI(){const t=new Lf({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=t,globalThis.loaders.version=YI,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=t,t}const ZI=KI();function QI(t,e){return tR(t||{},e)}function tR(t,e,n=0){if(n>3)return e;const r={...t};for(const[i,a]of Object.entries(e))a&&typeof a=="object"&&!Array.isArray(a)?r[i]=tR(r[i]||{},e[i],n+1):r[i]=e[i];return r}const GI="latest";function JI(){var t;return(t=globalThis._loadersgl_)!=null&&t.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.2"),globalThis._loadersgl_.version}const e6=JI();function La(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const Po=typeof process!="object"||String(process)!=="[object process]"||process.browser,t6=typeof window<"u"&&typeof window.orientation<"u",hw=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);hw&&parseFloat(hw[1]);class n6{constructor(e,n){M(this,"name");M(this,"workerThread");M(this,"isRunning",!0);M(this,"result");M(this,"_resolve",()=>{});M(this,"_reject",()=>{});this.name=e,this.workerThread=n,this.result=new Promise((r,i)=>{this._resolve=r,this._reject=i})}postMessage(e,n){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:n})}done(e){La(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){La(this.isRunning),this.isRunning=!1,this._reject(e)}}class mv{terminate(){}}const vv=new Map;function r6(t){La(t.source&&!t.url||!t.source&&t.url);let e=vv.get(t.source||t.url);return e||(t.url&&(e=i6(t.url),vv.set(t.url,e)),t.source&&(e=nR(t.source),vv.set(t.source,e))),La(e),e}function i6(t){if(!t.startsWith("http"))return t;const e=s6(t);return nR(e)}function nR(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function s6(t){return`try { + importScripts('${t}'); +} catch (error) { + console.error(error); + throw error; +}`}function rR(t,e=!0,n){const r=n||new Set;if(t){if(gw(t))r.add(t);else if(gw(t.buffer))r.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(const i in t)rR(t[i],e,r)}}return n===void 0?Array.from(r):[]}function gw(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}const _v=()=>{};class O0{constructor(e){M(this,"name");M(this,"source");M(this,"url");M(this,"terminated",!1);M(this,"worker");M(this,"onMessage");M(this,"onError");M(this,"_loadableURL","");const{name:n,source:r,url:i}=e;La(r||i),this.name=n,this.source=r,this.url=i,this.onMessage=_v,this.onError=a=>console.log(a),this.worker=Po?this._createBrowserWorker():this._createNodeWorker()}static isSupported(){return typeof Worker<"u"&&Po||typeof mv<"u"&&!Po}destroy(){this.onMessage=_v,this.onError=_v,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,n){n=n||rR(e),this.worker.postMessage(e,n)}_getErrorFromErrorEvent(e){let n="Failed to load ";return n+=`worker ${this.name} from ${this.url}. `,e.message&&(n+=`${e.message} in `),e.lineno&&(n+=`:${e.lineno}:${e.colno}`),new Error(n)}_createBrowserWorker(){this._loadableURL=r6({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=n=>{n.data?this.onMessage(n.data):this.onError(new Error("No data received"))},e.onerror=n=>{this.onError(this._getErrorFromErrorEvent(n)),this.terminated=!0},e.onmessageerror=n=>console.error(n),e}_createNodeWorker(){let e;if(this.url){const r=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new mv(r,{eval:!1})}else if(this.source)e=new mv(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",n=>{this.onMessage(n)}),e.on("error",n=>{this.onError(n)}),e.on("exit",n=>{}),e}}class a6{constructor(e){M(this,"name","unnamed");M(this,"source");M(this,"url");M(this,"maxConcurrency",1);M(this,"maxMobileConcurrency",1);M(this,"onDebug",()=>{});M(this,"reuseWorkers",!0);M(this,"props",{});M(this,"jobQueue",[]);M(this,"idleQueue",[]);M(this,"count",0);M(this,"isDestroyed",!1);this.source=e.source,this.url=e.url,this.setProps(e)}static isSupported(){return O0.isSupported()}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,n=(i,a,l)=>i.done(l),r=(i,a)=>i.error(a)){const i=new Promise(a=>(this.jobQueue.push({name:e,onMessage:n,onError:r,onStart:a}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const n=this.jobQueue.shift();if(n){this.onDebug({message:"Starting job",name:n.name,workerThread:e,backlog:this.jobQueue.length});const r=new n6(n.name,e);e.onMessage=i=>n.onMessage(r,i.type,i.payload),e.onError=i=>n.onError(r,i),n.onStart(r);try{await r.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Po||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}},wa=class wa{constructor(e){M(this,"props");M(this,"workerPools",new Map);this.props={...o6},this.setProps(e),this.workerPools=new Map}static isSupported(){return O0.isSupported()}static getWorkerFarm(e={}){return wa._workerFarm=wa._workerFarm||new wa({}),wa._workerFarm.setProps(e),wa._workerFarm}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const n of this.workerPools.values())n.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:n,source:r,url:i}=e;let a=this.workerPools.get(n);return a||(a=new a6({name:n,source:r,url:i}),a.setProps(this._getWorkerPoolProps()),this.workerPools.set(n,a)),a}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};M(wa,"_workerFarm");let Vh=wa;function l6(t,e={}){const n=e[t.id]||{},r=Po?`${t.id}-worker.js`:`${t.id}-worker-node.js`;let i=n.workerUrl;if(!i&&t.id==="compression"&&(i=e.workerUrl),e._workerType==="test"&&(Po?i=`modules/${t.module}/dist/${r}`:i=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!i){let a=t.version;a==="latest"&&(a=GI);const l=a?`@${a}`:"";i=`https://unpkg.com/@loaders.gl/${t.module}${l}/dist/${r}`}return La(i),i}function c6(t,e=e6){La(t,"no worker provided");const n=t.version;return!(!e||!n)}function u6(t,e){return!Vh.isSupported()||!Po&&!(e!=null&&e._nodeWorkers)?!1:t.worker&&(e==null?void 0:e.worker)}async function f6(t,e,n,r,i){const a=t.id,l=l6(t,n),f=Vh.getWorkerFarm(n).getWorkerPool({name:a,url:l});n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r||{}));const h=await f.startJob("process-on-worker",d6.bind(null,i));return h.postMessage("process",{input:e,options:n,context:r}),await(await h.result).result}async function d6(t,e,n,r){switch(n){case"done":e.done(r);break;case"error":e.error(new Error(r.error));break;case"process":const{id:i,input:a,options:l}=r;try{const u=await t(a,l);e.postMessage("done",{id:i,result:u})}catch(u){const f=u instanceof Error?u.message:"unknown error";e.postMessage("error",{id:i,error:f})}break;default:console.warn(`parse-with-worker unknown message ${n}`)}}function h6(t,e,n){if(n=n||t.byteLength,t.byteLengtha instanceof ArrayBuffer?new Uint8Array(a):a),n=e.reduce((a,l)=>a+l.byteLength,0),r=new Uint8Array(n);let i=0;for(const a of e)r.set(a,i),i+=a.byteLength;return r.buffer}async function m6(t){const e=[];for await(const n of t)e.push(n);return g6(...e)}function pw(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}class mw{constructor(e,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=pw(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(pw()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class qg{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,n="count"){return this._getOrCreate({name:e,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(const e of Object.values(this.stats))e.reset();return this}forEach(e){for(const n of Object.values(this.stats))e(n)}getTable(){const e={};return this.forEach(n=>{e[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(n=>this._getOrCreate(n))}_getOrCreate(e){const{name:n,type:r}=e;let i=this.stats[n];return i||(e instanceof mw?i=e:i=new mw(n,r),this.stats[n]=i),i}}let v6="";const vw={};function _6(t){for(const e in vw)if(t.startsWith(e)){const n=vw[e];t=t.replace(e,n)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${v6}${t}`),t}function y6(t){return t&&typeof t=="object"&&t.isBuffer}function iR(t){if(y6(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){const e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function sR(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function b6(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}const S6=t=>typeof t=="boolean",Qu=t=>typeof t=="function",zf=t=>t!==null&&typeof t=="object",_w=t=>zf(t)&&t.constructor==={}.constructor,E6=t=>!!t&&typeof t[Symbol.iterator]=="function",w6=t=>t&&typeof t[Symbol.asyncIterator]=="function",jo=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,Wo=t=>typeof Blob<"u"&&t instanceof Blob,T6=t=>t&&typeof t=="object"&&t.isBuffer,C6=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||zf(t)&&Qu(t.tee)&&Qu(t.cancel)&&Qu(t.getReader),A6=t=>zf(t)&&Qu(t.read)&&Qu(t.pipe)&&S6(t.readable),aR=t=>C6(t)||A6(t);class R6 extends Error{constructor(n,r){super(n);M(this,"reason");M(this,"url");M(this,"response");this.reason=r.reason,this.url=r.url,this.response=r.response}}const x6=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,M6=/^([-\w.]+\/[-\w.+]+)/;function yw(t,e){return t.toLowerCase()===e.toLowerCase()}function O6(t){const e=M6.exec(t);return e?e[1]:t}function bw(t){const e=x6.exec(t);return e?e[1]:""}const oR=/\?.*/;function P6(t){const e=t.match(oR);return e&&e[0]}function xy(t){return t.replace(oR,"")}function N6(t){if(t.length<50)return t;const e=t.slice(t.length-15);return`${t.substr(0,32)}...${e}`}function Yg(t){return jo(t)?t.url:Wo(t)?t.name||"":typeof t=="string"?t:""}function My(t){if(jo(t)){const e=t,n=e.headers.get("content-type")||"",r=xy(e.url);return O6(n)||bw(r)}return Wo(t)?t.type||"":typeof t=="string"?bw(t):""}function I6(t){return jo(t)?t.headers["content-length"]||-1:Wo(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function lR(t){if(jo(t))return t;const e={},n=I6(t);n>=0&&(e["content-length"]=String(n));const r=Yg(t),i=My(t);i&&(e["content-type"]=i);const a=await k6(t);a&&(e["x-first-bytes"]=a),typeof t=="string"&&(t=new TextEncoder().encode(t));const l=new Response(t,{headers:e});return Object.defineProperty(l,"url",{value:r}),l}async function D6(t){if(!t.ok)throw await F6(t)}async function F6(t){const e=N6(t.url);let n=`Failed to fetch resource (${t.status}) ${t.statusText}: ${e}`;n=n.length>100?`${n.slice(0,100)}...`:n;const r={reason:t.statusText,url:t.url,response:t};try{const i=t.headers.get("Content-Type");r.reason=!t.bodyUsed&&(i!=null&&i.includes("application/json"))?await t.json():await t.text()}catch{}return new R6(n,r)}async function k6(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){const n=t.slice(0,5);return await new Promise(r=>{const i=new FileReader;i.onload=a=>{var l;return r((l=a==null?void 0:a.target)==null?void 0:l.result)},i.readAsDataURL(n)})}if(t instanceof ArrayBuffer){const n=t.slice(0,5);return`data:base64,${B6(n)}`}return null}function B6(t){let e="";const n=new Uint8Array(t);for(let r=0;r{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}class V6{constructor(){M(this,"console");this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}}const cR={fetch:null,mimeType:void 0,nothrow:!1,log:new V6,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Ay,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},H6={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function uR(){globalThis.loaders=globalThis.loaders||{};const{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function fR(){const t=uR();return t.globalOptions=t.globalOptions||{...cR},t.globalOptions}function j6(t,e,n,r){return n=n||[],n=Array.isArray(n)?n:[n],W6(t,n),q6(e,t,r)}function W6(t,e){ww(t,null,cR,H6,e);for(const n of e){const r=t&&t[n.id]||{},i=n.options&&n.options[n.id]||{},a=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};ww(r,n.id,i,a,e)}}function ww(t,e,n,r,i){const a=e||"Top level",l=e?`${e}.`:"";for(const u in t){const f=!e&&zf(t[u]),h=u==="baseUri"&&!e,g=u==="workerUrl"&&e;if(!(u in n)&&!h&&!g){if(u in r)Ew.warn(`${a} loader option '${l}${u}' no longer supported, use '${r[u]}'`)();else if(!f){const m=X6(u,i);Ew.warn(`${a} loader option '${l}${u}' not recognized. ${m}`)()}}}}function X6(t,e){const n=t.toLowerCase();let r="";for(const i of e)for(const a in i.options){if(t===a)return`Did you mean '${i.id}.${a}'?`;const l=a.toLowerCase();(n.startsWith(l)||l.startsWith(n))&&(r=r||`Did you mean '${i.id}.${a}'?`)}return r}function q6(t,e,n){const i={...t.options||{}};return Y6(i,n),i.log===null&&(i.log=new $6),Tw(i,fR()),Tw(i,e),i}function Tw(t,e){for(const n in e)if(n in e){const r=e[n];_w(r)&&_w(t[n])?t[n]={...t[n],...e[n]}:t[n]=e[n]}}function Y6(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function Oy(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t==null?void 0:t.extensions)):!1}function Py(t){zh(t,"null loader"),zh(Oy(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t!=null&&t.parseTextSync||t!=null&&t.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}const dR=()=>{const t=uR();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function K6(t){const e=dR();t=Array.isArray(t)?t:[t];for(const n of t){const r=Py(n);e.find(i=>r===i)||e.unshift(r)}}function Z6(){return dR()}const Q6=/\.([^.]+)$/;async function G6(t,e=[],n,r){if(!hR(t))return null;let i=Cw(t,e,{...n,nothrow:!0},r);if(i)return i;if(Wo(t)&&(t=await t.slice(0,10).arrayBuffer(),i=Cw(t,e,n,r)),!i&&!(n!=null&&n.nothrow))throw new Error(gR(t));return i}function Cw(t,e=[],n,r){if(!hR(t))return null;if(e&&!Array.isArray(e))return Py(e);let i=[];e&&(i=i.concat(e)),n!=null&&n.ignoreRegisteredLoaders||i.push(...Z6()),eD(i);const a=J6(t,i,n,r);if(!a&&!(n!=null&&n.nothrow))throw new Error(gR(t));return a}function J6(t,e,n,r){const i=Yg(t),a=My(t),l=xy(i)||(r==null?void 0:r.url);let u=null,f="";return n!=null&&n.mimeType&&(u=yv(e,n==null?void 0:n.mimeType),f=`match forced by supplied MIME type ${n==null?void 0:n.mimeType}`),u=u||tD(e,l),f=f||(u?`matched url ${l}`:""),u=u||yv(e,a),f=f||(u?`matched MIME type ${a}`:""),u=u||rD(e,t),f=f||(u?`matched initial data ${pR(t)}`:""),n!=null&&n.fallbackMimeType&&(u=u||yv(e,n==null?void 0:n.fallbackMimeType),f=f||(u?`matched fallback MIME type ${a}`:"")),f&&ZI.log(1,`selectLoader selected ${u==null?void 0:u.name}: ${f}.`),u}function hR(t){return!(t instanceof Response&&t.status===204)}function gR(t){const e=Yg(t),n=My(t);let r="No valid loader found (";r+=e?`${sR(e)}, `:"no url provided, ",r+=`MIME type: ${n?`"${n}"`:"not provided"}, `;const i=t?pR(t):"";return r+=i?` first bytes: "${i}"`:"first bytes: not available",r+=")",r}function eD(t){for(const e of t)Py(e)}function tD(t,e){const n=e&&Q6.exec(e),r=n&&n[1];return r?nD(t,r):null}function nD(t,e){e=e.toLowerCase();for(const n of t)for(const r of n.extensions)if(r.toLowerCase()===e)return n;return null}function yv(t,e){var n;for(const r of t)if((n=r.mimeTypes)!=null&&n.some(i=>yw(e,i))||yw(e,`application/x.${r.id}`))return r;return null}function rD(t,e){if(!e)return null;for(const n of t)if(typeof e=="string"){if(iD(e,n))return n}else if(ArrayBuffer.isView(e)){if(Aw(e.buffer,e.byteOffset,n))return n}else if(e instanceof ArrayBuffer&&Aw(e,0,n))return n;return null}function iD(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(r=>t.startsWith(r))}function Aw(t,e,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some(i=>sD(t,e,n,i))}function sD(t,e,n,r){if(r instanceof ArrayBuffer)return h6(r,t,r.byteLength);switch(typeof r){case"function":return r(t);case"string":const i=P0(t,e,r.length);return r===i;default:return!1}}function pR(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?P0(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?P0(t,0,e):""}function P0(t,e,n){if(t.byteLengthSw(i,r.fetch):e!=null&&e.fetch?e==null?void 0:e.fetch:Sw}function vD(t,e,n){if(n)return n;const r={fetch:vR(e,t),...t};if(r.url){const i=xy(r.url);r.baseUrl=i,r.queryString=P6(r.url),r.filename=sR(i),r.baseUrl=b6(i)}return Array.isArray(r.loaders)||(r.loaders=null),r}function _D(t,e){if(t&&!Array.isArray(t))return t;let n;if(t&&(n=Array.isArray(t)?t:[t]),e&&e.loaders){const r=Array.isArray(e.loaders)?e.loaders:[e.loaders];n=n?[...n,...r]:r}return n&&n.length?n:void 0}async function Hh(t,e,n,r){e&&!Array.isArray(e)&&!Oy(e)&&(r=void 0,n=e,e=void 0),t=await t,n=n||{};const i=Yg(t),l=_D(e,r),u=await G6(t,l,n);return u?(n=j6(n,u,l,i),r=vD({url:i,_parse:Hh,loaders:l},n,r||null),await yD(u,t,n,r)):null}async function yD(t,e,n,r){if(c6(t),n=QI(t.options,n),jo(e)){const a=e,{ok:l,redirected:u,status:f,statusText:h,type:g,url:m}=a,v=Object.fromEntries(a.headers.entries());r.response={headers:v,ok:l,redirected:u,status:f,statusText:h,type:g,url:m}}e=await mD(e,t,n);const i=t;if(i.parseTextSync&&typeof e=="string")return i.parseTextSync(e,n,r);if(u6(t,n))return await f6(t,e,n,r,Hh);if(i.parseText&&typeof e=="string")return await i.parseText(e,n,r);if(i.parse)return await i.parse(e,n,r);throw La(!i.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}const xw=100;class bD{constructor(e,n){M(this,"schema");M(this,"options");M(this,"shape");M(this,"length",0);M(this,"rows",null);M(this,"cursor",0);M(this,"_headers",[]);if(this.options=n,this.schema=e,!Array.isArray(e)){this._headers=[];for(const r in e)this._headers[e[r].index]=e[r].name}}rowCount(){return this.length}addArrayRow(e,n){Number.isFinite(n)&&(this.cursor=n),this.shape="array-row-table",this.rows=this.rows||new Array(xw),this.rows[this.length]=e,this.length++}addObjectRow(e,n){Number.isFinite(n)&&(this.cursor=n),this.shape="object-row-table",this.rows=this.rows||new Array(xw),this.rows[this.length]=e,this.length++}getBatch(){let e=this.rows;return e?(e=e.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}}function _R(t,e){if(!t)throw new Error("null row");const n={};if(e)for(let r=0;r0?this.allocated*=2:TD,this.columns={};for(const e in this.schema){const n=this.schema[e],r=n.type||Float32Array,i=this.columns[n.index];if(i&&ArrayBuffer.isView(i)){const a=new r(this.allocated);a.set(i),this.columns[n.index]=a}else i?(i.length=this.allocated,this.columns[n.index]=i):this.columns[n.index]=new r(this.allocated)}}}_pruneColumns(){for(const[e,n]of Object.entries(this.columns))this.columns[e]=n.slice(0,this.length)}}const AD={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},RD="TableBatchBuilder",cf=class cf{constructor(e,n){M(this,"schema");M(this,"options");M(this,"aggregator",null);M(this,"batchCount",0);M(this,"bytesUsed",0);M(this,"isChunkComplete",!1);M(this,"lastBatchEmittedMs",Date.now());M(this,"totalLength",0);M(this,"totalBytes",0);M(this,"rowBytes",0);this.schema=e,this.options={...AD,...n}}limitReached(){var e,n;return!!((e=this.options)!=null&&e.limit&&this.totalLength>=this.options.limit||(n=this.options)!=null&&n._limitMB&&this.totalBytes/1e6>=this.options._limitMB)}addRow(e){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(e),this.totalBytes+=this.rowBytes,Array.isArray(e)?this.addArrayRow(e):this.addObjectRow(e))}addArrayRow(e){if(!this.aggregator){const n=this._getTableBatchType();this.aggregator=new n(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){const n=this._getTableBatchType();this.aggregator=new n(this.schema,this.options)}this.aggregator.addObjectRow(e)}chunkComplete(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),typeof e=="string"&&(this.bytesUsed+=e.length),this.isChunkComplete=!0}getFullBatch(e){return this._isFull()?this._getBatch(e):null}getFinalBatch(e){return this._getBatch(e)}_estimateRowMB(e){return Array.isArray(e)?e.length*8:Object.keys(e).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(e){if(!this.aggregator)return null;e!=null&&e.bytesUsed&&(this.bytesUsed=e.bytesUsed);const n=this.aggregator.getBatch();return n.count=this.batchCount,n.bytesUsed=this.bytesUsed,Object.assign(n,e),this.batchCount++,this.aggregator=null,n}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return wD;case"columnar-table":return CD;case"arrow-table":if(!cf.ArrowBatch)throw new Error(RD);return cf.ArrowBatch;default:return bD}}};M(cf,"ArrowBatch");let N0=cf;class Ow extends Array{enqueue(e){return this.push(e)}dequeue(){return this.shift()}}class xD{constructor(){M(this,"_values");M(this,"_settlers");M(this,"_closed");this._values=new Ow,this._settlers=new Ow,this._closed=!1}close(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}[Symbol.asyncIterator](){return this}enqueue(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");const n=this._settlers.dequeue();e instanceof Error?n.reject(e):n.resolve({value:e})}else this._values.enqueue(e)}next(){if(this._values.length>0){const e=this._values.dequeue();return e instanceof Error?Promise.reject(e):Promise.resolve({value:e})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((e,n)=>{this._settlers.enqueue({resolve:e,reject:n})})}}async function jh(t,e,n,r){let i,a;!Array.isArray(e)&&!Oy(e)?(i=[],a=e):(i=e,a=n);const l=vR(a);let u=t;return typeof t=="string"&&(u=await l(t)),Wo(t)&&(u=await l(t)),Array.isArray(i)?await Hh(u,i,a):await Hh(u,i,a)}/* @license +Papa Parse +v5.0.0-beta.0 +https://github.com/mholt/PapaParse +License: MIT +*/const Pw="\uFEFF";function MD(t,e={},n=PD){e=e||{};var r=e.dynamicTyping||!1;Zi(r)&&(e.dynamicTypingFunction=r,r={}),e.dynamicTyping=r,e.transform=Zi(e.transform)?e.transform:!1;var i=new n(e);return i.stream(t)}function OD(t,e){var n=!1,r=!0,i=",",a=`\r +`,l='"',u=l+l,f=!1,h=null;m();var g=new RegExp(gf(l),"g");if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return v(null,t,f);if(typeof t[0]=="object")return v(h||Object.keys(t[0]),t,f)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:Object.keys(t.data[0])),!Array.isArray(t.data[0])&&typeof t.data[0]!="object"&&(t.data=[t.data])),v(t.fields||[],t.data||[],f);throw new Error("Unable to serialize unrecognized input");function m(){if(typeof e=="object"){if(typeof e.delimiter=="string"&&!Mi.BAD_DELIMITERS.filter(function(E){return e.delimiter.indexOf(E)!==-1}).length&&(i=e.delimiter),(typeof e.quotes=="boolean"||Array.isArray(e.quotes))&&(n=e.quotes),(typeof e.skipEmptyLines=="boolean"||typeof e.skipEmptyLines=="string")&&(f=e.skipEmptyLines),typeof e.newline=="string"&&(a=e.newline),typeof e.quoteChar=="string"&&(l=e.quoteChar),typeof e.header=="boolean"&&(r=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");h=e.columns}e.escapeChar!==void 0&&(u=e.escapeChar+l)}}function v(E,b,C){var T="";typeof E=="string"&&(E=JSON.parse(E)),typeof b=="string"&&(b=JSON.parse(b));var A=Array.isArray(E)&&E.length>0,O=!Array.isArray(b[0]);if(A&&r){for(var x=0;x0&&(T+=i),T+=S(E[x],x);b.length>0&&(T+=a)}for(var N=0;N0&&!D&&(T+=i);var Y=A&&O?E[X]:X;T+=S(b[N][Y],X)}N0&&!D)&&(T+=a)}}return T}function S(E,b){if(typeof E>"u"||E===null)return"";if(E.constructor===Date)return JSON.stringify(E).slice(1,25);E=E.toString().replace(g,u);var C=typeof n=="boolean"&&n||Array.isArray(n)&&n[b]||w(E,Mi.BAD_DELIMITERS)||E.indexOf(i)>-1||E.charAt(0)===" "||E.charAt(E.length-1)===" ";return C?l+E+l:E}function w(E,b){for(var C=0;C-1)return!0;return!1}}let bR=class{constructor(e){M(this,"_handle");M(this,"_config");M(this,"_finished",!1);M(this,"_completed",!1);M(this,"_input",null);M(this,"_baseIndex",0);M(this,"_partialLine","");M(this,"_rowCount",0);M(this,"_start",0);M(this,"isFirstChunk",!0);M(this,"_completeResults",{data:[],errors:[],meta:{}});var n={...e};n.chunkSize=parseInt(n.chunkSize),!e.step&&!e.chunk&&(n.chunkSize=null),this._handle=new SR(n),this._handle.streamer=this,this._config=n}parseChunk(e,n){if(this.isFirstChunk&&Zi(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(e);r!==void 0&&(e=r)}this.isFirstChunk=!1;var i=this._partialLine+e;this._partialLine="";var a=this._handle.parse(i,this._baseIndex,!this._finished);if(!(this._handle.paused()||this._handle.aborted())){var l=a.meta.cursor;this._finished||(this._partialLine=i.substring(l-this._baseIndex),this._baseIndex=l),a&&a.data&&(this._rowCount+=a.data.length);var u=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(Zi(this._config.chunk)&&!n){if(this._config.chunk(a,this._handle),this._handle.paused()||this._handle.aborted())return;a=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(a.data),this._completeResults.errors=this._completeResults.errors.concat(a.errors),this._completeResults.meta=a.meta),!this._completed&&u&&Zi(this._config.complete)&&(!a||!a.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),a}}_sendError(e){Zi(this._config.error)&&this._config.error(e)}};class PD extends bR{constructor(n={}){super(n);M(this,"remaining")}stream(n){return this.remaining=n,this._nextChunk()}_nextChunk(){if(!this._finished){var n=this._config.chunkSize,r=n?this.remaining.substr(0,n):this.remaining;return this.remaining=n?this.remaining.substr(n):"",this._finished=!this.remaining,this.parseChunk(r)}}}const ND=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,ID=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/;class SR{constructor(e){M(this,"_config");M(this,"_stepCounter",0);M(this,"_rowCounter",0);M(this,"_input");M(this,"_parser");M(this,"_paused",!1);M(this,"_aborted",!1);M(this,"_delimiterError",!1);M(this,"_fields",[]);M(this,"_results",{data:[],errors:[],meta:{}});if(Zi(e.step)){var n=e.step;e.step=r=>{if(this._results=r,this.needsHeaderRow())this.processResults();else{if(this.processResults(),!this._results.data||this._results.data.length===0)return;this._stepCounter+=r.data.length,e.preview&&this._stepCounter>e.preview?this._parser.abort():n(this._results,this)}}}this._config=e}parse(e,n,r){var i=this._config.quoteChar||'"';if(this._config.newline||(this._config.newline=DD(e,i)),this._delimiterError=!1,this._config.delimiter)Zi(this._config.delimiter)&&(this._config.delimiter=this._config.delimiter(e),this._results.meta.delimiter=this._config.delimiter);else{var a=this.guessDelimiter(e,this._config.newline,this._config.skipEmptyLines,this._config.comments,this._config.delimitersToGuess);a.successful?this._config.delimiter=a.bestDelimiter:(this._delimiterError=!0,this._config.delimiter=Mi.DefaultDelimiter),this._results.meta.delimiter=this._config.delimiter}var l=ER(this._config);return this._config.preview&&this._config.header&&l.preview++,this._input=e,this._parser=new I0(l),this._results=this._parser.parse(this._input,n,r),this.processResults(),this._paused?{meta:{paused:!0}}:this._results||{meta:{paused:!1}}}paused(){return this._paused}pause(){this._paused=!0,this._parser.abort(),this._input=this._input.substr(this._parser.getCharIndex())}resume(){this._paused=!1,this.streamer.parseChunk(this._input,!0)}aborted(){return this._aborted}abort(){this._aborted=!0,this._parser.abort(),this._results.meta.aborted=!0,Zi(this._config.complete)&&this._config.complete(this._results),this._input=""}testEmptyLine(e){return this._config.skipEmptyLines==="greedy"?e.join("").trim()==="":e.length===1&&e[0].length===0}processResults(){if(this._results&&this._delimiterError&&(this.addError("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+Mi.DefaultDelimiter+"'"),this._delimiterError=!1),this._config.skipEmptyLines)for(var e=0;e{Zi(this._config.transformHeader)&&(r=this._config.transformHeader(r)),this._fields.push(r)};if(Array.isArray(this._results.data[0])){for(var n=0;this.needsHeaderRow()&&n=this._fields.length?"__parsed_extra":this._fields[i]),this._config.transform&&(l=this._config.transform(l,a)),l=this.parseDynamic(a,l),a==="__parsed_extra"?(r[a]=r[a]||[],r[a].push(l)):r[a]=l}return this._config.header&&(i>this._fields.length?this.addError("FieldMismatch","TooManyFields","Too many fields: expected "+this._fields.length+" fields but parsed "+i,this._rowCounter+n):i"u"){f=0;continue}else b>1&&(m+=Math.abs(b-f),f=b)}w.data.length>0&&(v/=w.data.length-S),(typeof u>"u"||m>u)&&v>1.99&&(u=m,l=g)}return this._config.delimiter=l,{successful:!!l,bestDelimiter:l}}addError(e,n,r,i){this._results.errors.push({type:e,code:n,message:r,row:i})}}function DD(t,e){t=t.substr(0,1024*1024);var n=new RegExp(gf(e)+"([^]*?)"+gf(e),"gm");t=t.replace(n,"");var r=t.split("\r"),i=t.split(` +`),a=i.length>1&&i[0].length=r.length/2?`\r +`:"\r"}function gf(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I0(t){t=t||{};var e=t.delimiter,n=t.newline,r=t.comments,i=t.step,a=t.preview,l=t.fastMode,u;t.quoteChar===void 0?u='"':u=t.quoteChar;var f=u;if(t.escapeChar!==void 0&&(f=t.escapeChar),(typeof e!="string"||Mi.BAD_DELIMITERS.indexOf(e)>-1)&&(e=","),r===e)throw new Error("Comment character same as delimiter");r===!0?r="#":(typeof r!="string"||Mi.BAD_DELIMITERS.indexOf(r)>-1)&&(r=!1),n!==` +`&&n!=="\r"&&n!==`\r +`&&(n=` +`);var h=0,g=!1;this.parse=function(m,v,S){if(typeof m!="string")throw new Error("Input must be a string");var w=m.length,E=e.length,b=n.length,C=r.length,T=Zi(i);h=0;var A=[],O=[],x=[],N=0;if(!m)return $();if(l||l!==!1&&m.indexOf(u)===-1){for(var F=m.split(n),L=0;L=a)return A=A.slice(0,a),$(!0)}}return $()}for(var D=m.indexOf(e,h),V=m.indexOf(n,h),B=new RegExp(gf(f)+gf(u),"g"),W;;){if(m[h]===u){for(W=h,h++;;){if(W=m.indexOf(u,W+1),W===-1)return S||O.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:A.length,index:h}),Z();if(W===w-1){var X=m.substring(h,W).replace(B,u);return Z(X)}if(u===f&&m[W+1]===f){W++;continue}if(!(u!==f&&W!==0&&m[W-1]===f)){var Y=V===-1?D:Math.min(D,V),ae=j(Y);if(m[W+1+ae]===e){if(x.push(m.substring(h,W).replace(B,u)),h=W+1+ae+E,D=m.indexOf(e,h),V=m.indexOf(n,h),T&&(ie(),g))return $();if(a&&A.length>=a)return $(!0);break}var U=j(V);if(m.substr(W+1+U,b)===n){if(x.push(m.substring(h,W).replace(B,u)),P(W+1+U+b),D=m.indexOf(e,h),T&&(ie(),g))return $();if(a&&A.length>=a)return $(!0);break}O.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:A.length,index:h}),W++}}if(T&&(ie(),g))return $();if(a&&A.length>=a)return $(!0);continue}if(r&&x.length===0&&m.substr(h,C)===r){if(V===-1)return $();h=V+b,V=m.indexOf(n,h),D=m.indexOf(e,h);continue}if(D!==-1&&(D=a)return $(!0);continue}break}return Z();function z(se){A.push(se),N=h}function j(se){var q=0;if(se!==-1){var ce=m.substring(W+1,se);ce&&ce.trim()===""&&(q=ce.length)}return q}function Z(se){return S||(typeof se>"u"&&(se=m.substr(h)),x.push(se),h=w,z(x),T&&ie()),$()}function P(se){h=se,z(x),x=[],V=m.indexOf(n,h)}function $(se,q){var ce=q||!1;return{data:ce?A[0]:A,errors:O,meta:{delimiter:e,linebreak:n,aborted:g,truncated:!!se,cursor:N+(v||0)}}}function ie(){i($(void 0,!0)),A=[],O=[]}},this.abort=function(){g=!0},this.getCharIndex=function(){return h}}function ER(t){if(typeof t!="object"||t===null)return t;var e=Array.isArray(t)?[]:{};for(var n in t)e[n]=ER(t[n]);return e}function Zi(t){return typeof t=="function"}const Mi={parse:MD,unparse:OD,RECORD_SEP:"",UNIT_SEP:"",BYTE_ORDER_MARK:Pw,BAD_DELIMITERS:["\r",` +`,'"',Pw],WORKERS_SUPPORTED:!1,NODE_STREAM_INPUT:1,LocalChunkSize:1024*1024*10,RemoteChunkSize:1024*1024*5,DefaultDelimiter:",",Parser:I0,ParserHandle:SR,ChunkStreamer:bR},{ChunkStreamer:FD}=Mi;class kD extends FD{constructor(n={}){super(n);M(this,"textDecoder",new TextDecoder(this._config.encoding))}async stream(n){this._input=n;try{for await(const r of n)this.parseChunk(this.getStringChunk(r));this._finished=!0,this.parseChunk("")}catch(r){this._sendError(r)}}_nextChunk(){}getStringChunk(n){return typeof n=="string"?n:this.textDecoder.decode(n,{stream:!0})}}const BD="4.3.2",Ny="object-row-table",Iy={dataType:null,batchType:null,id:"csv",module:"csv",name:"CSV",version:BD,extensions:["csv","tsv","dsv"],mimeTypes:["text/csv","text/tab-separated-values","text/dsv"],category:"table",parse:async(t,e)=>Nw(new TextDecoder().decode(t),e),parseText:(t,e)=>Nw(t,e),parseInBatches:UD,options:{csv:{shape:Ny,optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[","," ","|",";"]}}};async function Nw(t,e){const n={...Iy.options.csv,...e==null?void 0:e.csv},r=LD(t),a=n.header==="auto"?wR(r):!!n.header,l={...n,header:a,download:!1,transformHeader:a?TR():void 0,error:m=>{throw new Error(m)}},u=Mi.parse(t,l),f=u.data,h=u.meta.fields||CR(n.columnPrefix,r.length),g=n.shape||Ny;switch(g){case"object-row-table":return{shape:"object-row-table",data:f.map(m=>Array.isArray(m)?_R(m,h):m)};case"array-row-table":return{shape:"array-row-table",data:f.map(m=>Array.isArray(m)?m:yR(m,h))};default:throw new Error(g)}}function UD(t,e){e={...e},e.batchSize==="auto"&&(e.batchSize=4e3);const n={...Iy.options.csv,...e==null?void 0:e.csv},r=new xD;let i=!0,a=null,l=null,u=null;const f={...n,header:!1,download:!1,chunkSize:1024*1024*5,skipEmptyLines:!1,step(h){let g=h.data;if(n.skipEmptyLines&&g.flat().join("").trim()==="")return;const m=h.meta.cursor;if(i&&!a&&(n.header==="auto"?wR(g):!!n.header)){a=g.map(TR());return}i&&(i=!1,a||(a=CR(n.columnPrefix,g.length)),u=zD(g,a)),n.optimizeMemoryUsage&&(g=JSON.parse(JSON.stringify(g)));const v=n.shape||Ny;l=l||new N0(u,{shape:v,...e});try{l.addRow(g);const S=l&&l.getFullBatch({bytesUsed:m});S&&r.enqueue(S)}catch(S){r.enqueue(S)}},complete(h){try{const g=h.meta.cursor,m=l&&l.getFinalBatch({bytesUsed:g});m&&r.enqueue(m)}catch(g){r.enqueue(g)}r.close()}};return Mi.parse(t,f,kD),r}function wR(t){return t&&t.every(e=>typeof e=="string")}function LD(t){return Mi.parse(t,{dynamicTyping:!0,preview:1}).data[0]}function TR(){const t=new Set;return e=>{let n=e,r=1;for(;t.has(n);)n=`${e}.${r}`,r++;return t.add(n),n}}function CR(t,e=0){const n=[];for(let r=0;r1&&arguments[1]!==void 0?arguments[1]:{},n=[];return Ft.Children.forEach(t,function(r){r==null&&!e.keepEmpty||(Array.isArray(r)?n=n.concat(Lo(r)):AR(r)&&r.props?n=n.concat(Lo(r.props.children,e)):n.push(r))}),n}var D0={},XD=function(e){};function qD(t,e){}function YD(t,e){}function KD(){D0={}}function RR(t,e,n){!e&&!D0[n]&&(t(!1,n),D0[n]=!0)}function kr(t,e){RR(qD,t,e)}function ZD(t,e){RR(YD,t,e)}kr.preMessage=XD;kr.resetWarned=KD;kr.noteOnce=ZD;function QD(t,e){if(pt(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(pt(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xR(t){var e=QD(t,"string");return pt(e)=="symbol"?e:e+""}function K(t,e,n){return(e=xR(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function J(t){for(var e=1;e=19)return!0;var i=Ev.isMemo(e)?e.type.type:e.type;return!(typeof i=="function"&&!((n=i.prototype)!==null&&n!==void 0&&n.render)&&i.$$typeof!==Ev.ForwardRef||typeof e=="function"&&!((r=e.prototype)!==null&&r!==void 0&&r.render)&&e.$$typeof!==Ev.ForwardRef)};function MR(t){return _.isValidElement(t)&&!AR(t)}var Fy=function(e){if(e&&MR(e)){var n=e;return n.props.propertyIsEnumerable("ref")?n.props.ref:n.ref}return null},F0=_.createContext(null);function n4(t){var e=t.children,n=t.onBatchResize,r=_.useRef(0),i=_.useRef([]),a=_.useContext(F0),l=_.useCallback(function(u,f,h){r.current+=1;var g=r.current;i.current.push({size:u,element:f,data:h}),Promise.resolve().then(function(){g===r.current&&(n==null||n(i.current),i.current=[])}),a==null||a(u,f,h)},[n,a]);return _.createElement(F0.Provider,{value:l},e)}var OR=function(){if(typeof Map<"u")return Map;function t(e,n){var r=-1;return e.some(function(i,a){return i[0]===n?(r=a,!0):!1}),r}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(n){var r=t(this.__entries__,n),i=this.__entries__[r];return i&&i[1]},e.prototype.set=function(n,r){var i=t(this.__entries__,n);~i?this.__entries__[i][1]=r:this.__entries__.push([n,r])},e.prototype.delete=function(n){var r=this.__entries__,i=t(r,n);~i&&r.splice(i,1)},e.prototype.has=function(n){return!!~t(this.__entries__,n)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var i=0,a=this.__entries__;i0},t.prototype.connect_=function(){!k0||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l4?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){!k0||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(e){var n=e.propertyName,r=n===void 0?"":n,i=o4.some(function(a){return!!~r.indexOf(a)});i&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),PR=function(t,e){for(var n=0,r=Object.keys(e);n"u"||!(Element instanceof Object))){if(!(e instanceof _c(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)||(n.set(e,new v4(e)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof _c(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)&&(n.delete(e),n.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&e.activeObservations_.push(n)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new _4(r.target,r.broadcastRect())});this.callback_.call(e,n,e),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),IR=typeof WeakMap<"u"?new WeakMap:new OR,DR=function(){function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=c4.getInstance(),r=new y4(e,n,this);IR.set(this,r)}return t}();["observe","unobserve","disconnect"].forEach(function(t){DR.prototype[t]=function(){var e;return(e=IR.get(this))[t].apply(e,arguments)}});var b4=function(){return typeof Wh.ResizeObserver<"u"?Wh.ResizeObserver:DR}(),Na=new Map;function S4(t){t.forEach(function(e){var n,r=e.target;(n=Na.get(r))===null||n===void 0||n.forEach(function(i){return i(r)})})}var FR=new b4(S4);function E4(t,e){Na.has(t)||(Na.set(t,new Set),FR.observe(t)),Na.get(t).add(e)}function w4(t,e){Na.has(t)&&(Na.get(t).delete(e),Na.get(t).size||(FR.unobserve(t),Na.delete(t)))}function xr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&arguments[1]!==void 0?arguments[1]:1;zw+=1;var r=zw;function i(a){if(a===0)LR(r),e();else{var l=BR(function(){i(a-1)});Uy.set(r,l)}}return i(n),r};dr.cancel=function(t){var e=Uy.get(t);return LR(t),UR(e)};function zR(t){if(Array.isArray(t))return t}function N4(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,l,u=[],f=!0,h=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;f=!1}else for(;!(f=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);f=!0);}catch(g){h=!0,i=g}finally{try{if(!f&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(h)throw i}}return u}}function $R(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function de(t,e){return zR(t)||N4(t,e)||By(t,e)||$R()}function _f(t){for(var e=0,n,r=0,i=t.length;i>=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}function Zr(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function I4(t,e){if(!t)return!1;if(t.contains)return t.contains(e);for(var n=e;n;){if(n===t)return!0;n=n.parentNode}return!1}var $w="data-rc-order",Vw="data-rc-priority",D4="rc-util-key",U0=new Map;function VR(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.mark;return e?e.startsWith("data-")?e:"data-".concat(e):D4}function ep(t){if(t.attachTo)return t.attachTo;var e=document.querySelector("head");return e||document.body}function F4(t){return t==="queue"?"prependQueue":t?"prepend":"append"}function Ly(t){return Array.from((U0.get(t)||t).children).filter(function(e){return e.tagName==="STYLE"})}function HR(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Zr())return null;var n=e.csp,r=e.prepend,i=e.priority,a=i===void 0?0:i,l=F4(r),u=l==="prependQueue",f=document.createElement("style");f.setAttribute($w,l),u&&a&&f.setAttribute(Vw,"".concat(a)),n!=null&&n.nonce&&(f.nonce=n==null?void 0:n.nonce),f.innerHTML=t;var h=ep(e),g=h.firstChild;if(r){if(u){var m=(e.styles||Ly(h)).filter(function(v){if(!["prepend","prependQueue"].includes(v.getAttribute($w)))return!1;var S=Number(v.getAttribute(Vw)||0);return a>=S});if(m.length)return h.insertBefore(f,m[m.length-1].nextSibling),f}h.insertBefore(f,g)}else h.appendChild(f);return f}function jR(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=ep(e);return(e.styles||Ly(n)).find(function(r){return r.getAttribute(VR(e))===t})}function yf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=jR(t,e);if(n){var r=ep(e);r.removeChild(n)}}function k4(t,e){var n=U0.get(t);if(!n||!I4(document,n)){var r=HR("",e),i=r.parentNode;U0.set(t,i),t.removeChild(r)}}function Hs(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=ep(n),i=Ly(r),a=J(J({},n),{},{styles:i});k4(r,a);var l=jR(e,a);if(l){var u,f;if((u=a.csp)!==null&&u!==void 0&&u.nonce&&l.nonce!==((f=a.csp)===null||f===void 0?void 0:f.nonce)){var h;l.nonce=(h=a.csp)===null||h===void 0?void 0:h.nonce}return l.innerHTML!==t&&(l.innerHTML=t),l}var g=HR(t,a);return g.setAttribute(VR(a),e),g}function B4(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Fn(t,e){if(t==null)return{};var n,r,i=B4(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=new Set;function i(a,l){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,f=r.has(a);if(kr(!f,"Warning: There may be circular references"),f)return!1;if(a===l)return!0;if(n&&u>1)return!1;r.add(a);var h=u+1;if(Array.isArray(a)){if(!Array.isArray(l)||a.length!==l.length)return!1;for(var g=0;g1&&arguments[1]!==void 0?arguments[1]:!1,l={map:this.cache};return n.forEach(function(u){if(!l)l=void 0;else{var f;l=(f=l)===null||f===void 0||(f=f.map)===null||f===void 0?void 0:f.get(u)}}),(r=l)!==null&&r!==void 0&&r.value&&a&&(l.value[1]=this.cacheCallTimes++),(i=l)===null||i===void 0?void 0:i.value}},{key:"get",value:function(n){var r;return(r=this.internalGet(n,!0))===null||r===void 0?void 0:r[0]}},{key:"has",value:function(n){return!!this.internalGet(n)}},{key:"set",value:function(n,r){var i=this;if(!this.has(n)){if(this.size()+1>t.MAX_CACHE_SIZE+t.MAX_CACHE_OFFSET){var a=this.keys.reduce(function(h,g){var m=de(h,2),v=m[1];return i.internalGet(g)[1]0,void 0),Hw+=1}return Mr(t,[{key:"getDerivativeToken",value:function(n){return this.derivatives.reduce(function(r,i){return i(n,r)},void 0)}}]),t}(),wv=new zy;function z0(t){var e=Array.isArray(t)?t:[t];return wv.has(e)||wv.set(e,new WR(e)),wv.get(e)}var V4=new WeakMap,Tv={};function H4(t,e){for(var n=V4,r=0;r3&&arguments[3]!==void 0?arguments[3]:{},a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(a)return t;var l=J(J({},i),{},(r={},K(r,yc,e),K(r,Ji,n),r)),u=Object.keys(l).map(function(f){var h=l[f];return h?"".concat(f,'="').concat(h,'"'):null}).filter(function(f){return f}).join(" ");return"")}var xh=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"--".concat(n?"".concat(n,"-"):"").concat(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()},j4=function(e,n,r){return Object.keys(e).length?".".concat(n).concat(r!=null&&r.scope?".".concat(r.scope):"","{").concat(Object.entries(e).map(function(i){var a=de(i,2),l=a[0],u=a[1];return"".concat(l,":").concat(u,";")}).join(""),"}"):""},XR=function(e,n,r){var i={},a={};return Object.entries(e).forEach(function(l){var u,f,h=de(l,2),g=h[0],m=h[1];if(r!=null&&(u=r.preserve)!==null&&u!==void 0&&u[g])a[g]=m;else if((typeof m=="string"||typeof m=="number")&&!(r!=null&&(f=r.ignore)!==null&&f!==void 0&&f[g])){var v,S=xh(g,r==null?void 0:r.prefix);i[S]=typeof m=="number"&&!(r!=null&&(v=r.unitless)!==null&&v!==void 0&&v[g])?"".concat(m,"px"):String(m),a[g]="var(".concat(S,")")}}),[a,j4(i,n,{scope:r==null?void 0:r.scope})]},Xw=Zr()?_.useLayoutEffect:_.useEffect,Dn=function(e,n){var r=_.useRef(!0);Xw(function(){return e(r.current)},n),Xw(function(){return r.current=!1,function(){r.current=!0}},[])},qw=function(e,n){Dn(function(r){if(!r)return e()},n)},W4=J({},Xg),Yw=W4.useInsertionEffect,X4=function(e,n,r){_.useMemo(e,r),Dn(function(){return n(!0)},r)},q4=Yw?function(t,e,n){return Yw(function(){return t(),e()},n)}:X4,Y4=J({},Xg),K4=Y4.useInsertionEffect,Z4=function(e){var n=[],r=!1;function i(a){r||n.push(a)}return _.useEffect(function(){return r=!1,function(){r=!0,n.length&&n.forEach(function(a){return a()})}},e),i},Q4=function(){return function(e){e()}},G4=typeof K4<"u"?Z4:Q4;function $y(t,e,n,r,i){var a=_.useContext($f),l=a.cache,u=[t].concat(ze(e)),f=L0(u),h=G4([f]),g=function(w){l.opUpdate(f,function(E){var b=E||[void 0,void 0],C=de(b,2),T=C[0],A=T===void 0?0:T,O=C[1],x=O,N=x||n(),F=[A,N];return w?w(F):F})};_.useMemo(function(){g()},[f]);var m=l.opGet(f),v=m[1];return q4(function(){i==null||i(v)},function(S){return g(function(w){var E=de(w,2),b=E[0],C=E[1];return S&&b===0&&(i==null||i(v)),[b+1,C]}),function(){l.opUpdate(f,function(w){var E=w||[],b=de(E,2),C=b[0],T=C===void 0?0:C,A=b[1],O=T-1;return O===0?(h(function(){(S||!l.opGet(f))&&(r==null||r(A,!1))}),null):[T-1,A]})}},[f]),v}var J4={},e5="css",po=new Map;function t5(t){po.set(t,(po.get(t)||0)+1)}function n5(t,e){if(typeof document<"u"){var n=document.querySelectorAll("style[".concat(yc,'="').concat(t,'"]'));n.forEach(function(r){if(r[Ia]===e){var i;(i=r.parentNode)===null||i===void 0||i.removeChild(r)}})}}var r5=0;function i5(t,e){po.set(t,(po.get(t)||0)-1);var n=Array.from(po.keys()),r=n.filter(function(i){var a=po.get(i)||0;return a<=0});n.length-r.length>r5&&r.forEach(function(i){n5(i,e),po.delete(i)})}var s5=function(e,n,r,i){var a=r.getDerivativeToken(e),l=J(J({},a),n);return i&&(l=i(l)),l},qR="token";function a5(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=_.useContext($f),i=r.cache.instanceId,a=r.container,l=n.salt,u=l===void 0?"":l,f=n.override,h=f===void 0?J4:f,g=n.formatToken,m=n.getComputedToken,v=n.cssVar,S=H4(function(){return Object.assign.apply(Object,[{}].concat(ze(e)))},e),w=Ju(S),E=Ju(h),b=v?Ju(v):"",C=$y(qR,[u,t.id,w,E,b],function(){var T,A=m?m(S,h,t):s5(S,h,t,g),O=J({},A),x="";if(v){var N=XR(A,v.key,{prefix:v.prefix,ignore:v.ignore,unitless:v.unitless,preserve:v.preserve}),F=de(N,2);A=F[0],x=F[1]}var L=Ww(A,u);A._tokenKey=L,O._tokenKey=Ww(O,u);var D=(T=v==null?void 0:v.key)!==null&&T!==void 0?T:L;A._themeKey=D,t5(D);var V="".concat(e5,"-").concat(_f(L));return A._hashId=V,[A,V,O,x,(v==null?void 0:v.key)||""]},function(T){i5(T[0]._themeKey,i)},function(T){var A=de(T,4),O=A[0],x=A[3];if(v&&x){var N=Hs(x,_f("css-variables-".concat(O._themeKey)),{mark:Ji,prepend:"queue",attachTo:a,priority:-999});N[Ia]=i,N.setAttribute(yc,O._themeKey)}});return C}var o5=function(e,n,r){var i=de(e,5),a=i[2],l=i[3],u=i[4],f=r||{},h=f.plain;if(!l)return null;var g=a._tokenKey,m=-999,v={"data-rc-order":"prependQueue","data-rc-priority":"".concat(m)},S=Yh(l,u,g,v,h);return[m,g,S]},l5={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},YR="comm",KR="rule",ZR="decl",c5="@import",u5="@namespace",f5="@keyframes",d5="@layer",QR=Math.abs,Vy=String.fromCharCode;function GR(t){return t.trim()}function Mh(t,e,n){return t.replace(e,n)}function h5(t,e,n){return t.indexOf(e,n)}function Jl(t,e){return t.charCodeAt(e)|0}function bc(t,e,n){return t.slice(e,n)}function us(t){return t.length}function g5(t){return t.length}function nh(t,e){return e.push(t),t}var tp=1,Sc=1,JR=0,Ni=0,ar=0,Bc="";function Hy(t,e,n,r,i,a,l,u){return{value:t,root:e,parent:n,type:r,props:i,children:a,line:tp,column:Sc,length:l,return:"",siblings:u}}function p5(){return ar}function m5(){return ar=Ni>0?Jl(Bc,--Ni):0,Sc--,ar===10&&(Sc=1,tp--),ar}function es(){return ar=Ni2||bf(ar)>3?"":" "}function b5(t,e){for(;--e&&es()&&!(ar<48||ar>102||ar>57&&ar<65||ar>70&&ar<97););return np(t,Oh()+(e<6&&Da()==32&&es()==32))}function V0(t){for(;es();)switch(ar){case t:return Ni;case 34:case 39:t!==34&&t!==39&&V0(ar);break;case 40:t===41&&V0(t);break;case 92:es();break}return Ni}function S5(t,e){for(;es()&&t+ar!==57;)if(t+ar===84&&Da()===47)break;return"/*"+np(e,Ni-1)+"*"+Vy(t===47?t:es())}function E5(t){for(;!bf(Da());)es();return np(t,Ni)}function w5(t){return _5(Ph("",null,null,null,[""],t=v5(t),0,[0],t))}function Ph(t,e,n,r,i,a,l,u,f){for(var h=0,g=0,m=l,v=0,S=0,w=0,E=1,b=1,C=1,T=0,A="",O=i,x=a,N=r,F=A;b;)switch(w=T,T=es()){case 40:if(w!=108&&Jl(F,m-1)==58){h5(F+=Mh(Cv(T),"&","&\f"),"&\f",QR(h?u[h-1]:0))!=-1&&(C=-1);break}case 34:case 39:case 91:F+=Cv(T);break;case 9:case 10:case 13:case 32:F+=y5(w);break;case 92:F+=b5(Oh()-1,7);continue;case 47:switch(Da()){case 42:case 47:nh(T5(S5(es(),Oh()),e,n,f),f),(bf(w||1)==5||bf(Da()||1)==5)&&us(F)&&bc(F,-1,void 0)!==" "&&(F+=" ");break;default:F+="/"}break;case 123*E:u[h++]=us(F)*C;case 125*E:case 59:case 0:switch(T){case 0:case 125:b=0;case 59+g:C==-1&&(F=Mh(F,/\f/g,"")),S>0&&(us(F)-m||E===0&&w===47)&&nh(S>32?Zw(F+";",r,n,m-1,f):Zw(Mh(F," ","")+";",r,n,m-2,f),f);break;case 59:F+=";";default:if(nh(N=Kw(F,e,n,h,g,i,u,A,O=[],x=[],m,a),a),T===123)if(g===0)Ph(F,e,N,N,O,a,m,u,x);else{switch(v){case 99:if(Jl(F,3)===110)break;case 108:if(Jl(F,2)===97)break;default:g=0;case 100:case 109:case 115:}g?Ph(t,N,N,r&&nh(Kw(t,N,N,0,0,i,u,A,i,O=[],m,x),x),i,x,m,u,r?O:x):Ph(F,N,N,N,[""],x,0,u,x)}}h=g=S=0,E=C=1,A=F="",m=l;break;case 58:m=1+us(F),S=w;default:if(E<1){if(T==123)--E;else if(T==125&&E++==0&&m5()==125)continue}switch(F+=Vy(T),T*E){case 38:C=g>0?1:(F+="\f",-1);break;case 44:u[h++]=(us(F)-1)*C,C=1;break;case 64:Da()===45&&(F+=Cv(es())),v=Da(),g=m=us(A=F+=E5(Oh())),T++;break;case 45:w===45&&us(F)==2&&(E=0)}}return a}function Kw(t,e,n,r,i,a,l,u,f,h,g,m){for(var v=i-1,S=i===0?a:[""],w=g5(S),E=0,b=0,C=0;E0?S[T]+" "+A:Mh(A,/&\f/g,S[T])))&&(f[C++]=O);return Hy(t,e,n,i===0?KR:u,f,h,g,m)}function T5(t,e,n,r){return Hy(t,e,n,YR,Vy(p5()),bc(t,2,-2),0,r)}function Zw(t,e,n,r,i){return Hy(t,e,n,ZR,bc(t,0,r),bc(t,r+1,-1),r,i)}function H0(t,e){for(var n="",r=0;r1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{root:!0,parentSelectors:[]},i=r.root,a=r.injectHash,l=r.parentSelectors,u=n.hashId,f=n.layer;n.path;var h=n.hashPriority,g=n.transformers,m=g===void 0?[]:g;n.linters;var v="",S={};function w(C){var T=C.getName(u);if(!S[T]){var A=t(C.style,n,{root:!1,parentSelectors:l}),O=de(A,1),x=O[0];S[T]="@keyframes ".concat(C.getName(u)).concat(x)}}function E(C){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return C.forEach(function(A){Array.isArray(A)?E(A,T):A&&T.push(A)}),T}var b=E(Array.isArray(e)?e:[e]);return b.forEach(function(C){var T=typeof C=="string"&&!i?{}:C;if(typeof T=="string")v+="".concat(T,` +`);else if(T._keyframe)w(T);else{var A=m.reduce(function(O,x){var N;return(x==null||(N=x.visit)===null||N===void 0?void 0:N.call(x,O))||O},T);Object.keys(A).forEach(function(O){var x=A[O];if(pt(x)==="object"&&x&&(O!=="animationName"||!x._keyframe)&&!O5(x)){var N=!1,F=O.trim(),L=!1;(i||a)&&u?F.startsWith("@")?N=!0:F==="&"?F=Gw("",u,h):F=Gw(O,u,h):i&&!u&&(F==="&"||F==="")&&(F="",L=!0);var D=t(x,n,{root:L,injectHash:N,parentSelectors:[].concat(ze(l),[F])}),V=de(D,2),B=V[0],W=V[1];S=J(J({},S),W),v+="".concat(F).concat(B)}else{let ae=function(U,z){var j=U.replace(/[A-Z]/g,function(P){return"-".concat(P.toLowerCase())}),Z=z;!l5[U]&&typeof Z=="number"&&Z!==0&&(Z="".concat(Z,"px")),U==="animationName"&&z!==null&&z!==void 0&&z._keyframe&&(w(z),Z=z.getName(u)),v+="".concat(j,":").concat(Z,";")};var X,Y=(X=x==null?void 0:x.value)!==null&&X!==void 0?X:x;pt(x)==="object"&&x!==null&&x!==void 0&&x[n3]&&Array.isArray(Y)?Y.forEach(function(U){ae(O,U)}):ae(O,Y)}})}}),i?f&&(v&&(v="@layer ".concat(f.name," {").concat(v,"}")),f.dependencies&&(S["@layer ".concat(f.name)]=f.dependencies.map(function(C){return"@layer ".concat(C,", ").concat(f.name,";")}).join(` +`))):v="{".concat(v,"}"),[v,S]};function r3(t,e){return _f("".concat(t.join("%")).concat(e))}function N5(){return null}var i3="style";function j0(t,e){var n=t.token,r=t.path,i=t.hashId,a=t.layer,l=t.nonce,u=t.clientOnly,f=t.order,h=f===void 0?0:f,g=_.useContext($f),m=g.autoClear;g.mock;var v=g.defaultCache,S=g.hashPriority,w=g.container,E=g.ssrInline,b=g.transformers,C=g.linters,T=g.cache,A=g.layer,O=n._tokenKey,x=[O];A&&x.push("layer"),x.push.apply(x,ze(r));var N=$0,F=$y(i3,x,function(){var W=x.join("|");if(R5(W)){var X=x5(W),Y=de(X,2),ae=Y[0],U=Y[1];if(ae)return[ae,O,U,{},u,h]}var z=e(),j=P5(z,{hashId:i,hashPriority:S,layer:A?a:void 0,path:r.join("-"),transformers:b,linters:C}),Z=de(j,2),P=Z[0],$=Z[1],ie=Nh(P),se=r3(x,ie);return[ie,O,se,$,u,h]},function(W,X){var Y=de(W,3),ae=Y[2];(X||m)&&$0&&yf(ae,{mark:Ji})},function(W){var X=de(W,4),Y=X[0];X[1];var ae=X[2],U=X[3];if(N&&Y!==e3){var z={mark:Ji,prepend:A?!1:"queue",attachTo:w,priority:h},j=typeof l=="function"?l():l;j&&(z.csp={nonce:j});var Z=[],P=[];Object.keys(U).forEach(function(ie){ie.startsWith("@layer")?Z.push(ie):P.push(ie)}),Z.forEach(function(ie){Hs(Nh(U[ie]),"_layer-".concat(ie),J(J({},z),{},{prepend:!0}))});var $=Hs(Y,ae,z);$[Ia]=T.instanceId,$.setAttribute(yc,O),P.forEach(function(ie){Hs(Nh(U[ie]),"_effect-".concat(ie),z)})}}),L=de(F,3),D=L[0],V=L[1],B=L[2];return function(W){var X;if(!E||N||!v)X=_.createElement(N5,null);else{var Y;X=_.createElement("style",kt({},(Y={},K(Y,yc,V),K(Y,Ji,B),Y),{dangerouslySetInnerHTML:{__html:D}}))}return _.createElement(_.Fragment,null,X,W)}}var I5=function(e,n,r){var i=de(e,6),a=i[0],l=i[1],u=i[2],f=i[3],h=i[4],g=i[5],m=r||{},v=m.plain;if(h)return null;var S=a,w={"data-rc-order":"prependQueue","data-rc-priority":"".concat(g)};return S=Yh(a,l,u,w,v),f&&Object.keys(f).forEach(function(E){if(!n[E]){n[E]=!0;var b=Nh(f[E]),C=Yh(b,l,"_effect-".concat(E),w,v);E.startsWith("@layer")?S=C+S:S+=C}}),[g,u,S]},s3="cssVar",D5=function(e,n){var r=e.key,i=e.prefix,a=e.unitless,l=e.ignore,u=e.token,f=e.scope,h=f===void 0?"":f,g=_.useContext($f),m=g.cache.instanceId,v=g.container,S=u._tokenKey,w=[].concat(ze(e.path),[r,h,S]),E=$y(s3,w,function(){var b=n(),C=XR(b,r,{prefix:i,unitless:a,ignore:l,scope:h}),T=de(C,2),A=T[0],O=T[1],x=r3(w,O);return[A,O,x,r]},function(b){var C=de(b,3),T=C[2];$0&&yf(T,{mark:Ji})},function(b){var C=de(b,3),T=C[1],A=C[2];if(T){var O=Hs(T,A,{mark:Ji,prepend:"queue",attachTo:v,priority:-999});O[Ia]=m,O.setAttribute(yc,r)}});return E},F5=function(e,n,r){var i=de(e,4),a=i[1],l=i[2],u=i[3],f=r||{},h=f.plain;if(!a)return null;var g=-999,m={"data-rc-order":"prependQueue","data-rc-priority":"".concat(g)},v=Yh(a,u,l,m,h);return[g,l,v]},ku;ku={},K(ku,i3,I5),K(ku,qR,o5),K(ku,s3,F5);var ln=function(){function t(e,n){xr(this,t),K(this,"name",void 0),K(this,"style",void 0),K(this,"_keyframe",!0),this.name=e,this.style=n}return Mr(t,[{key:"getName",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return n?"".concat(n,"-").concat(this.name):this.name}}]),t}();function Il(t){return t.notSplit=!0,t}Il(["borderTop","borderBottom"]),Il(["borderTop"]),Il(["borderBottom"]),Il(["borderLeft","borderRight"]),Il(["borderLeft"]),Il(["borderRight"]);var jy=_.createContext({});function a3(t){return zR(t)||kR(t)||By(t)||$R()}function vs(t,e){for(var n=t,r=0;r3&&arguments[3]!==void 0?arguments[3]:!1;return e.length&&r&&n===void 0&&!vs(t,e.slice(0,-1))?t:o3(t,e,n,r)}function k5(t){return pt(t)==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function Jw(t){return Array.isArray(t)?[]:{}}var B5=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function Hl(){for(var t=arguments.length,e=new Array(t),n=0;n{const t=()=>{};return t.deprecated=U5,t},z5=_.createContext(void 0);var $5={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},V5={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},H5=J(J({},V5),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});const c3={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},eT={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},H5),timePickerLocale:Object.assign({},c3)},ii="${label} is not a valid ${type}",Ec={locale:"en",Pagination:$5,DatePicker:eT,TimePicker:c3,Calendar:eT,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:ii,method:ii,array:ii,object:ii,number:ii,date:ii,boolean:ii,integer:ii,float:ii,regexp:ii,email:ii,url:ii,hex:ii},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};Object.assign({},Ec.Modal);let Ih=[];const tT=()=>Ih.reduce((t,e)=>Object.assign(Object.assign({},t),e),Ec.Modal);function j5(t){if(t){const e=Object.assign({},t);return Ih.push(e),tT(),()=>{Ih=Ih.filter(n=>n!==e),tT()}}Object.assign({},Ec.Modal)}const Wy=_.createContext(void 0),Xy=(t,e)=>{const n=_.useContext(Wy),r=_.useMemo(()=>{var a;const l=Ec[t],u=(a=n==null?void 0:n[t])!==null&&a!==void 0?a:{};return Object.assign(Object.assign({},typeof l=="function"?l():l),u||{})},[t,e,n]),i=_.useMemo(()=>{const a=n==null?void 0:n.locale;return n!=null&&n.exist&&!a?Ec.locale:a},[n]);return[r,i]},W5="internalMark",X5=t=>{const{locale:e={},children:n,_ANT_MARK__:r}=t;_.useEffect(()=>j5(e==null?void 0:e.Modal),[e]);const i=_.useMemo(()=>Object.assign(Object.assign({},e),{exist:!0}),[e]);return _.createElement(Wy.Provider,{value:i},n)},u3={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},Sf=Object.assign(Object.assign({},u3),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, +'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', +'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),_r=Math.round;function Av(t,e){const n=t.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=e(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const nT=(t,e,n)=>n===0?t:t/100;function Bu(t,e){const n=e||255;return t>n?n:t<0?0:t}class En{constructor(e){K(this,"isValid",!0),K(this,"r",0),K(this,"g",0),K(this,"b",0),K(this,"a",1),K(this,"_h",void 0),K(this,"_s",void 0),K(this,"_l",void 0),K(this,"_v",void 0),K(this,"_max",void 0),K(this,"_min",void 0),K(this,"_brightness",void 0);function n(r){return r[0]in e&&r[1]in e&&r[2]in e}if(e)if(typeof e=="string"){let i=function(a){return r.startsWith(a)};const r=e.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):i("rgb")?this.fromRgbString(r):i("hsl")?this.fromHslString(r):(i("hsv")||i("hsb"))&&this.fromHsvString(r)}else if(e instanceof En)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(n("rgb"))this.r=Bu(e.r),this.g=Bu(e.g),this.b=Bu(e.b),this.a=typeof e.a=="number"?Bu(e.a,1):1;else if(n("hsl"))this.fromHsl(e);else if(n("hsv"))this.fromHsv(e);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e))}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const n=this.toHsv();return n.h=e,this._c(n)}getLuminance(){function e(a){const l=a/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)}const n=e(this.r),r=e(this.g),i=e(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const e=this.getMax()-this.getMin();e===0?this._h=0:this._h=_r(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g"u"){const e=this.getMax()-this.getMin();e===0?this._s=0:this._s=e/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(e=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-e/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(e=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+e/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(e,n=50){const r=this._c(e),i=n/100,a=u=>(r[u]-this[u])*i+this[u],l={r:_r(a("r")),g:_r(a("g")),b:_r(a("b")),a:_r(a("a")*100)/100};return this._c(l)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const n=this._c(e),r=this.a+n.a*(1-this.a),i=a=>_r((this[a]*this.a+n[a]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const n=(this.r||0).toString(16);e+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);e+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(e+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const a=_r(this.a*255).toString(16);e+=a.length===2?a:"0"+a}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),n=_r(this.getSaturation()*100),r=_r(this.getLightness()*100);return this.a!==1?`hsla(${e},${n}%,${r}%,${this.a})`:`hsl(${e},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,n,r){const i=this.clone();return i[e]=Bu(n,r),i}_c(e){return new this.constructor(e)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const n=e.replace("#","");function r(i,a){return parseInt(n[i]+n[a||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:e,s:n,l:r,a:i}){if(this._h=e%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const v=_r(r*255);this.r=v,this.g=v,this.b=v}let a=0,l=0,u=0;const f=e/60,h=(1-Math.abs(2*r-1))*n,g=h*(1-Math.abs(f%2-1));f>=0&&f<1?(a=h,l=g):f>=1&&f<2?(a=g,l=h):f>=2&&f<3?(l=h,u=g):f>=3&&f<4?(l=g,u=h):f>=4&&f<5?(a=g,u=h):f>=5&&f<6&&(a=h,u=g);const m=r-h/2;this.r=_r((a+m)*255),this.g=_r((l+m)*255),this.b=_r((u+m)*255)}fromHsv({h:e,s:n,v:r,a:i}){this._h=e%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const a=_r(r*255);if(this.r=a,this.g=a,this.b=a,n<=0)return;const l=e/60,u=Math.floor(l),f=l-u,h=_r(r*(1-n)*255),g=_r(r*(1-n*f)*255),m=_r(r*(1-n*(1-f))*255);switch(u){case 0:this.g=m,this.b=h;break;case 1:this.r=g,this.b=h;break;case 2:this.r=h,this.b=m;break;case 3:this.r=h,this.g=g;break;case 4:this.r=m,this.g=h;break;case 5:default:this.g=h,this.b=g;break}}fromHsvString(e){const n=Av(e,nT);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(e){const n=Av(e,nT);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(e){const n=Av(e,(r,i)=>i.includes("%")?_r(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var rh=2,rT=.16,q5=.05,Y5=.05,K5=.15,f3=5,d3=4,Z5=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function iT(t,e,n){var r;return Math.round(t.h)>=60&&Math.round(t.h)<=240?r=n?Math.round(t.h)-rh*e:Math.round(t.h)+rh*e:r=n?Math.round(t.h)+rh*e:Math.round(t.h)-rh*e,r<0?r+=360:r>=360&&(r-=360),r}function sT(t,e,n){if(t.h===0&&t.s===0)return t.s;var r;return n?r=t.s-rT*e:e===d3?r=t.s+rT:r=t.s+q5*e,r>1&&(r=1),n&&e===f3&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function aT(t,e,n){var r;return n?r=t.v+Y5*e:r=t.v-K5*e,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function Ef(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new En(t),i=r.toHsv(),a=f3;a>0;a-=1){var l=new En({h:iT(i,a,!0),s:sT(i,a,!0),v:aT(i,a,!0)});n.push(l)}n.push(r);for(var u=1;u<=d3;u+=1){var f=new En({h:iT(i,u),s:sT(i,u),v:aT(i,u)});n.push(f)}return e.theme==="dark"?Z5.map(function(h){var g=h.index,m=h.amount;return new En(e.backgroundColor||"#141414").mix(n[g],m).toHexString()}):n.map(function(h){return h.toHexString()})}var Rv={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},W0=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];W0.primary=W0[5];var X0=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];X0.primary=X0[5];var q0=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];q0.primary=q0[5];var Y0=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Y0.primary=Y0[5];var K0=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];K0.primary=K0[5];var Z0=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Z0.primary=Z0[5];var Q0=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];Q0.primary=Q0[5];var G0=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];G0.primary=G0[5];var Kh=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Kh.primary=Kh[5];var J0=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];J0.primary=J0[5];var e_=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];e_.primary=e_[5];var t_=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];t_.primary=t_[5];var n_=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];n_.primary=n_[5];var xv={red:W0,volcano:X0,orange:q0,gold:Y0,yellow:K0,lime:Z0,green:Q0,cyan:G0,blue:Kh,geekblue:J0,purple:e_,magenta:t_,grey:n_};function Q5(t,e){let{generateColorPalettes:n,generateNeutralColorPalettes:r}=e;const{colorSuccess:i,colorWarning:a,colorError:l,colorInfo:u,colorPrimary:f,colorBgBase:h,colorTextBase:g}=t,m=n(f),v=n(i),S=n(a),w=n(l),E=n(u),b=r(h,g),C=t.colorLink||t.colorInfo,T=n(C),A=new En(w[1]).mix(new En(w[3]),50).toHexString();return Object.assign(Object.assign({},b),{colorPrimaryBg:m[1],colorPrimaryBgHover:m[2],colorPrimaryBorder:m[3],colorPrimaryBorderHover:m[4],colorPrimaryHover:m[5],colorPrimary:m[6],colorPrimaryActive:m[7],colorPrimaryTextHover:m[8],colorPrimaryText:m[9],colorPrimaryTextActive:m[10],colorSuccessBg:v[1],colorSuccessBgHover:v[2],colorSuccessBorder:v[3],colorSuccessBorderHover:v[4],colorSuccessHover:v[4],colorSuccess:v[6],colorSuccessActive:v[7],colorSuccessTextHover:v[8],colorSuccessText:v[9],colorSuccessTextActive:v[10],colorErrorBg:w[1],colorErrorBgHover:w[2],colorErrorBgFilledHover:A,colorErrorBgActive:w[3],colorErrorBorder:w[3],colorErrorBorderHover:w[4],colorErrorHover:w[5],colorError:w[6],colorErrorActive:w[7],colorErrorTextHover:w[8],colorErrorText:w[9],colorErrorTextActive:w[10],colorWarningBg:S[1],colorWarningBgHover:S[2],colorWarningBorder:S[3],colorWarningBorderHover:S[4],colorWarningHover:S[4],colorWarning:S[6],colorWarningActive:S[7],colorWarningTextHover:S[8],colorWarningText:S[9],colorWarningTextActive:S[10],colorInfoBg:E[1],colorInfoBgHover:E[2],colorInfoBorder:E[3],colorInfoBorderHover:E[4],colorInfoHover:E[4],colorInfo:E[6],colorInfoActive:E[7],colorInfoTextHover:E[8],colorInfoText:E[9],colorInfoTextActive:E[10],colorLinkHover:T[4],colorLink:T[6],colorLinkActive:T[7],colorBgMask:new En("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const G5=t=>{let e=t,n=t,r=t,i=t;return t<6&&t>=5?e=t+1:t<16&&t>=6?e=t+2:t>=16&&(e=16),t<7&&t>=5?n=4:t<8&&t>=7?n=5:t<14&&t>=8?n=6:t<16&&t>=14?n=7:t>=16&&(n=8),t<6&&t>=2?r=1:t>=6&&(r=2),t>4&&t<8?i=4:t>=8&&(i=6),{borderRadius:t,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:e,borderRadiusOuter:i}};function J5(t){const{motionUnit:e,motionBase:n,borderRadius:r,lineWidth:i}=t;return Object.assign({motionDurationFast:`${(n+e).toFixed(1)}s`,motionDurationMid:`${(n+e*2).toFixed(1)}s`,motionDurationSlow:`${(n+e*3).toFixed(1)}s`,lineWidthBold:i+1},G5(r))}const eF=t=>{const{controlHeight:e}=t;return{controlHeightSM:e*.75,controlHeightXS:e*.5,controlHeightLG:e*1.25}};function tF(t){return(t+8)/t}function nF(t){const e=new Array(10).fill(null).map((n,r)=>{const i=r-1,a=t*Math.pow(Math.E,i/5),l=r>1?Math.floor(a):Math.ceil(a);return Math.floor(l/2)*2});return e[1]=t,e.map(n=>({size:n,lineHeight:tF(n)}))}const rF=t=>{const e=nF(t),n=e.map(g=>g.size),r=e.map(g=>g.lineHeight),i=n[1],a=n[0],l=n[2],u=r[1],f=r[0],h=r[2];return{fontSizeSM:a,fontSize:i,fontSizeLG:l,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:u,lineHeightLG:h,lineHeightSM:f,fontHeight:Math.round(u*i),fontHeightLG:Math.round(h*l),fontHeightSM:Math.round(f*a),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function iF(t){const{sizeUnit:e,sizeStep:n}=t;return{sizeXXL:e*(n+8),sizeXL:e*(n+4),sizeLG:e*(n+2),sizeMD:e*(n+1),sizeMS:e*n,size:e*n,sizeSM:e*(n-1),sizeXS:e*(n-2),sizeXXS:e*(n-3)}}const Ti=(t,e)=>new En(t).setA(e).toRgbString(),Uu=(t,e)=>new En(t).darken(e).toHexString(),sF=t=>{const e=Ef(t);return{1:e[0],2:e[1],3:e[2],4:e[3],5:e[4],6:e[5],7:e[6],8:e[4],9:e[5],10:e[6]}},aF=(t,e)=>{const n=t||"#fff",r=e||"#000";return{colorBgBase:n,colorTextBase:r,colorText:Ti(r,.88),colorTextSecondary:Ti(r,.65),colorTextTertiary:Ti(r,.45),colorTextQuaternary:Ti(r,.25),colorFill:Ti(r,.15),colorFillSecondary:Ti(r,.06),colorFillTertiary:Ti(r,.04),colorFillQuaternary:Ti(r,.02),colorBgSolid:Ti(r,1),colorBgSolidHover:Ti(r,.75),colorBgSolidActive:Ti(r,.95),colorBgLayout:Uu(n,4),colorBgContainer:Uu(n,0),colorBgElevated:Uu(n,0),colorBgSpotlight:Ti(r,.85),colorBgBlur:"transparent",colorBorder:Uu(n,15),colorBorderSecondary:Uu(n,6)}};function oF(t){Rv.pink=Rv.magenta,xv.pink=xv.magenta;const e=Object.keys(u3).map(n=>{const r=t[n]===Rv[n]?xv[n]:Ef(t[n]);return new Array(10).fill(1).reduce((i,a,l)=>(i[`${n}-${l+1}`]=r[l],i[`${n}${l+1}`]=r[l],i),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),e),Q5(t,{generateColorPalettes:sF,generateNeutralColorPalettes:aF})),rF(t.fontSize)),iF(t)),eF(t)),J5(t))}const h3=z0(oF),r_={token:Sf,override:{override:Sf},hashed:!0},g3=Ft.createContext(r_),i_="ant",qy="anticon",lF=["outlined","borderless","filled","underlined"],cF=(t,e)=>e||(t?`${i_}-${t}`:i_),ci=_.createContext({getPrefixCls:cF,iconPrefixCls:qy}),{Consumer:rG}=ci,oT={};function Uc(t){const e=_.useContext(ci),{getPrefixCls:n,direction:r,getPopupContainer:i}=e,a=e[t];return Object.assign(Object.assign({classNames:oT,styles:oT},a),{getPrefixCls:n,direction:r,getPopupContainer:i})}const uF=`-ant-${Date.now()}-${Math.random()}`;function fF(t,e){const n={},r=(l,u)=>{let f=l.clone();return f=(u==null?void 0:u(f))||f,f.toRgbString()},i=(l,u)=>{const f=new En(l),h=Ef(f.toRgbString());n[`${u}-color`]=r(f),n[`${u}-color-disabled`]=h[1],n[`${u}-color-hover`]=h[4],n[`${u}-color-active`]=h[6],n[`${u}-color-outline`]=f.clone().setA(.2).toRgbString(),n[`${u}-color-deprecated-bg`]=h[0],n[`${u}-color-deprecated-border`]=h[2]};if(e.primaryColor){i(e.primaryColor,"primary");const l=new En(e.primaryColor),u=Ef(l.toRgbString());u.forEach((h,g)=>{n[`primary-${g+1}`]=h}),n["primary-color-deprecated-l-35"]=r(l,h=>h.lighten(35)),n["primary-color-deprecated-l-20"]=r(l,h=>h.lighten(20)),n["primary-color-deprecated-t-20"]=r(l,h=>h.tint(20)),n["primary-color-deprecated-t-50"]=r(l,h=>h.tint(50)),n["primary-color-deprecated-f-12"]=r(l,h=>h.setA(h.a*.12));const f=new En(u[0]);n["primary-color-active-deprecated-f-30"]=r(f,h=>h.setA(h.a*.3)),n["primary-color-active-deprecated-d-02"]=r(f,h=>h.darken(2))}return e.successColor&&i(e.successColor,"success"),e.warningColor&&i(e.warningColor,"warning"),e.errorColor&&i(e.errorColor,"error"),e.infoColor&&i(e.infoColor,"info"),` + :root { + ${Object.keys(n).map(l=>`--${t}-${l}: ${n[l]};`).join(` +`)} + } + `.trim()}function dF(t,e){const n=fF(t,e);Zr()&&Hs(n,`${uF}-dynamic-theme`)}const wf=_.createContext(!1),hF=t=>{let{children:e,disabled:n}=t;const r=_.useContext(wf);return _.createElement(wf.Provider,{value:n??r},e)},wc=_.createContext(void 0),gF=t=>{let{children:e,size:n}=t;const r=_.useContext(wc);return _.createElement(wc.Provider,{value:n||r},e)};function pF(){const t=_.useContext(wf),e=_.useContext(wc);return{componentDisabled:t,componentSize:e}}var p3=Mr(function t(){xr(this,t)}),m3="CALC_UNIT",mF=new RegExp(m3,"g");function Mv(t){return typeof t=="number"?"".concat(t).concat(m3):t}var vF=function(t){Xo(n,t);var e=qo(n);function n(r,i){var a;xr(this,n),a=e.call(this),K(Nt(a),"result",""),K(Nt(a),"unitlessCssVar",void 0),K(Nt(a),"lowPriority",void 0);var l=pt(r);return a.unitlessCssVar=i,r instanceof n?a.result="(".concat(r.result,")"):l==="number"?a.result=Mv(r):l==="string"&&(a.result=r),a}return Mr(n,[{key:"add",value:function(i){return i instanceof n?this.result="".concat(this.result," + ").concat(i.getResult()):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," + ").concat(Mv(i))),this.lowPriority=!0,this}},{key:"sub",value:function(i){return i instanceof n?this.result="".concat(this.result," - ").concat(i.getResult()):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," - ").concat(Mv(i))),this.lowPriority=!0,this}},{key:"mul",value:function(i){return this.lowPriority&&(this.result="(".concat(this.result,")")),i instanceof n?this.result="".concat(this.result," * ").concat(i.getResult(!0)):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," * ").concat(i)),this.lowPriority=!1,this}},{key:"div",value:function(i){return this.lowPriority&&(this.result="(".concat(this.result,")")),i instanceof n?this.result="".concat(this.result," / ").concat(i.getResult(!0)):(typeof i=="number"||typeof i=="string")&&(this.result="".concat(this.result," / ").concat(i)),this.lowPriority=!1,this}},{key:"getResult",value:function(i){return this.lowPriority||i?"(".concat(this.result,")"):this.result}},{key:"equal",value:function(i){var a=this,l=i||{},u=l.unit,f=!0;return typeof u=="boolean"?f=u:Array.from(this.unitlessCssVar).some(function(h){return a.result.includes(h)})&&(f=!1),this.result=this.result.replace(mF,f?"px":""),typeof this.lowPriority<"u"?"calc(".concat(this.result,")"):this.result}}]),n}(p3),_F=function(t){Xo(n,t);var e=qo(n);function n(r){var i;return xr(this,n),i=e.call(this),K(Nt(i),"result",0),r instanceof n?i.result=r.result:typeof r=="number"&&(i.result=r),i}return Mr(n,[{key:"add",value:function(i){return i instanceof n?this.result+=i.result:typeof i=="number"&&(this.result+=i),this}},{key:"sub",value:function(i){return i instanceof n?this.result-=i.result:typeof i=="number"&&(this.result-=i),this}},{key:"mul",value:function(i){return i instanceof n?this.result*=i.result:typeof i=="number"&&(this.result*=i),this}},{key:"div",value:function(i){return i instanceof n?this.result/=i.result:typeof i=="number"&&(this.result/=i),this}},{key:"equal",value:function(){return this.result}}]),n}(p3),yF=function(e,n){var r=e==="css"?vF:_F;return function(i){return new r(i,n)}},lT=function(e,n){return"".concat([n,e.replace(/([A-Z]+)([A-Z][a-z]+)/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2")].filter(Boolean).join("-"))};function fr(t){var e=_.useRef();e.current=t;var n=_.useCallback(function(){for(var r,i=arguments.length,a=new Array(i),l=0;l1e4){var r=Date.now();this.lastAccessBeat.forEach(function(i,a){r-i>wF&&(n.map.delete(a),n.lastAccessBeat.delete(a))}),this.accessBeat=0}}}]),t}(),dT=new TF;function CF(t,e){return Ft.useMemo(function(){var n=dT.get(e);if(n)return n;var r=t();return dT.set(e,r),r},e)}var AF=function(){return{}};function RF(t){var e=t.useCSP,n=e===void 0?AF:e,r=t.useToken,i=t.usePrefix,a=t.getResetStyles,l=t.getCommonStyle,u=t.getCompUnitless;function f(v,S,w,E){var b=Array.isArray(v)?v[0]:v;function C(L){return"".concat(String(b)).concat(L.slice(0,1).toUpperCase()).concat(L.slice(1))}var T=(E==null?void 0:E.unitless)||{},A=typeof u=="function"?u(v):{},O=J(J({},A),{},K({},C("zIndexPopup"),!0));Object.keys(T).forEach(function(L){O[C(L)]=T[L]});var x=J(J({},E),{},{unitless:O,prefixToken:C}),N=g(v,S,w,x),F=h(b,w,x);return function(L){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L,V=N(L,D),B=de(V,2),W=B[1],X=F(D),Y=de(X,2),ae=Y[0],U=Y[1];return[ae,W,U]}}function h(v,S,w){var E=w.unitless,b=w.injectStyle,C=b===void 0?!0:b,T=w.prefixToken,A=w.ignore,O=function(F){var L=F.rootCls,D=F.cssVar,V=D===void 0?{}:D,B=r(),W=B.realToken;return D5({path:[v],prefix:V.prefix,key:V.key,unitless:E,ignore:A,token:W,scope:L},function(){var X=fT(v,W,S),Y=cT(v,W,X,{deprecatedTokens:w==null?void 0:w.deprecatedTokens});return Object.keys(X).forEach(function(ae){Y[T(ae)]=Y[ae],delete Y[ae]}),Y}),null},x=function(F){var L=r(),D=L.cssVar;return[function(V){return C&&D?Ft.createElement(Ft.Fragment,null,Ft.createElement(O,{rootCls:F,cssVar:D,component:v}),V):V},D==null?void 0:D.key]};return x}function g(v,S,w){var E=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},b=Array.isArray(v)?v:[v,v],C=de(b,1),T=C[0],A=b.join("-"),O=t.layer||{name:"antd"};return function(x){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x,F=r(),L=F.theme,D=F.realToken,V=F.hashId,B=F.token,W=F.cssVar,X=i(),Y=X.rootPrefixCls,ae=X.iconPrefixCls,U=n(),z=W?"css":"js",j=CF(function(){var q=new Set;return W&&Object.keys(E.unitless||{}).forEach(function(ce){q.add(xh(ce,W.prefix)),q.add(xh(ce,lT(T,W.prefix)))}),yF(z,q)},[z,T,W==null?void 0:W.prefix]),Z=EF(z),P=Z.max,$=Z.min,ie={theme:L,token:B,hashId:V,nonce:function(){return U.nonce},clientOnly:E.clientOnly,layer:O,order:E.order||-999};typeof a=="function"&&j0(J(J({},ie),{},{clientOnly:!1,path:["Shared",Y]}),function(){return a(B,{prefix:{rootPrefixCls:Y,iconPrefixCls:ae},csp:U})});var se=j0(J(J({},ie),{},{path:[A,x,ae]}),function(){if(E.injectStyle===!1)return[];var q=SF(B),ce=q.token,fe=q.flush,ye=fT(T,D,w),Ee=".".concat(x),Ce=cT(T,D,ye,{deprecatedTokens:E.deprecatedTokens});W&&ye&&pt(ye)==="object"&&Object.keys(ye).forEach(function(_e){ye[_e]="var(".concat(xh(_e,lT(T,W.prefix)),")")});var Te=ui(ce,{componentCls:Ee,prefixCls:x,iconCls:".".concat(ae),antCls:".".concat(Y),calc:j,max:P,min:$},W?ye:Ce),ve=S(Te,{hashId:V,prefixCls:x,rootPrefixCls:Y,iconPrefixCls:ae});fe(T,Ce);var ge=typeof l=="function"?l(Te,x,N,E.resetFont):null;return[E.resetStyle===!1?null:ge,ve]});return[se,V]}}function m(v,S,w){var E=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},b=g(v,S,w,J({resetStyle:!1,order:-998},E)),C=function(A){var O=A.prefixCls,x=A.rootCls,N=x===void 0?O:x;return b(O,N),null};return C}return{genStyleHooks:f,genSubStyleComponent:m,genComponentStyleHook:g}}const Zh=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"],xF="5.24.0";function Pv(t){return t>=0&&t<=255}function ih(t,e){const{r:n,g:r,b:i,a}=new En(t).toRgb();if(a<1)return t;const{r:l,g:u,b:f}=new En(e).toRgb();for(let h=.01;h<=1;h+=.01){const g=Math.round((n-l*(1-h))/h),m=Math.round((r-u*(1-h))/h),v=Math.round((i-f*(1-h))/h);if(Pv(g)&&Pv(m)&&Pv(v))return new En({r:g,g:m,b:v,a:Math.round(h*100)/100}).toRgbString()}return new En({r:n,g:r,b:i,a:1}).toRgbString()}var MF=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i{delete r[v]});const i=Object.assign(Object.assign({},n),r),a=480,l=576,u=768,f=992,h=1200,g=1600;if(i.motion===!1){const v="0s";i.motionDurationFast=v,i.motionDurationMid=v,i.motionDurationSlow=v}return Object.assign(Object.assign(Object.assign({},i),{colorFillContent:i.colorFillSecondary,colorFillContentHover:i.colorFill,colorFillAlter:i.colorFillQuaternary,colorBgContainerDisabled:i.colorFillTertiary,colorBorderBg:i.colorBgContainer,colorSplit:ih(i.colorBorderSecondary,i.colorBgContainer),colorTextPlaceholder:i.colorTextQuaternary,colorTextDisabled:i.colorTextQuaternary,colorTextHeading:i.colorText,colorTextLabel:i.colorTextSecondary,colorTextDescription:i.colorTextTertiary,colorTextLightSolid:i.colorWhite,colorHighlight:i.colorError,colorBgTextHover:i.colorFillSecondary,colorBgTextActive:i.colorFill,colorIcon:i.colorTextTertiary,colorIconHover:i.colorText,colorErrorOutline:ih(i.colorErrorBg,i.colorBgContainer),colorWarningOutline:ih(i.colorWarningBg,i.colorBgContainer),fontSizeIcon:i.fontSizeSM,lineWidthFocus:i.lineWidth*3,lineWidth:i.lineWidth,controlOutlineWidth:i.lineWidth*2,controlInteractiveSize:i.controlHeight/2,controlItemBgHover:i.colorFillTertiary,controlItemBgActive:i.colorPrimaryBg,controlItemBgActiveHover:i.colorPrimaryBgHover,controlItemBgActiveDisabled:i.colorFill,controlTmpOutline:i.colorFillQuaternary,controlOutline:ih(i.colorPrimaryBg,i.colorBgContainer),lineType:i.lineType,borderRadius:i.borderRadius,borderRadiusXS:i.borderRadiusXS,borderRadiusSM:i.borderRadiusSM,borderRadiusLG:i.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:i.sizeXXS,paddingXS:i.sizeXS,paddingSM:i.sizeSM,padding:i.size,paddingMD:i.sizeMD,paddingLG:i.sizeLG,paddingXL:i.sizeXL,paddingContentHorizontalLG:i.sizeLG,paddingContentVerticalLG:i.sizeMS,paddingContentHorizontal:i.sizeMS,paddingContentVertical:i.sizeSM,paddingContentHorizontalSM:i.size,paddingContentVerticalSM:i.sizeXS,marginXXS:i.sizeXXS,marginXS:i.sizeXS,marginSM:i.sizeSM,margin:i.size,marginMD:i.sizeMD,marginLG:i.sizeLG,marginXL:i.sizeXL,marginXXL:i.sizeXXL,boxShadow:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowSecondary:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowTertiary:` + 0 1px 2px 0 rgba(0, 0, 0, 0.03), + 0 1px 6px -1px rgba(0, 0, 0, 0.02), + 0 2px 4px 0 rgba(0, 0, 0, 0.02) + `,screenXS:a,screenXSMin:a,screenXSMax:l-1,screenSM:l,screenSMMin:l,screenSMMax:u-1,screenMD:u,screenMDMin:u,screenMDMax:f-1,screenLG:f,screenLGMin:f,screenLGMax:h-1,screenXL:h,screenXLMin:h,screenXLMax:g-1,screenXXL:g,screenXXLMin:g,boxShadowPopoverArrow:"2px 2px 5px rgba(0, 0, 0, 0.05)",boxShadowCard:` + 0 1px 2px -2px ${new En("rgba(0, 0, 0, 0.16)").toRgbString()}, + 0 3px 6px 0 ${new En("rgba(0, 0, 0, 0.12)").toRgbString()}, + 0 5px 12px 4px ${new En("rgba(0, 0, 0, 0.09)").toRgbString()} + `,boxShadowDrawerRight:` + -6px 0 16px 0 rgba(0, 0, 0, 0.08), + -3px 0 6px -4px rgba(0, 0, 0, 0.12), + -9px 0 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerLeft:` + 6px 0 16px 0 rgba(0, 0, 0, 0.08), + 3px 0 6px -4px rgba(0, 0, 0, 0.12), + 9px 0 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerUp:` + 0 6px 16px 0 rgba(0, 0, 0, 0.08), + 0 3px 6px -4px rgba(0, 0, 0, 0.12), + 0 9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowDrawerDown:` + 0 -6px 16px 0 rgba(0, 0, 0, 0.08), + 0 -3px 6px -4px rgba(0, 0, 0, 0.12), + 0 -9px 28px 8px rgba(0, 0, 0, 0.05) + `,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var hT=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i{const r=n.getDerivativeToken(t),{override:i}=e,a=hT(e,["override"]);let l=Object.assign(Object.assign({},r),{override:i});return l=_3(l),a&&Object.entries(a).forEach(u=>{let[f,h]=u;const{theme:g}=h,m=hT(h,["theme"]);let v=m;g&&(v=b3(Object.assign(Object.assign({},l),m),{override:m},g)),l[f]=v}),l};function Ws(){const{token:t,hashed:e,theme:n,override:r,cssVar:i}=Ft.useContext(g3),a=`${xF}-${e||""}`,l=n||h3,[u,f,h]=a5(l,[Sf,t],{salt:a,override:r,getComputedToken:b3,formatToken:_3,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:y3,ignore:OF,preserve:PF}});return[l,h,e?f:"",u,i]}const a_={overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},Lc=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return{boxSizing:"border-box",margin:0,padding:0,color:t.colorText,fontSize:t.fontSize,lineHeight:t.lineHeight,listStyle:"none",fontFamily:e?"inherit":t.fontFamily}},Yy=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),NF=t=>({a:{color:t.colorLink,textDecoration:t.linkDecoration,backgroundColor:"transparent",outline:"none",cursor:"pointer",transition:`color ${t.motionDurationSlow}`,"-webkit-text-decoration-skip":"objects","&:hover":{color:t.colorLinkHover},"&:active":{color:t.colorLinkActive},"&:active, &:hover":{textDecoration:t.linkHoverDecoration,outline:0},"&:focus":{textDecoration:t.linkFocusDecoration,outline:0},"&[disabled]":{color:t.colorTextDisabled,cursor:"not-allowed"}}}),IF=(t,e,n,r)=>{const i=`[class^="${e}"], [class*=" ${e}"]`,a=n?`.${n}`:i,l={boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}};let u={};return r!==!1&&(u={fontFamily:t.fontFamily,fontSize:t.fontSize}),{[a]:Object.assign(Object.assign(Object.assign({},u),l),{[i]:l})}},S3=t=>({[`.${t}`]:Object.assign(Object.assign({},Yy()),{[`.${t} .${t}-icon`]:{display:"block"}})}),{genStyleHooks:zc}=RF({usePrefix:()=>{const{getPrefixCls:t,iconPrefixCls:e}=_.useContext(ci);return{rootPrefixCls:t(),iconPrefixCls:e}},useToken:()=>{const[t,e,n,r,i]=Ws();return{theme:t,realToken:e,hashId:n,token:r,cssVar:i}},useCSP:()=>{const{csp:t}=_.useContext(ci);return t??{}},getResetStyles:(t,e)=>{var n;return[{"&":NF(t)},S3((n=e==null?void 0:e.prefix.iconPrefixCls)!==null&&n!==void 0?n:qy)]},getCommonStyle:IF,getCompUnitless:()=>y3});function DF(t,e){return Zh.reduce((n,r)=>{const i=t[`${r}1`],a=t[`${r}3`],l=t[`${r}6`],u=t[`${r}7`];return Object.assign(Object.assign({},n),e(r,{lightColor:i,lightBorderColor:a,darkColor:l,textColor:u}))},{})}const FF=(t,e)=>{const[n,r]=Ws();return j0({token:r,hashId:"",path:["ant-design-icons",t],nonce:()=>e==null?void 0:e.nonce,layer:{name:"antd"}},()=>[S3(t)])},kF=Object.assign({},Xg),{useId:gT}=kF,BF=()=>"",UF=typeof gT>"u"?BF:gT;function LF(t,e,n){var r;l3();const i=t||{},a=i.inherit===!1||!e?Object.assign(Object.assign({},r_),{hashed:(r=e==null?void 0:e.hashed)!==null&&r!==void 0?r:r_.hashed,cssVar:e==null?void 0:e.cssVar}):e,l=UF();return Kg(()=>{var u,f;if(!t)return e;const h=Object.assign({},a.components);Object.keys(t.components||{}).forEach(v=>{h[v]=Object.assign(Object.assign({},h[v]),t.components[v])});const g=`css-var-${l.replace(/:/g,"")}`,m=((u=i.cssVar)!==null&&u!==void 0?u:a.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof a.cssVar=="object"?a.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((f=i.cssVar)===null||f===void 0?void 0:f.key)||g});return Object.assign(Object.assign(Object.assign({},a),i),{token:Object.assign(Object.assign({},a.token),i.token),components:h,cssVar:m})},[i,a],(u,f)=>u.some((h,g)=>{const m=f[g];return!qh(h,m,!0)}))}var zF=["children"],E3=_.createContext({});function $F(t){var e=t.children,n=Fn(t,zF);return _.createElement(E3.Provider,{value:n},e)}var VF=function(t){Xo(n,t);var e=qo(n);function n(){return xr(this,n),e.apply(this,arguments)}return Mr(n,[{key:"render",value:function(){return this.props.children}}]),n}(_.Component);function HF(t){var e=_.useReducer(function(u){return u+1},0),n=de(e,2),r=n[1],i=_.useRef(t),a=fr(function(){return i.current}),l=fr(function(u){i.current=typeof u=="function"?u(i.current):u,r()});return[a,l]}var Sa="none",sh="appear",ah="enter",oh="leave",pT="none",qi="prepare",jl="start",Wl="active",Ky="end",w3="prepared";function mT(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit".concat(t)]="webkit".concat(e),n["Moz".concat(t)]="moz".concat(e),n["ms".concat(t)]="MS".concat(e),n["O".concat(t)]="o".concat(e.toLowerCase()),n}function jF(t,e){var n={animationend:mT("Animation","AnimationEnd"),transitionend:mT("Transition","TransitionEnd")};return t&&("AnimationEvent"in e||delete n.animationend.animation,"TransitionEvent"in e||delete n.transitionend.transition),n}var WF=jF(Zr(),typeof window<"u"?window:{}),T3={};if(Zr()){var XF=document.createElement("div");T3=XF.style}var lh={};function C3(t){if(lh[t])return lh[t];var e=WF[t];if(e)for(var n=Object.keys(e),r=n.length,i=0;i1&&arguments[1]!==void 0?arguments[1]:2;e();var a=dr(function(){i<=1?r({isCanceled:function(){return a!==t.current}}):n(r,i-1)});t.current=a}return _.useEffect(function(){return function(){e()}},[]),[n,e]};var KF=[qi,jl,Wl,Ky],ZF=[qi,w3],O3=!1,QF=!0;function P3(t){return t===Wl||t===Ky}const GF=function(t,e,n){var r=Tf(pT),i=de(r,2),a=i[0],l=i[1],u=YF(),f=de(u,2),h=f[0],g=f[1];function m(){l(qi,!0)}var v=e?ZF:KF;return M3(function(){if(a!==pT&&a!==Ky){var S=v.indexOf(a),w=v[S+1],E=n(a);E===O3?l(w,!0):w&&h(function(b){function C(){b.isCanceled()||l(w,!0)}E===!0?C():Promise.resolve(E).then(C)})}},[t,a]),_.useEffect(function(){return function(){g()}},[]),[m,a]};function JF(t,e,n,r){var i=r.motionEnter,a=i===void 0?!0:i,l=r.motionAppear,u=l===void 0?!0:l,f=r.motionLeave,h=f===void 0?!0:f,g=r.motionDeadline,m=r.motionLeaveImmediately,v=r.onAppearPrepare,S=r.onEnterPrepare,w=r.onLeavePrepare,E=r.onAppearStart,b=r.onEnterStart,C=r.onLeaveStart,T=r.onAppearActive,A=r.onEnterActive,O=r.onLeaveActive,x=r.onAppearEnd,N=r.onEnterEnd,F=r.onLeaveEnd,L=r.onVisibleChanged,D=Tf(),V=de(D,2),B=V[0],W=V[1],X=HF(Sa),Y=de(X,2),ae=Y[0],U=Y[1],z=Tf(null),j=de(z,2),Z=j[0],P=j[1],$=ae(),ie=_.useRef(!1),se=_.useRef(null);function q(){return n()}var ce=_.useRef(!1);function fe(){U(Sa),P(null,!0)}var ye=fr(function(He){var Ge=ae();if(Ge!==Sa){var Pe=q();if(!(He&&!He.deadline&&He.target!==Pe)){var Me=ce.current,dt;Ge===sh&&Me?dt=x==null?void 0:x(Pe,He):Ge===ah&&Me?dt=N==null?void 0:N(Pe,He):Ge===oh&&Me&&(dt=F==null?void 0:F(Pe,He)),Me&&dt!==!1&&fe()}}}),Ee=qF(ye),Ce=de(Ee,1),Te=Ce[0],ve=function(Ge){switch(Ge){case sh:return K(K(K({},qi,v),jl,E),Wl,T);case ah:return K(K(K({},qi,S),jl,b),Wl,A);case oh:return K(K(K({},qi,w),jl,C),Wl,O);default:return{}}},ge=_.useMemo(function(){return ve($)},[$]),_e=GF($,!t,function(He){if(He===qi){var Ge=ge[qi];return Ge?Ge(q()):O3}if(xe in ge){var Pe;P(((Pe=ge[xe])===null||Pe===void 0?void 0:Pe.call(ge,q(),null))||null)}return xe===Wl&&$!==Sa&&(Te(q()),g>0&&(clearTimeout(se.current),se.current=setTimeout(function(){ye({deadline:!0})},g))),xe===w3&&fe(),QF}),Ie=de(_e,2),we=Ie[0],xe=Ie[1],Ve=P3(xe);ce.current=Ve;var Fe=_.useRef(null);M3(function(){if(!(ie.current&&Fe.current===e)){W(e);var He=ie.current;ie.current=!0;var Ge;!He&&e&&u&&(Ge=sh),He&&e&&a&&(Ge=ah),(He&&!e&&h||!He&&m&&!e&&h)&&(Ge=oh);var Pe=ve(Ge);Ge&&(t||Pe[qi])?(U(Ge),we()):U(Sa),Fe.current=e}},[e]),_.useEffect(function(){($===sh&&!u||$===ah&&!a||$===oh&&!h)&&U(Sa)},[u,a,h]),_.useEffect(function(){return function(){ie.current=!1,clearTimeout(se.current)}},[]);var Be=_.useRef(!1);_.useEffect(function(){B&&(Be.current=!0),B!==void 0&&$===Sa&&((Be.current||B)&&(L==null||L(B)),Be.current=!0)},[B,$]);var nt=Z;return ge[qi]&&xe===jl&&(nt=J({transition:"none"},nt)),[$,xe,nt,B??e]}function ek(t){var e=t;pt(t)==="object"&&(e=t.transitionSupport);function n(i,a){return!!(i.motionName&&e&&a!==!1)}var r=_.forwardRef(function(i,a){var l=i.visible,u=l===void 0?!0:l,f=i.removeOnLeave,h=f===void 0?!0:f,g=i.forceRender,m=i.children,v=i.motionName,S=i.leavedClassName,w=i.eventProps,E=_.useContext(E3),b=E.motion,C=n(i,b),T=_.useRef(),A=_.useRef();function O(){try{return T.current instanceof HTMLElement?T.current:Gu(A.current)}catch{return null}}var x=JF(C,u,O,i),N=de(x,4),F=N[0],L=N[1],D=N[2],V=N[3],B=_.useRef(V);V&&(B.current=!0);var W=_.useCallback(function(j){T.current=j,Dy(a,j)},[a]),X,Y=J(J({},w),{},{visible:u});if(!m)X=null;else if(F===Sa)V?X=m(J({},Y),W):!h&&B.current&&S?X=m(J(J({},Y),{},{className:S}),W):g||!h&&!S?X=m(J(J({},Y),{},{style:{display:"none"}}),W):X=null;else{var ae;L===qi?ae="prepare":P3(L)?ae="active":L===jl&&(ae="start");var U=yT(v,"".concat(F,"-").concat(ae));X=m(J(J({},Y),{},{className:Ze(yT(v,F),K(K({},U,U&&ae),v,typeof v=="string")),style:D}),W)}if(_.isValidElement(X)&&Gg(X)){var z=Fy(X);z||(X=_.cloneElement(X,{ref:W}))}return _.createElement(VF,{ref:A},X)});return r.displayName="CSSMotion",r}const Zy=ek(x3);var o_="add",l_="keep",c_="remove",Nv="removed";function tk(t){var e;return t&&pt(t)==="object"&&"key"in t?e=t:e={key:t},J(J({},e),{},{key:String(e.key)})}function u_(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return t.map(tk)}function nk(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=e.length,a=u_(t),l=u_(e);a.forEach(function(h){for(var g=!1,m=r;m1});return f.forEach(function(h){n=n.filter(function(g){var m=g.key,v=g.status;return m!==h||v!==c_}),n.forEach(function(g){g.key===h&&(g.status=l_)})}),n}var rk=["component","children","onVisibleChanged","onAllRemoved"],ik=["status"],sk=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function ak(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Zy,n=function(r){Xo(a,r);var i=qo(a);function a(){var l;xr(this,a);for(var u=arguments.length,f=new Array(u),h=0;hnull;var ck=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);ie.endsWith("Color"))}const hk=t=>{const{prefixCls:e,iconPrefixCls:n,theme:r,holderRender:i}=t;e!==void 0&&(N3=e),r&&dk(r)&&dF(fk(),r)},gk=t=>{const{children:e,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:a,form:l,locale:u,componentSize:f,direction:h,space:g,splitter:m,virtual:v,dropdownMatchSelectWidth:S,popupMatchSelectWidth:w,popupOverflow:E,legacyLocale:b,parentContext:C,iconPrefixCls:T,theme:A,componentDisabled:O,segmented:x,statistic:N,spin:F,calendar:L,carousel:D,cascader:V,collapse:B,typography:W,checkbox:X,descriptions:Y,divider:ae,drawer:U,skeleton:z,steps:j,image:Z,layout:P,list:$,mentions:ie,modal:se,progress:q,result:ce,slider:fe,breadcrumb:ye,menu:Ee,pagination:Ce,input:Te,textArea:ve,empty:ge,badge:_e,radio:Ie,rate:we,switch:xe,transfer:Ve,avatar:Fe,message:Be,tag:nt,table:He,card:Ge,tabs:Pe,timeline:Me,timePicker:dt,upload:rt,notification:it,tree:st,colorPicker:at,datePicker:Je,rangePicker:lt,flex:ft,wave:ct,dropdown:mt,warning:xt,tour:Bt,tooltip:ht,popover:Vt,popconfirm:qt,floatButtonGroup:wn,variant:Mn,inputNumber:Ut,treeSelect:It}=t,Lt=_.useCallback((We,Qe)=>{const{prefixCls:bt}=t;if(Qe)return Qe;const _t=bt||C.getPrefixCls("");return We?`${_t}-${We}`:_t},[C.getPrefixCls,t.prefixCls]),Jt=T||C.iconPrefixCls||qy,Mt=n||C.csp;FF(Jt,Mt);const qe=LF(A,C.theme,{prefixCls:Lt("")}),ke={csp:Mt,autoInsertSpaceInButton:r,alert:i,anchor:a,locale:u||b,direction:h,space:g,splitter:m,virtual:v,popupMatchSelectWidth:w??S,popupOverflow:E,getPrefixCls:Lt,iconPrefixCls:Jt,theme:qe,segmented:x,statistic:N,spin:F,calendar:L,carousel:D,cascader:V,collapse:B,typography:W,checkbox:X,descriptions:Y,divider:ae,drawer:U,skeleton:z,steps:j,image:Z,input:Te,textArea:ve,layout:P,list:$,mentions:ie,modal:se,progress:q,result:ce,slider:fe,breadcrumb:ye,menu:Ee,pagination:Ce,empty:ge,badge:_e,radio:Ie,rate:we,switch:xe,transfer:Ve,avatar:Fe,message:Be,tag:nt,table:He,card:Ge,tabs:Pe,timeline:Me,timePicker:dt,upload:rt,notification:it,tree:st,colorPicker:at,datePicker:Je,rangePicker:lt,flex:ft,wave:ct,dropdown:mt,warning:xt,tour:Bt,tooltip:ht,popover:Vt,popconfirm:qt,floatButtonGroup:wn,variant:Mn,inputNumber:Ut,treeSelect:It},Ne=Object.assign({},C);Object.keys(ke).forEach(We=>{ke[We]!==void 0&&(Ne[We]=ke[We])}),uk.forEach(We=>{const Qe=t[We];Qe&&(Ne[We]=Qe)}),typeof r<"u"&&(Ne.button=Object.assign({autoInsertSpace:r},Ne.button));const Et=Kg(()=>Ne,Ne,(We,Qe)=>{const bt=Object.keys(We),_t=Object.keys(Qe);return bt.length!==_t.length||bt.some(Zt=>We[Zt]!==Qe[Zt])}),{layer:en}=_.useContext($f),Ue=_.useMemo(()=>({prefixCls:Jt,csp:Mt,layer:en?"antd":void 0}),[Jt,Mt,en]);let Oe=_.createElement(_.Fragment,null,_.createElement(lk,{dropdownMatchSelectWidth:S}),e);const je=_.useMemo(()=>{var We,Qe,bt,_t;return Hl(((We=Ec.Form)===null||We===void 0?void 0:We.defaultValidateMessages)||{},((bt=(Qe=Et.locale)===null||Qe===void 0?void 0:Qe.Form)===null||bt===void 0?void 0:bt.defaultValidateMessages)||{},((_t=Et.form)===null||_t===void 0?void 0:_t.validateMessages)||{},(l==null?void 0:l.validateMessages)||{})},[Et,l==null?void 0:l.validateMessages]);Object.keys(je).length>0&&(Oe=_.createElement(z5.Provider,{value:je},Oe)),u&&(Oe=_.createElement(X5,{locale:u,_ANT_MARK__:W5},Oe)),Oe=_.createElement(jy.Provider,{value:Ue},Oe),f&&(Oe=_.createElement(gF,{size:f},Oe)),Oe=_.createElement(ok,null,Oe);const Ye=_.useMemo(()=>{const We=qe||{},{algorithm:Qe,token:bt,components:_t,cssVar:Zt}=We,Yt=ck(We,["algorithm","token","components","cssVar"]),vn=Qe&&(!Array.isArray(Qe)||Qe.length>0)?z0(Qe):h3,On={};Object.entries(_t||{}).forEach(Zn=>{let[un,rn]=Zn;const Ae=Object.assign({},rn);"algorithm"in Ae&&(Ae.algorithm===!0?Ae.theme=vn:(Array.isArray(Ae.algorithm)||typeof Ae.algorithm=="function")&&(Ae.theme=z0(Ae.algorithm)),delete Ae.algorithm),On[un]=Ae});const _n=Object.assign(Object.assign({},Sf),bt);return Object.assign(Object.assign({},Yt),{theme:vn,token:_n,components:On,override:Object.assign({override:_n},On),cssVar:Zt})},[qe]);return A&&(Oe=_.createElement(g3.Provider,{value:Ye},Oe)),Et.warning&&(Oe=_.createElement(L5.Provider,{value:Et.warning},Oe)),O!==void 0&&(Oe=_.createElement(hF,{disabled:O},Oe)),_.createElement(ci.Provider,{value:Et},Oe)},$c=t=>{const e=_.useContext(ci),n=_.useContext(Wy);return _.createElement(gk,Object.assign({parentContext:e,legacyLocale:n},t))};$c.ConfigContext=ci;$c.SizeContext=wc;$c.config=hk;$c.useConfig=pF;Object.defineProperty($c,"SizeContext",{get:()=>wc});function I3(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}function pk(t){return I3(t)instanceof ShadowRoot}function Qh(t){return pk(t)?I3(t):null}function mk(t){return t.replace(/-(.)/g,function(e,n){return n.toUpperCase()})}function vk(t,e){kr(t,"[@ant-design/icons] ".concat(e))}function bT(t){return pt(t)==="object"&&typeof t.name=="string"&&typeof t.theme=="string"&&(pt(t.icon)==="object"||typeof t.icon=="function")}function ST(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(t).reduce(function(e,n){var r=t[n];switch(n){case"class":e.className=r,delete e.class;break;default:delete e[n],e[mk(n)]=r}return e},{})}function f_(t,e,n){return n?Ft.createElement(t.tag,J(J({key:e},ST(t.attrs)),n),(t.children||[]).map(function(r,i){return f_(r,"".concat(e,"-").concat(t.tag,"-").concat(i))})):Ft.createElement(t.tag,J({key:e},ST(t.attrs)),(t.children||[]).map(function(r,i){return f_(r,"".concat(e,"-").concat(t.tag,"-").concat(i))}))}function D3(t){return Ef(t)[0]}function F3(t){return t?Array.isArray(t)?t:[t]:[]}var _k=` +.anticon { + display: inline-flex; + align-items: center; + color: inherit; + font-style: normal; + line-height: 0; + text-align: center; + text-transform: none; + vertical-align: -0.125em; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.anticon > * { + line-height: 1; +} + +.anticon svg { + display: inline-block; +} + +.anticon::before { + display: none; +} + +.anticon .anticon-icon { + display: block; +} + +.anticon[tabindex] { + cursor: pointer; +} + +.anticon-spin::before, +.anticon-spin { + display: inline-block; + -webkit-animation: loadingCircle 1s infinite linear; + animation: loadingCircle 1s infinite linear; +} + +@-webkit-keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes loadingCircle { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +`,yk=function(e){var n=_.useContext(jy),r=n.csp,i=n.prefixCls,a=n.layer,l=_k;i&&(l=l.replace(/anticon/g,i)),a&&(l="@layer ".concat(a,` { +`).concat(l,` +}`)),_.useEffect(function(){var u=e.current,f=Qh(u);Hs(l,"@ant-design-icons",{prepend:!a,csp:r,attachTo:f})},[])},bk=["icon","className","onClick","style","primaryColor","secondaryColor"],ef={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function Sk(t){var e=t.primaryColor,n=t.secondaryColor;ef.primaryColor=e,ef.secondaryColor=n||D3(e),ef.calculated=!!n}function Ek(){return J({},ef)}var Vc=function(e){var n=e.icon,r=e.className,i=e.onClick,a=e.style,l=e.primaryColor,u=e.secondaryColor,f=Fn(e,bk),h=_.useRef(),g=ef;if(l&&(g={primaryColor:l,secondaryColor:u||D3(l)}),yk(h),vk(bT(n),"icon should be icon definiton, but got ".concat(n)),!bT(n))return null;var m=n;return m&&typeof m.icon=="function"&&(m=J(J({},m),{},{icon:m.icon(g.primaryColor,g.secondaryColor)})),f_(m.icon,"svg-".concat(m.name),J(J({className:r,onClick:i,style:a,"data-icon":m.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},f),{},{ref:h}))};Vc.displayName="IconReact";Vc.getTwoToneColors=Ek;Vc.setTwoToneColors=Sk;function k3(t){var e=F3(t),n=de(e,2),r=n[0],i=n[1];return Vc.setTwoToneColors({primaryColor:r,secondaryColor:i})}function wk(){var t=Vc.getTwoToneColors();return t.calculated?[t.primaryColor,t.secondaryColor]:t.primaryColor}var Tk=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];k3(Kh.primary);var Xs=_.forwardRef(function(t,e){var n=t.className,r=t.icon,i=t.spin,a=t.rotate,l=t.tabIndex,u=t.onClick,f=t.twoToneColor,h=Fn(t,Tk),g=_.useContext(jy),m=g.prefixCls,v=m===void 0?"anticon":m,S=g.rootClassName,w=Ze(S,v,K(K({},"".concat(v,"-").concat(r.name),!!r.name),"".concat(v,"-spin"),!!i||r.name==="loading"),n),E=l;E===void 0&&u&&(E=-1);var b=a?{msTransform:"rotate(".concat(a,"deg)"),transform:"rotate(".concat(a,"deg)")}:void 0,C=F3(f),T=de(C,2),A=T[0],O=T[1];return _.createElement("span",kt({role:"img","aria-label":r.name},h,{ref:e,tabIndex:E,onClick:u,className:w}),_.createElement(Vc,{icon:r,primaryColor:A,secondaryColor:O,style:b}))});Xs.displayName="AntdIcon";Xs.getTwoToneColor=wk;Xs.setTwoToneColor=k3;var Ck={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"}}]},name:"close-circle",theme:"filled"},Ak=function(e,n){return _.createElement(Xs,kt({},e,{ref:n,icon:Ck}))},Rk=_.forwardRef(Ak),xk={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},Mk=function(e,n){return _.createElement(Xs,kt({},e,{ref:n,icon:xk}))},Ok=_.forwardRef(Mk),Pk=`accept acceptCharset accessKey action allowFullScreen allowTransparency + alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge + charSet checked classID className colSpan cols content contentEditable contextMenu + controls coords crossOrigin data dateTime default defer dir disabled download draggable + encType form formAction formEncType formMethod formNoValidate formTarget frameBorder + headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity + is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media + mediaGroup method min minLength multiple muted name noValidate nonce open + optimum pattern placeholder poster preload radioGroup readOnly rel required + reversed role rowSpan rows sandbox scope scoped scrolling seamless selected + shape size sizes span spellCheck src srcDoc srcLang srcSet start step style + summary tabIndex target title type useMap value width wmode wrap`,Nk=`onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown + onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick + onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown + onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel + onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough + onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,Ik="".concat(Pk," ").concat(Nk).split(/[\s\n]+/),Dk="aria-",Fk="data-";function ET(t,e){return t.indexOf(e)===0}function Gh(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=J({},e);var r={};return Object.keys(t).forEach(function(i){(n.aria&&(i==="role"||ET(i,Dk))||n.data&&ET(i,Fk)||n.attr&&Ik.includes(i))&&(r[i]=t[i])}),r}function kk(t){return t&&Ft.isValidElement(t)&&t.type===Ft.Fragment}const Bk=(t,e,n)=>Ft.isValidElement(t)?Ft.cloneElement(t,typeof n=="function"?n(t.props||{}):n):e;function B3(t,e){return Bk(t,t,e)}const Uk=t=>{const[,,,,e]=Ws();return e?`${t}-css-var`:""};var et={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,CAPS_LOCK:20,ESC:27,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,N:78,P:80,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,SEMICOLON:186,EQUALS:187,WIN_KEY:224},Lk={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},zk=function(e,n){return _.createElement(Xs,kt({},e,{ref:n,icon:Lk}))},$k=_.forwardRef(zk);const U3=Ft.createContext(void 0),co=100,L3={Modal:co,Drawer:co,Popover:co,Popconfirm:co,Tooltip:co,Tour:co,FloatButton:co},Vk={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function Hk(t){return t in L3}const z3=(t,e)=>{const[,n]=Ws(),r=Ft.useContext(U3),i=Hk(t);let a;if(e!==void 0)a=[e,e];else{let l=r??0;i?l+=(r?0:n.zIndexPopupBase)+L3[t]:l+=Vk[t],a=[r===void 0?e:l,l]}return a};function ts(){ts=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(U,z,j){U[z]=j.value},a=typeof Symbol=="function"?Symbol:{},l=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function h(U,z,j){return Object.defineProperty(U,z,{value:j,enumerable:!0,configurable:!0,writable:!0}),U[z]}try{h({},"")}catch{h=function(j,Z,P){return j[Z]=P}}function g(U,z,j,Z){var P=z&&z.prototype instanceof C?z:C,$=Object.create(P.prototype),ie=new Y(Z||[]);return i($,"_invoke",{value:V(U,j,ie)}),$}function m(U,z,j){try{return{type:"normal",arg:U.call(z,j)}}catch(Z){return{type:"throw",arg:Z}}}e.wrap=g;var v="suspendedStart",S="suspendedYield",w="executing",E="completed",b={};function C(){}function T(){}function A(){}var O={};h(O,l,function(){return this});var x=Object.getPrototypeOf,N=x&&x(x(ae([])));N&&N!==n&&r.call(N,l)&&(O=N);var F=A.prototype=C.prototype=Object.create(O);function L(U){["next","throw","return"].forEach(function(z){h(U,z,function(j){return this._invoke(z,j)})})}function D(U,z){function j(P,$,ie,se){var q=m(U[P],U,$);if(q.type!=="throw"){var ce=q.arg,fe=ce.value;return fe&&pt(fe)=="object"&&r.call(fe,"__await")?z.resolve(fe.__await).then(function(ye){j("next",ye,ie,se)},function(ye){j("throw",ye,ie,se)}):z.resolve(fe).then(function(ye){ce.value=ye,ie(ce)},function(ye){return j("throw",ye,ie,se)})}se(q.arg)}var Z;i(this,"_invoke",{value:function($,ie){function se(){return new z(function(q,ce){j($,ie,q,ce)})}return Z=Z?Z.then(se,se):se()}})}function V(U,z,j){var Z=v;return function(P,$){if(Z===w)throw Error("Generator is already running");if(Z===E){if(P==="throw")throw $;return{value:t,done:!0}}for(j.method=P,j.arg=$;;){var ie=j.delegate;if(ie){var se=B(ie,j);if(se){if(se===b)continue;return se}}if(j.method==="next")j.sent=j._sent=j.arg;else if(j.method==="throw"){if(Z===v)throw Z=E,j.arg;j.dispatchException(j.arg)}else j.method==="return"&&j.abrupt("return",j.arg);Z=w;var q=m(U,z,j);if(q.type==="normal"){if(Z=j.done?E:S,q.arg===b)continue;return{value:q.arg,done:j.done}}q.type==="throw"&&(Z=E,j.method="throw",j.arg=q.arg)}}}function B(U,z){var j=z.method,Z=U.iterator[j];if(Z===t)return z.delegate=null,j==="throw"&&U.iterator.return&&(z.method="return",z.arg=t,B(U,z),z.method==="throw")||j!=="return"&&(z.method="throw",z.arg=new TypeError("The iterator does not provide a '"+j+"' method")),b;var P=m(Z,U.iterator,z.arg);if(P.type==="throw")return z.method="throw",z.arg=P.arg,z.delegate=null,b;var $=P.arg;return $?$.done?(z[U.resultName]=$.value,z.next=U.nextLoc,z.method!=="return"&&(z.method="next",z.arg=t),z.delegate=null,b):$:(z.method="throw",z.arg=new TypeError("iterator result is not an object"),z.delegate=null,b)}function W(U){var z={tryLoc:U[0]};1 in U&&(z.catchLoc=U[1]),2 in U&&(z.finallyLoc=U[2],z.afterLoc=U[3]),this.tryEntries.push(z)}function X(U){var z=U.completion||{};z.type="normal",delete z.arg,U.completion=z}function Y(U){this.tryEntries=[{tryLoc:"root"}],U.forEach(W,this),this.reset(!0)}function ae(U){if(U||U===""){var z=U[l];if(z)return z.call(U);if(typeof U.next=="function")return U;if(!isNaN(U.length)){var j=-1,Z=function P(){for(;++j=0;--P){var $=this.tryEntries[P],ie=$.completion;if($.tryLoc==="root")return Z("end");if($.tryLoc<=this.prev){var se=r.call($,"catchLoc"),q=r.call($,"finallyLoc");if(se&&q){if(this.prev<$.catchLoc)return Z($.catchLoc,!0);if(this.prev<$.finallyLoc)return Z($.finallyLoc)}else if(se){if(this.prev<$.catchLoc)return Z($.catchLoc,!0)}else{if(!q)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return Z($.finallyLoc)}}}},abrupt:function(z,j){for(var Z=this.tryEntries.length-1;Z>=0;--Z){var P=this.tryEntries[Z];if(P.tryLoc<=this.prev&&r.call(P,"finallyLoc")&&this.prev=0;--j){var Z=this.tryEntries[j];if(Z.finallyLoc===z)return this.complete(Z.completion,Z.afterLoc),X(Z),b}},catch:function(z){for(var j=this.tryEntries.length-1;j>=0;--j){var Z=this.tryEntries[j];if(Z.tryLoc===z){var P=Z.completion;if(P.type==="throw"){var $=P.arg;X(Z)}return $}}throw Error("illegal catch attempt")},delegateYield:function(z,j,Z){return this.delegate={iterator:ae(z),resultName:j,nextLoc:Z},this.method==="next"&&(this.arg=t),b}},e}function wT(t,e,n,r,i,a,l){try{var u=t[a](l),f=u.value}catch(h){return void n(h)}u.done?e(f):Promise.resolve(f).then(r,i)}function Vf(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function l(f){wT(a,r,i,l,u,"next",f)}function u(f){wT(a,r,i,l,u,"throw",f)}l(void 0)})}}const $3=(t,e,n)=>n!==void 0?n:`${t}-${e}`;function V3(t,e){var n=Object.assign({},t);return Array.isArray(e)&&e.forEach(function(r){delete n[r]}),n}const jk=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,r=e.height;if(n||r)return!0}if(t.getBoundingClientRect){var i=t.getBoundingClientRect(),a=i.width,l=i.height;if(a||l)return!0}}return!1},H3=t=>{const e=Ft.useContext(wc);return Ft.useMemo(()=>t?typeof t=="string"?t??e:t instanceof Function?t(e):e:e,[t,e])},Wk=t=>{const{componentCls:e}=t;return{[e]:{"&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},Xk=t=>{const{componentCls:e,antCls:n}=t;return{[e]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${e}-item:empty`]:{display:"none"},[`${e}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},qk=t=>{const{componentCls:e}=t;return{[e]:{"&-gap-row-small":{rowGap:t.spaceGapSmallSize},"&-gap-row-middle":{rowGap:t.spaceGapMiddleSize},"&-gap-row-large":{rowGap:t.spaceGapLargeSize},"&-gap-col-small":{columnGap:t.spaceGapSmallSize},"&-gap-col-middle":{columnGap:t.spaceGapMiddleSize},"&-gap-col-large":{columnGap:t.spaceGapLargeSize}}}},j3=zc("Space",t=>{const e=ui(t,{spaceGapSmallSize:t.paddingXS,spaceGapMiddleSize:t.padding,spaceGapLargeSize:t.paddingLG});return[Xk(e),qk(e),Wk(e)]},()=>({}),{resetStyle:!1});var W3=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i{const n=_.useContext(rp),r=_.useMemo(()=>{if(!n)return"";const{compactDirection:i,isFirstItem:a,isLastItem:l}=n,u=i==="vertical"?"-vertical-":"-";return Ze(`${t}-compact${u}item`,{[`${t}-compact${u}first-item`]:a,[`${t}-compact${u}last-item`]:l,[`${t}-compact${u}item-rtl`]:e==="rtl"})},[t,e,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:r}},Kk=t=>{const{children:e}=t;return _.createElement(rp.Provider,{value:null},e)},Zk=t=>{const{children:e}=t,n=W3(t,["children"]);return _.createElement(rp.Provider,{value:_.useMemo(()=>n,[n])},e)},Qk=t=>{const{getPrefixCls:e,direction:n}=_.useContext(ci),{size:r,direction:i,block:a,prefixCls:l,className:u,rootClassName:f,children:h}=t,g=W3(t,["size","direction","block","prefixCls","className","rootClassName","children"]),m=H3(A=>r??A),v=e("space-compact",l),[S,w]=j3(v),E=Ze(v,w,{[`${v}-rtl`]:n==="rtl",[`${v}-block`]:a,[`${v}-vertical`]:i==="vertical"},u,f),b=_.useContext(rp),C=Lo(h),T=_.useMemo(()=>C.map((A,O)=>{const x=(A==null?void 0:A.key)||`${v}-item-${O}`;return _.createElement(Zk,{key:x,compactSize:m,compactDirection:i,isFirstItem:O===0&&(!b||(b==null?void 0:b.isFirstItem)),isLastItem:O===C.length-1&&(!b||(b==null?void 0:b.isLastItem))},A)}),[r,C,b]);return C.length===0?null:S(_.createElement("div",Object.assign({className:E},g),T))},Gk=t=>({animationDuration:t,animationFillMode:"both"}),Jk=t=>({animationDuration:t,animationFillMode:"both"}),Qy=function(t,e,n,r){const a=(arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1)?"&":"";return{[` + ${a}${t}-enter, + ${a}${t}-appear + `]:Object.assign(Object.assign({},Gk(r)),{animationPlayState:"paused"}),[`${a}${t}-leave`]:Object.assign(Object.assign({},Jk(r)),{animationPlayState:"paused"}),[` + ${a}${t}-enter${t}-enter-active, + ${a}${t}-appear${t}-appear-active + `]:{animationName:e,animationPlayState:"running"},[`${a}${t}-leave${t}-leave-active`]:{animationName:n,animationPlayState:"running",pointerEvents:"none"}}},e8=new ln("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),t8=new ln("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),n8=new ln("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),r8=new ln("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),i8=new ln("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),s8=new ln("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),a8=new ln("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),o8=new ln("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}}),l8={"move-up":{inKeyframes:a8,outKeyframes:o8},"move-down":{inKeyframes:e8,outKeyframes:t8},"move-left":{inKeyframes:n8,outKeyframes:r8},"move-right":{inKeyframes:i8,outKeyframes:s8}},TT=(t,e)=>{const{antCls:n}=t,r=`${n}-${e}`,{inKeyframes:i,outKeyframes:a}=l8[e];return[Qy(r,i,a,t.motionDurationMid),{[` + ${r}-enter, + ${r}-appear + `]:{opacity:0,animationTimingFunction:t.motionEaseOutCirc},[`${r}-leave`]:{animationTimingFunction:t.motionEaseInOutCirc}}]},X3=new ln("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),q3=new ln("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),Y3=new ln("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),K3=new ln("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),c8=new ln("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),u8=new ln("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}}),f8=new ln("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),d8=new ln("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}}),h8={"slide-up":{inKeyframes:X3,outKeyframes:q3},"slide-down":{inKeyframes:Y3,outKeyframes:K3},"slide-left":{inKeyframes:c8,outKeyframes:u8},"slide-right":{inKeyframes:f8,outKeyframes:d8}},CT=(t,e)=>{const{antCls:n}=t,r=`${n}-${e}`,{inKeyframes:i,outKeyframes:a}=h8[e];return[Qy(r,i,a,t.motionDurationMid),{[` + ${r}-enter, + ${r}-appear + `]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:t.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},[`${r}-leave`]:{animationTimingFunction:t.motionEaseInQuint}}]},g8=new ln("antZoomIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),p8=new ln("antZoomOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),AT=new ln("antZoomBigIn",{"0%":{transform:"scale(0.8)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),RT=new ln("antZoomBigOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.8)",opacity:0}}),m8=new ln("antZoomUpIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 0%"}}),v8=new ln("antZoomUpOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 0%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 0%",opacity:0}}),_8=new ln("antZoomLeftIn",{"0%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"0% 50%"}}),y8=new ln("antZoomLeftOut",{"0%":{transform:"scale(1)",transformOrigin:"0% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"0% 50%",opacity:0}}),b8=new ln("antZoomRightIn",{"0%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"100% 50%"}}),S8=new ln("antZoomRightOut",{"0%":{transform:"scale(1)",transformOrigin:"100% 50%"},"100%":{transform:"scale(0.8)",transformOrigin:"100% 50%",opacity:0}}),E8=new ln("antZoomDownIn",{"0%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0},"100%":{transform:"scale(1)",transformOrigin:"50% 100%"}}),w8=new ln("antZoomDownOut",{"0%":{transform:"scale(1)",transformOrigin:"50% 100%"},"100%":{transform:"scale(0.8)",transformOrigin:"50% 100%",opacity:0}}),T8={zoom:{inKeyframes:g8,outKeyframes:p8},"zoom-big":{inKeyframes:AT,outKeyframes:RT},"zoom-big-fast":{inKeyframes:AT,outKeyframes:RT},"zoom-left":{inKeyframes:_8,outKeyframes:y8},"zoom-right":{inKeyframes:b8,outKeyframes:S8},"zoom-up":{inKeyframes:m8,outKeyframes:v8},"zoom-down":{inKeyframes:E8,outKeyframes:w8}},C8=(t,e)=>{const{antCls:n}=t,r=`${n}-${e}`,{inKeyframes:i,outKeyframes:a}=T8[e];return[Qy(r,i,a,t.motionDurationFast),{[` + ${r}-enter, + ${r}-appear + `]:{transform:"scale(0)",opacity:0,animationTimingFunction:t.motionEaseOutCirc,"&-prepare":{transform:"none"}},[`${r}-leave`]:{animationTimingFunction:t.motionEaseInOutCirc}}]};function A8(t,e,n){const{focusElCls:r,focus:i,borderElCls:a}=n,l=a?"> *":"",u=["hover",i?"focus":null,"active"].filter(Boolean).map(f=>`&:${f} ${l}`).join(",");return{[`&-item:not(${e}-last-item)`]:{marginInlineEnd:t.calc(t.lineWidth).mul(-1).equal()},"&-item":Object.assign(Object.assign({[u]:{zIndex:2}},r?{[`&${r}`]:{zIndex:2}}:{}),{[`&[disabled] ${l}`]:{zIndex:0}})}}function R8(t,e,n){const{borderElCls:r}=n,i=r?`> ${r}`:"";return{[`&-item:not(${e}-first-item):not(${e}-last-item) ${i}`]:{borderRadius:0},[`&-item:not(${e}-last-item)${e}-first-item`]:{[`& ${i}, &${t}-sm ${i}, &${t}-lg ${i}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${e}-first-item)${e}-last-item`]:{[`& ${i}, &${t}-sm ${i}, &${t}-lg ${i}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function x8(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{focus:!0};const{componentCls:n}=t,r=`${n}-compact`;return{[r]:Object.assign(Object.assign({},A8(t,r,e)),R8(n,r,e))}}var Z3=_.createContext(null),xT=[];function M8(t,e){var n=_.useState(function(){if(!Zr())return null;var w=document.createElement("div");return w}),r=de(n,1),i=r[0],a=_.useRef(!1),l=_.useContext(Z3),u=_.useState(xT),f=de(u,2),h=f[0],g=f[1],m=l||(a.current?void 0:function(w){g(function(E){var b=[w].concat(ze(E));return b})});function v(){i.parentElement||document.body.appendChild(i),a.current=!0}function S(){var w;(w=i.parentElement)===null||w===void 0||w.removeChild(i),a.current=!1}return Dn(function(){return t?l?l(v):v():S(),S},[t]),Dn(function(){h.length&&(h.forEach(function(w){return w()}),g(xT))},[h]),[i,m]}function O8(t){var e="rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7)),n=document.createElement("div");n.id=e;var r=n.style;r.position="absolute",r.left="0",r.top="0",r.width="100px",r.height="100px",r.overflow="scroll";var i,a;if(t){var l=getComputedStyle(t);r.scrollbarColor=l.scrollbarColor,r.scrollbarWidth=l.scrollbarWidth;var u=getComputedStyle(t,"::-webkit-scrollbar"),f=parseInt(u.width,10),h=parseInt(u.height,10);try{var g=f?"width: ".concat(u.width,";"):"",m=h?"height: ".concat(u.height,";"):"";Hs(` +#`.concat(e,`::-webkit-scrollbar { +`).concat(g,` +`).concat(m,` +}`),e)}catch(w){console.error(w),i=f,a=h}}document.body.appendChild(n);var v=t&&i&&!isNaN(i)?i:n.offsetWidth-n.clientWidth,S=t&&a&&!isNaN(a)?a:n.offsetHeight-n.clientHeight;return document.body.removeChild(n),yf(e),{width:v,height:S}}function P8(t){return typeof document>"u"||!t||!(t instanceof Element)?{width:0,height:0}:O8(t)}function N8(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var I8="rc-util-locker-".concat(Date.now()),MT=0;function D8(t){var e=!!t,n=_.useState(function(){return MT+=1,"".concat(I8,"_").concat(MT)}),r=de(n,1),i=r[0];Dn(function(){if(e){var a=P8(document.body).width,l=N8();Hs(` +html body { + overflow-y: hidden; + `.concat(l?"width: calc(100% - ".concat(a,"px);"):"",` +}`),i)}else yf(i);return function(){yf(i)}},[e,i])}var F8=!1;function k8(t){return F8}var OT=function(e){return e===!1?!1:!Zr()||!e?null:typeof e=="string"?document.querySelector(e):typeof e=="function"?e():e},Q3=_.forwardRef(function(t,e){var n=t.open,r=t.autoLock,i=t.getContainer;t.debug;var a=t.autoDestroy,l=a===void 0?!0:a,u=t.children,f=_.useState(n),h=de(f,2),g=h[0],m=h[1],v=g||n;_.useEffect(function(){(l||n)&&m(n)},[n,l]);var S=_.useState(function(){return OT(i)}),w=de(S,2),E=w[0],b=w[1];_.useEffect(function(){var B=OT(i);b(B??null)});var C=M8(v&&!E),T=de(C,2),A=T[0],O=T[1],x=E??A;D8(r&&n&&Zr()&&(x===A||x===document.body));var N=null;if(u&&Gg(u)&&e){var F=u;N=F.ref}var L=Qg(N,e);if(!v||!Zr()||E===void 0)return null;var D=x===!1||k8(),V=u;return e&&(V=_.cloneElement(u,{ref:L})),_.createElement(Z3.Provider,{value:O},D?V:za.createPortal(V,x))});function B8(){var t=J({},Xg);return t.useId}var PT=0,NT=B8();const G3=NT?function(e){var n=NT();return e||n}:function(e){var n=_.useState("ssr-id"),r=de(n,2),i=r[0],a=r[1];return _.useEffect(function(){var l=PT;PT+=1,a("rc_unique_".concat(l))},[]),e||i};var bo="RC_FORM_INTERNAL_HOOKS",gn=function(){kr(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},Cc=_.createContext({getFieldValue:gn,getFieldsValue:gn,getFieldError:gn,getFieldWarning:gn,getFieldsError:gn,isFieldsTouched:gn,isFieldTouched:gn,isFieldValidating:gn,isFieldsValidating:gn,resetFields:gn,setFields:gn,setFieldValue:gn,setFieldsValue:gn,validateFields:gn,submit:gn,getInternalHooks:function(){return gn(),{dispatch:gn,initEntityValue:gn,registerField:gn,useSubscribe:gn,setInitialValues:gn,destroyForm:gn,setCallbacks:gn,registerWatch:gn,getFields:gn,setValidateMessages:gn,setPreserve:gn,getInitialValue:gn}}}),Jh=_.createContext(null);function d_(t){return t==null?[]:Array.isArray(t)?t:[t]}function U8(t){return t&&!!t._init}function h_(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var g_=h_();function L8(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function z8(t,e,n){if(ky())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&mf(i,n.prototype),i}function p_(t){var e=typeof Map=="function"?new Map:void 0;return p_=function(r){if(r===null||!L8(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return z8(r,arguments,vf(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),mf(i,r)},p_(t)}var $8=/%[sdj%]/g,V8=function(){};function m_(t){if(!t||!t.length)return null;var e={};return t.forEach(function(n){var r=n.field;e[r]=e[r]||[],e[r].push(n)}),e}function li(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r=a)return u;switch(u){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch{return"[Circular]"}break;default:return u}});return l}return t}function H8(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function hr(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||H8(e)&&typeof t=="string"&&!t)}function j8(t,e,n){var r=[],i=0,a=t.length;function l(u){r.push.apply(r,ze(u||[])),i++,i===a&&n(r)}t.forEach(function(u){e(u,l)})}function IT(t,e,n){var r=0,i=t.length;function a(l){if(l&&l.length){n(l);return}var u=r;r=r+1,ue.max?i.push(li(a.messages[m].max,e.fullField,e.max)):u&&f&&(ge.max)&&i.push(li(a.messages[m].range,e.fullField,e.min,e.max))},J3=function(e,n,r,i,a,l){e.required&&(!r.hasOwnProperty(e.field)||hr(n,l||e.type))&&i.push(li(a.messages.required,e.fullField))},ch;const G8=function(){if(ch)return ch;var t="[a-fA-F\\d:]",e=function(N){return N&&N.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",i=["(?:".concat(r,":){7}(?:").concat(r,"|:)"),"(?:".concat(r,":){6}(?:").concat(n,"|:").concat(r,"|:)"),"(?:".concat(r,":){5}(?::").concat(n,"|(?::").concat(r,"){1,2}|:)"),"(?:".concat(r,":){4}(?:(?::").concat(r,"){0,1}:").concat(n,"|(?::").concat(r,"){1,3}|:)"),"(?:".concat(r,":){3}(?:(?::").concat(r,"){0,2}:").concat(n,"|(?::").concat(r,"){1,4}|:)"),"(?:".concat(r,":){2}(?:(?::").concat(r,"){0,3}:").concat(n,"|(?::").concat(r,"){1,5}|:)"),"(?:".concat(r,":){1}(?:(?::").concat(r,"){0,4}:").concat(n,"|(?::").concat(r,"){1,6}|:)"),"(?::(?:(?::".concat(r,"){0,5}:").concat(n,"|(?::").concat(r,"){1,7}|:))")],a="(?:%[0-9a-zA-Z]{1,})?",l="(?:".concat(i.join("|"),")").concat(a),u=new RegExp("(?:^".concat(n,"$)|(?:^").concat(l,"$)")),f=new RegExp("^".concat(n,"$")),h=new RegExp("^".concat(l,"$")),g=function(N){return N&&N.exact?u:new RegExp("(?:".concat(e(N)).concat(n).concat(e(N),")|(?:").concat(e(N)).concat(l).concat(e(N),")"),"g")};g.v4=function(x){return x&&x.exact?f:new RegExp("".concat(e(x)).concat(n).concat(e(x)),"g")},g.v6=function(x){return x&&x.exact?h:new RegExp("".concat(e(x)).concat(l).concat(e(x)),"g")};var m="(?:(?:[a-z]+:)?//)",v="(?:\\S+(?::\\S*)?@)?",S=g.v4().source,w=g.v6().source,E="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",b="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",C="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",T="(?::\\d{2,5})?",A='(?:[/?#][^\\s"]*)?',O="(?:".concat(m,"|www\\.)").concat(v,"(?:localhost|").concat(S,"|").concat(w,"|").concat(E).concat(b).concat(C,")").concat(T).concat(A);return ch=new RegExp("(?:^".concat(O,"$)"),"i"),ch};var BT={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},Xu={integer:function(e){return Xu.number(e)&&parseInt(e,10)===e},float:function(e){return Xu.number(e)&&!Xu.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return pt(e)==="object"&&!Xu.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(BT.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(G8())},hex:function(e){return typeof e=="string"&&!!e.match(BT.hex)}},J8=function(e,n,r,i,a){if(e.required&&n===void 0){J3(e,n,r,i,a);return}var l=["integer","float","array","regexp","object","method","email","number","date","url","hex"],u=e.type;l.indexOf(u)>-1?Xu[u](n)||i.push(li(a.messages.types[u],e.fullField,e.type)):u&&pt(n)!==e.type&&i.push(li(a.messages.types[u],e.fullField,e.type))},eB=function(e,n,r,i,a){(/^\s+$/.test(n)||n==="")&&i.push(li(a.messages.whitespace,e.fullField))};const Ht={required:J3,whitespace:eB,type:J8,range:Q8,enum:K8,pattern:Z8};var tB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a)}r(l)},nB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(n==null&&!e.required)return r();Ht.required(e,n,i,l,a,"array"),n!=null&&(Ht.type(e,n,i,l,a),Ht.range(e,n,i,l,a))}r(l)},rB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),n!==void 0&&Ht.type(e,n,i,l,a)}r(l)},iB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n,"date")&&!e.required)return r();if(Ht.required(e,n,i,l,a),!hr(n,"date")){var f;n instanceof Date?f=n:f=new Date(n),Ht.type(e,f,i,l,a),f&&Ht.range(e,f.getTime(),i,l,a)}}r(l)},sB="enum",aB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),n!==void 0&&Ht[sB](e,n,i,l,a)}r(l)},oB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),n!==void 0&&(Ht.type(e,n,i,l,a),Ht.range(e,n,i,l,a))}r(l)},lB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),n!==void 0&&(Ht.type(e,n,i,l,a),Ht.range(e,n,i,l,a))}r(l)},cB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),n!==void 0&&Ht.type(e,n,i,l,a)}r(l)},uB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(n===""&&(n=void 0),hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),n!==void 0&&(Ht.type(e,n,i,l,a),Ht.range(e,n,i,l,a))}r(l)},fB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),n!==void 0&&Ht.type(e,n,i,l,a)}r(l)},dB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n,"string")&&!e.required)return r();Ht.required(e,n,i,l,a),hr(n,"string")||Ht.pattern(e,n,i,l,a)}r(l)},hB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n)&&!e.required)return r();Ht.required(e,n,i,l,a),hr(n)||Ht.type(e,n,i,l,a)}r(l)},gB=function(e,n,r,i,a){var l=[],u=Array.isArray(n)?"array":pt(n);Ht.required(e,n,i,l,a,u),r(l)},pB=function(e,n,r,i,a){var l=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(hr(n,"string")&&!e.required)return r();Ht.required(e,n,i,l,a,"string"),hr(n,"string")||(Ht.type(e,n,i,l,a),Ht.range(e,n,i,l,a),Ht.pattern(e,n,i,l,a),e.whitespace===!0&&Ht.whitespace(e,n,i,l,a))}r(l)},Iv=function(e,n,r,i,a){var l=e.type,u=[],f=e.required||!e.required&&i.hasOwnProperty(e.field);if(f){if(hr(n,l)&&!e.required)return r();Ht.required(e,n,i,u,a,l),hr(n,l)||Ht.type(e,n,i,u,a)}r(u)};const tf={string:pB,method:cB,number:uB,boolean:rB,regexp:hB,integer:lB,float:oB,array:nB,object:fB,enum:aB,pattern:dB,date:iB,url:Iv,hex:Iv,email:Iv,required:gB,any:tB};var Hf=function(){function t(e){xr(this,t),K(this,"rules",null),K(this,"_messages",g_),this.define(e)}return Mr(t,[{key:"define",value:function(n){var r=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(pt(n)!=="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(i){var a=n[i];r.rules[i]=Array.isArray(a)?a:[a]})}},{key:"messages",value:function(n){return n&&(this._messages=kT(h_(),n)),this._messages}},{key:"validate",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},l=n,u=i,f=a;if(typeof u=="function"&&(f=u,u={}),!this.rules||Object.keys(this.rules).length===0)return f&&f(null,l),Promise.resolve(l);function h(w){var E=[],b={};function C(A){if(Array.isArray(A)){var O;E=(O=E).concat.apply(O,ze(A))}else E.push(A)}for(var T=0;T0&&arguments[0]!==void 0?arguments[0]:[],L=Array.isArray(F)?F:[F];!u.suppressWarning&&L.length&&t.warning("async-validator:",L),L.length&&b.message!==void 0&&(L=[].concat(b.message));var D=L.map(FT(b,l));if(u.first&&D.length)return S[b.field]=1,E(D);if(!C)E(D);else{if(b.required&&!w.value)return b.message!==void 0?D=[].concat(b.message).map(FT(b,l)):u.error&&(D=[u.error(b,li(u.messages.required,b.field))]),E(D);var V={};b.defaultField&&Object.keys(w.value).map(function(X){V[X]=b.defaultField}),V=J(J({},V),w.rule.fields);var B={};Object.keys(V).forEach(function(X){var Y=V[X],ae=Array.isArray(Y)?Y:[Y];B[X]=ae.map(T.bind(null,X))});var W=new t(B);W.messages(u.messages),w.rule.options&&(w.rule.options.messages=u.messages,w.rule.options.error=u.error),W.validate(w.value,w.rule.options||u,function(X){var Y=[];D&&D.length&&Y.push.apply(Y,ze(D)),X&&X.length&&Y.push.apply(Y,ze(X)),E(Y.length?Y:null)})}}var O;if(b.asyncValidator)O=b.asyncValidator(b,w.value,A,w.source,u);else if(b.validator){try{O=b.validator(b,w.value,A,w.source,u)}catch(F){var x,N;(x=(N=console).error)===null||x===void 0||x.call(N,F),u.suppressValidatorError||setTimeout(function(){throw F},0),A(F.message)}O===!0?A():O===!1?A(typeof b.message=="function"?b.message(b.fullField||b.field):b.message||"".concat(b.fullField||b.field," fails")):O instanceof Array?A(O):O instanceof Error&&A(O.message)}O&&O.then&&O.then(function(){return A()},function(F){return A(F)})},function(w){h(w)},l)}},{key:"getType",value:function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!tf.hasOwnProperty(n.type))throw new Error(li("Unknown rule type %s",n.type));return n.type||"string"}},{key:"getValidationMethod",value:function(n){if(typeof n.validator=="function")return n.validator;var r=Object.keys(n),i=r.indexOf("message");return i!==-1&&r.splice(i,1),r.length===1&&r[0]==="required"?tf.required:tf[this.getType(n)]||void 0}}]),t}();K(Hf,"register",function(e,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");tf[e]=n});K(Hf,"warning",V8);K(Hf,"messages",g_);K(Hf,"validators",tf);var si="'${name}' is not a valid ${type}",ex={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:si,method:si,array:si,object:si,number:si,date:si,boolean:si,integer:si,float:si,regexp:si,email:si,url:si,hex:si},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}},UT=Hf;function mB(t,e){return t.replace(/\\?\$\{\w+\}/g,function(n){if(n.startsWith("\\"))return n.slice(1);var r=n.slice(2,-1);return e[r]})}var LT="CODE_LOGIC_ERROR";function v_(t,e,n,r,i){return __.apply(this,arguments)}function __(){return __=Vf(ts().mark(function t(e,n,r,i,a){var l,u,f,h,g,m,v,S,w;return ts().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return l=J({},r),delete l.ruleIndex,UT.warning=function(){},l.validator&&(u=l.validator,l.validator=function(){try{return u.apply(void 0,arguments)}catch(C){return console.error(C),Promise.reject(LT)}}),f=null,l&&l.type==="array"&&l.defaultField&&(f=l.defaultField,delete l.defaultField),h=new UT(K({},e,[l])),g=Hl(ex,i.validateMessages),h.messages(g),m=[],b.prev=10,b.next=13,Promise.resolve(h.validate(K({},e,n),J({},i)));case 13:b.next=18;break;case 15:b.prev=15,b.t0=b.catch(10),b.t0.errors&&(m=b.t0.errors.map(function(C,T){var A=C.message,O=A===LT?g.default:A;return _.isValidElement(O)?_.cloneElement(O,{key:"error_".concat(T)}):O}));case 18:if(!(!m.length&&f)){b.next=23;break}return b.next=21,Promise.all(n.map(function(C,T){return v_("".concat(e,".").concat(T),C,f,i,a)}));case 21:return v=b.sent,b.abrupt("return",v.reduce(function(C,T){return[].concat(ze(C),ze(T))},[]));case 23:return S=J(J({},r),{},{name:e,enum:(r.enum||[]).join(", ")},a),w=m.map(function(C){return typeof C=="string"?mB(C,S):C}),b.abrupt("return",w);case 26:case"end":return b.stop()}},t,null,[[10,15]])})),__.apply(this,arguments)}function vB(t,e,n,r,i,a){var l=t.join("."),u=n.map(function(g,m){var v=g.validator,S=J(J({},g),{},{ruleIndex:m});return v&&(S.validator=function(w,E,b){var C=!1,T=function(){for(var x=arguments.length,N=new Array(x),F=0;F2&&arguments[2]!==void 0?arguments[2]:!1;return t&&t.some(function(r){return tx(e,r,n)})}function tx(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!t||!e||!n&&t.length!==e.length?!1:e.every(function(r,i){return t[i]===r})}function bB(t,e){if(t===e)return!0;if(!t&&e||t&&!e||!t||!e||pt(t)!=="object"||pt(e)!=="object")return!1;var n=Object.keys(t),r=Object.keys(e),i=new Set([].concat(n,r));return ze(i).every(function(a){var l=t[a],u=e[a];return typeof l=="function"&&typeof u=="function"?!0:l===u})}function SB(t){var e=arguments.length<=1?void 0:arguments[1];return e&&e.target&&pt(e.target)==="object"&&t in e.target?e.target[t]:e}function $T(t,e,n){var r=t.length;if(e<0||e>=r||n<0||n>=r)return t;var i=t[e],a=e-n;return a>0?[].concat(ze(t.slice(0,n)),[i],ze(t.slice(n,e)),ze(t.slice(e+1,r))):a<0?[].concat(ze(t.slice(0,e)),ze(t.slice(e+1,n+1)),[i],ze(t.slice(n+1,r))):t}var EB=["name"],Ci=[];function Dv(t,e,n,r,i,a){return typeof t=="function"?t(e,n,"source"in a?{source:a.source}:{}):r!==i}var Gy=function(t){Xo(n,t);var e=qo(n);function n(r){var i;if(xr(this,n),i=e.call(this,r),K(Nt(i),"state",{resetCount:0}),K(Nt(i),"cancelRegisterFunc",null),K(Nt(i),"mounted",!1),K(Nt(i),"touched",!1),K(Nt(i),"dirty",!1),K(Nt(i),"validatePromise",void 0),K(Nt(i),"prevValidating",void 0),K(Nt(i),"errors",Ci),K(Nt(i),"warnings",Ci),K(Nt(i),"cancelRegister",function(){var f=i.props,h=f.preserve,g=f.isListField,m=f.name;i.cancelRegisterFunc&&i.cancelRegisterFunc(g,h,Jn(m)),i.cancelRegisterFunc=null}),K(Nt(i),"getNamePath",function(){var f=i.props,h=f.name,g=f.fieldContext,m=g.prefixName,v=m===void 0?[]:m;return h!==void 0?[].concat(ze(v),ze(h)):[]}),K(Nt(i),"getRules",function(){var f=i.props,h=f.rules,g=h===void 0?[]:h,m=f.fieldContext;return g.map(function(v){return typeof v=="function"?v(m):v})}),K(Nt(i),"refresh",function(){i.mounted&&i.setState(function(f){var h=f.resetCount;return{resetCount:h+1}})}),K(Nt(i),"metaCache",null),K(Nt(i),"triggerMetaEvent",function(f){var h=i.props.onMetaChange;if(h){var g=J(J({},i.getMeta()),{},{destroy:f});qh(i.metaCache,g)||h(g),i.metaCache=g}else i.metaCache=null}),K(Nt(i),"onStoreChange",function(f,h,g){var m=i.props,v=m.shouldUpdate,S=m.dependencies,w=S===void 0?[]:S,E=m.onReset,b=g.store,C=i.getNamePath(),T=i.getValue(f),A=i.getValue(b),O=h&&ec(h,C);switch(g.type==="valueUpdate"&&g.source==="external"&&!qh(T,A)&&(i.touched=!0,i.dirty=!0,i.validatePromise=null,i.errors=Ci,i.warnings=Ci,i.triggerMetaEvent()),g.type){case"reset":if(!h||O){i.touched=!1,i.dirty=!1,i.validatePromise=void 0,i.errors=Ci,i.warnings=Ci,i.triggerMetaEvent(),E==null||E(),i.refresh();return}break;case"remove":{if(v&&Dv(v,f,b,T,A,g)){i.reRender();return}break}case"setField":{var x=g.data;if(O){"touched"in x&&(i.touched=x.touched),"validating"in x&&!("originRCField"in x)&&(i.validatePromise=x.validating?Promise.resolve([]):null),"errors"in x&&(i.errors=x.errors||Ci),"warnings"in x&&(i.warnings=x.warnings||Ci),i.dirty=!0,i.triggerMetaEvent(),i.reRender();return}else if("value"in x&&ec(h,C,!0)){i.reRender();return}if(v&&!C.length&&Dv(v,f,b,T,A,g)){i.reRender();return}break}case"dependenciesUpdate":{var N=w.map(Jn);if(N.some(function(F){return ec(g.relatedFields,F)})){i.reRender();return}break}default:if(O||(!w.length||C.length||v)&&Dv(v,f,b,T,A,g)){i.reRender();return}break}v===!0&&i.reRender()}),K(Nt(i),"validateRules",function(f){var h=i.getNamePath(),g=i.getValue(),m=f||{},v=m.triggerName,S=m.validateOnly,w=S===void 0?!1:S,E=Promise.resolve().then(Vf(ts().mark(function b(){var C,T,A,O,x,N,F;return ts().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:if(i.mounted){D.next=2;break}return D.abrupt("return",[]);case 2:if(C=i.props,T=C.validateFirst,A=T===void 0?!1:T,O=C.messageVariables,x=C.validateDebounce,N=i.getRules(),v&&(N=N.filter(function(V){return V}).filter(function(V){var B=V.validateTrigger;if(!B)return!0;var W=d_(B);return W.includes(v)})),!(x&&v)){D.next=10;break}return D.next=8,new Promise(function(V){setTimeout(V,x)});case 8:if(i.validatePromise===E){D.next=10;break}return D.abrupt("return",[]);case 10:return F=vB(h,g,N,f,A,O),F.catch(function(V){return V}).then(function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ci;if(i.validatePromise===E){var B;i.validatePromise=null;var W=[],X=[];(B=V.forEach)===null||B===void 0||B.call(V,function(Y){var ae=Y.rule.warningOnly,U=Y.errors,z=U===void 0?Ci:U;ae?X.push.apply(X,ze(z)):W.push.apply(W,ze(z))}),i.errors=W,i.warnings=X,i.triggerMetaEvent(),i.reRender()}}),D.abrupt("return",F);case 13:case"end":return D.stop()}},b)})));return w||(i.validatePromise=E,i.dirty=!0,i.errors=Ci,i.warnings=Ci,i.triggerMetaEvent(),i.reRender()),E}),K(Nt(i),"isFieldValidating",function(){return!!i.validatePromise}),K(Nt(i),"isFieldTouched",function(){return i.touched}),K(Nt(i),"isFieldDirty",function(){if(i.dirty||i.props.initialValue!==void 0)return!0;var f=i.props.fieldContext,h=f.getInternalHooks(bo),g=h.getInitialValue;return g(i.getNamePath())!==void 0}),K(Nt(i),"getErrors",function(){return i.errors}),K(Nt(i),"getWarnings",function(){return i.warnings}),K(Nt(i),"isListField",function(){return i.props.isListField}),K(Nt(i),"isList",function(){return i.props.isList}),K(Nt(i),"isPreserve",function(){return i.props.preserve}),K(Nt(i),"getMeta",function(){i.prevValidating=i.isFieldValidating();var f={touched:i.isFieldTouched(),validating:i.prevValidating,errors:i.errors,warnings:i.warnings,name:i.getNamePath(),validated:i.validatePromise===null};return f}),K(Nt(i),"getOnlyChild",function(f){if(typeof f=="function"){var h=i.getMeta();return J(J({},i.getOnlyChild(f(i.getControlled(),h,i.props.fieldContext))),{},{isFunction:!0})}var g=Lo(f);return g.length!==1||!_.isValidElement(g[0])?{child:g,isFunction:!1}:{child:g[0],isFunction:!1}}),K(Nt(i),"getValue",function(f){var h=i.props.fieldContext.getFieldsValue,g=i.getNamePath();return vs(f||h(!0),g)}),K(Nt(i),"getControlled",function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h=i.props,g=h.name,m=h.trigger,v=h.validateTrigger,S=h.getValueFromEvent,w=h.normalize,E=h.valuePropName,b=h.getValueProps,C=h.fieldContext,T=v!==void 0?v:C.validateTrigger,A=i.getNamePath(),O=C.getInternalHooks,x=C.getFieldsValue,N=O(bo),F=N.dispatch,L=i.getValue(),D=b||function(Y){return K({},E,Y)},V=f[m],B=g!==void 0?D(L):{},W=J(J({},f),B);W[m]=function(){i.touched=!0,i.dirty=!0,i.triggerMetaEvent();for(var Y,ae=arguments.length,U=new Array(ae),z=0;z=0&&V<=B.length?(g.keys=[].concat(ze(g.keys.slice(0,V)),[g.id],ze(g.keys.slice(V))),A([].concat(ze(B.slice(0,V)),[D],ze(B.slice(V))))):(g.keys=[].concat(ze(g.keys),[g.id]),A([].concat(ze(B),[D]))),g.id+=1},remove:function(D){var V=x(),B=new Set(Array.isArray(D)?D:[D]);B.size<=0||(g.keys=g.keys.filter(function(W,X){return!B.has(X)}),A(V.filter(function(W,X){return!B.has(X)})))},move:function(D,V){if(D!==V){var B=x();D<0||D>=B.length||V<0||V>=B.length||(g.keys=$T(g.keys,D,V),A($T(B,D,V)))}}},F=T||[];return Array.isArray(F)||(F=[]),r(F.map(function(L,D){var V=g.keys[D];return V===void 0&&(g.keys[D]=g.id,V=g.keys[D],g.id+=1),{name:D,key:V,isListField:!0}}),N,b)})))}function TB(t){var e=!1,n=t.length,r=[];return t.length?new Promise(function(i,a){t.forEach(function(l,u){l.catch(function(f){return e=!0,f}).then(function(f){n-=1,r[u]=f,!(n>0)&&(e&&a(r),i(r))})})}):Promise.resolve([])}var rx="__@field_split__";function Fv(t){return t.map(function(e){return"".concat(pt(e),":").concat(e)}).join(rx)}var Fl=function(){function t(){xr(this,t),K(this,"kvs",new Map)}return Mr(t,[{key:"set",value:function(n,r){this.kvs.set(Fv(n),r)}},{key:"get",value:function(n){return this.kvs.get(Fv(n))}},{key:"update",value:function(n,r){var i=this.get(n),a=r(i);a?this.set(n,a):this.delete(n)}},{key:"delete",value:function(n){this.kvs.delete(Fv(n))}},{key:"map",value:function(n){return ze(this.kvs.entries()).map(function(r){var i=de(r,2),a=i[0],l=i[1],u=a.split(rx);return n({key:u.map(function(f){var h=f.match(/^([^:]*):(.*)$/),g=de(h,3),m=g[1],v=g[2];return m==="number"?Number(v):v}),value:l})})}},{key:"toJSON",value:function(){var n={};return this.map(function(r){var i=r.key,a=r.value;return n[i.join(".")]=a,null}),n}}]),t}(),CB=["name"],AB=Mr(function t(e){var n=this;xr(this,t),K(this,"formHooked",!1),K(this,"forceRootUpdate",void 0),K(this,"subscribable",!0),K(this,"store",{}),K(this,"fieldEntities",[]),K(this,"initialValues",{}),K(this,"callbacks",{}),K(this,"validateMessages",null),K(this,"preserve",null),K(this,"lastValidatePromise",null),K(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),K(this,"getInternalHooks",function(r){return r===bo?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):(kr(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),K(this,"useSubscribe",function(r){n.subscribable=r}),K(this,"prevWithoutPreserves",null),K(this,"setInitialValues",function(r,i){if(n.initialValues=r||{},i){var a,l=Hl(r,n.store);(a=n.prevWithoutPreserves)===null||a===void 0||a.map(function(u){var f=u.key;l=Xi(l,f,vs(r,f))}),n.prevWithoutPreserves=null,n.updateStore(l)}}),K(this,"destroyForm",function(r){if(r)n.updateStore({});else{var i=new Fl;n.getFieldEntities(!0).forEach(function(a){n.isMergedPreserve(a.isPreserve())||i.set(a.getNamePath(),!0)}),n.prevWithoutPreserves=i}}),K(this,"getInitialValue",function(r){var i=vs(n.initialValues,r);return r.length?Hl(i):i}),K(this,"setCallbacks",function(r){n.callbacks=r}),K(this,"setValidateMessages",function(r){n.validateMessages=r}),K(this,"setPreserve",function(r){n.preserve=r}),K(this,"watchList",[]),K(this,"registerWatch",function(r){return n.watchList.push(r),function(){n.watchList=n.watchList.filter(function(i){return i!==r})}}),K(this,"notifyWatch",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(n.watchList.length){var i=n.getFieldsValue(),a=n.getFieldsValue(!0);n.watchList.forEach(function(l){l(i,a,r)})}}),K(this,"timeoutId",null),K(this,"warningUnhooked",function(){}),K(this,"updateStore",function(r){n.store=r}),K(this,"getFieldEntities",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return r?n.fieldEntities.filter(function(i){return i.getNamePath().length}):n.fieldEntities}),K(this,"getFieldsMap",function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=new Fl;return n.getFieldEntities(r).forEach(function(a){var l=a.getNamePath();i.set(l,a)}),i}),K(this,"getFieldEntitiesForNamePathList",function(r){if(!r)return n.getFieldEntities(!0);var i=n.getFieldsMap(!0);return r.map(function(a){var l=Jn(a);return i.get(l)||{INVALIDATE_NAME_PATH:Jn(a)}})}),K(this,"getFieldsValue",function(r,i){n.warningUnhooked();var a,l,u;if(r===!0||Array.isArray(r)?(a=r,l=i):r&&pt(r)==="object"&&(u=r.strict,l=r.filter),a===!0&&!l)return n.store;var f=n.getFieldEntitiesForNamePathList(Array.isArray(a)?a:null),h=[];return f.forEach(function(g){var m,v,S="INVALIDATE_NAME_PATH"in g?g.INVALIDATE_NAME_PATH:g.getNamePath();if(u){var w,E;if((w=(E=g).isList)!==null&&w!==void 0&&w.call(E))return}else if(!a&&(m=(v=g).isListField)!==null&&m!==void 0&&m.call(v))return;if(!l)h.push(S);else{var b="getMeta"in g?g.getMeta():null;l(b)&&h.push(S)}}),zT(n.store,h.map(Jn))}),K(this,"getFieldValue",function(r){n.warningUnhooked();var i=Jn(r);return vs(n.store,i)}),K(this,"getFieldsError",function(r){n.warningUnhooked();var i=n.getFieldEntitiesForNamePathList(r);return i.map(function(a,l){return a&&!("INVALIDATE_NAME_PATH"in a)?{name:a.getNamePath(),errors:a.getErrors(),warnings:a.getWarnings()}:{name:Jn(r[l]),errors:[],warnings:[]}})}),K(this,"getFieldError",function(r){n.warningUnhooked();var i=Jn(r),a=n.getFieldsError([i])[0];return a.errors}),K(this,"getFieldWarning",function(r){n.warningUnhooked();var i=Jn(r),a=n.getFieldsError([i])[0];return a.warnings}),K(this,"isFieldsTouched",function(){n.warningUnhooked();for(var r=arguments.length,i=new Array(r),a=0;a0&&arguments[0]!==void 0?arguments[0]:{},i=new Fl,a=n.getFieldEntities(!0);a.forEach(function(f){var h=f.props.initialValue,g=f.getNamePath();if(h!==void 0){var m=i.get(g)||new Set;m.add({entity:f,value:h}),i.set(g,m)}});var l=function(h){h.forEach(function(g){var m=g.props.initialValue;if(m!==void 0){var v=g.getNamePath(),S=n.getInitialValue(v);if(S!==void 0)kr(!1,"Form already set 'initialValues' with path '".concat(v.join("."),"'. Field can not overwrite it."));else{var w=i.get(v);if(w&&w.size>1)kr(!1,"Multiple Field with path '".concat(v.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(w){var E=n.getFieldValue(v),b=g.isListField();!b&&(!r.skipExist||E===void 0)&&n.updateStore(Xi(n.store,v,ze(w)[0].value))}}}})},u;r.entities?u=r.entities:r.namePathList?(u=[],r.namePathList.forEach(function(f){var h=i.get(f);if(h){var g;(g=u).push.apply(g,ze(ze(h).map(function(m){return m.entity})))}})):u=a,l(u)}),K(this,"resetFields",function(r){n.warningUnhooked();var i=n.store;if(!r){n.updateStore(Hl(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(i,null,{type:"reset"}),n.notifyWatch();return}var a=r.map(Jn);a.forEach(function(l){var u=n.getInitialValue(l);n.updateStore(Xi(n.store,l,u))}),n.resetWithFieldInitialValue({namePathList:a}),n.notifyObservers(i,a,{type:"reset"}),n.notifyWatch(a)}),K(this,"setFields",function(r){n.warningUnhooked();var i=n.store,a=[];r.forEach(function(l){var u=l.name,f=Fn(l,CB),h=Jn(u);a.push(h),"value"in f&&n.updateStore(Xi(n.store,h,f.value)),n.notifyObservers(i,[h],{type:"setField",data:l})}),n.notifyWatch(a)}),K(this,"getFields",function(){var r=n.getFieldEntities(!0),i=r.map(function(a){var l=a.getNamePath(),u=a.getMeta(),f=J(J({},u),{},{name:l,value:n.getFieldValue(l)});return Object.defineProperty(f,"originRCField",{value:!0}),f});return i}),K(this,"initEntityValue",function(r){var i=r.props.initialValue;if(i!==void 0){var a=r.getNamePath(),l=vs(n.store,a);l===void 0&&n.updateStore(Xi(n.store,a,i))}}),K(this,"isMergedPreserve",function(r){var i=r!==void 0?r:n.preserve;return i??!0}),K(this,"registerField",function(r){n.fieldEntities.push(r);var i=r.getNamePath();if(n.notifyWatch([i]),r.props.initialValue!==void 0){var a=n.store;n.resetWithFieldInitialValue({entities:[r],skipExist:!0}),n.notifyObservers(a,[r.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(l,u){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(m){return m!==r}),!n.isMergedPreserve(u)&&(!l||f.length>1)){var h=l?void 0:n.getInitialValue(i);if(i.length&&n.getFieldValue(i)!==h&&n.fieldEntities.every(function(m){return!tx(m.getNamePath(),i)})){var g=n.store;n.updateStore(Xi(g,i,h,!0)),n.notifyObservers(g,[i],{type:"remove"}),n.triggerDependenciesUpdate(g,i)}}n.notifyWatch([i])}}),K(this,"dispatch",function(r){switch(r.type){case"updateValue":{var i=r.namePath,a=r.value;n.updateValue(i,a);break}case"validateField":{var l=r.namePath,u=r.triggerName;n.validateFields([l],{triggerName:u});break}}}),K(this,"notifyObservers",function(r,i,a){if(n.subscribable){var l=J(J({},a),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(u){var f=u.onStoreChange;f(r,i,l)})}else n.forceRootUpdate()}),K(this,"triggerDependenciesUpdate",function(r,i){var a=n.getDependencyChildrenFields(i);return a.length&&n.validateFields(a),n.notifyObservers(r,a,{type:"dependenciesUpdate",relatedFields:[i].concat(ze(a))}),a}),K(this,"updateValue",function(r,i){var a=Jn(r),l=n.store;n.updateStore(Xi(n.store,a,i)),n.notifyObservers(l,[a],{type:"valueUpdate",source:"internal"}),n.notifyWatch([a]);var u=n.triggerDependenciesUpdate(l,a),f=n.callbacks.onValuesChange;if(f){var h=zT(n.store,[a]);f(h,n.getFieldsValue())}n.triggerOnFieldsChange([a].concat(ze(u)))}),K(this,"setFieldsValue",function(r){n.warningUnhooked();var i=n.store;if(r){var a=Hl(n.store,r);n.updateStore(a)}n.notifyObservers(i,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),K(this,"setFieldValue",function(r,i){n.setFields([{name:r,value:i,errors:[],warnings:[]}])}),K(this,"getDependencyChildrenFields",function(r){var i=new Set,a=[],l=new Fl;n.getFieldEntities().forEach(function(f){var h=f.props.dependencies;(h||[]).forEach(function(g){var m=Jn(g);l.update(m,function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return v.add(f),v})})});var u=function f(h){var g=l.get(h)||new Set;g.forEach(function(m){if(!i.has(m)){i.add(m);var v=m.getNamePath();m.isFieldDirty()&&v.length&&(a.push(v),f(v))}})};return u(r),a}),K(this,"triggerOnFieldsChange",function(r,i){var a=n.callbacks.onFieldsChange;if(a){var l=n.getFields();if(i){var u=new Fl;i.forEach(function(h){var g=h.name,m=h.errors;u.set(g,m)}),l.forEach(function(h){h.errors=u.get(h.name)||h.errors})}var f=l.filter(function(h){var g=h.name;return ec(r,g)});f.length&&a(f,l)}}),K(this,"validateFields",function(r,i){n.warningUnhooked();var a,l;Array.isArray(r)||typeof r=="string"||typeof i=="string"?(a=r,l=i):l=r;var u=!!a,f=u?a.map(Jn):[],h=[],g=String(Date.now()),m=new Set,v=l||{},S=v.recursive,w=v.dirty;n.getFieldEntities(!0).forEach(function(T){if(u||f.push(T.getNamePath()),!(!T.props.rules||!T.props.rules.length)&&!(w&&!T.isFieldDirty())){var A=T.getNamePath();if(m.add(A.join(g)),!u||ec(f,A,S)){var O=T.validateRules(J({validateMessages:J(J({},ex),n.validateMessages)},l));h.push(O.then(function(){return{name:A,errors:[],warnings:[]}}).catch(function(x){var N,F=[],L=[];return(N=x.forEach)===null||N===void 0||N.call(x,function(D){var V=D.rule.warningOnly,B=D.errors;V?L.push.apply(L,ze(B)):F.push.apply(F,ze(B))}),F.length?Promise.reject({name:A,errors:F,warnings:L}):{name:A,errors:F,warnings:L}}))}}});var E=TB(h);n.lastValidatePromise=E,E.catch(function(T){return T}).then(function(T){var A=T.map(function(O){var x=O.name;return x});n.notifyObservers(n.store,A,{type:"validateFinish"}),n.triggerOnFieldsChange(A,T)});var b=E.then(function(){return n.lastValidatePromise===E?Promise.resolve(n.getFieldsValue(f)):Promise.reject([])}).catch(function(T){var A=T.filter(function(O){return O&&O.errors.length});return Promise.reject({values:n.getFieldsValue(f),errorFields:A,outOfDate:n.lastValidatePromise!==E})});b.catch(function(T){return T});var C=f.filter(function(T){return m.has(T.join(g))});return n.triggerOnFieldsChange(C),b}),K(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(r){var i=n.callbacks.onFinish;if(i)try{i(r)}catch(a){console.error(a)}}).catch(function(r){var i=n.callbacks.onFinishFailed;i&&i(r)})}),this.forceRootUpdate=e});function ix(t){var e=_.useRef(),n=_.useState({}),r=de(n,2),i=r[1];if(!e.current)if(t)e.current=t;else{var a=function(){i({})},l=new AB(a);e.current=l.getForm()}return[e.current]}var S_=_.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),RB=function(e){var n=e.validateMessages,r=e.onFormChange,i=e.onFormFinish,a=e.children,l=_.useContext(S_),u=_.useRef({});return _.createElement(S_.Provider,{value:J(J({},l),{},{validateMessages:J(J({},l.validateMessages),n),triggerFormChange:function(h,g){r&&r(h,{changedFields:g,forms:u.current}),l.triggerFormChange(h,g)},triggerFormFinish:function(h,g){i&&i(h,{values:g,forms:u.current}),l.triggerFormFinish(h,g)},registerForm:function(h,g){h&&(u.current=J(J({},u.current),{},K({},h,g))),l.registerForm(h,g)},unregisterForm:function(h){var g=J({},u.current);delete g[h],u.current=g,l.unregisterForm(h)}})},a)},xB=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"],MB=function(e,n){var r=e.name,i=e.initialValues,a=e.fields,l=e.form,u=e.preserve,f=e.children,h=e.component,g=h===void 0?"form":h,m=e.validateMessages,v=e.validateTrigger,S=v===void 0?"onChange":v,w=e.onValuesChange,E=e.onFieldsChange,b=e.onFinish,C=e.onFinishFailed,T=e.clearOnDestroy,A=Fn(e,xB),O=_.useRef(null),x=_.useContext(S_),N=ix(l),F=de(N,1),L=F[0],D=L.getInternalHooks(bo),V=D.useSubscribe,B=D.setInitialValues,W=D.setCallbacks,X=D.setValidateMessages,Y=D.setPreserve,ae=D.destroyForm;_.useImperativeHandle(n,function(){return J(J({},L),{},{nativeElement:O.current})}),_.useEffect(function(){return x.registerForm(r,L),function(){x.unregisterForm(r)}},[x,L,r]),X(J(J({},x.validateMessages),m)),W({onValuesChange:w,onFieldsChange:function(q){if(x.triggerFormChange(r,q),E){for(var ce=arguments.length,fe=new Array(ce>1?ce-1:0),ye=1;ye{let{children:e,status:n,override:r}=t;const i=_.useContext(E_),a=_.useMemo(()=>{const l=Object.assign({},i);return r&&delete l.isFormItemInput,n&&(delete l.status,delete l.hasFeedback,delete l.feedbackIcon),l},[n,r,i]);return _.createElement(E_.Provider,{value:a},e)},IB=_.createContext(void 0),DB=t=>{const{space:e,form:n,children:r}=t;if(r==null)return null;let i=r;return n&&(i=Ft.createElement(NB,{override:!0,status:!0},i)),e&&(i=Ft.createElement(Kk,null,i)),i};function FB(t){return e=>_.createElement($c,{theme:{token:{motion:!1,zIndexPopupBase:0}}},_.createElement(t,Object.assign({},e)))}const kB=(t,e,n,r,i)=>FB(l=>{const{prefixCls:u,style:f}=l,h=_.useRef(null),[g,m]=_.useState(0),[v,S]=_.useState(0),[w,E]=Tc(!1,{value:l.open}),{getPrefixCls:b}=_.useContext(ci),C=b("select",u);_.useEffect(()=>{if(E(!0),typeof ResizeObserver<"u"){const O=new ResizeObserver(N=>{const F=N[0].target;m(F.offsetHeight+8),S(F.offsetWidth)}),x=setInterval(()=>{var N;const F=`.${C}-dropdown`,L=(N=h.current)===null||N===void 0?void 0:N.querySelector(F);L&&(clearInterval(x),O.observe(L))},10);return()=>{clearInterval(x),O.disconnect()}}},[]);let T=Object.assign(Object.assign({},l),{style:Object.assign(Object.assign({},f),{margin:0}),open:w,visible:w,getPopupContainer:()=>h.current});Object.assign(T,{[e]:{overflow:{adjustX:!1,adjustY:!1}}});const A={paddingBottom:g,position:"relative",minWidth:v};return _.createElement("div",{ref:h,style:A},_.createElement(t,Object.assign({},T)))}),sx=function(){if(typeof navigator>"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var ip=function(e){var n=e.className,r=e.customizeIcon,i=e.customizeIconProps,a=e.children,l=e.onMouseDown,u=e.onClick,f=typeof r=="function"?r(i):r;return _.createElement("span",{className:n,onMouseDown:function(g){g.preventDefault(),l==null||l(g)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:u,"aria-hidden":!0},f!==void 0?f:_.createElement("span",{className:Ze(n.split(/\s+/).map(function(h){return"".concat(h,"-icon")}))},a))},BB=function(e,n,r,i,a){var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,u=arguments.length>6?arguments[6]:void 0,f=arguments.length>7?arguments[7]:void 0,h=Ft.useMemo(function(){if(pt(i)==="object")return i.clearIcon;if(a)return a},[i,a]),g=Ft.useMemo(function(){return!!(!l&&i&&(r.length||u)&&!(f==="combobox"&&u===""))},[i,l,r.length,u,f]);return{allowClear:g,clearIcon:Ft.createElement(ip,{className:"".concat(e,"-clear"),onMouseDown:n,customizeIcon:h},"×")}},ax=_.createContext(null);function UB(){return _.useContext(ax)}function LB(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,e=_.useState(!1),n=de(e,2),r=n[0],i=n[1],a=_.useRef(null),l=function(){window.clearTimeout(a.current)};_.useEffect(function(){return l},[]);var u=function(h,g){l(),a.current=window.setTimeout(function(){i(h),g&&g()},t)};return[r,u,l]}function ox(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,e=_.useRef(null),n=_.useRef(null);_.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]);function r(i){(i||e.current===null)&&(e.current=i),window.clearTimeout(n.current),n.current=window.setTimeout(function(){e.current=null},t)}return[function(){return e.current},r]}function zB(t,e,n,r){var i=_.useRef(null);i.current={open:e,triggerOpen:n,customizedTrigger:r},_.useEffect(function(){function a(l){var u;if(!((u=i.current)!==null&&u!==void 0&&u.customizedTrigger)){var f=l.target;f.shadowRoot&&l.composed&&(f=l.composedPath()[0]||f),i.current.open&&t().filter(function(h){return h}).every(function(h){return!h.contains(f)&&h!==f})&&i.current.triggerOpen(!1)}}return window.addEventListener("mousedown",a),function(){return window.removeEventListener("mousedown",a)}},[])}function $B(t){return t&&![et.ESC,et.SHIFT,et.BACKSPACE,et.TAB,et.WIN_KEY,et.ALT,et.META,et.WIN_KEY_RIGHT,et.CTRL,et.SEMICOLON,et.EQUALS,et.CAPS_LOCK,et.CONTEXT_MENU,et.F1,et.F2,et.F3,et.F4,et.F5,et.F6,et.F7,et.F8,et.F9,et.F10,et.F11,et.F12].includes(t)}var VB=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],kl=void 0;function HB(t,e){var n=t.prefixCls,r=t.invalidate,i=t.item,a=t.renderItem,l=t.responsive,u=t.responsiveDisabled,f=t.registerSize,h=t.itemKey,g=t.className,m=t.style,v=t.children,S=t.display,w=t.order,E=t.component,b=E===void 0?"div":E,C=Fn(t,VB),T=l&&!S;function A(L){f(h,L)}_.useEffect(function(){return function(){A(null)}},[]);var O=a&&i!==kl?a(i,{index:w}):v,x;r||(x={opacity:T?0:1,height:T?0:kl,overflowY:T?"hidden":kl,order:l?w:kl,pointerEvents:T?"none":kl,position:T?"absolute":kl});var N={};T&&(N["aria-hidden"]=!0);var F=_.createElement(b,kt({className:Ze(!r&&n,g),style:J(J({},x),m)},N,C,{ref:e}),O);return l&&(F=_.createElement(Yo,{onResize:function(D){var V=D.offsetWidth;A(V)},disabled:u},F)),F}var nf=_.forwardRef(HB);nf.displayName="Item";function jB(t){if(typeof MessageChannel>"u")dr(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}function WB(){var t=_.useRef(null),e=function(r){t.current||(t.current=[],jB(function(){za.unstable_batchedUpdates(function(){t.current.forEach(function(i){i()}),t.current=null})})),t.current.push(r)};return e}function Lu(t,e){var n=_.useState(e),r=de(n,2),i=r[0],a=r[1],l=fr(function(u){t(function(){a(u)})});return[i,l]}var eg=Ft.createContext(null),XB=["component"],qB=["className"],YB=["className"],KB=function(e,n){var r=_.useContext(eg);if(!r){var i=e.component,a=i===void 0?"div":i,l=Fn(e,XB);return _.createElement(a,kt({},l,{ref:n}))}var u=r.className,f=Fn(r,qB),h=e.className,g=Fn(e,YB);return _.createElement(eg.Provider,{value:null},_.createElement(nf,kt({ref:n,className:Ze(u,h)},f,g)))},lx=_.forwardRef(KB);lx.displayName="RawItem";var ZB=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],cx="responsive",ux="invalidate";function QB(t){return"+ ".concat(t.length," ...")}function GB(t,e){var n=t.prefixCls,r=n===void 0?"rc-overflow":n,i=t.data,a=i===void 0?[]:i,l=t.renderItem,u=t.renderRawItem,f=t.itemKey,h=t.itemWidth,g=h===void 0?10:h,m=t.ssr,v=t.style,S=t.className,w=t.maxCount,E=t.renderRest,b=t.renderRawRest,C=t.suffix,T=t.component,A=T===void 0?"div":T,O=t.itemComponent,x=t.onVisibleChange,N=Fn(t,ZB),F=m==="full",L=WB(),D=Lu(L,null),V=de(D,2),B=V[0],W=V[1],X=B||0,Y=Lu(L,new Map),ae=de(Y,2),U=ae[0],z=ae[1],j=Lu(L,0),Z=de(j,2),P=Z[0],$=Z[1],ie=Lu(L,0),se=de(ie,2),q=se[0],ce=se[1],fe=Lu(L,0),ye=de(fe,2),Ee=ye[0],Ce=ye[1],Te=_.useState(null),ve=de(Te,2),ge=ve[0],_e=ve[1],Ie=_.useState(null),we=de(Ie,2),xe=we[0],Ve=we[1],Fe=_.useMemo(function(){return xe===null&&F?Number.MAX_SAFE_INTEGER:xe||0},[xe,B]),Be=_.useState(!1),nt=de(Be,2),He=nt[0],Ge=nt[1],Pe="".concat(r,"-item"),Me=Math.max(P,q),dt=w===cx,rt=a.length&&dt,it=w===ux,st=rt||typeof w=="number"&&a.length>w,at=_.useMemo(function(){var qe=a;return rt?B===null&&F?qe=a:qe=a.slice(0,Math.min(a.length,X/g)):typeof w=="number"&&(qe=a.slice(0,w)),qe},[a,g,B,w,rt]),Je=_.useMemo(function(){return rt?a.slice(Fe+1):a.slice(at.length)},[a,at,rt,Fe]),lt=_.useCallback(function(qe,ke){var Ne;return typeof f=="function"?f(qe):(Ne=f&&(qe==null?void 0:qe[f]))!==null&&Ne!==void 0?Ne:ke},[f]),ft=_.useCallback(l||function(qe){return qe},[l]);function ct(qe,ke,Ne){xe===qe&&(ke===void 0||ke===ge)||(Ve(qe),Ne||(Ge(qeX){ct(Et-1,qe-en-Ee+q);break}}C&&Vt(0)+Ee>X&&_e(null)}},[X,U,q,Ee,lt,at]);var qt=He&&!!Je.length,wn={};ge!==null&&rt&&(wn={position:"absolute",left:ge,top:0});var Mn={prefixCls:Pe,responsive:rt,component:O,invalidate:it},Ut=u?function(qe,ke){var Ne=lt(qe,ke);return _.createElement(eg.Provider,{key:Ne,value:J(J({},Mn),{},{order:ke,item:qe,itemKey:Ne,registerSize:xt,display:ke<=Fe})},u(qe,ke))}:function(qe,ke){var Ne=lt(qe,ke);return _.createElement(nf,kt({},Mn,{order:ke,key:Ne,item:qe,renderItem:ft,itemKey:Ne,registerSize:xt,display:ke<=Fe}))},It={order:qt?Fe:Number.MAX_SAFE_INTEGER,className:"".concat(Pe,"-rest"),registerSize:Bt,display:qt},Lt=E||QB,Jt=b?_.createElement(eg.Provider,{value:J(J({},Mn),It)},b(Je)):_.createElement(nf,kt({},Mn,It),typeof Lt=="function"?Lt(Je):Lt),Mt=_.createElement(A,kt({className:Ze(!it&&r,S),style:v,ref:e},N),at.map(Ut),st?Jt:null,C&&_.createElement(nf,kt({},Mn,{responsive:dt,responsiveDisabled:!rt,order:Fe,className:"".concat(Pe,"-suffix"),registerSize:ht,display:!0,style:wn}),C));return dt?_.createElement(Yo,{onResize:mt,disabled:!rt},Mt):Mt}var Wf=_.forwardRef(GB);Wf.displayName="Overflow";Wf.Item=lx;Wf.RESPONSIVE=cx;Wf.INVALIDATE=ux;var JB=function(e,n){var r,i=e.prefixCls,a=e.id,l=e.inputElement,u=e.disabled,f=e.tabIndex,h=e.autoFocus,g=e.autoComplete,m=e.editable,v=e.activeDescendantId,S=e.value,w=e.maxLength,E=e.onKeyDown,b=e.onMouseDown,C=e.onChange,T=e.onPaste,A=e.onCompositionStart,O=e.onCompositionEnd,x=e.onBlur,N=e.open,F=e.attrs,L=l||_.createElement("input",null),D=L,V=D.ref,B=D.props,W=B.onKeyDown,X=B.onChange,Y=B.onMouseDown,ae=B.onCompositionStart,U=B.onCompositionEnd,z=B.onBlur,j=B.style;return"maxLength"in L.props,L=_.cloneElement(L,J(J(J({type:"search"},B),{},{id:a,ref:Zg(n,V),disabled:u,tabIndex:f,autoComplete:g||"off",autoFocus:h,className:Ze("".concat(i,"-selection-search-input"),(r=L)===null||r===void 0||(r=r.props)===null||r===void 0?void 0:r.className),role:"combobox","aria-expanded":N||!1,"aria-haspopup":"listbox","aria-owns":"".concat(a,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(a,"_list"),"aria-activedescendant":N?v:void 0},F),{},{value:m?S:"",maxLength:w,readOnly:!m,unselectable:m?null:"on",style:J(J({},j),{},{opacity:m?null:0}),onKeyDown:function(P){E(P),W&&W(P)},onMouseDown:function(P){b(P),Y&&Y(P)},onChange:function(P){C(P),X&&X(P)},onCompositionStart:function(P){A(P),ae&&ae(P)},onCompositionEnd:function(P){O(P),U&&U(P)},onPaste:T,onBlur:function(P){x(P),z&&z(P)}})),L},fx=_.forwardRef(JB);function dx(t){return Array.isArray(t)?t:t!==void 0?[t]:[]}var eU=typeof window<"u"&&window.document&&window.document.documentElement,tU=eU;function nU(t){return t!=null}function rU(t){return!t&&t!==0}function HT(t){return["string","number"].includes(pt(t))}function hx(t){var e=void 0;return t&&(HT(t.title)?e=t.title.toString():HT(t.label)&&(e=t.label.toString())),e}function iU(t,e){tU?_.useLayoutEffect(t,e):_.useEffect(t,e)}function sU(t){var e;return(e=t.key)!==null&&e!==void 0?e:t.value}var jT=function(e){e.preventDefault(),e.stopPropagation()},aU=function(e){var n=e.id,r=e.prefixCls,i=e.values,a=e.open,l=e.searchValue,u=e.autoClearSearchValue,f=e.inputRef,h=e.placeholder,g=e.disabled,m=e.mode,v=e.showSearch,S=e.autoFocus,w=e.autoComplete,E=e.activeDescendantId,b=e.tabIndex,C=e.removeIcon,T=e.maxTagCount,A=e.maxTagTextLength,O=e.maxTagPlaceholder,x=O===void 0?function(Ie){return"+ ".concat(Ie.length," ...")}:O,N=e.tagRender,F=e.onToggleOpen,L=e.onRemove,D=e.onInputChange,V=e.onInputPaste,B=e.onInputKeyDown,W=e.onInputMouseDown,X=e.onInputCompositionStart,Y=e.onInputCompositionEnd,ae=e.onInputBlur,U=_.useRef(null),z=_.useState(0),j=de(z,2),Z=j[0],P=j[1],$=_.useState(!1),ie=de($,2),se=ie[0],q=ie[1],ce="".concat(r,"-selection"),fe=a||m==="multiple"&&u===!1||m==="tags"?l:"",ye=m==="tags"||m==="multiple"&&u===!1||v&&(a||se);iU(function(){P(U.current.scrollWidth)},[fe]);var Ee=function(we,xe,Ve,Fe,Be){return _.createElement("span",{title:hx(we),className:Ze("".concat(ce,"-item"),K({},"".concat(ce,"-item-disabled"),Ve))},_.createElement("span",{className:"".concat(ce,"-item-content")},xe),Fe&&_.createElement(ip,{className:"".concat(ce,"-item-remove"),onMouseDown:jT,onClick:Be,customizeIcon:C},"×"))},Ce=function(we,xe,Ve,Fe,Be,nt){var He=function(Pe){jT(Pe),F(!a)};return _.createElement("span",{onMouseDown:He},N({label:xe,value:we,disabled:Ve,closable:Fe,onClose:Be,isMaxTag:!!nt}))},Te=function(we){var xe=we.disabled,Ve=we.label,Fe=we.value,Be=!g&&!xe,nt=Ve;if(typeof A=="number"&&(typeof Ve=="string"||typeof Ve=="number")){var He=String(nt);He.length>A&&(nt="".concat(He.slice(0,A),"..."))}var Ge=function(Me){Me&&Me.stopPropagation(),L(we)};return typeof N=="function"?Ce(Fe,nt,xe,Be,Ge):Ee(we,nt,xe,Be,Ge)},ve=function(we){if(!i.length)return null;var xe=typeof x=="function"?x(we):x;return typeof N=="function"?Ce(void 0,xe,!1,!1,void 0,!0):Ee({title:xe},xe,!1)},ge=_.createElement("div",{className:"".concat(ce,"-search"),style:{width:Z},onFocus:function(){q(!0)},onBlur:function(){q(!1)}},_.createElement(fx,{ref:f,open:a,prefixCls:r,id:n,inputElement:null,disabled:g,autoFocus:S,autoComplete:w,editable:ye,activeDescendantId:E,value:fe,onKeyDown:B,onMouseDown:W,onChange:D,onPaste:V,onCompositionStart:X,onCompositionEnd:Y,onBlur:ae,tabIndex:b,attrs:Gh(e,!0)}),_.createElement("span",{ref:U,className:"".concat(ce,"-search-mirror"),"aria-hidden":!0},fe," ")),_e=_.createElement(Wf,{prefixCls:"".concat(ce,"-overflow"),data:i,renderItem:Te,renderRest:ve,suffix:ge,itemKey:sU,maxCount:T});return _.createElement("span",{className:"".concat(ce,"-wrap")},_e,!i.length&&!fe&&_.createElement("span",{className:"".concat(ce,"-placeholder")},h))},oU=function(e){var n=e.inputElement,r=e.prefixCls,i=e.id,a=e.inputRef,l=e.disabled,u=e.autoFocus,f=e.autoComplete,h=e.activeDescendantId,g=e.mode,m=e.open,v=e.values,S=e.placeholder,w=e.tabIndex,E=e.showSearch,b=e.searchValue,C=e.activeValue,T=e.maxLength,A=e.onInputKeyDown,O=e.onInputMouseDown,x=e.onInputChange,N=e.onInputPaste,F=e.onInputCompositionStart,L=e.onInputCompositionEnd,D=e.onInputBlur,V=e.title,B=_.useState(!1),W=de(B,2),X=W[0],Y=W[1],ae=g==="combobox",U=ae||E,z=v[0],j=b||"";ae&&C&&!X&&(j=C),_.useEffect(function(){ae&&Y(!1)},[ae,C]);var Z=g!=="combobox"&&!m&&!E?!1:!!j,P=V===void 0?hx(z):V,$=_.useMemo(function(){return z?null:_.createElement("span",{className:"".concat(r,"-selection-placeholder"),style:Z?{visibility:"hidden"}:void 0},S)},[z,Z,S,r]);return _.createElement("span",{className:"".concat(r,"-selection-wrap")},_.createElement("span",{className:"".concat(r,"-selection-search")},_.createElement(fx,{ref:a,prefixCls:r,id:i,open:m,inputElement:n,disabled:l,autoFocus:u,autoComplete:f,editable:U,activeDescendantId:h,value:j,onKeyDown:A,onMouseDown:O,onChange:function(se){Y(!0),x(se)},onPaste:N,onCompositionStart:F,onCompositionEnd:L,onBlur:D,tabIndex:w,attrs:Gh(e,!0),maxLength:ae?T:void 0})),!ae&&z?_.createElement("span",{className:"".concat(r,"-selection-item"),title:P,style:Z?{visibility:"hidden"}:void 0},z.label):null,$)},lU=function(e,n){var r=_.useRef(null),i=_.useRef(!1),a=e.prefixCls,l=e.open,u=e.mode,f=e.showSearch,h=e.tokenWithEnter,g=e.disabled,m=e.prefix,v=e.autoClearSearchValue,S=e.onSearch,w=e.onSearchSubmit,E=e.onToggleOpen,b=e.onInputKeyDown,C=e.onInputBlur,T=e.domRef;_.useImperativeHandle(n,function(){return{focus:function(P){r.current.focus(P)},blur:function(){r.current.blur()}}});var A=ox(0),O=de(A,2),x=O[0],N=O[1],F=function(P){var $=P.which,ie=r.current instanceof HTMLTextAreaElement;!ie&&l&&($===et.UP||$===et.DOWN)&&P.preventDefault(),b&&b(P),$===et.ENTER&&u==="tags"&&!i.current&&!l&&(w==null||w(P.target.value)),!(ie&&!l&&~[et.UP,et.DOWN,et.LEFT,et.RIGHT].indexOf($))&&$B($)&&E(!0)},L=function(){N(!0)},D=_.useRef(null),V=function(P){S(P,!0,i.current)!==!1&&E(!0)},B=function(){i.current=!0},W=function(P){i.current=!1,u!=="combobox"&&V(P.target.value)},X=function(P){var $=P.target.value;if(h&&D.current&&/[\r\n]/.test(D.current)){var ie=D.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");$=$.replace(ie,D.current)}D.current=null,V($)},Y=function(P){var $=P.clipboardData,ie=$==null?void 0:$.getData("text");D.current=ie||""},ae=function(P){var $=P.target;if($!==r.current){var ie=document.body.style.msTouchAction!==void 0;ie?setTimeout(function(){r.current.focus()}):r.current.focus()}},U=function(P){var $=x();P.target!==r.current&&!$&&!(u==="combobox"&&g)&&P.preventDefault(),(u!=="combobox"&&(!f||!$)||!l)&&(l&&v!==!1&&S("",!0,!1),E())},z={inputRef:r,onInputKeyDown:F,onInputMouseDown:L,onInputChange:X,onInputPaste:Y,onInputCompositionStart:B,onInputCompositionEnd:W,onInputBlur:C},j=u==="multiple"||u==="tags"?_.createElement(aU,kt({},e,z)):_.createElement(oU,kt({},e,z));return _.createElement("div",{ref:T,className:"".concat(a,"-selector"),onClick:ae,onMouseDown:U},m&&_.createElement("div",{className:"".concat(a,"-prefix")},m),j)},cU=_.forwardRef(lU);function uU(t){var e=t.prefixCls,n=t.align,r=t.arrow,i=t.arrowPos,a=r||{},l=a.className,u=a.content,f=i.x,h=f===void 0?0:f,g=i.y,m=g===void 0?0:g,v=_.useRef();if(!n||!n.points)return null;var S={position:"absolute"};if(n.autoArrow!==!1){var w=n.points[0],E=n.points[1],b=w[0],C=w[1],T=E[0],A=E[1];b===T||!["t","b"].includes(b)?S.top=m:b==="t"?S.top=0:S.bottom=0,C===A||!["l","r"].includes(C)?S.left=h:C==="l"?S.left=0:S.right=0}return _.createElement("div",{ref:v,className:Ze("".concat(e,"-arrow"),l),style:S},u)}function fU(t){var e=t.prefixCls,n=t.open,r=t.zIndex,i=t.mask,a=t.motion;return i?_.createElement(Zy,kt({},a,{motionAppear:!0,visible:n,removeOnLeave:!0}),function(l){var u=l.className;return _.createElement("div",{style:{zIndex:r},className:Ze("".concat(e,"-mask"),u)})}):null}var dU=_.memo(function(t){var e=t.children;return e},function(t,e){return e.cache}),hU=_.forwardRef(function(t,e){var n=t.popup,r=t.className,i=t.prefixCls,a=t.style,l=t.target,u=t.onVisibleChanged,f=t.open,h=t.keepDom,g=t.fresh,m=t.onClick,v=t.mask,S=t.arrow,w=t.arrowPos,E=t.align,b=t.motion,C=t.maskMotion,T=t.forceRender,A=t.getPopupContainer,O=t.autoDestroy,x=t.portal,N=t.zIndex,F=t.onMouseEnter,L=t.onMouseLeave,D=t.onPointerEnter,V=t.onPointerDownCapture,B=t.ready,W=t.offsetX,X=t.offsetY,Y=t.offsetR,ae=t.offsetB,U=t.onAlign,z=t.onPrepare,j=t.stretch,Z=t.targetWidth,P=t.targetHeight,$=typeof n=="function"?n():n,ie=f||h,se=(A==null?void 0:A.length)>0,q=_.useState(!A||!se),ce=de(q,2),fe=ce[0],ye=ce[1];if(Dn(function(){!fe&&se&&l&&ye(!0)},[fe,se,l]),!fe)return null;var Ee="auto",Ce={left:"-1000vw",top:"-1000vh",right:Ee,bottom:Ee};if(B||!f){var Te,ve=E.points,ge=E.dynamicInset||((Te=E._experimental)===null||Te===void 0?void 0:Te.dynamicInset),_e=ge&&ve[0][1]==="r",Ie=ge&&ve[0][0]==="b";_e?(Ce.right=Y,Ce.left=Ee):(Ce.left=W,Ce.right=Ee),Ie?(Ce.bottom=ae,Ce.top=Ee):(Ce.top=X,Ce.bottom=Ee)}var we={};return j&&(j.includes("height")&&P?we.height=P:j.includes("minHeight")&&P&&(we.minHeight=P),j.includes("width")&&Z?we.width=Z:j.includes("minWidth")&&Z&&(we.minWidth=Z)),f||(we.pointerEvents="none"),_.createElement(x,{open:T||ie,getContainer:A&&function(){return A(l)},autoDestroy:O},_.createElement(fU,{prefixCls:i,open:f,zIndex:N,mask:v,motion:C}),_.createElement(Yo,{onResize:U,disabled:!f},function(xe){return _.createElement(Zy,kt({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:T,leavedClassName:"".concat(i,"-hidden")},b,{onAppearPrepare:z,onEnterPrepare:z,visible:f,onVisibleChanged:function(Fe){var Be;b==null||(Be=b.onVisibleChanged)===null||Be===void 0||Be.call(b,Fe),u(Fe)}}),function(Ve,Fe){var Be=Ve.className,nt=Ve.style,He=Ze(i,Be,r);return _.createElement("div",{ref:Zg(xe,e,Fe),className:He,style:J(J(J(J({"--arrow-x":"".concat(w.x||0,"px"),"--arrow-y":"".concat(w.y||0,"px")},Ce),we),nt),{},{boxSizing:"border-box",zIndex:N},a),onMouseEnter:F,onMouseLeave:L,onPointerEnter:D,onClick:m,onPointerDownCapture:V},S&&_.createElement(uU,{prefixCls:i,arrow:S,arrowPos:w,align:E}),_.createElement(dU,{cache:!f&&!g},$))})}))}),gU=_.forwardRef(function(t,e){var n=t.children,r=t.getTriggerDOMNode,i=Gg(n),a=_.useCallback(function(u){Dy(e,r?r(u):u)},[r]),l=Qg(a,Fy(n));return i?_.cloneElement(n,{ref:l}):n}),WT=_.createContext(null);function XT(t){return t?Array.isArray(t)?t:[t]:[]}function pU(t,e,n,r){return _.useMemo(function(){var i=XT(n??e),a=XT(r??e),l=new Set(i),u=new Set(a);return t&&(l.has("hover")&&(l.delete("hover"),l.add("click")),u.has("hover")&&(u.delete("hover"),u.add("click"))),[l,u]},[t,e,n,r])}function mU(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function vU(t,e,n,r){for(var i=n.points,a=Object.keys(t),l=0;l1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?e:t}function zu(t){return Cf(parseFloat(t),0)}function YT(t,e){var n=J({},t);return(e||[]).forEach(function(r){if(!(r instanceof HTMLBodyElement||r instanceof HTMLHtmlElement)){var i=Xf(r).getComputedStyle(r),a=i.overflow,l=i.overflowClipMargin,u=i.borderTopWidth,f=i.borderBottomWidth,h=i.borderLeftWidth,g=i.borderRightWidth,m=r.getBoundingClientRect(),v=r.offsetHeight,S=r.clientHeight,w=r.offsetWidth,E=r.clientWidth,b=zu(u),C=zu(f),T=zu(h),A=zu(g),O=Cf(Math.round(m.width/w*1e3)/1e3),x=Cf(Math.round(m.height/v*1e3)/1e3),N=(w-E-T-A)*O,F=(v-S-b-C)*x,L=b*x,D=C*x,V=T*O,B=A*O,W=0,X=0;if(a==="clip"){var Y=zu(l);W=Y*O,X=Y*x}var ae=m.x+V-W,U=m.y+L-X,z=ae+m.width+2*W-V-B-N,j=U+m.height+2*X-L-D-F;n.left=Math.max(n.left,ae),n.top=Math.max(n.top,U),n.right=Math.min(n.right,z),n.bottom=Math.min(n.bottom,j)}}),n}function KT(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(e),r=n.match(/^(.*)\%$/);return r?t*(parseFloat(r[1])/100):parseFloat(n)}function ZT(t,e){var n=e||[],r=de(n,2),i=r[0],a=r[1];return[KT(t.width,i),KT(t.height,a)]}function QT(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function Bl(t,e){var n=e[0],r=e[1],i,a;return n==="t"?a=t.y:n==="b"?a=t.y+t.height:a=t.y+t.height/2,r==="l"?i=t.x:r==="r"?i=t.x+t.width:i=t.x+t.width/2,{x:i,y:a}}function pa(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map(function(r,i){return i===e?n[r]||"c":r}).join("")}function _U(t,e,n,r,i,a,l){var u=_.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:i[r]||{}}),f=de(u,2),h=f[0],g=f[1],m=_.useRef(0),v=_.useMemo(function(){return e?w_(e):[]},[e]),S=_.useRef({}),w=function(){S.current={}};t||w();var E=fr(function(){if(e&&n&&t){let Wr=function(ki,fi){var di=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me,hi=q.x+ki,Bi=q.y+fi,Jo=hi+_e,Va=Bi+ge,el=Math.max(hi,di.left),$e=Math.max(Bi,di.top),gt=Math.min(Jo,di.right),sn=Math.min(Va,di.bottom);return Math.max(0,(gt-el)*(sn-$e))},Go=function(){vn=q.y+Ne,On=vn+ge,_n=q.x+ke,Zn=_n+_e};var T,A,O,x,N=e,F=N.ownerDocument,L=Xf(N),D=L.getComputedStyle(N),V=D.width,B=D.height,W=D.position,X=N.style.left,Y=N.style.top,ae=N.style.right,U=N.style.bottom,z=N.style.overflow,j=J(J({},i[r]),a),Z=F.createElement("div");(T=N.parentElement)===null||T===void 0||T.appendChild(Z),Z.style.left="".concat(N.offsetLeft,"px"),Z.style.top="".concat(N.offsetTop,"px"),Z.style.position=W,Z.style.height="".concat(N.offsetHeight,"px"),Z.style.width="".concat(N.offsetWidth,"px"),N.style.left="0",N.style.top="0",N.style.right="auto",N.style.bottom="auto",N.style.overflow="hidden";var P;if(Array.isArray(n))P={x:n[0],y:n[1],width:0,height:0};else{var $,ie,se=n.getBoundingClientRect();se.x=($=se.x)!==null&&$!==void 0?$:se.left,se.y=(ie=se.y)!==null&&ie!==void 0?ie:se.top,P={x:se.x,y:se.y,width:se.width,height:se.height}}var q=N.getBoundingClientRect();q.x=(A=q.x)!==null&&A!==void 0?A:q.left,q.y=(O=q.y)!==null&&O!==void 0?O:q.top;var ce=F.documentElement,fe=ce.clientWidth,ye=ce.clientHeight,Ee=ce.scrollWidth,Ce=ce.scrollHeight,Te=ce.scrollTop,ve=ce.scrollLeft,ge=q.height,_e=q.width,Ie=P.height,we=P.width,xe={left:0,top:0,right:fe,bottom:ye},Ve={left:-ve,top:-Te,right:Ee-ve,bottom:Ce-Te},Fe=j.htmlRegion,Be="visible",nt="visibleFirst";Fe!=="scroll"&&Fe!==nt&&(Fe=Be);var He=Fe===nt,Ge=YT(Ve,v),Pe=YT(xe,v),Me=Fe===Be?Pe:Ge,dt=He?Pe:Me;N.style.left="auto",N.style.top="auto",N.style.right="0",N.style.bottom="0";var rt=N.getBoundingClientRect();N.style.left=X,N.style.top=Y,N.style.right=ae,N.style.bottom=U,N.style.overflow=z,(x=N.parentElement)===null||x===void 0||x.removeChild(Z);var it=Cf(Math.round(_e/parseFloat(V)*1e3)/1e3),st=Cf(Math.round(ge/parseFloat(B)*1e3)/1e3);if(it===0||st===0||pf(n)&&!jk(n))return;var at=j.offset,Je=j.targetOffset,lt=ZT(q,at),ft=de(lt,2),ct=ft[0],mt=ft[1],xt=ZT(P,Je),Bt=de(xt,2),ht=Bt[0],Vt=Bt[1];P.x-=ht,P.y-=Vt;var qt=j.points||[],wn=de(qt,2),Mn=wn[0],Ut=wn[1],It=QT(Ut),Lt=QT(Mn),Jt=Bl(P,It),Mt=Bl(q,Lt),qe=J({},j),ke=Jt.x-Mt.x+ct,Ne=Jt.y-Mt.y+mt,Et=Wr(ke,Ne),en=Wr(ke,Ne,Pe),Ue=Bl(P,["t","l"]),Oe=Bl(q,["t","l"]),je=Bl(P,["b","r"]),Ye=Bl(q,["b","r"]),We=j.overflow||{},Qe=We.adjustX,bt=We.adjustY,_t=We.shiftX,Zt=We.shiftY,Yt=function(fi){return typeof fi=="boolean"?fi:fi>=0},vn,On,_n,Zn;Go();var un=Yt(bt),rn=Lt[0]===It[0];if(un&&Lt[0]==="t"&&(On>dt.bottom||S.current.bt)){var Ae=Ne;rn?Ae-=ge-Ie:Ae=Ue.y-Ye.y-mt;var Le=Wr(ke,Ae),De=Wr(ke,Ae,Pe);Le>Et||Le===Et&&(!He||De>=en)?(S.current.bt=!0,Ne=Ae,mt=-mt,qe.points=[pa(Lt,0),pa(It,0)]):S.current.bt=!1}if(un&&Lt[0]==="b"&&(vnEt||ut===Et&&(!He||zt>=en)?(S.current.tb=!0,Ne=be,mt=-mt,qe.points=[pa(Lt,0),pa(It,0)]):S.current.tb=!1}var Ot=Yt(Qe),In=Lt[1]===It[1];if(Ot&&Lt[1]==="l"&&(Zn>dt.right||S.current.rl)){var tn=ke;In?tn-=_e-we:tn=Ue.x-Ye.x-ct;var Vn=Wr(tn,Ne),Pn=Wr(tn,Ne,Pe);Vn>Et||Vn===Et&&(!He||Pn>=en)?(S.current.rl=!0,ke=tn,ct=-ct,qe.points=[pa(Lt,1),pa(It,1)]):S.current.rl=!1}if(Ot&&Lt[1]==="r"&&(_nEt||Or===Et&&(!He||er>=en)?(S.current.lr=!0,ke=Bn,ct=-ct,qe.points=[pa(Lt,1),pa(It,1)]):S.current.lr=!1}Go();var Un=_t===!0?0:_t;typeof Un=="number"&&(_nPe.right&&(ke-=Zn-Pe.right-ct,P.x>Pe.right-Un&&(ke+=P.x-Pe.right+Un)));var Tn=Zt===!0?0:Zt;typeof Tn=="number"&&(vnPe.bottom&&(Ne-=On-Pe.bottom-mt,P.y>Pe.bottom-Tn&&(Ne+=P.y-Pe.bottom+Tn)));var Qn=q.x+ke,Ii=Qn+_e,jr=q.y+Ne,Di=jr+ge,Fi=P.x,Tt=Fi+we,yt=P.y,nn=yt+Ie,Hn=Math.max(Qn,Fi),Cn=Math.min(Ii,Tt),Nn=(Hn+Cn)/2,tr=Nn-Qn,br=Math.max(jr,yt),Br=Math.min(Di,nn),Sr=(br+Br)/2,Qr=Sr-jr;l==null||l(e,qe);var Gr=rt.right-q.x-(ke+q.width),gr=rt.bottom-q.y-(Ne+q.height);it===1&&(ke=Math.round(ke),Gr=Math.round(Gr)),st===1&&(Ne=Math.round(Ne),gr=Math.round(gr));var $a={ready:!0,offsetX:ke/it,offsetY:Ne/st,offsetR:Gr/it,offsetB:gr/st,arrowX:tr/it,arrowY:Qr/st,scaleX:it,scaleY:st,align:qe};g($a)}}),b=function(){m.current+=1;var A=m.current;Promise.resolve().then(function(){m.current===A&&E()})},C=function(){g(function(A){return J(J({},A),{},{ready:!1})})};return Dn(C,[r]),Dn(function(){t||C()},[t]),[h.ready,h.offsetX,h.offsetY,h.offsetR,h.offsetB,h.arrowX,h.arrowY,h.scaleX,h.scaleY,h.align,b]}function yU(t,e,n,r,i){Dn(function(){if(t&&e&&n){let m=function(){r(),i()};var a=e,l=n,u=w_(a),f=w_(l),h=Xf(l),g=new Set([h].concat(ze(u),ze(f)));return g.forEach(function(v){v.addEventListener("scroll",m,{passive:!0})}),h.addEventListener("resize",m,{passive:!0}),r(),function(){g.forEach(function(v){v.removeEventListener("scroll",m),h.removeEventListener("resize",m)})}}},[t,e,n])}function bU(t,e,n,r,i,a,l,u){var f=_.useRef(t);f.current=t;var h=_.useRef(!1);_.useEffect(function(){if(e&&r&&(!i||a)){var m=function(){h.current=!1},v=function(b){var C;f.current&&!l(((C=b.composedPath)===null||C===void 0||(C=C.call(b))===null||C===void 0?void 0:C[0])||b.target)&&!h.current&&u(!1)},S=Xf(r);S.addEventListener("pointerdown",m,!0),S.addEventListener("mousedown",v,!0),S.addEventListener("contextmenu",v,!0);var w=Qh(n);return w&&(w.addEventListener("mousedown",v,!0),w.addEventListener("contextmenu",v,!0)),function(){S.removeEventListener("pointerdown",m,!0),S.removeEventListener("mousedown",v,!0),S.removeEventListener("contextmenu",v,!0),w&&(w.removeEventListener("mousedown",v,!0),w.removeEventListener("contextmenu",v,!0))}}},[e,n,r,i,a]);function g(){h.current=!0}return g}var SU=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function EU(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Q3,e=_.forwardRef(function(n,r){var i=n.prefixCls,a=i===void 0?"rc-trigger-popup":i,l=n.children,u=n.action,f=u===void 0?"hover":u,h=n.showAction,g=n.hideAction,m=n.popupVisible,v=n.defaultPopupVisible,S=n.onPopupVisibleChange,w=n.afterPopupVisibleChange,E=n.mouseEnterDelay,b=n.mouseLeaveDelay,C=b===void 0?.1:b,T=n.focusDelay,A=n.blurDelay,O=n.mask,x=n.maskClosable,N=x===void 0?!0:x,F=n.getPopupContainer,L=n.forceRender,D=n.autoDestroy,V=n.destroyPopupOnHide,B=n.popup,W=n.popupClassName,X=n.popupStyle,Y=n.popupPlacement,ae=n.builtinPlacements,U=ae===void 0?{}:ae,z=n.popupAlign,j=n.zIndex,Z=n.stretch,P=n.getPopupClassNameFromAlign,$=n.fresh,ie=n.alignPoint,se=n.onPopupClick,q=n.onPopupAlign,ce=n.arrow,fe=n.popupMotion,ye=n.maskMotion,Ee=n.popupTransitionName,Ce=n.popupAnimation,Te=n.maskTransitionName,ve=n.maskAnimation,ge=n.className,_e=n.getTriggerDOMNode,Ie=Fn(n,SU),we=D||V||!1,xe=_.useState(!1),Ve=de(xe,2),Fe=Ve[0],Be=Ve[1];Dn(function(){Be(sx())},[]);var nt=_.useRef({}),He=_.useContext(WT),Ge=_.useMemo(function(){return{registerSubPopup:function(gt,sn){nt.current[gt]=sn,He==null||He.registerSubPopup(gt,sn)}}},[He]),Pe=G3(),Me=_.useState(null),dt=de(Me,2),rt=dt[0],it=dt[1],st=_.useRef(null),at=fr(function($e){st.current=$e,pf($e)&&rt!==$e&&it($e),He==null||He.registerSubPopup(Pe,$e)}),Je=_.useState(null),lt=de(Je,2),ft=lt[0],ct=lt[1],mt=_.useRef(null),xt=fr(function($e){pf($e)&&ft!==$e&&(ct($e),mt.current=$e)}),Bt=_.Children.only(l),ht=(Bt==null?void 0:Bt.props)||{},Vt={},qt=fr(function($e){var gt,sn,fn=ft;return(fn==null?void 0:fn.contains($e))||((gt=Qh(fn))===null||gt===void 0?void 0:gt.host)===$e||$e===fn||(rt==null?void 0:rt.contains($e))||((sn=Qh(rt))===null||sn===void 0?void 0:sn.host)===$e||$e===rt||Object.values(nt.current).some(function(An){return(An==null?void 0:An.contains($e))||$e===An})}),wn=qT(a,fe,Ce,Ee),Mn=qT(a,ye,ve,Te),Ut=_.useState(v||!1),It=de(Ut,2),Lt=It[0],Jt=It[1],Mt=m??Lt,qe=fr(function($e){m===void 0&&Jt($e)});Dn(function(){Jt(m||!1)},[m]);var ke=_.useRef(Mt);ke.current=Mt;var Ne=_.useRef([]);Ne.current=[];var Et=fr(function($e){var gt;qe($e),((gt=Ne.current[Ne.current.length-1])!==null&>!==void 0?gt:Mt)!==$e&&(Ne.current.push($e),S==null||S($e))}),en=_.useRef(),Ue=function(){clearTimeout(en.current)},Oe=function(gt){var sn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ue(),sn===0?Et(gt):en.current=setTimeout(function(){Et(gt)},sn*1e3)};_.useEffect(function(){return Ue},[]);var je=_.useState(!1),Ye=de(je,2),We=Ye[0],Qe=Ye[1];Dn(function($e){(!$e||Mt)&&Qe(!0)},[Mt]);var bt=_.useState(null),_t=de(bt,2),Zt=_t[0],Yt=_t[1],vn=_.useState(null),On=de(vn,2),_n=On[0],Zn=On[1],un=function(gt){Zn([gt.clientX,gt.clientY])},rn=_U(Mt,rt,ie&&_n!==null?_n:ft,Y,U,z,q),Ae=de(rn,11),Le=Ae[0],De=Ae[1],be=Ae[2],ut=Ae[3],zt=Ae[4],Ot=Ae[5],In=Ae[6],tn=Ae[7],Vn=Ae[8],Pn=Ae[9],Bn=Ae[10],Or=pU(Fe,f,h,g),er=de(Or,2),Un=er[0],Tn=er[1],Qn=Un.has("click"),Ii=Tn.has("click")||Tn.has("contextMenu"),jr=fr(function(){We||Bn()}),Di=function(){ke.current&&ie&&Ii&&Oe(!1)};yU(Mt,ft,rt,jr,Di),Dn(function(){jr()},[_n,Y]),Dn(function(){Mt&&!(U!=null&&U[Y])&&jr()},[JSON.stringify(z)]);var Fi=_.useMemo(function(){var $e=vU(U,a,Pn,ie);return Ze($e,P==null?void 0:P(Pn))},[Pn,P,U,a,ie]);_.useImperativeHandle(r,function(){return{nativeElement:mt.current,popupElement:st.current,forceAlign:jr}});var Tt=_.useState(0),yt=de(Tt,2),nn=yt[0],Hn=yt[1],Cn=_.useState(0),Nn=de(Cn,2),tr=Nn[0],br=Nn[1],Br=function(){if(Z&&ft){var gt=ft.getBoundingClientRect();Hn(gt.width),br(gt.height)}},Sr=function(){Br(),jr()},Qr=function(gt){Qe(!1),Bn(),w==null||w(gt)},Gr=function(){return new Promise(function(gt){Br(),Yt(function(){return gt})})};Dn(function(){Zt&&(Bn(),Zt(),Yt(null))},[Zt]);function gr($e,gt,sn,fn){Vt[$e]=function(An){var ws;fn==null||fn(An),Oe(gt,sn);for(var tl=arguments.length,Ha=new Array(tl>1?tl-1:0),Ts=1;Ts1?sn-1:0),An=1;An1?sn-1:0),An=1;An1&&arguments[1]!==void 0?arguments[1]:{},n=e.fieldNames,r=e.childrenAsData,i=[],a=px(n,!1),l=a.label,u=a.value,f=a.options,h=a.groupLabel;function g(m,v){Array.isArray(m)&&m.forEach(function(S){if(v||!(f in S)){var w=S[u];i.push({key:GT(S,i.length),groupOption:v,data:S,label:S[l],value:w})}else{var E=S[h];E===void 0&&r&&(E=S.label),i.push({key:GT(S,i.length),group:!0,data:S,label:E}),g(S[f],!0)}})}return g(t,!1),i}function C_(t){var e=J({},t);return"props"in e||Object.defineProperty(e,"props",{get:function(){return kr(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),e}}),e}var xU=function(e,n,r){if(!n||!n.length)return null;var i=!1,a=function u(f,h){var g=a3(h),m=g[0],v=g.slice(1);if(!m)return[f];var S=f.split(m);return i=i||S.length>1,S.reduce(function(w,E){return[].concat(ze(w),ze(u(E,v)))},[]).filter(Boolean)},l=a(e,n);return i?typeof r<"u"?l.slice(0,r):l:null},Jy=_.createContext(null);function MU(t){var e=t.visible,n=t.values;if(!e)return null;var r=50;return _.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(n.slice(0,r).map(function(i){var a=i.label,l=i.value;return["number","string"].includes(pt(a))?a:l}).join(", ")),n.length>r?", ...":null)}var OU=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],PU=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],A_=function(e){return e==="tags"||e==="multiple"},NU=_.forwardRef(function(t,e){var n,r=t.id,i=t.prefixCls,a=t.className,l=t.showSearch,u=t.tagRender,f=t.direction,h=t.omitDomProps,g=t.displayValues,m=t.onDisplayValuesChange,v=t.emptyOptions,S=t.notFoundContent,w=S===void 0?"Not Found":S,E=t.onClear,b=t.mode,C=t.disabled,T=t.loading,A=t.getInputElement,O=t.getRawInputElement,x=t.open,N=t.defaultOpen,F=t.onDropdownVisibleChange,L=t.activeValue,D=t.onActiveValueChange,V=t.activeDescendantId,B=t.searchValue,W=t.autoClearSearchValue,X=t.onSearch,Y=t.onSearchSplit,ae=t.tokenSeparators,U=t.allowClear,z=t.prefix,j=t.suffixIcon,Z=t.clearIcon,P=t.OptionList,$=t.animation,ie=t.transitionName,se=t.dropdownStyle,q=t.dropdownClassName,ce=t.dropdownMatchSelectWidth,fe=t.dropdownRender,ye=t.dropdownAlign,Ee=t.placement,Ce=t.builtinPlacements,Te=t.getPopupContainer,ve=t.showAction,ge=ve===void 0?[]:ve,_e=t.onFocus,Ie=t.onBlur,we=t.onKeyUp,xe=t.onKeyDown,Ve=t.onMouseDown,Fe=Fn(t,OU),Be=A_(b),nt=(l!==void 0?l:Be)||b==="combobox",He=J({},Fe);PU.forEach(function(Tt){delete He[Tt]}),h==null||h.forEach(function(Tt){delete He[Tt]});var Ge=_.useState(!1),Pe=de(Ge,2),Me=Pe[0],dt=Pe[1];_.useEffect(function(){dt(sx())},[]);var rt=_.useRef(null),it=_.useRef(null),st=_.useRef(null),at=_.useRef(null),Je=_.useRef(null),lt=_.useRef(!1),ft=LB(),ct=de(ft,3),mt=ct[0],xt=ct[1],Bt=ct[2];_.useImperativeHandle(e,function(){var Tt,yt;return{focus:(Tt=at.current)===null||Tt===void 0?void 0:Tt.focus,blur:(yt=at.current)===null||yt===void 0?void 0:yt.blur,scrollTo:function(Hn){var Cn;return(Cn=Je.current)===null||Cn===void 0?void 0:Cn.scrollTo(Hn)},nativeElement:rt.current||it.current}});var ht=_.useMemo(function(){var Tt;if(b!=="combobox")return B;var yt=(Tt=g[0])===null||Tt===void 0?void 0:Tt.value;return typeof yt=="string"||typeof yt=="number"?String(yt):""},[B,b,g]),Vt=b==="combobox"&&typeof A=="function"&&A()||null,qt=typeof O=="function"&&O(),wn=Qg(it,qt==null||(n=qt.props)===null||n===void 0?void 0:n.ref),Mn=_.useState(!1),Ut=de(Mn,2),It=Ut[0],Lt=Ut[1];Dn(function(){Lt(!0)},[]);var Jt=Tc(!1,{defaultValue:N,value:x}),Mt=de(Jt,2),qe=Mt[0],ke=Mt[1],Ne=It?qe:!1,Et=!w&&v;(C||Et&&Ne&&b==="combobox")&&(Ne=!1);var en=Et?!1:Ne,Ue=_.useCallback(function(Tt){var yt=Tt!==void 0?Tt:!Ne;C||(ke(yt),Ne!==yt&&(F==null||F(yt)))},[C,Ne,ke,F]),Oe=_.useMemo(function(){return(ae||[]).some(function(Tt){return[` +`,`\r +`].includes(Tt)})},[ae]),je=_.useContext(Jy)||{},Ye=je.maxCount,We=je.rawValues,Qe=function(yt,nn,Hn){if(!(Be&&T_(Ye)&&(We==null?void 0:We.size)>=Ye)){var Cn=!0,Nn=yt;D==null||D(null);var tr=xU(yt,ae,T_(Ye)?Ye-We.size:void 0),br=Hn?null:tr;return b!=="combobox"&&br&&(Nn="",Y==null||Y(br),Ue(!1),Cn=!1),X&&ht!==Nn&&X(Nn,{source:nn?"typing":"effect"}),Cn}},bt=function(yt){!yt||!yt.trim()||X(yt,{source:"submit"})};_.useEffect(function(){!Ne&&!Be&&b!=="combobox"&&Qe("",!1,!1)},[Ne]),_.useEffect(function(){qe&&C&&ke(!1),C&&!lt.current&&xt(!1)},[C]);var _t=ox(),Zt=de(_t,2),Yt=Zt[0],vn=Zt[1],On=_.useRef(!1),_n=function(yt){var nn=Yt(),Hn=yt.key,Cn=Hn==="Enter";if(Cn&&(b!=="combobox"&&yt.preventDefault(),Ne||Ue(!0)),vn(!!ht),Hn==="Backspace"&&!nn&&Be&&!ht&&g.length){for(var Nn=ze(g),tr=null,br=Nn.length-1;br>=0;br-=1){var Br=Nn[br];if(!Br.disabled){Nn.splice(br,1),tr=Br;break}}tr&&m(Nn,{type:"remove",values:[tr]})}for(var Sr=arguments.length,Qr=new Array(Sr>1?Sr-1:0),Gr=1;Gr1?nn-1:0),Cn=1;Cn1?tr-1:0),Br=1;Br"u"?"undefined":pt(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const vx=function(t,e,n,r){var i=_.useRef(!1),a=_.useRef(null);function l(){clearTimeout(a.current),i.current=!0,a.current=setTimeout(function(){i.current=!1},50)}var u=_.useRef({top:t,bottom:e,left:n,right:r});return u.current.top=t,u.current.bottom=e,u.current.left=n,u.current.right=r,function(f,h){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,m=f?h<0&&u.current.left||h>0&&u.current.right:h<0&&u.current.top||h>0&&u.current.bottom;return g&&m?(clearTimeout(a.current),i.current=!1):(!m||i.current)&&l(),!i.current&&m}};function BU(t,e,n,r,i,a,l){var u=_.useRef(0),f=_.useRef(null),h=_.useRef(null),g=_.useRef(!1),m=vx(e,n,r,i);function v(T,A){if(dr.cancel(f.current),!m(!1,A)){var O=T;if(!O._virtualHandled)O._virtualHandled=!0;else return;u.current+=A,h.current=A,JT||O.preventDefault(),f.current=dr(function(){var x=g.current?10:1;l(u.current*x,!1),u.current=0})}}function S(T,A){l(A,!0),JT||T.preventDefault()}var w=_.useRef(null),E=_.useRef(null);function b(T){if(t){dr.cancel(E.current),E.current=dr(function(){w.current=null},2);var A=T.deltaX,O=T.deltaY,x=T.shiftKey,N=A,F=O;(w.current==="sx"||!w.current&&x&&O&&!A)&&(N=O,F=0,w.current="sx");var L=Math.abs(N),D=Math.abs(F);w.current===null&&(w.current=a&&L>D?"x":"y"),w.current==="y"?v(T,F):S(T,N)}}function C(T){t&&(g.current=T.detail===h.current)}return[b,C]}function UU(t,e,n,r){var i=_.useMemo(function(){return[new Map,[]]},[t,n.id,r]),a=de(i,2),l=a[0],u=a[1],f=function(g){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g,v=l.get(g),S=l.get(m);if(v===void 0||S===void 0)for(var w=t.length,E=u.length;E0&&arguments[0]!==void 0?arguments[0]:!1;g();var w=function(){var C=!1;u.current.forEach(function(T,A){if(T&&T.offsetParent){var O=Gu(T),x=O.offsetHeight,N=getComputedStyle(O),F=N.marginTop,L=N.marginBottom,D=eC(F),V=eC(L),B=x+D+V;f.current.get(A)!==B&&(f.current.set(A,B),C=!0)}}),C&&l(function(T){return T+1})};if(S)w();else{h.current+=1;var E=h.current;Promise.resolve().then(function(){E===h.current&&w()})}}function v(S,w){var E=t(S);u.current.get(E),w?(u.current.set(E,w),m()):u.current.delete(E)}return _.useEffect(function(){return g},[]),[v,m,f.current,a]}var tC=14/15;function $U(t,e,n){var r=_.useRef(!1),i=_.useRef(0),a=_.useRef(0),l=_.useRef(null),u=_.useRef(null),f,h=function(S){if(r.current){var w=Math.ceil(S.touches[0].pageX),E=Math.ceil(S.touches[0].pageY),b=i.current-w,C=a.current-E,T=Math.abs(b)>Math.abs(C);T?i.current=w:a.current=E;var A=n(T,T?b:C,!1,S);A&&S.preventDefault(),clearInterval(u.current),A&&(u.current=setInterval(function(){T?b*=tC:C*=tC;var O=Math.floor(T?b:C);(!n(T,O,!0)||Math.abs(O)<=.1)&&clearInterval(u.current)},16))}},g=function(){r.current=!1,f()},m=function(S){f(),S.touches.length===1&&!r.current&&(r.current=!0,i.current=Math.ceil(S.touches[0].pageX),a.current=Math.ceil(S.touches[0].pageY),l.current=S.target,l.current.addEventListener("touchmove",h,{passive:!1}),l.current.addEventListener("touchend",g,{passive:!0}))};f=function(){l.current&&(l.current.removeEventListener("touchmove",h),l.current.removeEventListener("touchend",g))},Dn(function(){return t&&e.current.addEventListener("touchstart",m,{passive:!0}),function(){var v;(v=e.current)===null||v===void 0||v.removeEventListener("touchstart",m),f(),clearInterval(u.current)}},[t])}function nC(t){return Math.floor(Math.pow(t,.5))}function R_(t,e){var n="touches"in t?t.touches[0]:t;return n[e?"pageX":"pageY"]-window[e?"scrollX":"scrollY"]}function VU(t,e,n){_.useEffect(function(){var r=e.current;if(t&&r){var i=!1,a,l,u=function(){dr.cancel(a)},f=function v(){u(),a=dr(function(){n(l),v()})},h=function(S){if(!S.target.draggable){var w=S;w._virtualHandled||(w._virtualHandled=!0,i=!0)}},g=function(){i=!1,u()},m=function(S){if(i){var w=R_(S,!1),E=r.getBoundingClientRect(),b=E.top,C=E.bottom;if(w<=b){var T=b-w;l=-nC(T),f()}else if(w>=C){var A=w-C;l=nC(A),f()}else u()}};return r.addEventListener("mousedown",h),r.ownerDocument.addEventListener("mouseup",g),r.ownerDocument.addEventListener("mousemove",m),function(){r.removeEventListener("mousedown",h),r.ownerDocument.removeEventListener("mouseup",g),r.ownerDocument.removeEventListener("mousemove",m),u()}}},[t])}var HU=10;function jU(t,e,n,r,i,a,l,u){var f=_.useRef(),h=_.useState(null),g=de(h,2),m=g[0],v=g[1];return Dn(function(){if(m&&m.times=0;Y-=1){var ae=i(e[Y]),U=n.get(ae);if(U===void 0){T=!0;break}if(X-=U,X<=0)break}switch(x){case"top":O=F-b;break;case"bottom":O=L-C+b;break;default:{var z=t.current.scrollTop,j=z+C;Fj&&(A="bottom")}}O!==null&&l(O),O!==m.lastTop&&(T=!0)}T&&v(J(J({},m),{},{times:m.times+1,targetAlign:A,lastTop:O}))}},[m,t.current]),function(S){if(S==null){u();return}if(dr.cancel(f.current),typeof S=="number")l(S);else if(S&&pt(S)==="object"){var w,E=S.align;"index"in S?w=S.index:w=e.findIndex(function(T){return i(T)===S.key});var b=S.offset,C=b===void 0?0:b;v({times:0,index:w,offset:C,originAlign:E})}}}var rC=_.forwardRef(function(t,e){var n=t.prefixCls,r=t.rtl,i=t.scrollOffset,a=t.scrollRange,l=t.onStartMove,u=t.onStopMove,f=t.onScroll,h=t.horizontal,g=t.spinSize,m=t.containerSize,v=t.style,S=t.thumbStyle,w=t.showScrollBar,E=_.useState(!1),b=de(E,2),C=b[0],T=b[1],A=_.useState(null),O=de(A,2),x=O[0],N=O[1],F=_.useState(null),L=de(F,2),D=L[0],V=L[1],B=!r,W=_.useRef(),X=_.useRef(),Y=_.useState(w),ae=de(Y,2),U=ae[0],z=ae[1],j=_.useRef(),Z=function(){w===!0||w===!1||(clearTimeout(j.current),z(!0),j.current=setTimeout(function(){z(!1)},3e3))},P=a-m||0,$=m-g||0,ie=_.useMemo(function(){if(i===0||P===0)return 0;var ve=i/P;return ve*$},[i,P,$]),se=function(ge){ge.stopPropagation(),ge.preventDefault()},q=_.useRef({top:ie,dragging:C,pageY:x,startTop:D});q.current={top:ie,dragging:C,pageY:x,startTop:D};var ce=function(ge){T(!0),N(R_(ge,h)),V(q.current.top),l(),ge.stopPropagation(),ge.preventDefault()};_.useEffect(function(){var ve=function(we){we.preventDefault()},ge=W.current,_e=X.current;return ge.addEventListener("touchstart",ve,{passive:!1}),_e.addEventListener("touchstart",ce,{passive:!1}),function(){ge.removeEventListener("touchstart",ve),_e.removeEventListener("touchstart",ce)}},[]);var fe=_.useRef();fe.current=P;var ye=_.useRef();ye.current=$,_.useEffect(function(){if(C){var ve,ge=function(we){var xe=q.current,Ve=xe.dragging,Fe=xe.pageY,Be=xe.startTop;dr.cancel(ve);var nt=W.current.getBoundingClientRect(),He=m/(h?nt.width:nt.height);if(Ve){var Ge=(R_(we,h)-Fe)*He,Pe=Be;!B&&h?Pe-=Ge:Pe+=Ge;var Me=fe.current,dt=ye.current,rt=dt?Pe/dt:0,it=Math.ceil(rt*Me);it=Math.max(it,0),it=Math.min(it,Me),ve=dr(function(){f(it,h)})}},_e=function(){T(!1),u()};return window.addEventListener("mousemove",ge,{passive:!0}),window.addEventListener("touchmove",ge,{passive:!0}),window.addEventListener("mouseup",_e,{passive:!0}),window.addEventListener("touchend",_e,{passive:!0}),function(){window.removeEventListener("mousemove",ge),window.removeEventListener("touchmove",ge),window.removeEventListener("mouseup",_e),window.removeEventListener("touchend",_e),dr.cancel(ve)}}},[C]),_.useEffect(function(){return Z(),function(){clearTimeout(j.current)}},[i]),_.useImperativeHandle(e,function(){return{delayHidden:Z}});var Ee="".concat(n,"-scrollbar"),Ce={position:"absolute",visibility:U?null:"hidden"},Te={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return h?(Ce.height=8,Ce.left=0,Ce.right=0,Ce.bottom=0,Te.height="100%",Te.width=g,B?Te.left=ie:Te.right=ie):(Ce.width=8,Ce.top=0,Ce.bottom=0,B?Ce.right=0:Ce.left=0,Te.width="100%",Te.height=g,Te.top=ie),_.createElement("div",{ref:W,className:Ze(Ee,K(K(K({},"".concat(Ee,"-horizontal"),h),"".concat(Ee,"-vertical"),!h),"".concat(Ee,"-visible"),U)),style:J(J({},Ce),v),onMouseDown:se,onMouseMove:Z},_.createElement("div",{ref:X,className:Ze("".concat(Ee,"-thumb"),K({},"".concat(Ee,"-thumb-moving"),C)),style:J(J({},Te),S),onMouseDown:ce}))}),WU=20;function iC(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*t;return isNaN(n)&&(n=0),n=Math.max(n,WU),Math.floor(n)}var XU=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],qU=[],YU={overflowY:"auto",overflowAnchor:"none"};function KU(t,e){var n=t.prefixCls,r=n===void 0?"rc-virtual-list":n,i=t.className,a=t.height,l=t.itemHeight,u=t.fullHeight,f=u===void 0?!0:u,h=t.style,g=t.data,m=t.children,v=t.itemKey,S=t.virtual,w=t.direction,E=t.scrollWidth,b=t.component,C=b===void 0?"div":b,T=t.onScroll,A=t.onVirtualScroll,O=t.onVisibleChange,x=t.innerProps,N=t.extraRender,F=t.styles,L=t.showScrollBar,D=L===void 0?"optional":L,V=Fn(t,XU),B=_.useCallback(function(Ae){return typeof v=="function"?v(Ae):Ae==null?void 0:Ae[v]},[v]),W=zU(B),X=de(W,4),Y=X[0],ae=X[1],U=X[2],z=X[3],j=!!(S!==!1&&a&&l),Z=_.useMemo(function(){return Object.values(U.maps).reduce(function(Ae,Le){return Ae+Le},0)},[U.id,U.maps]),P=j&&g&&(Math.max(l*g.length,Z)>a||!!E),$=w==="rtl",ie=Ze(r,K({},"".concat(r,"-rtl"),$),i),se=g||qU,q=_.useRef(),ce=_.useRef(),fe=_.useRef(),ye=_.useState(0),Ee=de(ye,2),Ce=Ee[0],Te=Ee[1],ve=_.useState(0),ge=de(ve,2),_e=ge[0],Ie=ge[1],we=_.useState(!1),xe=de(we,2),Ve=xe[0],Fe=xe[1],Be=function(){Fe(!0)},nt=function(){Fe(!1)},He={getKey:B};function Ge(Ae){Te(function(Le){var De;typeof Ae=="function"?De=Ae(Le):De=Ae;var be=Lt(De);return q.current.scrollTop=be,be})}var Pe=_.useRef({start:0,end:se.length}),Me=_.useRef(),dt=kU(se,B),rt=de(dt,1),it=rt[0];Me.current=it;var st=_.useMemo(function(){if(!j)return{scrollHeight:void 0,start:0,end:se.length-1,offset:void 0};if(!P){var Ae;return{scrollHeight:((Ae=ce.current)===null||Ae===void 0?void 0:Ae.offsetHeight)||0,start:0,end:se.length-1,offset:void 0}}for(var Le=0,De,be,ut,zt=se.length,Ot=0;Ot=Ce&&De===void 0&&(De=Ot,be=Le),Pn>Ce+a&&ut===void 0&&(ut=Ot),Le=Pn}return De===void 0&&(De=0,be=0,ut=Math.ceil(a/l)),ut===void 0&&(ut=se.length-1),ut=Math.min(ut+1,se.length-1),{scrollHeight:Le,start:De,end:ut,offset:be}},[P,j,Ce,se,z,a]),at=st.scrollHeight,Je=st.start,lt=st.end,ft=st.offset;Pe.current.start=Je,Pe.current.end=lt,_.useLayoutEffect(function(){var Ae=U.getRecord();if(Ae.size===1){var Le=Array.from(Ae)[0],De=B(se[Je]);if(De===Le){var be=U.get(Le),ut=be-l;Ge(function(zt){return zt+ut})}}U.resetRecord()},[at]);var ct=_.useState({width:0,height:a}),mt=de(ct,2),xt=mt[0],Bt=mt[1],ht=function(Le){Bt({width:Le.offsetWidth,height:Le.offsetHeight})},Vt=_.useRef(),qt=_.useRef(),wn=_.useMemo(function(){return iC(xt.width,E)},[xt.width,E]),Mn=_.useMemo(function(){return iC(xt.height,at)},[xt.height,at]),Ut=at-a,It=_.useRef(Ut);It.current=Ut;function Lt(Ae){var Le=Ae;return Number.isNaN(It.current)||(Le=Math.min(Le,It.current)),Le=Math.max(Le,0),Le}var Jt=Ce<=0,Mt=Ce>=Ut,qe=_e<=0,ke=_e>=E,Ne=vx(Jt,Mt,qe,ke),Et=function(){return{x:$?-_e:_e,y:Ce}},en=_.useRef(Et()),Ue=fr(function(Ae){if(A){var Le=J(J({},Et()),Ae);(en.current.x!==Le.x||en.current.y!==Le.y)&&(A(Le),en.current=Le)}});function Oe(Ae,Le){var De=Ae;Le?(za.flushSync(function(){Ie(De)}),Ue()):Ge(De)}function je(Ae){var Le=Ae.currentTarget.scrollTop;Le!==Ce&&Ge(Le),T==null||T(Ae),Ue()}var Ye=function(Le){var De=Le,be=E?E-xt.width:0;return De=Math.max(De,0),De=Math.min(De,be),De},We=fr(function(Ae,Le){Le?(za.flushSync(function(){Ie(function(De){var be=De+($?-Ae:Ae);return Ye(be)})}),Ue()):Ge(function(De){var be=De+Ae;return be})}),Qe=BU(j,Jt,Mt,qe,ke,!!E,We),bt=de(Qe,2),_t=bt[0],Zt=bt[1];$U(j,q,function(Ae,Le,De,be){var ut=be;return Ne(Ae,Le,De)?!1:!ut||!ut._virtualHandled?(ut&&(ut._virtualHandled=!0),_t({preventDefault:function(){},deltaX:Ae?Le:0,deltaY:Ae?0:Le}),!0):!1}),VU(P,q,function(Ae){Ge(function(Le){return Le+Ae})}),Dn(function(){function Ae(De){var be=Jt&&De.detail<0,ut=Mt&&De.detail>0;j&&!be&&!ut&&De.preventDefault()}var Le=q.current;return Le.addEventListener("wheel",_t,{passive:!1}),Le.addEventListener("DOMMouseScroll",Zt,{passive:!0}),Le.addEventListener("MozMousePixelScroll",Ae,{passive:!1}),function(){Le.removeEventListener("wheel",_t),Le.removeEventListener("DOMMouseScroll",Zt),Le.removeEventListener("MozMousePixelScroll",Ae)}},[j,Jt,Mt]),Dn(function(){if(E){var Ae=Ye(_e);Ie(Ae),Ue({x:Ae})}},[xt.width,E]);var Yt=function(){var Le,De;(Le=Vt.current)===null||Le===void 0||Le.delayHidden(),(De=qt.current)===null||De===void 0||De.delayHidden()},vn=jU(q,se,U,l,B,function(){return ae(!0)},Ge,Yt);_.useImperativeHandle(e,function(){return{nativeElement:fe.current,getScrollInfo:Et,scrollTo:function(Le){function De(be){return be&&pt(be)==="object"&&("left"in be||"top"in be)}De(Le)?(Le.left!==void 0&&Ie(Ye(Le.left)),vn(Le.top)):vn(Le)}}}),Dn(function(){if(O){var Ae=se.slice(Je,lt+1);O(Ae,se)}},[Je,lt,se]);var On=UU(se,B,U,l),_n=N==null?void 0:N({start:Je,end:lt,virtual:P,offsetX:_e,offsetY:ft,rtl:$,getSize:On}),Zn=DU(se,Je,lt,E,_e,Y,m,He),un=null;a&&(un=J(K({},f?"height":"maxHeight",a),YU),j&&(un.overflowY="hidden",E&&(un.overflowX="hidden"),Ve&&(un.pointerEvents="none")));var rn={};return $&&(rn.dir="rtl"),_.createElement("div",kt({ref:fe,style:J(J({},h),{},{position:"relative"}),className:ie},rn,V),_.createElement(Yo,{onResize:ht},_.createElement(C,{className:"".concat(r,"-holder"),style:un,ref:q,onScroll:je,onMouseEnter:Yt},_.createElement(mx,{prefixCls:r,height:at,offsetX:_e,offsetY:ft,scrollWidth:E,onInnerResize:ae,ref:ce,innerProps:x,rtl:$,extra:_n},Zn))),P&&at>a&&_.createElement(rC,{ref:Vt,prefixCls:r,scrollOffset:Ce,scrollRange:at,rtl:$,onScroll:Oe,onStartMove:Be,onStopMove:nt,spinSize:Mn,containerSize:xt.height,style:F==null?void 0:F.verticalScrollBar,thumbStyle:F==null?void 0:F.verticalScrollBarThumb,showScrollBar:D}),P&&E>xt.width&&_.createElement(rC,{ref:qt,prefixCls:r,scrollOffset:_e,scrollRange:E,rtl:$,onScroll:Oe,onStartMove:Be,onStopMove:nt,spinSize:wn,containerSize:xt.width,horizontal:!0,style:F==null?void 0:F.horizontalScrollBar,thumbStyle:F==null?void 0:F.horizontalScrollBarThumb,showScrollBar:D}))}var _x=_.forwardRef(KU);_x.displayName="List";function ZU(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var QU=["disabled","title","children","style","className"];function sC(t){return typeof t=="string"||typeof t=="number"}var GU=function(e,n){var r=UB(),i=r.prefixCls,a=r.id,l=r.open,u=r.multiple,f=r.mode,h=r.searchValue,g=r.toggleOpen,m=r.notFoundContent,v=r.onPopupScroll,S=_.useContext(Jy),w=S.maxCount,E=S.flattenOptions,b=S.onActiveValue,C=S.defaultActiveFirstOption,T=S.onSelect,A=S.menuItemSelectedIcon,O=S.rawValues,x=S.fieldNames,N=S.virtual,F=S.direction,L=S.listHeight,D=S.listItemHeight,V=S.optionRender,B="".concat(i,"-item"),W=Kg(function(){return E},[l,E],function(ve,ge){return ge[0]&&ve[1]!==ge[1]}),X=_.useRef(null),Y=_.useMemo(function(){return u&&T_(w)&&(O==null?void 0:O.size)>=w},[u,w,O==null?void 0:O.size]),ae=function(ge){ge.preventDefault()},U=function(ge){var _e;(_e=X.current)===null||_e===void 0||_e.scrollTo(typeof ge=="number"?{index:ge}:ge)},z=_.useCallback(function(ve){return f==="combobox"?!1:O.has(ve)},[f,ze(O).toString(),O.size]),j=function(ge){for(var _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ie=W.length,we=0;we1&&arguments[1]!==void 0?arguments[1]:!1;ie(ge);var Ie={source:_e?"keyboard":"mouse"},we=W[ge];if(!we){b(null,-1,Ie);return}b(we.value,ge,Ie)};_.useEffect(function(){se(C!==!1?j(0):-1)},[W.length,h]);var q=_.useCallback(function(ve){return f==="combobox"?String(ve).toLowerCase()===h.toLowerCase():O.has(ve)},[f,h,ze(O).toString(),O.size]);_.useEffect(function(){var ve=setTimeout(function(){if(!u&&l&&O.size===1){var _e=Array.from(O)[0],Ie=W.findIndex(function(we){var xe=we.data;return xe.value===_e});Ie!==-1&&(se(Ie),U(Ie))}});if(l){var ge;(ge=X.current)===null||ge===void 0||ge.scrollTo(void 0)}return function(){return clearTimeout(ve)}},[l,h]);var ce=function(ge){ge!==void 0&&T(ge,{selected:!O.has(ge)}),u||g(!1)};if(_.useImperativeHandle(n,function(){return{onKeyDown:function(ge){var _e=ge.which,Ie=ge.ctrlKey;switch(_e){case et.N:case et.P:case et.UP:case et.DOWN:{var we=0;if(_e===et.UP?we=-1:_e===et.DOWN?we=1:ZU()&&Ie&&(_e===et.N?we=1:_e===et.P&&(we=-1)),we!==0){var xe=j($+we,we);U(xe),se(xe,!0)}break}case et.TAB:case et.ENTER:{var Ve,Fe=W[$];Fe&&!(Fe!=null&&(Ve=Fe.data)!==null&&Ve!==void 0&&Ve.disabled)&&!Y?ce(Fe.value):ce(void 0),l&&ge.preventDefault();break}case et.ESC:g(!1),l&&ge.stopPropagation()}},onKeyUp:function(){},scrollTo:function(ge){U(ge)}}}),W.length===0)return _.createElement("div",{role:"listbox",id:"".concat(a,"_list"),className:"".concat(B,"-empty"),onMouseDown:ae},m);var fe=Object.keys(x).map(function(ve){return x[ve]}),ye=function(ge){return ge.label};function Ee(ve,ge){var _e=ve.group;return{role:_e?"presentation":"option",id:"".concat(a,"_list_").concat(ge)}}var Ce=function(ge){var _e=W[ge];if(!_e)return null;var Ie=_e.data||{},we=Ie.value,xe=_e.group,Ve=Gh(Ie,!0),Fe=ye(_e);return _e?_.createElement("div",kt({"aria-label":typeof Fe=="string"&&!xe?Fe:null},Ve,{key:ge},Ee(_e,ge),{"aria-selected":q(we)}),we):null},Te={role:"listbox",id:"".concat(a,"_list")};return _.createElement(_.Fragment,null,N&&_.createElement("div",kt({},Te,{style:{height:0,width:0,overflow:"hidden"}}),Ce($-1),Ce($),Ce($+1)),_.createElement(_x,{itemKey:"key",ref:X,data:W,height:L,itemHeight:D,fullHeight:!1,onMouseDown:ae,onScroll:v,virtual:N,direction:F,innerProps:N?null:Te},function(ve,ge){var _e=ve.group,Ie=ve.groupOption,we=ve.data,xe=ve.label,Ve=ve.value,Fe=we.key;if(_e){var Be,nt=(Be=we.title)!==null&&Be!==void 0?Be:sC(xe)?xe.toString():void 0;return _.createElement("div",{className:Ze(B,"".concat(B,"-group"),we.className),title:nt},xe!==void 0?xe:Fe)}var He=we.disabled,Ge=we.title;we.children;var Pe=we.style,Me=we.className,dt=Fn(we,QU),rt=V3(dt,fe),it=z(Ve),st=He||!it&&Y,at="".concat(B,"-option"),Je=Ze(B,at,Me,K(K(K(K({},"".concat(at,"-grouped"),Ie),"".concat(at,"-active"),$===ge&&!st),"".concat(at,"-disabled"),st),"".concat(at,"-selected"),it)),lt=ye(ve),ft=!A||typeof A=="function"||it,ct=typeof lt=="number"?lt:lt||Ve,mt=sC(ct)?ct.toString():void 0;return Ge!==void 0&&(mt=Ge),_.createElement("div",kt({},Gh(rt),N?{}:Ee(ve,ge),{"aria-selected":q(Ve),className:Je,title:mt,onMouseMove:function(){$===ge||st||se(ge)},onClick:function(){st||ce(Ve)},style:Pe}),_.createElement("div",{className:"".concat(at,"-content")},typeof V=="function"?V(ve,{index:ge}):ct),_.isValidElement(A)||it,ft&&_.createElement(ip,{className:"".concat(B,"-option-state"),customizeIcon:A,customizeIconProps:{value:Ve,disabled:st,isSelected:it}},it?"✓":null))}))},JU=_.forwardRef(GU);const eL=function(t,e){var n=_.useRef({values:new Map,options:new Map}),r=_.useMemo(function(){var a=n.current,l=a.values,u=a.options,f=t.map(function(m){if(m.label===void 0){var v;return J(J({},m),{},{label:(v=l.get(m.value))===null||v===void 0?void 0:v.label})}return m}),h=new Map,g=new Map;return f.forEach(function(m){h.set(m.value,m),g.set(m.value,e.get(m.value)||u.get(m.value))}),n.current.values=h,n.current.options=g,f},[t,e]),i=_.useCallback(function(a){return e.get(a)||n.current.options.get(a)},[e]);return[r,i]};function kv(t,e){return dx(t).join("").toUpperCase().includes(e)}const tL=function(t,e,n,r,i){return _.useMemo(function(){if(!n||r===!1)return t;var a=e.options,l=e.label,u=e.value,f=[],h=typeof r=="function",g=n.toUpperCase(),m=h?r:function(S,w){return i?kv(w[i],g):w[a]?kv(w[l!=="children"?l:"label"],g):kv(w[u],g)},v=h?function(S){return C_(S)}:function(S){return S};return t.forEach(function(S){if(S[a]){var w=m(n,v(S));if(w)f.push(S);else{var E=S[a].filter(function(b){return m(n,v(b))});E.length&&f.push(J(J({},S),{},K({},a,E)))}return}m(n,v(S))&&f.push(S)}),f},[t,r,i,n,e])};var aC=0,nL=Zr();function rL(){var t;return nL?(t=aC,aC+=1):t="TEST_OR_SSR",t}function iL(t){var e=_.useState(),n=de(e,2),r=n[0],i=n[1];return _.useEffect(function(){i("rc_select_".concat(rL()))},[]),t||r}var sL=["children","value"],aL=["children"];function oL(t){var e=t,n=e.key,r=e.props,i=r.children,a=r.value,l=Fn(r,sL);return J({key:n,value:a!==void 0?a:n,children:i},l)}function yx(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Lo(t).map(function(n,r){if(!_.isValidElement(n)||!n.type)return null;var i=n,a=i.type.isSelectOptGroup,l=i.key,u=i.props,f=u.children,h=Fn(u,aL);return e||!a?oL(n):J(J({key:"__RC_SELECT_GRP__".concat(l===null?r:l,"__"),label:l},h),{},{options:yx(f)})}).filter(function(n){return n})}var lL=function(e,n,r,i,a){return _.useMemo(function(){var l=e,u=!e;u&&(l=yx(n));var f=new Map,h=new Map,g=function(S,w,E){E&&typeof E=="string"&&S.set(w[E],w)},m=function v(S){for(var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,E=0;E0?Ue(Ye.options):Ye.options}):Ye})},ct=_.useMemo(function(){return T?ft(lt):lt},[lt,T,Te]),mt=_.useMemo(function(){return RU(ct,{fieldNames:ye,childrenAsData:ce})},[ct,ye,ce]),xt=function(Oe){var je=xe(Oe);if(nt(je),P&&(je.length!==Me.length||je.some(function(Qe,bt){var _t;return((_t=Me[bt])===null||_t===void 0?void 0:_t.value)!==(Qe==null?void 0:Qe.value)}))){var Ye=Z?je:je.map(function(Qe){return Qe.value}),We=je.map(function(Qe){return C_(dt(Qe.value))});P(q?Ye:Ye[0],q?We:We[0])}},Bt=_.useState(null),ht=de(Bt,2),Vt=ht[0],qt=ht[1],wn=_.useState(0),Mn=de(wn,2),Ut=Mn[0],It=Mn[1],Lt=L!==void 0?L:r!=="combobox",Jt=_.useCallback(function(Ue,Oe){var je=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Ye=je.source,We=Ye===void 0?"keyboard":Ye;It(Oe),l&&r==="combobox"&&Ue!==null&&We==="keyboard"&&qt(String(Ue))},[l,r]),Mt=function(Oe,je,Ye){var We=function(){var un,rn=dt(Oe);return[Z?{label:rn==null?void 0:rn[ye.label],value:Oe,key:(un=rn==null?void 0:rn.key)!==null&&un!==void 0?un:Oe}:Oe,C_(rn)]};if(je&&S){var Qe=We(),bt=de(Qe,2),_t=bt[0],Zt=bt[1];S(_t,Zt)}else if(!je&&w&&Ye!=="clear"){var Yt=We(),vn=de(Yt,2),On=vn[0],_n=vn[1];w(On,_n)}},qe=oC(function(Ue,Oe){var je,Ye=q?Oe.selected:!0;Ye?je=q?[].concat(ze(Me),[Ue]):[Ue]:je=Me.filter(function(We){return We.value!==Ue}),xt(je),Mt(Ue,Ye),r==="combobox"?qt(""):(!A_||v)&&(ve(""),qt(""))}),ke=function(Oe,je){xt(Oe);var Ye=je.type,We=je.values;(Ye==="remove"||Ye==="clear")&&We.forEach(function(Qe){Mt(Qe.value,!1,Ye)})},Ne=function(Oe,je){if(ve(Oe),qt(null),je.source==="submit"){var Ye=(Oe||"").trim();if(Ye){var We=Array.from(new Set([].concat(ze(it),[Ye])));xt(We),Mt(Ye,!0),ve("")}return}je.source!=="blur"&&(r==="combobox"&&xt(Oe),g==null||g(Oe))},Et=function(Oe){var je=Oe;r!=="tags"&&(je=Oe.map(function(We){var Qe=Ie.get(We);return Qe==null?void 0:Qe.value}).filter(function(We){return We!==void 0}));var Ye=Array.from(new Set([].concat(ze(it),ze(je))));xt(Ye),Ye.forEach(function(We){Mt(We,!0)})},en=_.useMemo(function(){var Ue=V!==!1&&b!==!1;return J(J({},ge),{},{flattenOptions:mt,onActiveValue:Jt,defaultActiveFirstOption:Lt,onSelect:qe,menuItemSelectedIcon:D,rawValues:it,fieldNames:ye,virtual:Ue,direction:B,listHeight:X,listItemHeight:ae,childrenAsData:ce,maxCount:$,optionRender:N})},[$,ge,mt,Jt,Lt,qe,D,it,ye,V,b,B,X,ae,ce,N]);return _.createElement(Jy.Provider,{value:en},_.createElement(NU,kt({},ie,{id:se,prefixCls:a,ref:e,omitDomProps:uL,mode:r,displayValues:rt,onDisplayValuesChange:ke,direction:B,searchValue:Te,onSearch:Ne,autoClearSearchValue:v,onSearchSplit:Et,dropdownMatchSelectWidth:b,OptionList:JU,emptyOptions:!mt.length,activeValue:Vt,activeDescendantId:"".concat(se,"_list_").concat(Ut)})))}),nb=dL;nb.Option=tb;nb.OptGroup=eb;function hL(t,e,n){return Ze({[`${t}-status-success`]:e==="success",[`${t}-status-warning`]:e==="warning",[`${t}-status-error`]:e==="error",[`${t}-status-validating`]:e==="validating",[`${t}-has-feedback`]:n})}const gL=(t,e)=>e||t,pL=()=>{const[,t]=Ws(),[e]=Xy("Empty"),r=new En(t.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return _.createElement("svg",{style:r,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},_.createElement("title",null,(e==null?void 0:e.description)||"Empty"),_.createElement("g",{fill:"none",fillRule:"evenodd"},_.createElement("g",{transform:"translate(24 31.67)"},_.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),_.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),_.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),_.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),_.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),_.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),_.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},_.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),_.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},mL=()=>{const[,t]=Ws(),[e]=Xy("Empty"),{colorFill:n,colorFillTertiary:r,colorFillQuaternary:i,colorBgContainer:a}=t,{borderColor:l,shadowColor:u,contentColor:f}=_.useMemo(()=>({borderColor:new En(n).onBackground(a).toHexString(),shadowColor:new En(r).onBackground(a).toHexString(),contentColor:new En(i).onBackground(a).toHexString()}),[n,r,i,a]);return _.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},_.createElement("title",null,(e==null?void 0:e.description)||"Empty"),_.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},_.createElement("ellipse",{fill:u,cx:"32",cy:"33",rx:"32",ry:"7"}),_.createElement("g",{fillRule:"nonzero",stroke:l},_.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),_.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:f}))))},vL=t=>{const{componentCls:e,margin:n,marginXS:r,marginXL:i,fontSize:a,lineHeight:l}=t;return{[e]:{marginInline:r,fontSize:a,lineHeight:l,textAlign:"center",[`${e}-image`]:{height:t.emptyImgHeight,marginBottom:r,opacity:t.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},[`${e}-description`]:{color:t.colorTextDescription},[`${e}-footer`]:{marginTop:n},"&-normal":{marginBlock:i,color:t.colorTextDescription,[`${e}-description`]:{color:t.colorTextDescription},[`${e}-image`]:{height:t.emptyImgHeightMD}},"&-small":{marginBlock:r,color:t.colorTextDescription,[`${e}-image`]:{height:t.emptyImgHeightSM}}}}},_L=zc("Empty",t=>{const{componentCls:e,controlHeightLG:n,calc:r}=t,i=ui(t,{emptyImgCls:`${e}-img`,emptyImgHeight:r(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:r(n).mul(.875).equal()});return[vL(i)]});var yL=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i{const{className:e,rootClassName:n,prefixCls:r,image:i=bx,description:a,children:l,imageStyle:u,style:f,classNames:h,styles:g}=t,m=yL(t,["className","rootClassName","prefixCls","image","description","children","imageStyle","style","classNames","styles"]),{getPrefixCls:v,direction:S,className:w,style:E,classNames:b,styles:C}=Uc("empty"),T=v("empty",r),[A,O,x]=_L(T),[N]=Xy("Empty"),F=typeof a<"u"?a:N==null?void 0:N.description,L=typeof F=="string"?F:"empty";let D=null;return typeof i=="string"?D=_.createElement("img",{alt:L,src:i}):D=i,A(_.createElement("div",Object.assign({className:Ze(O,x,T,w,{[`${T}-normal`]:i===Sx,[`${T}-rtl`]:S==="rtl"},e,n,b.root,h==null?void 0:h.root),style:Object.assign(Object.assign(Object.assign(Object.assign({},C.root),E),g==null?void 0:g.root),f)},m),_.createElement("div",{className:Ze(`${T}-image`,b.image,h==null?void 0:h.image),style:Object.assign(Object.assign(Object.assign({},u),C.image),g==null?void 0:g.image)},D),F&&_.createElement("div",{className:Ze(`${T}-description`,b.description,h==null?void 0:h.description),style:Object.assign(Object.assign({},C.description),g==null?void 0:g.description)},F),l&&_.createElement("div",{className:Ze(`${T}-footer`,b.footer,h==null?void 0:h.footer),style:Object.assign(Object.assign({},C.footer),g==null?void 0:g.footer)},l)))};mo.PRESENTED_IMAGE_DEFAULT=bx;mo.PRESENTED_IMAGE_SIMPLE=Sx;const bL=t=>{const{componentName:e}=t,{getPrefixCls:n}=_.useContext(ci),r=n("empty");switch(e){case"Table":case"List":return Ft.createElement(mo,{image:mo.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return Ft.createElement(mo,{image:mo.PRESENTED_IMAGE_SIMPLE,className:`${r}-small`});case"Table.filter":return null;default:return Ft.createElement(mo,null)}},SL=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;var r,i;const{variant:a,[t]:l}=_.useContext(ci),u=_.useContext(IB),f=l==null?void 0:l.variant;let h;typeof e<"u"?h=e:n===!1?h="borderless":h=(i=(r=u??f)!==null&&r!==void 0?r:a)!==null&&i!==void 0?i:"outlined";const g=lF.includes(h);return[h,g]},EL=t=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:t==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function wL(t,e){return t||EL(e)}const lC=t=>{const{optionHeight:e,optionFontSize:n,optionLineHeight:r,optionPadding:i}=t;return{position:"relative",display:"block",minHeight:e,padding:i,color:t.colorText,fontWeight:"normal",fontSize:n,lineHeight:r,boxSizing:"border-box"}},TL=t=>{const{antCls:e,componentCls:n}=t,r=`${n}-item`,i=`&${e}-slide-up-enter${e}-slide-up-enter-active`,a=`&${e}-slide-up-appear${e}-slide-up-appear-active`,l=`&${e}-slide-up-leave${e}-slide-up-leave-active`,u=`${n}-dropdown-placement-`,f=`${r}-option-selected`;return[{[`${n}-dropdown`]:Object.assign(Object.assign({},Lc(t)),{position:"absolute",top:-9999,zIndex:t.zIndexPopup,boxSizing:"border-box",padding:t.paddingXXS,overflow:"hidden",fontSize:t.fontSize,fontVariant:"initial",backgroundColor:t.colorBgElevated,borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,[` + ${i}${u}bottomLeft, + ${a}${u}bottomLeft + `]:{animationName:X3},[` + ${i}${u}topLeft, + ${a}${u}topLeft, + ${i}${u}topRight, + ${a}${u}topRight + `]:{animationName:Y3},[`${l}${u}bottomLeft`]:{animationName:q3},[` + ${l}${u}topLeft, + ${l}${u}topRight + `]:{animationName:K3},"&-hidden":{display:"none"},[r]:Object.assign(Object.assign({},lC(t)),{cursor:"pointer",transition:`background ${t.motionDurationSlow} ease`,borderRadius:t.borderRadiusSM,"&-group":{color:t.colorTextDescription,fontSize:t.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},a_),"&-state":{flex:"none",display:"flex",alignItems:"center"},[`&-active:not(${r}-option-disabled)`]:{backgroundColor:t.optionActiveBg},[`&-selected:not(${r}-option-disabled)`]:{color:t.optionSelectedColor,fontWeight:t.optionSelectedFontWeight,backgroundColor:t.optionSelectedBg,[`${r}-option-state`]:{color:t.colorPrimary}},"&-disabled":{[`&${r}-option-selected`]:{backgroundColor:t.colorBgContainerDisabled},color:t.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:t.calc(t.controlPaddingHorizontal).mul(2).equal()}},"&-empty":Object.assign(Object.assign({},lC(t)),{color:t.colorTextDisabled})}),[`${f}:has(+ ${f})`]:{borderEndStartRadius:0,borderEndEndRadius:0,[`& + ${f}`]:{borderStartStartRadius:0,borderStartEndRadius:0}},"&-rtl":{direction:"rtl"}})},CT(t,"slide-up"),CT(t,"slide-down"),TT(t,"move-up"),TT(t,"move-down")]},CL=t=>{const{multipleSelectItemHeight:e,paddingXXS:n,lineWidth:r,INTERNAL_FIXED_ITEM_MARGIN:i}=t,a=t.max(t.calc(n).sub(r).equal(),0),l=t.max(t.calc(a).sub(i).equal(),0);return{basePadding:a,containerPadding:l,itemHeight:Rt(e),itemLineHeight:Rt(t.calc(e).sub(t.calc(t.lineWidth).mul(2)).equal())}},AL=t=>{const{multipleSelectItemHeight:e,selectHeight:n,lineWidth:r}=t;return t.calc(n).sub(e).div(2).sub(r).equal()},RL=t=>{const{componentCls:e,iconCls:n,borderRadiusSM:r,motionDurationSlow:i,paddingXS:a,multipleItemColorDisabled:l,multipleItemBorderColorDisabled:u,colorIcon:f,colorIconHover:h,INTERNAL_FIXED_ITEM_MARGIN:g}=t;return{[`${e}-selection-overflow`]:{position:"relative",display:"flex",flex:"auto",flexWrap:"wrap",maxWidth:"100%","&-item":{flex:"none",alignSelf:"center",maxWidth:"100%",display:"inline-flex"},[`${e}-selection-item`]:{display:"flex",alignSelf:"center",flex:"none",boxSizing:"border-box",maxWidth:"100%",marginBlock:g,borderRadius:r,cursor:"default",transition:`font-size ${i}, line-height ${i}, height ${i}`,marginInlineEnd:t.calc(g).mul(2).equal(),paddingInlineStart:a,paddingInlineEnd:t.calc(a).div(2).equal(),[`${e}-disabled&`]:{color:l,borderColor:u,cursor:"not-allowed"},"&-content":{display:"inline-block",marginInlineEnd:t.calc(a).div(2).equal(),overflow:"hidden",whiteSpace:"pre",textOverflow:"ellipsis"},"&-remove":Object.assign(Object.assign({},Yy()),{display:"inline-flex",alignItems:"center",color:f,fontWeight:"bold",fontSize:10,lineHeight:"inherit",cursor:"pointer",[`> ${n}`]:{verticalAlign:"-0.2em"},"&:hover":{color:h}})}}}},xL=(t,e)=>{const{componentCls:n,INTERNAL_FIXED_ITEM_MARGIN:r}=t,i=`${n}-selection-overflow`,a=t.multipleSelectItemHeight,l=AL(t),u=e?`${n}-${e}`:"",f=CL(t);return{[`${n}-multiple${u}`]:Object.assign(Object.assign({},RL(t)),{[`${n}-selector`]:{display:"flex",alignItems:"center",width:"100%",height:"100%",paddingInline:f.basePadding,paddingBlock:f.containerPadding,borderRadius:t.borderRadius,[`${n}-disabled&`]:{background:t.multipleSelectorBgDisabled,cursor:"not-allowed"},"&:after":{display:"inline-block",width:0,margin:`${Rt(r)} 0`,lineHeight:Rt(a),visibility:"hidden",content:'"\\a0"'}},[`${n}-selection-item`]:{height:f.itemHeight,lineHeight:Rt(f.itemLineHeight)},[`${n}-selection-wrap`]:{alignSelf:"flex-start","&:after":{lineHeight:Rt(a),marginBlock:r}},[`${n}-prefix`]:{marginInlineStart:t.calc(t.inputPaddingHorizontalBase).sub(f.basePadding).equal()},[`${i}-item + ${i}-item, + ${n}-prefix + ${n}-selection-wrap + `]:{[`${n}-selection-search`]:{marginInlineStart:0},[`${n}-selection-placeholder`]:{insetInlineStart:0}},[`${i}-item-suffix`]:{minHeight:f.itemHeight,marginBlock:r},[`${n}-selection-search`]:{display:"inline-flex",position:"relative",maxWidth:"100%",marginInlineStart:t.calc(t.inputPaddingHorizontalBase).sub(l).equal(),"\n &-input,\n &-mirror\n ":{height:a,fontFamily:t.fontFamily,lineHeight:Rt(a),transition:`all ${t.motionDurationSlow}`},"&-input":{width:"100%",minWidth:4.1},"&-mirror":{position:"absolute",top:0,insetInlineStart:0,insetInlineEnd:"auto",zIndex:999,whiteSpace:"pre",visibility:"hidden"}},[`${n}-selection-placeholder`]:{position:"absolute",top:"50%",insetInlineStart:t.calc(t.inputPaddingHorizontalBase).sub(f.basePadding).equal(),insetInlineEnd:t.inputPaddingHorizontalBase,transform:"translateY(-50%)",transition:`all ${t.motionDurationSlow}`}})}};function Bv(t,e){const{componentCls:n}=t,r=e?`${n}-${e}`:"",i={[`${n}-multiple${r}`]:{fontSize:t.fontSize,[`${n}-selector`]:{[`${n}-show-search&`]:{cursor:"text"}},[` + &${n}-show-arrow ${n}-selector, + &${n}-allow-clear ${n}-selector + `]:{paddingInlineEnd:t.calc(t.fontSizeIcon).add(t.controlPaddingHorizontal).equal()}}};return[xL(t,e),i]}const ML=t=>{const{componentCls:e}=t,n=ui(t,{selectHeight:t.controlHeightSM,multipleSelectItemHeight:t.multipleItemHeightSM,borderRadius:t.borderRadiusSM,borderRadiusSM:t.borderRadiusXS}),r=ui(t,{fontSize:t.fontSizeLG,selectHeight:t.controlHeightLG,multipleSelectItemHeight:t.multipleItemHeightLG,borderRadius:t.borderRadiusLG,borderRadiusSM:t.borderRadius});return[Bv(t),Bv(n,"sm"),{[`${e}-multiple${e}-sm`]:{[`${e}-selection-placeholder`]:{insetInline:t.calc(t.controlPaddingHorizontalSM).sub(t.lineWidth).equal()},[`${e}-selection-search`]:{marginInlineStart:2}}},Bv(r,"lg")]};function Uv(t,e){const{componentCls:n,inputPaddingHorizontalBase:r,borderRadius:i}=t,a=t.calc(t.controlHeight).sub(t.calc(t.lineWidth).mul(2)).equal(),l=e?`${n}-${e}`:"";return{[`${n}-single${l}`]:{fontSize:t.fontSize,height:t.controlHeight,[`${n}-selector`]:Object.assign(Object.assign({},Lc(t,!0)),{display:"flex",borderRadius:i,flex:"1 1 auto",[`${n}-selection-search`]:{position:"absolute",inset:0,width:"100%","&-input":{width:"100%",WebkitAppearance:"textfield"}},[` + ${n}-selection-item, + ${n}-selection-placeholder + `]:{display:"block",padding:0,lineHeight:Rt(a),transition:`all ${t.motionDurationSlow}, visibility 0s`,alignSelf:"center"},[`${n}-selection-placeholder`]:{transition:"none",pointerEvents:"none"},[["&:after",`${n}-selection-item:empty:after`,`${n}-selection-placeholder:empty:after`].join(",")]:{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'}}),[` + &${n}-show-arrow ${n}-selection-item, + &${n}-show-arrow ${n}-selection-search, + &${n}-show-arrow ${n}-selection-placeholder + `]:{paddingInlineEnd:t.showArrowPaddingInlineEnd},[`&${n}-open ${n}-selection-item`]:{color:t.colorTextPlaceholder},[`&:not(${n}-customize-input)`]:{[`${n}-selector`]:{width:"100%",height:"100%",alignItems:"center",padding:`0 ${Rt(r)}`,[`${n}-selection-search-input`]:{height:a},"&:after":{lineHeight:Rt(a)}}},[`&${n}-customize-input`]:{[`${n}-selector`]:{"&:after":{display:"none"},[`${n}-selection-search`]:{position:"static",width:"100%"},[`${n}-selection-placeholder`]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:`0 ${Rt(r)}`,"&:after":{display:"none"}}}}}}}function OL(t){const{componentCls:e}=t,n=t.calc(t.controlPaddingHorizontalSM).sub(t.lineWidth).equal();return[Uv(t),Uv(ui(t,{controlHeight:t.controlHeightSM,borderRadius:t.borderRadiusSM}),"sm"),{[`${e}-single${e}-sm`]:{[`&:not(${e}-customize-input)`]:{[`${e}-selector`]:{padding:`0 ${Rt(n)}`},[`&${e}-show-arrow ${e}-selection-search`]:{insetInlineEnd:t.calc(n).add(t.calc(t.fontSize).mul(1.5)).equal()},[` + &${e}-show-arrow ${e}-selection-item, + &${e}-show-arrow ${e}-selection-placeholder + `]:{paddingInlineEnd:t.calc(t.fontSize).mul(1.5).equal()}}}},Uv(ui(t,{controlHeight:t.singleItemHeightLG,fontSize:t.fontSizeLG,borderRadius:t.borderRadiusLG}),"lg")]}const PL=t=>{const{fontSize:e,lineHeight:n,lineWidth:r,controlHeight:i,controlHeightSM:a,controlHeightLG:l,paddingXXS:u,controlPaddingHorizontal:f,zIndexPopupBase:h,colorText:g,fontWeightStrong:m,controlItemBgActive:v,controlItemBgHover:S,colorBgContainer:w,colorFillSecondary:E,colorBgContainerDisabled:b,colorTextDisabled:C,colorPrimaryHover:T,colorPrimary:A,controlOutline:O}=t,x=u*2,N=r*2,F=Math.min(i-x,i-N),L=Math.min(a-x,a-N),D=Math.min(l-x,l-N);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(u/2),zIndexPopup:h+50,optionSelectedColor:g,optionSelectedFontWeight:m,optionSelectedBg:v,optionActiveBg:S,optionPadding:`${(i-e*n)/2}px ${f}px`,optionFontSize:e,optionLineHeight:n,optionHeight:i,selectorBg:w,clearBg:w,singleItemHeightLG:l,multipleItemBg:E,multipleItemBorderColor:"transparent",multipleItemHeight:F,multipleItemHeightSM:L,multipleItemHeightLG:D,multipleSelectorBgDisabled:b,multipleItemColorDisabled:C,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(t.fontSize*1.25),hoverBorderColor:T,activeBorderColor:A,activeOutlineColor:O,selectAffixPadding:u}},Ex=(t,e)=>{const{componentCls:n,antCls:r,controlOutlineWidth:i}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{border:`${Rt(t.lineWidth)} ${t.lineType} ${e.borderColor}`,background:t.selectorBg},[`&:not(${n}-disabled):not(${n}-customize-input):not(${r}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:e.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:e.activeBorderColor,boxShadow:`0 0 0 ${Rt(i)} ${e.activeOutlineColor}`,outline:0},[`${n}-prefix`]:{color:e.color}}}},cC=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},Ex(t,e))}),NL=t=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},Ex(t,{borderColor:t.colorBorder,hoverBorderHover:t.hoverBorderColor,activeBorderColor:t.activeBorderColor,activeOutlineColor:t.activeOutlineColor,color:t.colorText})),cC(t,{status:"error",borderColor:t.colorError,hoverBorderHover:t.colorErrorHover,activeBorderColor:t.colorError,activeOutlineColor:t.colorErrorOutline,color:t.colorError})),cC(t,{status:"warning",borderColor:t.colorWarning,hoverBorderHover:t.colorWarningHover,activeBorderColor:t.colorWarning,activeOutlineColor:t.colorWarningOutline,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${Rt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}})}),wx=(t,e)=>{const{componentCls:n,antCls:r}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{background:e.bg,border:`${Rt(t.lineWidth)} ${t.lineType} transparent`,color:e.color},[`&:not(${n}-disabled):not(${n}-customize-input):not(${r}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{background:e.hoverBg},[`${n}-focused& ${n}-selector`]:{background:t.selectorBg,borderColor:e.activeBorderColor,outline:0}}}},uC=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},wx(t,e))}),IL=t=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},wx(t,{bg:t.colorFillTertiary,hoverBg:t.colorFillSecondary,activeBorderColor:t.activeBorderColor,color:t.colorText})),uC(t,{status:"error",bg:t.colorErrorBg,hoverBg:t.colorErrorBgHover,activeBorderColor:t.colorError,color:t.colorError})),uC(t,{status:"warning",bg:t.colorWarningBg,hoverBg:t.colorWarningBgHover,activeBorderColor:t.colorWarning,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{borderColor:t.colorBorder,background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.colorBgContainer,border:`${Rt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`}})}),DL=t=>({"&-borderless":{[`${t.componentCls}-selector`]:{background:"transparent",border:`${Rt(t.lineWidth)} ${t.lineType} transparent`},[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${Rt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`},[`&${t.componentCls}-status-error`]:{[`${t.componentCls}-prefix, ${t.componentCls}-selection-item`]:{color:t.colorError}},[`&${t.componentCls}-status-warning`]:{[`${t.componentCls}-prefix, ${t.componentCls}-selection-item`]:{color:t.colorWarning}}}}),Tx=(t,e)=>{const{componentCls:n,antCls:r}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{borderWidth:`0 0 ${Rt(t.lineWidth)} 0`,borderStyle:`none none ${t.lineType} none`,borderColor:e.borderColor,background:t.selectorBg,borderRadius:0},[`&:not(${n}-disabled):not(${n}-customize-input):not(${r}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:e.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:e.activeBorderColor,outline:0},[`${n}-prefix`]:{color:e.color}}}},fC=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},Tx(t,e))}),FL=t=>({"&-underlined":Object.assign(Object.assign(Object.assign(Object.assign({},Tx(t,{borderColor:t.colorBorder,hoverBorderHover:t.hoverBorderColor,activeBorderColor:t.activeBorderColor,activeOutlineColor:t.activeOutlineColor,color:t.colorText})),fC(t,{status:"error",borderColor:t.colorError,hoverBorderHover:t.colorErrorHover,activeBorderColor:t.colorError,activeOutlineColor:t.colorErrorOutline,color:t.colorError})),fC(t,{status:"warning",borderColor:t.colorWarning,hoverBorderHover:t.colorWarningHover,activeBorderColor:t.colorWarning,activeOutlineColor:t.colorWarningOutline,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${Rt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}})}),kL=t=>({[t.componentCls]:Object.assign(Object.assign(Object.assign(Object.assign({},NL(t)),IL(t)),DL(t)),FL(t))}),BL=t=>{const{componentCls:e}=t;return{position:"relative",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,input:{cursor:"pointer"},[`${e}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},[`${e}-disabled&`]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},UL=t=>{const{componentCls:e}=t;return{[`${e}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},LL=t=>{const{antCls:e,componentCls:n,inputPaddingHorizontalBase:r,iconCls:i}=t;return{[n]:Object.assign(Object.assign({},Lc(t)),{position:"relative",display:"inline-flex",cursor:"pointer",[`&:not(${n}-customize-input) ${n}-selector`]:Object.assign(Object.assign({},BL(t)),UL(t)),[`${n}-selection-item`]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},a_),{[`> ${e}-typography`]:{display:"inline"}}),[`${n}-selection-placeholder`]:Object.assign(Object.assign({},a_),{flex:1,color:t.colorTextPlaceholder,pointerEvents:"none"}),[`${n}-arrow`]:Object.assign(Object.assign({},Yy()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:`opacity ${t.motionDurationSlow} ease`,[i]:{verticalAlign:"top",transition:`transform ${t.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${n}-suffix)`]:{pointerEvents:"auto"}},[`${n}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${n}-selection-wrap`]:{display:"flex",width:"100%",position:"relative",minWidth:0,"&:after":{content:'"\\a0"',width:0,overflow:"hidden"}},[`${n}-prefix`]:{flex:"none",marginInlineEnd:t.selectAffixPadding},[`${n}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:r,zIndex:1,display:"inline-block",width:t.fontSizeIcon,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:`color ${t.motionDurationMid} ease, opacity ${t.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:t.colorTextTertiary}},[`&:hover ${n}-clear`]:{opacity:1,background:t.colorBgBase,borderRadius:"50%"}}),[`${n}-status`]:{"&-error, &-warning, &-success, &-validating":{[`&${n}-has-feedback`]:{[`${n}-clear`]:{insetInlineEnd:t.calc(r).add(t.fontSize).add(t.paddingXS).equal()}}}}}},zL=t=>{const{componentCls:e}=t;return[{[e]:{[`&${e}-in-form-item`]:{width:"100%"}}},LL(t),OL(t),ML(t),TL(t),{[`${e}-rtl`]:{direction:"rtl"}},x8(t,{borderElCls:`${e}-selector`,focusElCls:`${e}-focused`})]},$L=zc("Select",(t,e)=>{let{rootPrefixCls:n}=e;const r=ui(t,{rootPrefixCls:n,inputPaddingHorizontalBase:t.calc(t.paddingSM).sub(1).equal(),multipleSelectItemHeight:t.multipleItemHeight,selectHeight:t.controlHeight});return[zL(r),kL(r)]},PL,{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});var VL={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},HL=function(e,n){return _.createElement(Xs,kt({},e,{ref:n,icon:VL}))},jL=_.forwardRef(HL),WL={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},XL=function(e,n){return _.createElement(Xs,kt({},e,{ref:n,icon:WL}))},qL=_.forwardRef(XL),YL={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},KL=function(e,n){return _.createElement(Xs,kt({},e,{ref:n,icon:YL}))},ZL=_.forwardRef(KL);function QL(t){let{suffixIcon:e,clearIcon:n,menuItemSelectedIcon:r,removeIcon:i,loading:a,multiple:l,hasFeedback:u,prefixCls:f,showSuffixIcon:h,feedbackIcon:g,showArrow:m,componentName:v}=t;const S=n??_.createElement(Rk,null),w=T=>e===null&&!u&&!m?null:_.createElement(_.Fragment,null,h!==!1&&T,u&&g);let E=null;if(e!==void 0)E=w(e);else if(a)E=w(_.createElement($k,{spin:!0}));else{const T=`${f}-suffix`;E=A=>{let{open:O,showSearch:x}=A;return w(O&&x?_.createElement(ZL,{className:T}):_.createElement(qL,{className:T}))}}let b=null;r!==void 0?b=r:l?b=_.createElement(jL,null):b=null;let C=null;return i!==void 0?C=i:C=_.createElement(Ok,null),{clearIcon:S,suffixIcon:E,itemIcon:b,removeIcon:C}}function GL(t,e){return e!==void 0?e:t!==null}var JL=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i{var n;const{prefixCls:r,bordered:i,className:a,rootClassName:l,getPopupContainer:u,popupClassName:f,dropdownClassName:h,listHeight:g=256,placement:m,listItemHeight:v,size:S,disabled:w,notFoundContent:E,status:b,builtinPlacements:C,dropdownMatchSelectWidth:T,popupMatchSelectWidth:A,direction:O,style:x,allowClear:N,variant:F,dropdownStyle:L,transitionName:D,tagRender:V,maxCount:B,prefix:W}=t,X=JL(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix"]),{getPopupContainer:Y,getPrefixCls:ae,renderEmpty:U,direction:z,virtual:j,popupMatchSelectWidth:Z,popupOverflow:P}=_.useContext(ci),$=Uc("select"),[,ie]=Ws(),se=v??(ie==null?void 0:ie.controlHeight),q=ae("select",r),ce=ae(),fe=O??z,{compactSize:ye,compactItemClassnames:Ee}=Yk(q,fe),[Ce,Te]=SL("select",F,i),ve=Uk(q),[ge,_e,Ie]=$L(q,ve),we=_.useMemo(()=>{const{mode:Vt}=t;if(Vt!=="combobox")return Vt===Cx?"combobox":Vt},[t.mode]),xe=we==="multiple"||we==="tags",Ve=GL(t.suffixIcon,t.showArrow),Fe=(n=A??T)!==null&&n!==void 0?n:Z,{status:Be,hasFeedback:nt,isFormItemInput:He,feedbackIcon:Ge}=_.useContext(E_),Pe=gL(Be,b);let Me;E!==void 0?Me=E:we==="combobox"?Me=null:Me=(U==null?void 0:U("Select"))||_.createElement(bL,{componentName:"Select"});const{suffixIcon:dt,itemIcon:rt,removeIcon:it,clearIcon:st}=QL(Object.assign(Object.assign({},X),{multiple:xe,hasFeedback:nt,feedbackIcon:Ge,showSuffixIcon:Ve,prefixCls:q,componentName:"Select"})),at=N===!0?{clearIcon:st}:N,Je=V3(X,["suffixIcon","itemIcon"]),lt=Ze(f||h,{[`${q}-dropdown-${fe}`]:fe==="rtl"},l,Ie,ve,_e),ft=H3(Vt=>{var qt;return(qt=S??ye)!==null&&qt!==void 0?qt:Vt}),ct=_.useContext(wf),mt=w??ct,xt=Ze({[`${q}-lg`]:ft==="large",[`${q}-sm`]:ft==="small",[`${q}-rtl`]:fe==="rtl",[`${q}-${Ce}`]:Te,[`${q}-in-form-item`]:He},hL(q,Pe,nt),Ee,$.className,a,l,Ie,ve,_e),Bt=_.useMemo(()=>m!==void 0?m:fe==="rtl"?"bottomRight":"bottomLeft",[m,fe]),[ht]=z3("SelectLike",L==null?void 0:L.zIndex);return ge(_.createElement(nb,Object.assign({ref:e,virtual:j,showSearch:$.showSearch},Je,{style:Object.assign(Object.assign({},$.style),x),dropdownMatchSelectWidth:Fe,transitionName:$3(ce,"slide-up",D),builtinPlacements:wL(C,P),listHeight:g,listItemHeight:se,mode:we,prefixCls:q,placement:Bt,direction:fe,prefix:W,suffixIcon:dt,menuItemSelectedIcon:rt,removeIcon:it,allowClear:at,notFoundContent:Me,className:xt,getPopupContainer:u||Y,dropdownClassName:lt,disabled:mt,dropdownStyle:Object.assign(Object.assign({},L),{zIndex:ht}),maxCount:xe?B:void 0,tagRender:xe?V:void 0})))},Hc=_.forwardRef(e7),t7=kB(Hc,"dropdownAlign");Hc.SECRET_COMBOBOX_MODE_DO_NOT_USE=Cx;Hc.Option=tb;Hc.OptGroup=eb;Hc._InternalPanelDoNotUseOrYouWillBeFired=t7;function Ax(t){var e=t.children,n=t.prefixCls,r=t.id,i=t.overlayInnerStyle,a=t.bodyClassName,l=t.className,u=t.style;return _.createElement("div",{className:Ze("".concat(n,"-content"),l),style:u},_.createElement("div",{className:Ze("".concat(n,"-inner"),a),id:r,role:"tooltip",style:i},typeof e=="function"?e():e))}var Ul={shiftX:64,adjustY:1},Ll={adjustX:1,shiftY:!0},Ai=[0,0],n7={left:{points:["cr","cl"],overflow:Ll,offset:[-4,0],targetOffset:Ai},right:{points:["cl","cr"],overflow:Ll,offset:[4,0],targetOffset:Ai},top:{points:["bc","tc"],overflow:Ul,offset:[0,-4],targetOffset:Ai},bottom:{points:["tc","bc"],overflow:Ul,offset:[0,4],targetOffset:Ai},topLeft:{points:["bl","tl"],overflow:Ul,offset:[0,-4],targetOffset:Ai},leftTop:{points:["tr","tl"],overflow:Ll,offset:[-4,0],targetOffset:Ai},topRight:{points:["br","tr"],overflow:Ul,offset:[0,-4],targetOffset:Ai},rightTop:{points:["tl","tr"],overflow:Ll,offset:[4,0],targetOffset:Ai},bottomRight:{points:["tr","br"],overflow:Ul,offset:[0,4],targetOffset:Ai},rightBottom:{points:["bl","br"],overflow:Ll,offset:[4,0],targetOffset:Ai},bottomLeft:{points:["tl","bl"],overflow:Ul,offset:[0,4],targetOffset:Ai},leftBottom:{points:["br","bl"],overflow:Ll,offset:[-4,0],targetOffset:Ai}},r7=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],i7=function(e,n){var r=e.overlayClassName,i=e.trigger,a=i===void 0?["hover"]:i,l=e.mouseEnterDelay,u=l===void 0?0:l,f=e.mouseLeaveDelay,h=f===void 0?.1:f,g=e.overlayStyle,m=e.prefixCls,v=m===void 0?"rc-tooltip":m,S=e.children,w=e.onVisibleChange,E=e.afterVisibleChange,b=e.transitionName,C=e.animation,T=e.motion,A=e.placement,O=A===void 0?"right":A,x=e.align,N=x===void 0?{}:x,F=e.destroyTooltipOnHide,L=F===void 0?!1:F,D=e.defaultVisible,V=e.getTooltipContainer,B=e.overlayInnerStyle;e.arrowContent;var W=e.overlay,X=e.id,Y=e.showArrow,ae=Y===void 0?!0:Y,U=e.classNames,z=e.styles,j=Fn(e,r7),Z=G3(X),P=_.useRef(null);_.useImperativeHandle(n,function(){return P.current});var $=J({},j);"visible"in e&&($.popupVisible=e.visible);var ie=function(){return _.createElement(Ax,{key:"content",prefixCls:v,id:Z,bodyClassName:U==null?void 0:U.body,overlayInnerStyle:J(J({},B),z==null?void 0:z.body)},W)},se=function(){var ce=_.Children.only(S),fe=(ce==null?void 0:ce.props)||{},ye=J(J({},fe),{},{"aria-describedby":W?Z:null});return _.cloneElement(S,ye)};return _.createElement(gx,kt({popupClassName:Ze(r,U==null?void 0:U.root),prefixCls:v,popup:ie,action:a,builtinPlacements:n7,popupPlacement:O,ref:P,popupAlign:N,getPopupContainer:V,onPopupVisibleChange:w,afterPopupVisibleChange:E,popupTransitionName:b,popupAnimation:C,popupMotion:T,defaultPopupVisible:D,autoDestroy:L,mouseLeaveDelay:h,popupStyle:J(J({},g),z==null?void 0:z.root),mouseEnterDelay:u,arrow:ae},$),se())};const s7=_.forwardRef(i7);function a7(t){const{sizePopupArrow:e,borderRadiusXS:n,borderRadiusOuter:r}=t,i=e/2,a=0,l=i,u=r*1/Math.sqrt(2),f=i-r*(1-1/Math.sqrt(2)),h=i-n*(1/Math.sqrt(2)),g=r*(Math.sqrt(2)-1)+n*(1/Math.sqrt(2)),m=2*i-h,v=g,S=2*i-u,w=f,E=2*i-a,b=l,C=i*Math.sqrt(2)+r*(Math.sqrt(2)-2),T=r*(Math.sqrt(2)-1),A=`polygon(${T}px 100%, 50% ${T}px, ${2*i-T}px 100%, ${T}px 100%)`,O=`path('M ${a} ${l} A ${r} ${r} 0 0 0 ${u} ${f} L ${h} ${g} A ${n} ${n} 0 0 1 ${m} ${v} L ${S} ${w} A ${r} ${r} 0 0 0 ${E} ${b} Z')`;return{arrowShadowWidth:C,arrowPath:O,arrowPolygon:A}}const o7=(t,e,n)=>{const{sizePopupArrow:r,arrowPolygon:i,arrowPath:a,arrowShadowWidth:l,borderRadiusXS:u,calc:f}=t;return{pointerEvents:"none",width:r,height:r,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:r,height:f(r).div(2).equal(),background:e,clipPath:{_multi_value_:!0,value:[i,a]},content:'""'},"&::after":{content:'""',position:"absolute",width:l,height:l,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${Rt(u)} 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}},Rx=8;function xx(t){const{contentRadius:e,limitVerticalRadius:n}=t,r=e>12?e+2:12;return{arrowOffsetHorizontal:r,arrowOffsetVertical:n?Rx:r}}function uh(t,e){return t?e:{}}function l7(t,e,n){const{componentCls:r,boxShadowPopoverArrow:i,arrowOffsetVertical:a,arrowOffsetHorizontal:l}=t,{arrowDistance:u=0,arrowPlacement:f={left:!0,right:!0,top:!0,bottom:!0}}={};return{[r]:Object.assign(Object.assign(Object.assign(Object.assign({[`${r}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},o7(t,e,i)),{"&:before":{background:e}})]},uh(!!f.top,{[[`&-placement-top > ${r}-arrow`,`&-placement-topLeft > ${r}-arrow`,`&-placement-topRight > ${r}-arrow`].join(",")]:{bottom:u,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top > ${r}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},"&-placement-topLeft":{"--arrow-offset-horizontal":l,[`> ${r}-arrow`]:{left:{_skip_check_:!0,value:l}}},"&-placement-topRight":{"--arrow-offset-horizontal":`calc(100% - ${Rt(l)})`,[`> ${r}-arrow`]:{right:{_skip_check_:!0,value:l}}}})),uh(!!f.bottom,{[[`&-placement-bottom > ${r}-arrow`,`&-placement-bottomLeft > ${r}-arrow`,`&-placement-bottomRight > ${r}-arrow`].join(",")]:{top:u,transform:"translateY(-100%)"},[`&-placement-bottom > ${r}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},"&-placement-bottomLeft":{"--arrow-offset-horizontal":l,[`> ${r}-arrow`]:{left:{_skip_check_:!0,value:l}}},"&-placement-bottomRight":{"--arrow-offset-horizontal":`calc(100% - ${Rt(l)})`,[`> ${r}-arrow`]:{right:{_skip_check_:!0,value:l}}}})),uh(!!f.left,{[[`&-placement-left > ${r}-arrow`,`&-placement-leftTop > ${r}-arrow`,`&-placement-leftBottom > ${r}-arrow`].join(",")]:{right:{_skip_check_:!0,value:u},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left > ${r}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop > ${r}-arrow`]:{top:a},[`&-placement-leftBottom > ${r}-arrow`]:{bottom:a}})),uh(!!f.right,{[[`&-placement-right > ${r}-arrow`,`&-placement-rightTop > ${r}-arrow`,`&-placement-rightBottom > ${r}-arrow`].join(",")]:{left:{_skip_check_:!0,value:u},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right > ${r}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop > ${r}-arrow`]:{top:a},[`&-placement-rightBottom > ${r}-arrow`]:{bottom:a}}))}}function c7(t,e,n,r){if(r===!1)return{adjustX:!1,adjustY:!1};const i=r&&typeof r=="object"?r:{},a={};switch(t){case"top":case"bottom":a.shiftX=e.arrowOffsetHorizontal*2+n,a.shiftY=!0,a.adjustY=!0;break;case"left":case"right":a.shiftY=e.arrowOffsetVertical*2+n,a.shiftX=!0,a.adjustX=!0;break}const l=Object.assign(Object.assign({},a),i);return l.shiftX||(l.adjustX=!0),l.shiftY||(l.adjustY=!0),l}const dC={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},u7={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},f7=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function d7(t){const{arrowWidth:e,autoAdjustOverflow:n,arrowPointAtCenter:r,offset:i,borderRadius:a}=t,l=e/2,u={};return Object.keys(dC).forEach(f=>{const h=r&&u7[f]||dC[f],g=Object.assign(Object.assign({},h),{offset:[0,0],dynamicInset:!0});switch(u[f]=g,f7.has(f)&&(g.autoArrow=!1),f){case"top":case"topLeft":case"topRight":g.offset[1]=-l-i;break;case"bottom":case"bottomLeft":case"bottomRight":g.offset[1]=l+i;break;case"left":case"leftTop":case"leftBottom":g.offset[0]=-l-i;break;case"right":case"rightTop":case"rightBottom":g.offset[0]=l+i;break}const m=xx({contentRadius:a,limitVerticalRadius:!0});if(r)switch(f){case"topLeft":case"bottomLeft":g.offset[0]=-m.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":g.offset[0]=m.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":g.offset[1]=-m.arrowOffsetHorizontal*2+l;break;case"leftBottom":case"rightBottom":g.offset[1]=m.arrowOffsetHorizontal*2-l;break}g.overflow=c7(f,m,e,n),g.htmlRegion="visibleFirst"}),u}const h7=t=>{const{calc:e,componentCls:n,tooltipMaxWidth:r,tooltipColor:i,tooltipBg:a,tooltipBorderRadius:l,zIndexPopup:u,controlHeight:f,boxShadowSecondary:h,paddingSM:g,paddingXS:m,arrowOffsetHorizontal:v,sizePopupArrow:S}=t,w=e(l).add(S).add(v).equal(),E=e(l).mul(2).add(S).equal();return[{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},Lc(t)),{position:"absolute",zIndex:u,display:"block",width:"max-content",maxWidth:r,visibility:"visible","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:["var(--valid-offset-x, 50%)","var(--arrow-y, 50%)"].join(" "),"&-hidden":{display:"none"},"--antd-arrow-background-color":a,[`${n}-inner`]:{minWidth:E,minHeight:f,padding:`${Rt(t.calc(g).div(2).equal())} ${Rt(m)}`,color:i,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:a,borderRadius:l,boxShadow:h,boxSizing:"border-box"},[["&-placement-topLeft","&-placement-topRight","&-placement-bottomLeft","&-placement-bottomRight"].join(",")]:{minWidth:w},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${n}-inner`]:{borderRadius:t.min(l,Rx)}},[`${n}-content`]:{position:"relative"}}),DF(t,(b,C)=>{let{darkColor:T}=C;return{[`&${n}-${b}`]:{[`${n}-inner`]:{backgroundColor:T},[`${n}-arrow`]:{"--antd-arrow-background-color":T}}}})),{"&-rtl":{direction:"rtl"}})},l7(t,"var(--antd-arrow-background-color)"),{[`${n}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow}}]},g7=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+70},xx({contentRadius:t.borderRadius,limitVerticalRadius:!0})),a7(ui(t,{borderRadiusOuter:Math.min(t.borderRadiusOuter,4)}))),Mx=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return zc("Tooltip",r=>{const{borderRadius:i,colorTextLightSolid:a,colorBgSpotlight:l}=r,u=ui(r,{tooltipMaxWidth:250,tooltipColor:a,tooltipBorderRadius:i,tooltipBg:l});return[h7(u),C8(r,"zoom-big-fast")]},g7,{resetStyle:!1,injectStyle:e})(t)},p7=Zh.map(t=>`${t}-inverse`);function m7(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat(ze(p7),ze(Zh)).includes(t):Zh.includes(t)}function Ox(t,e){const n=m7(e),r=Ze({[`${t}-${e}`]:e&&n}),i={},a={};return e&&!n&&(i.background=e,a["--antd-arrow-background-color"]=e),{className:r,overlayStyle:i,arrowStyle:a}}const v7=t=>{const{prefixCls:e,className:n,placement:r="top",title:i,color:a,overlayInnerStyle:l}=t,{getPrefixCls:u}=_.useContext(ci),f=u("tooltip",e),[h,g,m]=Mx(f),v=Ox(f,a),S=v.arrowStyle,w=Object.assign(Object.assign({},l),v.overlayStyle),E=Ze(g,m,f,`${f}-pure`,`${f}-placement-${r}`,n,v.className);return h(_.createElement("div",{className:E,style:S},_.createElement("div",{className:`${f}-arrow`}),_.createElement(Ax,Object.assign({},t,{className:g,prefixCls:f,overlayInnerStyle:w}),i)))};var _7=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i{var n,r;const{prefixCls:i,openClassName:a,getTooltipContainer:l,color:u,overlayInnerStyle:f,children:h,afterOpenChange:g,afterVisibleChange:m,destroyTooltipOnHide:v,arrow:S=!0,title:w,overlay:E,builtinPlacements:b,arrowPointAtCenter:C=!1,autoAdjustOverflow:T=!0,motion:A,getPopupContainer:O,placement:x="top",mouseEnterDelay:N=.1,mouseLeaveDelay:F=.1,overlayStyle:L,rootClassName:D,overlayClassName:V,styles:B,classNames:W}=t,X=_7(t,["prefixCls","openClassName","getTooltipContainer","color","overlayInnerStyle","children","afterOpenChange","afterVisibleChange","destroyTooltipOnHide","arrow","title","overlay","builtinPlacements","arrowPointAtCenter","autoAdjustOverflow","motion","getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName","overlayClassName","styles","classNames"]),Y=!!S,[,ae]=Ws(),{getPopupContainer:U,getPrefixCls:z,direction:j,className:Z,style:P,classNames:$,styles:ie}=Uc("tooltip"),se=l3(),q=_.useRef(null),ce=()=>{var Je;(Je=q.current)===null||Je===void 0||Je.forceAlign()};_.useImperativeHandle(e,()=>{var Je,lt;return{forceAlign:ce,forcePopupAlign:()=>{se.deprecated(!1,"forcePopupAlign","forceAlign"),ce()},nativeElement:(Je=q.current)===null||Je===void 0?void 0:Je.nativeElement,popupElement:(lt=q.current)===null||lt===void 0?void 0:lt.popupElement}});const[fe,ye]=Tc(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(r=t.defaultOpen)!==null&&r!==void 0?r:t.defaultVisible}),Ee=!w&&!E&&w!==0,Ce=Je=>{var lt,ft;ye(Ee?!1:Je),Ee||((lt=t.onOpenChange)===null||lt===void 0||lt.call(t,Je),(ft=t.onVisibleChange)===null||ft===void 0||ft.call(t,Je))},Te=_.useMemo(()=>{var Je,lt;let ft=C;return typeof S=="object"&&(ft=(lt=(Je=S.pointAtCenter)!==null&&Je!==void 0?Je:S.arrowPointAtCenter)!==null&<!==void 0?lt:C),b||d7({arrowPointAtCenter:ft,autoAdjustOverflow:T,arrowWidth:Y?ae.sizePopupArrow:0,borderRadius:ae.borderRadius,offset:ae.marginXXS})},[C,S,b,ae]),ve=_.useMemo(()=>w===0?w:E||w||"",[E,w]),ge=_.createElement(DB,{space:!0},typeof ve=="function"?ve():ve),_e=z("tooltip",i),Ie=z(),we=t["data-popover-inject"];let xe=fe;!("open"in t)&&!("visible"in t)&&Ee&&(xe=!1);const Ve=_.isValidElement(h)&&!kk(h)?h:_.createElement("span",null,h),Fe=Ve.props,Be=!Fe.className||typeof Fe.className=="string"?Ze(Fe.className,a||`${_e}-open`):Fe.className,[nt,He,Ge]=Mx(_e,!we),Pe=Ox(_e,u),Me=Pe.arrowStyle,dt=Ze(V,{[`${_e}-rtl`]:j==="rtl"},Pe.className,D,He,Ge,Z,$.root,W==null?void 0:W.root),rt=Ze($.body,W==null?void 0:W.body),[it,st]=z3("Tooltip",X.zIndex),at=_.createElement(s7,Object.assign({},X,{zIndex:it,showArrow:Y,placement:x,mouseEnterDelay:N,mouseLeaveDelay:F,prefixCls:_e,classNames:{root:dt,body:rt},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Me),ie.root),P),L),B==null?void 0:B.root),body:Object.assign(Object.assign(Object.assign(Object.assign({},ie.body),f),B==null?void 0:B.body),Pe.overlayStyle)},getTooltipContainer:O||l||U,ref:q,builtinPlacements:Te,overlay:ge,visible:xe,onVisibleChange:Ce,afterVisibleChange:g??m,arrowContent:_.createElement("span",{className:`${_e}-arrow-content`}),motion:{motionName:$3(Ie,"zoom-big-fast",t.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!v}),xe?B3(Ve,{className:Be}):Ve);return nt(_.createElement(U3.Provider,{value:st},at))}),Px=y7;Px._InternalPanelDoNotUseOrYouWillBeFired=v7;function b7(t,e,n){var r=n||{},i=r.noTrailing,a=i===void 0?!1:i,l=r.noLeading,u=l===void 0?!1:l,f=r.debounceMode,h=f===void 0?void 0:f,g,m=!1,v=0;function S(){g&&clearTimeout(g)}function w(b){var C=b||{},T=C.upcomingOnly,A=T===void 0?!1:T;S(),m=!A}function E(){for(var b=arguments.length,C=new Array(b),T=0;Tt?u?(v=Date.now(),a||(g=setTimeout(h?N:x,t))):x():a!==!0&&(g=setTimeout(h?N:x,h===void 0?t-O:t))}return E.cancel=w,E}function S7(t,e,n){var r={},i=r.atBegin,a=i===void 0?!1:i;return b7(t,e,{debounceMode:a!==!1})}function x_(t,e,n){return(t-e)/(n-e)}function rb(t,e,n,r){var i=x_(e,n,r),a={};switch(t){case"rtl":a.right="".concat(i*100,"%"),a.transform="translateX(50%)";break;case"btt":a.bottom="".concat(i*100,"%"),a.transform="translateY(50%)";break;case"ttb":a.top="".concat(i*100,"%"),a.transform="translateY(-50%)";break;default:a.left="".concat(i*100,"%"),a.transform="translateX(-50%)";break}return a}function vo(t,e){return Array.isArray(t)?t[e]:t}var Ko=_.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),E7=_.createContext({}),w7=["prefixCls","value","valueIndex","onStartMove","onDelete","style","render","dragging","draggingDelete","onOffsetChange","onChangeComplete","onFocus","onMouseEnter"],hC=_.forwardRef(function(t,e){var n=t.prefixCls,r=t.value,i=t.valueIndex,a=t.onStartMove,l=t.onDelete,u=t.style,f=t.render,h=t.dragging,g=t.draggingDelete,m=t.onOffsetChange,v=t.onChangeComplete,S=t.onFocus,w=t.onMouseEnter,E=Fn(t,w7),b=_.useContext(Ko),C=b.min,T=b.max,A=b.direction,O=b.disabled,x=b.keyboard,N=b.range,F=b.tabIndex,L=b.ariaLabelForHandle,D=b.ariaLabelledByForHandle,V=b.ariaRequired,B=b.ariaValueTextFormatterForHandle,W=b.styles,X=b.classNames,Y="".concat(n,"-handle"),ae=function(ce){O||a(ce,i)},U=function(ce){S==null||S(ce,i)},z=function(ce){w(ce,i)},j=function(ce){if(!O&&x){var fe=null;switch(ce.which||ce.keyCode){case et.LEFT:fe=A==="ltr"||A==="btt"?-1:1;break;case et.RIGHT:fe=A==="ltr"||A==="btt"?1:-1;break;case et.UP:fe=A!=="ttb"?1:-1;break;case et.DOWN:fe=A!=="ttb"?-1:1;break;case et.HOME:fe="min";break;case et.END:fe="max";break;case et.PAGE_UP:fe=2;break;case et.PAGE_DOWN:fe=-2;break;case et.BACKSPACE:case et.DELETE:l(i);break}fe!==null&&(ce.preventDefault(),m(fe,i))}},Z=function(ce){switch(ce.which||ce.keyCode){case et.LEFT:case et.RIGHT:case et.UP:case et.DOWN:case et.HOME:case et.END:case et.PAGE_UP:case et.PAGE_DOWN:v==null||v();break}},P=rb(A,r,C,T),$={};if(i!==null){var ie;$={tabIndex:O?null:vo(F,i),role:"slider","aria-valuemin":C,"aria-valuemax":T,"aria-valuenow":r,"aria-disabled":O,"aria-label":vo(L,i),"aria-labelledby":vo(D,i),"aria-required":vo(V,i),"aria-valuetext":(ie=vo(B,i))===null||ie===void 0?void 0:ie(r),"aria-orientation":A==="ltr"||A==="rtl"?"horizontal":"vertical",onMouseDown:ae,onTouchStart:ae,onFocus:U,onMouseEnter:z,onKeyDown:j,onKeyUp:Z}}var se=_.createElement("div",kt({ref:e,className:Ze(Y,K(K(K({},"".concat(Y,"-").concat(i+1),i!==null&&N),"".concat(Y,"-dragging"),h),"".concat(Y,"-dragging-delete"),g),X.handle),style:J(J(J({},P),u),W.handle)},$,E));return f&&(se=f(se,{index:i,prefixCls:n,value:r,dragging:h,draggingDelete:g})),se}),T7=["prefixCls","style","onStartMove","onOffsetChange","values","handleRender","activeHandleRender","draggingIndex","draggingDelete","onFocus"],C7=_.forwardRef(function(t,e){var n=t.prefixCls,r=t.style,i=t.onStartMove,a=t.onOffsetChange,l=t.values,u=t.handleRender,f=t.activeHandleRender,h=t.draggingIndex,g=t.draggingDelete,m=t.onFocus,v=Fn(t,T7),S=_.useRef({}),w=_.useState(!1),E=de(w,2),b=E[0],C=E[1],T=_.useState(-1),A=de(T,2),O=A[0],x=A[1],N=function(B){x(B),C(!0)},F=function(B,W){N(W),m==null||m(B)},L=function(B,W){N(W)};_.useImperativeHandle(e,function(){return{focus:function(B){var W;(W=S.current[B])===null||W===void 0||W.focus()},hideHelp:function(){za.flushSync(function(){C(!1)})}}});var D=J({prefixCls:n,onStartMove:i,onOffsetChange:a,render:u,onFocus:F,onMouseEnter:L},v);return _.createElement(_.Fragment,null,l.map(function(V,B){var W=h===B;return _.createElement(hC,kt({ref:function(Y){Y?S.current[B]=Y:delete S.current[B]},dragging:W,draggingDelete:W&&g,style:vo(r,B),key:B,value:V,valueIndex:B},D))}),f&&b&&_.createElement(hC,kt({key:"a11y"},D,{value:l[O],valueIndex:null,dragging:h!==-1,draggingDelete:g,render:f,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))}),A7=function(e){var n=e.prefixCls,r=e.style,i=e.children,a=e.value,l=e.onClick,u=_.useContext(Ko),f=u.min,h=u.max,g=u.direction,m=u.includedStart,v=u.includedEnd,S=u.included,w="".concat(n,"-text"),E=rb(g,a,f,h);return _.createElement("span",{className:Ze(w,K({},"".concat(w,"-active"),S&&m<=a&&a<=v)),style:J(J({},E),r),onMouseDown:function(C){C.stopPropagation()},onClick:function(){l(a)}},i)},R7=function(e){var n=e.prefixCls,r=e.marks,i=e.onClick,a="".concat(n,"-mark");return r.length?_.createElement("div",{className:a},r.map(function(l){var u=l.value,f=l.style,h=l.label;return _.createElement(A7,{key:u,prefixCls:a,style:f,value:u,onClick:i},h)})):null},x7=function(e){var n=e.prefixCls,r=e.value,i=e.style,a=e.activeStyle,l=_.useContext(Ko),u=l.min,f=l.max,h=l.direction,g=l.included,m=l.includedStart,v=l.includedEnd,S="".concat(n,"-dot"),w=g&&m<=r&&r<=v,E=J(J({},rb(h,r,u,f)),typeof i=="function"?i(r):i);return w&&(E=J(J({},E),typeof a=="function"?a(r):a)),_.createElement("span",{className:Ze(S,K({},"".concat(S,"-active"),w)),style:E})},M7=function(e){var n=e.prefixCls,r=e.marks,i=e.dots,a=e.style,l=e.activeStyle,u=_.useContext(Ko),f=u.min,h=u.max,g=u.step,m=_.useMemo(function(){var v=new Set;if(r.forEach(function(w){v.add(w.value)}),i&&g!==null)for(var S=f;S<=h;)v.add(S),S+=g;return Array.from(v)},[f,h,g,i,r]);return _.createElement("div",{className:"".concat(n,"-step")},m.map(function(v){return _.createElement(x7,{prefixCls:n,key:v,value:v,style:a,activeStyle:l})}))},gC=function(e){var n=e.prefixCls,r=e.style,i=e.start,a=e.end,l=e.index,u=e.onStartMove,f=e.replaceCls,h=_.useContext(Ko),g=h.direction,m=h.min,v=h.max,S=h.disabled,w=h.range,E=h.classNames,b="".concat(n,"-track"),C=x_(i,m,v),T=x_(a,m,v),A=function(F){!S&&u&&u(F,-1)},O={};switch(g){case"rtl":O.right="".concat(C*100,"%"),O.width="".concat(T*100-C*100,"%");break;case"btt":O.bottom="".concat(C*100,"%"),O.height="".concat(T*100-C*100,"%");break;case"ttb":O.top="".concat(C*100,"%"),O.height="".concat(T*100-C*100,"%");break;default:O.left="".concat(C*100,"%"),O.width="".concat(T*100-C*100,"%")}var x=f||Ze(b,K(K({},"".concat(b,"-").concat(l+1),l!==null&&w),"".concat(n,"-track-draggable"),u),E.track);return _.createElement("div",{className:x,style:J(J({},O),r),onMouseDown:A,onTouchStart:A})},O7=function(e){var n=e.prefixCls,r=e.style,i=e.values,a=e.startPoint,l=e.onStartMove,u=_.useContext(Ko),f=u.included,h=u.range,g=u.min,m=u.styles,v=u.classNames,S=_.useMemo(function(){if(!h){if(i.length===0)return[];var E=a??g,b=i[0];return[{start:Math.min(E,b),end:Math.max(E,b)}]}for(var C=[],T=0;TP7&&g3&&arguments[3]!==void 0?arguments[3]:"unit";if(typeof E=="number"){var T,A=w[b],O=A+E,x=[];r.forEach(function(V){x.push(V.value)}),x.push(t,e),x.push(u(A));var N=E>0?1:-1;C==="unit"?x.push(u(A+N*n)):x.push(u(O)),x=x.filter(function(V){return V!==null}).filter(function(V){return E<0?V<=A:V>=A}),C==="unit"&&(x=x.filter(function(V){return V!==A}));var F=C==="unit"?A:O;T=x[0];var L=Math.abs(T-F);if(x.forEach(function(V){var B=Math.abs(V-F);B1){var D=ze(w);return D[b]=T,S(D,E-N,b,C)}return T}else{if(E==="min")return t;if(E==="max")return e}},g=function(w,E,b){var C=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unit",T=w[b],A=h(w,E,b,C);return{value:A,changed:A!==T}},m=function(w){return a===null&&w===0||typeof a=="number"&&w3&&arguments[3]!==void 0?arguments[3]:"unit",T=w.map(f),A=T[b],O=h(T,E,b,C);if(T[b]=O,i===!1){var x=a||0;b>0&&T[b-1]!==A&&(T[b]=Math.max(T[b],T[b-1]+x)),b0;D-=1)for(var V=!0;m(T[D]-T[D-1])&&V;){var B=g(T,-1,D-1);T[D-1]=B.value,V=B.changed}for(var W=T.length-1;W>0;W-=1)for(var X=!0;m(T[W]-T[W-1])&&X;){var Y=g(T,-1,W-1);T[W-1]=Y.value,X=Y.changed}for(var ae=0;ae=0?z:!1},[z,lt]),ct=_.useMemo(function(){return Object.keys(Ee||{}).map(function(De){var be=Ee[De],ut={value:Number(De)};return be&&pt(be)==="object"&&!_.isValidElement(be)&&("label"in be||"style"in be)?(ut.style=be.style,ut.label=be.label):ut.label=be,ut}).filter(function(De){var be=De.label;return be||typeof be=="number"}).sort(function(De,be){return De.value-be.value})},[Ee]),mt=I7(at,Je,lt,ct,ae,ft),xt=de(mt,2),Bt=xt[0],ht=xt[1],Vt=Tc(F,{value:N}),qt=de(Vt,2),wn=qt[0],Mn=qt[1],Ut=_.useMemo(function(){var De=wn==null?[]:Array.isArray(wn)?wn:[wn],be=de(De,1),ut=be[0],zt=ut===void 0?at:ut,Ot=wn===null?[]:[zt];if(Me){if(Ot=ze(De),D||wn===void 0){var In=D>=0?D+1:2;for(Ot=Ot.slice(0,In);Ot.length=0&&Be.current.focus(De)}_t(null)},[bt]);var Yt=_.useMemo(function(){return rt&<===null?!1:rt},[rt,lt]),vn=fr(function(De,be){Oe(De,be),B==null||B(It(Ut))}),On=Ne!==-1;_.useEffect(function(){if(!On){var De=Ut.lastIndexOf(Et);Be.current.focus(De)}},[On]);var _n=_.useMemo(function(){return ze(Ue).sort(function(De,be){return De-be})},[Ue]),Zn=_.useMemo(function(){return Me?[_n[0],_n[_n.length-1]]:[at,_n[0]]},[_n,Me,at]),un=de(Zn,2),rn=un[0],Ae=un[1];_.useImperativeHandle(e,function(){return{focus:function(){Be.current.focus(0)},blur:function(){var be,ut=document,zt=ut.activeElement;(be=nt.current)!==null&&be!==void 0&&be.contains(zt)&&(zt==null||zt.blur())}}}),_.useEffect(function(){S&&Be.current.focus(0)},[]);var Le=_.useMemo(function(){return{min:at,max:Je,direction:He,disabled:g,keyboard:v,step:lt,included:$,includedStart:rn,includedEnd:Ae,range:Me,tabIndex:Ie,ariaLabelForHandle:we,ariaLabelledByForHandle:xe,ariaRequired:Ve,ariaValueTextFormatterForHandle:Fe,styles:u||{},classNames:l||{}}},[at,Je,He,g,v,lt,$,rn,Ae,Me,Ie,we,xe,Ve,Fe,u,l]);return _.createElement(Ko.Provider,{value:Le},_.createElement("div",{ref:nt,className:Ze(r,i,K(K(K(K({},"".concat(r,"-disabled"),g),"".concat(r,"-vertical"),Z),"".concat(r,"-horizontal"),!Z),"".concat(r,"-with-marks"),ct.length)),style:a,onMouseDown:Ye,id:f},_.createElement("div",{className:Ze("".concat(r,"-rail"),l==null?void 0:l.rail),style:J(J({},ce),u==null?void 0:u.rail)}),ge!==!1&&_.createElement(O7,{prefixCls:r,style:se,values:Ut,startPoint:ie,onStartMove:Yt?vn:void 0}),_.createElement(M7,{prefixCls:r,marks:ct,dots:Ce,style:fe,activeStyle:ye}),_.createElement(C7,{ref:Be,prefixCls:r,style:q,values:Ue,draggingIndex:Ne,draggingDelete:en,onStartMove:vn,onOffsetChange:Zt,onFocus:w,onBlur:E,handleRender:Te,activeHandleRender:ve,onChangeComplete:Jt,onDelete:dt?Mt:void 0}),_.createElement(R7,{prefixCls:r,marks:ct,onClick:je})))});const k7=_.createContext({}),mC=_.forwardRef((t,e)=>{const{open:n,draggingDelete:r}=t,i=_.useRef(null),a=n&&!r,l=_.useRef(null);function u(){dr.cancel(l.current),l.current=null}function f(){l.current=dr(()=>{var h;(h=i.current)===null||h===void 0||h.forceAlign(),l.current=null})}return _.useEffect(()=>(a?f():u(),u),[a,t.title]),_.createElement(Px,Object.assign({ref:Zg(i,e)},t,{open:a}))}),B7=t=>{const{componentCls:e,antCls:n,controlSize:r,dotSize:i,marginFull:a,marginPart:l,colorFillContentHover:u,handleColorDisabled:f,calc:h,handleSize:g,handleSizeHover:m,handleActiveColor:v,handleActiveOutlineColor:S,handleLineWidth:w,handleLineWidthHover:E,motionDurationMid:b}=t;return{[e]:Object.assign(Object.assign({},Lc(t)),{position:"relative",height:r,margin:`${Rt(l)} ${Rt(a)}`,padding:0,cursor:"pointer",touchAction:"none","&-vertical":{margin:`${Rt(a)} ${Rt(l)}`},[`${e}-rail`]:{position:"absolute",backgroundColor:t.railBg,borderRadius:t.borderRadiusXS,transition:`background-color ${b}`},[`${e}-track,${e}-tracks`]:{position:"absolute",transition:`background-color ${b}`},[`${e}-track`]:{backgroundColor:t.trackBg,borderRadius:t.borderRadiusXS},[`${e}-track-draggable`]:{boxSizing:"content-box",backgroundClip:"content-box",border:"solid rgba(0,0,0,0)"},"&:hover":{[`${e}-rail`]:{backgroundColor:t.railHoverBg},[`${e}-track`]:{backgroundColor:t.trackHoverBg},[`${e}-dot`]:{borderColor:u},[`${e}-handle::after`]:{boxShadow:`0 0 0 ${Rt(w)} ${t.colorPrimaryBorderHover}`},[`${e}-dot-active`]:{borderColor:t.dotActiveBorderColor}},[`${e}-handle`]:{position:"absolute",width:g,height:g,outline:"none",userSelect:"none","&-dragging-delete":{opacity:0},"&::before":{content:'""',position:"absolute",insetInlineStart:h(w).mul(-1).equal(),insetBlockStart:h(w).mul(-1).equal(),width:h(g).add(h(w).mul(2)).equal(),height:h(g).add(h(w).mul(2)).equal(),backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:g,height:g,backgroundColor:t.colorBgElevated,boxShadow:`0 0 0 ${Rt(w)} ${t.handleColor}`,outline:"0px solid transparent",borderRadius:"50%",cursor:"pointer",transition:` + inset-inline-start ${b}, + inset-block-start ${b}, + width ${b}, + height ${b}, + box-shadow ${b}, + outline ${b} + `},"&:hover, &:active, &:focus":{"&::before":{insetInlineStart:h(m).sub(g).div(2).add(E).mul(-1).equal(),insetBlockStart:h(m).sub(g).div(2).add(E).mul(-1).equal(),width:h(m).add(h(E).mul(2)).equal(),height:h(m).add(h(E).mul(2)).equal()},"&::after":{boxShadow:`0 0 0 ${Rt(E)} ${v}`,outline:`6px solid ${S}`,width:m,height:m,insetInlineStart:t.calc(g).sub(m).div(2).equal(),insetBlockStart:t.calc(g).sub(m).div(2).equal()}}},[`&-lock ${e}-handle`]:{"&::before, &::after":{transition:"none"}},[`${e}-mark`]:{position:"absolute",fontSize:t.fontSize},[`${e}-mark-text`]:{position:"absolute",display:"inline-block",color:t.colorTextDescription,textAlign:"center",wordBreak:"keep-all",cursor:"pointer",userSelect:"none","&-active":{color:t.colorText}},[`${e}-step`]:{position:"absolute",background:"transparent",pointerEvents:"none"},[`${e}-dot`]:{position:"absolute",width:i,height:i,backgroundColor:t.colorBgElevated,border:`${Rt(w)} solid ${t.dotBorderColor}`,borderRadius:"50%",cursor:"pointer",transition:`border-color ${t.motionDurationSlow}`,pointerEvents:"auto","&-active":{borderColor:t.dotActiveBorderColor}},[`&${e}-disabled`]:{cursor:"not-allowed",[`${e}-rail`]:{backgroundColor:`${t.railBg} !important`},[`${e}-track`]:{backgroundColor:`${t.trackBgDisabled} !important`},[` + ${e}-dot + `]:{backgroundColor:t.colorBgElevated,borderColor:t.trackBgDisabled,boxShadow:"none",cursor:"not-allowed"},[`${e}-handle::after`]:{backgroundColor:t.colorBgElevated,cursor:"not-allowed",width:g,height:g,boxShadow:`0 0 0 ${Rt(w)} ${f}`,insetInlineStart:0,insetBlockStart:0},[` + ${e}-mark-text, + ${e}-dot + `]:{cursor:"not-allowed !important"}},[`&-tooltip ${n}-tooltip-inner`]:{minWidth:"unset"}})}},Nx=(t,e)=>{const{componentCls:n,railSize:r,handleSize:i,dotSize:a,marginFull:l,calc:u}=t,f=e?"paddingBlock":"paddingInline",h=e?"width":"height",g=e?"height":"width",m=e?"insetBlockStart":"insetInlineStart",v=e?"top":"insetInlineStart",S=u(r).mul(3).sub(i).div(2).equal(),w=u(i).sub(r).div(2).equal(),E=e?{borderWidth:`${Rt(w)} 0`,transform:`translateY(${Rt(u(w).mul(-1).equal())})`}:{borderWidth:`0 ${Rt(w)}`,transform:`translateX(${Rt(t.calc(w).mul(-1).equal())})`};return{[f]:r,[g]:u(r).mul(3).equal(),[`${n}-rail`]:{[h]:"100%",[g]:r},[`${n}-track,${n}-tracks`]:{[g]:r},[`${n}-track-draggable`]:Object.assign({},E),[`${n}-handle`]:{[m]:S},[`${n}-mark`]:{insetInlineStart:0,top:0,[v]:u(r).mul(3).add(e?0:l).equal(),[h]:"100%"},[`${n}-step`]:{insetInlineStart:0,top:0,[v]:r,[h]:"100%",[g]:r},[`${n}-dot`]:{position:"absolute",[m]:u(r).sub(a).div(2).equal()}}},U7=t=>{const{componentCls:e,marginPartWithMark:n}=t;return{[`${e}-horizontal`]:Object.assign(Object.assign({},Nx(t,!0)),{[`&${e}-with-marks`]:{marginBottom:n}})}},L7=t=>{const{componentCls:e}=t;return{[`${e}-vertical`]:Object.assign(Object.assign({},Nx(t,!1)),{height:"100%"})}},z7=t=>{const n=t.controlHeightLG/4,r=t.controlHeightSM/2,i=t.lineWidth+1,a=t.lineWidth+1*1.5,l=t.colorPrimary,u=new En(l).setA(.2).toRgbString();return{controlSize:n,railSize:4,handleSize:n,handleSizeHover:r,dotSize:8,handleLineWidth:i,handleLineWidthHover:a,railBg:t.colorFillTertiary,railHoverBg:t.colorFillSecondary,trackBg:t.colorPrimaryBorder,trackHoverBg:t.colorPrimaryBorderHover,handleColor:t.colorPrimaryBorder,handleActiveColor:l,handleActiveOutlineColor:u,handleColorDisabled:new En(t.colorTextDisabled).onBackground(t.colorBgContainer).toHexString(),dotBorderColor:t.colorBorderSecondary,dotActiveBorderColor:t.colorPrimaryBorder,trackBgDisabled:t.colorBgContainerDisabled}},$7=zc("Slider",t=>{const e=ui(t,{marginPart:t.calc(t.controlHeight).sub(t.controlSize).div(2).equal(),marginFull:t.calc(t.controlSize).div(2).equal(),marginPartWithMark:t.calc(t.controlHeightLG).sub(t.controlSize).equal()});return[B7(e),U7(e),L7(e)]},z7);function Lv(){const[t,e]=_.useState(!1),n=_.useRef(null),r=()=>{dr.cancel(n.current)},i=a=>{r(),a?e(a):n.current=dr(()=>{e(a)})};return _.useEffect(()=>r,[]),[t,i]}var V7=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);itypeof n=="number"?n.toString():""}const j7=Ft.forwardRef((t,e)=>{const{prefixCls:n,range:r,className:i,rootClassName:a,style:l,disabled:u,tooltipPrefixCls:f,tipFormatter:h,tooltipVisible:g,getTooltipPopupContainer:m,tooltipPlacement:v,tooltip:S={},onChangeComplete:w,classNames:E,styles:b}=t,C=V7(t,["prefixCls","range","className","rootClassName","style","disabled","tooltipPrefixCls","tipFormatter","tooltipVisible","getTooltipPopupContainer","tooltipPlacement","tooltip","onChangeComplete","classNames","styles"]),{vertical:T}=t,{getPrefixCls:A,direction:O,className:x,style:N,classNames:F,styles:L,getPopupContainer:D}=Uc("slider"),V=Ft.useContext(wf),B=u??V,{handleRender:W,direction:X}=Ft.useContext(k7),ae=(X||O)==="rtl",[U,z]=Lv(),[j,Z]=Lv(),P=Object.assign({},S),{open:$,placement:ie,getPopupContainer:se,prefixCls:q,formatter:ce}=P,fe=$??g,ye=(U||j)&&fe!==!1,Ee=H7(ce,h),[Ce,Te]=Lv(),ve=Me=>{w==null||w(Me),Te(!1)},ge=(Me,dt)=>Me||(dt?ae?"left":"right":"top"),_e=A("slider",n),[Ie,we,xe]=$7(_e),Ve=Ze(i,x,F.root,E==null?void 0:E.root,a,{[`${_e}-rtl`]:ae,[`${_e}-lock`]:Ce},we,xe);ae&&!C.vertical&&(C.reverse=!C.reverse),Ft.useEffect(()=>{const Me=()=>{dr(()=>{Z(!1)},1)};return document.addEventListener("mouseup",Me),()=>{document.removeEventListener("mouseup",Me)}},[]);const Fe=r&&!fe,Be=W||((Me,dt)=>{const{index:rt}=dt,it=Me.props;function st(ft,ct,mt){var xt,Bt,ht,Vt;mt&&((Bt=(xt=C)[ft])===null||Bt===void 0||Bt.call(xt,ct)),(Vt=(ht=it)[ft])===null||Vt===void 0||Vt.call(ht,ct)}const at=Object.assign(Object.assign({},it),{onMouseEnter:ft=>{z(!0),st("onMouseEnter",ft)},onMouseLeave:ft=>{z(!1),st("onMouseLeave",ft)},onMouseDown:ft=>{Z(!0),Te(!0),st("onMouseDown",ft)},onFocus:ft=>{var ct;Z(!0),(ct=C.onFocus)===null||ct===void 0||ct.call(C,ft),st("onFocus",ft,!0)},onBlur:ft=>{var ct;Z(!1),(ct=C.onBlur)===null||ct===void 0||ct.call(C,ft),st("onBlur",ft,!0)}}),Je=Ft.cloneElement(Me,at),lt=(!!fe||ye)&&Ee!==null;return Fe?Je:Ft.createElement(mC,Object.assign({},P,{prefixCls:A("tooltip",q??f),title:Ee?Ee(dt.value):"",open:lt,placement:ge(ie??v,T),key:rt,classNames:{root:`${_e}-tooltip`},getPopupContainer:se||m||D}),Je)}),nt=Fe?(Me,dt)=>{const rt=Ft.cloneElement(Me,{style:Object.assign(Object.assign({},Me.props.style),{visibility:"hidden"})});return Ft.createElement(mC,Object.assign({},P,{prefixCls:A("tooltip",q??f),title:Ee?Ee(dt.value):"",open:Ee!==null&&ye,placement:ge(ie??v,T),key:"tooltip",classNames:{root:`${_e}-tooltip`},getPopupContainer:se||m||D,draggingDelete:dt.draggingDelete}),rt)}:void 0,He=Object.assign(Object.assign(Object.assign(Object.assign({},L.root),N),b==null?void 0:b.root),l),Ge=Object.assign(Object.assign({},L.tracks),b==null?void 0:b.tracks),Pe=Ze(F.tracks,E==null?void 0:E.tracks);return Ie(Ft.createElement(F7,Object.assign({},C,{classNames:Object.assign({handle:Ze(F.handle,E==null?void 0:E.handle),rail:Ze(F.rail,E==null?void 0:E.rail),track:Ze(F.track,E==null?void 0:E.track)},Pe?{tracks:Pe}:{}),styles:Object.assign({handle:Object.assign(Object.assign({},L.handle),b==null?void 0:b.handle),rail:Object.assign(Object.assign({},L.rail),b==null?void 0:b.rail),track:Object.assign(Object.assign({},L.track),b==null?void 0:b.track)},Object.keys(Ge).length?{tracks:Ge}:{}),step:C.step,range:r,className:Ve,style:He,disabled:B,ref:e,prefixCls:_e,handleRender:Be,activeHandleRender:nt,onChangeComplete:ve})))});function vC(t){return["small","middle","large"].includes(t)}function _C(t){return t?typeof t=="number"&&!Number.isNaN(t):!1}const Ix=Ft.createContext({latestIndex:0}),W7=Ix.Provider,X7=t=>{let{className:e,index:n,children:r,split:i,style:a}=t;const{latestIndex:l}=_.useContext(Ix);return r==null?null:_.createElement(_.Fragment,null,_.createElement("div",{className:e,style:a},r),n{var n;const{getPrefixCls:r,direction:i,size:a,className:l,style:u,classNames:f,styles:h}=Uc("space"),{size:g=a??"small",align:m,className:v,rootClassName:S,children:w,direction:E="horizontal",prefixCls:b,split:C,style:T,wrap:A=!1,classNames:O,styles:x}=t,N=q7(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[F,L]=Array.isArray(g)?g:[g,g],D=vC(L),V=vC(F),B=_C(L),W=_C(F),X=Lo(w,{keepEmpty:!0}),Y=m===void 0&&E==="horizontal"?"center":m,ae=r("space",b),[U,z,j]=j3(ae),Z=Ze(ae,l,z,`${ae}-${E}`,{[`${ae}-rtl`]:i==="rtl",[`${ae}-align-${Y}`]:Y,[`${ae}-gap-row-${L}`]:D,[`${ae}-gap-col-${F}`]:V},v,S,j),P=Ze(`${ae}-item`,(n=O==null?void 0:O.item)!==null&&n!==void 0?n:f.item);let $=0;const ie=X.map((ce,fe)=>{var ye;ce!=null&&($=fe);const Ee=(ce==null?void 0:ce.key)||`${P}-${fe}`;return _.createElement(X7,{className:P,key:Ee,index:fe,split:C,style:(ye=x==null?void 0:x.item)!==null&&ye!==void 0?ye:h.item},ce)}),se=_.useMemo(()=>({latestIndex:$}),[$]);if(X.length===0)return null;const q={};return A&&(q.flexWrap="wrap"),!V&&W&&(q.columnGap=F),!D&&B&&(q.rowGap=L),U(_.createElement("div",Object.assign({ref:e,className:Z,style:Object.assign(Object.assign(Object.assign({},q),u),T)},N),_.createElement(W7,{value:se},ie)))}),Dx=Y7;Dx.Compact=Qk;const tg=100,Fx=tg/5,kx=tg/2-Fx/2,zv=kx*2*Math.PI,yC=50,bC=t=>{const{dotClassName:e,style:n,hasCircleCls:r}=t;return _.createElement("circle",{className:Ze(`${e}-circle`,{[`${e}-circle-bg`]:r}),r:kx,cx:yC,cy:yC,strokeWidth:Fx,style:n})},K7=t=>{let{percent:e,prefixCls:n}=t;const r=`${n}-dot`,i=`${r}-holder`,a=`${i}-hidden`,[l,u]=_.useState(!1);Dn(()=>{e!==0&&u(!0)},[e!==0]);const f=Math.max(Math.min(e,100),0);if(!l)return null;const h={strokeDashoffset:`${zv/4}`,strokeDasharray:`${zv*f/100} ${zv*(100-f)/100}`};return _.createElement("span",{className:Ze(i,`${r}-progress`,f<=0&&a)},_.createElement("svg",{viewBox:`0 0 ${tg} ${tg}`,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f},_.createElement(bC,{dotClassName:r,hasCircleCls:!0}),_.createElement(bC,{dotClassName:r,style:h})))};function Z7(t){const{prefixCls:e,percent:n=0}=t,r=`${e}-dot`,i=`${r}-holder`,a=`${i}-hidden`;return _.createElement(_.Fragment,null,_.createElement("span",{className:Ze(i,n>0&&a)},_.createElement("span",{className:Ze(r,`${e}-dot-spin`)},[1,2,3,4].map(l=>_.createElement("i",{className:`${e}-dot-item`,key:l})))),_.createElement(K7,{prefixCls:e,percent:n}))}function Q7(t){const{prefixCls:e,indicator:n,percent:r}=t,i=`${e}-dot`;return n&&_.isValidElement(n)?B3(n,{className:Ze(n.props.className,i),percent:r}):_.createElement(Z7,{prefixCls:e,percent:r})}const G7=new ln("antSpinMove",{to:{opacity:1}}),J7=new ln("antRotate",{to:{transform:"rotate(405deg)"}}),e9=t=>{const{componentCls:e,calc:n}=t;return{[e]:Object.assign(Object.assign({},Lc(t)),{position:"absolute",display:"none",color:t.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${t.motionDurationSlow} ${t.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${e}-text`]:{fontSize:t.fontSize,paddingTop:n(n(t.dotSize).sub(t.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:t.colorBgMask,zIndex:t.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${t.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[e]:{[`${e}-dot-holder`]:{color:t.colorWhite},[`${e}-text`]:{color:t.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${e}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:t.contentHeight,[`${e}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:n(t.dotSize).mul(-1).div(2).equal()},[`${e}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${t.colorBgContainer}`},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${e}-dot`]:{margin:n(t.dotSizeSM).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeSM).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${e}-dot`]:{margin:n(t.dotSizeLG).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeLG).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${e}-container`]:{position:"relative",transition:`opacity ${t.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:t.colorBgContainer,opacity:0,transition:`all ${t.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${e}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:t.spinDotDefault},[`${e}-dot-holder`]:{width:"1em",height:"1em",fontSize:t.dotSize,display:"inline-block",transition:`transform ${t.motionDurationSlow} ease, opacity ${t.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:t.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${e}-dot-progress`]:{position:"absolute",inset:0},[`${e}-dot`]:{position:"relative",display:"inline-block",fontSize:t.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),height:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:G7,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:J7,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(r=>`${r} ${t.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:t.colorFillSecondary}},[`&-sm ${e}-dot`]:{"&, &-holder":{fontSize:t.dotSizeSM}},[`&-sm ${e}-dot-holder`]:{i:{width:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal(),height:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal()}},[`&-lg ${e}-dot`]:{"&, &-holder":{fontSize:t.dotSizeLG}},[`&-lg ${e}-dot-holder`]:{i:{width:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal(),height:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal()}},[`&${e}-show-text ${e}-text`]:{display:"block"}})}},t9=t=>{const{controlHeightLG:e,controlHeight:n}=t;return{contentHeight:400,dotSize:e/2,dotSizeSM:e*.35,dotSizeLG:n}},n9=zc("Spin",t=>{const e=ui(t,{spinDotDefault:t.colorTextDescription});return[e9(e)]},t9),r9=200,SC=[[30,.05],[70,.03],[96,.01]];function i9(t,e){const[n,r]=_.useState(0),i=_.useRef(null),a=e==="auto";return _.useEffect(()=>(a&&t&&(r(0),i.current=setInterval(()=>{r(l=>{const u=100-l;for(let f=0;f{clearInterval(i.current)}),[a,t]),a?n:e}var s9=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i{var e;const{prefixCls:n,spinning:r=!0,delay:i=0,className:a,rootClassName:l,size:u="default",tip:f,wrapperClassName:h,style:g,children:m,fullscreen:v=!1,indicator:S,percent:w}=t,E=s9(t,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:b,direction:C,className:T,style:A,indicator:O}=Uc("spin"),x=b("spin",n),[N,F,L]=n9(x),[D,V]=_.useState(()=>r&&!a9(r,i)),B=i9(D,w);_.useEffect(()=>{if(r){const j=S7(i,()=>{V(!0)});return j(),()=>{var Z;(Z=j==null?void 0:j.cancel)===null||Z===void 0||Z.call(j)}}V(!1)},[i,r]);const W=_.useMemo(()=>typeof m<"u"&&!v,[m,v]),X=Ze(x,T,{[`${x}-sm`]:u==="small",[`${x}-lg`]:u==="large",[`${x}-spinning`]:D,[`${x}-show-text`]:!!f,[`${x}-rtl`]:C==="rtl"},a,!v&&l,F,L),Y=Ze(`${x}-container`,{[`${x}-blur`]:D}),ae=(e=S??O)!==null&&e!==void 0?e:Bx,U=Object.assign(Object.assign({},A),g),z=_.createElement("div",Object.assign({},E,{style:U,className:X,"aria-live":"polite","aria-busy":D}),_.createElement(Q7,{prefixCls:x,indicator:ae,percent:B}),f&&(W||v)?_.createElement("div",{className:`${x}-text`},f):null);return N(W?_.createElement("div",Object.assign({},E,{className:Ze(`${x}-nested-loading`,h,F,L)}),D&&_.createElement("div",{key:"loading"},z),_.createElement("div",{className:Y,key:"container"},m)):v?_.createElement("div",{className:Ze(`${x}-fullscreen`,{[`${x}-fullscreen-show`]:D},l,F,L)},z):z)};Ux.setDefaultIndicator=t=>{Bx=t};function Dh(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function o9(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function Lx(t){let e,n,r;t.length!==2?(e=Dh,n=(u,f)=>Dh(t(u),f),r=(u,f)=>t(u)-f):(e=t===Dh||t===o9?t:l9,n=t,r=t);function i(u,f,h=0,g=u.length){if(h>>1;n(u[m],f)<0?h=m+1:g=m}while(h>>1;n(u[m],f)<=0?h=m+1:g=m}while(hh&&r(u[m-1],f)>-r(u[m],f)?m-1:m}return{left:i,center:l,right:a}}function l9(){return 0}function c9(t){return t===null?NaN:+t}const u9=Lx(Dh),f9=u9.right;Lx(c9).center;const d9=Math.sqrt(50),h9=Math.sqrt(10),g9=Math.sqrt(2);function ng(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),l=a>=d9?10:a>=h9?5:a>=g9?2:1;let u,f,h;return i<0?(h=Math.pow(10,-i)/l,u=Math.round(t*h),f=Math.round(e*h),u/he&&--f,h=-h):(h=Math.pow(10,i)*l,u=Math.round(t/h),f=Math.round(e/h),u*he&&--f),f0))return[];if(t===e)return[t];const r=e=i))return[];const u=a-i+1,f=new Array(u);if(r)if(l<0)for(let h=0;h>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?fh(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?fh(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=y9.exec(t))?new Kr(e[1],e[2],e[3],1):(e=b9.exec(t))?new Kr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=S9.exec(t))?fh(e[1],e[2],e[3],e[4]):(e=E9.exec(t))?fh(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=w9.exec(t))?xC(e[1],e[2]/100,e[3]/100,1):(e=T9.exec(t))?xC(e[1],e[2]/100,e[3]/100,e[4]):EC.hasOwnProperty(t)?CC(EC[t]):t==="transparent"?new Kr(NaN,NaN,NaN,0):null}function CC(t){return new Kr(t>>16&255,t>>8&255,t&255,1)}function fh(t,e,n,r){return r<=0&&(t=e=n=NaN),new Kr(t,e,n,r)}function R9(t){return t instanceof qf||(t=xf(t)),t?(t=t.rgb(),new Kr(t.r,t.g,t.b,t.opacity)):new Kr}function O_(t,e,n,r){return arguments.length===1?R9(t):new Kr(t,e,n,r??1)}function Kr(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}ib(Kr,O_,zx(qf,{brighter(t){return t=t==null?rg:Math.pow(rg,t),new Kr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Af:Math.pow(Af,t),new Kr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Kr(Io(this.r),Io(this.g),Io(this.b),ig(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:AC,formatHex:AC,formatHex8:x9,formatRgb:RC,toString:RC}));function AC(){return`#${So(this.r)}${So(this.g)}${So(this.b)}`}function x9(){return`#${So(this.r)}${So(this.g)}${So(this.b)}${So((isNaN(this.opacity)?1:this.opacity)*255)}`}function RC(){const t=ig(this.opacity);return`${t===1?"rgb(":"rgba("}${Io(this.r)}, ${Io(this.g)}, ${Io(this.b)}${t===1?")":`, ${t})`}`}function ig(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Io(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function So(t){return t=Io(t),(t<16?"0":"")+t.toString(16)}function xC(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ki(t,e,n,r)}function $x(t){if(t instanceof Ki)return new Ki(t.h,t.s,t.l,t.opacity);if(t instanceof qf||(t=xf(t)),!t)return new Ki;if(t instanceof Ki)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),l=NaN,u=a-i,f=(a+i)/2;return u?(e===a?l=(n-r)/u+(n0&&f<1?0:l,new Ki(l,u,f,t.opacity)}function M9(t,e,n,r){return arguments.length===1?$x(t):new Ki(t,e,n,r??1)}function Ki(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ib(Ki,M9,zx(qf,{brighter(t){return t=t==null?rg:Math.pow(rg,t),new Ki(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Af:Math.pow(Af,t),new Ki(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Kr($v(t>=240?t-240:t+120,i,r),$v(t,i,r),$v(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ki(MC(this.h),dh(this.s),dh(this.l),ig(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ig(this.opacity);return`${t===1?"hsl(":"hsla("}${MC(this.h)}, ${dh(this.s)*100}%, ${dh(this.l)*100}%${t===1?")":`, ${t})`}`}}));function MC(t){return t=(t||0)%360,t<0?t+360:t}function dh(t){return Math.max(0,Math.min(1,t||0))}function $v(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const sb=t=>()=>t;function O9(t,e){return function(n){return t+n*e}}function P9(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function N9(t){return(t=+t)==1?Vx:function(e,n){return n-e?P9(e,n,t):sb(isNaN(e)?n:e)}}function Vx(t,e){var n=e-t;return n?O9(t,n):sb(isNaN(t)?e:t)}const OC=function t(e){var n=N9(e);function r(i,a){var l=n((i=O_(i)).r,(a=O_(a)).r),u=n(i.g,a.g),f=n(i.b,a.b),h=Vx(i.opacity,a.opacity);return function(g){return i.r=l(g),i.g=u(g),i.b=f(g),i.opacity=h(g),i+""}}return r.gamma=t,r}(1);function I9(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(a){for(i=0;in&&(a=e.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(r=r[0])===(i=i[0])?u[l]?u[l]+=i:u[++l]=i:(u[++l]=null,f.push({i:l,x:sg(r,i)})),n=Vv.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function W9(t,e,n){var r=t[0],i=t[1],a=e[0],l=e[1];return i2?X9:W9,f=h=null,m}function m(v){return v==null||isNaN(v=+v)?a:(f||(f=u(t.map(r),e,n)))(r(l(v)))}return m.invert=function(v){return l(i((h||(h=u(e,t.map(r),sg)))(v)))},m.domain=function(v){return arguments.length?(t=Array.from(v,H9),g()):t.slice()},m.range=function(v){return arguments.length?(e=Array.from(v),g()):e.slice()},m.rangeRound=function(v){return e=Array.from(v),n=$9,g()},m.clamp=function(v){return arguments.length?(l=v?!0:Xl,g()):l!==Xl},m.interpolate=function(v){return arguments.length?(n=v,g()):n},m.unknown=function(v){return arguments.length?(a=v,m):a},function(v,S){return r=v,i=S,g()}}function K9(){return Y9()(Xl,Xl)}function Z9(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function ag(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ac(t){return t=ag(Math.abs(t)),t?t[1]:NaN}function Q9(t,e){return function(n,r){for(var i=n.length,a=[],l=0,u=t[0],f=0;i>0&&u>0&&(f+u+1>r&&(u=Math.max(1,r-f)),a.push(n.substring(i-=u,i+u)),!((f+=u+1)>r));)u=t[l=(l+1)%t.length];return a.reverse().join(e)}}function G9(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var J9=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function og(t){if(!(e=J9.exec(t)))throw new Error("invalid format: "+t);var e;return new ob({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}og.prototype=ob.prototype;function ob(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}ob.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ez(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Hx;function tz(t,e){var n=ag(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Hx=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=r.length;return a===l?r:a>l?r+new Array(a-l+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ag(t,Math.max(0,e+a-1))[0]}function NC(t,e){var n=ag(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const IC={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Z9,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>NC(t*100,e),r:NC,s:tz,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function DC(t){return t}var FC=Array.prototype.map,kC=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nz(t){var e=t.grouping===void 0||t.thousands===void 0?DC:Q9(FC.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?DC:G9(FC.call(t.numerals,String)),l=t.percent===void 0?"%":t.percent+"",u=t.minus===void 0?"−":t.minus+"",f=t.nan===void 0?"NaN":t.nan+"";function h(m){m=og(m);var v=m.fill,S=m.align,w=m.sign,E=m.symbol,b=m.zero,C=m.width,T=m.comma,A=m.precision,O=m.trim,x=m.type;x==="n"?(T=!0,x="g"):IC[x]||(A===void 0&&(A=12),O=!0,x="g"),(b||v==="0"&&S==="=")&&(b=!0,v="0",S="=");var N=E==="$"?n:E==="#"&&/[boxX]/.test(x)?"0"+x.toLowerCase():"",F=E==="$"?r:/[%p]/.test(x)?l:"",L=IC[x],D=/[defgprs%]/.test(x);A=A===void 0?6:/[gprs]/.test(x)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function V(B){var W=N,X=F,Y,ae,U;if(x==="c")X=L(B)+X,B="";else{B=+B;var z=B<0||1/B<0;if(B=isNaN(B)?f:L(Math.abs(B),A),O&&(B=ez(B)),z&&+B==0&&w!=="+"&&(z=!1),W=(z?w==="("?w:u:w==="-"||w==="("?"":w)+W,X=(x==="s"?kC[8+Hx/3]:"")+X+(z&&w==="("?")":""),D){for(Y=-1,ae=B.length;++YU||U>57){X=(U===46?i+B.slice(Y+1):B.slice(Y))+X,B=B.slice(0,Y);break}}}T&&!b&&(B=e(B,1/0));var j=W.length+B.length+X.length,Z=j>1)+W+B+X+Z.slice(j);break;default:B=Z+W+B+X;break}return a(B)}return V.toString=function(){return m+""},V}function g(m,v){var S=h((m=og(m),m.type="f",m)),w=Math.max(-8,Math.min(8,Math.floor(Ac(v)/3)))*3,E=Math.pow(10,-w),b=kC[8+w/3];return function(C){return S(E*C)+b}}return{format:h,formatPrefix:g}}var hh,jx,Wx;rz({thousands:",",grouping:[3],currency:["$",""]});function rz(t){return hh=nz(t),jx=hh.format,Wx=hh.formatPrefix,hh}function iz(t){return Math.max(0,-Ac(Math.abs(t)))}function sz(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ac(e)/3)))*3-Ac(Math.abs(t)))}function az(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ac(e)-Ac(t))+1}function oz(t,e,n,r){var i=m9(t,e,n),a;switch(r=og(r??",f"),r.type){case"s":{var l=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(a=sz(i,l))&&(r.precision=a),Wx(r,l)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=az(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=iz(i))&&(r.precision=a-(r.type==="%")*2);break}}return jx(r)}function lz(t){var e=t.domain;return t.ticks=function(n){var r=e();return p9(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return oz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,a=r.length-1,l=r[i],u=r[a],f,h,g=10;for(u0;){if(h=M_(l,u,n),h===f)return r[i]=l,r[a]=u,e(r);if(h>0)l=Math.floor(l/h)*h,u=Math.ceil(u/h)*h;else if(h<0)l=Math.ceil(l*h)/h,u=Math.floor(u*h)/h;else break;f=h}return t},t}function lb(){var t=K9();return t.copy=function(){return q9(t,lb())},v9.apply(t,arguments),lz(t)}function sp(t){for(var e=t.length/6|0,n=new Array(e),r=0;r{try{n.onload=()=>r(n),n.onerror=a=>{const l=a instanceof Error?a.message:"error";i(new Error(l))}}catch(a){i(a)}})}const Sz={};let UC=!0;async function Ez(t,e,n){let r;cb(n)?r=await qx(t,e,n):r=Xx(t,n);const i=e&&e.imagebitmap;return await wz(r,i)}async function wz(t,e=null){if((Tz(e)||!UC)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(n){console.warn(n),UC=!1}return await createImageBitmap(t)}function Tz(t){for(const e in t||Sz)return!1;return!0}function Cz(t){return!Mz(t,"ftyp",4)||!(t[8]&96)?null:Az(t)}function Az(t){switch(Rz(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Rz(t,e,n){return String.fromCharCode(...t.slice(e,n))}function xz(t){return[...t].map(e=>e.charCodeAt(0))}function Mz(t,e,n=0){const r=xz(e);for(let i=0;i=24&&e.getUint32(0,ms)===2303741511?{mimeType:"image/png",width:e.getUint32(16,ms),height:e.getUint32(20,ms)}:null}function Nz(t){const e=Yf(t);return e.byteLength>=10&&e.getUint32(0,ms)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,rf),height:e.getUint16(8,rf)}:null}function Iz(t){const e=Yf(t);return e.byteLength>=14&&e.getUint16(0,ms)===16973&&e.getUint32(2,rf)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,rf),height:e.getUint32(22,rf)}:null}function Dz(t){const e=Yf(t);if(!(e.byteLength>=3&&e.getUint16(0,ms)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:r,sofMarkers:i}=Fz();let a=2;for(;a+9!!Yx(new DataView(t))],options:$z},Sn=new Lf({id:"deck"});let k_={};function Hz(t){k_=t}function Hr(t,e,n,r){Sn.level>0&&k_[t]&&k_[t].call(null,e,n,r)}function jz(t){const e=t[0],n=t[t.length-1];return e==="{"&&n==="}"||e==="["&&n==="]"}const Wz={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:jz,parseTextSync:JSON.parse};function Xz(){const t="9.1.1",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(Sn.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:Sn,_registerLoggers:Hz},K6([Wz,[Vz,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}const qz=Xz();function ub(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}const Hv={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function Yz(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Kz(r);return e}function Kz(t){let e=LC(t);if(e!=="object")return{value:t,...Hv[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...Hv[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=LC(t.value),{...t,...Hv[e],type:e}):{type:"object",value:null};throw new Error("props")}function LC(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}const Zz=`#ifdef MODULE_LOGDEPTH + logdepth_adjustPosition(gl_Position); +#endif +`,Qz=`#ifdef MODULE_MATERIAL + fragColor = material_filterColor(fragColor); +#endif + +#ifdef MODULE_LIGHTING + fragColor = lighting_filterColor(fragColor); +#endif + +#ifdef MODULE_FOG + fragColor = fog_filterColor(fragColor); +#endif + +#ifdef MODULE_PICKING + fragColor = picking_filterHighlightColor(fragColor); + fragColor = picking_filterPickingColor(fragColor); +#endif + +#ifdef MODULE_LOGDEPTH + logdepth_setFragDepth(); +#endif +`,Gz={vertex:Zz,fragment:Qz},zC=/void\s+main\s*\([^)]*\)\s*\{\n?/,$C=/}\n?[^{}]*$/,jv=[],Fh="__LUMA_INJECT_DECLARATIONS__";function Jz(t){const e={vertex:{},fragment:{}};for(const n in t){let r=t[n];const i=e$(n);typeof r=="string"&&(r={order:0,injection:r}),e[i][n]=r}return e}function e$(t){const e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function lg(t,e,n,r=!1){const i=e==="vertex";for(const a in n){const l=n[a];l.sort((f,h)=>f.order-h.order),jv.length=l.length;for(let f=0,h=l.length;ff+u));break;case"vs:#main-end":i&&(t=t.replace($C,f=>u+f));break;case"fs:#decl":i||(t=t.replace(Fh,u));break;case"fs:#main-start":i||(t=t.replace(zC,f=>f+u));break;case"fs:#main-end":i||(t=t.replace($C,f=>u+f));break;default:t=t.replace(a,f=>f+u)}}return t=t.replace(Fh,""),r&&(t=t.replace(/\}\s*$/,a=>a+Gz[e])),t}function cg(t){t.map(e=>t$(e))}function t$(t){if(t.instance)return;cg(t.dependencies||[]);const{propTypes:e={},deprecations:n=[],inject:r={}}=t,i={normalizedInjections:Jz(r),parsedDeprecations:n$(n)};e&&(i.propValidators=Yz(e)),t.instance=i;let a={};e&&(a=Object.entries(e).reduce((l,[u,f])=>{const h=f==null?void 0:f.value;return h&&(l[u]=h),l},{})),t.defaultUniforms={...t.defaultUniforms,...a}}function Kx(t,e,n){var r;(r=t.deprecations)==null||r.forEach(i=>{var a;(a=i.regex)!=null&&a.test(e)&&(i.deprecated?n.deprecated(i.old,i.new)():n.removed(i.old,i.new)())})}function n$(t){return t.forEach(e=>{switch(e.type){case"function":e.regex=new RegExp(`\\b${e.old}\\(`);break;default:e.regex=new RegExp(`${e.type} ${e.old};`)}}),t}function fb(t){cg(t);const e={},n={};Zx({modules:t,level:0,moduleMap:e,moduleDepth:n});const r=Object.keys(n).sort((i,a)=>n[a]-n[i]).map(i=>e[i]);return cg(r),r}function Zx(t){const{modules:e,level:n,moduleMap:r,moduleDepth:i}=t;if(n>=5)throw new Error("Possible loop in shader dependency graph");for(const a of e)r[a.name]=a,(i[a.name]===void 0||i[a.name]l.order-u.order);for(const l of a)n+=` ${l.injection} +`}i.footer&&(n+=` ${i.footer}`),n+=`} +`}return n}function Jx(t){const e={vertex:{},fragment:{}};for(const n of t){let r,i;typeof n!="string"?(r=n,i=r.hook):(r={},i=n),i=i.trim();const[a,l]=i.split(":"),u=i.replace(/\(.+/,""),f=Object.assign(r,{signature:l});switch(a){case"vs":e.vertex[u]=f;break;case"fs":e.fragment[u]=f;break;default:throw new Error(a)}}return e}function o$(t,e){return{name:l$(t,e),language:"glsl",version:c$(t)}}function l$(t,e="unnamed"){const r=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(t);return r?r[1]:e}function c$(t){let e=100;const n=t.match(/[^\s]+/g);if(n&&n.length>=2&&n[0]==="#version"){const r=parseInt(n[1],10);Number.isFinite(r)&&(e=r)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}const eM=` + +${Fh} +`,u$=`precision highp float; +`;function f$(t){const e=fb(t.modules||[]);return{source:h$(t.platformInfo,{...t,source:t.source,stage:"vertex",modules:e}),getUniforms:tM(e)}}function d$(t){const{vs:e,fs:n}=t,r=fb(t.modules||[]);return{vs:HC(t.platformInfo,{...t,source:e,stage:"vertex",modules:r}),fs:HC(t.platformInfo,{...t,source:n,stage:"fragment",modules:r}),getUniforms:tM(r)}}function h$(t,e){var E;const{source:n,stage:r,modules:i,hookFunctions:a=[],inject:l={},log:u}=e;ub(typeof n=="string","shader source must be a string");const f=n;let h="";const g=Jx(a),m={},v={},S={};for(const b in l){const C=typeof l[b]=="string"?{injection:l[b],order:0}:l[b],T=/^(v|f)s:(#)?([\w-]+)$/.exec(b);if(T){const A=T[2],O=T[3];A?O==="decl"?v[b]=[C]:S[b]=[C]:m[b]=[C]}else S[b]=[C]}const w=i;for(const b of w){u&&Kx(b,f,u);const C=nM(b,"wgsl");h+=C;const T=((E=b.injections)==null?void 0:E[r])||{};for(const A in T){const O=/^(v|f)s:#([\w-]+)$/.exec(A);if(O){const N=O[2]==="decl"?v:S;N[A]=N[A]||[],N[A].push(T[A])}else m[A]=m[A]||[],m[A].push(T[A])}}return h+=eM,h=lg(h,r,v),h+=Gx(g[r],m),h+=f,h=lg(h,r,S),h}function HC(t,e){var F;const{id:n,source:r,stage:i,language:a="glsl",modules:l,defines:u={},hookFunctions:f=[],inject:h={},prologue:g=!0,log:m}=e;ub(typeof r=="string","shader source must be a string");const v=a==="glsl"?o$(r).version:-1,S=t.shaderLanguageVersion,w=v===100?"#version 100":"#version 300 es",b=r.split(` +`).slice(1).join(` +`),C={};l.forEach(L=>{Object.assign(C,L.defines)}),Object.assign(C,u);let T="";switch(a){case"wgsl":break;case"glsl":T=g?`${w} + +// ----- PROLOGUE ------------------------- +${g$({id:n,source:r,stage:i})} +${`#define SHADER_TYPE_${i.toUpperCase()}`} + +${r$(t)} +${i==="fragment"?u$:""} + +// ----- APPLICATION DEFINES ------------------------- + +${p$(C)} + +`:`${w} +`;break}const A=Jx(f),O={},x={},N={};for(const L in h){const D=typeof h[L]=="string"?{injection:h[L],order:0}:h[L],V=/^(v|f)s:(#)?([\w-]+)$/.exec(L);if(V){const B=V[2],W=V[3];B?W==="decl"?x[L]=[D]:N[L]=[D]:O[L]=[D]}else N[L]=[D]}for(const L of l){m&&Kx(L,b,m);const D=nM(L,i);T+=D;const V=((F=L.instance)==null?void 0:F.normalizedInjections[i])||{};for(const B in V){const W=/^(v|f)s:#([\w-]+)$/.exec(B);if(W){const Y=W[2]==="decl"?x:N;Y[B]=Y[B]||[],Y[B].push(V[B])}else O[B]=O[B]||[],O[B].push(V[B])}}return T+="// ----- MAIN SHADER SOURCE -------------------------",T+=eM,T=lg(T,i,x),T+=Gx(A[i],O),T+=b,T=lg(T,i,N),a==="glsl"&&v!==S&&(T=i$(T,i)),T.trim()}function tM(t){return function(n){var i;const r={};for(const a of t){const l=(i=a.getUniforms)==null?void 0:i.call(a,n,r);Object.assign(r,l)}return r}}function g$(t){const{id:e,source:n,stage:r}=t;return e&&n.indexOf("SHADER_NAME")===-1?` +#define SHADER_NAME ${e}_${r}`:""}function p$(t={}){let e="";for(const n in t){const r=t[n];(r||Number.isFinite(r))&&(e+=`#define ${n.toUpperCase()} ${t[n]} +`)}return e}function nM(t,e){let n;switch(e){case"vertex":n=t.vs||"";break;case"fragment":n=t.fs||"";break;case"wgsl":n=t.source||"";break;default:ub(!1)}if(!t.name)throw new Error("Shader module must have a name");const r=t.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");let i=`// ----- MODULE ${t.name} --------------- + +`;return e!=="wgsl"&&(i+=`#define MODULE_${r} +`),i+=`${n} +`,i}const m$=/^\s*\#\s*ifdef\s*([a-zA-Z_]+)\s*$/,v$=/^\s*\#\s*endif\s*$/;function _$(t,e){var l;const n=t.split(` +`),r=[];let i=!0,a=null;for(const u of n){const f=u.match(m$),h=u.match(v$);f?(a=f[1],i=!!((l=e==null?void 0:e.defines)!=null&&l[a])):h?i=!0:i&&r.push(u)}return r.join(` +`)}const yo=class yo{constructor(){M(this,"_hookFunctions",[]);M(this,"_defaultModules",[])}static getDefaultShaderAssembler(){return yo.defaultShaderAssembler=yo.defaultShaderAssembler||new yo,yo.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(n=>n.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){const n=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(r=>r.name!==n)}addShaderHook(e,n){n&&(e=Object.assign(n,{hook:e})),this._hookFunctions.push(e)}assembleWGSLShader(e){const n=this._getModuleList(e.modules),r=this._hookFunctions,{source:i,getUniforms:a}=f$({...e,source:e.source,modules:n,hookFunctions:r});return{source:e.platformInfo.shaderLanguage==="wgsl"?_$(i):i,getUniforms:a,modules:n}}assembleGLSLShaderPair(e){const n=this._getModuleList(e.modules),r=this._hookFunctions;return{...d$({...e,vs:e.vs,fs:e.fs,modules:n,hookFunctions:r}),modules:n}}_getModuleList(e=[]){const n=new Array(this._defaultModules.length+e.length),r={};let i=0;for(let a=0,l=this._defaultModules.length;at.startsWith(e))}function db(t){let e=I$(t);if(aM(t)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;const r=D$(t);r&&(e.blockWidth=r.blockWidth,e.blockHeight=r.blockHeight)}const n=N$.exec(t);if(n){const[,r,i,a,l,u]=n,f=`${a}${i}`,h=iM(f),g=h.byteLength*8,m=r.length,v=[g,m>=2?g:0,m>=3?g:0,m>=4?g:0];e={format:t,attachment:e.attachment,dataType:h.dataType,components:m,channels:r,integer:h.integer,signed:h.signed,normalized:h.normalized,bitsPerChannel:v,bytesPerPixel:h.byteLength*r.length,packed:e.packed,srgb:e.srgb},u==="-webgl"&&(e.webgl=!0),l==="-srgb"&&(e.srgb=!0)}return t.endsWith("-webgl")&&(e.webgl=!0),t.endsWith("-srgb")&&(e.srgb=!0),e}function I$(t){var a;const e=sM(t),n=e.bytesPerPixel||1,r=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:t,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||((a=e.channels)==null?void 0:a.length)||1,bytesPerPixel:n,bitsPerChannel:r,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function D$(t){const n=/.*-(\d+)x(\d+)-.*/.exec(t);if(n){const[,r,i]=n;return{blockWidth:Number(r),blockHeight:Number(i)}}return null}function F$(t){const e=sM(t),n={format:t,create:e.f??!0,render:e.render??!0,filter:e.filter??!0,blend:e.blend??!0,store:e.store??!0},r=db(t),i=t.startsWith("depth")||t.startsWith("stencil"),a=r==null?void 0:r.signed,l=r==null?void 0:r.integer,u=r==null?void 0:r.webgl;return n.render&&(n.render=!a),n.filter&&(n.filter=!i&&!a&&!l&&!u),n}class k${}class B${constructor(e=[],n){M(this,"features");M(this,"disabledFeatures");this.features=new Set(e),this.disabledFeatures=n||{}}*[Symbol.iterator](){yield*this.features}has(e){var n;return!((n=this.disabledFeatures)!=null&&n[e])&&this.features.has(e)}}const Pg=class Pg{constructor(e){M(this,"id");M(this,"props");M(this,"userData",{});M(this,"statsManager",rM);M(this,"timestamp",0);M(this,"_reused",!1);M(this,"_lumaData",{});this.props={...Pg.defaultProps,...e},this.id=this.props.id||op(this[Symbol.toStringTag].toLowerCase())}get[Symbol.toStringTag](){return"Device"}getTextureFormatCapabilities(e){const n=F$(e),r=l=>(typeof l=="string"?this.features.has(l):l)??!0,i=r(n.create),a={format:e,create:i,render:i&&r(n.render),filter:i&&r(n.filter),blend:i&&r(n.blend),store:i&&r(n.store)};return this._getDeviceSpecificTextureFormatCapabilities(a)}isTextureFormatSupported(e,n){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return aM(e)}loseDevice(){return!1}reportError(e){this.props.onError(e)}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createCommandEncoder(e={}){throw new Error("not implemented")}incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,n){throw new Error("not implemented")}readPixelsToBufferWebGL(e,n){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,n){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const n={...e};return(e.usage||0)&$n.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?n.indexType="uint32":e.data instanceof Uint16Array?n.indexType="uint16":Re.warn("indices buffer content must be of integer type")()),n}};M(Pg,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:e=>Re.error(e.message)(),_reuseDevices:!1,_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:Re.get("debug")||void 0,debugShaders:Re.get("debug-shaders")||void 0,debugFramebuffers:!!Re.get("debug-framebuffers"),debugWebGL:!!Re.get("debug-webgl"),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0});let Ua=Pg;const U$=Ho()&&typeof document<"u",L$=()=>U$&&document.readyState==="complete",z$="set luma.log.level=1 (or higher) to trace rendering",XC="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Ta=class Ta{constructor(){M(this,"stats",rM);M(this,"log",Re);M(this,"VERSION","9.1.2");M(this,"spector");M(this,"preregisteredAdapters",new Map);if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw Re.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),Re.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");Re.error("This version of luma.gl has already been initialized")()}Re.log(1,`${this.VERSION} - ${z$}`)(),globalThis.luma=this}registerAdapters(e){for(const n of e)this.preregisteredAdapters.set(n.type,n)}getSupportedAdapters(e=[]){const n=this.getAdapterMap(e);return Array.from(n).map(([,r])=>r).filter(r=>{var i;return(i=r.isSupported)==null?void 0:i.call(r)}).map(r=>r.type)}getBestAvailableAdapter(e=[]){var r,i,a,l;const n=this.getAdapterMap(e);return(i=(r=n.get("webgpu"))==null?void 0:r.isSupported)!=null&&i.call(r)?"webgpu":(l=(a=n.get("webgl"))==null?void 0:a.isSupported)!=null&&l.call(a)?"webgl":null}setDefaultDeviceProps(e){Object.assign(Ta.defaultProps,e)}async createDevice(e={}){var u;e={...Ta.defaultProps,...e},e.waitForPageLoad&&await Ta.pageLoaded;const n=this.getAdapterMap(e.adapters);let r=e.type||"";r==="best-available"&&(r=this.getBestAvailableAdapter(e.adapters)||r);const a=(this.getAdapterMap(e.adapters)||n).get(r),l=await((u=a==null?void 0:a.create)==null?void 0:u.call(a,e));if(l)return l;throw new Error(XC)}async attachDevice(e){var l;const n=this.getAdapterMap(e.adapters);let r="";e.handle instanceof WebGL2RenderingContext&&(r="webgl"),e.createCanvasContext&&await Ta.pageLoaded,e.handle===null&&(r="unknown");const i=n.get(r),a=await((l=i==null?void 0:i.attach)==null?void 0:l.call(i,null));if(a)return a;throw new Error(XC)}enforceWebGL2(e=!0,n=[]){var a;const i=this.getAdapterMap(n).get("webgl");i||Re.warn("enforceWebGL2: webgl adapter not found")(),(a=i==null?void 0:i.enforceWebGL2)==null||a.call(i,e)}getAdapterMap(e=[]){const n=new Map(this.preregisteredAdapters);for(const r of e)n.set(r.type,r);return n}registerDevices(e){Re.warn("luma.registerDevices() is deprecated, use luma.registerAdapters() instead");for(const n of e){const r=n.adapter;r&&this.preregisteredAdapters.set(r.type,r)}}};M(Ta,"defaultProps",{...Ua.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0}),M(Ta,"pageLoaded",$$().then(()=>{Re.probe(2,"DOM is loaded")()}));let U_=Ta;const L_=new U_;function $$(){return L$()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}class V${}const Ng=class Ng{constructor(e){M(this,"id");M(this,"props");M(this,"canvas");M(this,"htmlCanvas");M(this,"offscreenCanvas");M(this,"type");M(this,"width",1);M(this,"height",1);M(this,"resizeObserver");M(this,"_canvasSizeInfo",{clientWidth:0,clientHeight:0,devicePixelRatio:1});if(this.props={...Ng.defaultProps,...e},e=this.props,!Ho()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=j$(e.canvas):this.canvas=e.canvas;else{const n=W$(e),r=H$((e==null?void 0:e.container)||null);r.insertBefore(n,r.firstChild),this.canvas=n,e!=null&&e.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(n=>{for(const r of n)r.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":const e=this.getDevicePixelRatio(),n=this.canvas;return n.parentElement?[n.clientWidth*e,n.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){const[e,n]=this.getPixelSize();return e/n}cssToDeviceRatio(){var e;try{const[n]=this.getDrawingBufferSize(),r=this._canvasSizeInfo.clientWidth||((e=this.htmlCanvas)==null?void 0:e.clientWidth);return r?n/r:1}catch{return 1}}cssToDevicePixels(e,n=!0){const r=this.cssToDeviceRatio(),[i,a]=this.getDrawingBufferSize();return X$(e,r,i,a,n)}setDevicePixelRatio(e,n={}){if(!this.htmlCanvas)return;let r="width"in n?n.width:this.htmlCanvas.clientWidth,i="height"in n?n.height:this.htmlCanvas.clientHeight;(!r||!i)&&(Re.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,r=this.htmlCanvas.width||1,i=this.htmlCanvas.height||1);const a=this._canvasSizeInfo;if(a.clientWidth!==r||a.clientHeight!==i||a.devicePixelRatio!==e){let l=e;const u=Math.floor(r*l),f=Math.floor(i*l);if(this.htmlCanvas.width=u,this.htmlCanvas.height=f,this.device.gl){const[g,m]=this.getDrawingBufferSize();(g!==u||m!==f)&&(l=Math.min(g/r,m/i),this.htmlCanvas.width=Math.floor(r*l),this.htmlCanvas.height=Math.floor(i*l),Re.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=r,this._canvasSizeInfo.clientHeight=i,this._canvasSizeInfo.devicePixelRatio=e}}}getDrawingBufferSize(){const e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){var n;((n=this.htmlCanvas)==null?void 0:n.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};M(Ng,"defaultProps",{canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb"});let z_=Ng;function H$(t){if(typeof t=="string"){const e=document.getElementById(t);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function j$(t){const e=document.getElementById(t);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function W$(t){const{width:e,height:n}=t,r=document.createElement("canvas");return r.id=op("lumagl-auto-created-canvas"),r.width=e||1,r.height=n||1,r.style.width=Number.isFinite(e)?`${e}px`:"100%",r.style.height=Number.isFinite(n)?`${n}px`:"100%",r}function X$(t,e,n,r,i){const a=t,l=qC(a[0],e,n);let u=YC(a[1],e,r,i),f=qC(a[0]+1,e,n);const h=f===n-1?f:f-1;f=YC(a[1]+1,e,r,i);let g;return i?(f=f===0?f:f+1,g=u,u=f):g=f===r-1?f:f-1,{x:l,y:u,width:Math.max(h-l+1,1),height:Math.max(g-u+1,1)}}function qC(t,e,n){return Math.min(Math.round(t*e),n-1)}function YC(t,e,n,r){return r?Math.max(0,n-1-Math.round(t*e)):Math.min(Math.round(t*e),n-1)}const Ar=class Ar extends mn{constructor(n,r){r=Ar.normalizeProps(n,r);super(n,r,Ar.defaultProps);M(this,"dimension");M(this,"format");M(this,"width");M(this,"height");M(this,"depth");M(this,"mipLevels");M(this,"updateTimestamp");if(this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.props.width===void 0||this.props.height===void 0){const i=Ar.getTextureDataSize(this.props.data);this.width=(i==null?void 0:i.width)||1,this.height=(i==null?void 0:i.height)||1}this.props.mipmaps&&this.props.mipLevels===void 0&&(this.props.mipLevels="pyramid"),this.mipLevels=this.props.mipLevels==="pyramid"?Ar.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=n.incrementTimestamp()}get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}clone(n){return this.device.createTexture({...this.props,...n})}static isExternalImage(n){return typeof ImageData<"u"&&n instanceof ImageData||typeof ImageBitmap<"u"&&n instanceof ImageBitmap||typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement||typeof VideoFrame<"u"&&n instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}static getExternalImageSize(n){if(typeof ImageData<"u"&&n instanceof ImageData||typeof ImageBitmap<"u"&&n instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height};if(typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement)return{width:n.naturalWidth,height:n.naturalHeight};if(typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement)return{width:n.videoWidth,height:n.videoHeight};if(typeof VideoFrame<"u"&&n instanceof VideoFrame)return{width:n.displayWidth,height:n.displayHeight};throw new Error("Unknown image type")}static isTextureLevelData(n){const r=n==null?void 0:n.data;return ArrayBuffer.isView(r)}static getTextureDataSize(n){if(!n||ArrayBuffer.isView(n))return null;if(Array.isArray(n))return Ar.getTextureDataSize(n[0]);if(Ar.isExternalImage(n))return Ar.getExternalImageSize(n);if(n&&typeof n=="object"&&n.constructor===Object){const i=Object.values(n)[0];return{width:i.width,height:i.height}}throw new Error("texture size deduction failed")}static normalizeTextureData(n,r){let i;return ArrayBuffer.isView(n)?i=[{data:n,width:r.width,height:r.height}]:Array.isArray(n)?i=n:i=[n],i}static getMipLevelCount(n,r){return Math.floor(Math.log2(Math.max(n,r)))+1}static getCubeFaceDepth(n){switch(n){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw new Error(n)}}static normalizeProps(n,r){var f,h;const i={...r},a=((h=(f=n==null?void 0:n.props)==null?void 0:f._resourceDefaults)==null?void 0:h.texture)||{};Object.assign(i,a);const{width:l,height:u}=i;return typeof l=="number"&&(i.width=Math.max(1,Math.ceil(l))),typeof u=="number"&&(i.height=Math.max(1,Math.ceil(u))),i}};M(Ar,"COPY_SRC",1),M(Ar,"COPY_DST",2),M(Ar,"TEXTURE",4),M(Ar,"STORAGE",8),M(Ar,"RENDER_ATTACHMENT",16),M(Ar,"CubeFaces",["+X","-X","+Y","-Y","+Z","-Z"]),M(Ar,"defaultProps",{...mn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0,flipY:void 0}),M(Ar,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1});let Kn=Ar;const Ig=class Ig extends mn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,n){super(e,n,Ig.defaultProps)}};M(Ig,"defaultProps",{...mn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});let fg=Ig;function q$(t,e,n){let r="";const i=e.split(/\r?\n/),a=t.slice().sort((l,u)=>l.lineNum-u.lineNum);switch((n==null?void 0:n.showSourceCode)||"no"){case"all":let l=0;for(let u=1;u<=i.length;u++)for(r+=oM(i[u-1],u,n);a.length>l&&a[l].lineNum===u;){const f=a[l++];r+=KC(f,i,f.lineNum,{...n,inlineSource:!1})}return r;case"issues":case"no":for(const u of t)r+=KC(u,i,u.lineNum,{inlineSource:(n==null?void 0:n.showSourceCode)!=="no"});return r}}function KC(t,e,n,r){if(r!=null&&r.inlineSource){const a=Y$(e,n),l=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^ +`:"";return` +${a}${l}${t.type.toUpperCase()}: ${t.message} + +`}const i=t.type==="error"?"red":"#8B4000";return r!=null&&r.html?`
${t.type.toUpperCase()}: ${t.message}
`:`${t.type.toUpperCase()}: ${t.message}`}function Y$(t,e,n){let r="";for(let i=e-2;i<=e;i++){const a=t[i-1];a!==void 0&&(r+=oM(a,e,n))}return r}function oM(t,e,n){const r=n!=null&&n.html?Z$(t):t;return`${K$(String(e),4)}: ${r}${n!=null&&n.html?"
":` +`}`}function K$(t,e){let n="";for(let r=t.length;r",">").replaceAll('"',""").replaceAll("'","'")}const Dg=class Dg extends mn{constructor(n,r){r={...r,debugShaders:r.debugShaders||n.props.debugShaders||"errors"};super(n,{id:Q$(r),...r},Dg.defaultProps);M(this,"stage");M(this,"source");M(this,"compilationStatus","pending");this.stage=this.props.stage,this.source=this.props.source}get[Symbol.toStringTag](){return"Shader"}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){const n=this.props.debugShaders;switch(n){case"never":return;case"errors":if(this.compilationStatus==="success")return;break}const r=await this.getCompilationInfo();n==="warnings"&&(r==null?void 0:r.length)===0||this._displayShaderLog(r)}_displayShaderLog(n){var h;if(typeof document>"u"||!(document!=null&&document.createElement))return;const r=lM(this.source),i=`${this.stage} ${r}`;let a=q$(n,this.source,{showSourceCode:"all",html:!0});const l=this.getTranslatedSource();l&&(a+=`

Translated Source



${l}
`);const u=document.createElement("Button");u.innerHTML=` +

Shader Compilation Error in ${i}



+
+${a}
+
`,u.style.top="10px",u.style.left="10px",u.style.position="absolute",u.style.zIndex="9999",u.style.width="100%",u.style.textAlign="left",document.body.appendChild(u),(h=document.getElementsByClassName("luma-compiler-log-error")[0])==null||h.scrollIntoView(),u.onclick=()=>{const g=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(g)}}};M(Dg,"defaultProps",{...mn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});let dg=Dg;function Q$(t){return lM(t.source)||t.id||op(`unnamed ${t.stage}-shader`)}function lM(t,e="unnamed"){const r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return r?r[1]:e}const uf=class uf extends mn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,n){n=uf.normalizeProps(e,n),super(e,n,uf.defaultProps)}static normalizeProps(e,n){var a,l;const r=((l=(a=e==null?void 0:e.props)==null?void 0:a._resourceDefaults)==null?void 0:l.sampler)||{};return{...n,...r}}};M(uf,"defaultProps",{...mn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});let hg=uf;const Fg=class Fg extends mn{constructor(n,r={}){super(n,r,Fg.defaultProps);M(this,"width");M(this,"height");this.width=this.props.width,this.height=this.props.height}get[Symbol.toStringTag](){return"Framebuffer"}clone(n){const r=this.colorAttachments.map(a=>a.texture.clone(n)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(n);return this.device.createFramebuffer({...this.props,colorAttachments:r,depthStencilAttachment:i})}resize(n){let r=!n;if(n){const[i,a]=Array.isArray(n)?n:[n.width,n.height];r=r||a!==this.height||i!==this.width,this.width=i,this.height=a}r&&(Re.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((r,i)=>{if(typeof r=="string"){const a=this.createColorTexture(r,i);return this.attachResource(a),a.view}return r instanceof Kn?r.view:r});const n=this.props.depthStencilAttachment;if(n)if(typeof n=="string"){const r=this.createDepthStencilTexture(n);this.attachResource(r),this.depthStencilAttachment=r.view}else n instanceof Kn?this.depthStencilAttachment=n.view:this.depthStencilAttachment=n}createColorTexture(n,r){return this.device.createTexture({id:`${this.id}-color-attachment-${r}`,usage:Kn.RENDER_ATTACHMENT,format:n,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(n){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:Kn.RENDER_ATTACHMENT,format:n,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(n,r){for(let i=0;i":["f32",2],"vec3":["f32",3],"vec4":["f32",4],f16:["f16",1],"vec2":["f16",2],"vec3":["f16",3],"vec4":["f16",4],i32:["i32",1],"vec2":["i32",2],"vec3":["i32",3],"vec4":["i32",4],u32:["u32",1],"vec2":["u32",2],"vec3":["u32",3],"vec4":["u32",4]},tV={f32:4,f16:2,i32:4,u32:4};function cM(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);const[n,r]=t.split("x"),i=n,a=r?parseInt(r):1,l=iM(i),u={type:i,components:a,byteLength:l.byteLength*a,integer:l.integer,signed:l.signed,normalized:l.normalized};return e&&(u.webglOnly=!0),u}function uM(t,e){const n={};for(const r of t.attributes){const i=rV(t,e,r.name);i&&(n[r.name]=i)}return n}function nV(t,e,n=16){const r=uM(t,e),i=new Array(n).fill(null);for(const a of Object.values(r))i[a.location]=a;return i}function rV(t,e,n){const r=iV(t,n),i=sV(e,n);if(!r)return null;const a=G$(r.type),l=(i==null?void 0:i.vertexFormat)||a.defaultVertexFormat,u=cM(l);return{attributeName:(i==null?void 0:i.attributeName)||r.name,bufferName:(i==null?void 0:i.bufferName)||r.name,location:r.location,shaderType:r.type,shaderDataType:a.dataType,shaderComponents:a.components,vertexFormat:l,bufferDataType:u.type,bufferComponents:u.components,normalized:u.normalized,integer:a.integer,stepMode:(i==null?void 0:i.stepMode)||r.stepMode||"vertex",byteOffset:(i==null?void 0:i.byteOffset)||0,byteStride:(i==null?void 0:i.byteStride)||0}}function iV(t,e){const n=t.attributes.find(r=>r.name===e);return n||Re.warn(`shader layout attribute "${e}" not present in shader`),n||null}function sV(t,e){aV(t);let n=oV(t,e);return n||(n=lV(t,e),n)?n:(Re.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function aV(t){for(const e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&Re.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function oV(t,e){for(const n of t)if(n.format&&n.name===e)return{attributeName:n.name,bufferName:e,stepMode:n.stepMode,vertexFormat:n.format,byteOffset:0,byteStride:n.byteStride||0};return null}function lV(t,e){var n;for(const r of t){let i=r.byteStride;if(typeof r.byteStride!="number")for(const l of r.attributes||[]){const u=cM(l.format);i+=u.byteLength}const a=(n=r.attributes)==null?void 0:n.find(l=>l.attribute===e);if(a)return{attributeName:a.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:a.format,byteOffset:a.byteOffset,byteStride:i}}return null}const zg=class zg extends mn{constructor(n,r){super(n,r,zg.defaultProps);M(this,"maxVertexAttributes");M(this,"attributeInfos");M(this,"indexBuffer",null);M(this,"attributes");this.maxVertexAttributes=n.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null);const{shaderLayout:i,bufferLayout:a}=r.renderPipeline||{};if(!i||!a)throw new Error("VertexArray");this.attributeInfos=nV(i,a,this.maxVertexAttributes)}get[Symbol.toStringTag](){return"VertexArray"}setConstantWebGL(n,r){throw new Error("constant attributes not supported")}};M(zg,"defaultProps",{...mn.defaultProps,renderPipeline:null});let j_=zg;const $g=class $g extends mn{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,n){super(e,n,$g.defaultProps)}};M($g,"defaultProps",{...mn.defaultProps,layout:void 0,buffers:{}});let W_=$g;const Vg=class Vg extends mn{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,n){super(e,n,Vg.defaultProps)}};M(Vg,"defaultProps",{...mn.defaultProps,type:void 0,count:void 0});let X_=Vg;const cV={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2":{type:"f32",components:2},"vec3":{type:"f32",components:3},"vec4":{type:"f32",components:4},"vec2":{type:"i32",components:2},"vec3":{type:"i32",components:3},"vec4":{type:"i32",components:4},"vec2":{type:"u32",components:2},"vec3":{type:"u32",components:3},"vec4":{type:"u32",components:4},"mat2x2":{type:"f32",components:4},"mat2x3":{type:"f32",components:6},"mat2x4":{type:"f32",components:8},"mat3x2":{type:"f32",components:6},"mat3x3":{type:"f32",components:9},"mat3x4":{type:"f32",components:12},"mat4x2":{type:"f32",components:8},"mat4x3":{type:"f32",components:12},"mat4x4":{type:"f32",components:16}};function uV(t){return cV[t]}function fV(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}let vh;function fM(t){return(!vh||vh.byteLengtha.type==="uniform"&&a.name===(e==null?void 0:e.name));if(!r)throw new Error(e==null?void 0:e.name);const i=r;for(const a of i.uniforms||[])this.bindingLayout[a.name]=a}}setUniforms(e){for(const[n,r]of Object.entries(e))this._setUniform(n,r),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${n}=${r}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,n){pV(this.uniforms[e],n)||(this.uniforms[e]=mV(n),this.modifiedUniforms[e]=!0,this.modified=!0)}}class _V{constructor(e){M(this,"uniformBlocks",new Map);M(this,"uniformBufferLayouts",new Map);M(this,"uniformBuffers",new Map);for(const[n,r]of Object.entries(e)){const i=n,a=new gV(r.uniformTypes||{});this.uniformBufferLayouts.set(i,a);const l=new vV({name:n});l.setUniforms(r.defaultUniforms||{}),this.uniformBlocks.set(i,l)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e){var n;for(const[r,i]of Object.entries(e))(n=this.uniformBlocks.get(r))==null||n.setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){var n;return((n=this.uniformBufferLayouts.get(e))==null?void 0:n.byteLength)||0}getUniformBufferData(e){var r,i;const n=((r=this.uniformBlocks.get(e))==null?void 0:r.getAllUniforms())||{};return(i=this.uniformBufferLayouts.get(e))==null?void 0:i.getData(n)}createUniformBuffer(e,n,r){r&&this.setUniforms(r);const i=this.getUniformBufferByteLength(n),a=e.createBuffer({usage:$n.UNIFORM|$n.COPY_DST,byteLength:i}),l=this.getUniformBufferData(n);return a.write(l),a}getManagedUniformBuffer(e,n){if(!this.uniformBuffers.get(n)){const r=this.getUniformBufferByteLength(n),i=e.createBuffer({usage:$n.UNIFORM|$n.COPY_DST,byteLength:r});this.uniformBuffers.set(n,i)}return this.uniformBuffers.get(n)}updateUniformBuffers(){let e=!1;for(const n of this.uniformBlocks.keys()){const r=this.updateUniformBuffer(n);e||(e=r)}return e&&Re.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){var a;const n=this.uniformBlocks.get(e);let r=this.uniformBuffers.get(e),i=!1;if(r&&(n!=null&&n.needsRedraw)){i||(i=n.needsRedraw);const l=this.getUniformBufferData(e);r=this.uniformBuffers.get(e),r==null||r.write(l);const u=(a=this.uniformBlocks.get(e))==null?void 0:a.getAllUniforms();Re.log(4,`Writing to uniform buffer ${String(e)}`,l,u)()}return i}}function dM(t){const e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function hM(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function yV(t,e,n){if(!e||e>4)throw new Error(`size ${e}`);const r=e;let i=dM(t);if(i==="uint8"&&n&&r===1)return"unorm8-webgl";if(i==="uint8"&&n&&r===3)return"unorm8x3-webgl";if(i==="uint8"||i==="sint8"){if(r===1||r===3)throw new Error(`size: ${e}`);return n&&(i=i.replace("int","norm")),`${i}x${r}`}if(i==="uint16"||i==="sint16"){if(r===1||r===3)throw new Error(`size: ${e}`);return n&&(i=i.replace("int","norm")),`${i}x${r}`}return r===1?i:`${i}x${r}`}class Zv{constructor(e){M(this,"bufferLayouts");this.bufferLayouts=e}getBufferLayout(e){return this.bufferLayouts.find(n=>n.name===e)||null}getAttributeNamesForBuffer(e){var n;return e.attributes?(n=e.attributes)==null?void 0:n.map(r=>r.attribute):[e.name]}mergeBufferLayouts(e,n){const r=[...e];for(const i of n){const a=r.findIndex(l=>l.name===i.name);a<0?r.push(i):r[a]=i}return r}}class bV{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}}class qs{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(e){throw new Error("Cannot evaluate node")}evaluateString(e){return this.evaluate(e).toString()}search(e){}searchBlock(e,n){if(e){n(vg.instance);for(const r of e)r instanceof Array?this.searchBlock(r,n):r.search(n);n(_g.instance)}}}class vg extends qs{}vg.instance=new vg;class _g extends qs{}_g.instance=new _g;class kn extends qs{constructor(){super()}}let q_=class extends kn{constructor(e,n,r,i,a,l){super(),this.calls=new Set,this.name=e,this.args=n,this.returnType=r,this.body=i,this.startLine=a,this.endLine=l}get astNodeType(){return"function"}search(e){this.searchBlock(this.body,e)}};class SV extends kn{constructor(e){super(),this.expression=e}get astNodeType(){return"staticAssert"}search(e){this.expression.search(e)}}class EV extends kn{constructor(e,n){super(),this.condition=e,this.body=n}get astNodeType(){return"while"}search(e){this.condition.search(e),this.searchBlock(this.body,e)}}class wV extends kn{constructor(e){super(),this.body=e}get astNodeType(){return"continuing"}search(e){this.searchBlock(this.body,e)}}class TV extends kn{constructor(e,n,r,i){super(),this.init=e,this.condition=n,this.increment=r,this.body=i}get astNodeType(){return"for"}search(e){var n,r,i;(n=this.init)===null||n===void 0||n.search(e),(r=this.condition)===null||r===void 0||r.search(e),(i=this.increment)===null||i===void 0||i.search(e),this.searchBlock(this.body,e)}}class _o extends kn{constructor(e,n,r,i,a){super(),this.name=e,this.type=n,this.storage=r,this.access=i,this.value=a}get astNodeType(){return"var"}search(e){var n;e(this),(n=this.value)===null||n===void 0||n.search(e)}}class gM extends kn{constructor(e,n,r){super(),this.name=e,this.type=n,this.value=r}get astNodeType(){return"override"}search(e){var n;(n=this.value)===null||n===void 0||n.search(e)}}class Y_ extends kn{constructor(e,n,r,i,a){super(),this.name=e,this.type=n,this.storage=r,this.access=i,this.value=a}get astNodeType(){return"let"}search(e){var n;e(this),(n=this.value)===null||n===void 0||n.search(e)}}class QC extends kn{constructor(e,n,r,i,a){super(),this.name=e,this.type=n,this.storage=r,this.access=i,this.value=a}get astNodeType(){return"const"}evaluate(e){return this.value.evaluate(e)}search(e){var n;e(this),(n=this.value)===null||n===void 0||n.search(e)}}var xc;(function(t){t.increment="++",t.decrement="--"})(xc||(xc={}));(function(t){function e(n){const r=n;if(r=="parse")throw new Error("Invalid value for IncrementOperator");return t[r]}t.parse=e})(xc||(xc={}));class CV extends kn{constructor(e,n){super(),this.operator=e,this.variable=n}get astNodeType(){return"increment"}search(e){this.variable.search(e)}}var Mf;(function(t){t.assign="=",t.addAssign="+=",t.subtractAssin="-=",t.multiplyAssign="*=",t.divideAssign="/=",t.moduloAssign="%=",t.andAssign="&=",t.orAssign="|=",t.xorAssign="^=",t.shiftLeftAssign="<<=",t.shiftRightAssign=">>="})(Mf||(Mf={}));(function(t){function e(n){const r=n;if(r=="parse")throw new Error("Invalid value for AssignOperator");return r}t.parse=e})(Mf||(Mf={}));class AV extends kn{constructor(e,n,r){super(),this.operator=e,this.variable=n,this.value=r}get astNodeType(){return"assign"}search(e){this.variable.search(e),this.value.search(e)}}class pM extends kn{constructor(e,n){super(),this.name=e,this.args=n}get astNodeType(){return"call"}search(e){for(const n of this.args)n.search(e);e(this)}}class RV extends kn{constructor(e,n){super(),this.body=e,this.continuing=n}get astNodeType(){return"loop"}}class xV extends kn{constructor(e,n){super(),this.condition=e,this.body=n}get astNodeType(){return"body"}}class MV extends kn{constructor(e,n,r,i){super(),this.condition=e,this.body=n,this.elseif=r,this.else=i}get astNodeType(){return"if"}search(e){this.condition.search(e),this.searchBlock(this.body,e),this.searchBlock(this.elseif,e),this.searchBlock(this.else,e)}}class OV extends kn{constructor(e){super(),this.value=e}get astNodeType(){return"return"}search(e){var n;(n=this.value)===null||n===void 0||n.search(e)}}class PV extends kn{constructor(e){super(),this.name=e}get astNodeType(){return"enable"}}class NV extends kn{constructor(e){super(),this.extensions=e}get astNodeType(){return"requires"}}class IV extends kn{constructor(e,n){super(),this.severity=e,this.rule=n}get astNodeType(){return"diagnostic"}}class mM extends kn{constructor(e,n){super(),this.name=e,this.type=n}get astNodeType(){return"alias"}}class DV extends kn{constructor(){super()}get astNodeType(){return"discard"}}class FV extends kn{constructor(){super()}get astNodeType(){return"break"}}class kV extends kn{constructor(){super()}get astNodeType(){return"continue"}}class Zo extends kn{constructor(e){super(),this.name=e}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}}class go extends Zo{constructor(e,n,r,i){super(e),this.members=n,this.startLine=r,this.endLine=i}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(e){for(let n=0;n":return this.left.evaluate(e)>this.right.evaluate(e)?1:0;case"<=":return this.left.evaluate(e)<=this.right.evaluate(e)?1:0;case">=":return this.left.evaluate(e)>=this.right.evaluate(e)?1:0;case"&&":return this.left.evaluate(e)&&this.right.evaluate(e)?1:0;case"||":return this.left.evaluate(e)||this.right.evaluate(e)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}search(e){this.left.search(e),this.right.search(e)}}class SM extends qs{constructor(){super()}}class VV extends SM{constructor(e,n){super(),this.selector=e,this.body=n}get astNodeType(){return"case"}search(e){this.searchBlock(this.body,e)}}class HV extends SM{constructor(e){super(),this.body=e}get astNodeType(){return"default"}search(e){this.searchBlock(this.body,e)}}class jV extends qs{constructor(e,n,r){super(),this.name=e,this.type=n,this.attributes=r}get astNodeType(){return"argument"}}class WV extends qs{constructor(e,n){super(),this.condition=e,this.body=n}get astNodeType(){return"elseif"}search(e){this.condition.search(e),this.searchBlock(this.body,e)}}class XV extends qs{constructor(e,n,r){super(),this.name=e,this.type=n,this.attributes=r}get astNodeType(){return"member"}}let qV=class extends qs{constructor(e,n){super(),this.name=e,this.value=n}get astNodeType(){return"attribute"}};var oe,te;(function(t){t[t.token=0]="token",t[t.keyword=1]="keyword",t[t.reserved=2]="reserved"})(te||(te={}));class ne{constructor(e,n,r){this.name=e,this.type=n,this.rule=r}toString(){return this.name}}class k{}oe=k;k.none=new ne("",te.reserved,"");k.eof=new ne("EOF",te.token,"");k.reserved={asm:new ne("asm",te.reserved,"asm"),bf16:new ne("bf16",te.reserved,"bf16"),do:new ne("do",te.reserved,"do"),enum:new ne("enum",te.reserved,"enum"),f16:new ne("f16",te.reserved,"f16"),f64:new ne("f64",te.reserved,"f64"),handle:new ne("handle",te.reserved,"handle"),i8:new ne("i8",te.reserved,"i8"),i16:new ne("i16",te.reserved,"i16"),i64:new ne("i64",te.reserved,"i64"),mat:new ne("mat",te.reserved,"mat"),premerge:new ne("premerge",te.reserved,"premerge"),regardless:new ne("regardless",te.reserved,"regardless"),typedef:new ne("typedef",te.reserved,"typedef"),u8:new ne("u8",te.reserved,"u8"),u16:new ne("u16",te.reserved,"u16"),u64:new ne("u64",te.reserved,"u64"),unless:new ne("unless",te.reserved,"unless"),using:new ne("using",te.reserved,"using"),vec:new ne("vec",te.reserved,"vec"),void:new ne("void",te.reserved,"void")};k.keywords={array:new ne("array",te.keyword,"array"),atomic:new ne("atomic",te.keyword,"atomic"),bool:new ne("bool",te.keyword,"bool"),f32:new ne("f32",te.keyword,"f32"),i32:new ne("i32",te.keyword,"i32"),mat2x2:new ne("mat2x2",te.keyword,"mat2x2"),mat2x3:new ne("mat2x3",te.keyword,"mat2x3"),mat2x4:new ne("mat2x4",te.keyword,"mat2x4"),mat3x2:new ne("mat3x2",te.keyword,"mat3x2"),mat3x3:new ne("mat3x3",te.keyword,"mat3x3"),mat3x4:new ne("mat3x4",te.keyword,"mat3x4"),mat4x2:new ne("mat4x2",te.keyword,"mat4x2"),mat4x3:new ne("mat4x3",te.keyword,"mat4x3"),mat4x4:new ne("mat4x4",te.keyword,"mat4x4"),ptr:new ne("ptr",te.keyword,"ptr"),sampler:new ne("sampler",te.keyword,"sampler"),sampler_comparison:new ne("sampler_comparison",te.keyword,"sampler_comparison"),struct:new ne("struct",te.keyword,"struct"),texture_1d:new ne("texture_1d",te.keyword,"texture_1d"),texture_2d:new ne("texture_2d",te.keyword,"texture_2d"),texture_2d_array:new ne("texture_2d_array",te.keyword,"texture_2d_array"),texture_3d:new ne("texture_3d",te.keyword,"texture_3d"),texture_cube:new ne("texture_cube",te.keyword,"texture_cube"),texture_cube_array:new ne("texture_cube_array",te.keyword,"texture_cube_array"),texture_multisampled_2d:new ne("texture_multisampled_2d",te.keyword,"texture_multisampled_2d"),texture_storage_1d:new ne("texture_storage_1d",te.keyword,"texture_storage_1d"),texture_storage_2d:new ne("texture_storage_2d",te.keyword,"texture_storage_2d"),texture_storage_2d_array:new ne("texture_storage_2d_array",te.keyword,"texture_storage_2d_array"),texture_storage_3d:new ne("texture_storage_3d",te.keyword,"texture_storage_3d"),texture_depth_2d:new ne("texture_depth_2d",te.keyword,"texture_depth_2d"),texture_depth_2d_array:new ne("texture_depth_2d_array",te.keyword,"texture_depth_2d_array"),texture_depth_cube:new ne("texture_depth_cube",te.keyword,"texture_depth_cube"),texture_depth_cube_array:new ne("texture_depth_cube_array",te.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new ne("texture_depth_multisampled_2d",te.keyword,"texture_depth_multisampled_2d"),texture_external:new ne("texture_external",te.keyword,"texture_external"),u32:new ne("u32",te.keyword,"u32"),vec2:new ne("vec2",te.keyword,"vec2"),vec3:new ne("vec3",te.keyword,"vec3"),vec4:new ne("vec4",te.keyword,"vec4"),bitcast:new ne("bitcast",te.keyword,"bitcast"),block:new ne("block",te.keyword,"block"),break:new ne("break",te.keyword,"break"),case:new ne("case",te.keyword,"case"),continue:new ne("continue",te.keyword,"continue"),continuing:new ne("continuing",te.keyword,"continuing"),default:new ne("default",te.keyword,"default"),diagnostic:new ne("diagnostic",te.keyword,"diagnostic"),discard:new ne("discard",te.keyword,"discard"),else:new ne("else",te.keyword,"else"),enable:new ne("enable",te.keyword,"enable"),fallthrough:new ne("fallthrough",te.keyword,"fallthrough"),false:new ne("false",te.keyword,"false"),fn:new ne("fn",te.keyword,"fn"),for:new ne("for",te.keyword,"for"),function:new ne("function",te.keyword,"function"),if:new ne("if",te.keyword,"if"),let:new ne("let",te.keyword,"let"),const:new ne("const",te.keyword,"const"),loop:new ne("loop",te.keyword,"loop"),while:new ne("while",te.keyword,"while"),private:new ne("private",te.keyword,"private"),read:new ne("read",te.keyword,"read"),read_write:new ne("read_write",te.keyword,"read_write"),return:new ne("return",te.keyword,"return"),requires:new ne("requires",te.keyword,"requires"),storage:new ne("storage",te.keyword,"storage"),switch:new ne("switch",te.keyword,"switch"),true:new ne("true",te.keyword,"true"),alias:new ne("alias",te.keyword,"alias"),type:new ne("type",te.keyword,"type"),uniform:new ne("uniform",te.keyword,"uniform"),var:new ne("var",te.keyword,"var"),override:new ne("override",te.keyword,"override"),workgroup:new ne("workgroup",te.keyword,"workgroup"),write:new ne("write",te.keyword,"write"),r8unorm:new ne("r8unorm",te.keyword,"r8unorm"),r8snorm:new ne("r8snorm",te.keyword,"r8snorm"),r8uint:new ne("r8uint",te.keyword,"r8uint"),r8sint:new ne("r8sint",te.keyword,"r8sint"),r16uint:new ne("r16uint",te.keyword,"r16uint"),r16sint:new ne("r16sint",te.keyword,"r16sint"),r16float:new ne("r16float",te.keyword,"r16float"),rg8unorm:new ne("rg8unorm",te.keyword,"rg8unorm"),rg8snorm:new ne("rg8snorm",te.keyword,"rg8snorm"),rg8uint:new ne("rg8uint",te.keyword,"rg8uint"),rg8sint:new ne("rg8sint",te.keyword,"rg8sint"),r32uint:new ne("r32uint",te.keyword,"r32uint"),r32sint:new ne("r32sint",te.keyword,"r32sint"),r32float:new ne("r32float",te.keyword,"r32float"),rg16uint:new ne("rg16uint",te.keyword,"rg16uint"),rg16sint:new ne("rg16sint",te.keyword,"rg16sint"),rg16float:new ne("rg16float",te.keyword,"rg16float"),rgba8unorm:new ne("rgba8unorm",te.keyword,"rgba8unorm"),rgba8unorm_srgb:new ne("rgba8unorm_srgb",te.keyword,"rgba8unorm_srgb"),rgba8snorm:new ne("rgba8snorm",te.keyword,"rgba8snorm"),rgba8uint:new ne("rgba8uint",te.keyword,"rgba8uint"),rgba8sint:new ne("rgba8sint",te.keyword,"rgba8sint"),bgra8unorm:new ne("bgra8unorm",te.keyword,"bgra8unorm"),bgra8unorm_srgb:new ne("bgra8unorm_srgb",te.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new ne("rgb10a2unorm",te.keyword,"rgb10a2unorm"),rg11b10float:new ne("rg11b10float",te.keyword,"rg11b10float"),rg32uint:new ne("rg32uint",te.keyword,"rg32uint"),rg32sint:new ne("rg32sint",te.keyword,"rg32sint"),rg32float:new ne("rg32float",te.keyword,"rg32float"),rgba16uint:new ne("rgba16uint",te.keyword,"rgba16uint"),rgba16sint:new ne("rgba16sint",te.keyword,"rgba16sint"),rgba16float:new ne("rgba16float",te.keyword,"rgba16float"),rgba32uint:new ne("rgba32uint",te.keyword,"rgba32uint"),rgba32sint:new ne("rgba32sint",te.keyword,"rgba32sint"),rgba32float:new ne("rgba32float",te.keyword,"rgba32float"),static_assert:new ne("static_assert",te.keyword,"static_assert")};k.tokens={decimal_float_literal:new ne("decimal_float_literal",te.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|(-?[0-9]+f)/),hex_float_literal:new ne("hex_float_literal",te.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new ne("int_literal",te.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new ne("uint_literal",te.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new ne("ident",te.token,/[_a-zA-Z][0-9a-zA-Z_]*/),and:new ne("and",te.token,"&"),and_and:new ne("and_and",te.token,"&&"),arrow:new ne("arrow ",te.token,"->"),attr:new ne("attr",te.token,"@"),forward_slash:new ne("forward_slash",te.token,"/"),bang:new ne("bang",te.token,"!"),bracket_left:new ne("bracket_left",te.token,"["),bracket_right:new ne("bracket_right",te.token,"]"),brace_left:new ne("brace_left",te.token,"{"),brace_right:new ne("brace_right",te.token,"}"),colon:new ne("colon",te.token,":"),comma:new ne("comma",te.token,","),equal:new ne("equal",te.token,"="),equal_equal:new ne("equal_equal",te.token,"=="),not_equal:new ne("not_equal",te.token,"!="),greater_than:new ne("greater_than",te.token,">"),greater_than_equal:new ne("greater_than_equal",te.token,">="),shift_right:new ne("shift_right",te.token,">>"),less_than:new ne("less_than",te.token,"<"),less_than_equal:new ne("less_than_equal",te.token,"<="),shift_left:new ne("shift_left",te.token,"<<"),modulo:new ne("modulo",te.token,"%"),minus:new ne("minus",te.token,"-"),minus_minus:new ne("minus_minus",te.token,"--"),period:new ne("period",te.token,"."),plus:new ne("plus",te.token,"+"),plus_plus:new ne("plus_plus",te.token,"++"),or:new ne("or",te.token,"|"),or_or:new ne("or_or",te.token,"||"),paren_left:new ne("paren_left",te.token,"("),paren_right:new ne("paren_right",te.token,")"),semicolon:new ne("semicolon",te.token,";"),star:new ne("star",te.token,"*"),tilde:new ne("tilde",te.token,"~"),underscore:new ne("underscore",te.token,"_"),xor:new ne("xor",te.token,"^"),plus_equal:new ne("plus_equal",te.token,"+="),minus_equal:new ne("minus_equal",te.token,"-="),times_equal:new ne("times_equal",te.token,"*="),division_equal:new ne("division_equal",te.token,"/="),modulo_equal:new ne("modulo_equal",te.token,"%="),and_equal:new ne("and_equal",te.token,"&="),or_equal:new ne("or_equal",te.token,"|="),xor_equal:new ne("xor_equal",te.token,"^="),shift_right_equal:new ne("shift_right_equal",te.token,">>="),shift_left_equal:new ne("shift_left_equal",te.token,"<<=")};k.simpleTokens={"@":oe.tokens.attr,"{":oe.tokens.brace_left,"}":oe.tokens.brace_right,":":oe.tokens.colon,",":oe.tokens.comma,"(":oe.tokens.paren_left,")":oe.tokens.paren_right,";":oe.tokens.semicolon};k.literalTokens={"&":oe.tokens.and,"&&":oe.tokens.and_and,"->":oe.tokens.arrow,"/":oe.tokens.forward_slash,"!":oe.tokens.bang,"[":oe.tokens.bracket_left,"]":oe.tokens.bracket_right,"=":oe.tokens.equal,"==":oe.tokens.equal_equal,"!=":oe.tokens.not_equal,">":oe.tokens.greater_than,">=":oe.tokens.greater_than_equal,">>":oe.tokens.shift_right,"<":oe.tokens.less_than,"<=":oe.tokens.less_than_equal,"<<":oe.tokens.shift_left,"%":oe.tokens.modulo,"-":oe.tokens.minus,"--":oe.tokens.minus_minus,".":oe.tokens.period,"+":oe.tokens.plus,"++":oe.tokens.plus_plus,"|":oe.tokens.or,"||":oe.tokens.or_or,"*":oe.tokens.star,"~":oe.tokens.tilde,_:oe.tokens.underscore,"^":oe.tokens.xor,"+=":oe.tokens.plus_equal,"-=":oe.tokens.minus_equal,"*=":oe.tokens.times_equal,"/=":oe.tokens.division_equal,"%=":oe.tokens.modulo_equal,"&=":oe.tokens.and_equal,"|=":oe.tokens.or_equal,"^=":oe.tokens.xor_equal,">>=":oe.tokens.shift_right_equal,"<<=":oe.tokens.shift_left_equal};k.regexTokens={decimal_float_literal:oe.tokens.decimal_float_literal,hex_float_literal:oe.tokens.hex_float_literal,int_literal:oe.tokens.int_literal,uint_literal:oe.tokens.uint_literal,ident:oe.tokens.ident};k.storage_class=[oe.keywords.function,oe.keywords.private,oe.keywords.workgroup,oe.keywords.uniform,oe.keywords.storage];k.access_mode=[oe.keywords.read,oe.keywords.write,oe.keywords.read_write];k.sampler_type=[oe.keywords.sampler,oe.keywords.sampler_comparison];k.sampled_texture_type=[oe.keywords.texture_1d,oe.keywords.texture_2d,oe.keywords.texture_2d_array,oe.keywords.texture_3d,oe.keywords.texture_cube,oe.keywords.texture_cube_array];k.multisampled_texture_type=[oe.keywords.texture_multisampled_2d];k.storage_texture_type=[oe.keywords.texture_storage_1d,oe.keywords.texture_storage_2d,oe.keywords.texture_storage_2d_array,oe.keywords.texture_storage_3d];k.depth_texture_type=[oe.keywords.texture_depth_2d,oe.keywords.texture_depth_2d_array,oe.keywords.texture_depth_cube,oe.keywords.texture_depth_cube_array,oe.keywords.texture_depth_multisampled_2d];k.texture_external_type=[oe.keywords.texture_external];k.any_texture_type=[...oe.sampled_texture_type,...oe.multisampled_texture_type,...oe.storage_texture_type,...oe.depth_texture_type,...oe.texture_external_type];k.texel_format=[oe.keywords.r8unorm,oe.keywords.r8snorm,oe.keywords.r8uint,oe.keywords.r8sint,oe.keywords.r16uint,oe.keywords.r16sint,oe.keywords.r16float,oe.keywords.rg8unorm,oe.keywords.rg8snorm,oe.keywords.rg8uint,oe.keywords.rg8sint,oe.keywords.r32uint,oe.keywords.r32sint,oe.keywords.r32float,oe.keywords.rg16uint,oe.keywords.rg16sint,oe.keywords.rg16float,oe.keywords.rgba8unorm,oe.keywords.rgba8unorm_srgb,oe.keywords.rgba8snorm,oe.keywords.rgba8uint,oe.keywords.rgba8sint,oe.keywords.bgra8unorm,oe.keywords.bgra8unorm_srgb,oe.keywords.rgb10a2unorm,oe.keywords.rg11b10float,oe.keywords.rg32uint,oe.keywords.rg32sint,oe.keywords.rg32float,oe.keywords.rgba16uint,oe.keywords.rgba16sint,oe.keywords.rgba16float,oe.keywords.rgba32uint,oe.keywords.rgba32sint,oe.keywords.rgba32float];k.const_literal=[oe.tokens.int_literal,oe.tokens.uint_literal,oe.tokens.decimal_float_literal,oe.tokens.hex_float_literal,oe.keywords.true,oe.keywords.false];k.literal_or_ident=[oe.tokens.ident,oe.tokens.int_literal,oe.tokens.uint_literal,oe.tokens.decimal_float_literal,oe.tokens.hex_float_literal];k.element_count_expression=[oe.tokens.int_literal,oe.tokens.uint_literal,oe.tokens.ident];k.template_types=[oe.keywords.vec2,oe.keywords.vec3,oe.keywords.vec4,oe.keywords.mat2x2,oe.keywords.mat2x3,oe.keywords.mat2x4,oe.keywords.mat3x2,oe.keywords.mat3x3,oe.keywords.mat3x4,oe.keywords.mat4x2,oe.keywords.mat4x3,oe.keywords.mat4x4,oe.keywords.atomic,oe.keywords.bitcast,...oe.any_texture_type];k.attribute_name=[oe.tokens.ident,oe.keywords.block,oe.keywords.diagnostic];k.assignment_operators=[oe.tokens.equal,oe.tokens.plus_equal,oe.tokens.minus_equal,oe.tokens.times_equal,oe.tokens.division_equal,oe.tokens.modulo_equal,oe.tokens.and_equal,oe.tokens.or_equal,oe.tokens.xor_equal,oe.tokens.shift_right_equal,oe.tokens.shift_left_equal];k.increment_operators=[oe.tokens.plus_plus,oe.tokens.minus_minus];class t2{constructor(e,n,r){this.type=e,this.lexeme=n,this.line=r}toString(){return this.lexeme}isTemplateType(){return k.template_types.indexOf(this.type)!=-1}isArrayType(){return this.type==k.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}}class YV{constructor(e){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=e??""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new t2(k.eof,"",this._line)),this._tokens}scanToken(){let e=this._advance();if(e==` +`)return this._line++,!0;if(this._isWhitespace(e))return!0;if(e=="/"){if(this._peekAhead()=="/"){for(;e!=` +`;){if(this._isAtEnd())return!0;e=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();let l=1;for(;l>0;){if(this._isAtEnd())return!0;if(e=this._advance(),e==` +`)this._line++;else if(e=="*"){if(this._peekAhead()=="/"&&(this._advance(),l--,l==0))return!0}else e=="/"&&this._peekAhead()=="*"&&(this._advance(),l++)}return!0}}const n=k.simpleTokens[e];if(n)return this._addToken(n),!0;let r=k.none;const i=this._isAlpha(e),a=e==="_";if(this._isAlphaNumeric(e)){let l=this._peekAhead();for(;this._isAlphaNumeric(l);)e+=this._advance(),l=this._peekAhead()}if(i){const l=k.keywords[e];if(l)return this._addToken(l),!0}if(i||a)return this._addToken(k.tokens.ident),!0;for(;;){let l=this._findType(e);const u=this._peekAhead();if(e=="-"&&this._tokens.length>0){if(u=="=")return this._current++,e+=u,this._addToken(k.tokens.minus_equal),!0;if(u=="-")return this._current++,e+=u,this._addToken(k.tokens.minus_minus),!0;const f=this._tokens.length-1;if((k.literal_or_ident.indexOf(this._tokens[f].type)!=-1||this._tokens[f].type==k.tokens.paren_right)&&u!=">")return this._addToken(l),!0}if(e==">"&&(u==">"||u=="=")){let f=!1,h=this._tokens.length-1;for(let g=0;g<5&&h>=0&&k.assignment_operators.indexOf(this._tokens[h].type)===-1;++g,--h)if(this._tokens[h].type===k.tokens.less_than){h>0&&this._tokens[h-1].isArrayOrTemplateType()&&(f=!0);break}if(f)return this._addToken(l),!0}if(l===k.none){let f=e,h=0;const g=2;for(let m=0;m=this._source.length}_isAlpha(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}_isAlphaNumeric(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e=="_"||e>="0"&&e<="9"}_isWhitespace(e){return e==" "||e==" "||e=="\r"}_advance(e=0){let n=this._source[this._current];return e=e||0,e++,this._current+=e,n}_peekAhead(e=0){return e=e||0,this._current+e>=this._source.length?"\0":this._source[this._current+e]}_addToken(e){const n=this._source.substring(this._start,this._current);this._tokens.push(new t2(e,n,this._line))}}class KV{constructor(){this._tokens=[],this._current=0,this._currentLine=0,this._context=new bV,this._deferArrayCountEval=[]}parse(e){this._initialize(e),this._deferArrayCountEval.length=0;const n=[];for(;!this._isAtEnd();){const r=this._global_decl_or_directive();if(!r)break;n.push(r)}if(this._deferArrayCountEval.length>0){for(const r of this._deferArrayCountEval){const i=r.arrayType,a=r.countNode;if(a instanceof K_){const u=a.name,f=this._context.constants.get(u);if(f)try{const h=f.evaluate(this._context);i.count=h}catch{}}}this._deferArrayCountEval.length=0}return n}_initialize(e){if(e)if(typeof e=="string"){const n=new YV(e);this._tokens=n.scanTokens()}else this._tokens=e;else this._tokens=[];this._current=0}_error(e,n){return{token:e,message:n,toString:function(){return`${n}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==k.eof}_match(e){if(e instanceof ne)return this._check(e)?(this._advance(),!0):!1;for(let n=0,r=e.length;n'.");const i=this._paren_expression();return new LV(r,i)}const e=this._type_decl(),n=this._argument_expression_list();return new ql(e,n)}_argument_expression_list(){if(!this._match(k.tokens.paren_left))return null;const e=[];do{if(this._check(k.tokens.paren_right))break;const n=this._short_circuit_or_expression();e.push(n)}while(this._match(k.tokens.comma));return this._consume(k.tokens.paren_right,"Expected ')' for agument list"),e}_optional_paren_expression(){this._match(k.tokens.paren_left);const e=this._short_circuit_or_expression();return this._match(k.tokens.paren_right),new e2([e])}_paren_expression(){this._consume(k.tokens.paren_left,"Expected '('.");const e=this._short_circuit_or_expression();return this._consume(k.tokens.paren_right,"Expected ')'."),new e2([e])}_struct_decl(){if(!this._match(k.keywords.struct))return null;const e=this._currentLine,n=this._consume(k.tokens.ident,"Expected name for struct.").toString();this._consume(k.tokens.brace_left,"Expected '{' for struct body.");const r=[];for(;!this._check(k.tokens.brace_right);){const l=this._attribute(),u=this._consume(k.tokens.ident,"Expected variable name.").toString();this._consume(k.tokens.colon,"Expected ':' for struct member type.");const f=this._attribute(),h=this._type_decl();h!=null&&(h.attributes=f),this._check(k.tokens.brace_right)?this._match(k.tokens.comma):this._consume(k.tokens.comma,"Expected ',' for struct member."),r.push(new XV(u,h,l))}this._consume(k.tokens.brace_right,"Expected '}' after struct body.");const i=this._currentLine,a=new go(n,r,e,i);return this._context.structs.set(n,a),a}_global_variable_decl(){const e=this._variable_decl();return e&&this._match(k.tokens.equal)&&(e.value=this._const_expression()),e}_override_variable_decl(){const e=this._override_decl();return e&&this._match(k.tokens.equal)&&(e.value=this._const_expression()),e}_global_const_decl(){if(!this._match(k.keywords.const))return null;const e=this._consume(k.tokens.ident,"Expected variable name");let n=null;if(this._match(k.tokens.colon)){const a=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=a)}let r=null;if(this._match(k.tokens.equal)){const a=this._short_circuit_or_expression();if(a instanceof ql)r=a;else if(a instanceof GC&&a.initializer instanceof ql)r=a.initializer;else try{const l=a.evaluate(this._context);r=new JC(l)}catch{r=a}}const i=new QC(e.toString(),n,"","",r);return this._context.constants.set(i.name,i),i}_global_let_decl(){if(!this._match(k.keywords.let))return null;const e=this._consume(k.tokens.ident,"Expected variable name");let n=null;if(this._match(k.tokens.colon)){const i=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=i)}let r=null;return this._match(k.tokens.equal)&&(r=this._const_expression()),new Y_(e.toString(),n,"","",r)}_const_expression(){return this._short_circuit_or_expression()}_variable_decl(){if(!this._match(k.keywords.var))return null;let e="",n="";this._match(k.tokens.less_than)&&(e=this._consume(k.storage_class,"Expected storage_class.").toString(),this._match(k.tokens.comma)&&(n=this._consume(k.access_mode,"Expected access_mode.").toString()),this._consume(k.tokens.greater_than,"Expected '>'."));const r=this._consume(k.tokens.ident,"Expected variable name");let i=null;if(this._match(k.tokens.colon)){const a=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=a)}return new _o(r.toString(),i,e,n,null)}_override_decl(){if(!this._match(k.keywords.override))return null;const e=this._consume(k.tokens.ident,"Expected variable name");let n=null;if(this._match(k.tokens.colon)){const r=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=r)}return new gM(e.toString(),n,null)}_diagnostic(){this._consume(k.tokens.paren_left,"Expected '('");const e=this._consume(k.tokens.ident,"Expected severity control name.");this._consume(k.tokens.comma,"Expected ','");const n=this._consume(k.tokens.ident,"Expected diagnostic rule name.");return this._consume(k.tokens.paren_right,"Expected ')'"),new IV(e.toString(),n.toString())}_enable_directive(){const e=this._consume(k.tokens.ident,"identity expected.");return new PV(e.toString())}_requires_directive(){const e=[this._consume(k.tokens.ident,"identity expected.").toString()];for(;this._match(k.tokens.comma);){const n=this._consume(k.tokens.ident,"identity expected.");e.push(n.toString())}return new NV(e)}_type_alias(){const e=this._consume(k.tokens.ident,"identity expected.");this._consume(k.tokens.equal,"Expected '=' for type alias.");let n=this._type_decl();if(n===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(n.name)&&(n=this._context.aliases.get(n.name).type);const r=new mM(e.toString(),n);return this._context.aliases.set(r.name,r),r}_type_decl(){if(this._check([k.tokens.ident,...k.texel_format,k.keywords.bool,k.keywords.f32,k.keywords.i32,k.keywords.u32])){const r=this._advance(),i=r.toString();return this._context.structs.has(i)?this._context.structs.get(i):this._context.aliases.has(i)?this._context.aliases.get(i).type:new Zo(r.toString())}let e=this._texture_sampler_types();if(e)return e;if(this._check(k.template_types)){let r=this._advance().toString(),i=null,a=null;return this._match(k.tokens.less_than)&&(i=this._type_decl(),a=null,this._match(k.tokens.comma)&&(a=this._consume(k.access_mode,"Expected access_mode for pointer").toString()),this._consume(k.tokens.greater_than,"Expected '>' for type.")),new vM(r,i,a)}if(this._match(k.keywords.ptr)){let r=this._previous().toString();this._consume(k.tokens.less_than,"Expected '<' for pointer.");const i=this._consume(k.storage_class,"Expected storage_class for pointer");this._consume(k.tokens.comma,"Expected ',' for pointer.");const a=this._type_decl();let l=null;return this._match(k.tokens.comma)&&(l=this._consume(k.access_mode,"Expected access_mode for pointer").toString()),this._consume(k.tokens.greater_than,"Expected '>' for pointer."),new BV(r,i.toString(),a,l)}const n=this._attribute();if(this._match(k.keywords.array)){let r=null,i=-1;const a=this._previous();let l=null;if(this._match(k.tokens.less_than)){r=this._type_decl(),this._context.aliases.has(r.name)&&(r=this._context.aliases.get(r.name).type);let f="";if(this._match(k.tokens.comma)){l=this._shift_expression();try{f=l.evaluate(this._context).toString(),l=null}catch{f="1"}}this._consume(k.tokens.greater_than,"Expected '>' for array."),i=f?parseInt(f):0}const u=new _M(a.toString(),n,r,i);return l&&this._deferArrayCountEval.push({arrayType:u,countNode:l}),u}return null}_texture_sampler_types(){if(this._match(k.sampler_type))return new qu(this._previous().toString(),null,null);if(this._match(k.depth_texture_type))return new qu(this._previous().toString(),null,null);if(this._match(k.sampled_texture_type)||this._match(k.multisampled_texture_type)){const e=this._previous();this._consume(k.tokens.less_than,"Expected '<' for sampler type.");const n=this._type_decl();return this._consume(k.tokens.greater_than,"Expected '>' for sampler type."),new qu(e.toString(),n,null)}if(this._match(k.storage_texture_type)){const e=this._previous();this._consume(k.tokens.less_than,"Expected '<' for sampler type.");const n=this._consume(k.texel_format,"Invalid texel format.").toString();this._consume(k.tokens.comma,"Expected ',' after texel format.");const r=this._consume(k.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(k.tokens.greater_than,"Expected '>' for sampler type."),new qu(e.toString(),n,r)}return null}_attribute(){let e=[];for(;this._match(k.tokens.attr);){const n=this._consume(k.attribute_name,"Expected attribute name"),r=new qV(n.toString(),null);if(this._match(k.tokens.paren_left)){if(r.value=this._consume(k.literal_or_ident,"Expected attribute value").toString(),this._check(k.tokens.comma)){this._advance();do{const i=this._consume(k.literal_or_ident,"Expected attribute value").toString();r.value instanceof Array||(r.value=[r.value]),r.value.push(i)}while(this._match(k.tokens.comma))}this._consume(k.tokens.paren_right,"Expected ')'")}e.push(r)}return e.length==0?null:e}}class nc{constructor(e,n){this.name=e,this.attributes=n,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}}class n2{constructor(e,n,r){this.name=e,this.type=n,this.attributes=r,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}}class _h extends nc{constructor(e,n){super(e,n),this.members=[],this.align=0,this.startLine=-1,this.endLine=-1,this.inUse=!1}get isStruct(){return!0}}class Qv extends nc{constructor(e,n){super(e,n),this.count=0,this.stride=0}get isArray(){return!0}}class r2 extends nc{constructor(e,n,r,i){super(e,r),this.format=n,this.access=i}get isTemplate(){return!0}}var Ea;(function(t){t[t.Uniform=0]="Uniform",t[t.Storage=1]="Storage",t[t.Texture=2]="Texture",t[t.Sampler=3]="Sampler",t[t.StorageTexture=4]="StorageTexture"})(Ea||(Ea={}));class yh{constructor(e,n,r,i,a,l,u){this.name=e,this.type=n,this.group=r,this.binding=i,this.attributes=a,this.resourceType=l,this.access=u}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}}class ZV{constructor(e,n){this.name=e,this.type=n}}class bh{constructor(e,n){this.align=e,this.size=n}}class QV{constructor(e,n,r,i){this.name=e,this.type=n,this.locationType=r,this.location=i,this.interpolation=null}}class i2{constructor(e,n,r,i){this.name=e,this.type=n,this.locationType=r,this.location=i}}class GV{constructor(e,n,r,i){this.name=e,this.type=n,this.attributes=r,this.id=i}}class JV{constructor(e,n){this.name=e,this.type=n}}class eH{constructor(e,n=null){this.stage=null,this.inputs=[],this.outputs=[],this.arguments=[],this.returnType=null,this.resources=[],this.overrides=[],this.startLine=-1,this.endLine=-1,this.inUse=!1,this.calls=new Set,this.name=e,this.stage=n}}class tH{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}}class nH{constructor(e){this.resources=null,this.inUse=!1,this.info=null,this.node=e}}class Vs{constructor(e){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new tH,this.functions=[],this._types=new Map,this._functions=new Map,e&&this.update(e)}_isStorageTexture(e){return e.name=="texture_storage_1d"||e.name=="texture_storage_2d"||e.name=="texture_storage_2d_array"||e.name=="texture_storage_3d"}update(e){const r=new KV().parse(e);for(const i of r)i instanceof q_&&this._functions.set(i.name,new nH(i));for(const i of r)if(i instanceof go){const a=this._getTypeInfo(i,null);a instanceof _h&&this.structs.push(a)}for(const i of r){if(i instanceof mM){this.aliases.push(this._getAliasInfo(i));continue}if(i instanceof gM){const a=i,l=this._getAttributeNum(a.attributes,"id",0),u=a.type!=null?this._getTypeInfo(a.type,a.attributes):null;this.overrides.push(new GV(a.name,u,a.attributes,l));continue}if(this._isUniformVar(i)){const a=i,l=this._getAttributeNum(a.attributes,"group",0),u=this._getAttributeNum(a.attributes,"binding",0),f=this._getTypeInfo(a.type,a.attributes),h=new yh(a.name,f,l,u,a.attributes,Ea.Uniform,a.access);this.uniforms.push(h);continue}if(this._isStorageVar(i)){const a=i,l=this._getAttributeNum(a.attributes,"group",0),u=this._getAttributeNum(a.attributes,"binding",0),f=this._getTypeInfo(a.type,a.attributes),h=this._isStorageTexture(f),g=new yh(a.name,f,l,u,a.attributes,h?Ea.StorageTexture:Ea.Storage,a.access);this.storage.push(g);continue}if(this._isTextureVar(i)){const a=i,l=this._getAttributeNum(a.attributes,"group",0),u=this._getAttributeNum(a.attributes,"binding",0),f=this._getTypeInfo(a.type,a.attributes),h=this._isStorageTexture(f),g=new yh(a.name,f,l,u,a.attributes,h?Ea.StorageTexture:Ea.Texture,a.access);h?this.storage.push(g):this.textures.push(g);continue}if(this._isSamplerVar(i)){const a=i,l=this._getAttributeNum(a.attributes,"group",0),u=this._getAttributeNum(a.attributes,"binding",0),f=this._getTypeInfo(a.type,a.attributes),h=new yh(a.name,f,l,u,a.attributes,Ea.Sampler,a.access);this.samplers.push(h);continue}if(i instanceof q_){const a=this._getAttribute(i,"vertex"),l=this._getAttribute(i,"fragment"),u=this._getAttribute(i,"compute"),f=a||l||u,h=new eH(i.name,f==null?void 0:f.name);h.startLine=i.startLine,h.endLine=i.endLine,this.functions.push(h),this._functions.get(i.name).info=h,f&&(this._functions.get(i.name).inUse=!0,h.inUse=!0,h.resources=this._findResources(i,!!f),h.inputs=this._getInputs(i.args),h.outputs=this._getOutputs(i.returnType),this.entry[f.name].push(h)),h.arguments=i.args.map(g=>new JV(g.name,this._getTypeInfo(g.type,g.attributes))),h.returnType=i.returnType?this._getTypeInfo(i.returnType,i.attributes):null;continue}}for(const i of this._functions.values())i.info&&(i.info.inUse=i.inUse,this._addCalls(i.node,i.info.calls));for(const i of this._functions.values())i.node.search(a=>{var l;if(a.astNodeType==="varExpr"){const u=a;for(const f of this.overrides)u.name==f.name&&((l=i.info)===null||l===void 0||l.overrides.push(f))}});for(const i of this.uniforms)this._markStructsInUse(i.type);for(const i of this.storage)this._markStructsInUse(i.type)}_markStructsInUse(e){if(e)if(e.isStruct){if(e.inUse=!0,e.members)for(const n of e.members)this._markStructsInUse(n.type)}else if(e.isArray)this._markStructsInUse(e.format);else if(e.isTemplate)e.format&&this._markStructsInUse(e.format);else{const n=this._getAlias(e.name);n&&this._markStructsInUse(n)}}_addCalls(e,n){var r;for(const i of e.calls){const a=(r=this._functions.get(i.name))===null||r===void 0?void 0:r.info;a&&n.add(a)}}findResource(e,n){for(const r of this.uniforms)if(r.group==e&&r.binding==n)return r;for(const r of this.storage)if(r.group==e&&r.binding==n)return r;for(const r of this.textures)if(r.group==e&&r.binding==n)return r;for(const r of this.samplers)if(r.group==e&&r.binding==n)return r;return null}_findResource(e){for(const n of this.uniforms)if(n.name==e)return n;for(const n of this.storage)if(n.name==e)return n;for(const n of this.textures)if(n.name==e)return n;for(const n of this.samplers)if(n.name==e)return n;return null}_markStructsFromAST(e){const n=this._getTypeInfo(e,null);this._markStructsInUse(n)}_findResources(e,n){const r=[],i=this,a=[];return e.search(l=>{if(l instanceof vg)a.push({});else if(l instanceof _g)a.pop();else if(l instanceof _o){const u=l;n&&u.type!==null&&this._markStructsFromAST(u.type),a.length>0&&(a[a.length-1][u.name]=u)}else if(l instanceof ql){const u=l;n&&u.type!==null&&this._markStructsFromAST(u.type)}else if(l instanceof Y_){const u=l;n&&u.type!==null&&this._markStructsFromAST(u.type),a.length>0&&(a[a.length-1][u.name]=u)}else if(l instanceof K_){const u=l;if(a.length>0&&a[a.length-1][u.name])return;const f=i._findResource(u.name);f&&r.push(f)}else if(l instanceof yM){const u=l,f=i._functions.get(u.name);f&&(n&&(f.inUse=!0),e.calls.add(f.node),f.resources===null&&(f.resources=i._findResources(f.node,n)),r.push(...f.resources))}else if(l instanceof pM){const u=l,f=i._functions.get(u.name);f&&(n&&(f.inUse=!0),e.calls.add(f.node),f.resources===null&&(f.resources=i._findResources(f.node,n)),r.push(...f.resources))}}),[...new Map(r.map(l=>[l.name,l])).values()]}getBindGroups(){const e=[];function n(r,i){r>=e.length&&(e.length=r+1),e[r]===void 0&&(e[r]=[]),i>=e[r].length&&(e[r].length=i+1)}for(const r of this.uniforms){n(r.group,r.binding);const i=e[r.group];i[r.binding]=r}for(const r of this.storage){n(r.group,r.binding);const i=e[r.group];i[r.binding]=r}for(const r of this.textures){n(r.group,r.binding);const i=e[r.group];i[r.binding]=r}for(const r of this.samplers){n(r.group,r.binding);const i=e[r.group];i[r.binding]=r}return e}_getOutputs(e,n=void 0){if(n===void 0&&(n=[]),e instanceof go)this._getStructOutputs(e,n);else{const r=this._getOutputInfo(e);r!==null&&n.push(r)}return n}_getStructOutputs(e,n){for(const r of e.members)if(r.type instanceof go)this._getStructOutputs(r.type,n);else{const i=this._getAttribute(r,"location")||this._getAttribute(r,"builtin");if(i!==null){const a=this._getTypeInfo(r.type,r.type.attributes),l=this._parseInt(i.value),u=new i2(r.name,a,i.name,l);n.push(u)}}}_getOutputInfo(e){const n=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(n!==null){const r=this._getTypeInfo(e,e.attributes),i=this._parseInt(n.value);return new i2("",r,n.name,i)}return null}_getInputs(e,n=void 0){n===void 0&&(n=[]);for(const r of e)if(r.type instanceof go)this._getStructInputs(r.type,n);else{const i=this._getInputInfo(r);i!==null&&n.push(i)}return n}_getStructInputs(e,n){for(const r of e.members)if(r.type instanceof go)this._getStructInputs(r.type,n);else{const i=this._getInputInfo(r);i!==null&&n.push(i)}}_getInputInfo(e){const n=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(n!==null){const r=this._getAttribute(e,"interpolation"),i=this._getTypeInfo(e.type,e.attributes),a=this._parseInt(n.value),l=new QV(e.name,i,n.name,a);return r!==null&&(l.interpolation=this._parseString(r.value)),l}return null}_parseString(e){return e instanceof Array&&(e=e[0]),e}_parseInt(e){e instanceof Array&&(e=e[0]);const n=parseInt(e);return isNaN(n)?e:n}_getAlias(e){for(const n of this.aliases)if(n.name==e)return n.type;return null}_getAliasInfo(e){return new ZV(e.name,this._getTypeInfo(e.type,null))}_getTypeInfo(e,n){if(this._types.has(e))return this._types.get(e);if(e instanceof _M){const i=e,a=i.format?this._getTypeInfo(i.format,i.attributes):null,l=new Qv(i.name,n);return l.format=a,l.count=i.count,this._types.set(e,l),this._updateTypeInfo(l),l}if(e instanceof go){const i=e,a=new _h(i.name,n);a.startLine=i.startLine,a.endLine=i.endLine;for(const l of i.members){const u=this._getTypeInfo(l.type,l.attributes);a.members.push(new n2(l.name,u,l.attributes))}return this._types.set(e,a),this._updateTypeInfo(a),a}if(e instanceof qu){const i=e,a=i.format instanceof Zo,l=i.format?a?this._getTypeInfo(i.format,null):new nc(i.format,null):null,u=new r2(i.name,l,n,i.access);return this._types.set(e,u),this._updateTypeInfo(u),u}if(e instanceof vM){const i=e,a=i.format?this._getTypeInfo(i.format,null):null,l=new r2(i.name,a,n,i.access);return this._types.set(e,l),this._updateTypeInfo(l),l}const r=new nc(e.name,n);return this._types.set(e,r),this._updateTypeInfo(r),r}_updateTypeInfo(e){var n,r;const i=this._getTypeSize(e);if(e.size=(n=i==null?void 0:i.size)!==null&&n!==void 0?n:0,e instanceof Qv&&e.format){const a=this._getTypeSize(e.format);e.stride=(r=a==null?void 0:a.size)!==null&&r!==void 0?r:0,this._updateTypeInfo(e.format)}e instanceof _h&&this._updateStructInfo(e)}_updateStructInfo(e){var n;let r=0,i=0,a=0,l=0;for(let u=0,f=e.members.length;ut.name);Vs._samplerTypes=k.sampler_type.map(t=>t.name);function rH(t){var a;const e={attributes:[],bindings:[]};let n;try{n=iH(t)}catch(l){return Re.error(l.message)(),e}for(const l of n.uniforms){const u=[];for(const f of((a=l.type)==null?void 0:a.members)||[])u.push({name:f.name,type:s2(f.type)});e.bindings.push({type:"uniform",name:l.name,group:l.group,location:l.binding,members:u})}for(const l of n.textures)e.bindings.push({type:"texture",name:l.name,group:l.group,location:l.binding});for(const l of n.samplers)e.bindings.push({type:"sampler",name:l.name,group:l.group,location:l.binding});const r=n.entry.vertex[0],i=(r==null?void 0:r.inputs.length)||0;for(let l=0;l`:t.name}function iH(t){try{return new Vs(t)}catch(e){if(e instanceof Error)throw e;let n="WGSL parse error";throw typeof e=="object"&&(e!=null&&e.message)&&(n+=`: ${e.message} `),typeof e=="object"&&(e!=null&&e.token)&&(n+=e.token.line||""),new Error(n,{cause:e})}}const sH={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...sH}};const Oi=globalThis.mathgl.config;function aH(t,{precision:e=Oi.precision}={}){return t=oH(t),`${parseFloat(t.toPrecision(e))}`}function Mc(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Fa(t,e,n){return cH(t,r=>Math.max(e,Math.min(n,r)))}function yg(t,e,n){return Mc(t)?t.map((r,i)=>yg(r,e[i],n)):n*e+(1-n)*t}function Of(t,e,n){const r=Oi.EPSILON;try{if(t===e)return!0;if(Mc(t)&&Mc(e)){if(t.length!==e.length)return!1;for(let i=0;i0?", ":"")+aH(this[r],e);return`${e.printTypes?this.constructor.name:""}[${n}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let n=0;n=0&&e=0&&eMath.PI*2)throw Error("expected radians")}function KH(t,e,n,r,i,a){const l=2*a/(n-e),u=2*a/(i-r),f=(n+e)/(n-e),h=(i+r)/(i-r),g=-1,m=-1,v=-2*a;return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=f,t[9]=h,t[10]=g,t[11]=m,t[12]=0,t[13]=0,t[14]=v,t[15]=0,t}function xM(t,e=[],n=0){const r=Math.fround(t),i=t-r;return e[n]=r,e[n+1]=i,e}function ZH(t){return t-Math.fround(t)}function QH(t){const e=new Float32Array(32);for(let n=0;n<4;++n)for(let r=0;r<4;++r){const i=n*4+r;xM(t[r*4+n],e,i*2)}return e}const GH=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND + +// All these functions are for substituting tan() function from Intel GPU only +const float TWO_PI = 6.2831854820251465; +const float PI_2 = 1.5707963705062866; +const float PI_16 = 0.1963495463132858; + +const float SIN_TABLE_0 = 0.19509032368659973; +const float SIN_TABLE_1 = 0.3826834261417389; +const float SIN_TABLE_2 = 0.5555702447891235; +const float SIN_TABLE_3 = 0.7071067690849304; + +const float COS_TABLE_0 = 0.9807852506637573; +const float COS_TABLE_1 = 0.9238795042037964; +const float COS_TABLE_2 = 0.8314695954322815; +const float COS_TABLE_3 = 0.7071067690849304; + +const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3! +const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5! +const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7! +const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9! + +float sin_taylor_fp32(float a) { + float r, s, t, x; + + if (a == 0.0) { + return 0.0; + } + + x = -a * a; + s = a; + r = a; + + r = r * x; + t = r * INVERSE_FACTORIAL_3; + s = s + t; + + r = r * x; + t = r * INVERSE_FACTORIAL_5; + s = s + t; + + r = r * x; + t = r * INVERSE_FACTORIAL_7; + s = s + t; + + r = r * x; + t = r * INVERSE_FACTORIAL_9; + s = s + t; + + return s; +} + +void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) { + if (a == 0.0) { + sin_t = 0.0; + cos_t = 1.0; + } + sin_t = sin_taylor_fp32(a); + cos_t = sqrt(1.0 - sin_t * sin_t); +} + +float tan_taylor_fp32(float a) { + float sin_a; + float cos_a; + + if (a == 0.0) { + return 0.0; + } + + // 2pi range reduction + float z = floor(a / TWO_PI); + float r = a - TWO_PI * z; + + float t; + float q = floor(r / PI_2 + 0.5); + int j = int(q); + + if (j < -2 || j > 2) { + return 1.0 / 0.0; + } + + t = r - PI_2 * q; + + q = floor(t / PI_16 + 0.5); + int k = int(q); + int abs_k = int(abs(float(k))); + + if (abs_k > 4) { + return 1.0 / 0.0; + } else { + t = t - PI_16 * q; + } + + float u = 0.0; + float v = 0.0; + + float sin_t, cos_t; + float s, c; + sincos_taylor_fp32(t, sin_t, cos_t); + + if (k == 0) { + s = sin_t; + c = cos_t; + } else { + if (abs(float(abs_k) - 1.0) < 0.5) { + u = COS_TABLE_0; + v = SIN_TABLE_0; + } else if (abs(float(abs_k) - 2.0) < 0.5) { + u = COS_TABLE_1; + v = SIN_TABLE_1; + } else if (abs(float(abs_k) - 3.0) < 0.5) { + u = COS_TABLE_2; + v = SIN_TABLE_2; + } else if (abs(float(abs_k) - 4.0) < 0.5) { + u = COS_TABLE_3; + v = SIN_TABLE_3; + } + if (k > 0) { + s = u * sin_t + v * cos_t; + c = u * cos_t - v * sin_t; + } else { + s = u * sin_t - v * cos_t; + c = u * cos_t + v * sin_t; + } + } + + if (j == 0) { + sin_a = s; + cos_a = c; + } else if (j == 1) { + sin_a = c; + cos_a = -s; + } else if (j == -1) { + sin_a = -c; + cos_a = s; + } else { + sin_a = -s; + cos_a = -c; + } + return sin_a / cos_a; +} +#endif + +float tan_fp32(float a) { +#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND + return tan_taylor_fp32(a); +#else + return tan(a); +#endif +} +`,JH={name:"fp32",vs:GH},ej=` +uniform fp64arithmeticUniforms { + uniform float ONE; +} fp64; + +/* +About LUMA_FP64_CODE_ELIMINATION_WORKAROUND + +The purpose of this workaround is to prevent shader compilers from +optimizing away necessary arithmetic operations by swapping their sequences +or transform the equation to some 'equivalent' form. + +The method is to multiply an artifical variable, ONE, which will be known to +the compiler to be 1 only at runtime. The whole expression is then represented +as a polynomial with respective to ONE. In the coefficients of all terms, only one a +and one b should appear + +err = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE +*/ + +// Divide float number to high and low floats to extend fraction bits +vec2 split(float a) { + const float SPLIT = 4097.0; + float t = a * SPLIT; +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) + float a_hi = t * fp64.ONE - (t - a); + float a_lo = a * fp64.ONE - a_hi; +#else + float a_hi = t - (t - a); + float a_lo = a - a_hi; +#endif + return vec2(a_hi, a_lo); +} + +// Divide float number again when high float uses too many fraction bits +vec2 split2(vec2 a) { + vec2 b = split(a.x); + b.y += a.y; + return b; +} + +// Special sum operation when a > b +vec2 quickTwoSum(float a, float b) { +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) + float sum = (a + b) * fp64.ONE; + float err = b - (sum - a) * fp64.ONE; +#else + float sum = a + b; + float err = b - (sum - a); +#endif + return vec2(sum, err); +} + +// General sum operation +vec2 twoSum(float a, float b) { + float s = (a + b); +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) + float v = (s * fp64.ONE - a) * fp64.ONE; + float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE + (b - v); +#else + float v = s - a; + float err = (a - (s - v)) + (b - v); +#endif + return vec2(s, err); +} + +vec2 twoSub(float a, float b) { + float s = (a - b); +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) + float v = (s * fp64.ONE - a) * fp64.ONE; + float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE - (b + v); +#else + float v = s - a; + float err = (a - (s - v)) - (b + v); +#endif + return vec2(s, err); +} + +vec2 twoSqr(float a) { + float prod = a * a; + vec2 a_fp64 = split(a); +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) + float err = ((a_fp64.x * a_fp64.x - prod) * fp64.ONE + 2.0 * a_fp64.x * + a_fp64.y * fp64.ONE * fp64.ONE) + a_fp64.y * a_fp64.y * fp64.ONE * fp64.ONE * fp64.ONE; +#else + float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y; +#endif + return vec2(prod, err); +} + +vec2 twoProd(float a, float b) { + float prod = a * b; + vec2 a_fp64 = split(a); + vec2 b_fp64 = split(b); + float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y + + a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y; + return vec2(prod, err); +} + +vec2 sum_fp64(vec2 a, vec2 b) { + vec2 s, t; + s = twoSum(a.x, b.x); + t = twoSum(a.y, b.y); + s.y += t.x; + s = quickTwoSum(s.x, s.y); + s.y += t.y; + s = quickTwoSum(s.x, s.y); + return s; +} + +vec2 sub_fp64(vec2 a, vec2 b) { + vec2 s, t; + s = twoSub(a.x, b.x); + t = twoSub(a.y, b.y); + s.y += t.x; + s = quickTwoSum(s.x, s.y); + s.y += t.y; + s = quickTwoSum(s.x, s.y); + return s; +} + +vec2 mul_fp64(vec2 a, vec2 b) { + vec2 prod = twoProd(a.x, b.x); + // y component is for the error + prod.y += a.x * b.y; +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) + prod = split2(prod); +#endif + prod = quickTwoSum(prod.x, prod.y); + prod.y += a.y * b.x; +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) + prod = split2(prod); +#endif + prod = quickTwoSum(prod.x, prod.y); + return prod; +} + +vec2 div_fp64(vec2 a, vec2 b) { + float xn = 1.0 / b.x; +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) + vec2 yn = mul_fp64(a, vec2(xn, 0)); +#else + vec2 yn = a * xn; +#endif + float diff = (sub_fp64(a, mul_fp64(b, yn))).x; + vec2 prod = twoProd(xn, diff); + return sum_fp64(yn, prod); +} + +vec2 sqrt_fp64(vec2 a) { + if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0); + if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0); + + float x = 1.0 / sqrt(a.x); + float yn = a.x * x; +#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) + vec2 yn_sqr = twoSqr(yn) * fp64.ONE; +#else + vec2 yn_sqr = twoSqr(yn); +#endif + float diff = sub_fp64(a, yn_sqr).x; + vec2 prod = twoProd(x * 0.5, diff); +#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) + return sum_fp64(split(yn), prod); +#else + return sum_fp64(vec2(yn, 0.0), prod); +#endif +} +`,tj={ONE:1},nj={name:"fp64arithmetic",vs:ej,defaultUniforms:tj,uniformTypes:{ONE:"f32"},fp64ify:xM,fp64LowPart:ZH,fp64ifyMatrix4:QH},rj=[0,1,1,1],ij=`uniform pickingUniforms { + float isActive; + float isAttribute; + float isHighlightActive; + float useFloatColors; + vec3 highlightedObjectColor; + vec4 highlightColor; +} picking; + +out vec4 picking_vRGBcolor_Avalid; + +// Normalize unsigned byte color to 0-1 range +vec3 picking_normalizeColor(vec3 color) { + return picking.useFloatColors > 0.5 ? color : color / 255.0; +} + +// Normalize unsigned byte color to 0-1 range +vec4 picking_normalizeColor(vec4 color) { + return picking.useFloatColors > 0.5 ? color : color / 255.0; +} + +bool picking_isColorZero(vec3 color) { + return dot(color, vec3(1.0)) < 0.00001; +} + +bool picking_isColorValid(vec3 color) { + return dot(color, vec3(1.0)) > 0.00001; +} + +// Check if this vertex is highlighted +bool isVertexHighlighted(vec3 vertexColor) { + vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); + return + bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor)); +} + +// Set the current picking color +void picking_setPickingColor(vec3 pickingColor) { + pickingColor = picking_normalizeColor(pickingColor); + + if (bool(picking.isActive)) { + // Use alpha as the validity flag. If pickingColor is [0, 0, 0] fragment is non-pickable + picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor)); + + if (!bool(picking.isAttribute)) { + // Stores the picking color so that the fragment shader can render it during picking + picking_vRGBcolor_Avalid.rgb = pickingColor; + } + } else { + // Do the comparison with selected item color in vertex shader as it should mean fewer compares + picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor)); + } +} + +void picking_setPickingAttribute(float value) { + if (bool(picking.isAttribute)) { + picking_vRGBcolor_Avalid.r = value; + } +} + +void picking_setPickingAttribute(vec2 value) { + if (bool(picking.isAttribute)) { + picking_vRGBcolor_Avalid.rg = value; + } +} + +void picking_setPickingAttribute(vec3 value) { + if (bool(picking.isAttribute)) { + picking_vRGBcolor_Avalid.rgb = value; + } +} +`,sj=`uniform pickingUniforms { + float isActive; + float isAttribute; + float isHighlightActive; + float useFloatColors; + vec3 highlightedObjectColor; + vec4 highlightColor; +} picking; + +in vec4 picking_vRGBcolor_Avalid; + +/* + * Returns highlight color if this item is selected. + */ +vec4 picking_filterHighlightColor(vec4 color) { + // If we are still picking, we don't highlight + if (picking.isActive > 0.5) { + return color; + } + + bool selected = bool(picking_vRGBcolor_Avalid.a); + + if (selected) { + // Blend in highlight color based on its alpha value + float highLightAlpha = picking.highlightColor.a; + float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha); + float highLightRatio = highLightAlpha / blendedAlpha; + + vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio); + return vec4(blendedRGB, blendedAlpha); + } else { + return color; + } +} + +/* + * Returns picking color if picking enabled else unmodified argument. + */ +vec4 picking_filterPickingColor(vec4 color) { + if (bool(picking.isActive)) { + if (picking_vRGBcolor_Avalid.a == 0.0) { + discard; + } + return picking_vRGBcolor_Avalid; + } + return color; +} + +/* + * Returns picking color if picking is enabled if not + * highlight color if this item is selected, otherwise unmodified argument. + */ +vec4 picking_filterColor(vec4 color) { + vec4 highlightColor = picking_filterHighlightColor(color); + return picking_filterPickingColor(highlightColor); +} +`,c2={props:{},uniforms:{},name:"picking",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useFloatColors:"f32",highlightedObjectColor:"vec3",highlightColor:"vec4"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useFloatColors:!0,highlightedObjectColor:[0,0,0],highlightColor:rj},vs:ij,fs:sj,getUniforms:aj};function aj(t={},e){const n={};if(t.highlightedObjectColor!==void 0)if(t.highlightedObjectColor===null)n.isHighlightActive=!1;else{n.isHighlightActive=!0;const r=t.highlightedObjectColor.slice(0,3);n.highlightedObjectColor=r}if(t.highlightColor){const r=Array.from(t.highlightColor,i=>i/255);Number.isFinite(r[3])||(r[3]=1),n.highlightColor=r}return t.isActive!==void 0&&(n.isActive=!!t.isActive,n.isAttribute=!!t.isAttribute),t.useFloatColors!==void 0&&(n.useFloatColors=!!t.useFloatColors),n}const u2=`precision highp int; + +// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) +struct AmbientLight { + vec3 color; +}; + +struct PointLight { + vec3 color; + vec3 position; + vec3 attenuation; // 2nd order x:Constant-y:Linear-z:Exponential +}; + +struct DirectionalLight { + vec3 color; + vec3 direction; +}; + +uniform lightingUniforms { + int enabled; + int lightType; + + int directionalLightCount; + int pointLightCount; + + vec3 ambientColor; + + vec3 lightColor0; + vec3 lightPosition0; + vec3 lightDirection0; + vec3 lightAttenuation0; + + vec3 lightColor1; + vec3 lightPosition1; + vec3 lightDirection1; + vec3 lightAttenuation1; + + vec3 lightColor2; + vec3 lightPosition2; + vec3 lightDirection2; + vec3 lightAttenuation2; +} lighting; + +PointLight lighting_getPointLight(int index) { + switch (index) { + case 0: + return PointLight(lighting.lightColor0, lighting.lightPosition0, lighting.lightAttenuation0); + case 1: + return PointLight(lighting.lightColor1, lighting.lightPosition1, lighting.lightAttenuation1); + case 2: + default: + return PointLight(lighting.lightColor2, lighting.lightPosition2, lighting.lightAttenuation2); + } +} + +DirectionalLight lighting_getDirectionalLight(int index) { + switch (index) { + case 0: + return DirectionalLight(lighting.lightColor0, lighting.lightDirection0); + case 1: + return DirectionalLight(lighting.lightColor1, lighting.lightDirection1); + case 2: + default: + return DirectionalLight(lighting.lightColor2, lighting.lightDirection2); + } +} + +float getPointLightAttenuation(PointLight pointLight, float distance) { + return pointLight.attenuation.x + + pointLight.attenuation.y * distance + + pointLight.attenuation.z * distance * distance; +} + +// #endif +`,oj=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) +struct AmbientLight { + color: vec3, +}; + +struct PointLight { + color: vec3, + position: vec3, + attenuation: vec3, // 2nd order x:Constant-y:Linear-z:Exponential +}; + +struct DirectionalLight { + color: vec3, + direction: vec3, +}; + +struct lightingUniforms { + enabled: i32, + poightCount: i32, + directionalLightCount: i32, + + ambientColor: vec3, + + // TODO - support multiple lights by uncommenting arrays below + lightType: i32, + lightColor: vec3, + lightDirection: vec3, + lightPosition: vec3, + lightAttenuation: vec3, + + // AmbientLight ambientLight; + // PointLight pointLight[MAX_LIGHTS]; + // DirectionalLight directionalLight[MAX_LIGHTS]; +}; + +// Binding 0:1 is reserved for lighting (Note: could go into separate bind group as it is stable across draw calls) +@binding(1) @group(0) var lighting : lightingUniforms; + +fn lighting_getPointLight(index: i32) -> PointLight { + return PointLight(lighting.lightColor, lighting.lightPosition, lighting.lightAttenuation); +} + +fn lighting_getDirectionalLight(index: i32) -> DirectionalLight { + return DirectionalLight(lighting.lightColor, lighting.lightDirection); +} + +fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 { + return pointLight.attenuation.x + + pointLight.attenuation.y * distance + + pointLight.attenuation.z * distance * distance; +} +`,MM=3,lj=255;var Pf;(function(t){t[t.POINT=0]="POINT",t[t.DIRECTIONAL=1]="DIRECTIONAL"})(Pf||(Pf={}));const sf={props:{},uniforms:{},name:"lighting",defines:{MAX_LIGHTS:MM},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientLightColor:"vec3",lightColor0:"vec3",lightPosition0:"vec3",lightDirection0:"vec3",lightAttenuation0:"vec3",lightColor1:"vec3",lightPosition1:"vec3",lightDirection1:"vec3",lightAttenuation1:"vec3",lightColor2:"vec3",lightPosition2:"vec3",lightDirection2:"vec3",lightAttenuation2:"vec3"},defaultUniforms:{enabled:1,lightType:Pf.POINT,directionalLightCount:0,pointLightCount:0,ambientLightColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0]},source:oj,vs:u2,fs:u2,getUniforms:cj};function cj(t,e={}){if(t=t&&{...t},!t)return{...sf.defaultUniforms};t.lights&&(t={...t,...fj(t.lights),lights:void 0});const{ambientLight:n,pointLights:r,directionalLights:i}=t||{};if(!(n||r&&r.length>0||i&&i.length>0))return{...sf.defaultUniforms,enabled:0};const l={...sf.defaultUniforms,...e,...uj({ambientLight:n,pointLights:r,directionalLights:i})};return t.enabled!==void 0&&(l.enabled=t.enabled?1:0),l}function uj({ambientLight:t,pointLights:e=[],directionalLights:n=[]}){const r={};r.ambientLightColor=n0(t);let i=0;for(const a of e){r.lightType=Pf.POINT;const l=i;r[`lightColor${l}`]=n0(a),r[`lightPosition${l}`]=a.position,r[`lightAttenuation${l}`]=a.attenuation||[1,0,0],i++}for(const a of n){r.lightType=Pf.DIRECTIONAL;const l=i;r[`lightColor${l}`]=n0(a),r[`lightDirection${l}`]=a.direction,i++}return i>MM&&Re.warn("MAX_LIGHTS exceeded")(),r.directionalLightCount=n.length,r.pointLightCount=e.length,r}function fj(t){var n,r;const e={pointLights:[],directionalLights:[]};for(const i of t||[])switch(i.type){case"ambient":e.ambientLight=i;break;case"directional":(n=e.directionalLights)==null||n.push(i);break;case"point":(r=e.pointLights)==null||r.push(i);break}return e}function n0(t={}){const{color:e=[0,0,0],intensity:n=1}=t;return e.map(r=>r*n/lj)}const OM=`uniform phongMaterialUniforms { + uniform float ambient; + uniform float diffuse; + uniform float shininess; + uniform vec3 specularColor; +} material; +`,PM=`uniform phongMaterialUniforms { + uniform float ambient; + uniform float diffuse; + uniform float shininess; + uniform vec3 specularColor; +} material; + +vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) { + vec3 halfway_direction = normalize(light_direction + view_direction); + float lambertian = dot(light_direction, normal_worldspace); + float specular = 0.0; + if (lambertian > 0.0) { + float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); + specular = pow(specular_angle, material.shininess); + } + lambertian = max(lambertian, 0.0); + return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color; +} + +vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) { + vec3 lightColor = surfaceColor; + + if (lighting.enabled == 0) { + return lightColor; + } + + vec3 view_direction = normalize(cameraPosition - position_worldspace); + lightColor = material.ambient * surfaceColor * lighting.ambientColor; + + for (int i = 0; i < lighting.pointLightCount; i++) { + PointLight pointLight = lighting_getPointLight(i); + vec3 light_position_worldspace = pointLight.position; + vec3 light_direction = normalize(light_position_worldspace - position_worldspace); + float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace)); + lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation); + } + + int totalLights = min(MAX_LIGHTS, lighting.pointLightCount + lighting.directionalLightCount); + for (int i = lighting.pointLightCount; i < totalLights; i++) { + DirectionalLight directionalLight = lighting_getDirectionalLight(i); + lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); + } + + return lightColor; +} +`,NM={props:{},name:"gouraudMaterial",vs:PM.replace("phongMaterial","gouraudMaterial"),fs:OM.replace("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:1},dependencies:[sf],uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(t){const e={...t};return e.specularColor&&(e.specularColor=e.specularColor.map(n=>n/255)),{...NM.defaultUniforms,...e}}},dj=`struct phongMaterialUniforms { + ambient: f32, + diffuse: f32, + shininess: f32, + specularColor: vec3, +}; + +@binding(2) @group(0) var material : phongMaterialUniforms; + +fn lighting_getLightColor(surfaceColor: vec3, light_direction: vec3, view_direction: vec3, normal_worldspace: vec3, color: vec3) -> vec3 { + let halfway_direction: vec3 = normalize(light_direction + view_direction); + var lambertian: f32 = dot(light_direction, normal_worldspace); + var specular: f32 = 0.0; + if (lambertian > 0.0) { + let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); + specular = pow(specular_angle, material.shininess); + } + lambertian = max(lambertian, 0.0); + return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color; +} + +fn lighting_getLightColor2(surfaceColor: vec3, cameraPosition: vec3, position_worldspace: vec3, normal_worldspace: vec3) -> vec3 { + var lightColor: vec3 = surfaceColor; + + if (lighting.enabled == 0) { + return lightColor; + } + + let view_direction: vec3 = normalize(cameraPosition - position_worldspace); + lightColor = material.ambient * surfaceColor * lighting.ambientColor; + + if (lighting.lightType == 0) { + let pointLight: PointLight = lighting_getPointLight(0); + let light_position_worldspace: vec3 = pointLight.position; + let light_direction: vec3 = normalize(light_position_worldspace - position_worldspace); + lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); + } else if (lighting.lightType == 1) { + var directionalLight: DirectionalLight = lighting_getDirectionalLight(0); + lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); + } + + return lightColor; + /* + for (int i = 0; i < MAX_LIGHTS; i++) { + if (i >= lighting.pointLightCount) { + break; + } + PointLight pointLight = lighting.pointLight[i]; + vec3 light_position_worldspace = pointLight.position; + vec3 light_direction = normalize(light_position_worldspace - position_worldspace); + lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); + } + + for (int i = 0; i < MAX_LIGHTS; i++) { + if (i >= lighting.directionalLightCount) { + break; + } + DirectionalLight directionalLight = lighting.directionalLight[i]; + lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); + } + */ +} + +fn lighting_getSpecularLightColor(cameraPosition: vec3, position_worldspace: vec3, normal_worldspace: vec3) -> vec3{ + var lightColor = vec3(0, 0, 0); + let surfaceColor = vec3(0, 0, 0); + + if (lighting.enabled == 0) { + let view_direction = normalize(cameraPosition - position_worldspace); + + switch (lighting.lightType) { + case 0, default: { + let pointLight: PointLight = lighting_getPointLight(0); + let light_position_worldspace: vec3 = pointLight.position; + let light_direction: vec3 = normalize(light_position_worldspace - position_worldspace); + lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color); + } + case 1: { + let directionalLight: DirectionalLight = lighting_getDirectionalLight(0); + lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); + } + } + } + return lightColor; +} +`,IM={name:"phongMaterial",dependencies:[sf],source:dj,vs:OM,fs:PM,defines:{LIGHTING_FRAGMENT:1},uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(t){const e={...t};return e.specularColor&&(e.specularColor=e.specularColor.map(n=>n/255)),{...IM.defaultUniforms,...e}}},f2=`uniform layerUniforms { + uniform float opacity; +} layer; +`,hj={name:"layer",vs:f2,fs:f2,getUniforms:t=>({opacity:Math.pow(t.opacity,1/2.2)}),uniformTypes:{opacity:"f32"}},DM="#define SMOOTH_EDGE_RADIUS 0.5",gj=` +${DM} + +struct VertexGeometry { + vec4 position; + vec3 worldPosition; + vec3 worldPositionAlt; + vec3 normal; + vec2 uv; + vec3 pickingColor; +} geometry = VertexGeometry( + vec4(0.0, 0.0, 1.0, 0.0), + vec3(0.0), + vec3(0.0), + vec3(0.0), + vec2(0.0), + vec3(0.0) +); +`,pj=` +${DM} + +struct FragmentGeometry { + vec2 uv; +} geometry; + +float smoothedge(float edge, float x) { + return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); +} +`,FM={name:"geometry",vs:gj,fs:pj},mj=25;var or;(function(t){t[t.Start=1]="Start",t[t.Move=2]="Move",t[t.End=4]="End",t[t.Cancel=8]="Cancel"})(or||(or={}));var ur;(function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.Up=4]="Up",t[t.Down=8]="Down",t[t.Horizontal=3]="Horizontal",t[t.Vertical=12]="Vertical",t[t.All=15]="All"})(ur||(ur={}));var Ct;(function(t){t[t.Possible=1]="Possible",t[t.Began=2]="Began",t[t.Changed=4]="Changed",t[t.Ended=8]="Ended",t[t.Recognized=8]="Recognized",t[t.Cancelled=16]="Cancelled",t[t.Failed=32]="Failed"})(Ct||(Ct={}));const vj="compute",_j="auto",G_="manipulation",Bh="none",J_="pan-x",ey="pan-y";function yj(t){if(t.includes(Bh))return Bh;const e=t.includes(J_),n=t.includes(ey);return e&&n?Bh:e||n?e?J_:ey:t.includes(G_)?G_:_j}class bj{constructor(e,n){this.actions="",this.manager=e,this.set(n)}set(e){e===vj&&(e=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=e,this.actions=e)}update(){this.set(this.manager.options.touchAction)}compute(){let e=[];for(const n of this.manager.recognizers)n.options.enable&&(e=e.concat(n.getTouchAction()));return yj(e.join(" "))}}function Sg(t){return t.trim().split(/\s+/g)}function r0(t,e,n){if(t)for(const r of Sg(e))t.addEventListener(r,n,!1)}function i0(t,e,n){if(t)for(const r of Sg(e))t.removeEventListener(r,n,!1)}function d2(t){return(t.ownerDocument||t).defaultView}function Sj(t,e){let n=t;for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function kM(t){const e=t.length;if(e===1)return{x:Math.round(t[0].clientX),y:Math.round(t[0].clientY)};let n=0,r=0,i=0;for(;i=Math.abs(e)?t<0?ur.Left:ur.Right:e<0?ur.Up:ur.Down}function wj(t,e){const n=e.center;let r=t.offsetDelta,i=t.prevDelta;const a=t.prevInput;return(e.eventType===or.Start||(a==null?void 0:a.eventType)===or.End)&&(i=t.prevDelta={x:(a==null?void 0:a.deltaX)||0,y:(a==null?void 0:a.deltaY)||0},r=t.offsetDelta={x:n.x,y:n.y}),{deltaX:i.x+(n.x-r.x),deltaY:i.y+(n.y-r.y)}}function LM(t,e,n){return{x:e/t||0,y:n/t||0}}function Tj(t,e){return g2(e[0],e[1])/g2(t[0],t[1])}function Cj(t,e){return p2(e[1],e[0])-p2(t[1],t[0])}function Aj(t,e){const n=t.lastInterval||e,r=e.timeStamp-n.timeStamp;let i,a,l,u;if(e.eventType!==or.Cancel&&(r>mj||n.velocity===void 0)){const f=e.deltaX-n.deltaX,h=e.deltaY-n.deltaY,g=LM(r,f,h);a=g.x,l=g.y,i=Math.abs(g.x)>Math.abs(g.y)?g.x:g.y,u=UM(f,h),t.lastInterval=e}else i=n.velocity,a=n.velocityX,l=n.velocityY,u=n.direction;e.velocity=i,e.velocityX=a,e.velocityY=l,e.direction=u}function Rj(t,e){const{session:n}=t,{pointers:r}=e,{length:i}=r;n.firstInput||(n.firstInput=h2(e)),i>1&&!n.firstMultiple?n.firstMultiple=h2(e):i===1&&(n.firstMultiple=!1);const{firstInput:a,firstMultiple:l}=n,u=l?l.center:a.center,f=e.center=kM(r);e.timeStamp=Date.now(),e.deltaTime=e.timeStamp-a.timeStamp,e.angle=Ej(u,f),e.distance=BM(u,f);const{deltaX:h,deltaY:g}=wj(n,e);e.deltaX=h,e.deltaY=g,e.offsetDirection=UM(e.deltaX,e.deltaY);const m=LM(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=m.x,e.overallVelocityY=m.y,e.overallVelocity=Math.abs(m.x)>Math.abs(m.y)?m.x:m.y,e.scale=l?Tj(l.pointers,r):1,e.rotation=l?Cj(l.pointers,r):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length;let v=t.element;return Sj(e.srcEvent.target,v)&&(v=e.srcEvent.target),e.target=v,Aj(n,e),e}function xj(t,e,n){const r=n.pointers.length,i=n.changedPointers.length,a=e&or.Start&&r-i===0,l=e&(or.End|or.Cancel)&&r-i===0;n.isFirst=!!a,n.isFinal=!!l,a&&(t.session={}),n.eventType=e;const u=Rj(t,n);t.emit("hammer.input",u),t.recognize(u),t.session.prevInput=u}let Mj=class{constructor(e){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=n=>{this.manager.options.enable&&this.handler(n)},this.manager=e,this.element=e.element,this.target=e.options.inputTarget||e.element}callback(e,n){xj(this.manager,e,n)}init(){r0(this.element,this.evEl,this.domHandler),r0(this.target,this.evTarget,this.domHandler),r0(d2(this.element),this.evWin,this.domHandler)}destroy(){i0(this.element,this.evEl,this.domHandler),i0(this.target,this.evTarget,this.domHandler),i0(d2(this.element),this.evWin,this.domHandler)}};const Oj={pointerdown:or.Start,pointermove:or.Move,pointerup:or.End,pointercancel:or.Cancel,pointerout:or.Cancel},Pj="pointerdown",Nj="pointermove pointerup pointercancel";class Ij extends Mj{constructor(e){super(e),this.evEl=Pj,this.evWin=Nj,this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){const{store:n}=this;let r=!1;const i=Oj[e.type],a=e.pointerType,l=a==="touch";let u=n.findIndex(f=>f.pointerId===e.pointerId);i&or.Start&&(e.buttons||l)?u<0&&(n.push(e),u=n.length-1):i&(or.End|or.Cancel)&&(r=!0),!(u<0)&&(n[u]=e,this.callback(i,{pointers:n,changedPointers:[e],eventType:i,pointerType:a,srcEvent:e}),r&&n.splice(u,1))}}const Dj=["","webkit","Moz","MS","ms","o"];function Fj(t,e){const n=e[0].toUpperCase()+e.slice(1);for(const r of Dj){const i=r?r+n:e;if(i in t)return i}}const kj=1,m2=2,v2={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}};class Bj{constructor(e,n){this.options={...v2,...n,cssProps:{...v2.cssProps,...n.cssProps},inputTarget:n.inputTarget||e},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new Ij(this),this.touchAction=new bj(this,this.options.touchAction),this.toggleCssProps(!0)}set(e){return Object.assign(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this}stop(e){this.session.stopped=e?m2:kj}recognize(e){const{session:n}=this;if(n.stopped)return;this.session.prevented&&e.srcEvent.preventDefault();let r;const{recognizers:i}=this;let{curRecognizer:a}=n;(!a||a&&a.state&Ct.Recognized)&&(a=n.curRecognizer=null);let l=0;for(;l-1&&this.requireFail.splice(r,1)}return this}hasRequireFailures(){return!!this.requireFail.find(e=>e.options.enable)}canRecognizeWith(e){return!!this.simultaneous[e.id]}emit(e){if(!e)return;const{state:n}=this;n=Ct.Ended&&this.manager.emit(this.options.event+_2(n),e)}tryEmit(e){this.canEmit()?this.emit(e):this.state=Ct.Failed}canEmit(){let e=0;for(;e{this.state=Ct.Recognized,this.tryEmit(this._input)},n.interval),Ct.Began):Ct.Recognized}return Ct.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=Ct.Failed},this.options.interval),Ct.Failed}reset(){clearTimeout(this._timer)}emit(e){this.state===Ct.Recognized&&(e.tapCount=this.count,this.manager.emit(this.options.event,e))}}const zj=["","start","move","end","cancel","up","down","left","right"];class b2 extends $M{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:ur.All,...e}),this.pX=null,this.pY=null}getTouchAction(){const{options:{direction:e}}=this,n=[];return e&ur.Horizontal&&n.push(ey),e&ur.Vertical&&n.push(J_),n}getEventNames(){return zj.map(e=>this.options.event+e)}directionTest(e){const{options:n}=this;let r=!0,{distance:i}=e,{direction:a}=e;const l=e.deltaX,u=e.deltaY;return a&n.direction||(n.direction&ur.Horizontal?(a=l===0?ur.None:l<0?ur.Left:ur.Right,r=l!==this.pX,i=Math.abs(e.deltaX)):(a=u===0?ur.None:u<0?ur.Up:ur.Down,r=u!==this.pY,i=Math.abs(e.deltaY))),e.direction=a,r&&i>n.threshold&&!!(a&n.direction)}attrTest(e){return super.attrTest(e)&&(!!(this.state&Ct.Began)||!(this.state&Ct.Began)&&this.directionTest(e))}emit(e){this.pX=e.deltaX,this.pY=e.deltaY;const n=ur[e.direction].toLowerCase();n&&(e.additionalEvent=this.options.event+n),super.emit(e)}}const $j=["","start","move","end","cancel","in","out"];class Vj extends $M{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[Bh]}getEventNames(){return $j.map(e=>this.options.event+e)}attrTest(e){return super.attrTest(e)&&(Math.abs(e.scale-1)>this.options.threshold||!!(this.state&Ct.Began))}emit(e){if(e.scale!==1){const n=e.scale<1?"in":"out";e.additionalEvent=this.options.event+n}super.emit(e)}}class lp{constructor(e,n,r){this.element=e,this.callback=n,this.options=r}}const Hj=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",jj=Hj.indexOf("firefox")!==-1,S2=4.000244140625,Wj=40,Xj=.25;class qj extends lp{constructor(e,n,r){super(e,n,{enable:!0,...r}),this.handleEvent=i=>{if(!this.options.enable)return;let a=i.deltaY;globalThis.WheelEvent&&(jj&&i.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(a/=globalThis.devicePixelRatio),i.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(a*=Wj)),a!==0&&a%S2===0&&(a=Math.floor(a/S2)),i.shiftKey&&a&&(a=a*Xj),this.callback({type:"wheel",center:{x:i.clientX,y:i.clientY},delta:-a,srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(e,n){e==="wheel"&&(this.options.enable=n)}}const E2=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"];class Yj extends lp{constructor(e,n,r){super(e,n,{enable:!0,...r}),this.handleEvent=a=>{this.handleOverEvent(a),this.handleOutEvent(a),this.handleEnterEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)},this.pressed=!1;const{enable:i}=this.options;this.enableMoveEvent=i,this.enableLeaveEvent=i,this.enableEnterEvent=i,this.enableOutEvent=i,this.enableOverEvent=i,E2.forEach(a=>e.addEventListener(a,this.handleEvent))}destroy(){E2.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,n){switch(e){case"pointermove":this.enableMoveEvent=n;break;case"pointerover":this.enableOverEvent=n;break;case"pointerout":this.enableOutEvent=n;break;case"pointerenter":this.enableEnterEvent=n;break;case"pointerleave":this.enableLeaveEvent=n;break}}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit("pointerover",e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit("pointerout",e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit("pointerenter",e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit("pointerleave",e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.buttons===0&&(this.pressed=!1),this.pressed||this._emit("pointermove",e);break;case"mouseup":this.pressed=!1;break}}_emit(e,n){this.callback({type:e,center:{x:n.clientX,y:n.clientY},srcEvent:n,pointerType:"mouse",target:n.target})}}const w2=["keydown","keyup"];class Kj extends lp{constructor(e,n,r){super(e,n,{enable:!0,tabIndex:0,...r}),this.handleEvent=i=>{const a=i.target||i.srcElement;a.tagName==="INPUT"&&a.type==="text"||a.tagName==="TEXTAREA"||(this.enableDownEvent&&i.type==="keydown"&&this.callback({type:"keydown",srcEvent:i,key:i.key,target:i.target}),this.enableUpEvent&&i.type==="keyup"&&this.callback({type:"keyup",srcEvent:i,key:i.key,target:i.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,e.tabIndex=this.options.tabIndex,e.style.outline="none",w2.forEach(i=>e.addEventListener(i,this.handleEvent))}destroy(){w2.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,n){e==="keydown"&&(this.enableDownEvent=n),e==="keyup"&&(this.enableUpEvent=n)}}class Zj extends lp{constructor(e,n,r){super(e,n,r),this.handleEvent=i=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:i.clientX,y:i.clientY},srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,n){e==="contextmenu"&&(this.options.enable=n)}}const T2=1,ty=2,C2=4,Qj={pointerdown:T2,pointermove:ty,pointerup:C2,mousedown:T2,mousemove:ty,mouseup:C2},Gj=0,Jj=1,eW=2,tW=1,nW=2,rW=4;function iW(t){const e=Qj[t.srcEvent.type];if(!e)return null;const{buttons:n,button:r}=t.srcEvent;let i=!1,a=!1,l=!1;return e===ty?(i=!!(n&tW),a=!!(n&rW),l=!!(n&nW)):(i=r===Gj,a=r===Jj,l=r===eW),{leftButton:i,middleButton:a,rightButton:l}}function sW(t,e){const n=t.center;if(!n)return null;const r=e.getBoundingClientRect(),i=r.width/e.offsetWidth||1,a=r.height/e.offsetHeight||1,l={x:(n.x-r.left-e.clientLeft)/i,y:(n.y-r.top-e.clientTop)/a};return{center:n,offsetCenter:l}}const aW={srcElement:"root",priority:0};class oW{constructor(e,n){this.handleEvent=r=>{if(this.isEmpty())return;const i=this._normalizeEvent(r);let a=r.srcEvent.target;for(;a&&a!==i.rootElement;){if(this._emit(i,a),i.handled)return;a=a.parentNode}this._emit(i,"root")},this.eventManager=e,this.recognizerName=n,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,n,r,i=!1,a=!1){const{handlers:l,handlersByElement:u}=this,f={...aW,...r};let h=u.get(f.srcElement);h||(h=[],u.set(f.srcElement,h));const g={type:e,handler:n,srcElement:f.srcElement,priority:f.priority};i&&(g.once=!0),a&&(g.passive=!0),l.push(g),this._active=this._active||!g.passive;let m=h.length-1;for(;m>=0&&!(h[m].priority>=g.priority);)m--;h.splice(m+1,0,g)}remove(e,n){const{handlers:r,handlersByElement:i}=this;for(let a=r.length-1;a>=0;a--){const l=r[a];if(l.type===e&&l.handler===n){r.splice(a,1);const u=i.get(l.srcElement);u.splice(u.indexOf(l),1),u.length===0&&i.delete(l.srcElement)}}this._active=r.some(a=>!a.passive)}_emit(e,n){const r=this.handlersByElement.get(n);if(r){let i=!1;const a=()=>{e.handled=!0},l=()=>{e.handled=!0,i=!0},u=[];for(let f=0;f{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:n}}}function lW(t){if("recognizer"in t)return t;let e;const n=Array.isArray(t)?[...t]:[t];if(typeof n[0]=="function"){const r=n.shift(),i=n.shift()||{};e=new r(i)}else e=n.shift();return{recognizer:e,recognizeWith:typeof n[0]=="string"?[n[0]]:n[0],requireFailure:typeof n[1]=="string"?[n[1]]:n[1]}}class cW{constructor(e=null,n={}){if(this._onBasicInput=r=>{this.manager.emit(r.srcEvent.type,r)},this._onOtherEvent=r=>{this.manager.emit(r.type,r)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...n},this.events=new Map,this.element=e,!!e){this.manager=new Bj(e,this.options);for(const r of this.options.recognizers){const{recognizer:i,recognizeWith:a,requireFailure:l}=lW(r);this.manager.add(i),a&&i.recognizeWith(a),l&&i.requireFailure(l)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new qj(e,this._onOtherEvent,{enable:!1}),this.moveInput=new Yj(e,this._onOtherEvent,{enable:!1}),this.keyInput=new Kj(e,this._onOtherEvent,{enable:!1,tabIndex:n.tabIndex}),this.contextmenuInput=new Zj(e,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}}getElement(){return this.element}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy())}on(e,n,r){this._addEventHandler(e,n,r,!1)}once(e,n,r){this._addEventHandler(e,n,r,!0)}watch(e,n,r){this._addEventHandler(e,n,r,!1,!0)}off(e,n){this._removeEventHandler(e,n)}_toggleRecognizer(e,n){var a,l,u,f;const{manager:r}=this;if(!r)return;const i=r.get(e);i&&(i.set({enable:n}),r.touchAction.update()),(a=this.wheelInput)==null||a.enableEventType(e,n),(l=this.moveInput)==null||l.enableEventType(e,n),(u=this.keyInput)==null||u.enableEventType(e,n),(f=this.contextmenuInput)==null||f.enableEventType(e,n)}_addEventHandler(e,n,r,i,a){if(typeof e!="string"){r=n;for(const[h,g]of Object.entries(e))this._addEventHandler(h,g,r,i,a);return}const{manager:l,events:u}=this;if(!l)return;let f=u.get(e);if(!f){const h=this._getRecognizerName(e)||e;f=new oW(this,h),u.set(e,f),l&&l.on(e,f.handleEvent)}f.add(e,n,r,i,a),f.isEmpty()||this._toggleRecognizer(f.recognizerName,!0)}_removeEventHandler(e,n){if(typeof e!="string"){for(const[a,l]of Object.entries(e))this._removeEventHandler(a,l);return}const{events:r}=this,i=r.get(e);if(i&&(i.remove(e,n),i.isEmpty())){const{recognizerName:a}=i;let l=!1;for(const u of r.values())if(u.recognizerName===a&&!u.isEmpty()){l=!0;break}l||this._toggleRecognizer(a,!1)}}_getRecognizerName(e){var n;return(n=this.manager.recognizers.find(r=>r.getEventNames().includes(e)))==null?void 0:n.options.event}}const cn={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(cn,"IDENTITY",{get:()=>(Sn.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});const _s={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},zo={common:0,meters:1,pixels:2},ny={click:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},A2={multipan:[b2,{threshold:10,direction:ur.Vertical,pointers:2}],pinch:[Vj,{},null,["multipan"]],pan:[b2,{threshold:1},["pinch"],["multipan"]],dblclick:[y2,{event:"dblclick",taps:2}],click:[y2,{event:"click"},null,["dblclick"]]},uW=Object.keys(cn).map(t=>`const int COORDINATE_SYSTEM_${t} = ${cn[t]};`).join(""),fW=Object.keys(_s).map(t=>`const int PROJECTION_MODE_${t} = ${_s[t]};`).join(""),dW=Object.keys(zo).map(t=>`const int UNIT_${t.toUpperCase()} = ${zo[t]};`).join(""),hW=`${uW} +${fW} +${dW} +uniform projectUniforms { +bool wrapLongitude; +int coordinateSystem; +vec3 commonUnitsPerMeter; +int projectionMode; +float scale; +vec3 commonUnitsPerWorldUnit; +vec3 commonUnitsPerWorldUnit2; +vec4 center; +mat4 modelMatrix; +mat4 viewProjectionMatrix; +vec2 viewportSize; +float devicePixelRatio; +float focalDistance; +vec3 cameraPosition; +vec3 coordinateOrigin; +vec3 commonOrigin; +bool pseudoMeters; +} project; +const float TILE_SIZE = 512.0; +const float PI = 3.1415926536; +const float WORLD_SCALE = TILE_SIZE / (PI * 2.0); +const vec3 ZERO_64_LOW = vec3(0.0); +const float EARTH_RADIUS = 6370972.0; +const float GLOBE_RADIUS = 256.0; +float project_size_at_latitude(float lat) { +float y = clamp(lat, -89.9, 89.9); +return 1.0 / cos(radians(y)); +} +float project_size() { +if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && +project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && +project.pseudoMeters == false) { +if (geometry.position.w == 0.0) { +return project_size_at_latitude(geometry.worldPosition.y); +} +float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0; +float y2 = y * y; +float y4 = y2 * y2; +float y6 = y4 * y2; +return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; +} +return 1.0; +} +float project_size_at_latitude(float meters, float lat) { +return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat); +} +float project_size(float meters) { +return meters * project.commonUnitsPerMeter.z * project_size(); +} +vec2 project_size(vec2 meters) { +return meters * project.commonUnitsPerMeter.xy * project_size(); +} +vec3 project_size(vec3 meters) { +return meters * project.commonUnitsPerMeter * project_size(); +} +vec4 project_size(vec4 meters) { +return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w); +} +mat3 project_get_orientation_matrix(vec3 up) { +vec3 uz = normalize(up); +vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0)); +vec3 uy = cross(uz, ux); +return mat3(ux, uy, uz); +} +bool project_needs_rotation(vec3 commonPosition, out mat3 transform) { +if (project.projectionMode == PROJECTION_MODE_GLOBE) { +transform = project_get_orientation_matrix(commonPosition); +return true; +} +return false; +} +vec3 project_normal(vec3 vector) { +vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0); +vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); +mat3 rotation; +if (project_needs_rotation(geometry.position.xyz, rotation)) { +n = rotation * n; +} +return n; +} +vec4 project_offset_(vec4 offset) { +float dy = offset.y; +vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; +return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w); +} +vec2 project_mercator_(vec2 lnglat) { +float x = lnglat.x; +if (project.wrapLongitude) { +x = mod(x + 180., 360.0) - 180.; +} +float y = clamp(lnglat.y, -89.9, 89.9); +return vec2( +radians(x) + PI, +PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5)) +) * WORLD_SCALE; +} +vec3 project_globe_(vec3 lnglatz) { +float lambda = radians(lnglatz.x); +float phi = radians(lnglatz.y); +float cosPhi = cos(phi); +float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; +return vec3( +sin(lambda) * cosPhi, +-cos(lambda) * cosPhi, +sin(phi) +) * D; +} +vec4 project_position(vec4 position, vec3 position64Low) { +vec4 position_world = project.modelMatrix * position; +if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { +if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { +return vec4( +project_mercator_(position_world.xy), +project_size_at_latitude(position_world.z, position_world.y), +position_world.w +); +} +if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) { +position_world.xyz += project.coordinateOrigin; +} +} +if (project.projectionMode == PROJECTION_MODE_GLOBE) { +if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { +return vec4( +project_globe_(position_world.xyz), +position_world.w +); +} +} +if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { +if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { +if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { +return vec4( +project_mercator_(position_world.xy) - project.commonOrigin.xy, +project_size(position_world.z), +position_world.w +); +} +} +} +if (project.projectionMode == PROJECTION_MODE_IDENTITY || +(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && +(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || +project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { +position_world.xyz -= project.coordinateOrigin; +} +return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0)); +} +vec4 project_position(vec4 position) { +return project_position(position, ZERO_64_LOW); +} +vec3 project_position(vec3 position, vec3 position64Low) { +vec4 projected_position = project_position(vec4(position, 1.0), position64Low); +return projected_position.xyz; +} +vec3 project_position(vec3 position) { +vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW); +return projected_position.xyz; +} +vec2 project_position(vec2 position) { +vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW); +return projected_position.xy; +} +vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) { +return viewProjectionMatrix * position + center; +} +vec4 project_common_position_to_clipspace(vec4 position) { +return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center); +} +vec2 project_pixel_size_to_clipspace(vec2 pixels) { +vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; +return offset * project.focalDistance; +} +float project_size_to_pixel(float meters) { +return project_size(meters) * project.scale; +} +float project_size_to_pixel(float size, int unit) { +if (unit == UNIT_METERS) return project_size_to_pixel(size); +if (unit == UNIT_COMMON) return size * project.scale; +return size; +} +float project_pixel_size(float pixels) { +return pixels / project.scale; +} +vec2 project_pixel_size(vec2 pixels) { +return pixels / project.scale; +} +`;function gW(t,e){if(t===e)return!0;if(Array.isArray(t)){const n=t.length;if(!e||e.length!==n)return!1;for(let r=0;r{for(const i in r)if(!gW(r[i],e[i])){n=t(r),e=r;break}return n}}const R2=[0,0,0,0],pW=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],VM=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],mW=[0,0,0],HM=[0,0,0],vW=Zf(bW);function jM(t,e,n=HM){n.length<3&&(n=[n[0],n[1],0]);let r=n,i,a=!0;switch(e===cn.LNGLAT_OFFSETS||e===cn.METER_OFFSETS?i=n:i=t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case _s.WEB_MERCATOR:(e===cn.LNGLAT||e===cn.CARTESIAN)&&(i=[0,0,0],a=!1);break;case _s.WEB_MERCATOR_AUTO_OFFSET:e===cn.LNGLAT?r=i:e===cn.CARTESIAN&&(r=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],i=t.unprojectPosition(r),r[0]-=n[0],r[1]-=n[1],r[2]-=n[2]);break;case _s.IDENTITY:r=t.position.map(Math.fround),r[2]=r[2]||0;break;case _s.GLOBE:a=!1,i=null;break;default:a=!1}return{geospatialOrigin:i,shaderCoordinateOrigin:r,offsetMode:a}}function _W(t,e,n){const{viewMatrixUncentered:r,projectionMatrix:i}=t;let{viewMatrix:a,viewProjectionMatrix:l}=t,u=R2,f=R2,h=t.cameraPosition;const{geospatialOrigin:g,shaderCoordinateOrigin:m,offsetMode:v}=jM(t,e,n);return v&&(f=t.projectPosition(g||m),h=[h[0]-f[0],h[1]-f[1],h[2]-f[2]],f[3]=1,u=Kf([],f,l),a=r||a,l=Do([],i,a),l=Do([],l,pW)),{viewMatrix:a,viewProjectionMatrix:l,projectionCenter:u,originCommon:f,cameraPosCommon:h,shaderCoordinateOrigin:m,geospatialOrigin:g}}function yW({viewport:t,devicePixelRatio:e=1,modelMatrix:n=null,coordinateSystem:r=cn.DEFAULT,coordinateOrigin:i=HM,autoWrapLongitude:a=!1}){r===cn.DEFAULT&&(r=t.isGeospatial?cn.LNGLAT:cn.CARTESIAN);const l=vW({viewport:t,devicePixelRatio:e,coordinateSystem:r,coordinateOrigin:i});return l.wrapLongitude=a,l.modelMatrix=n||VM,l}function bW({viewport:t,devicePixelRatio:e,coordinateSystem:n,coordinateOrigin:r}){const{projectionCenter:i,viewProjectionMatrix:a,originCommon:l,cameraPosCommon:u,shaderCoordinateOrigin:f,geospatialOrigin:h}=_W(t,n,r),g=t.getDistanceScales(),m=[t.width*e,t.height*e],v=Kf([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,S={coordinateSystem:n,projectionMode:t.projectionMode,coordinateOrigin:f,commonOrigin:l.slice(0,3),center:i,pseudoMeters:!!t._pseudoMeters,viewportSize:m,devicePixelRatio:e,focalDistance:v,commonUnitsPerMeter:g.unitsPerMeter,commonUnitsPerWorldUnit:g.unitsPerMeter,commonUnitsPerWorldUnit2:mW,scale:t.scale,wrapLongitude:!1,viewProjectionMatrix:a,modelMatrix:VM,cameraPosition:u};if(h){const w=t.getDistanceScales(h);switch(n){case cn.METER_OFFSETS:S.commonUnitsPerWorldUnit=w.unitsPerMeter,S.commonUnitsPerWorldUnit2=w.unitsPerMeter2;break;case cn.LNGLAT:case cn.LNGLAT_OFFSETS:t._pseudoMeters||(S.commonUnitsPerMeter=w.unitsPerMeter),S.commonUnitsPerWorldUnit=w.unitsPerDegree,S.commonUnitsPerWorldUnit2=w.unitsPerDegree2;break;case cn.CARTESIAN:S.commonUnitsPerWorldUnit=[1,1,w.unitsPerMeter[2]],S.commonUnitsPerWorldUnit2=[0,0,w.unitsPerMeter2[2]];break}}return S}const SW={};function EW(t=SW){return"viewport"in t?yW(t):{}}const gb={name:"project",dependencies:[JH,FM],vs:hW,getUniforms:EW,uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3",commonUnitsPerWorldUnit2:"vec3",center:"vec4",modelMatrix:"mat4x4",viewProjectionMatrix:"mat4x4",viewportSize:"vec2",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3",coordinateOrigin:"vec3",commonOrigin:"vec3",pseudoMeters:"f32"}},wW=` +vec4 project_position_to_clipspace( + vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition +) { + vec3 projectedPosition = project_position(position, position64Low); + mat3 rotation; + if (project_needs_rotation(projectedPosition, rotation)) { + // offset is specified as ENU + // when in globe projection, rotate offset so that the ground alighs with the surface of the globe + offset = rotation * offset; + } + commonPosition = vec4(projectedPosition + offset, 1.0); + return project_common_position_to_clipspace(commonPosition); +} + +vec4 project_position_to_clipspace( + vec3 position, vec3 position64Low, vec3 offset +) { + vec4 commonPosition; + return project_position_to_clipspace(position, position64Low, offset, commonPosition); +} +`,WM={name:"project32",dependencies:[gb],vs:wW};function TW(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function rc(t,e){const n=Kf([],e,t);return HH(n,n,1/n[3]),n}function x2(t,e){const n=t%e;return n<0?e+n:n}function ry(t,e,n){return tn?n:t}function CW(t){return Math.log(t)*Math.LOG2E}const pb=Math.log2||CW;function js(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const Qi=Math.PI,XM=Qi/4,Pi=Qi/180,iy=180/Qi,Pc=512,Eg=4003e4,M2=85.051129,AW=1.5;function RW(t){return pb(t)}function wg(t){const[e,n]=t;js(Number.isFinite(e)),js(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");const r=e*Pi,i=n*Pi,a=Pc*(r+Qi)/(2*Qi),l=Pc*(Qi+Math.log(Math.tan(XM+i*.5)))/(2*Qi);return[a,l]}function Nc(t){const[e,n]=t,r=e/Pc*(2*Qi)-Qi,i=2*(Math.atan(Math.exp(n/Pc*(2*Qi)-Qi))-XM);return[r*iy,i*iy]}function xW(t){const{latitude:e}=t;js(Number.isFinite(e));const n=Math.cos(e*Pi);return RW(Eg*n)-9}function s0(t){const e=Math.cos(t*Pi);return Pc/Eg/e}function sy(t){const{latitude:e,longitude:n,highPrecision:r=!1}=t;js(Number.isFinite(e)&&Number.isFinite(n));const i=Pc,a=Math.cos(e*Pi),l=i/360,u=l/a,f=i/Eg/a,h={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[l,u,f],degreesPerUnit:[1/l,1/u,1/f]};if(r){const g=Pi*Math.tan(e*Pi)/a,m=l*g/2,v=i/Eg*g,S=v/u*f;h.unitsPerDegree2=[0,m,v],h.unitsPerMeter2=[S,0,S]}return h}function qM(t,e){const[n,r,i]=t,[a,l,u]=e,{unitsPerMeter:f,unitsPerMeter2:h}=sy({longitude:n,latitude:r,highPrecision:!0}),g=wg(t);g[0]+=a*(f[0]+h[0]*l),g[1]+=l*(f[1]+h[1]*l);const m=Nc(g),v=(i||0)+(u||0);return Number.isFinite(i)||Number.isFinite(u)?[m[0],m[1],v]:m}function MW(t){const{height:e,pitch:n,bearing:r,altitude:i,scale:a,center:l}=t,u=TW();bg(u,u,[0,0,-i]),AM(u,u,-n*Pi),RM(u,u,r*Pi);const f=a/e;return hb(u,u,[f,f,f]),l&&bg(u,u,yH([],l)),u}function OW(t){const{width:e,height:n,altitude:r,pitch:i=0,offset:a,center:l,scale:u,nearZMultiplier:f=1,farZMultiplier:h=1}=t;let{fovy:g=Tg(AW)}=t;r!==void 0&&(g=Tg(r));const m=g*Pi,v=i*Pi,S=YM(g);let w=S;l&&(w+=l[2]*u/Math.cos(v)/n);const E=m*(.5+(a?a[1]:0)/n),b=Math.sin(E)*w/Math.sin(ry(Math.PI/2-v-E,.01,Math.PI-.01)),C=Math.sin(v)*b+w,T=w*10,A=Math.min(C*h,T);return{fov:m,aspect:e/n,focalDistance:S,near:f,far:A}}function Tg(t){return 2*Math.atan(.5/t)*iy}function YM(t){return .5/Math.tan(.5*t*Pi)}function KM(t,e){const[n,r,i=0]=t;return js(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),rc(e,[n,r,i,1])}function mb(t,e,n=0){const[r,i,a]=t;if(js(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(a))return rc(e,[r,i,a,1]);const l=rc(e,[r,i,0,1]),u=rc(e,[r,i,1,1]),f=l[2],h=u[2],g=f===h?0:((n||0)-f)/(h-f);return wM([],l,u,g)}function PW(t){const{width:e,height:n,bounds:r,minExtent:i=0,maxZoom:a=24,offset:l=[0,0]}=t,[[u,f],[h,g]]=r,m=NW(t.padding),v=wg([u,ry(g,-85.051129,M2)]),S=wg([h,ry(f,-85.051129,M2)]),w=[Math.max(Math.abs(S[0]-v[0]),i),Math.max(Math.abs(S[1]-v[1]),i)],E=[e-m.left-m.right-Math.abs(l[0])*2,n-m.top-m.bottom-Math.abs(l[1])*2];js(E[0]>0&&E[1]>0);const b=E[0]/w[0],C=E[1]/w[1],T=(m.right-m.left)/2/b,A=(m.top-m.bottom)/2/C,O=[(S[0]+v[0])/2+T,(S[1]+v[1])/2+A],x=Nc(O),N=Math.min(a,pb(Math.abs(Math.min(b,C))));return js(Number.isFinite(N)),{longitude:x[0],latitude:x[1],zoom:N}}function NW(t=0){return typeof t=="number"?{top:t,bottom:t,left:t,right:t}:(js(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t)}const O2=Math.PI/180;function IW(t,e=0){const{width:n,height:r,unproject:i}=t,a={targetZ:e},l=i([0,r],a),u=i([n,r],a);let f,h;const g=t.fovy?.5*t.fovy*O2:Math.atan(.5/t.altitude),m=(90-t.pitch)*O2;return g>m-.01?(f=P2(t,0,e),h=P2(t,n,e)):(f=i([0,0],a),h=i([n,0],a)),[l,u,h,f]}function P2(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=rc(r,[e,0,1,1]),a=rc(r,[e,t.height,1,1]),u=(n*t.distanceScales.unitsPerMeter[2]-i[2])/(a[2]-i[2]),f=wM([],i,a,u),h=Nc(f);return h.push(n),h}const N2=512;function DW(t){const{width:e,height:n,pitch:r=0}=t;let{longitude:i,latitude:a,zoom:l,bearing:u=0}=t;(i<-180||i>180)&&(i=x2(i+180,360)-180),(u<-180||u>180)&&(u=x2(u+180,360)-180);const f=pb(n/N2);if(l<=f)l=f,a=0;else{const h=n/2/Math.pow(2,l),g=Nc([0,h])[1];if(am&&(a=m)}}return{width:e,height:n,longitude:i,latitude:a,zoom:l,pitch:r,bearing:u}}const ZM=` +uniform shadowUniforms { + bool drawShadowMap; + bool useShadowMap; + vec4 color; + highp int lightId; + float lightCount; + mat4 viewProjectionMatrix0; + mat4 viewProjectionMatrix1; + vec4 projectCenter0; + vec4 projectCenter1; +} shadow; +`,FW=` +const int max_lights = 2; + +out vec3 shadow_vPosition[max_lights]; + +vec4 shadow_setVertexPosition(vec4 position_commonspace) { + mat4 viewProjectionMatrices[max_lights]; + viewProjectionMatrices[0] = shadow.viewProjectionMatrix0; + viewProjectionMatrices[1] = shadow.viewProjectionMatrix1; + vec4 projectCenters[max_lights]; + projectCenters[0] = shadow.projectCenter0; + projectCenters[1] = shadow.projectCenter1; + + if (shadow.drawShadowMap) { + return project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[shadow.lightId], projectCenters[shadow.lightId]); + } + if (shadow.useShadowMap) { + for (int i = 0; i < max_lights; i++) { + if(i < int(shadow.lightCount)) { + vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[i], projectCenters[i]); + shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0; + } + } + } + return gl_Position; +} +`,kW=` +${ZM} +${FW} +`,BW=` +const int max_lights = 2; +uniform sampler2D shadow_uShadowMap0; +uniform sampler2D shadow_uShadowMap1; + +in vec3 shadow_vPosition[max_lights]; + +const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0); +const vec4 bitUnpackShift = 1.0 / bitPackShift; +const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0); + +float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) { + vec4 rgbaDepth = texture(shadowMap, position.xy); + + float z = dot(rgbaDepth, bitUnpackShift); + return smoothstep(0.001, 0.01, position.z - z); +} + +vec4 shadow_filterShadowColor(vec4 color) { + if (shadow.drawShadowMap) { + vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift); + rgbaDepth -= rgbaDepth.gbaa * bitMask; + return rgbaDepth; + } + if (shadow.useShadowMap) { + float shadowAlpha = 0.0; + shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0); + if(shadow.lightCount > 1.0) { + shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1); + } + shadowAlpha *= shadow.color.a / shadow.lightCount; + float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha); + + return vec4( + mix(color.rgb, shadow.color.rgb, shadowAlpha / blendedAlpha), + blendedAlpha + ); + } + return color; +} +`,UW=` +${ZM} +${BW} +`,LW=Zf(jW),zW=Zf(WW),$W=[0,0,0,1],VW=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function HW(t,e){const[n,r,i]=t,a=mb([n,r,i],e);return Number.isFinite(i)?a:[a[0],a[1],0]}function jW({viewport:t,center:e}){return new Ss(t.viewProjectionMatrix).invert().transform(e)}function WW({viewport:t,shadowMatrices:e}){const n=[],r=t.pixelUnprojectionMatrix,i=t.isGeospatial?void 0:1,a=[[0,0,i],[t.width,0,i],[0,t.height,i],[t.width,t.height,i],[0,0,-1],[t.width,0,-1],[0,t.height,-1],[t.width,t.height,-1]].map(l=>HW(l,r));for(const l of e){const u=l.clone().translate(new bs(t.center).negate()),f=a.map(g=>u.transform(g)),h=new Ss().ortho({left:Math.min(...f.map(g=>g[0])),right:Math.max(...f.map(g=>g[0])),bottom:Math.min(...f.map(g=>g[1])),top:Math.max(...f.map(g=>g[1])),near:Math.min(...f.map(g=>-g[2])),far:Math.max(...f.map(g=>-g[2]))});n.push(h.multiplyRight(l))}return n}function XW(t){const{shadowEnabled:e=!0,project:n}=t;if(!e||!n||!t.shadowMatrices||!t.shadowMatrices.length)return{drawShadowMap:!1,useShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};const r=gb.getUniforms(n),i=LW({viewport:n.viewport,center:r.center}),a=[],l=zW({shadowMatrices:t.shadowMatrices,viewport:n.viewport}).slice();for(let f=0;f0:!1,color:t.shadowColor||$W,lightId:t.shadowLightId||0,lightCount:t.shadowMatrices.length,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};for(let f=0;f",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4",viewProjectionMatrix1:"mat4x4",projectCenter0:"vec4",projectCenter1:"vec4"}},QM={...c2,defaultUniforms:{...c2.defaultUniforms,useFloatColors:!1},inject:{"vs:DECKGL_FILTER_GL_POSITION":` + // for picking depth values + picking_setPickingAttribute(position.z / position.w); + `,"vs:DECKGL_FILTER_COLOR":` + picking_setPickingColor(geometry.pickingColor); + `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:` + // use highlight color if this fragment belongs to the selected object. + color = picking_filterHighlightColor(color); + + // use picking color if rendering to picking FBO. + color = picking_filterPickingColor(color); + `}}},qW=[FM],YW=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function KW(){const t=ug.getDefaultShaderAssembler();for(const e of qW)t.addDefaultModule(e);for(const e of YW)t.addShaderHook(e);return t}const ZW=[255,255,255],QW=1;let GW=0;class JW{constructor(e={}){this.type="ambient";const{color:n=ZW}=e,{intensity:r=QW}=e;this.id=e.id||`ambient-${GW++}`,this.color=n,this.intensity=r}}const eX=[255,255,255],tX=1,nX=[0,0,-1];let rX=0;class D2{constructor(e={}){this.type="directional";const{color:n=eX}=e,{intensity:r=tX}=e,{direction:i=nX}=e,{_shadow:a=!1}=e;this.id=e.id||`directional-${rX++}`,this.color=n,this.intensity=r,this.type="directional",this.direction=new bs(i).normalize().toArray(),this.shadow=a}getProjectedLight(e){return this}}class iX{constructor(e,n={id:"pass"}){const{id:r}=n;this.id=r,this.device=e,this.props={...n}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}}class vb extends iX{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){const[n,r]=this.device.canvasContext.getDrawingBufferSize(),i=e.clearCanvas??!0,a=e.clearColor??(i?[0,0,0,0]:!1),l=i?1:!1,u=i?0:!1,f=e.colorMask??15,h={viewport:[0,0,n,r]};e.colorMask&&(h.colorMask=f),e.scissorRect&&(h.scissorRect=e.scissorRect);const g=this.device.beginRenderPass({framebuffer:e.target,parameters:h,clearColor:a,clearDepth:l,clearStencil:u});try{return this._drawLayers(g,e)}finally{g.end()}}_drawLayers(e,n){const{target:r,shaderModuleProps:i,viewports:a,views:l,onViewportActive:u,clearStack:f=!0}=n;n.pass=n.pass||"unknown",f&&(this._lastRenderIndex=-1);const h=[];for(const g of a){const m=l&&l[g.id];u==null||u(g);const v=this._getDrawLayerParams(g,n),S=g.subViewports||[g];for(const w of S){const E=this._drawLayersInViewport(e,{target:r,shaderModuleProps:i,viewport:w,view:m,pass:n.pass,layers:n.layers},v);h.push(E)}}return h}_getDrawLayerParams(e,{layers:n,pass:r,isPicking:i=!1,layerFilter:a,cullRect:l,effects:u,shaderModuleProps:f},h=!1){var w;const g=[],m=GM(this._lastRenderIndex+1),v={layer:n[0],viewport:e,isPicking:i,renderPass:r,cullRect:l},S={};for(let E=0;E{const l=i.props._offset,u=i.id,f=i.parent&&i.parent.id;let h;if(f&&!(f in e)&&r(i.parent,!1),f in n){const g=n[f]=n[f]||GM(e[f],e);h=g(i,a),n[u]=g}else Number.isFinite(l)?(h=l+(e[f]||0),n[u]=null):h=t;return a&&h>=t&&(t=h+1),e[u]=h,h};return r}function sX(t,{shaderModuleProps:e,target:n,viewport:r}){var f;const i=((f=e==null?void 0:e.project)==null?void 0:f.devicePixelRatio)??t.canvasContext.cssToDeviceRatio(),[,a]=t.canvasContext.getDrawingBufferSize(),l=n?n.height:a,u=r;return[u.x*i,l-(u.y+u.height)*i,u.width*i,u.height*i]}function F2(t,...e){for(const n of e)if(n)for(const r in n)t[r]?Object.assign(t[r],n[r]):t[r]=n[r];return t}class aX extends vb{constructor(e,n){super(e,n);const r=e.createTexture({format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},mipmaps:!0}),i=e.createTexture({format:"depth16unorm",width:1,height:1,mipmaps:!1});this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[r],depthStencilAttachment:i})}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null)}getShadowMap(){return this.fbo.colorAttachments[0].texture}render(e){const n=this.fbo,r=this.device.canvasContext.cssToDeviceRatio(),i=e.viewports[0],a=i.width*r,l=i.height*r,u=[1,1,1,1];(a!==n.width||l!==n.height)&&n.resize({width:a,height:l}),super.render({...e,clearColor:u,target:n,pass:"shadow"})}getLayerParameters(e,n,r){return{...e.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}shouldDrawLayer(e){return e.props.shadowEnabled!==!1}getShaderModuleProps(e,n,r){return{shadow:{project:r.project,drawToShadowMap:!0}}}}const oX={color:[255,255,255],intensity:1},k2=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],lX=[0,0,0,200/255];class JM{constructor(e={}){this.id="lighting-effect",this.shadowColor=lX,this.shadow=!1,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;const{device:n,deck:r}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(n),r._addDefaultShaderModule(I2),this.dummyShadowMap=n.createTexture({width:1,height:1}))}setProps(e){this.ambientLight=void 0,this.directionalLights=[],this.pointLights=[];for(const n in e){const r=e[n];switch(r.type){case"ambient":this.ambientLight=r;break;case"directional":this.directionalLights.push(r);break;case"point":this.pointLights.push(r);break}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(n=>n.shadow),this.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:n,viewports:r,onViewportActive:i,views:a}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let l=0;ll.getShadowMap()),dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{},i={enabled:!0,ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(l=>l.getProjectedLight({layer:e})),pointLights:this.pointLights.map(l=>l.getProjectedLight({layer:e}))},a=e.props.material;return{shadow:r,lighting:i,phongMaterial:a,gouraudMaterial:a}}cleanup(e){for(const n of this.shadowPasses)n.delete();this.shadowPasses.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(I2))}_calculateMatrices(){const e=[];for(const n of this.directionalLights){const r=new Ss().lookAt({eye:new bs(n.direction).negate()});e.push(r)}return e}_createShadowPasses(e){for(let n=0;ni&&(a=i);const l=this._pool,u=e.BYTES_PER_ELEMENT*a,f=l.findIndex(h=>h.byteLength>=u);if(f>=0){const h=new e(l.splice(f,1)[0],0,a);return r&&h.fill(0),h}return new e(a)}_release(e){if(!ArrayBuffer.isView(e))return;const n=this._pool,{buffer:r}=e,{byteLength:i}=r,a=n.findIndex(l=>l.byteLength>=i);a<0?n.push(r):(a>0||n.lengththis.opts.poolSize&&n.shift()}}const Nf=new cX;function Yu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function uX(t){return[t[12],t[13],t[14]]}function fX(t){return{left:zl(t[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:zl(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:zl(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:zl(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:zl(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),far:zl(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}}const B2=new bs;function zl(t,e,n,r){B2.set(t,e,n);const i=B2.len();return{distance:r/i,normal:new bs(-t/i,-e/i,-n/i)}}function dX(t){return t-Math.fround(t)}let Vu;function a0(t,e){const{size:n=1,startIndex:r=0}=e,i=e.endIndex!==void 0?e.endIndex:t.length,a=(i-r)/n;Vu=Nf.allocate(Vu,a,{type:Float32Array,size:n*2});let l=r,u=0;for(;l=n.delay+n.duration*n.repeat}getTime(e){if(e===void 0)return this.time;const n=this.channels.get(e);return n===void 0?-1:n.time}setTime(e){this.time=Math.max(0,e);const n=this.channels.values();for(const i of n)this._setChannelTime(i,this.time);const r=this.animations.values();for(const i of r){const{animation:a,channel:l}=i;a.setTime(this.getTime(l))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,n){const r=SX++;return this.animations.set(r,{animation:e,channel:n}),e.setTime(this.getTime(n)),r}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,n){const r=n-e.delay,i=e.duration*e.repeat;r>=i?e.time=e.duration*e.rate:(e.time=Math.max(0,r)%e.duration,e.time*=e.rate)}}function EX(t){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function wX(t){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}let TX=0;const CX={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:L_.stats.get(`animation-loop-${TX++}`),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1};class AX{constructor(e){M(this,"device",null);M(this,"canvas",null);M(this,"props");M(this,"animationProps",null);M(this,"timeline",null);M(this,"stats");M(this,"cpuTime");M(this,"gpuTime");M(this,"frameRate");M(this,"display");M(this,"needsRedraw","initialized");M(this,"_initialized",!1);M(this,"_running",!1);M(this,"_animationFrameId",null);M(this,"_nextFramePromise",null);M(this,"_resolveNextFrame",null);M(this,"_cpuStartTime",0);M(this,"_error",null);if(this.props={...CX,...e},e=this.props,!e.device)throw new Error("No device provided");const{useDevicePixels:n=!0}=this.props;this.stats=e.stats||new qg({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:e.autoResizeViewport,autoResizeDrawingBuffer:e.autoResizeDrawingBuffer,useDevicePixels:n}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}setError(e){var r,i;if(this.props.onError(e),this._error=Error(),((i=(r=this.device)==null?void 0:r.canvasContext)==null?void 0:i.canvas)instanceof HTMLCanvasElement){const a=document.createElement("h1");a.innerHTML=e.message,a.style.position="absolute",a.style.top="20%",a.style.left="10px",a.style.color="black",a.style.backgroundColor="red",document.body.appendChild(a)}}setNeedsRedraw(e){return this.needsRedraw=this.needsRedraw||e,this}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),"autoResizeDrawingBuffer"in e&&(this.props.autoResizeDrawingBuffer=e.autoResizeDrawingBuffer||!1),"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){const n=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(n),n}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){var e;return(e=this.device)!=null&&e.isLost||this._error?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=EX(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(wX(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(e){var n;if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),(n=this.device)==null||n.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_initializeAnimationProps(){var n,r;const e=(r=(n=this.device)==null?void 0:n.canvasContext)==null?void 0:r.canvas;if(!this.device||!e)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:e,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;const{width:e,height:n,aspect:r}=this._getSizeAndAspect();(e!==this.animationProps.width||n!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),r!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=n,this.animationProps.aspect=r,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){var e;if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=((e=this.device.canvasContext)==null?void 0:e.canvas)||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){const e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";const n=document.createElement("div");n.style.position="absolute",n.style.left="10px",n.style.bottom="10px",n.style.width="300px",n.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(n);const r=this.props.onAddHTML(n);r&&(n.innerHTML=r)}}_getSizeAndAspect(){var a,l,u,f;if(!this.device)return{width:1,height:1,aspect:1};const[e,n]=((l=(a=this.device)==null?void 0:a.canvasContext)==null?void 0:l.getPixelSize())||[1,1];let r=1;const i=(f=(u=this.device)==null?void 0:u.canvasContext)==null?void 0:f.canvas;return i&&i.clientHeight?r=i.clientWidth/i.clientHeight:e>0&&n>0&&(r=e/n),{width:e,height:n,aspect:r}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){var e,n;this.props.autoResizeDrawingBuffer&&((n=(e=this.device)==null?void 0:e.canvasContext)==null||n.resize({useDevicePixels:this.props.useDevicePixels}))}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}}const l0={};function Gf(t="id"){l0[t]=l0[t]||1;const e=l0[t]++;return`${t}-${e}`}class z2{constructor(e){M(this,"id");M(this,"userData",{});M(this,"topology");M(this,"bufferLayout",[]);M(this,"vertexCount");M(this,"indices");M(this,"attributes");if(this.id=e.id||Gf("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&!(this.indices.usage&$n.INDEX))throw new Error("Index buffer must have INDEX usage")}destroy(){var e;(e=this.indices)==null||e.destroy();for(const n of Object.values(this.attributes))n.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices||null}_calculateVertexCount(e){return e.byteLength/12}}function RX(t,e){if(e instanceof z2)return e;const n=xX(t,e),{attributes:r,bufferLayout:i}=MX(t,e);return new z2({topology:e.topology||"triangle-list",bufferLayout:i,vertexCount:e.vertexCount,indices:n,attributes:r})}function xX(t,e){if(!e.indices)return;const n=e.indices.value;return t.createBuffer({usage:$n.INDEX,data:n})}function MX(t,e){const n=[],r={};for(const[a,l]of Object.entries(e.attributes)){let u=a;switch(a){case"POSITION":u="positions";break;case"NORMAL":u="normals";break;case"TEXCOORD_0":u="texCoords";break;case"COLOR_0":u="colors";break}if(l){r[u]=t.createBuffer({data:l.value,id:`${a}-buffer`});const{value:f,size:h,normalized:g}=l;n.push({name:u,format:yV(f,h,g)})}}const i=e._calculateVertexCount(e.attributes,e.indices);return{attributes:r,bufferLayout:n,vertexCount:i}}const Hg=class Hg{constructor(e){M(this,"device");M(this,"destroyPolicy");M(this,"_hashCounter",0);M(this,"_hashes",{});M(this,"_renderPipelineCache",{});M(this,"_computePipelineCache",{});this.device=e,this.destroyPolicy=e.props._factoryDestroyPolicy}static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new Hg(e),e._lumaData.defaultPipelineFactory}createRenderPipeline(e){const n={...Rc.defaultProps,...e},r=this._hashRenderPipeline(n);if(!this._renderPipelineCache[r]){const i=this.device.createRenderPipeline({...n,id:n.id?`${n.id}-cached`:void 0});i.hash=r,this._renderPipelineCache[r]={pipeline:i,useCount:0}}return this._renderPipelineCache[r].useCount++,this._renderPipelineCache[r].pipeline}createComputePipeline(e){const n={...pg.defaultProps,...e},r=this._hashComputePipeline(n);if(!this._computePipelineCache[r]){const i=this.device.createComputePipeline({...n,id:n.id?`${n.id}-cached`:void 0});i.hash=r,this._computePipelineCache[r]={pipeline:i,useCount:0}}return this._computePipelineCache[r].useCount++,this._computePipelineCache[r].pipeline}release(e){const n=e.hash,r=e instanceof pg?this._computePipelineCache:this._renderPipelineCache;r[n].useCount--,r[n].useCount===0&&this.destroyPolicy==="unused"&&(r[n].pipeline.destroy(),delete r[n])}_hashComputePipeline(e){return`${this._getHash(e.shader.source)}`}_hashRenderPipeline(e){const n=e.vs?this._getHash(e.vs.source):0,r=e.fs?this._getHash(e.fs.source):0,i="-",a=this._getHash(JSON.stringify(e.bufferLayout));switch(this.device.type){case"webgl":return`${n}/${r}V${i}BL${a}`;default:const l=this._getHash(JSON.stringify(e.parameters));return`${n}/${r}V${i}T${e.topology}P${l}BL${a}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}};M(Hg,"defaultProps",{...Rc.defaultProps});let ay=Hg;const jg=class jg{constructor(e){M(this,"device");M(this,"destroyPolicy");M(this,"_cache",{});this.device=e,this.destroyPolicy=e.props._factoryDestroyPolicy}static getDefaultShaderFactory(e){var n;return(n=e._lumaData).defaultShaderFactory||(n.defaultShaderFactory=new jg(e)),e._lumaData.defaultShaderFactory}createShader(e){const n=this._hashShader(e);let r=this._cache[n];if(!r){const i=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[n]=r={shader:i,useCount:0}}return r.useCount++,r.shader}release(e){const n=this._hashShader(e),r=this._cache[n];r&&(r.useCount--,r.useCount===0&&this.destroyPolicy==="unused"&&(delete this._cache[n],r.shader.destroy()))}_hashShader(e){return`${e.stage}:${e.source}`}};M(jg,"defaultProps",{...dg.defaultProps});let oy=jg;function OX(t,e){var i;const n={},r="Values";if(t.attributes.length===0&&!((i=t.varyings)!=null&&i.length))return{"No attributes or varyings":{[r]:"N/A"}};for(const a of t.attributes)if(a){const l=`${a.location} ${a.name}: ${a.type}`;n[`in ${l}`]={[r]:a.stepMode||"vertex"}}for(const a of t.varyings||[]){const l=`${a.location} ${a.name}`;n[`out ${l}`]={[r]:JSON.stringify(a)}}return n}let yr=null,uo=null;function PX(t,{id:e,minimap:n,opaque:r,top:i="0",left:a="0",rgbaScale:l=1}){yr||(yr=document.createElement("canvas"),yr.id=e,yr.title=e,yr.style.zIndex="100",yr.style.position="absolute",yr.style.top=i,yr.style.left=a,yr.style.border="blue 5px solid",yr.style.transform="scaleY(-1)",document.body.appendChild(yr),uo=yr.getContext("2d")),(yr.width!==t.width||yr.height!==t.height)&&(yr.width=t.width/2,yr.height=t.height/2,yr.style.width="400px",yr.style.height="400px");const u=t.device.readPixelsToArrayWebGL(t),f=uo==null?void 0:uo.createImageData(t.width,t.height);if(f){for(let g=0;g{const r=t[n];DX(r)?e.uniforms[n]=r:e.bindings[n]=r}),e}class FX{constructor(e,n){M(this,"options",{disableWarnings:!1});M(this,"modules");M(this,"moduleUniforms");M(this,"moduleBindings");Object.assign(this.options,n);const r=fb(Object.values(e).filter(i=>i.dependencies));for(const i of r)e[i.name]=i;Re.log(1,"Creating ShaderInputs with modules",Object.keys(e))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(const[i,a]of Object.entries(e))this._addModule(a),a.name&&i!==a.name&&!this.options.disableWarnings&&Re.warn(`Module name: ${i} vs ${a.name}`)()}destroy(){}setProps(e){var n;for(const r of Object.keys(e)){const i=r,a=e[i]||{},l=this.modules[i];if(!l){this.options.disableWarnings||Re.warn(`Module ${r} not found`)();continue}const u=this.moduleUniforms[i],f=this.moduleBindings[i],h=((n=l.getUniforms)==null?void 0:n.call(l,a,u))||a,{uniforms:g,bindings:m}=rO(h);this.moduleUniforms[i]={...u,...g},this.moduleBindings[i]={...f,...m}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindingValues(){const e={};for(const n of Object.values(this.moduleBindings))Object.assign(e,n);return e}getDebugTable(){var n;const e={};for(const[r,i]of Object.entries(this.moduleUniforms))for(const[a,l]of Object.entries(i))e[`${r}.${a}`]={type:(n=this.modules[r].uniformTypes)==null?void 0:n[a],value:String(l)};return e}_addModule(e){const n=e.name;this.moduleUniforms[n]=e.defaultUniforms||{},this.moduleBindings[n]={}}}let kX="";async function BX(t,e){const n=new Image;return n.crossOrigin="anonymous",n.src=t.startsWith("http")?t:kX+t,await n.decode(),e?await createImageBitmap(n,e):await createImageBitmap(n)}class c0{constructor(e,n){M(this,"device");M(this,"id");M(this,"texture");M(this,"sampler");M(this,"view");M(this,"ready");M(this,"isReady",!1);M(this,"destroyed",!1);M(this,"resolveReady",()=>{});M(this,"rejectReady",()=>{});this.device=e,this.id=n.id||Gf("async-texture"),typeof(n==null?void 0:n.data)=="string"&&n.dimension==="2d"&&(n={...n,data:BX(n.data)}),this.ready=new Promise((r,i)=>{this.resolveReady=()=>{this.isReady=!0,r()},this.rejectReady=i}),this.initAsync(n)}get[Symbol.toStringTag](){return"AsyncTexture"}toString(){return`AsyncTexture:"${this.id}"(${this.isReady?"ready":"loading"})`}async initAsync(e){let n,r;const i=e.data,a=await iO(i).then(n,r);if(this.destroyed)return;const l={...e,data:a};this.texture=this.device.createTexture(l),this.sampler=this.texture.sampler,this.view=this.texture.view,this.isReady=!0}destroy(){this.texture&&(this.texture.destroy(),this.texture=null),this.destroyed=!0}resize(e){if(!this.isReady)throw new Error("Cannot resize texture before it is ready");if(e.width===this.texture.width&&e.height===this.texture.height)return!1;if(this.texture){const n=this.texture;this.texture=n.clone(e),n.destroy()}return!0}}async function iO(t){if(t=await t,Array.isArray(t))return await Promise.all(t.map(iO));if(t&&typeof t=="object"&&t.constructor===Object){const e=t,n=await Promise.all(Object.values(e)),r=Object.keys(e),i={};for(let a=0;a[v.name,v]))||[]),i=n.shaderInputs||new FX(r,{disableWarnings:this.props.disableWarnings});this.setShaderInputs(i);const a=zX(e),l=(((h=this.props.modules)==null?void 0:h.length)>0?this.props.modules:(g=this.shaderInputs)==null?void 0:g.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){(m=this.props).shaderLayout||(m.shaderLayout=rH(this.props.source));const{source:v,getUniforms:S}=this.props.shaderAssembler.assembleWGSLShader({platformInfo:a,...this.props,modules:l});this.source=v,this._getModuleUniforms=S}else{const{vs:v,fs:S,getUniforms:w}=this.props.shaderAssembler.assembleGLSLShaderPair({platformInfo:a,...this.props,modules:l});this.vs=v,this.fs=S,this._getModuleUniforms=w}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,n.geometry&&this.setGeometry(n.geometry),this.pipelineFactory=n.pipelineFactory||ay.getDefaultPipelineFactory(this.device),this.shaderFactory=n.shaderFactory||oy.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in n&&(this.isInstanced=n.isInstanced),n.instanceCount&&this.setInstanceCount(n.instanceCount),n.vertexCount&&this.setVertexCount(n.vertexCount),n.indexBuffer&&this.setIndexBuffer(n.indexBuffer),n.attributes&&this.setAttributes(n.attributes),n.constantAttributes&&this.setConstantAttributes(n.constantAttributes),n.bindings&&this.setBindings(n.bindings),n.uniforms&&this.setUniformsWebGL(n.uniforms),n.moduleSettings&&this.updateModuleSettingsWebGL(n.moduleSettings),n.transformFeedback&&(this.transformFeedback=n.transformFeedback),Object.seal(this)}get[Symbol.toStringTag](){return"Model"}toString(){return`Model(${this.id})`}destroy(){var e;this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),(e=this._gpuGeometry)==null||e.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");const e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||(this._needsRedraw=e)}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){const n=this._areBindingsLoading();if(n)return Re.info(fo,`>>> DRAWING ABORTED ${this.id}: ${n} not loaded`)(),!1;try{e.pushDebugGroup(`${this}.predraw(${e})`),this.predraw()}finally{e.popDebugGroup()}let r;try{e.pushDebugGroup(`${this}.draw(${e})`),this._logDrawCallStart(),this.pipeline=this._updatePipeline();const i=this._getBindings();this.pipeline.setBindings(i,{disableWarnings:this.props.disableWarnings}),cy(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);const{indexBuffer:a}=this.vertexArray,l=a?a.byteLength/(a.indexType==="uint32"?4:2):void 0;r=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:l,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{e.popDebugGroup(),this._logDrawCallEnd()}return this._logFramebuffer(e),r?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",r}setGeometry(e){var r;(r=this._gpuGeometry)==null||r.destroy();const n=e&&RX(this.device,e);if(n){this.setTopology(n.topology||"triangle-list");const i=new Zv(this.bufferLayout);this.bufferLayout=i.mergeBufferLayouts(n.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(n)}this._gpuGeometry=n}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){const n=new Zv(this.bufferLayout);this.bufferLayout=this._gpuGeometry?n.mergeBufferLayouts(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){ly(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(e){this.instanceCount=e,this.isInstanced===void 0&&e>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new _V(this.shaderInputs.modules);for(const[n,r]of Object.entries(this.shaderInputs.modules))if(LX(r)){const i=this._uniformStore.getManagedUniformBuffer(this.device,n);this.bindings[`${n}Uniforms`]=i}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setBindings(this.shaderInputs.getBindingValues()),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,n){const r=(n==null?void 0:n.disableWarnings)??this.props.disableWarnings;e.indices&&Re.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();const i=new Zv(this.bufferLayout);for(const[a,l]of Object.entries(e)){const u=i.getBufferLayout(a);if(!u){r||Re.warn(`Model(${this.id}): Missing layout for buffer "${a}".`)();continue}const f=i.getAttributeNamesForBuffer(u);let h=!1;for(const g of f){const m=this._attributeInfos[g];m&&(this.vertexArray.setBuffer(m.location,l),h=!0)}!h&&!r&&Re.warn(`Model(${this.id}): Ignoring buffer "${l.id}" for unknown attribute "${a}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,n){for(const[r,i]of Object.entries(e)){const a=this._attributeInfos[r];a?this.vertexArray.setConstantWebGL(a.location,i):((n==null?void 0:n.disableWarnings)??this.props.disableWarnings)||Re.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){this.setUniformsWebGL(e)}setUniformsWebGL(e){cy(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettingsWebGL(e){const{bindings:n,uniforms:r}=rO(this._getModuleUniforms(e));Object.assign(this.bindings,n),Object.assign(this.uniforms,r),this.setNeedsRedraw("moduleSettings")}_areBindingsLoading(){for(const e of Object.values(this.bindings))if(e instanceof c0&&!e.isReady)return e.id;return!1}_getBindings(){const e={};for(const[n,r]of Object.entries(this.bindings))r instanceof c0?r.isReady&&(e[n]=r.texture):e[n]=r;return e}_getBindingsUpdateTimestamp(){let e=0;for(const n of Object.values(this.bindings))n instanceof fg?e=Math.max(e,n.texture.updateTimestamp):n instanceof $n||n instanceof Kn?e=Math.max(e,n.updateTimestamp):n instanceof c0?e=n.texture?Math.max(e,n.texture.updateTimestamp):1/0:n instanceof hg||(e=Math.max(e,n.buffer.updateTimestamp));return e}_setGeometryAttributes(e){const n={...e.attributes};for(const[r]of Object.entries(n))!this.pipeline.shaderLayout.attributes.find(i=>i.name===r)&&r!=="positions"&&delete n[r];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(n,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||(this._pipelineNeedsUpdate=e),this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,n=null;this.pipeline&&(Re.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,n=this.pipeline.fs),this._pipelineNeedsUpdate=!1;const r=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debugShaders:this.props.debugShaders});let i=null;this.source?i=r:this.fs&&(i=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debugShaders:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,bindings:this._getBindings(),vs:r,fs:i}),this._attributeInfos=uM(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),n&&this.shaderFactory.release(n)}return this.pipeline}_logDrawCallStart(){const e=Re.level>3?0:UX;Re.level<2||Date.now()-this._lastLogTime>> DRAWING MODEL ${this.id}`,{collapsed:Re.level<=2})())}_logDrawCallEnd(){if(this._logOpen){const e=OX(this.pipeline.shaderLayout,this.id);Re.table(fo,e)();const n=this.shaderInputs.getDebugTable();for(const[i,a]of Object.entries(this.uniforms))n[i]={value:a};Re.table(fo,n)();const r=this._getAttributeDebugTable();Re.table(fo,this._attributeInfos)(),Re.table(fo,r)(),Re.groupEnd(fo)(),this._logOpen=!1}}_logFramebuffer(e){const n=this.device.props.debugFramebuffers;if(this._drawCount++,!n)return;const r=e.props.framebuffer;r&&PX(r,{id:r.id,minimap:!0})}_getAttributeDebugTable(){const e={};for(const[n,r]of Object.entries(this._attributeInfos)){const i=this.vertexArray.attributes[r.location];e[r.location]={name:n,type:r.shaderType,values:i?this._getBufferOrConstantValues(i,r.bufferDataType):"null"}}if(this.vertexArray.indexBuffer){const{indexBuffer:n}=this.vertexArray,r=n.indexType==="uint32"?new Uint32Array(n.debugData):new Uint16Array(n.debugData);e.indices={name:"indices",type:n.indexType,values:r.toString()}}return e}_getBufferOrConstantValues(e,n){const r=hM(n);return(e instanceof $n?new r(e.debugData):e).toString()}};M(Wg,"defaultProps",{...Rc.defaultProps,source:void 0,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:ug.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0});let $o=Wg;function LX(t){return!!(t.uniformTypes&&!cy(t.uniformTypes))}function zX(t){return{type:t.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}function cy(t){for(const e in t)return!1;return!0}const ff=class ff{constructor(e,n=ff.defaultProps){M(this,"device");M(this,"model");M(this,"transformFeedback");if(!ff.isSupported(e))throw new Error("BufferTransform not yet implemented on WebGPU");this.device=e,this.model=new $o(this.device,{id:n.id||"buffer-transform-model",fs:n.fs||S$(),topology:n.topology||"point-list",varyings:n.outputs||n.varyings,...n}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:n.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}static isSupported(e){var n;return((n=e==null?void 0:e.info)==null?void 0:n.type)==="webgl"}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){e!=null&&e.inputBuffers&&this.model.setAttributes(e.inputBuffers),e!=null&&e.outputBuffers&&this.transformFeedback.setBuffers(e.outputBuffers);const n=this.device.beginRenderPass(e);this.model.draw(n),n.end()}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){const n=this.getBuffer(e);if(!n)throw new Error("BufferTransform#getBuffer");if(n instanceof $n)return n.readAsync();const{buffer:r,byteOffset:i=0,byteLength:a=r.byteLength}=n;return r.readAsync(i,a)}};M(ff,"defaultProps",{...$o.defaultProps,outputs:void 0,feedbackBuffers:void 0});let If=ff;class _b{constructor(e){M(this,"id");M(this,"topology");M(this,"vertexCount");M(this,"indices");M(this,"attributes");M(this,"userData",{});const{attributes:n={},indices:r=null,vertexCount:i=null}=e;this.id=e.id||Gf("geometry"),this.topology=e.topology,r&&(this.indices=ArrayBuffer.isView(r)?{value:r,size:1}:r),this.attributes={};for(const[a,l]of Object.entries(n)){const u=ArrayBuffer.isView(l)?{value:l}:l;if(!ArrayBuffer.isView(u.value))throw new Error(`${this._print(a)}: must be typed array or object with value as typed array`);if((a==="POSITION"||a==="positions")&&!u.size&&(u.size=3),a==="indices"){if(this.indices)throw new Error("Multiple indices detected");this.indices=u}else this.attributes[a]=u}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,n){return this}_calculateVertexCount(e,n){if(n)return n.value.length;let r=1/0;for(const i of Object.values(e)){const{value:a,size:l,constant:u}=i;!u&&a&&l!==void 0&&l>=1&&(r=Math.min(r,a.length/l))}return r}}class $X extends _b{constructor(e={}){const{id:n=Gf("cube-geometry"),indices:r=!0}=e;super(r?{...e,id:n,topology:"triangle-list",indices:{size:1,value:VX},attributes:{...KX,...e.attributes}}:{...e,id:n,topology:"triangle-list",indices:void 0,attributes:{...ZX,...e.attributes}})}}const VX=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),HX=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),jX=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),WX=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),XX=new Float32Array([1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1]),qX=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),YX=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),KX={POSITION:{size:3,value:HX},NORMAL:{size:3,value:jX},TEXCOORD_0:{size:2,value:WX}},ZX={POSITION:{size:3,value:XX},TEXCOORD_0:{size:2,value:qX},COLOR_0:{size:3,value:YX}},QX={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant-alpha",blendAlphaDstFactor:"zero"};class sO extends vb{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):super.render(e)}_drawPickingBuffer({layers:e,layerFilter:n,views:r,viewports:i,onViewportActive:a,pickingFBO:l,deviceRect:{x:u,y:f,width:h,height:g},cullRect:m,effects:v,pass:S="picking",pickZ:w,shaderModuleProps:E}){this.pickZ=w;const b=this._resetColorEncoder(w),C=[u,f,h,g],T=super.render({target:l,layers:e,layerFilter:n,views:r,viewports:i,onViewportActive:a,cullRect:m,effects:v==null?void 0:v.filter(O=>O.useInPicking),pass:S,isPicking:!0,shaderModuleProps:E,clearColor:[0,0,0,0],colorMask:15,scissorRect:C});return this._colorEncoderState=null,{decodePickingColor:b&&JX.bind(null,b),stats:T}}shouldDrawLayer(e){const{pickable:n,operation:r}=e.props;return n&&r.includes("draw")||r.includes("terrain")||r.includes("mask")}getShaderModuleProps(e,n,r){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(e,n,r){const i={...e.props.parameters},{pickable:a,operation:l}=e.props;return!this._colorEncoderState||l.includes("terrain")?i.blend=!1:a&&l.includes("draw")&&(Object.assign(i,QX),i.blend=!0,i.blendColor=GX(this._colorEncoderState,e,r)),i}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function GX(t,e,n){const{byLayer:r,byAlpha:i}=t;let a,l=r.get(e);return l?(l.viewports.push(n),a=l.a):(a=r.size+1,a<=255?(l={a,layer:e,viewports:[n]},r.set(e,l),i[a]=l):(Sn.warn("Too many pickable layers, only picking the first 255")(),a=0)),[0,0,0,a/255]}function JX(t,e){const n=t.byAlpha[e[3]];return n&&{pickedLayer:n.layer,pickedViewports:n.viewports,pickedObjectIndex:n.layer.decodePickingColor(e)}}const Vl={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},Cg=Symbol.for("component"),Fo=Symbol.for("propTypes"),u0=Symbol.for("deprecatedProps"),ic=Symbol.for("asyncPropDefaults"),Vo=Symbol.for("asyncPropOriginal"),ka=Symbol.for("asyncPropResolved");function aO(t,e=()=>!0){return Array.isArray(t)?oO(t,e,[]):e(t)?[t]:[]}function oO(t,e,n){let r=-1;for(;++r0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,n){if(e===this._data&&!n)return;this._data=e;const r=++this._loadCount;let i=e;typeof e=="string"&&(i=jh(e)),i instanceof Promise?(this.isLoaded=!1,this._loader=i.then(a=>{this._loadCount===r&&(this.isLoaded=!0,this._error=void 0,this._content=a)}).catch(a=>{this._loadCount===r&&(this.isLoaded=!0,this._error=a||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(const a of this._subscribers)a.onChange(this.getData())}}class nq{constructor(e){var n;this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:(n=e.device)==null?void 0:n.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:n,forceUpdate:r=!1,persistent:i=!0}){let a=this._resources[e];a?a.setData(n,r):(a=new tq(e,n,this._context),this._resources[e]=a),a.persistent=i}remove(e){const n=this._resources[e];n&&(n.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){const n=this._consumers[e];if(n){for(const r in n){const i=n[r],a=this._resources[i.resourceId];a&&a.unsubscribe(i)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:n,consumerId:r,requestId:i="default"}){const{_resources:a,protocol:l}=this;e.startsWith(l)&&(e=e.replace(l,""),a[e]||this.add({resourceId:e,data:null,persistent:!1}));const u=a[e];if(this._track(r,i,u,n),u)return u.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(const e in this._resources)this._resources[e].delete()}_track(e,n,r,i){const a=this._consumers,l=a[e]=a[e]||{};let u=l[n];const f=u&&u.resourceId&&this._resources[u.resourceId];f&&(f.unsubscribe(u),this.prune()),r&&(u?(u.onChange=i,u.resourceId=r.id):u={onChange:i,resourceId:r.id},l[n]=u,r.subscribe(u))}_prune(){this._pruneRequest=null;for(const e of Object.keys(this._resources)){const n=this._resources[e];!n.persistent&&!n.inUse()&&(n.delete(),delete this._resources[e])}}}const rq="layerManager.setLayers",iq="layerManager.activateViewport";class sq{constructor(e,n){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=u=>{Hr(iq,this,u),u&&(this.context.viewport=u)};const{deck:r,stats:i,viewport:a,timeline:l}=n||{};this.layers=[],this.resourceManager=new nq({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e==null?void 0:e.gl,deck:r,shaderAssembler:KW(),defaultShaderModules:[hj],renderPass:void 0,stats:i||new qg({id:"deck.gl"}),viewport:a||new Qf({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:l||new tO,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let n=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(const r of this.layers){const i=r.getNeedsRedraw(e);n=n||i}return n}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(n=>e.find(r=>n.id.indexOf(r)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,n){Hr(rq,this,n,e),this._lastRenderedLayers=e;const r=aO(e,Boolean);for(const i of r)i.context=this.context;this._updateLayers(this.layers,r)}updateLayers(){const e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){const{defaultShaderModules:n}=this.context;n.find(r=>r.name===e.name)||(n.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){const{defaultShaderModules:n}=this.context,r=n.findIndex(i=>i.name===e.name);r>=0&&(n.splice(r,1),this._defaultShaderModulesChanged=!0)}_handleError(e,n,r){r.raiseError(n,`${e} of ${r}`)}_updateLayers(e,n){const r={};for(const l of e)r[l.id]?Sn.warn(`Multiple old layers with same id ${l.id}`)():r[l.id]=l;if(this._defaultShaderModulesChanged){for(const l of e)l.setNeedsUpdate(),l.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}const i=[];this._updateSublayersRecursively(n,r,i),this._finalizeOldLayers(r);let a=!1;for(const l of i)if(l.hasUniformTransition()){a=`Uniform transition in ${l}`;break}this._needsUpdate=a,this.layers=i}_updateSublayersRecursively(e,n,r){for(const i of e){i.context=this.context;const a=n[i.id];a===null&&Sn.warn(`Multiple new layers with same id ${i.id}`)(),n[i.id]=null;let l=null;try{this._debug&&a!==i&&i.validateProps(),a?(this._transferLayerState(a,i),this._updateLayer(i)):this._initializeLayer(i),r.push(i),l=i.isComposite?i.getSubLayers():null}catch(u){this._handleError("matching",u,i)}l&&this._updateSublayersRecursively(l,n,r)}}_finalizeOldLayers(e){for(const n in e){const r=e[n];r&&this._finalizeLayer(r)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Vl.INITIALIZED}catch(n){this._handleError("initialization",n,e)}}_transferLayerState(e,n){n._transferState(e),n.lifecycle=Vl.MATCHED,n!==e&&(e.lifecycle=Vl.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(n){this._handleError("update",n,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Vl.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Vl.FINALIZED}catch(n){this._handleError("finalization",n,e)}}}function Gi(t,e,n){if(t===e)return!0;if(!n||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;rn.containsPixel(e)):this._viewports}getViews(){const e={};return this.views.forEach(n=>{e[n.id]=n}),e}getView(e){return this.views.find(n=>n.id===e)}getViewState(e){const n=typeof e=="string"?this.getView(e):e,r=n&&this.viewState[n.getViewStateId()]||this.viewState;return n?n.filterViewState(r):r}getViewport(e){return this._viewportMap[e]}unproject(e,n){const r=this.getViewports(),i={x:e[0],y:e[1]};for(let a=r.length-1;a>=0;--a){const l=r[a];if(l.containsPixel(i)){const u=e.slice();return u[0]-=l.x,u[1]-=l.y,l.unproject(u,n)}}return null}setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,n){(e!==this.width||n!==this.height)&&(this.width=e,this.height=n,this.setNeedsUpdate("Size changed"))}_setViews(e){e=aO(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!Gi(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):Sn.warn("missing `viewState` or `initialViewState`")()}_createController(e,n){const r=n.type;return new r({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:a=>{var l;return(l=this.getView(e.id))==null?void 0:l.makeViewport({viewState:a,width:this.width,height:this.height})}})}_updateController(e,n,r,i){const a=e.controller;if(a&&r){const l={...n,...a,id:e.id,x:r.x,y:r.y,width:r.width,height:r.height};return(!i||i.constructor!==a.type)&&(i=this._createController(e,l)),i&&i.setProps(l),i}return null}_rebuildViewports(){const{views:e}=this,n=this.controllers;this._viewports=[],this.controllers={};let r=!1;for(let i=e.length;i--;){const a=e[i],l=this.getViewState(a),u=a.makeViewport({viewState:l,width:this.width,height:this.height});let f=n[a.id];const h=!!a.controller;h&&!f&&(r=!0),(r||!h)&&f&&(f.finalize(),f=null),this.controllers[a.id]=this._updateController(a,l,u,f),u&&this._viewports.unshift(u)}for(const i in n){const a=n[i];a&&!this.controllers[i]&&a.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,n){return e.length!==n.length?!0:e.some((r,i)=>!e[i].equals(n[i]))}}const oq=/([0-9]+\.?[0-9]*)(%|px)/;function ma(t){switch(typeof t){case"number":return{position:t,relative:!1};case"string":const e=oq.exec(t);if(e&&e.length>=3){const n=e[2]==="%",r=parseFloat(e[1]);return{position:n?r/100:r,relative:n}}default:throw new Error(`Could not parse position string ${t}`)}}function va(t,e){return t.relative?Math.round(t.position*e):t.position}class Dc{constructor(e){const{id:n,x:r=0,y:i=0,width:a="100%",height:l="100%",padding:u=null}=e;this.id=n||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=ma(r),this._y=ma(i),this._width=ma(a),this._height=ma(l),this._padding=u&&{left:ma(u.left||0),right:ma(u.right||0),top:ma(u.top||0),bottom:ma(u.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.constructor===e.constructor&&Gi(this.props,e.props,2)}makeViewport({width:e,height:n,viewState:r}){r=this.filterViewState(r);const i=this.getDimensions({width:e,height:n});if(!i.height||!i.width)return null;const a=this.getViewportType(r);return new a({...r,...this.props,...i})}getViewStateId(){const{viewState:e}=this.props;return typeof e=="string"?e:(e==null?void 0:e.id)||this.id}filterViewState(e){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;const n={...e};for(const r in this.props.viewState)r!=="id"&&(n[r]=this.props.viewState[r]);return n}return e}getDimensions({width:e,height:n}){const r={x:va(this._x,e),y:va(this._y,n),width:va(this._width,e),height:va(this._height,n)};return this._padding&&(r.padding={left:va(this._padding.left,e),top:va(this._padding.top,n),right:va(this._padding.right,e),bottom:va(this._padding.bottom,n)}),r}get controller(){const e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}}class cp{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){var n,r;this.cancel(),this.settings=e,this._inProgress=!0,(r=(n=this.settings).onStart)==null||r.call(n,this)}end(){var e,n;this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,(n=(e=this.settings).onEnd)==null||n.call(e,this))}cancel(){var e,n;this._inProgress&&((n=(e=this.settings).onInterrupt)==null||n.call(e,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){var e,n;if(!this._inProgress)return!1;if(this._handle===null){const{_timeline:r,settings:i}=this;this._handle=r.addChannel({delay:r.getTime(),duration:i.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),(n=(e=this.settings).onUpdate)==null||n.call(e,this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}const $2=()=>{},uy={BREAK:1,SNAP_TO_END:2,IGNORE:3},lq=t=>t,cq=uy.BREAK;class uq{constructor(e){this._onTransitionUpdate=n=>{const{time:r,settings:{interpolator:i,startProps:a,endProps:l,duration:u,easing:f}}=n,h=f(r/u),g=i.interpolateProps(a,l,h);this.propsInTransition=this.getControllerState({...this.props,...g}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new cp(e.timeline),this.onViewStateChange=e.onViewStateChange||$2,this.onStateChange=e.onStateChange||$2}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let n=!1;const r=this.props;if(this.props=e,!r||this._shouldIgnoreViewportChange(r,e))return!1;if(this._isTransitionEnabled(e)){let i=r;if(this.transition.inProgress){const{interruption:a,endProps:l}=this.transition.settings;i={...r,...a===uy.SNAP_TO_END?l:this.propsInTransition||r}}this._triggerTransition(i,e),n=!0}else this.transition.cancel();return n}updateTransition(){this.transition.update()}_isTransitionEnabled(e){const{transitionDuration:n,transitionInterpolator:r}=e;return(n>0||n==="auto")&&!!r}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,n){return this.transition.inProgress?this.transition.settings.interruption===uy.IGNORE||this._isUpdateDueToCurrentTransition(n):this._isTransitionEnabled(n)?n.transitionInterpolator.arePropsEqual(e,n):!0}_triggerTransition(e,n){const r=this.getControllerState(e),i=this.getControllerState(n).shortestPathFrom(r),a=n.transitionInterpolator,l=a.getDuration?a.getDuration(e,n):n.transitionDuration;if(l===0)return;const u=a.initializeProps(e,i);this.propsInTransition={};const f={duration:l,easing:n.transitionEasing||lq,interpolator:a,interruption:n.transitionInterruption||cq,startProps:u.start,endProps:u.end,onStart:n.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(n.onTransitionInterrupt),onEnd:this._onTransitionEnd(n.onTransitionEnd)};this.transition.start(f),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return n=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e==null||e(n)}}}function Fr(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}class fq{constructor(e){const{compare:n,extract:r,required:i}=e;this._propsToCompare=n,this._propsToExtract=r||n,this._requiredProps=i}arePropsEqual(e,n){for(const r of this._propsToCompare)if(!(r in e)||!(r in n)||!Of(e[r],n[r]))return!1;return!0}initializeProps(e,n){const r={},i={};for(const a of this._propsToExtract)(a in e||a in n)&&(r[a]=e[a],i[a]=n[a]);return this._checkRequiredProps(r),this._checkRequiredProps(i),{start:r,end:i}}getDuration(e,n){return n.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(n=>{const r=e[n];Fr(Number.isFinite(r)||Array.isArray(r),`${n} is required for transition`)})}}const dq=["longitude","latitude","zoom","bearing","pitch"],hq=["longitude","latitude","zoom"];class lO extends fq{constructor(e={}){const n=Array.isArray(e)?e:e.transitionProps,r=Array.isArray(e)?{}:e;r.transitionProps=Array.isArray(n)?{compare:n,required:n}:n||{compare:dq,required:hq},super(r.transitionProps),this.opts=r}initializeProps(e,n){const r=super.initializeProps(e,n),{makeViewport:i,around:a}=this.opts;if(i&&a){const l=i(e),u=i(n),f=l.unproject(a);r.start.around=a,Object.assign(r.end,{around:u.project(f),aroundPosition:f,width:n.width,height:n.height})}return r}interpolateProps(e,n,r){const i={};for(const a of this._propsToExtract)i[a]=yg(e[a]||0,n[a]||0,r);if(n.aroundPosition&&this.opts.makeViewport){const a=this.opts.makeViewport({...n,...i});Object.assign(i,a.panByPosition(n.aroundPosition,yg(e.around,n.around,r)))}return i}}const _a={transitionDuration:0},gq=300,Th=t=>1-(1-t)*(1-t),$l={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},ho={};class pq{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new uq({...e,getControllerState:n=>new this.ControllerState(n),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){var e;for(const n in this._events)this._events[n]&&((e=this.eventManager)==null||e.off(n,this.handleEvent));this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;const n=this._eventStartBlocked;switch(e.type){case"panstart":return n?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return n?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"multipanstart":return n?!1:this._onMultiPanStart(e);case"multipanmove":return this._onMultiPan(e);case"multipanend":return this._onMultiPanEnd(e);case"dblclick":return this._onDoubleClick(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){const{x:n,y:r}=this.props,{offsetCenter:i}=e;return[i.x-n,i.y-r]}isPointInBounds(e,n){const{width:r,height:i}=this.props;if(n&&n.handled)return!1;const a=e[0]>=0&&e[0]<=r&&e[1]>=0&&e[1]<=i;return a&&n&&n.stopPropagation(),a}isFunctionKeyPressed(e){const{srcEvent:n}=e;return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){const n=setTimeout(()=>{this._eventStartBlocked===n&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=n}setProps(e){e.dragMode&&(this.dragMode=e.dragMode),this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);const{inertia:n}=e;this.inertia=Number.isFinite(n)?n:n===!0?gq:0;const{scrollZoom:r=!0,dragPan:i=!0,dragRotate:a=!0,doubleClickZoom:l=!0,touchZoom:u=!0,touchRotate:f=!1,keyboard:h=!0}=e,g=!!this.onViewStateChange;this.toggleEvents($l.WHEEL,g&&r),this.toggleEvents($l.PAN,g),this.toggleEvents($l.PINCH,g&&(u||f)),this.toggleEvents($l.MULTI_PAN,g&&f),this.toggleEvents($l.DOUBLE_CLICK,g&&l),this.toggleEvents($l.KEYBOARD,g&&h),this.scrollZoom=r,this.dragPan=i,this.dragRotate=a,this.doubleClickZoom=l,this.touchZoom=u,this.touchRotate=f,this.keyboard=h}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,n){this.eventManager&&e.forEach(r=>{this._events[r]!==n&&(this._events[r]=n,n?this.eventManager.on(r,this.handleEvent):this.eventManager.off(r,this.handleEvent))})}updateViewport(e,n=null,r={}){const i={...e.getViewportProps(),...n},a=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(r),a){const l=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:i,interactionState:this._interactionState,oldViewState:l,viewId:this.props.id})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){const n=this.getCenter(e);if(!this.isPointInBounds(n,e))return!1;let r=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(r=!r);const i=this.controllerState[r?"panStart":"rotateStart"]({pos:n});return this._panMove=r,this.updateViewport(i,_a,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;const n=this.getCenter(e),r=this.controllerState.pan({pos:n});return this.updateViewport(r,_a,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){const{inertia:n}=this;if(this.dragPan&&n&&e.velocity){const r=this.getCenter(e),i=[r[0]+e.velocityX*n/2,r[1]+e.velocityY*n/2],a=this.controllerState.pan({pos:i}).panEnd();this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:n,transitionEasing:Th},{isDragging:!1,isPanning:!0})}else{const r=this.controllerState.panEnd();this.updateViewport(r,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;const n=this.getCenter(e),r=this.controllerState.rotate({pos:n});return this.updateViewport(r,_a,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){const{inertia:n}=this;if(this.dragRotate&&n&&e.velocity){const r=this.getCenter(e),i=[r[0]+e.velocityX*n/2,r[1]+e.velocityY*n/2],a=this.controllerState.rotate({pos:i}).rotateEnd();this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:n,transitionEasing:Th},{isDragging:!1,isRotating:!0})}else{const r=this.controllerState.rotateEnd();this.updateViewport(r,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;const n=this.getCenter(e);if(!this.isPointInBounds(n,e))return!1;e.srcEvent.preventDefault();const{speed:r=.01,smooth:i=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:a}=e;let l=2/(1+Math.exp(-Math.abs(a*r)));a<0&&l!==0&&(l=1/l);const u=this.controllerState.zoom({pos:n,scale:l});return this.updateViewport(u,{...this._getTransitionProps({around:n}),transitionDuration:i?250:1},{isZooming:!0,isPanning:!0}),!0}_onMultiPanStart(e){const n=this.getCenter(e);if(!this.isPointInBounds(n,e))return!1;const r=this.controllerState.rotateStart({pos:n});return this.updateViewport(r,_a,{isDragging:!0}),!0}_onMultiPan(e){if(!this.touchRotate||!this.isDragging())return!1;const n=this.getCenter(e);n[0]-=e.deltaX;const r=this.controllerState.rotate({pos:n});return this.updateViewport(r,_a,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(e){if(!this.isDragging())return!1;const{inertia:n}=this;if(this.touchRotate&&n&&e.velocityY){const r=this.getCenter(e),i=[r[0],r[1]+=e.velocityY*n/2],a=this.controllerState.rotate({pos:i});this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:n,transitionEasing:Th},{isDragging:!1,isRotating:!0}),this.blockEvents(n)}else{const r=this.controllerState.rotateEnd();this.updateViewport(r,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){const n=this.getCenter(e);if(!this.isPointInBounds(n,e))return!1;const r=this.controllerState.zoomStart({pos:n}).rotateStart({pos:n});return ho._startPinchRotation=e.rotation,ho._lastPinchEvent=e,this.updateViewport(r,_a,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let n=this.controllerState;if(this.touchZoom){const{scale:r}=e,i=this.getCenter(e);n=n.zoom({pos:i,scale:r})}if(this.touchRotate){const{rotation:r}=e;n=n.rotate({deltaAngleX:ho._startPinchRotation-r})}return this.updateViewport(n,_a,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),ho._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;const{inertia:n}=this,{_lastPinchEvent:r}=ho;if(this.touchZoom&&n&&r&&e.scale!==r.scale){const i=this.getCenter(e);let a=this.controllerState.rotateEnd();const l=Math.log2(e.scale),u=(l-Math.log2(r.scale))/(e.deltaTime-r.deltaTime),f=Math.pow(2,l+u*n/2);a=a.zoom({pos:i,scale:f}).zoomEnd(),this.updateViewport(a,{...this._getTransitionProps({around:i}),transitionDuration:n,transitionEasing:Th},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(n)}else{const i=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return ho._startPinchRotation=null,ho._lastPinchEvent=null,!0}_onDoubleClick(e){if(!this.doubleClickZoom)return!1;const n=this.getCenter(e);if(!this.isPointInBounds(n,e))return!1;const r=this.isFunctionKeyPressed(e),i=this.controllerState.zoom({pos:n,scale:r?.5:2});return this.updateViewport(i,this._getTransitionProps({around:n}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;const n=this.isFunctionKeyPressed(e),{zoomSpeed:r,moveSpeed:i,rotateSpeedX:a,rotateSpeedY:l}=this.keyboard===!0?{}:this.keyboard,{controllerState:u}=this;let f;const h={};switch(e.srcEvent.code){case"Minus":f=n?u.zoomOut(r).zoomOut(r):u.zoomOut(r),h.isZooming=!0;break;case"Equal":f=n?u.zoomIn(r).zoomIn(r):u.zoomIn(r),h.isZooming=!0;break;case"ArrowLeft":n?(f=u.rotateLeft(a),h.isRotating=!0):(f=u.moveLeft(i),h.isPanning=!0);break;case"ArrowRight":n?(f=u.rotateRight(a),h.isRotating=!0):(f=u.moveRight(i),h.isPanning=!0);break;case"ArrowUp":n?(f=u.rotateUp(l),h.isRotating=!0):(f=u.moveUp(i),h.isPanning=!0);break;case"ArrowDown":n?(f=u.rotateDown(l),h.isRotating=!0):(f=u.moveDown(i),h.isPanning=!0);break;default:return!1}return this.updateViewport(f,this._getTransitionProps(),h),!0}_getTransitionProps(e){const{transition:n}=this;return!n||!n.transitionInterpolator?_a:e?{...n,transitionInterpolator:new lO({...e,...n.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:n}}class mq{constructor(e,n){this._viewportProps=this.applyConstraints(e),this._state=n}getViewportProps(){return this._viewportProps}getState(){return this._state}}const V2=5,vq=1.2;class _q extends mq{constructor(e){const{width:n,height:r,latitude:i,longitude:a,zoom:l,bearing:u=0,pitch:f=0,altitude:h=1.5,position:g=[0,0,0],maxZoom:m=20,minZoom:v=0,maxPitch:S=60,minPitch:w=0,startPanLngLat:E,startZoomLngLat:b,startRotatePos:C,startBearing:T,startPitch:A,startZoom:O,normalize:x=!0}=e;Fr(Number.isFinite(a)),Fr(Number.isFinite(i)),Fr(Number.isFinite(l)),super({width:n,height:r,latitude:i,longitude:a,zoom:l,bearing:u,pitch:f,altitude:h,maxZoom:m,minZoom:v,maxPitch:S,minPitch:w,normalize:x,position:g},{startPanLngLat:E,startZoomLngLat:b,startRotatePos:C,startBearing:T,startPitch:A,startZoom:O}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:n}){const r=this.getState().startPanLngLat||this._unproject(n);if(!r)return this;const a=this.makeViewport(this.getViewportProps()).panByPosition(r,e);return this._getUpdatedState(a)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:n=0,deltaAngleY:r=0}){const{startRotatePos:i,startBearing:a,startPitch:l}=this.getState();if(!i||a===void 0||l===void 0)return this;let u;return e?u=this._getNewRotation(e,i,l,a):u={bearing:a+n,pitch:l+r},this._getUpdatedState(u)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:n,scale:r}){let{startZoom:i,startZoomLngLat:a}=this.getState();if(a||(i=this.getViewportProps().zoom,a=this._unproject(n)||this._unproject(e)),!a)return this;const{maxZoom:l,minZoom:u}=this.getViewportProps();let f=i+Math.log2(r);f=Fa(f,u,l);const h=this.makeViewport({...this.getViewportProps(),zoom:f});return this._getUpdatedState({zoom:f,...h.panByPosition(a,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){const n=e.getViewportProps(),r={...this.getViewportProps()},{bearing:i,longitude:a}=r;return Math.abs(i-n.bearing)>180&&(r.bearing=i<0?i+360:i-360),Math.abs(a-n.longitude)>180&&(r.longitude=a<0?a+360:a-360),r}applyConstraints(e){const{maxZoom:n,minZoom:r,zoom:i}=e;e.zoom=Fa(i,r,n);const{maxPitch:a,minPitch:l,pitch:u}=e;e.pitch=Fa(u,l,a);const{normalize:f=!0}=e;return f&&Object.assign(e,DW(e)),e}_zoomFromCenter(e){const{width:n,height:r}=this.getViewportProps();return this.zoom({pos:[n/2,r/2],scale:e})}_panFromCenter(e){const{width:n,height:r}=this.getViewportProps();return this.pan({startPos:[n/2,r/2],pos:[n/2+e[0],r/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}_unproject(e){const n=this.makeViewport(this.getViewportProps());return e&&n.unproject(e)}_getNewRotation(e,n,r,i){const a=e[0]-n[0],l=e[1]-n[1],u=e[1],f=n[1],{width:h,height:g}=this.getViewportProps(),m=a/h;let v=0;l>0?Math.abs(g-f)>V2&&(v=l/(f-g)*vq):l<0&&f>V2&&(v=1-u/f),v=Fa(v,-1,1);const{minPitch:S,maxPitch:w}=this.getViewportProps(),E=i+180*m;let b=r;return v>0?b=r+v*(w-r):v<0&&(b=r-v*(S-r)),{pitch:b,bearing:E}}}class yq extends pq{constructor(){super(...arguments),this.ControllerState=_q,this.transition={transitionDuration:300,transitionInterpolator:new lO({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(e){e.position=e.position||[0,0,0];const n=this.props;super.setProps(e),(!n||n.height!==e.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...e,...this.state}))}}class cO extends Dc{constructor(e={}){super(e)}getViewportType(){return Ic}get ControllerType(){return yq}}cO.displayName="MapView";const bq=new JM;function Sq(t,e){const n=t.order??1/0,r=e.order??1/0;return n-r}class Eq{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){const n=this._defaultEffects;if(!n.find(r=>r.id===e.id)){const r=n.findIndex(i=>Sq(i,e)>0);r<0?n.push(e):n.splice(r,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(Gi(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){const n=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),n}getEffects(){return this._resolvedEffects}_setEffects(e){const n={};for(const i of this.effects)n[i.id]=i;const r=[];for(const i of e){const a=n[i.id];let l=i;a&&a!==i?a.setProps?(a.setProps(i.props),l=a):a.cleanup(this._context):a||i.setup(this._context),r.push(l),delete n[i.id]}for(const i in n)n[i].cleanup(this._context);this.effects=r,this._resolvedEffects=r.concat(this._defaultEffects),e.some(i=>i instanceof JM)||this._resolvedEffects.push(bq),this._needsRedraw="effects changed"}finalize(){for(const e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class wq extends vb{shouldDrawLayer(e){const{operation:n}=e.props;return n.includes("draw")||n.includes("terrain")}}const Tq="deckRenderer.renderLayers";class Cq{constructor(e){this.device=e,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new wq(e),this.pickLayersPass=new sO(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;const n=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,r={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};r.effects&&this._preRender(r.effects,r);const i=this.lastPostProcessEffect?this.renderBuffers[0]:r.target;this.lastPostProcessEffect&&(r.clearColor=[0,0,0,0],r.clearCanvas=!0);const a=n.render({...r,target:i});r.effects&&this._postRender(r.effects,r),this.renderCount++,Hr(Tq,this,a,e)}needsRedraw(e={clearRedrawFlags:!1}){const n=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),n}finalize(){const{renderBuffers:e}=this;for(const n of e)n.delete();e.length=0}_preRender(e,n){this.lastPostProcessEffect=null,n.preRenderStats=n.preRenderStats||{};for(const r of e)n.preRenderStats[r.id]=r.preRender(n),r.postRender&&(this.lastPostProcessEffect=r.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){const{renderBuffers:e}=this,n=this.device.canvasContext.getDrawingBufferSize();e.length===0&&[0,1].map(r=>{const i=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"}});e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${r}`,colorAttachments:[i]}))});for(const r of e)r.resize(n)}_postRender(e,n){const{renderBuffers:r}=this,i={...n,inputBuffer:r[0],swapBuffer:r[1]};for(const a of e)if(a.postRender){i.target=a.id===this.lastPostProcessEffect?n.target:void 0;const l=a.postRender(i);i.inputBuffer=l,i.swapBuffer=l===r[0]?r[1]:r[0]}}}const Aq={pickedColor:null,pickedObjectIndex:-1};function Rq({pickedColors:t,decodePickingColor:e,deviceX:n,deviceY:r,deviceRadius:i,deviceRect:a}){const{x:l,y:u,width:f,height:h}=a;let g=i*i,m=-1,v=0;for(let S=0;Sg)v+=4*f;else for(let b=0;b=0){const T=b+l-n,A=T*T+E;A<=g&&(g=A,m=v)}v+=4}}if(m>=0){const S=t.slice(m,m+4),w=e(S);if(w){const E=Math.floor(m/4/f),b=m/4-E*f;return{...w,pickedColor:S,pickedX:l+b,pickedY:u+E}}Sn.error("Picked non-existent layer. Is picking buffer corrupt?")()}return Aq}function xq({pickedColors:t,decodePickingColor:e}){const n=new Map;if(t){for(let r=0;r=0){const a=t.slice(r,r+4),l=a.join(",");if(!n.has(l)){const u=e(a);u?n.set(l,{...u,color:a}):Sn.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(n.values())}function uO({pickInfo:t,viewports:e,pixelRatio:n,x:r,y:i,z:a}){let l=e[0];e.length>1&&(l=Oq((t==null?void 0:t.pickedViewports)||e,{x:r,y:i}));let u;if(l){const f=[r-l.x,i-l.y];a!==void 0&&(f[2]=a),u=l.unproject(f)}return{color:null,layer:null,viewport:l,index:-1,picked:!1,x:r,y:i,pixel:[r,i],coordinate:u,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:n}}function Mq(t){const{pickInfo:e,lastPickedInfo:n,mode:r,layers:i}=t,{pickedColor:a,pickedLayer:l,pickedObjectIndex:u}=e,f=l?[l]:[];if(r==="hover"){const m=n.index,v=n.layerId,S=l?l.props.id:null;if(S!==v||u!==m){if(S!==v){const w=i.find(E=>E.props.id===v);w&&f.unshift(w)}n.layerId=S,n.index=u,n.info=null}}const h=uO(t),g=new Map;return g.set(null,h),f.forEach(m=>{let v={...h};m===l&&(v.color=a,v.index=u,v.picked=!0),v=fO({layer:m,info:v,mode:r});const S=v.layer;m===l&&r==="hover"&&(n.info=v),g.set(S.id,v),r==="hover"&&S.updateAutoHighlight(v)}),g}function fO({layer:t,info:e,mode:n}){for(;t&&e;){const r=e.layer||null;e.sourceLayer=r,e.layer=t,e=t.getPickingInfo({info:e,mode:n,sourceLayer:r}),t=t.parent}return e}function Oq(t,e){for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.containsPixel(e))return r}return t[0]}class Pq{constructor(e){this._pickable=!0,this.device=e,this.pickLayersPass=new sO(e),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(e){"layerFilter"in e&&(this.layerFilter=e.layerFilter),"_pickable"in e&&(this._pickable=e._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:n,layers:r,viewports:i},a=this.lastPickedInfo.info){const l=a&&a.layer&&a.layer.id,u=a&&a.viewport&&a.viewport.id,f=l?r.find(v=>v.id===l):null,h=u&&i.find(v=>v.id===u)||i[0],g=h&&h.unproject([e-h.x,n-h.y]);return{...a,...{x:e,y:n,viewport:h,coordinate:g,layer:f}}}_resizeBuffer(){var n,r;if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){const i=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=i}const{canvas:e}=this.device.getDefaultCanvasContext();(n=this.pickingFBO)==null||n.resize({width:e.width,height:e.height}),(r=this.depthFBO)==null||r.resize({width:e.width,height:e.height})}_getPickable(e){if(this._pickable===!1)return null;const n=e.filter(r=>this.pickLayersPass.shouldDrawLayer(r)&&!r.isComposite);return n.length?n:null}_pickClosestObject({layers:e,views:n,viewports:r,x:i,y:a,radius:l=0,depth:u=1,mode:f="query",unproject3D:h,onViewportActive:g,effects:m}){const v=this.device.canvasContext.cssToDeviceRatio(),S=this._getPickable(e);if(!S||r.length===0)return{result:[],emptyInfo:uO({viewports:r,x:i,y:a,pixelRatio:v})};this._resizeBuffer();const w=this.device.canvasContext.cssToDevicePixels([i,a],!0),E=[w.x+Math.floor(w.width/2),w.y+Math.floor(w.height/2)],b=Math.round(l*v),{width:C,height:T}=this.pickingFBO,A=this._getPickingRect({deviceX:E[0],deviceY:E[1],deviceRadius:b,deviceWidth:C,deviceHeight:T}),O={x:i-l,y:a-l,width:l*2+1,height:l*2+1};let x;const N=[],F=new Set;for(let L=0;L=h);V++){const B=N[V];let W={color:B.pickedColor,layer:null,index:B.pickedObjectIndex,picked:!0,x:i,y:a,pixelRatio:S};W=fO({layer:B.pickedLayer,info:W,mode:f});const X=W.layer.id;F.has(X)||F.set(X,new Set);const Y=F.get(X),ae=W.object??W.index;Y.has(ae)||(Y.add(ae),L.push(W))}return L}_drawAndSample({layers:e,views:n,viewports:r,onViewportActive:i,deviceRect:a,cullRect:l,effects:u,pass:f},h=!1){const g=h?this.depthFBO:this.pickingFBO,m={layers:e,layerFilter:this.layerFilter,views:n,viewports:r,onViewportActive:i,pickingFBO:g,deviceRect:a,cullRect:l,effects:u,pass:f,pickZ:h,preRenderStats:{},isPicking:!0};for(const T of u)T.useInPicking&&(m.preRenderStats[T.id]=T.preRender(m));const{decodePickingColor:v}=this.pickLayersPass.render(m),{x:S,y:w,width:E,height:b}=a,C=new(h?Float32Array:Uint8Array)(E*b*4);return this.device.readPixelsToArrayWebGL(g,{sourceX:S,sourceY:w,sourceWidth:E,sourceHeight:b,target:C}),{pickedColors:C,decodePickingColor:v}}_getPickingRect({deviceX:e,deviceY:n,deviceRadius:r,deviceWidth:i,deviceHeight:a}){const l=Math.max(0,e-r),u=Math.max(0,n-r),f=Math.min(i,e+r+1)-l,h=Math.min(a,n+r+1)-u;return f<=0||h<=0?null:{x:l,y:u,width:f,height:h}}}const Nq={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},Iq="top-left",H2="__root";class Dq{constructor({deck:e,parentElement:n}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,this.parentElement=n}getWidgets(){return this.resolvedWidgets}setProps(e){e.widgets&&!Gi(e.widgets,this.widgets,1)&&this._setWidgets(e.widgets)}finalize(){for(const e of this.getWidgets())this._remove(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(const e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(n=>n.id===e.id)||(this._add(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}_setWidgets(e){const n={};for(const r of this.resolvedWidgets)n[r.id]=r;this.resolvedWidgets.length=0;for(const r of this.defaultWidgets)n[r.id]=null,this.resolvedWidgets.push(r);for(let r of e){const i=n[r.id];i?i.viewId!==r.viewId||i.placement!==r.placement?(this._remove(i),this._add(r)):r!==i&&(i.setProps(r.props),r=i):this._add(r),n[r.id]=null,this.resolvedWidgets.push(r)}for(const r in n){const i=n[r];i&&this._remove(i)}this.widgets=e}_add(e){const{viewId:n=null,placement:r=Iq}=e,i=e.onAdd({deck:this.deck,viewId:n});i&&this._getContainer(n,r).append(i),e._element=i}_remove(e){var n;(n=e.onRemove)==null||n.call(e),e._element&&e._element.remove(),e._element=void 0}_getContainer(e,n){var l;const r=e||H2;let i=this.containers[r];i||(i=document.createElement("div"),i.style.pointerEvents="none",i.style.position="absolute",i.style.overflow="hidden",(l=this.parentElement)==null||l.append(i),this.containers[r]=i);let a=i.querySelector(`.${n}`);return a||(a=document.createElement("div"),a.className=n,a.style.position="absolute",a.style.zIndex="2",Object.assign(a.style,Nq[n]),i.append(a)),a}_updateContainers(){const e=this.deck.width,n=this.deck.height;for(const r in this.containers){const i=this.lastViewports[r]||null,a=r===H2||i,l=this.containers[r];a?(l.style.display="block",l.style.left=`${i?i.x:0}px`,l.style.top=`${i?i.y:0}px`,l.style.width=`${i?i.width:e}px`,l.style.height=`${i?i.height:n}px`):l.style.display="none"}}onRedraw({viewports:e,layers:n}){var i,a;const r=e.reduce((l,u)=>(l[u.id]=u,l),{});for(const l of this.getWidgets()){const{viewId:u}=l;if(u){const f=r[u];f&&(l.onViewportChange&&l.onViewportChange(f),(i=l.onRedraw)==null||i.call(l,{viewports:[f],layers:n}))}else{if(l.onViewportChange)for(const f of e)l.onViewportChange(f);(a=l.onRedraw)==null||a.call(l,{viewports:e,layers:n})}}this.lastViewports=r,this._updateContainers()}onHover(e,n){var r,i;for(const a of this.getWidgets()){const{viewId:l}=a;(!l||l===((r=e.viewport)==null?void 0:r.id))&&((i=a.onHover)==null||i.call(a,e,n))}}onEvent(e,n){var i,a;const r=ny[n.type];if(r)for(const l of this.getWidgets()){const{viewId:u}=l;(!u||u===((i=e.viewport)==null?void 0:i.id))&&((a=l[r])==null||a.call(l,e,n))}}}const Fq={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class kq{constructor(){this.id="default-tooltip",this.placement="fill",this.props={},this.isVisible=!1}onAdd({deck:e}){const n=document.createElement("div");return n.className="deck-tooltip",Object.assign(n.style,Fq),this.deck=e,this.element=n,n}onRemove(){this.deck=void 0,this.element=void 0}setProps(){}onViewportChange(e){var n;this.isVisible&&e.id===((n=this.lastViewport)==null?void 0:n.id)&&e!==this.lastViewport&&this.setTooltip(null)}onHover(e){const{deck:n}=this,r=n&&n.props.getTooltip;if(!r)return;const i=r(e);this.lastViewport=e.viewport,this.setTooltip(i,e.x,e.y)}setTooltip(e,n,r){const i=this.element;if(i){if(typeof e=="string")i.innerText=e;else if(e)e.text&&(i.innerText=e.text),e.html&&(i.innerHTML=e.html),e.className&&(i.className=e.className);else{this.isVisible=!1,i.style.display="none";return}this.isVisible=!0,i.style.display="block",i.style.transform=`translate(${n}px, ${r}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(i.style,e.style)}}}var Yl;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Yl||(Yl={}));const yb={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,35725:null,36006:null,36007:null,34229:null,34964:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32926:!1,32928:!1,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],36389:null,36662:null,36663:null,35053:null,35055:null,35723:4352,36010:null,35977:!1,3333:4,3317:4,37440:!1,37441:!1,37443:37444,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},sr=(t,e,n)=>e?t.enable(n):t.disable(n),j2=(t,e,n)=>t.hint(n,e),ai=(t,e,n)=>t.pixelStorei(n,e),W2=(t,e,n)=>{const r=n===36006?36009:36008;return t.bindFramebuffer(r,e)},Hu=(t,e,n)=>{const i={34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[n];t.bindBuffer(i,e)};function f0(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}const Bq={3042:sr,32773:(t,e)=>t.blendColor(...e),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(t,e)=>t.clearColor(...e),3107:(t,e)=>t.colorMask(...e),2884:sr,2885:(t,e)=>t.cullFace(e),2929:sr,2931:(t,e)=>t.clearDepth(e),2932:(t,e)=>t.depthFunc(e),2928:(t,e)=>t.depthRange(...e),2930:(t,e)=>t.depthMask(e),3024:sr,35723:j2,35725:(t,e)=>t.useProgram(e),36007:(t,e)=>t.bindRenderbuffer(36161,e),36389:(t,e)=>{var n;return(n=t.bindTransformFeedback)==null?void 0:n.call(t,36386,e)},34229:(t,e)=>t.bindVertexArray(e),36006:W2,36010:W2,34964:Hu,36662:Hu,36663:Hu,35053:Hu,35055:Hu,2886:(t,e)=>t.frontFace(e),33170:j2,2849:(t,e)=>t.lineWidth(e),32823:sr,32824:"polygonOffset",10752:"polygonOffset",35977:sr,32926:sr,32928:sr,32938:"sampleCoverage",32939:"sampleCoverage",3089:sr,3088:(t,e)=>t.scissor(...e),2960:sr,2961:(t,e)=>t.clearStencil(e),2968:(t,e)=>t.stencilMaskSeparate(1028,e),36005:(t,e)=>t.stencilMaskSeparate(1029,e),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(t,e)=>t.viewport(...e),34383:sr,10754:sr,12288:sr,12289:sr,12290:sr,12291:sr,12292:sr,12293:sr,12294:sr,12295:sr,3333:ai,3317:ai,37440:ai,37441:ai,37443:ai,3330:ai,3332:ai,3331:ai,3314:ai,32878:ai,3316:ai,3315:ai,32877:ai,framebuffer:(t,e)=>{const n=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,n)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{const n=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...n)},blendFunc:(t,e)=>{const n=(e==null?void 0:e.length)===2?[...e,...e]:e;t.blendFuncSeparate(...n)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(e[0],e[1]||!1),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=f0(e)?e:[e,e];const[n,r]=e;t.stencilMaskSeparate(1028,n),t.stencilMaskSeparate(1029,r)},stencilFunc:(t,e)=>{e=f0(e)&&e.length===3?[...e,...e]:e;const[n,r,i,a,l,u]=e;t.stencilFuncSeparate(1028,n,r,i),t.stencilFuncSeparate(1029,a,l,u)},stencilOp:(t,e)=>{e=f0(e)&&e.length===3?[...e,...e]:e;const[n,r,i,a,l,u]=e;t.stencilOpSeparate(1028,n,r,i),t.stencilOpSeparate(1029,a,l,u)},viewport:(t,e)=>t.viewport(...e)};function qn(t,e,n){return e[t]!==void 0?e[t]:n[t]}const Uq={blendEquation:(t,e,n)=>t.blendEquationSeparate(qn(32777,e,n),qn(34877,e,n)),blendFunc:(t,e,n)=>t.blendFuncSeparate(qn(32969,e,n),qn(32968,e,n),qn(32971,e,n),qn(32970,e,n)),polygonOffset:(t,e,n)=>t.polygonOffset(qn(32824,e,n),qn(10752,e,n)),sampleCoverage:(t,e,n)=>t.sampleCoverage(qn(32938,e,n),qn(32939,e,n)),stencilFuncFront:(t,e,n)=>t.stencilFuncSeparate(1028,qn(2962,e,n),qn(2967,e,n),qn(2963,e,n)),stencilFuncBack:(t,e,n)=>t.stencilFuncSeparate(1029,qn(34816,e,n),qn(36003,e,n),qn(36004,e,n)),stencilOpFront:(t,e,n)=>t.stencilOpSeparate(1028,qn(2964,e,n),qn(2965,e,n),qn(2966,e,n)),stencilOpBack:(t,e,n)=>t.stencilOpSeparate(1029,qn(34817,e,n),qn(34818,e,n),qn(34819,e,n))},X2={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,n)=>t({[e]:n}),hint:(t,e,n)=>t({[e]:n}),useProgram:(t,e)=>t({35725:e}),bindRenderbuffer:(t,e,n)=>t({36007:n}),bindTransformFeedback:(t,e,n)=>t({36389:n}),bindVertexArray:(t,e)=>t({34229:e}),bindFramebuffer:(t,e,n)=>{switch(e){case 36160:return t({36006:n,36010:n});case 36009:return t({36006:n});case 36008:return t({36010:n});default:return null}},bindBuffer:(t,e,n)=>{const r={34962:[34964],36662:[36662],36663:[36663],35051:[35053],35052:[35055]}[e];return r?t({[r]:n}):{valueChanged:!0}},blendColor:(t,e,n,r,i)=>t({32773:new Float32Array([e,n,r,i])}),blendEquation:(t,e)=>t({32777:e,34877:e}),blendEquationSeparate:(t,e,n)=>t({32777:e,34877:n}),blendFunc:(t,e,n)=>t({32969:e,32968:n,32971:e,32970:n}),blendFuncSeparate:(t,e,n,r,i)=>t({32969:e,32968:n,32971:r,32970:i}),clearColor:(t,e,n,r,i)=>t({3106:new Float32Array([e,n,r,i])}),clearDepth:(t,e)=>t({2931:e}),clearStencil:(t,e)=>t({2961:e}),colorMask:(t,e,n,r,i)=>t({3107:[e,n,r,i]}),cullFace:(t,e)=>t({2885:e}),depthFunc:(t,e)=>t({2932:e}),depthRange:(t,e,n)=>t({2928:new Float32Array([e,n])}),depthMask:(t,e)=>t({2930:e}),frontFace:(t,e)=>t({2886:e}),lineWidth:(t,e)=>t({2849:e}),polygonOffset:(t,e,n)=>t({32824:e,10752:n}),sampleCoverage:(t,e,n)=>t({32938:e,32939:n}),scissor:(t,e,n,r,i)=>t({3088:new Int32Array([e,n,r,i])}),stencilMask:(t,e)=>t({2968:e,36005:e}),stencilMaskSeparate:(t,e,n)=>t({[e===1028?2968:36005]:n}),stencilFunc:(t,e,n,r)=>t({2962:e,2967:n,2963:r,34816:e,36003:n,36004:r}),stencilFuncSeparate:(t,e,n,r,i)=>t({[e===1028?2962:34816]:n,[e===1028?2967:36003]:r,[e===1028?2963:36004]:i}),stencilOp:(t,e,n,r)=>t({2964:e,2965:n,2966:r,34817:e,34818:n,34819:r}),stencilOpSeparate:(t,e,n,r,i)=>t({[e===1028?2964:34817]:n,[e===1028?2965:34818]:r,[e===1028?2966:34819]:i}),viewport:(t,e,n,r,i)=>t({2978:[e,n,r,i]})},cs=(t,e)=>t.isEnabled(e),q2={3042:cs,2884:cs,2929:cs,3024:cs,32823:cs,32926:cs,32928:cs,3089:cs,2960:cs,35977:cs},Lq=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function jc(t,e){if($q(e))return;const n={};for(const i in e){const a=Number(i),l=Bq[i];l&&(typeof l=="string"?n[l]=!0:l(t,e[i],a))}const r=t.state&&t.state.cache;if(r)for(const i in n){const a=Uq[i];a(t,e,r)}}function dO(t,e=yb){if(typeof e=="number"){const i=e,a=q2[i];return a?a(t,i):t.getParameter(i)}const n=Array.isArray(e)?e:Object.keys(e),r={};for(const i of n){const a=q2[i];r[i]=a?a(t,Number(i)):t.getParameter(Number(i))}return r}function zq(t){jc(t,yb)}function $q(t){for(const e in t)return!1;return!0}function Vq(t,e){if(t===e)return!0;const n=Array.isArray(t)||ArrayBuffer.isView(t),r=Array.isArray(e)||ArrayBuffer.isView(e);if(n&&r&&t.length===e.length){for(let i=0;i{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}static get(e){return e.state}push(e={}){this.stateStack.push({})}pop(){const e=this.stateStack[this.stateStack.length-1];jc(this.gl,e),this.stateStack.pop()}trackState(e,n){if(this.cache=n.copyState?dO(e):Object.assign({},yb),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,jq(e);for(const r in X2){const i=X2[r];Hq(e,r,i)}Y2(e,"getParameter"),Y2(e,"isEnabled")}_updateCache(e){let n=!1,r;const i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(const a in e){const l=e[a],u=this.cache[a];Vq(l,u)||(n=!0,r=u,i&&!(a in i)&&(i[a]=u),this.cache[a]=l)}return{valueChanged:n,oldValue:r}}}function Y2(t,e){const n=t[e].bind(t);t[e]=function(i){if(i===void 0||Lq.has(i))return n(i);const a=ko.get(t);return i in a.cache||(a.cache[i]=n(i)),a.enable?a.cache[i]:n(i)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function Hq(t,e,n){if(!t[e])return;const r=t[e].bind(t);t[e]=function(...a){const l=ko.get(t),{valueChanged:u,oldValue:f}=n(l._updateCache,...a);return u&&r(...a),f},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function jq(t){const e=t.useProgram.bind(t);t.useProgram=function(r){const i=ko.get(t);i.program!==r&&(e(r),i.program=r)}}function Wq(t,e,n){let r="";const i={preserveDrawingBuffer:!0,...n};let a=null;if(a||(a=t.getContext("webgl2",i)),i.failIfMajorPerformanceCaveat&&(r||(r="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow.")),!a&&!n.failIfMajorPerformanceCaveat&&(i.failIfMajorPerformanceCaveat=!1,a=t.getContext("webgl2",i),a.luma||(a.luma={}),a.luma.softwareRenderer=!0),a||(a=t.getContext("webgl",{}),a&&(a=null,r||(r="Your browser only supports WebGL1"))),!a)throw r||(r="Your browser does not support WebGL"),new Error(`Failed to create WebGL context: ${r}`);const{onContextLost:l,onContextRestored:u}=e;return t.addEventListener("webglcontextlost",f=>l(f),!1),t.addEventListener("webglcontextrestored",f=>u(f),!1),a.luma||(a.luma={}),a}function Fc(t,e,n){return n[e]===void 0&&(n[e]=t.getExtension(e)||null),n[e]}function Xq(t,e){const n=t.getParameter(7936),r=t.getParameter(7937);Fc(t,"WEBGL_debug_renderer_info",e);const i=e.WEBGL_debug_renderer_info,a=t.getParameter(i?i.UNMASKED_VENDOR_WEBGL:7936),l=t.getParameter(i?i.UNMASKED_RENDERER_WEBGL:7937),u=a||n,f=l||r,h=t.getParameter(7938),g=hO(u,f),m=qq(u,f),v=Yq(u,f);return{type:"webgl",gpu:g,gpuType:v,gpuBackend:m,vendor:u,renderer:f,version:h,shadingLanguage:"glsl",shadingLanguageVersion:300}}function hO(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function qq(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function Yq(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(hO(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function gO(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}const Ku="WEBGL_compressed_texture_s3tc",Zu="WEBGL_compressed_texture_s3tc_srgb",Kl="EXT_texture_compression_rgtc",Zl="EXT_texture_compression_bptc",Kq="WEBGL_compressed_texture_etc",Zq="WEBGL_compressed_texture_astc",Qq="WEBGL_compressed_texture_etc1",Gq="WEBGL_compressed_texture_pvrtc",Jq="WEBGL_compressed_texture_atc",K2="EXT_texture_norm16",Z2="EXT_render_snorm",eY="EXT_color_buffer_float",bb={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat-renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[Z2],"norm16-renderable-webgl":[K2],"snorm16-renderable-webgl":[K2,Z2],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[Ku,Zu,Kl,Zl],"texture-compression-bc5-webgl":[Kl],"texture-compression-bc7-webgl":[Zl],"texture-compression-etc2":[Kq],"texture-compression-astc":[Zq],"texture-compression-etc1-webgl":[Qq],"texture-compression-pvrtc-webgl":[Gq],"texture-compression-atc-webgl":[Jq]};function tY(t){return t in bb}function nY(t,e,n){return(bb[e]||[]).every(i=>Fc(t,i,n))}const Sb={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0},"r16unorm-webgl":{gl:33322,rb:!0},"r16snorm-webgl":{gl:36760},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0},"rg16unorm-webgl":{gl:33324},"rg16snorm-webgl":{gl:36761},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326},rgb9e5ufloat:{gl:35901},rg11b10ufloat:{gl:35898,rb:!0},rgb10a2unorm:{gl:32857,rb:!0},"rgb10a2uint-webgl":{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852},"rgb16snorm-webgl":{gl:36762},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842},"rgba16unorm-webgl":{gl:32859,rb:!0},"rgba16snorm-webgl":{gl:36763},"rgb32float-webgl":{gl:34837,x:eY,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Ku},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Zu},"bc1-rgba-unorm":{gl:33777,x:Ku},"bc1-rgba-unorm-srgb":{gl:35916,x:Zu},"bc2-rgba-unorm":{gl:33778,x:Ku},"bc2-rgba-unorm-srgb":{gl:35918,x:Zu},"bc3-rgba-unorm":{gl:33779,x:Ku},"bc3-rgba-unorm-srgb":{gl:35919,x:Zu},"bc4-r-unorm":{gl:36283,x:Kl},"bc4-r-snorm":{gl:36284,x:Kl},"bc5-rg-unorm":{gl:36285,x:Kl},"bc5-rg-snorm":{gl:36286,x:Kl},"bc6h-rgb-ufloat":{gl:36495,x:Zl},"bc6h-rgb-float":{gl:36494,x:Zl},"bc7-rgba-unorm":{gl:36492,x:Zl},"bc7-rgba-unorm-srgb":{gl:36493,x:Zl},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37819},"astc-10x5-unorm-srgb":{gl:37851},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rbg2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}};function rY(t,e,n){let r=e.create;const i=Sb[e.format];return(i==null?void 0:i.gl)===void 0&&(r=!1),i!=null&&i.x&&(r=r&&!!Fc(t,i.x,n)),{format:e.format,create:r&&e.create,render:r&&e.render,filter:r&&e.filter,blend:r&&e.blend,store:r&&e.store}}function pO(t){var i;const e=Sb[t],n=aY(t),r=db(t);return{internalFormat:n,format:(e==null?void 0:e.dataFormat)||sY(r.channels,r.integer,r.normalized,n),type:r.dataType?gO(r.dataType):((i=e==null?void 0:e.types)==null?void 0:i[0])||5121,compressed:r.compressed||!1}}function iY(t){switch(db(t).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${t}`)}}function sY(t,e,n,r){if(r===6408||r===6407)return r;switch(t){case"r":return e&&!n?36244:6403;case"rg":return e&&!n?33320:33319;case"rgb":return e&&!n?36248:6407;case"rgba":return e&&!n?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function aY(t){const e=Sb[t],n=e==null?void 0:e.gl;if(n===void 0)throw new Error(`Unsupported texture format ${t}`);return n}const Q2={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"};class oY extends B${constructor(n,r,i){super([],i);M(this,"gl");M(this,"extensions");M(this,"testedFeatures",new Set);this.gl=n,this.extensions=r,Fc(n,"EXT_color_buffer_float",r)}*[Symbol.iterator](){const n=this.getFeatures();for(const r of n)this.has(r)&&(yield r);return[]}has(n){var r;return(r=this.disabledFeatures)!=null&&r[n]?!1:(this.testedFeatures.has(n)||(this.testedFeatures.add(n),tY(n)&&nY(this.gl,n,this.extensions)&&this.features.add(n),this.getWebGLFeature(n)&&this.features.add(n)),this.features.has(n))}initializeFeatures(){const n=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(const r of n)this.has(r)}getFeatures(){return[...Object.keys(Q2),...Object.keys(bb)]}getWebGLFeature(n){const r=Q2[n];return typeof r=="string"?!!Fc(this.gl,r,this.extensions):!!r}}class lY extends k${constructor(n){super();M(this,"gl");M(this,"limits",{});this.gl=n}get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}getParameter(n){return this.limits[n]===void 0&&(this.limits[n]=this.gl.getParameter(n)),this.limits[n]||0}}class af extends gg{constructor(n,r){super(n,r);M(this,"device");M(this,"gl");M(this,"handle");M(this,"colorAttachments",[]);M(this,"depthStencilAttachment",null);const i=r.handle===null;this.device=n,this.gl=n.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),i||(n.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){const n=this.gl.bindFramebuffer(36160,this.handle);for(let r=0;r{r.onload=i,r.onerror=l=>a(new Error(`Unable to load script '${t}': ${l}`)),n.appendChild(r)})}const dY=1;let bn=null,G2=!1;const Eb={debugSpectorJS:Re.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function hY(t){if(!globalThis.SPECTOR)try{await mO(t.debugSpectorJSUrl||Eb.debugSpectorJSUrl)}catch(e){Re.warn(String(e))}}function gY(t){var e;if(t={...Eb,...t},!t.debugSpectorJS)return null;if(!bn&&globalThis.SPECTOR&&!((e=globalThis.luma)!=null&&e.spector)){Re.probe(dY,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:n}=globalThis.SPECTOR;bn=new n,globalThis.luma&&(globalThis.luma.spector=bn)}if(!bn)return null;if(G2||(G2=!0,bn.spyCanvases(),bn==null||bn.onCaptureStarted.add(n=>Re.info("Spector capture started:",n)()),bn==null||bn.onCapture.add(n=>{Re.info("Spector capture complete:",n)(),bn==null||bn.getResultUI(),bn==null||bn.resultView.display(),bn==null||bn.resultView.addCapture(n)})),t.gl){const n=t.gl,r=n.device;bn==null||bn.startCapture(t.gl,500),n.device=r,new Promise(i=>setTimeout(i,2e3)).then(i=>{Re.info("Spector capture stopped after 2 seconds")(),bn==null||bn.stopCapture()})}return bn}const pY="https://unpkg.com/webgl-debug@2.0.1/index.js";function vO(t){return t.luma=t.luma||{},t.luma}async function mY(){Ho()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await mO(pY))}function vY(t,e={}){return e.debugWebGL||e.traceWebGL?yY(t,e):_Y(t)}function _Y(t){const e=vO(t);return e.realContext?e.realContext:t}function yY(t,e){if(!globalThis.WebGLDebugUtils)return Re.warn("webgl-debug not loaded")(),t;const n=vO(t);if(n.debugContext)return n.debugContext;globalThis.WebGLDebugUtils.init({...Yl,...t});const r=globalThis.WebGLDebugUtils.makeDebugContext(t,bY.bind(null,e),SY.bind(null,e));for(const l in Yl)!(l in r)&&typeof Yl[l]=="number"&&(r[l]=Yl[l]);class i{}Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.setPrototypeOf(i,r);const a=Object.create(i);return n.realContext=t,n.debugContext=a,a.debug=!0,a}function J2(t,e){e=Array.from(e).map(r=>r===void 0?"undefined":r);let n=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return n=`${n.slice(0,100)}${n.length>100?"...":""}`,`gl.${t}(${n})`}function bY(t,e,n,r){r=Array.from(r).map(u=>u===void 0?"undefined":u);const i=globalThis.WebGLDebugUtils.glEnumToString(e),a=globalThis.WebGLDebugUtils.glFunctionArgsToString(n,r),l=`${i} in gl.${n}(${a})`;Re.error(l)();debugger}function SY(t,e,n){let r="";Re.level>=1&&(r=J2(e,n),t.traceWebGL&&Re.log(1,r)());for(const i of n)if(i===void 0){r=r||J2(e,n);debugger}}const d0={};function EY(t="id"){d0[t]=d0[t]||1;const e=d0[t]++;return`${t}-${e}`}class of extends $n{constructor(n,r={}){super(n,r);M(this,"device");M(this,"gl");M(this,"handle");M(this,"glTarget");M(this,"glUsage");M(this,"glIndexType",5123);M(this,"byteLength");M(this,"bytesUsed");this.device=n,this.gl=this.device.gl;const i=typeof r=="object"?r.handle:void 0;this.handle=i||this.gl.createBuffer(),n.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=wY(this.props.usage),this.glUsage=TY(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(n,r=0,i=n.byteLength+r){const a=this.glTarget;this.gl.bindBuffer(a,this.handle),this.gl.bufferData(a,i,this.glUsage),this.gl.bufferSubData(a,r,n),this.gl.bindBuffer(a,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(n,r,i),this.trackAllocatedMemory(i)}_initWithByteLength(n){let r=n;n===0&&(r=new Float32Array(0));const i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(null,0,n),this.trackAllocatedMemory(n),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(n,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,n),this.gl.bindBuffer(36663,null),this._setDebugData(n,r,n.byteLength)}async readAsync(n=0,r){return this.readSyncWebGL(n,r)}readSyncWebGL(n=0,r){r=r??this.byteLength-n;const i=new Uint8Array(r),a=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,n,i,a,r),this.gl.bindBuffer(36662,null),this._setDebugData(i,n,r),i}}function wY(t){return t&$n.INDEX?34963:t&$n.VERTEX?34962:t&$n.UNIFORM?35345:34962}function TY(t){return t&$n.INDEX||t&$n.VERTEX?35044:t&$n.UNIFORM?35048:35044}function CY(t){const e=t.split(/\r?\n/),n=[];for(const r of e){if(r.length<=1)continue;const i=r.split(":");if(i.length===2){const[m,v]=i;n.push({message:v.trim(),type:eA(m),lineNum:0,linePos:0});continue}const[a,l,u,...f]=i;let h=parseInt(u,10);isNaN(h)&&(h=0);let g=parseInt(l,10);isNaN(g)&&(g=0),n.push({message:f.join(":").trim(),type:eA(a),lineNum:h,linePos:g})}return n}function eA(t){const e=["warning","error","info"],n=t.toLowerCase();return e.includes(n)?n:"info"}class AY extends dg{constructor(n,r){super(n,r);M(this,"device");M(this,"handle");switch(this.device=n,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>this.compilationStatus)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){const n=this.device.gl.getShaderInfoLog(this.handle);return n?CY(n):[]}getTranslatedSource(){const r=this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders;return(r==null?void 0:r.getTranslatedShaderSource(this.handle))||null}async _compile(n){n=n.startsWith("#version ")?n:`#version 300 es +${n}`;const{gl:r}=this.device;if(r.shaderSource(this.handle,n),r.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}Re.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Re.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){const n=async a=>await new Promise(l=>setTimeout(l,a));if(!this.device.features.has("compilation-status-async-webgl")){await n(10);return}const{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await n(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}function RY(t,e,n,r){if(PY(e))return r(t);const i=t;i.pushState();try{return xY(t,e),jc(i.gl,n),r(t)}finally{i.popState()}}function xY(t,e){const n=t,{gl:r}=n;if(e.cullMode)switch(e.cullMode){case"none":r.disable(2884);break;case"front":r.enable(2884),r.cullFace(1028);break;case"back":r.enable(2884),r.cullFace(1029);break}if(e.frontFace&&r.frontFace(Bo("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&r.enable(34383),e.depthBias!==void 0&&(r.enable(32823),r.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){const a=n.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,l=Bo("provokingVertex",e.provokingVertex,{first:36429,last:36430});a==null||a.provokingVertexWEBGL(l)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){const a=n.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,l=Bo("polygonMode",e.polygonMode,{fill:6914,line:6913});a==null||a.polygonModeWEBGL(1028,l),a==null||a.polygonModeWEBGL(1029,l)}e.polygonOffsetLine&&r.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&r.enable(12288),e.clipDistance1&&r.enable(12289),e.clipDistance2&&r.enable(12290),e.clipDistance3&&r.enable(12291),e.clipDistance4&&r.enable(12292),e.clipDistance5&&r.enable(12293),e.clipDistance6&&r.enable(12294),e.clipDistance7&&r.enable(12295)),e.depthWriteEnabled!==void 0&&r.depthMask(OY("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?r.enable(2929):r.disable(2929),r.depthFunc(fy("depthCompare",e.depthCompare))),e.stencilWriteMask){const i=e.stencilWriteMask;r.stencilMaskSeparate(1028,i),r.stencilMaskSeparate(1029,i)}if(e.stencilReadMask&&Re.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){const i=e.stencilReadMask||4294967295,a=fy("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?r.enable(2960):r.disable(2960),r.stencilFuncSeparate(1028,a,0,i),r.stencilFuncSeparate(1029,a,0,i)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){const i=h0("stencilPassOperation",e.stencilPassOperation),a=h0("stencilFailOperation",e.stencilFailOperation),l=h0("stencilDepthFailOperation",e.stencilDepthFailOperation);r.stencilOpSeparate(1028,a,l,i),r.stencilOpSeparate(1029,a,l,i)}switch(e.blend){case!0:r.enable(3042);break;case!1:r.disable(3042);break}if(e.blendColorOperation||e.blendAlphaOperation){const i=tA("blendColorOperation",e.blendColorOperation||"add"),a=tA("blendAlphaOperation",e.blendAlphaOperation||"add");r.blendEquationSeparate(i,a);const l=Ch("blendColorSrcFactor",e.blendColorSrcFactor||"one"),u=Ch("blendColorDstFactor",e.blendColorDstFactor||"zero"),f=Ch("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),h=Ch("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");r.blendFuncSeparate(l,u,f,h)}}function fy(t,e){return Bo(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function h0(t,e){return Bo(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function tA(t,e){return Bo(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function Ch(t,e){return Bo(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function MY(t,e){return`Illegal parameter ${e} for ${t}`}function Bo(t,e,n){if(!(e in n))throw new Error(MY(t,e));return n[e]}function OY(t,e){return e}function PY(t){let e=!0;for(const n in t){e=!1;break}return e}function _O(t){const e={};return t.addressModeU&&(e[10242]=g0(t.addressModeU)),t.addressModeV&&(e[10243]=g0(t.addressModeV)),t.addressModeW&&(e[32882]=g0(t.addressModeW)),t.magFilter&&(e[10240]=dy(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=NY(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=fy("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function g0(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function dy(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function NY(t,e="none"){if(!e)return dy(t);switch(e){case"none":return dy(t);case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}class hy extends hg{constructor(n,r){super(n,r);M(this,"device");M(this,"handle");M(this,"parameters");this.device=n,this.parameters=_O(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(n){for(const[r,i]of Object.entries(n)){const a=Number(r);switch(a){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,a,i);break;default:this.device.gl.samplerParameteri(this.handle,a,i);break}}}}class Ql extends fg{constructor(n,r){super(n,{...Kn.defaultProps,...r});M(this,"device");M(this,"gl");M(this,"handle");M(this,"texture");this.device=n,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}}const IY="Failed to deduce GL constant from typed array";function DY(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(IY)}}function FY(t,e){const{clamped:n=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return n?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function yO(t){switch(t){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function kY(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function Ag(t,e,n){if(BY(e))return n(t);const{nocatch:r=!0}=e,i=ko.get(t);i.push(),jc(t,e);let a;if(r)a=n(t),i.pop();else try{a=n(t)}finally{i.pop()}return a}function BY(t){for(const e in t)return!1;return!0}function UY(t,e,n){const{dimension:r,width:i,height:a,depth:l=0}=n,{glInternalFormat:u}=n,f=n.glTarget;switch(r){case"2d-array":case"3d":t.texStorage3D(f,e,u,i,a,l);break;default:t.texStorage2D(f,e,u,i,a)}}function nA(t,e,n,r){const{width:i,height:a}=r,{dimension:l,depth:u=0,mipLevel:f=0}=r,{x:h=0,y:g=0,z:m=0}=r,{glFormat:v,glType:S}=r,w=bO(r.glTarget,l,u),E=r.flipY?{37440:!0}:{};Ag(t,E,()=>{switch(l){case"2d-array":case"3d":t.bindTexture(w,e),t.texSubImage3D(w,f,h,g,m,i,a,u,v,S,n),t.bindTexture(w,null);break;case"2d":case"cube":t.bindTexture(w,e),t.texSubImage2D(w,f,h,g,i,a,v,S,n),t.bindTexture(w,null);break;default:throw new Error(l)}})}function rA(t,e,n){const{dimension:r,width:i,height:a,depth:l=0,mipLevel:u=0,byteOffset:f=0}=n,{x:h=0,y:g=0,z:m=0}=n,{glFormat:v,glType:S,compressed:w}=n,E=bO(n.glTarget,r,l);switch(r){case"2d-array":case"3d":w?t.compressedTexSubImage3D(E,u,h,g,m,i,a,l,v,e,f):t.texSubImage3D(E,u,h,g,m,i,a,l,v,S,e,f);break;case"2d":case"cube":w?t.compressedTexSubImage2D(E,u,h,g,i,a,v,e,f):t.texSubImage2D(E,u,h,g,i,a,v,S,e,f);break;default:throw new Error(r)}}function LY(t){switch(t){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866}throw new Error(t)}function bO(t,e,n){return e==="cube"?34069+n:t}function zY(t,e){var C;const{sourceX:n=0,sourceY:r=0,sourceAttachment:i=0}=e||{};let{target:a=null,sourceWidth:l,sourceHeight:u,sourceDepth:f,sourceFormat:h,sourceType:g}=e||{};const{framebuffer:m,deleteFramebuffer:v}=SO(t),{gl:S,handle:w}=m;l||(l=m.width),u||(u=m.height);const E=(C=m.colorAttachments[i])==null?void 0:C.texture;if(!E)throw new Error(`Invalid framebuffer attachment ${i}`);f=(E==null?void 0:E.depth)||1,h||(h=(E==null?void 0:E.glFormat)||6408),g||(g=(E==null?void 0:E.glType)||5121),a=HY(a,g,h,l,u),g=g||DY(a);const b=S.bindFramebuffer(36160,w);return S.readBuffer(36064+i),S.readPixels(n,r,l,u,h,g,a),S.readBuffer(36064),S.bindFramebuffer(36160,b||null),v&&m.destroy(),a}function $Y(t,e){const{target:n,sourceX:r=0,sourceY:i=0,sourceFormat:a=6408,targetByteOffset:l=0}=e||{};let{sourceWidth:u,sourceHeight:f,sourceType:h}=e||{};const{framebuffer:g,deleteFramebuffer:m}=SO(t);u=u||g.width,f=f||g.height;const v=g;h=h||5121;let S=n;if(!S){const E=yO(a),b=kY(h),C=l+u*f*E*b;S=v.device.createBuffer({byteLength:C})}const w=t.device.createCommandEncoder();return w.copyTextureToBuffer({sourceTexture:t,width:u,height:f,origin:[r,i],destinationBuffer:S,byteOffset:l}),w.destroy(),m&&g.destroy(),S}function SO(t){return t instanceof gg?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:VY(t),deleteFramebuffer:!0}}function VY(t,e){const{device:n,width:r,height:i,id:a}=t;return n.createFramebuffer({...e,id:`framebuffer-for-${a}`,width:r,height:i,colorAttachments:[t]})}function HY(t,e,n,r,i,a){if(t)return t;e||(e=5121);const l=FY(e,{clamped:!1}),u=yO(n);return new l(r*i*u)}class lf extends Kn{constructor(n,r){super(n,r);M(this,"device");M(this,"gl");M(this,"handle");M(this,"sampler");M(this,"view");M(this,"mipmaps");M(this,"compressed");M(this,"glTarget");M(this,"glFormat");M(this,"glType");M(this,"glInternalFormat");M(this,"textureUnit",0);const i={...this.props};i.data=r.data,this.device=n,this.gl=this.device.gl,this.glTarget=LY(this.props.dimension);const a=pO(this.props.format);this.glInternalFormat=a.internalFormat,this.glFormat=a.format,this.glType=a.type,this.compressed=a.compressed,this.mipmaps=!!this.props.mipmaps,this._initialize(i),Object.seal(this)}_initialize(n){this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:n.data});let{width:r,height:i}=n;if(!r||!i){const a=Kn.getTextureDataSize(n.data);r=(a==null?void 0:a.width)||1,i=(a==null?void 0:a.height)||1}if(this.width=r,this.height=i,this.depth=n.depth,this.setSampler(n.sampler),this.view=new Ql(this.device,{...this.props,texture:this}),this.bind(),UY(this.gl,this.mipLevels,this),n.data)switch(n.dimension){case"1d":this.setTexture1DData(n.data);break;case"2d":this.setTexture2DData(n.data);break;case"3d":this.setTexture3DData(n.data);break;case"cube":this.setTextureCubeData(n.data);break;case"2d-array":this.setTextureArrayData(n.data);break;case"cube-array":this.setTextureCubeArrayData(n.data);break;default:throw new Error(n.dimension)}this.mipmaps&&this.generateMipmap()}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(n){return new Ql(this.device,{...n,texture:this})}setSampler(n={}){let r;n instanceof hy?(this.sampler=n,r=n.props):(this.sampler=new hy(this.device,n),r=n);const i=_O(r);this._setSamplerParameters(i)}generateMipmap(n){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(Re.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!(n!=null&&n.force))))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(i){Re.warn(`Error generating mipmap for ${this}: ${i.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(n){const r=Kn.getExternalImageSize(n.image),i={...Kn.defaultCopyExternalImageOptions,...r,...n},{image:a,depth:l,mipLevel:u,x:f,y:h,z:g,flipY:m}=i;let{width:v,height:S}=i;const{dimension:w,glTarget:E,glFormat:b,glInternalFormat:C,glType:T}=this;if(v=Math.min(v,this.width-f),S=Math.min(S,this.height-h),n.sourceX||n.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");return nA(this.device.gl,this.handle,a,{dimension:w,mipLevel:u,x:f,y:h,z:g,width:v,height:S,depth:l,glFormat:b,glType:T,glTarget:E,flipY:m}),{width:i.width,height:i.height}}setTexture1DData(n){throw new Error("setTexture1DData not supported in WebGL.")}setTexture2DData(n,r=0){this.bind();const i=Kn.normalizeTextureData(n,this);i.length>1&&this.props.mipmaps!==!1&&Re.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let a=0;a1&&this.props.mipmaps!==!1&&Re.warn(`${this.id} has mipmap and multiple LODs.`)();const a=Kn.CubeFaces.indexOf(r);this.setTexture2DData(n,a)}update(){throw new Error("Texture.update() not implemented. Use ExternalTexture")}setImageDataForFace(n){const{face:r,width:i,height:a,pixels:l,data:u,format:f=6408,type:h=5121}=n,{gl:g}=this,m=l||u;this.bind(),m instanceof Promise?m.then(v=>this.setImageDataForFace(Object.assign({},n,{face:r,data:v,pixels:v}))):this.width||this.height?g.texImage2D(r,0,f,i,a,0,f,h,m):g.texImage2D(r,0,f,f,h,m)}_getImageDataMap(n){for(let r=0;r36064+f);this.device.gl.drawBuffers(l)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(n){}popDebugGroup(){}insertDebugMarker(n){}setParameters(n={}){const r={...this.glParameters};r.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,n.viewport&&(n.viewport.length>=6?(r.viewport=n.viewport.slice(0,4),r.depthRange=[n.viewport[4],n.viewport[5]]):r.viewport=n.viewport),n.scissorRect&&(r.scissorTest=!0,r.scissor=n.scissorRect),n.blendConstant&&(r.blendColor=n.blendConstant),n.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),n[2967]=n.stencilReference),n.colorMask&&(r.colorMask=jY.map(i=>!!(i&n.colorMask))),this.glParameters=r,jc(this.device.gl,r)}beginOcclusionQuery(n){const r=this.props.occlusionQuerySet;r==null||r.beginOcclusionQuery()}endOcclusionQuery(){const n=this.props.occlusionQuerySet;n==null||n.endOcclusionQuery()}clear(){const n={...this.glParameters};let r=0;this.props.clearColors&&this.props.clearColors.forEach((i,a)=>{i&&this.clearColorBuffer(a,i)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(r|=16384,n.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=256,n.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=1024,n.clearStencil=this.props.clearStencil),r!==0&&Ag(this.device.gl,n,()=>{this.device.gl.clear(r)})}clearColorBuffer(n=0,r=[0,0,0,0]){Ag(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,n,r);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,n,r);break;case Float32Array:this.device.gl.clearBufferfv(6144,n,r);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}function XY(t){return qY.includes(t)}const qY=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],EO={5126:[5126,1,"float","f32","float32"],35664:[5126,2,"vec2","vec2","float32x2"],35665:[5126,3,"vec3","vec3","float32x3"],35666:[5126,4,"vec4","vec4","float32x4"],5124:[5124,1,"int","i32","sint32"],35667:[5124,2,"ivec2","vec2","sint32x2"],35668:[5124,3,"ivec3","vec3","sint32x3"],35669:[5124,4,"ivec4","vec4","sint32x4"],5125:[5125,1,"uint","u32","uint32"],36294:[5125,2,"uvec2","vec2","uint32x2"],36295:[5125,3,"uvec3","vec3","uint32x3"],36296:[5125,4,"uvec4","vec4","uint32x4"],35670:[5126,1,"bool","f32","float32"],35671:[5126,2,"bvec2","vec2","float32x2"],35672:[5126,3,"bvec3","vec3","float32x3"],35673:[5126,4,"bvec4","vec4","float32x4"],35674:[5126,8,"mat2","mat2x2"],35685:[5126,8,"mat2x3","mat2x3"],35686:[5126,8,"mat2x4","mat2x4"],35687:[5126,12,"mat3x2","mat3x2"],35675:[5126,12,"mat3","mat3x3"],35688:[5126,12,"mat3x4","mat3x4"],35689:[5126,16,"mat4x2","mat4x2"],35690:[5126,16,"mat4x3","mat4x3"],35676:[5126,16,"mat4","mat4x4"]};function wO(t){const e=EO[t];if(!e)throw new Error("uniform");const[n,r,,i]=e;return{format:i,components:r,glType:n}}function YY(t){const e=EO[t];if(!e)throw new Error("attribute");const[,n,,r,i]=e;return{attributeType:r,vertexFormat:i,components:n}}function KY(t,e){const n={attributes:[],bindings:[]};n.attributes=ZY(t,e);const r=JY(t,e);for(const u of r){const f=u.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));n.bindings.push({type:"uniform",name:u.name,group:0,location:u.location,visibility:(u.vertex?1:0)&(u.fragment?2:0),minBindingSize:u.byteLength,uniforms:f})}const i=GY(t,e);let a=0;for(const u of i)if(XY(u.type)){const{viewDimension:f,sampleType:h}=tK(u.type);n.bindings.push({type:"texture",name:u.name,group:0,location:a,viewDimension:f,sampleType:h}),u.textureUnit=a,a+=1}i.length&&(n.uniforms=i);const l=QY(t,e);return l!=null&&l.length&&(n.varyings=l),n}function ZY(t,e){const n=[],r=t.getProgramParameter(e,35721);for(let i=0;i=0){const{attributeType:h}=YY(u),g=/instance/i.test(l)?"instance":"vertex";n.push({name:l,location:f,stepMode:g,type:h})}}return n.sort((i,a)=>i.location-a.location),n}function QY(t,e){const n=[],r=t.getProgramParameter(e,35971);for(let i=0;ii.location-a.location),n}function GY(t,e){const n=[],r=t.getProgramParameter(e,35718);for(let i=0;i1)for(let S=0;St.getActiveUniformBlockParameter(e,a,l),r=[],i=t.getProgramParameter(e,35382);for(let a=0;aa.location-l.location),r}const eK={35678:["2d","float"],35680:["cube","float"],35679:["3d","float"],35682:["3d","depth"],36289:["2d-array","float"],36292:["2d-array","depth"],36293:["cube","float"],36298:["2d","sint"],36299:["3d","sint"],36300:["cube","sint"],36303:["2d-array","uint"],36306:["2d","uint"],36307:["3d","uint"],36308:["cube","uint"],36311:["2d-array","uint"]};function tK(t){const e=eK[t];if(!e)throw new Error("sampler");const[n,r]=e;return{viewDimension:n,sampleType:r}}function nK(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};const n=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!n||n.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:n[1],length:n[2]?1:0,isArray:!!n[2]}}function rK(t,e,n,r){const i=t;let a=r;a===!0&&(a=1),a===!1&&(a=0);const l=typeof a=="number"?[a]:a;switch(n){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof r!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,r);case 5126:return t.uniform1fv(e,l);case 35664:return t.uniform2fv(e,l);case 35665:return t.uniform3fv(e,l);case 35666:return t.uniform4fv(e,l);case 5124:return t.uniform1iv(e,l);case 35667:return t.uniform2iv(e,l);case 35668:return t.uniform3iv(e,l);case 35669:return t.uniform4iv(e,l);case 35670:return t.uniform1iv(e,l);case 35671:return t.uniform2iv(e,l);case 35672:return t.uniform3iv(e,l);case 35673:return t.uniform4iv(e,l);case 5125:return i.uniform1uiv(e,l,1);case 36294:return i.uniform2uiv(e,l,2);case 36295:return i.uniform3uiv(e,l,3);case 36296:return i.uniform4uiv(e,l,4);case 35674:return t.uniformMatrix2fv(e,!1,l);case 35675:return t.uniformMatrix3fv(e,!1,l);case 35676:return t.uniformMatrix4fv(e,!1,l);case 35685:return i.uniformMatrix2x3fv(e,!1,l);case 35686:return i.uniformMatrix2x4fv(e,!1,l);case 35687:return i.uniformMatrix3x2fv(e,!1,l);case 35688:return i.uniformMatrix3x4fv(e,!1,l);case 35689:return i.uniformMatrix4x2fv(e,!1,l);case 35690:return i.uniformMatrix4x3fv(e,!1,l)}throw new Error("Illegal uniform")}function iK(t){return nO(t)!==null||typeof t=="number"||typeof t=="boolean"}function sK(t){const e={bindings:{},uniforms:{}};return Object.keys(t).forEach(n=>{const r=t[n];iK(r)?e.uniforms[n]=r:e.bindings[n]=r}),e}function aK(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(t)}}function oK(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(t)}}const iA=4;class lK extends Rc{constructor(n,r){super(n,r);M(this,"device");M(this,"handle");M(this,"vs");M(this,"fs");M(this,"introspectedLayout");M(this,"uniforms",{});M(this,"bindings",{});M(this,"varyings",null);M(this,"_uniformCount",0);M(this,"_uniformSetters",{});this.device=n,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;const{varyings:i,bufferMode:a=35981}=r;i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,a)),this._linkShaders(),Re.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=KY(this.device.gl,this.handle),Re.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=cK(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(n,r){for(const[i,a]of Object.entries(n)){const l=this.shaderLayout.bindings.find(u=>u.name===i)||this.shaderLayout.bindings.find(u=>u.name===`${i}Uniforms`);if(!l){const u=this.shaderLayout.bindings.map(f=>`"${f.name}"`).join(", ");r!=null&&r.disableWarnings||Re.warn(`No binding "${i}" in render pipeline "${this.id}", expected one of ${u}`,a)();continue}switch(a||Re.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),l.type){case"uniform":if(!(a instanceof of)&&!(a.buffer instanceof of))throw new Error("buffer value");break;case"texture":if(!(a instanceof Ql||a instanceof lf||a instanceof af))throw new Error("texture value");break;case"sampler":Re.warn(`Ignoring sampler ${i}`)();break;default:throw new Error(l.type)}this.bindings[i]=a}}draw(n){var b;const{renderPass:r,parameters:i=this.props.parameters,topology:a=this.props.topology,vertexArray:l,vertexCount:u,instanceCount:f,isInstanced:h=!1,firstVertex:g=0,transformFeedback:m}=n,v=aK(a),S=!!l.indexBuffer,w=(b=l.indexBuffer)==null?void 0:b.glIndexType;if(this.linkStatus!=="success")return Re.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return Re.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),l.bindBeforeRender(r),m&&m.begin(this.props.topology),this._applyBindings(),this._applyUniforms();const E=r;return RY(this.device,i,E.glParameters,()=>{S&&h?this.device.gl.drawElementsInstanced(v,u||0,w,g,f||0):S?this.device.gl.drawElements(v,u||0,w,g):h?this.device.gl.drawArraysInstanced(v,g,u||0,f||0):this.device.gl.drawArrays(v,g,u||0),m&&m.end()}),l.unbindAfterRender(r),!0}setUniformsWebGL(n){const{bindings:r}=sK(n);Object.keys(r).forEach(i=>{Re.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,n)}async _linkShaders(){const{gl:n}=this.device;if(n.attachShader(this.handle,this.vs.handle),n.attachShader(this.handle,this.fs.handle),Re.time(iA,`linkProgram for ${this.id}`)(),n.linkProgram(this.handle),Re.timeEnd(iA,`linkProgram for ${this.id}`)(),Re.level,!this.device.features.has("compilation-status-async-webgl")){const i=this._getLinkStatus();this._reportLinkStatus(i);return}Re.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Re.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();const r=this._getLinkStatus();this._reportLinkStatus(r)}async _reportLinkStatus(n){var r;switch(n){case"success":return;default:switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`);case"pending":this.vs.asyncCompilationStatus.then(()=>this.vs.debugShader());break}switch((r=this.fs)==null?void 0:r.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`);case"pending":this.fs.asyncCompilationStatus.then(()=>this.fs.debugShader());break}const i=this.device.gl.getProgramInfoLog(this.handle);throw new Error(`Error during ${n}: ${i}`)}}_getLinkStatus(){const{gl:n}=this.device;return n.getProgramParameter(this.handle,35714)?(n.validateProgram(this.handle),n.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){const n=async a=>await new Promise(l=>setTimeout(l,a));if(!this.device.features.has("compilation-status-async-webgl")){await n(10);return}const{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await n(10)}}_areTexturesRenderable(){let n=!0;for(const r of this.shaderLayout.bindings)!this.bindings[r.name]&&!this.bindings[r.name.replace(/Uniforms$/,"")]&&(Re.warn(`Binding ${r.name} not found in ${this.id}`)(),n=!1);return n}_applyBindings(){if(this.linkStatus!=="success")return;const{gl:n}=this.device;n.useProgram(this.handle);let r=0,i=0;for(const a of this.shaderLayout.bindings){const l=this.bindings[a.name]||this.bindings[a.name.replace(/Uniforms$/,"")];if(!l)throw new Error(`No value for binding ${a.name} in ${this.id}`);switch(a.type){case"uniform":const{name:u}=a,f=n.getUniformBlockIndex(this.handle,u);if(f===4294967295)throw new Error(`Invalid uniform block name ${u}`);n.uniformBlockBinding(this.handle,i,f),l instanceof of?n.bindBufferBase(35345,i,l.handle):n.bindBufferRange(35345,i,l.buffer.handle,l.offset||0,l.size||l.buffer.byteLength-l.offset),i+=1;break;case"texture":if(!(l instanceof Ql||l instanceof lf||l instanceof af))throw new Error("texture");let h;if(l instanceof Ql)h=l.texture;else if(l instanceof lf)h=l;else if(l instanceof af&&l.colorAttachments[0]instanceof Ql)Re.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),h=l.colorAttachments[0].texture;else throw new Error("No texture");n.activeTexture(33984+r),n.bindTexture(h.glTarget,h.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${a.type}' not supported in WebGL`)}}}_applyUniforms(){for(const n of this.shaderLayout.uniforms||[]){const{name:r,location:i,type:a,textureUnit:l}=n,u=this.uniforms[r]??l;u!==void 0&&rK(this.device.gl,i,a,u)}}}function cK(t,e){const n={...t,attributes:t.attributes.map(r=>({...r}))};for(const r of(e==null?void 0:e.attributes)||[]){const i=n.attributes.find(a=>a.name===r.name);i?(i.type=r.type||i.type,i.stepMode=r.stepMode||i.stepMode):Re.warn(`shader layout attribute ${r.name} not present in shader`)}return n}class uK extends H_{constructor(n){super(n,{});M(this,"device");M(this,"commands",[]);this.device=n}submitCommands(n=this.commands){for(const r of n)switch(r.name){case"copy-buffer-to-buffer":fK(this.device,r.options);break;case"copy-buffer-to-texture":dK(this.device,r.options);break;case"copy-texture-to-buffer":hK(this.device,r.options);break;case"copy-texture-to-texture":gK(this.device,r.options);break;default:throw new Error(r.name)}}}function fK(t,e){const n=e.sourceBuffer,r=e.destinationBuffer;t.gl.bindBuffer(36662,n.handle),t.gl.bindBuffer(36663,r.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function dK(t,e){throw new Error("Not implemented")}function hK(t,e){const{sourceTexture:n,mipLevel:r=0,aspect:i="all",width:a=e.sourceTexture.width,height:l=e.sourceTexture.height,depthOrArrayLayers:u=0,origin:f=[0,0],destinationBuffer:h,byteOffset:g=0,bytesPerRow:m,rowsPerImage:v}=e;if(i!=="all")throw new Error("aspect not supported in WebGL");if(r!==0||u!==0||m||v)throw new Error("not implemented");const{framebuffer:S,destroyFramebuffer:w}=TO(n);let E;try{const b=h,C=a||S.width,T=l||S.height,A=pO(S.colorAttachments[0].texture.props.format),O=A.format,x=A.type;t.gl.bindBuffer(35051,b.handle),E=t.gl.bindFramebuffer(36160,S.handle),t.gl.readPixels(f[0],f[1],C,T,O,x,g)}finally{t.gl.bindBuffer(35051,null),E!==void 0&&t.gl.bindFramebuffer(36160,E),w&&S.destroy()}}function gK(t,e){const{sourceTexture:n,destinationMipLevel:r=0,origin:i=[0,0],destinationOrigin:a=[0,0],destinationTexture:l}=e;let{width:u=e.destinationTexture.width,height:f=e.destinationTexture.height}=e;const{framebuffer:h,destroyFramebuffer:g}=TO(n),[m,v]=i,[S,w,E]=a,b=t.gl.bindFramebuffer(36160,h.handle);let C=null,T;if(l instanceof lf)C=l,u=Number.isFinite(u)?u:C.width,f=Number.isFinite(f)?f:C.height,C.bind(0),T=C.glTarget;else throw new Error("invalid destination");switch(T){case 3553:case 34067:t.gl.copyTexSubImage2D(T,r,S,w,m,v,u,f);break;case 35866:case 32879:t.gl.copyTexSubImage3D(T,r,S,w,E,m,v,u,f);break}C&&C.unbind(),t.gl.bindFramebuffer(36160,b),g&&h.destroy()}function TO(t){if(t instanceof Kn){const{width:e,height:n,id:r}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${r}`,width:e,height:n,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}class pK extends V_{constructor(n,r){super(n,r);M(this,"device");M(this,"commandBuffer");this.device=n,this.commandBuffer=new uK(n)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(n){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:n})}copyBufferToTexture(n){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:n})}copyTextureToBuffer(n){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:n})}copyTextureToTexture(n){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:n})}pushDebugGroup(n){}popDebugGroup(){}insertDebugMarker(n){}resolveQuerySet(n,r,i){}}function mK(t){const{target:e,source:n,start:r=0,count:i=1}=t,a=n.length,l=i*a;let u=0;for(let f=r;u{for(const r in n)this.setBuffer(r,n[r])})}setBuffer(n,r){const i=this._getVaryingIndex(n),{buffer:a,byteLength:l,byteOffset:u}=this._getBufferRange(r);if(i<0){this.unusedBuffers[n]=a,Re.warn(`${this.id} unusedBuffers varying buffer ${n}`)();return}this.buffers[i]={buffer:a,byteLength:l,byteOffset:u},this.bindOnUse||this._bindBuffer(i,a,u,l)}getBuffer(n){if(sA(n))return this.buffers[n]||null;const r=this._getVaryingIndex(n);return r>=0?this.buffers[r]:null}bind(n=this.handle){if(typeof n!="function")return this.gl.bindTransformFeedback(36386,n),this;let r;return this._bound?r=n():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=n(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(n){if(n instanceof of)return{buffer:n,byteOffset:0,byteLength:n.byteLength};const{buffer:r,byteOffset:i=0,byteLength:a=n.buffer.byteLength}=n;return{buffer:r,byteOffset:i,byteLength:a}}_getVaryingIndex(n){if(sA(n))return Number(n);for(const r of this.layout.varyings)if(n===r.name)return r.location;return-1}_bindBuffers(){for(const n in this.buffers){const{buffer:r,byteLength:i,byteOffset:a}=this._getBufferRange(this.buffers[n]);this._bindBuffer(Number(n),r,a,i)}}_unbindBuffers(){for(const n in this.buffers)this.gl.bindBufferBase(35982,Number(n),null)}_bindBuffer(n,r,i=0,a){const l=r&&r.handle;!l||a===void 0?this.gl.bindBufferBase(35982,n,l):this.gl.bindBufferRange(35982,n,l,i,a)}}function sA(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}class bK extends X_{constructor(n,r){super(n,r);M(this,"device");M(this,"handle");M(this,"target",null);M(this,"_queryPending",!1);M(this,"_pollingPromise",null);if(this.device=n,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}get[Symbol.toStringTag](){return"Query"}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(n){return this._begin(n!=null&&n.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(n){this._queryPending||(this.target=n,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;const n=this.device.gl.getQueryParameter(this.handle,34919);return n&&(this._queryPending=!1),n}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(n=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,a)=>{const l=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>n?(a("Timed out"),this._pollingPromise=null):requestAnimationFrame(l)};requestAnimationFrame(l)}),this._pollingPromise}}class Ba extends Ua{constructor(n){var m,v;super({...n,id:n.id||EY("webgl-device")});M(this,"type","webgl");M(this,"handle");M(this,"features");M(this,"limits");M(this,"info");M(this,"canvasContext");M(this,"lost");M(this,"_resolveContextLost");M(this,"gl");M(this,"debug",!1);M(this,"_canvasSizeInfo",{clientWidth:0,clientHeight:0,devicePixelRatio:1});M(this,"_extensions",{});M(this,"_polyfilled",!1);M(this,"spectorJS");M(this,"renderPass",null);M(this,"_constants");const r=Ua._getCanvasContextProps(n);if(!r)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let i=(v=(m=r.canvas)==null?void 0:m.gl)==null?void 0:v.device;if(i)throw new Error(`WebGL context already attached to device ${i.id}`);this.canvasContext=new fY(this,r),this.lost=new Promise(S=>{this._resolveContextLost=S});const a={...n.webgl};r.alphaMode==="premultiplied"&&(a.premultipliedAlpha=!0),n.powerPreference!==void 0&&(a.powerPreference=n.powerPreference);const u=this.props._handle||Wq(this.canvasContext.canvas,{onContextLost:S=>{var w;return(w=this._resolveContextLost)==null?void 0:w.call(this,{reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})},onContextRestored:S=>console.log("WebGL context restored")},a);if(!u)throw new Error("WebGL context creation failed");if(i=u.device,i){if(n._reuseDevices)return Re.log(1,`Not creating a new Device, instead returning a reference to Device ${i.id} already attached to WebGL context`,i)(),i._reused=!0,i;throw new Error(`WebGL context already attached to device ${i.id}`)}this.handle=u,this.gl=u,this.spectorJS=gY({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=Xq(this.gl,this._extensions),this.limits=new lY(this.gl),this.features=new oY(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),r.autoResize!==!1&&this.canvasContext.resize(),new ko(this.gl,{log:(...S)=>Re.log(1,...S)()}).trackState(this.gl,{copyState:!1});const h=n.debugWebGL||n.debug,g=n.debugWebGL;h&&(this.gl=vY(this.gl,{debugWebGL:h,traceWebGL:g}),Re.warn("WebGL debug mode activated. Performance reduced.")(),n.debugWebGL&&(Re.level=Math.max(Re.level,1)))}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}createCanvasContext(n){throw new Error("WebGL only supports a single canvas")}createBuffer(n){const r=this._normalizeBufferProps(n);return new of(this,r)}createTexture(n){return new lf(this,n)}createExternalTexture(n){throw new Error("createExternalTexture() not implemented")}createSampler(n){return new hy(this,n)}createShader(n){return new AY(this,n)}createFramebuffer(n){return new af(this,n)}createVertexArray(n){return new wb(this,n)}createTransformFeedback(n){return new yK(this,n)}createQuerySet(n){return new bK(this,n)}createRenderPipeline(n){return new lK(this,n)}beginRenderPass(n){return new WY(this,n)}createComputePipeline(n){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(n){throw new Error("ComputePass not supported in WebGL")}createCommandEncoder(n={}){return new pK(this,n)}submit(){var n;(n=this.renderPass)==null||n.end(),this.renderPass=null}readPixelsToArrayWebGL(n,r){return zY(n,r)}readPixelsToBufferWebGL(n,r){return $Y(n,r)}setParametersWebGL(n){jc(this.gl,n)}getParametersWebGL(n){return dO(this.gl,n)}withParametersWebGL(n,r){return Ag(this.gl,n,r)}resetWebGL(){Re.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),zq(this.gl)}_getDeviceSpecificTextureFormatCapabilities(n){return rY(this.gl,n,this._extensions)}loseDevice(){var a;let n=!1;const i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(n=!0,i.loseContext()),(a=this._resolveContextLost)==null||a.call(this,{reason:"destroyed",message:"Application triggered context loss"}),n}pushState(){ko.get(this.gl).push()}popState(){ko.get(this.gl).pop()}setSpectorMetadata(n,r){n.__SPECTOR_Metadata=r}getGLKey(n,r){const i=Number(n);for(const a in this.gl)if(this.gl[a]===i)return`GL.${a}`;return r!=null&&r.emptyIfUnknown?"":String(n)}getGLKeys(n){const r={emptyIfUnknown:!0};return Object.entries(n).reduce((i,[a,l])=>(i[`${a}:${this.getGLKey(a,r)}`]=`${l}:${this.getGLKey(l,r)}`,i),{})}setConstantAttributeWebGL(n,r){const i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);const a=this._constants[n];switch(a&&TK(a,r)&&Re.info(1,`setConstantAttributeWebGL(${n}) could have been skipped, value unchanged`)(),this._constants[n]=r,r.constructor){case Float32Array:SK(this,n,r);break;case Int32Array:EK(this,n,r);break;case Uint32Array:wK(this,n,r);break;default:throw new Error("constant")}}getExtension(n){return Fc(this.gl,n,this._extensions),this._extensions}}function SK(t,e,n){switch(n.length){case 1:t.gl.vertexAttrib1fv(e,n);break;case 2:t.gl.vertexAttrib2fv(e,n);break;case 3:t.gl.vertexAttrib3fv(e,n);break;case 4:t.gl.vertexAttrib4fv(e,n);break}}function EK(t,e,n){t.gl.vertexAttribI4iv(e,n)}function wK(t,e,n){t.gl.vertexAttribI4uiv(e,n)}function TK(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let n=0;n({drawBuffersWEBGL(e){return t.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),RK=t=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return t.createVertexArray()},deleteVertexArrayOES(e){return t.deleteVertexArray(e)},isVertexArrayOES(e){return t.isVertexArray(e)},bindVertexArrayOES(e){return t.bindVertexArray(e)}}),xK=t=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return t.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return t.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return t.vertexAttribDivisor(...e)}});function MK(t=!0){const e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(n,r){if(n==="webgl"||n==="experimental-webgl"){const i=this.originalGetContext("webgl2",r);return i instanceof HTMLElement&&OK(i),i}return this.originalGetContext(n,r)}}function OK(t){t.getExtension("EXT_color_buffer_float");const e={...CK,WEBGL_disjoint_timer_query:t.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:AK(t),OES_vertex_array_object:RK(t),ANGLE_instanced_arrays:xK(t)},n=t.getExtension;t.getExtension=function(i){const a=n.call(t,i);return a||(i in e?e[i]:null)};const r=t.getSupportedExtensions;t.getSupportedExtensions=function(){const i=r.apply(t)||[];return i==null?void 0:i.concat(Object.keys(e))}}const Ah=1;class PK extends V${constructor(){super();M(this,"type","webgl");Ua.defaultProps={...Ua.defaultProps,...Eb},Ba.adapter=this}isSupported(){return typeof WebGL2RenderingContext<"u"}enforceWebGL2(n){MK(n)}async attach(n){if(n instanceof Ba)return n;if((n==null?void 0:n.device)instanceof Ua)return n.device;if(!NK(n))throw new Error("Invalid WebGL2RenderingContext");return new Ba({_handle:n,createCanvasContext:{canvas:n.canvas,autoResize:!1}})}async create(n={}){Re.groupCollapsed(Ah,"WebGLDevice created")();const r=[];(n.debugWebGL||n.debug)&&r.push(mY()),n.debugSpectorJS&&r.push(hY(n));const i=await Promise.allSettled(r);for(const u of i)u.status==="rejected"&&Re.error(`Failed to initialize debug libraries ${u.reason}`)();const a=new Ba(n),l=`${a._reused?"Reusing":"Created"} device with WebGL2 ${a.debug?"debug ":""}context: ${a.info.vendor}, ${a.info.renderer} for canvas: ${a.canvasContext.id}`;return Re.probe(Ah,l)(),Re.table(Ah,a.info)(),Re.groupEnd(Ah)(),a}}function NK(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:!!(t&&Number.isFinite(t._version))}const aA=new PK;function ya(){}const IK=({isDragging:t})=>t?"grabbing":"grab",CO={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{type:"webgl"},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:ya,onWebGLInitialized:ya,onResize:ya,onViewStateChange:ya,onInteractionStateChange:ya,onBeforeRender:ya,onAfterRender:ya,onLoad:ya,onError:t=>Sn.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:IK,getTooltip:null,debug:!1,drawPickingColors:!1};class Tb{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new qg({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=r=>{const{_pickRequest:i}=this;if(r.type==="pointerleave")i.x=-1,i.y=-1,i.radius=0;else{if(r.leftButton||r.rightButton)return;{const a=r.offsetCenter;if(!a)return;i.x=a.x,i.y=a.y,i.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:i.x,y:i.y}),i.event=r},this._onEvent=r=>{const i=ny[r.type],a=r.offsetCenter;if(!i||!a||!this.layerManager)return;const l=this.layerManager.getLayers(),u=this.deckPicker.getLastPickedObject({x:a.x,y:a.y,layers:l,viewports:this.getViewports(a)},this._lastPointerDownInfo),{layer:f}=u,h=f&&(f[i]||f.props[i]),g=this.props[i];let m=!1;h&&(m=h.call(f,u,r)),m||(g==null||g(u,r),this.widgetManager.onEvent(u,r))},this._onPointerDown=r=>{const i=r.offsetCenter,a=this._pick("pickObject","pickObject Time",{x:i.x,y:i.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=a.result[0]||a.emptyInfo},this.props={...CO,...e},e=this.props,e.viewState&&e.initialViewState&&Sn.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,e.device&&(this.device=e.device);let n=this.device;!n&&e.gl&&(e.gl instanceof WebGLRenderingContext&&Sn.error("WebGL1 context not supported.")(),n=aA.attach(e.gl)),n||(n=L_.createDevice({type:"best-available",_reuseDevices:!0,adapters:[aA],...e.deviceProps,createCanvasContext:{canvas:this._createCanvas(e),useDevicePixels:this.props.useDevicePixels,autoResize:!1}})),this.animationLoop=this._createAnimationLoop(n,e),this.setProps(e),e._typedArrayManagerProps&&Nf.setOptions(e._typedArrayManagerProps),this.animationLoop.start()}finalize(){var e,n,r,i,a,l,u,f,h,g;(e=this.animationLoop)==null||e.stop(),(n=this.animationLoop)==null||n.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,(r=this.layerManager)==null||r.finalize(),this.layerManager=null,(i=this.viewManager)==null||i.finalize(),this.viewManager=null,(a=this.effectManager)==null||a.finalize(),this.effectManager=null,(l=this.deckRenderer)==null||l.finalize(),this.deckRenderer=null,(u=this.deckPicker)==null||u.finalize(),this.deckPicker=null,(f=this.eventManager)==null||f.destroy(),this.eventManager=null,(h=this.widgetManager)==null||h.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&((g=this.canvas.parentElement)==null||g.removeChild(this.canvas),this.canvas=null)}setProps(e){var r;this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&Sn.removed("onLayerHover","onHover")(),"onLayerClick"in e&&Sn.removed("onLayerClick","onClick")(),e.initialViewState&&!Gi(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._setCanvasSize(this.props);const n=Object.create(this.props);Object.assign(n,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),(r=this.animationLoop)==null||r.setProps(n),this.layerManager&&(this.viewManager.setProps(n),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(n),this.effectManager.setProps(n),this.deckRenderer.setProps(n),this.deckPicker.setProps(n),this.widgetManager.setProps(n)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let n=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);const r=this.viewManager.needsRedraw(e),i=this.layerManager.needsRedraw(e),a=this.effectManager.needsRedraw(e),l=this.deckRenderer.needsRedraw(e);return n=n||r||i||a||l,n}redraw(e){if(!this.layerManager)return;let n=this.needsRedraw({clearRedrawFlags:!0});n=e||n,n&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(n):this._drawLayers(n))}get isInitialized(){return this.viewManager!==null}getViews(){return Fr(this.viewManager),this.viewManager.views}getViewports(e){return Fr(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}pickObject(e){const n=this._pick("pickObject","pickObject Time",e).result;return n.length?n[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_addResources(e,n=!1){for(const r in e)this.layerManager.resourceManager.add({resourceId:r,data:e[r],forceUpdate:n})}_removeResources(e){for(const n of e)this.layerManager.resourceManager.remove(n)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){var n;(n=this.layerManager)==null||n.removeDefaultShaderModule(e)}_pick(e,n,r){Fr(this.deckPicker);const{stats:i}=this;i.get("Pick Count").incrementCount(),i.get(n).timeStart();const a=this.deckPicker[e]({layers:this.layerManager.getLayers(r),views:this.viewManager.getViews(),viewports:this.getViewports(r),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...r});return i.get(n).timeEnd(),a}_createCanvas(e){let n=e.canvas;return typeof n=="string"&&(n=document.getElementById(n),Fr(n)),n||(n=document.createElement("canvas"),n.id=e.id||"deckgl-overlay",(e.parent||document.body).appendChild(n)),Object.assign(n.style,e.style),n}_setCanvasSize(e){var i;if(!this.canvas)return;const{width:n,height:r}=e;if(n||n===0){const a=Number.isFinite(n)?`${n}px`:n;this.canvas.style.width=a}if(r||r===0){const a=Number.isFinite(r)?`${r}px`:r;this.canvas.style.position=((i=e.style)==null?void 0:i.position)||"absolute",this.canvas.style.height=a}}_updateCanvasSize(){var i,a;const{canvas:e}=this;if(!e)return;const n=e.clientWidth??e.width,r=e.clientHeight??e.height;(n!==this.width||r!==this.height)&&(this.width=n,this.height=r,(i=this.viewManager)==null||i.setProps({width:n,height:r}),(a=this.layerManager)==null||a.activateViewport(this.getViewports()[0]),this.props.onResize({width:n,height:r}))}_createAnimationLoop(e,n){const{gl:r,onError:i,useDevicePixels:a}=n;return new AX({device:e,useDevicePixels:a,autoResizeDrawingBuffer:!r,autoResizeViewport:!1,onInitialize:l=>this._setDevice(l.device),onRender:this._onRenderFrame.bind(this),onError:i})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){const{views:e}=this.props,n=Array.isArray(e)?e:e?[e]:[new cO({id:"default-view"})];return n.length&&this.props.controller&&(n[0].props.controller=this.props.controller),n}_onContextLost(){const{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){var n,r,i;const{_pickRequest:e}=this;if(e.event){const{result:a,emptyInfo:l}=this._pick("pickObject","pickObject Time",e);this.cursorState.isHovering=a.length>0;let u=l,f=!1;for(const h of a)u=h,f=((n=h.layer)==null?void 0:n.onHover(h,e.event))||f;f||((i=(r=this.props).onHover)==null||i.call(r,u,e.event),this.widgetManager.onHover(u,e.event)),e.event=null}}_updateCursor(){const e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){var i,a;if(this.device=e,!this.animationLoop)return;this.canvas||(this.canvas=(i=this.device.canvasContext)==null?void 0:i.canvas),this.device instanceof Ba&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device instanceof Ba&&this.props.onWebGLInitialized(this.device.gl);const n=new tO;n.play(),this.animationLoop.attachTimeline(n),this.eventManager=new cW(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(A2).map(l=>{var S;const[u,f,h,g]=A2[l],m=(S=this.props.eventRecognizerOptions)==null?void 0:S[l],v={...f,...m,event:l};return{recognizer:new u(v),recognizeWith:h,requestFailure:g}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const l in ny)this.eventManager.on(l,this._onEvent);this.viewManager=new aq({timeline:n,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});const r=this.viewManager.getViewports()[0];this.layerManager=new sq(this.device,{deck:this,stats:this.stats,viewport:r,timeline:n}),this.effectManager=new Eq({deck:this,device:this.device}),this.deckRenderer=new Cq(this.device),this.deckPicker=new Pq(this.device),this.widgetManager=new Dq({deck:this,parentElement:(a=this.canvas)==null?void 0:a.parentElement}),this.widgetManager.addDefault(new kq),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(e,n){var l;const{device:r,gl:i}=this.layerManager.context;this.props.onBeforeRender({device:r,gl:i});const a={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...n};(l=this.deckRenderer)==null||l.renderLayers(a),a.pass==="screen"&&this.widgetManager.onRedraw({viewports:a.viewports,layers:a.layers}),this.props.onAfterRender({device:r,gl:i})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),Sn.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){const n=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:n},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){const{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();const n=this.animationLoop.stats;e.get("GPU Time").addTime(n.get("GPU Time").lastTiming),e.get("CPU Time").addTime(n.get("CPU Time").lastTiming)}_getMetrics(){const{metrics:e,stats:n}=this;e.fps=n.get("frameRate").getHz(),e.setPropsTime=n.get("setProps Time").time,e.updateAttributesTime=n.get("Update Attributes").time,e.framesRedrawn=n.get("Redraw Count").count,e.pickTime=n.get("pickObject Time").time+n.get("pickMultipleObjects Time").time+n.get("pickObjects Time").time,e.pickCount=n.get("Pick Count").count,e.gpuTime=n.get("GPU Time").time,e.cpuTime=n.get("CPU Time").time,e.gpuTimePerFrame=n.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=n.get("CPU Time").getAverageTime();const r=L_.stats.get("Memory Usage");e.bufferMemory=r.get("Buffer Memory").count,e.textureMemory=r.get("Texture Memory").count,e.renderbufferMemory=r.get("Renderbuffer Memory").count,e.gpuMemory=r.get("GPU Memory").count}}Tb.defaultProps=CO;Tb.VERSION=qz;function DK(t){switch(t){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return hM(t)}}const FK=dM;function Rh(t,e){return{attribute:t,format:e.size>1?`${e.type}x${e.size}`:e.type,byteOffset:e.offset||0}}function Eo(t){return t.stride||t.size*t.bytesPerElement}function kK(t,e){return t.type===e.type&&t.size===e.size&&Eo(t)===Eo(e)&&(t.offset||0)===(e.offset||0)}function gy(t,e){e.offset&&Sn.removed("shaderAttribute.offset","vertexOffset, elementOffset")();const n=Eo(t),r=e.vertexOffset!==void 0?e.vertexOffset:t.vertexOffset||0,i=e.elementOffset||0,a=r*n+i*t.bytesPerElement+(t.offset||0);return{...e,offset:a,stride:n}}function BK(t,e){const n=gy(t,e);return{high:n,low:{...n,offset:n.offset+t.size*4}}}class UK{constructor(e,n,r){this._buffer=null,this.device=e,this.id=n.id||"",this.size=n.size||1;const i=n.logicalType||n.type,a=i==="float64";let{defaultValue:l}=n;l=Number.isFinite(l)?[l]:l||new Array(this.size).fill(0);let u;a?u="float32":!i&&n.isIndexed?u="uint32":u=i||"float32";let f=DK(i||u);this.doublePrecision=a,a&&n.fp64===!1&&(f=Float32Array),this.value=null,this.settings={...n,defaultType:f,defaultValue:l,logicalType:i,type:u,normalized:u.includes("norm"),size:this.size,bytesPerElement:f.BYTES_PER_ELEMENT},this.state={...r,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){const e=this.getAccessor();return e.vertexOffset?e.vertexOffset*Eo(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),Nf.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,n=null){const r={};if(this.state.constant){const i=this.value;if(n){const a=gy(this.getAccessor(),n),l=a.offset/i.BYTES_PER_ELEMENT,u=a.size||this.size;r[e]=i.subarray(l,l+u)}else r[e]=i}else r[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?r[`${e}64Low`]=r[e]:r[`${e}64Low`]=new Float32Array(this.size)),r}_getBufferLayout(e=this.id,n=null){const r=this.getAccessor(),i=[],a={name:this.id,byteStride:Eo(r),attributes:i};if(this.doublePrecision){const l=BK(r,n||{});i.push(Rh(e,{...r,...l.high}),Rh(`${e}64Low`,{...r,...l.low}))}else if(n){const l=gy(r,n);i.push(Rh(e,{...r,...l}))}else i.push(Rh(e,r));return a}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){const n=Array.from(this.value);e=[n,n]}else{const{value:n,numInstances:r,size:i}=this,a=r*i;if(n&&a&&n.length>=a){const l=new Array(i).fill(1/0),u=new Array(i).fill(-1/0);for(let f=0;fu[h]&&(u[h]=g)}e=[l,u]}}return this.state.bounds=e,e}setData(e){const{state:n}=this;let r;ArrayBuffer.isView(e)?r={value:e}:e instanceof $n?r={buffer:e}:r=e;const i={...this.settings,...r};if(ArrayBuffer.isView(r.value)){if(!r.type)if(this.doublePrecision&&r.value instanceof Float64Array)i.type="float32";else{const l=FK(r.value);i.type=i.normalized?l.replace("int","norm"):l}i.bytesPerElement=r.value.BYTES_PER_ELEMENT,i.stride=Eo(i)}if(n.bounds=null,r.constant){let a=r.value;if(a=this._normalizeValue(a,[],0),this.settings.normalized&&(a=this.normalizeConstant(a)),!(!n.constant||!this._areValuesEqual(a,this.value)))return!1;n.externalBuffer=null,n.constant=!0,this.value=ArrayBuffer.isView(a)?a:new Float32Array(a)}else if(r.buffer){const a=r.buffer;n.externalBuffer=a,n.constant=!1,this.value=r.value||null}else if(r.value){this._checkExternalBuffer(r);let a=r.value;n.externalBuffer=null,n.constant=!1,this.value=a;let{buffer:l}=this;const u=Eo(i),f=(i.vertexOffset||0)*u;if(this.doublePrecision&&a instanceof Float64Array&&(a=a0(a,i)),this.settings.isIndexed){const g=this.settings.defaultType;a.constructor!==g&&(a=new g(a))}const h=a.byteLength+f+u*2;(!l||l.byteLength(n+128)/255*2-1);case"snorm16":return new Float32Array(e).map(n=>(n+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(n=>n/255);case"unorm16":return new Float32Array(e).map(n=>n/65535);default:return e}}_normalizeValue(e,n,r){const{defaultValue:i,size:a}=this.settings;if(Number.isFinite(e))return n[r]=e,n;if(!e){let l=a;for(;--l>=0;)n[r+l]=i[l];return n}switch(a){case 4:n[r+3]=Number.isFinite(e[3])?e[3]:i[3];case 3:n[r+2]=Number.isFinite(e[2])?e[2]:i[2];case 2:n[r+1]=Number.isFinite(e[1])?e[1]:i[1];case 1:n[r+0]=Number.isFinite(e[0])?e[0]:i[0];break;default:let l=a;for(;--l>=0;)n[r+l]=Number.isFinite(e[l])?e[l]:i[l]}return n}_areValuesEqual(e,n){if(!e||!n)return!1;const{size:r}=this;for(let i=0;i0&&(lA.length=t.length,r=lA):r=oA,(e>0||Number.isFinite(n))&&(r=(Array.isArray(r)?r:Array.from(r)).slice(e,n),i.index=e-1),{iterable:r,objectInfo:i}}function AO(t){return t&&t[Symbol.asyncIterator]}function zK(t,e){const{size:n,stride:r,offset:i,startIndices:a,nested:l}=e,u=t.BYTES_PER_ELEMENT,f=r?r/u:n,h=i?i/u:0,g=Math.floor((t.length-h)/f);return(m,{index:v,target:S})=>{if(!a){const C=v*f+h;for(let T=0;T=e[1]))return t;const n=[],r=t.length;let i=0;for(let a=0;ae[1]?n.push(l):e=[Math.min(l[0],e[0]),Math.max(l[1],e[1])]}return n.splice(i,0,e),n}const HK={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function RO(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});const n=t.type||"interpolation";return{...HK[n],...e,...t,type:n}}class xO extends UK{constructor(e,n){super(e,n,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:Uh}),this.constant=!1,this.settings.update=n.update||(n.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){const n=this.state.needsRedraw;return this.state.needsRedraw=n&&!e,n}layoutChanged(){return this.state.layoutChanged}setAccessor(e){var n;(n=this.state).layoutChanged||(n.layoutChanged=!kK(e,this.getAccessor())),super.setAccessor(e)}getUpdateTriggers(){const{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return!!this.settings.transition}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;const{accessor:n}=this.settings,r=this.settings.transition,i=Array.isArray(n)?e[n.find(a=>e[a])]:e[n];return RO(i,r)}setNeedsUpdate(e=this.id,n){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),n){const{startRow:r=0,endRow:i=1/0}=n;this.state.updateRanges=VK(this.state.updateRanges,[r,i])}else this.state.updateRanges=Uh}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=$K}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){const{state:n,settings:r}=this;return r.noAlloc?!1:r.update?(super.allocate(e,n.updateRanges!==Uh),!0):!1}updateBuffer({numInstances:e,data:n,props:r,context:i}){if(!this.needsUpdate())return!1;const{state:{updateRanges:a},settings:{update:l,noAlloc:u}}=this;let f=!0;if(l){for(const[h,g]of a)l.call(i,this,{data:n,startRow:h,endRow:g,props:r,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLengthg?h.set(A,E):(e._normalizeValue(A,C.target,0),eq({target:h,source:C.target,start:E,count:O}));E+=O*g}else e._normalizeValue(A,h,E),E+=g}}_validateAttributeUpdaters(){const{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){const{value:e}=this,n=Math.min(4,this.size);if(e&&e.length>=n){let r=!0;switch(n){case 4:r=r&&Number.isFinite(e[3]);case 3:r=r&&Number.isFinite(e[2]);case 2:r=r&&Number.isFinite(e[1]);case 1:r=r&&Number.isFinite(e[0]);break;default:r=!1}if(!r)throw new Error(`Illegal attribute generated for ${this.id}`)}}}function p0(t){const{source:e,target:n,start:r=0,size:i,getData:a}=t,l=t.end||n.length,u=e.length,f=l-r;if(u>f){n.set(e.subarray(0,f),r);return}if(n.set(e,r),!a)return;let h=u;for(;hr(g+u,m)),h=Math.min(i.length,a.length);for(let g=1;gu}){const u=n.doublePrecision&&n.value instanceof Float64Array?2:1,f=n.size*u,h=n.byteOffset,g=n.settings.bytesPerElement<4?h/n.settings.bytesPerElement*4:h,m=n.startIndices,v=a&&m,S=n.isConstant;if(!v&&e&&r>=i)return e;const w=n.value instanceof Float64Array?Float32Array:n.value.constructor,E=S?n.value:new w(n.getBuffer().readSyncWebGL(h,i*w.BYTES_PER_ELEMENT).buffer);if(n.settings.normalized&&!S){const A=l;l=(O,x)=>n.normalizeConstant(A(O,x))}const b=S?(A,O)=>l(E,O):(A,O)=>l(E.subarray(A+h,A+h+f),O),C=e?new Float32Array(e.readSyncWebGL(g,r*4).buffer):new Float32Array(0),T=new Float32Array(i);return jK({source:C,target:T,sourceStartIndices:a,targetStartIndices:m,size:f,getData:b}),(!e||e.byteLength0||i.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}}const JK=`uniform springUniforms { + float damping; + float stiffness; +} spring; +`,eZ={name:"spring",vs:JK,uniformTypes:{damping:"f32",stiffness:"f32"}},tZ=`#version 300 es +#define SHADER_NAME spring-transition-vertex-shader + +#define EPSILON 0.00001 + +in ATTRIBUTE_TYPE aPrev; +in ATTRIBUTE_TYPE aCur; +in ATTRIBUTE_TYPE aTo; +out ATTRIBUTE_TYPE vNext; +out float vIsTransitioningFlag; + +ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) { + ATTRIBUTE_TYPE velocity = cur - prev; + ATTRIBUTE_TYPE delta = dest - cur; + ATTRIBUTE_TYPE force = delta * spring.stiffness; + ATTRIBUTE_TYPE resistance = velocity * spring.damping; + return force - resistance + velocity + cur; +} + +void main(void) { + bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON; + vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0; + + vNext = getNextValue(aCur, aPrev, aTo); + gl_Position = vec4(0, 0, 0, 1); + gl_PointSize = 100.0; +} +`,nZ=`#version 300 es +#define SHADER_NAME spring-transition-is-transitioning-fragment-shader + +in float vIsTransitioningFlag; + +out vec4 fragColor; + +void main(void) { + if (vIsTransitioningFlag == 0.0) { + discard; + } + fragColor = vec4(1.0); +}`;function rZ(t,e){const n=MO(e.size),r=OO(e.size);return new If(t,{vs:tZ,fs:nZ,bufferLayout:[{name:"aPrev",format:r},{name:"aCur",format:r},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[eZ],defines:{ATTRIBUTE_TYPE:n},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function iZ(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function sZ(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}const aZ={interpolation:qK,spring:GK};class oZ{constructor(e,{id:n,timeline:r}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=n,this.device=e,this.timeline=r,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(const e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:n,numInstances:r}){this.numInstances=r||1;for(const i in e){const a=e[i],l=a.getTransitionSetting(n);l&&this._updateAttribute(i,a,l)}for(const i in this.transitions){const a=e[i];(!a||!a.getTransitionSetting(n))&&this._removeTransition(i)}}hasAttribute(e){const n=this.transitions[e];return n&&n.inProgress}getAttributes(){const e={};for(const n in this.transitions){const r=this.transitions[n];r.inProgress&&(e[n]=r.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(const n in this.transitions)this.transitions[n].update()&&(this.needsRedraw=!0);const e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,n,r){const i=this.transitions[e];let a=!i||i.type!==r.type;if(a){i&&this._removeTransition(e);const l=aZ[r.type];l?this.transitions[e]=new l({attribute:n,timeline:this.timeline,device:this.device}):(Sn.error(`unsupported transition type '${r.type}'`)(),a=!1)}(a||n.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(r,this.numInstances))}}const uA="attributeManager.invalidate",lZ="attributeManager.updateStart",cZ="attributeManager.updateEnd",uZ="attribute.updateStart",fZ="attribute.allocate",dZ="attribute.updateEnd";class hZ{constructor(e,{id:n="attribute-manager",stats:r,timeline:i}={}){this.mergeBoundsMemoized=Zf(hX),this.id=n,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=r,this.attributeTransitionManager=new oZ(e,{id:`${n}-transitions`,timeline:i}),Object.seal(this)}finalize(){for(const e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){const n=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,n&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(const n of e)this.attributes[n]!==void 0&&(this.attributes[n].delete(),delete this.attributes[n])}invalidate(e,n){const r=this._invalidateTrigger(e,n);Hr(uA,this,e,r)}invalidateAll(e){for(const n in this.attributes)this.attributes[n].setNeedsUpdate(n,e);Hr(uA,this,"all")}update({data:e,numInstances:n,startIndices:r=null,transitions:i,props:a={},buffers:l={},context:u={}}){let f=!1;Hr(lZ,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(const h in this.attributes){const g=this.attributes[h],m=g.settings.accessor;g.startIndices=r,g.numInstances=n,a[h]&&Sn.removed(`props.${h}`,`data.attributes.${h}`)(),g.setExternalBuffer(l[h])||g.setBinaryValue(typeof m=="string"?l[m]:void 0,e.startIndices)||typeof m=="string"&&!l[m]&&g.setConstantValue(a[m])||g.needsUpdate()&&(f=!0,this._updateAttribute({attribute:g,numInstances:n,data:e,props:a,context:u})),this.needsRedraw=this.needsRedraw||g.needsRedraw()}f&&Hr(cZ,this,n),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:n,transitions:i})}updateTransition(){const{attributeTransitionManager:e}=this,n=e.run();return this.needsRedraw=this.needsRedraw||n,n}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){const n=e.map(r=>{var i;return(i=this.attributes[r])==null?void 0:i.getBounds()});return this.mergeBoundsMemoized(n)}getChangedAttributes(e={clearChangedFlags:!1}){const{attributes:n,attributeTransitionManager:r}=this,i={...r.getAttributes()};for(const a in n){const l=n[a];l.needsRedraw(e)&&!r.hasAttribute(a)&&(i[a]=l)}return i}getBufferLayouts(e){return Object.values(this.getAttributes()).map(n=>n.getBufferLayout(e))}_add(e,n){for(const r in e){const i=e[r],a={...i,id:r,size:i.isIndexed&&1||i.size||1,...n};this.attributes[r]=new xO(this.device,a)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){const e={};for(const n in this.attributes)this.attributes[n].getUpdateTriggers().forEach(i=>{e[i]||(e[i]=[]),e[i].push(n)});this.updateTriggers=e}_invalidateTrigger(e,n){const{attributes:r,updateTriggers:i}=this,a=i[e];return a&&a.forEach(l=>{const u=r[l];u&&u.setNeedsUpdate(u.id,n)}),a}_updateAttribute(e){const{attribute:n,numInstances:r}=e;if(Hr(uZ,n),n.constant){n.setConstantValue(n.value);return}n.allocate(r)&&Hr(fZ,n,r),n.updateBuffer(e)&&(this.needsRedraw=!0,Hr(dZ,n,r))}}class gZ extends cp{get value(){return this._value}_onUpdate(){const{time:e,settings:{fromValue:n,toValue:r,duration:i,easing:a}}=this,l=a(e/i);this._value=yg(n,r,l)}}const fA=1e-5;function dA(t,e,n,r,i){const a=e-t,u=(n-e)*i,f=-a*r;return u+f+a+e}function pZ(t,e,n,r,i){if(Array.isArray(n)){const a=[];for(let l=0;l0}add(e,n,r,i){const{transitions:a}=this;if(a.has(e)){const f=a.get(e),{value:h=f.settings.fromValue}=f;n=h,this.remove(e)}if(i=RO(i),!i)return;const l=vZ[i.type];if(!l){Sn.error(`unsupported transition type '${i.type}'`)();return}const u=new l(this.timeline);u.start({...i,fromValue:n,toValue:r}),a.set(e,u)}remove(e){const{transitions:n}=this;n.has(e)&&(n.get(e).cancel(),n.delete(e))}update(){const e={};for(const[n,r]of this.transitions)r.update(),e[n]=r.value,r.inProgress||this.remove(n);return e}clear(){for(const e of this.transitions.keys())this.remove(e)}}function yZ(t){const e=t[Fo];for(const n in e){const r=e[n],{validate:i}=r;if(i&&!i(t[n],r))throw new Error(`Invalid prop ${n}: ${t[n]}`)}}function bZ(t,e){const n=kO({newProps:t,oldProps:e,propTypes:t[Fo],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),r=EZ(t,e);let i=!1;return r||(i=wZ(t,e)),{dataChanged:r,propsChanged:n,updateTriggersChanged:i,extensionsChanged:TZ(t,e),transitionsChanged:SZ(t,e)}}function SZ(t,e){if(!t.transitions)return!1;const n={},r=t[Fo];let i=!1;for(const a in t.transitions){const l=r[a],u=l&&l.type;(u==="number"||u==="color"||u==="array")&&py(t[a],e[a],l)&&(n[a]=!0,i=!0)}return i?n:!1}function kO({newProps:t,oldProps:e,ignoreProps:n={},propTypes:r={},triggerName:i="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${i} changed shallowly`;if(typeof e!="object"||e===null)return`${i} changed shallowly`;for(const a of Object.keys(t))if(!(a in n)){if(!(a in e))return`${i}.${a} added`;const l=py(t[a],e[a],r[a]);if(l)return`${i}.${a} ${l}`}for(const a of Object.keys(e))if(!(a in n)){if(!(a in t))return`${i}.${a} dropped`;if(!Object.hasOwnProperty.call(t,a)){const l=py(t[a],e[a],r[a]);if(l)return`${i}.${a} ${l}`}}return!1}function py(t,e,n){let r=n&&n.equal;return r&&!r(t,e,n)||!r&&(r=t&&e&&t.equals,r&&!r.call(t,e))?"changed deeply":!r&&e!==t?"changed shallowly":null}function EZ(t,e){if(e===null)return"oldProps is null, initial diff";let n=!1;const{dataComparator:r,_dataDiff:i}=t;return r?r(t.data,e.data)||(n="Data comparator detected a change"):t.data!==e.data&&(n="A new data container was supplied"),n&&i&&(n=i(t.data,e.data)||n),n}function wZ(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&gA(t,e,"all"))return{all:!0};const n={};let r=!1;for(const i in t.updateTriggers)i!=="all"&&gA(t,e,i)&&(n[i]=!0,r=!0);return r?n:!1}function TZ(t,e){if(e===null)return!0;const n=e.extensions,{extensions:r}=t;if(r===n)return!1;if(!n||!r||r.length!==n.length)return!0;for(let i=0;ir.name==="project64"))){const r=n.modules.findIndex(i=>i.name==="project32");r>=0&&n.modules.splice(r,1)}if("inject"in e)if(!t.inject)n.inject=e.inject;else{const r={...t.inject};for(const i in e.inject)r[i]=(r[i]||"")+e.inject[i];n.inject=r}return n}const OZ={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},my={};function PZ(t,e,n,r){if(n instanceof Kn)return n;n.constructor&&n.constructor.name!=="Object"&&(n={data:n});let i=null;n.compressed&&(i={minFilter:"linear",mipmapFilter:n.data.length>1?"nearest":"linear"});const a=e.createTexture({...n,sampler:{...OZ,...i,...r},mipmaps:!0});return my[a.id]=t,a}function NZ(t,e){!e||!(e instanceof Kn)||my[e.id]===t&&(e.delete(),delete my[e.id])}const IZ={boolean:{validate(t,e){return!0},equal(t,e,n){return!!t==!!e}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||vy(t)&&(t.length===3||t.length===4)},equal(t,e,n){return Gi(t,e,1)}},accessor:{validate(t,e){const n=Rg(t);return n==="function"||n===Rg(e.value)},equal(t,e,n){return typeof e=="function"?!0:Gi(t,e,1)}},array:{validate(t,e){return e.optional&&!t||vy(t)},equal(t,e,n){const{compare:r}=n,i=Number.isInteger(r)?r:r?1:0;return r?Gi(t,e,i):t===e}},object:{equal(t,e,n){if(n.ignore)return!0;const{compare:r}=n,i=Number.isInteger(r)?r:r?1:0;return r?Gi(t,e,i):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,n){return!n.compare&&n.ignore!==!1||t===e}},data:{transform:(t,e,n)=>{if(!t)return t;const{dataTransform:r}=n.props;return r?r(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,n)=>{const r=n.context;return!r||!r.device?null:PZ(n.id,r.device,t,{...e.parameters,...n.props.textureParameters})},release:(t,e,n)=>{NZ(n.id,t)}}};function DZ(t){const e={},n={},r={};for(const[i,a]of Object.entries(t)){const l=a==null?void 0:a.deprecatedFor;if(l)r[i]=Array.isArray(l)?l:[l];else{const u=FZ(i,a);e[i]=u,n[i]=u.value}}return{propTypes:e,defaultProps:n,deprecatedProps:r}}function FZ(t,e){switch(Rg(e)){case"object":return ju(t,e);case"array":return ju(t,{type:"array",value:e,compare:!1});case"boolean":return ju(t,{type:"boolean",value:e});case"number":return ju(t,{type:"number",value:e});case"function":return ju(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function ju(t,e){return"type"in e?{name:t,...IZ[e.type],...e}:"value"in e?{name:t,type:Rg(e.value),...e}:{name:t,type:"object",value:e}}function vy(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function Rg(t){return vy(t)?"array":t===null?"null":typeof t}function kZ(t,e){let n;for(let a=e.length-1;a>=0;a--){const l=e[a];"extensions"in l&&(n=l.extensions)}const r=_y(t.constructor,n),i=Object.create(r);i[Cg]=t,i[Vo]={},i[ka]={};for(let a=0;a{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(const e in this.asyncProps){const n=this.asyncProps[e];n&&n.type&&n.type.release&&n.type.release(n.resolvedValue,n.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||WZ}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){const n=this.asyncProps[e];return n&&n.resolvedValue}isAsyncPropLoading(e){if(e){const n=this.asyncProps[e];return!!(n&&n.pendingLoadCount>0&&n.pendingLoadCount!==n.resolvedLoadCount)}for(const n in this.asyncProps)if(this.isAsyncPropLoading(n))return!0;return!1}reloadAsyncProp(e,n){this._watchPromise(e,Promise.resolve(n))}setAsyncProps(e){this.component=e[Cg]||this.component;const n=e[ka]||{},r=e[Vo]||e,i=e[ic]||{};for(const a in n){const l=n[a];this._createAsyncPropData(a,i[a]),this._updateAsyncProp(a,l),n[a]=this.getAsyncProp(a)}for(const a in r){const l=r[a];this._createAsyncPropData(a,i[a]),this._updateAsyncProp(a,l)}}_fetch(e,n){return null}_onResolve(e,n){}_onError(e,n){}_updateAsyncProp(e,n){if(this._didAsyncInputValueChange(e,n)){if(typeof n=="string"&&(n=this._fetch(e,n)),n instanceof Promise){this._watchPromise(e,n);return}if(AO(n)){this._resolveAsyncIterable(e,n);return}this._setPropValue(e,n)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(const e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,n){const r=this.asyncProps[e];return n===r.resolvedValue||n===r.lastValue?!1:(r.lastValue=n,!0)}_setPropValue(e,n){this._freezeAsyncOldProps();const r=this.asyncProps[e];r&&(n=this._postProcessValue(r,n),r.resolvedValue=n,r.pendingLoadCount++,r.resolvedLoadCount=r.pendingLoadCount)}_setAsyncPropValue(e,n,r){const i=this.asyncProps[e];i&&r>=i.resolvedLoadCount&&n!==void 0&&(this._freezeAsyncOldProps(),i.resolvedValue=n,i.resolvedLoadCount=r,this.onAsyncPropUpdated(e,n))}_watchPromise(e,n){const r=this.asyncProps[e];if(r){r.pendingLoadCount++;const i=r.pendingLoadCount;n.then(a=>{this.component&&(a=this._postProcessValue(r,a),this._setAsyncPropValue(e,a,i),this._onResolve(e,a))}).catch(a=>{this._onError(e,a)})}}async _resolveAsyncIterable(e,n){if(e!=="data"){this._setPropValue(e,n);return}const r=this.asyncProps[e];if(!r)return;r.pendingLoadCount++;const i=r.pendingLoadCount;let a=[],l=0;for await(const u of n){if(!this.component)return;const{dataTransform:f}=this.component.props;f?a=f(u,a):a=a.concat(u),Object.defineProperty(a,"__diff",{enumerable:!1,value:[{startRow:l,endRow:a.length}]}),l=a.length,this._setAsyncPropValue(e,a,i)}this._onResolve(e,a)}_postProcessValue(e,n){const r=e.type;return r&&this.component&&(r.release&&r.release(e.resolvedValue,r,this.component),r.transform)?r.transform(n,r,this.component):n}_createAsyncPropData(e,n){if(!this.asyncProps[e]){const i=this.component&&this.component.props[Fo];this.asyncProps[e]={type:i&&i[e],lastValue:null,resolvedValue:n,pendingLoadCount:0,resolvedLoadCount:0}}}}class qZ extends XZ{constructor({attributeManager:e,layer:n}){super(n),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,n){const r=this.layer,i=r==null?void 0:r.props.fetch;return i?i(n,{propName:e,layer:r}):super._fetch(e,n)}_onResolve(e,n){const r=this.layer;if(r){const i=r.props.onDataLoad;e==="data"&&i&&i(n,{propName:e,layer:r})}}_onError(e,n){const r=this.layer;r&&r.raiseError(n,`loading ${e} of ${this.layer}`)}}const YZ="layer.changeFlag",KZ="layer.initialize",ZZ="layer.update",QZ="layer.finalize",GZ="layer.matched",mA=2**24-1,JZ=Object.freeze([]),eQ=Zf(({oldViewport:t,viewport:e})=>t.equals(e));let Vi=new Uint8ClampedArray(0);const tQ={data:{type:"data",value:JZ,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:e,layer:n,loaders:r,loadOptions:i,signal:a})=>{const{resourceManager:l}=n.context;i=i||n.getLoadOptions(),r=r||n.props.loaders,a&&(i={...i,fetch:{...i==null?void 0:i.fetch,signal:a}});let u=l.contains(t);return!u&&!i&&(l.add({resourceId:t,data:jh(t,r),persistent:!1}),u=!0),u?l.subscribe({resourceId:t,onChange:f=>{var h;return(h=n.internalState)==null?void 0:h.reloadAsyncProp(e,f)},consumerId:n.id,requestId:e}):jh(t,r,i)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:cn.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class Jf extends up{constructor(){super(...arguments),this.internalState=null,this.lifecycle=Vl.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){Fr(this.internalState);const n=this.internalState.viewport||this.context.viewport,r=eO(e,{viewport:n,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[i,a,l]=KM(r,n.pixelProjectionMatrix);return e.length===2?[i,a]:[i,a,l]}unproject(e){return Fr(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,n){Fr(this.internalState);const r=this.internalState.viewport||this.context.viewport;return yX(e,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...n})}get isComposite(){return!1}get isDrawable(){return!0}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){const e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(const n of this.getModels())n.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){const{coordinateSystem:e}=this.props;return e===cn.DEFAULT||e===cn.LNGLAT||e===cn.CARTESIAN}onHover(e,n){return this.props.onHover&&this.props.onHover(e,n)||!1}onClick(e,n){return this.props.onClick&&this.props.onClick(e,n)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,n=[]){return n[0]=e+1&255,n[1]=e+1>>8&255,n[2]=e+1>>8>>8&255,n}decodePickingColor(e){Fr(e instanceof Uint8Array);const[n,r,i]=e;return n+r*256+i*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:RZ(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){var e;return(e=this.getAttributeManager())==null?void 0:e.getBounds(["positions","instancePositions"])}getShaders(e){e=pA(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(const n of this.props.extensions)e=pA(e,n.getShaders.call(this,n));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){const n=this.getAttributeManager(),{dataChanged:r}=e.changeFlags;if(r&&n)if(Array.isArray(r))for(const i of r)n.invalidateAll(i);else n.invalidateAll();if(n){const{props:i}=e,a=this.internalState.hasPickingBuffer,l=Number.isInteger(i.highlightedObjectIndex)||i.pickable||i.extensions.some(u=>u.getNeedsPickingBuffer.call(this,u));if(a!==l){this.internalState.hasPickingBuffer=l;const{pickingColors:u,instancePickingColors:f}=n.attributes,h=u||f;h&&(l&&h.constant&&(h.constant=!1,n.invalidate(h.id)),!h.value&&!l&&(h.constant=!0,h.value=[0,0,0]))}}}finalizeState(e){for(const r of this.getModels())r.destroy();const n=this.getAttributeManager();n&&n.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(const n of this.getModels())n.draw(e.renderPass)}getPickingInfo({info:e,mode:n,sourceLayer:r}){const{index:i}=e;return i>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[i]),e}raiseError(e,n){var r,i,a,l;n&&(e=new Error(`${n}: ${e.message}`,{cause:e})),(i=(r=this.props).onError)!=null&&i.call(r,e)||(l=(a=this.context)==null?void 0:a.onError)==null||l.call(a,e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){var e;return((e=this.internalState)==null?void 0:e.uniformTransitions.active)||!1}activateViewport(e){if(!this.internalState)return;const n=this.internalState.viewport;this.internalState.viewport=e,(!n||!eQ({oldViewport:n,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){const n=this.getAttributeManager();n&&(e==="all"?n.invalidateAll():n.invalidate(e))}updateAttributes(e){let n=!1;for(const r in e)e[r].layoutChanged()&&(n=!0);for(const r of this.getModels())this._setModelAttributes(r,e,n)}_updateAttributes(){const e=this.getAttributeManager();if(!e)return;const n=this.props,r=this.getNumInstances(),i=this.getStartIndices();e.update({data:n.data,numInstances:r,startIndices:i,props:n,transitions:n.transitions,buffers:n.data.attributes,context:this});const a=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(a)}_updateAttributeTransition(){const e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){const{uniformTransitions:e}=this.internalState;if(e.active){const n=e.update(),r=Object.create(this.props);for(const i in n)Object.defineProperty(r,i,{value:n[i]});return r}return this.props}calculateInstancePickingColors(e,{numInstances:n}){if(e.constant)return;const r=Math.floor(Vi.length/4);if(this.internalState.usesPickingColorCache=!0,rmA&&Sn.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Vi=Nf.allocate(Vi,n,{size:4,copy:!0,maxCount:Math.max(n,mA)});const i=Math.floor(Vi.length/4),a=[0,0,0];for(let l=r;l(Sn.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new _Z(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(const n of this.props.extensions)n.initializeState.call(this,this.context,n);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){Hr(GZ,this,this===e);const{state:n,internalState:r}=e;this!==e&&(this.internalState=r,this.state=n,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){const e=this.needsUpdate();if(Hr(ZZ,this,e),!e)return;const n=this.props,r=this.context,i=this.internalState,a=r.viewport,l=this._updateUniformTransition();i.propsInTransition=l,r.viewport=i.viewport||a,this.props=l;try{const u=this._getUpdateParams(),f=this.getModels();if(r.device)this.updateState(u);else try{this.updateState(u)}catch{}for(const g of this.props.extensions)g.updateState.call(this,u,g);this.setNeedsRedraw(),this._updateAttributes();const h=this.getModels()[0]!==f[0];this._postUpdate(u,h)}finally{r.viewport=a,this.props=n,this._clearChangeFlags(),i.needsUpdate=!1,i.resetOldProps()}}_finalize(){Hr(QZ,this),this.finalizeState(this.context);for(const e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:n=null,uniforms:r={},parameters:i={}}){this._updateAttributeTransition();const a=this.props,l=this.context;this.props=this.internalState.propsInTransition||a;try{n&&this.setShaderModuleProps(n);const{getPolygonOffset:u}=this.props,f=u&&u(r)||[0,0];l.device instanceof Ba&&l.device.setParametersWebGL({polygonOffset:f});for(const h of this.getModels())h.setParameters(i);if(l.device instanceof Ba)l.device.withParametersWebGL(i,()=>{const h={renderPass:e,shaderModuleProps:n,uniforms:r,parameters:i,context:l};for(const g of this.props.extensions)g.draw.call(this,h,g);this.draw(h)});else{const h={renderPass:e,shaderModuleProps:n,uniforms:r,parameters:i,context:l};for(const g of this.props.extensions)g.draw.call(this,h,g);this.draw(h)}}finally{this.props=a}}getChangeFlags(){var e;return(e=this.internalState)==null?void 0:e.changeFlags}setChangeFlags(e){if(!this.internalState)return;const{changeFlags:n}=this.internalState;for(const i in e)if(e[i]){let a=!1;switch(i){case"dataChanged":const l=e[i],u=n[i];l&&Array.isArray(u)&&(n.dataChanged=Array.isArray(l)?u.concat(l):l,a=!0);default:n[i]||(n[i]=e[i],a=!0)}a&&Hr(YZ,this,i,e)}const r=!!(n.dataChanged||n.updateTriggersChanged||n.propsChanged||n.extensionsChanged);n.propsOrDataChanged=r,n.somethingChanged=r||n.viewportChanged||n.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,n){var i;const r=bZ(e,n);if(r.updateTriggersChanged)for(const a in r.updateTriggersChanged)r.updateTriggersChanged[a]&&this.invalidateAttribute(a);if(r.transitionsChanged)for(const a in r.transitionsChanged)this.internalState.uniformTransitions.add(a,n[a],e[a],(i=e.transitions)==null?void 0:i[a]);return this.setChangeFlags(r)}validateProps(){yZ(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){const n={highlightedObjectColor:e.picked?e.color:null},{highlightColor:r}=this.props;e.picked&&typeof r=="function"&&(n.highlightColor=r(e)),this.setShaderModuleProps({picking:n}),this.setNeedsRedraw()}_getAttributeManager(){const e=this.context;return new hZ(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,n){const{props:r,oldProps:i}=e,a=this.state.model;a!=null&&a.isInstanced&&a.setInstanceCount(this.getNumInstances());const{autoHighlight:l,highlightedObjectIndex:u,highlightColor:f}=r;if(n||i.autoHighlight!==l||i.highlightedObjectIndex!==u||i.highlightColor!==f){const h={};Array.isArray(f)&&(h.highlightColor=f),(n||i.autoHighlight!==l||u!==i.highlightedObjectIndex)&&(h.highlightedObjectColor=Number.isFinite(u)&&u>=0?this.encodePickingColor(u):null),this.setShaderModuleProps({picking:h})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let n=!1;n=n||this.internalState.needsRedraw&&this.id;const r=this.getAttributeManager(),i=r?r.getNeedsRedraw(e):!1;if(n=n||i,n)for(const a of this.props.extensions)a.onNeedsRedraw.call(this,a);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,n}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}Jf.defaultProps=tQ;Jf.layerName="Layer";const vA=`uniform scatterplotUniforms { + float radiusScale; + float radiusMinPixels; + float radiusMaxPixels; + float lineWidthScale; + float lineWidthMinPixels; + float lineWidthMaxPixels; + float stroked; + bool filled; + bool antialiasing; + bool billboard; + highp int radiusUnits; + highp int lineWidthUnits; +} scatterplot; +`,nQ={name:"scatterplot",vs:vA,fs:vA,uniformTypes:{radiusScale:"f32",radiusMinPixels:"f32",radiusMaxPixels:"f32",lineWidthScale:"f32",lineWidthMinPixels:"f32",lineWidthMaxPixels:"f32",stroked:"f32",filled:"f32",antialiasing:"f32",billboard:"f32",radiusUnits:"i32",lineWidthUnits:"i32"}},rQ=`#version 300 es +#define SHADER_NAME scatterplot-layer-vertex-shader +in vec3 positions; +in vec3 instancePositions; +in vec3 instancePositions64Low; +in float instanceRadius; +in float instanceLineWidths; +in vec4 instanceFillColors; +in vec4 instanceLineColors; +in vec3 instancePickingColors; +out vec4 vFillColor; +out vec4 vLineColor; +out vec2 unitPosition; +out float innerUnitRadius; +out float outerRadiusPixels; +void main(void) { +geometry.worldPosition = instancePositions; +outerRadiusPixels = clamp( +project_size_to_pixel(scatterplot.radiusScale * instanceRadius, scatterplot.radiusUnits), +scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels +); +float lineWidthPixels = clamp( +project_size_to_pixel(scatterplot.lineWidthScale * instanceLineWidths, scatterplot.lineWidthUnits), +scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels +); +outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0; +float edgePadding = scatterplot.antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0; +unitPosition = edgePadding * positions.xy; +geometry.uv = unitPosition; +geometry.pickingColor = instancePickingColors; +innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / outerRadiusPixels; +if (scatterplot.billboard) { +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +vec3 offset = edgePadding * positions * outerRadiusPixels; +DECKGL_FILTER_SIZE(offset, geometry); +gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); +} else { +vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels); +DECKGL_FILTER_SIZE(offset, geometry); +gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +} +vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity); +DECKGL_FILTER_COLOR(vFillColor, geometry); +vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity); +DECKGL_FILTER_COLOR(vLineColor, geometry); +} +`,iQ=`#version 300 es +#define SHADER_NAME scatterplot-layer-fragment-shader +precision highp float; +in vec4 vFillColor; +in vec4 vLineColor; +in vec2 unitPosition; +in float innerUnitRadius; +in float outerRadiusPixels; +out vec4 fragColor; +void main(void) { +geometry.uv = unitPosition; +float distToCenter = length(unitPosition) * outerRadiusPixels; +float inCircle = scatterplot.antialiasing ? +smoothedge(distToCenter, outerRadiusPixels) : +step(distToCenter, outerRadiusPixels); +if (inCircle == 0.0) { +discard; +} +if (scatterplot.stroked > 0.5) { +float isLine = scatterplot.antialiasing ? +smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) : +step(innerUnitRadius * outerRadiusPixels, distToCenter); +if (scatterplot.filled) { +fragColor = mix(vFillColor, vLineColor, isLine); +} else { +if (isLine == 0.0) { +discard; +} +fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine); +} +} else if (scatterplot.filled == false) { +discard; +} else { +fragColor = vFillColor; +} +fragColor.a *= inCircle; +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`,_A=[0,0,0,255],sQ={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:_A},getLineColor:{type:"accessor",value:_A},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class xg extends Jf{getShaders(){return super.getShaders({vs:rQ,fs:iQ,modules:[WM,QM,nQ]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){var n;super.updateState(e),e.changeFlags.extensionsChanged&&((n=this.state.model)==null||n.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){const{radiusUnits:n,radiusScale:r,radiusMinPixels:i,radiusMaxPixels:a,stroked:l,filled:u,billboard:f,antialiasing:h,lineWidthUnits:g,lineWidthScale:m,lineWidthMinPixels:v,lineWidthMaxPixels:S}=this.props,w={stroked:l,filled:u,billboard:f,antialiasing:h,radiusUnits:zo[n],radiusScale:r,radiusMinPixels:i,radiusMaxPixels:a,lineWidthUnits:zo[g],lineWidthScale:m,lineWidthMinPixels:v,lineWidthMaxPixels:S},E=this.state.model;E.shaderInputs.setProps({scatterplot:w}),E.draw(this.context.renderPass)}_getModel(){const e=[-1,-1,0,1,-1,0,-1,1,0,1,1,0];return new $o(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new _b({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}}xg.defaultProps=sQ;xg.layerName="ScatterplotLayer";const aQ={COUNTER_CLOCKWISE:-1};function oQ(t,e,n={}){return lQ(t,n)!==e?(uQ(t,n),!0):!1}function lQ(t,e={}){return Math.sign(cQ(t,e))}const yA={x:0,y:1,z:2};function cQ(t,e={}){const{start:n=0,end:r=t.length,plane:i="xy"}=e,a=e.size||2;let l=0;const u=yA[i[0]],f=yA[i[1]];for(let h=n,g=r-a;h=r),i=i.flatMap(S=>[S[0],S[1]]),oQ(i,aQ.COUNTER_CLOCKWISE));const a=n>0,l=r+1,u=a?l*3+1:r,f=Math.PI*2/r,h=new Uint16Array(a?r*3*2:0),g=new Float32Array(u*3),m=new Float32Array(u*3);let v=0;if(a){for(let S=0;S",extruded:"f32",stroked:"f32",isStroke:"f32",coverage:"f32",elevationScale:"f32",edgeDistance:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",radiusUnits:"i32",widthUnits:"i32"}},gQ=`#version 300 es +#define SHADER_NAME column-layer-vertex-shader +in vec3 positions; +in vec3 normals; +in vec3 instancePositions; +in float instanceElevations; +in vec3 instancePositions64Low; +in vec4 instanceFillColors; +in vec4 instanceLineColors; +in float instanceStrokeWidths; +in vec3 instancePickingColors; +out vec4 vColor; +#ifdef FLAT_SHADING +out vec3 cameraPosition; +out vec4 position_commonspace; +#endif +void main(void) { +geometry.worldPosition = instancePositions; +vec4 color = column.isStroke ? instanceLineColors : instanceFillColors; +mat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle)); +float elevation = 0.0; +float strokeOffsetRatio = 1.0; +if (column.extruded) { +elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale; +} else if (column.stroked) { +float widthPixels = clamp( +project_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits), +column.widthMinPixels, column.widthMaxPixels) / 2.0; +float halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius); +if (column.isStroke) { +strokeOffsetRatio -= sign(positions.z) * halfOffset; +} else { +strokeOffsetRatio -= halfOffset; +} +} +float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0); +float dotRadius = column.radius * column.coverage * shouldRender; +geometry.pickingColor = instancePickingColors; +vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation); +vec3 centroidPosition64Low = instancePositions64Low; +vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius; +if (column.radiusUnits == UNIT_METERS) { +offset = project_size(offset); +} +vec3 pos = vec3(offset, 0.); +DECKGL_FILTER_SIZE(pos, geometry); +gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position); +geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z)); +DECKGL_FILTER_GL_POSITION(gl_Position, geometry); +if (column.extruded && !column.isStroke) { +#ifdef FLAT_SHADING +cameraPosition = project.cameraPosition; +position_commonspace = geometry.position; +vColor = vec4(color.rgb, color.a * layer.opacity); +#else +vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); +vColor = vec4(lightColor, color.a * layer.opacity); +#endif +} else { +vColor = vec4(color.rgb, color.a * layer.opacity); +} +DECKGL_FILTER_COLOR(vColor, geometry); +} +`,pQ=`#version 300 es +#define SHADER_NAME column-layer-fragment-shader +precision highp float; +out vec4 fragColor; +in vec4 vColor; +#ifdef FLAT_SHADING +in vec3 cameraPosition; +in vec4 position_commonspace; +#endif +void main(void) { +fragColor = vColor; +geometry.uv = vec2(0.); +#ifdef FLAT_SHADING +if (column.extruded && !column.isStroke && !bool(picking.isActive)) { +vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); +fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal); +} +#endif +DECKGL_FILTER_COLOR(fragColor, geometry); +} +`,Mg=[0,0,0,255],mQ={diskResolution:{type:"number",min:4,value:20},vertices:null,radius:{type:"number",min:0,value:1e3},angle:{type:"number",value:0},offset:{type:"array",value:[0,0]},coverage:{type:"number",min:0,max:1,value:1},elevationScale:{type:"number",min:0,value:1},radiusUnits:"meters",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,flatShading:!1,getPosition:{type:"accessor",value:t=>t.position},getFillColor:{type:"accessor",value:Mg},getLineColor:{type:"accessor",value:Mg},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class Ab extends Jf{getShaders(){const e={},{flatShading:n}=this.props;return n&&(e.FLAT_SHADING=1),super.getShaders({vs:gQ,fs:pQ,defines:e,modules:[WM,n?IM:NM,QM,hQ]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:Mg},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:Mg},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(e){var u;super.updateState(e);const{props:n,oldProps:r,changeFlags:i}=e,a=i.extensionsChanged||n.flatShading!==r.flatShading;a&&((u=this.state.models)==null||u.forEach(f=>f.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());const l=this.getNumInstances();this.state.fillModel.setInstanceCount(l),this.state.wireframeModel.setInstanceCount(l),(a||n.diskResolution!==r.diskResolution||n.vertices!==r.vertices||(n.extruded||n.stroked)!==(r.extruded||r.stroked))&&this._updateGeometry(n)}getGeometry(e,n,r){const i=new fQ({radius:1,height:r?2:0,vertices:n,nradial:e});let a=0;if(n)for(let l=0;lUO(n,e));if(fp(t)){if(bQ(t))return e.style=yQ,_.cloneElement(t,e);if(SQ(t))return _.cloneElement(t,e)}return t}function fp(t){return t&&typeof t=="object"&&"type"in t||!1}function bQ(t){var e;return(e=t.props)==null?void 0:e.mapStyle}function SQ(t){const e=t.type;return e&&e.deckGLViewProps}function yy(t){if(typeof t=="function")return _.createElement(Dc,{},t);if(Array.isArray(t))return t.map(yy);if(fp(t)){if(t.type===_.Fragment)return yy(t.props.children);if(Og(t.type,Dc))return t}return t}function EQ({children:t,layers:e=[],views:n=null}){const r=[],i=[],a={};return _.Children.forEach(yy(t),l=>{if(fp(l)){const u=l.type;if(Og(u,Jf)){const f=wQ(u,l.props);i.push(f)}else r.push(l);if(Og(u,Dc)&&u!==Dc&&l.props.id){const f=new u(l.props);a[f.id]=f}}else l&&r.push(l)}),Object.keys(a).length>0&&(Array.isArray(n)?n.forEach(l=>{a[l.id]=l}):n&&(a[n.id]=n),n=Object.values(a)),e=i.length>0?[...i,...e]:e,{layers:e,children:r,views:n}}function wQ(t,e){const n={},r=t.defaultProps||{};for(const i in e)r[i]!==e[i]&&(n[i]=e[i]);return new t(n)}const TQ=_.createContext();function CQ({children:t,deck:e,ContextProvider:n=TQ.Provider}){const{viewManager:r}=e||{};if(!r||!r.views.length)return[];const i={},a=r.views[0].id;for(const l of t){let u=a,f=l;fp(l)&&Og(l.type,Dc)&&(u=l.props.id||a,f=l.props.children);const h=r.getViewport(u),g=r.getViewState(u);if(h){g.padding=h.padding;const{x:m,y:v,width:S,height:w}=h;f=UO(f,{x:m,y:v,width:S,height:w,viewport:h,viewState:g}),i[u]||(i[u]={viewport:h,children:[]}),i[u].children.push(f)}}return Object.keys(i).map(l=>{const{viewport:u,children:f}=i[l],{x:h,y:g,width:m,height:v}=u,S={position:"absolute",left:h,top:g,width:m,height:v},w=`view-${l}`,E=_.createElement("div",{key:w,id:w,style:S},...f),b={deck:e,viewport:u,container:e.canvas.offsetParent,eventManager:e.eventManager,onViewStateChange:T=>{T.viewId=l,e._onViewStateChange(T)},widgets:[]},C=`view-${l}-context`;return _.createElement(n,{key:C,value:b},E)})}const AQ={mixBlendMode:null};function RQ({width:t,height:e,style:n}){const r={position:"absolute",zIndex:0,left:0,top:0,width:t,height:e},i={left:0,top:0};if(n)for(const a in n)a in AQ?i[a]=n[a]:r[a]=n[a];return{containerStyle:r,canvasStyle:i}}function xQ(t){return{get deck(){return t.deck},pickObject:e=>t.deck.pickObject(e),pickMultipleObjects:e=>t.deck.pickMultipleObjects(e),pickObjects:e=>t.deck.pickObjects(e)}}function LO(t){t.redrawReason&&(t.deck._drawLayers(t.redrawReason),t.redrawReason=null)}function MQ(t,e,n){const r=new e({...n,_customRender:i=>{t.redrawReason=i;const a=r.getViewports();t.lastRenderedViewports!==a?t.forceUpdate():LO(t)}});return r}function OQ(t,e){const[n,r]=_.useState(0),a=_.useRef({control:null,version:n,forceUpdate:()=>r(x=>x+1)}).current,l=_.useRef(null),u=_.useRef(null),f=_.useMemo(()=>EQ(t),[t.layers,t.views,t.children]);let h=!0;const g=x=>{var N;return h&&t.viewState?(a.viewStateUpdateRequested=x,null):(a.viewStateUpdateRequested=null,(N=t.onViewStateChange)==null?void 0:N.call(t,x))},m=x=>{var N;h?a.interactionStateUpdateRequested=x:(a.interactionStateUpdateRequested=null,(N=t.onInteractionStateChange)==null||N.call(t,x))},v=_.useMemo(()=>{const x={widgets:[],...t,style:null,width:"100%",height:"100%",parent:l.current,canvas:u.current,layers:f.layers,views:f.views,onViewStateChange:g,onInteractionStateChange:m};return delete x._customRender,a.deck&&a.deck.setProps(x),x},[t]);_.useEffect(()=>{const x=t.Deck||Tb;return a.deck=MQ(a,x,{...v,parent:l.current,canvas:u.current}),()=>{var N;return(N=a.deck)==null?void 0:N.finalize()}},[]),_Q(()=>{LO(a);const{viewStateUpdateRequested:x,interactionStateUpdateRequested:N}=a;x&&g(x),N&&m(N)}),_.useImperativeHandle(e,()=>xQ(a),[]);const S=a.deck&&a.deck.isInitialized?a.deck.getViewports():void 0,{ContextProvider:w,width:E="100%",height:b="100%",id:C,style:T}=t,{containerStyle:A,canvasStyle:O}=_.useMemo(()=>RQ({width:E,height:b,style:T}),[E,b,T]);if(!a.viewStateUpdateRequested&&a.lastRenderedViewports===S||a.version!==n){a.lastRenderedViewports=S,a.version=n;const x=CQ({children:f.children,deck:a.deck,ContextProvider:w}),N=_.createElement("canvas",{key:"canvas",id:C||"deckgl-overlay",ref:u,style:O});a.control=_.createElement("div",{id:`${C||"deckgl"}-wrapper`,ref:l,style:A},[N,x])}return h=!1,a.control}const PQ=_.forwardRef(OQ),NQ=_.createContext(null);function IQ(t,e){const n=Array.isArray(t)?t[0]:t?t.x:0,r=Array.isArray(t)?t[1]:t?t.y:0,i=Array.isArray(e)?e[0]:e?e.x:0,a=Array.isArray(e)?e[1]:e?e.y:0;return n===i&&r===a}function ps(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n{let i=null;"interactive"in r&&(i=Object.assign({},r),delete i.interactive);const a=e[r.ref];if(a){i=i||Object.assign({},r),delete i.ref;for(const l of DQ)l in a&&(i[l]=a[l])}return i||r});return{...t,layers:n}}const TA={version:8,sources:{},layers:[]},CA={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},AA={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},RA={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},FQ=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],kQ=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class kc{constructor(e,n,r){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=i=>{const a=this.props[RA[i.type]];a?a(i):i.type==="error"&&console.error(i.error)},this._onCameraEvent=i=>{if(this._internalUpdate)return;i.viewState=this._propsedCameraUpdate||SA(this._map.transform);const a=this.props[AA[i.type]];a&&a(i)},this._onCameraUpdate=i=>this._internalUpdate?i:(this._propsedCameraUpdate=SA(i),EA(i,this.props)),this._onPointerEvent=i=>{(i.type==="mousemove"||i.type==="mouseout")&&this._updateHover(i);const a=this.props[CA[i.type]];a&&(this.props.interactiveLayerIds&&i.type!=="mouseover"&&i.type!=="mouseout"&&(i.features=this._hoveredFeatures||this._queryRenderedFeatures(i.point)),a(i),delete i.features)},this._MapClass=e,this.props=n,this._initialize(r)}get map(){return this._map}setProps(e){const n=this.props;this.props=e;const r=this._updateSettings(e,n),i=this._updateSize(e),a=this._updateViewState(e);this._updateStyle(e,n),this._updateStyleComponents(e),this._updateHandlers(e,n),(r||i||a&&!this._map.isMoving())&&this.redraw()}static reuse(e,n){const r=kc.savedMaps.pop();if(!r)return null;const i=r.map,a=i.getContainer();for(n.className=a.className;a.childNodes.length>0;)n.appendChild(a.childNodes[0]);i._container=n;const l=i._resizeObserver;l&&(l.disconnect(),l.observe(n)),r.setProps({...e,styleDiffing:!1}),i.resize();const{initialViewState:u}=e;return u&&(u.bounds?i.fitBounds(u.bounds,{...u.fitBoundsOptions,duration:0}):r._updateViewState(u)),i.isStyleLoaded()?i.fire("load"):i.once("style.load",()=>i.fire("load")),i._update(),r}_initialize(e){const{props:n}=this,{mapStyle:r=TA}=n,i={...n,...n.initialViewState,container:e,style:wA(r)},a=i.initialViewState||i.viewState||i;if(Object.assign(i,{center:[a.longitude||0,a.latitude||0],zoom:a.zoom||0,pitch:a.pitch||0,bearing:a.bearing||0}),n.gl){const u=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=u,n.gl)}const l=new this._MapClass(i);a.padding&&l.setPadding(a.padding),n.cursor&&(l.getCanvas().style.cursor=n.cursor),l.transformCameraUpdate=this._onCameraUpdate,l.on("style.load",()=>{var u;this._styleComponents={light:l.getLight(),sky:l.getSky(),projection:(u=l.getProjection)==null?void 0:u.call(l),terrain:l.getTerrain()},this._updateStyleComponents(this.props)}),l.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const u in CA)l.on(u,this._onPointerEvent);for(const u in AA)l.on(u,this._onCameraEvent);for(const u in RA)l.on(u,this._onEvent);this._map=l}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),kc.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const e=this._map;e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}_updateSize(e){const{viewState:n}=e;if(n){const r=this._map;if(n.width!==r.transform.width||n.height!==r.transform.height)return r.resize(),!0}return!1}_updateViewState(e){const n=this._map,r=n.transform;if(!n.isMoving()){const a=EA(r,e);if(Object.keys(a).length>0)return this._internalUpdate=!0,n.jumpTo(a),this._internalUpdate=!1,!0}return!1}_updateSettings(e,n){const r=this._map;let i=!1;for(const a of FQ)if(a in e&&!ps(e[a],n[a])){i=!0;const l=r[`set${a[0].toUpperCase()}${a.slice(1)}`];l==null||l.call(r,e[a])}return i}_updateStyle(e,n){if(e.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=e.cursor||""),e.mapStyle!==n.mapStyle){const{mapStyle:r=TA,styleDiffing:i=!0}=e,a={diff:i};"localIdeographFontFamily"in e&&(a.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(wA(r),a)}}_updateStyleComponents({light:e,projection:n,sky:r,terrain:i}){var u,f;const a=this._map,l=this._styleComponents;a.style._loaded&&(e&&!ps(e,l.light)&&(l.light=e,a.setLight(e)),n&&!ps(n,l.projection)&&n!==((u=l.projection)==null?void 0:u.type)&&(l.projection=typeof n=="string"?{type:n}:n,(f=a.setProjection)==null||f.call(a,l.projection)),r&&!ps(r,l.sky)&&(l.sky=r,a.setSky(r)),i!==void 0&&!ps(i,l.terrain)&&(!i||a.getSource(i.source))&&(l.terrain=i,a.setTerrain(i)))}_updateHandlers(e,n){const r=this._map;for(const i of kQ){const a=e[i]??!0,l=n[i]??!0;ps(a,l)||(a?r[i].enable(a):r[i].disable())}}_queryRenderedFeatures(e){const n=this._map,{interactiveLayerIds:r=[]}=this.props;try{return n.queryRenderedFeatures(e,{layers:r.filter(n.getLayer.bind(n))})}catch{return[]}}_updateHover(e){var i;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const a=e.type,l=((i=this._hoveredFeatures)==null?void 0:i.length)>0,u=this._queryRenderedFeatures(e.point),f=u.length>0;!f&&l&&(e.type="mouseleave",this._onPointerEvent(e)),this._hoveredFeatures=u,f&&!l&&(e.type="mouseenter",this._onPointerEvent(e)),e.type=a}else this._hoveredFeatures=null}}kc.savedMaps=[];const BQ=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function UQ(t){if(!t)return null;const e=t.map,n={getMap:()=>e};for(const r of LQ(e))!(r in n)&&!BQ.includes(r)&&(n[r]=e[r].bind(e));return n}function LQ(t){const e=new Set;let n=t;for(;n;){for(const r of Object.getOwnPropertyNames(n))r[0]!=="_"&&typeof t[r]=="function"&&r!=="fire"&&r!=="setEventedParent"&&e.add(r);n=Object.getPrototypeOf(n)}return Array.from(e)}const zQ=typeof document<"u"?_.useLayoutEffect:_.useEffect;function $Q(t,e){const{RTLTextPlugin:n,maxParallelImageRequests:r,workerCount:i,workerUrl:a}=e;if(n&&t.getRTLTextPluginStatus&&t.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:l,lazy:u=!0}=typeof n=="string"?{pluginUrl:n}:n;t.setRTLTextPlugin(l,f=>{f&&console.error(f)},u)}r!==void 0&&t.setMaxParallelImageRequests(r),i!==void 0&&t.setWorkerCount(i),a!==void 0&&t.setWorkerUrl(a)}const dp=_.createContext(null);function VQ(t,e){const n=_.useContext(NQ),[r,i]=_.useState(null),a=_.useRef(),{current:l}=_.useRef({mapLib:null,map:null});_.useEffect(()=>{const h=t.mapLib;let g=!0,m;return Promise.resolve(h||xI(()=>import("./maplibre-gl-CUnf5s77.js").then(v=>v.m),[])).then(v=>{if(!g)return;if(!v)throw new Error("Invalid mapLib");const S="Map"in v?v:v.default;if(!S.Map)throw new Error("Invalid mapLib");if($Q(S,t),!S.supported||S.supported(t))t.reuseMaps&&(m=kc.reuse(t,a.current)),m||(m=new kc(S.Map,t,a.current)),l.map=UQ(m),l.mapLib=S,i(m),n==null||n.onMapMount(l.map,t.id);else throw new Error("Map is not supported by this browser")}).catch(v=>{const{onError:S}=t;S?S({type:"error",target:null,originalEvent:null,error:v}):console.error(v)}),()=>{g=!1,m&&(n==null||n.onMapUnmount(t.id),t.reuseMaps?m.recycle():m.destroy())}},[]),zQ(()=>{r&&r.setProps(t)}),_.useImperativeHandle(e,()=>l.map,[r]);const u=_.useMemo(()=>({position:"relative",width:"100%",height:"100%",...t.style}),[t.style]),f={height:"100%"};return _.createElement("div",{id:t.id,ref:a,style:u},r&&_.createElement(dp.Provider,{value:l},_.createElement("div",{"mapboxgl-children":"",style:f},t.children)))}const HQ=_.forwardRef(VQ),jQ=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ys(t,e){if(!t||!e)return;const n=t.style;for(const r in e){const i=e[r];Number.isFinite(i)&&!jQ.test(r)?n[r]=`${i}px`:n[r]=i}}_.memo(_.forwardRef((t,e)=>{const{map:n,mapLib:r}=_.useContext(dp),i=_.useRef({props:t});i.current.props=t;const a=_.useMemo(()=>{let E=!1;_.Children.forEach(t.children,T=>{T&&(E=!0)});const b={...t,element:E?document.createElement("div"):null},C=new r.Marker(b);return C.setLngLat([t.longitude,t.latitude]),C.getElement().addEventListener("click",T=>{var A,O;(O=(A=i.current.props).onClick)==null||O.call(A,{type:"click",target:C,originalEvent:T})}),C.on("dragstart",T=>{var O,x;const A=T;A.lngLat=a.getLngLat(),(x=(O=i.current.props).onDragStart)==null||x.call(O,A)}),C.on("drag",T=>{var O,x;const A=T;A.lngLat=a.getLngLat(),(x=(O=i.current.props).onDrag)==null||x.call(O,A)}),C.on("dragend",T=>{var O,x;const A=T;A.lngLat=a.getLngLat(),(x=(O=i.current.props).onDragEnd)==null||x.call(O,A)}),C},[]);_.useEffect(()=>(a.addTo(n.getMap()),()=>{a.remove()}),[]);const{longitude:l,latitude:u,offset:f,style:h,draggable:g=!1,popup:m=null,rotation:v=0,rotationAlignment:S="auto",pitchAlignment:w="auto"}=t;return _.useEffect(()=>{Ys(a.getElement(),h)},[h]),_.useImperativeHandle(e,()=>a,[]),(a.getLngLat().lng!==l||a.getLngLat().lat!==u)&&a.setLngLat([l,u]),f&&!IQ(a.getOffset(),f)&&a.setOffset(f),a.isDraggable()!==g&&a.setDraggable(g),a.getRotation()!==v&&a.setRotation(v),a.getRotationAlignment()!==S&&a.setRotationAlignment(S),a.getPitchAlignment()!==w&&a.setPitchAlignment(w),a.getPopup()!==m&&a.setPopup(m),za.createPortal(t.children,a.getElement())}));function xA(t){return new Set(t?t.trim().split(/\s+/):[])}_.memo(_.forwardRef((t,e)=>{const{map:n,mapLib:r}=_.useContext(dp),i=_.useMemo(()=>document.createElement("div"),[]),a=_.useRef({props:t});a.current.props=t;const l=_.useMemo(()=>{const u={...t},f=new r.Popup(u);return f.setLngLat([t.longitude,t.latitude]),f.once("open",h=>{var g,m;(m=(g=a.current.props).onOpen)==null||m.call(g,h)}),f},[]);if(_.useEffect(()=>{const u=f=>{var h,g;(g=(h=a.current.props).onClose)==null||g.call(h,f)};return l.on("close",u),l.setDOMContent(i).addTo(n.getMap()),()=>{l.off("close",u),l.isOpen()&&l.remove()}},[]),_.useEffect(()=>{Ys(l.getElement(),t.style)},[t.style]),_.useImperativeHandle(e,()=>l,[]),l.isOpen()&&((l.getLngLat().lng!==t.longitude||l.getLngLat().lat!==t.latitude)&&l.setLngLat([t.longitude,t.latitude]),t.offset&&!ps(l.options.offset,t.offset)&&l.setOffset(t.offset),(l.options.anchor!==t.anchor||l.options.maxWidth!==t.maxWidth)&&(l.options.anchor=t.anchor,l.setMaxWidth(t.maxWidth)),l.options.className!==t.className)){const u=xA(l.options.className),f=xA(t.className);for(const h of u)f.has(h)||l.removeClassName(h);for(const h of f)u.has(h)||l.addClassName(h);l.options.className=t.className}return za.createPortal(t.children,i)}));function Qo(t,e,n,r){const i=_.useContext(dp),a=_.useMemo(()=>t(i),[]);return _.useEffect(()=>{const l=e,u=null,f=typeof e=="function"?e:null,{map:h}=i;return h.hasControl(a)||(h.addControl(a,l==null?void 0:l.position),u&&u(i)),()=>{f&&f(i),h.hasControl(a)&&h.removeControl(a)}},[]),a}function WQ(t){const e=Qo(({mapLib:n})=>new n.AttributionControl(t),{position:t.position});return _.useEffect(()=>{Ys(e._container,t.style)},[t.style]),null}_.memo(WQ);function XQ(t){const e=Qo(({mapLib:n})=>new n.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)}),{position:t.position});return _.useEffect(()=>{Ys(e._controlContainer,t.style)},[t.style]),null}_.memo(XQ);function qQ(t,e){const n=_.useRef({props:t}),r=Qo(({mapLib:i})=>{const a=new i.GeolocateControl(t),l=a._setupUI;return a._setupUI=()=>{a._container.hasChildNodes()||l()},a.on("geolocate",u=>{var f,h;(h=(f=n.current.props).onGeolocate)==null||h.call(f,u)}),a.on("error",u=>{var f,h;(h=(f=n.current.props).onError)==null||h.call(f,u)}),a.on("outofmaxbounds",u=>{var f,h;(h=(f=n.current.props).onOutOfMaxBounds)==null||h.call(f,u)}),a.on("trackuserlocationstart",u=>{var f,h;(h=(f=n.current.props).onTrackUserLocationStart)==null||h.call(f,u)}),a.on("trackuserlocationend",u=>{var f,h;(h=(f=n.current.props).onTrackUserLocationEnd)==null||h.call(f,u)}),a},{position:t.position});return n.current.props=t,_.useImperativeHandle(e,()=>r,[]),_.useEffect(()=>{Ys(r._container,t.style)},[t.style]),null}_.memo(_.forwardRef(qQ));function YQ(t){const e=Qo(({mapLib:n})=>new n.NavigationControl(t),{position:t.position});return _.useEffect(()=>{Ys(e._container,t.style)},[t.style]),null}_.memo(YQ);function KQ(t){const e=Qo(({mapLib:a})=>new a.ScaleControl(t),{position:t.position}),n=_.useRef(t),r=n.current;n.current=t;const{style:i}=t;return t.maxWidth!==void 0&&t.maxWidth!==r.maxWidth&&(e.options.maxWidth=t.maxWidth),t.unit!==void 0&&t.unit!==r.unit&&e.setUnit(t.unit),_.useEffect(()=>{Ys(e._container,i)},[i]),null}_.memo(KQ);function ZQ(t){const e=Qo(({mapLib:n})=>new n.TerrainControl(t),{position:t.position});return _.useEffect(()=>{Ys(e._container,t.style)},[t.style]),null}_.memo(ZQ);function QQ(t){const e=Qo(({mapLib:n})=>new n.LogoControl(t),{position:t.position});return _.useEffect(()=>{Ys(e._container,t.style)},[t.style]),null}_.memo(QQ);const MA=lb().domain([0,1e4]).range([BC(0),BC(1)]),GQ=lb().domain([0,12e3]).range([50,250]);function JQ(){const[t,e]=_.useState(0),[n,r]=_.useState("00:00:00"),[i,a]=_.useState("2023-12-01"),{isPending:l,error:u,data:f}=CI({queryKey:[i],queryFn:()=>jh(`./${i}.csv.gz`,Iy,{csv:{}})});u&&console.log(u);const h=[new xg({id:"deckgl-circle",data:[{position:[.45,51.47]}],getPosition:g=>g.position,getFillColor:[255,0,0,100],getRadius:1e3}),new Rb({id:"deckgl-grid",data:l?[]:f.data,getPosition:g=>[g.x,g.y],getFillColor:g=>MA(g[n]).slice(4,-1).split(", ").map(Number),cellSize:505,extruded:!1,updateTriggers:{getFillColor:[n]}}),new xg({id:"deckgl-circle2",getPosition:g=>[g.x,g.y],getFillColor:g=>MA(g[n]).slice(4,-1).split(", ").map(Number),getRadius:g=>GQ(g[n]),updateTriggers:{getFillColor:[n],getRadius:[n]}})];return Vr.jsxs(Vr.Fragment,{children:[Vr.jsx(PQ,{initialViewState:{longitude:37.028,latitude:55.778,zoom:7},controller:!0,layers:h,children:Vr.jsx(HQ,{mapStyle:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",hash:!0})}),Vr.jsxs(Dx,{style:{position:"absolute",zIndex:1,justifyContent:"center",padding:30},direction:"vertical",children:[Vr.jsx(Ux,{spinning:l}),Vr.jsx(Hc,{onChange:a,options:[{value:"2023-12-01"},{value:"2023-12-02"}],value:i}),Vr.jsx(j7,{value:t,min:0,max:47,onChange:g=>e(g),onChangeComplete:g=>{const m=Math.floor(g/2).toString().padStart(2,"0"),v=(g%2*30).toString().padStart(2,"0"),S=m+":"+v+":00";r(S)}}),Vr.jsx("p",{id:"time",children:n}),Vr.jsx("button",{onClick:()=>{e(t+1);const g=parseInt(t),m=Math.floor(g/2).toString().padStart(2,"0"),v=(g%2*30).toString().padStart(2,"0"),S=m+":"+v+":00";r(S)},children:"Плюс"})]})]})}const eG=new aI;FI.createRoot(document.getElementById("root")).render(Vr.jsx(_.StrictMode,{children:Vr.jsxs(dI,{client:eG,children:[Vr.jsx(JQ,{}),Vr.jsx(MI,{initialIsOpen:!1})]})}));export{by as g}; diff --git a/dist/assets/index-CWCiBtGb.css b/dist/assets/index-CWCiBtGb.css new file mode 100644 index 0000000..cddfd48 --- /dev/null +++ b/dist/assets/index-CWCiBtGb.css @@ -0,0 +1 @@ +.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}}.maplibregl-ctrl button:not(:disabled):active{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh} diff --git a/dist/assets/maplibre-gl-CUnf5s77.js b/dist/assets/maplibre-gl-CUnf5s77.js new file mode 100644 index 0000000..f0eb616 --- /dev/null +++ b/dist/assets/maplibre-gl-CUnf5s77.js @@ -0,0 +1,728 @@ +import{g as Yp}from"./index-9alGvXI7.js";function Jp(Da,Tc){for(var Rr=0;RrRi[Lr]})}}}return Object.freeze(Object.defineProperty(Da,Symbol.toStringTag,{value:"Module"}))}var wc={exports:{}};/** + * MapLibre GL JS + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.1.0/LICENSE.txt + */var Qp=wc.exports,fd;function ef(){return fd||(fd=1,function(Da,Tc){(function(Rr,Ri){Da.exports=Ri()})(Qp,function(){var Rr={},Ri={};function Lr(z,c,Pi){if(Ri[z]=Pi,z==="index"){var fr="var sharedModule = {}; ("+Ri.shared+")(sharedModule); ("+Ri.worker+")(sharedModule);",Mi={};return Ri.shared(Mi),Ri.index(Rr,Mi),typeof window<"u"&&Rr.setWorkerUrl(window.URL.createObjectURL(new Blob([fr],{type:"text/javascript"}))),Rr}}Lr("shared",["exports"],function(z){function c(n,t,r,s){return new(r||(r=Promise))(function(l,d){function p(x){try{g(s.next(x))}catch(b){d(b)}}function m(x){try{g(s.throw(x))}catch(b){d(b)}}function g(x){var b;x.done?l(x.value):(b=x.value,b instanceof r?b:new r(function(w){w(b)})).then(p,m)}g((s=s.apply(n,t||[])).next())})}function Pi(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fr,Mi;function mr(){if(Mi)return fr;function n(t,r){this.x=t,this.y=r}return Mi=1,fr=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,s=t.y-this.y;return r*r+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),s=Math.sin(t),l=s*this.x+r*this.y;return this.x=r*this.x-s*this.y,this.y=l,this},_rotateAround:function(t,r){var s=Math.cos(t),l=Math.sin(t),d=r.y+l*(this.x-r.x)+s*(this.y-r.y);return this.x=r.x+s*(this.x-r.x)-l*(this.y-r.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t},fr}typeof SuppressedError=="function"&&SuppressedError;var Ze,ue,Oe=Pi(mr()),Br=function(){if(ue)return Ze;function n(t,r,s,l){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(l-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=s,this.p2y=l}return ue=1,Ze=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,l=0;l<8;l++){var d=this.sampleCurveX(s)-t;if(Math.abs(d)d?m=s:g=s,s=.5*(g-m)+m;return s},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ze}(),_r=Pi(Br);let Fr,Or;function Xn(){return Fr==null&&(Fr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Fr}function oi(){if(Or==null&&(Or=!1,Xn())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let s=0;s<5*5;s++){const l=4*s;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(s%5,Math.floor(s/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let s=0;s<5*5*4;s++)if(s%4!=3&&r[s]!==s){Or=!0;break}}}return Or||!1}var gr,Mt=1e-6,ft=typeof Float32Array<"u"?Float32Array:Array;function Ct(){var n=new ft(9);return ft!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function Wn(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Rs(){var n=new ft(3);return ft!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function yr(n,t,r){var s=new ft(3);return s[0]=n,s[1]=t,s[2]=r,s}function Ji(n,t,r){var s=t[0],l=t[1],d=t[2],p=t[3];return n[0]=r[0]*s+r[4]*l+r[8]*d+r[12]*p,n[1]=r[1]*s+r[5]*l+r[9]*d+r[13]*p,n[2]=r[2]*s+r[6]*l+r[10]*d+r[14]*p,n[3]=r[3]*s+r[7]*l+r[11]*d+r[15]*p,n}function Si(){var n=new ft(4);return ft!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function ei(){var n=new ft(2);return ft!=Float32Array&&(n[0]=0,n[1]=0),n}function Kn(n,t){var r=new ft(2);return r[0]=n,r[1]=t,r}Math.hypot||(Math.hypot=function(){for(var n=0,t=arguments.length;t--;)n+=arguments[t]*arguments[t];return Math.sqrt(n)}),Rs(),gr=new ft(4),ft!=Float32Array&&(gr[0]=0,gr[1]=0,gr[2]=0,gr[3]=0),Rs(),yr(1,0,0),yr(0,1,0),Si(),Si(),Ct(),ei();const rt=8192;function yn(n,t,r){return t*(rt/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function xr(n,t){return(n%t+t)%t}function jr(n,t,r){return n*(1-r)+t*r}function Nr(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function xn(n,t,r,s){const l=new _r(n,t,r,s);return d=>l.solve(d)}const $i=xn(.25,.1,.25,1);function Li(n,t,r){return Math.min(r,Math.max(t,n))}function Ii(n,t,r){const s=r-t,l=((n-t)%s+s)%s+t;return l===t?r:l}function Wt(n,...t){for(const r of t)for(const s in r)n[s]=r[s];return n}let Vr=1;function Ur(n,t,r){const s={};for(const l in n)s[l]=t.call(this,n[l],l,n);return s}function Zr(n,t,r){const s={};for(const l in n)t.call(this,n[l],l,n)&&(s[l]=n[l]);return s}function fi(n){return Array.isArray(n)?n.map(fi):typeof n=="object"&&n?Ur(n,fi):n}const Yn={};function ti(n){Yn[n]||(typeof console<"u"&&console.warn(n),Yn[n]=!0)}function Ot(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function Qi(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let zt=null;function Gr(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const $r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Bi(n,t,r,s,l){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),g=new Uint8ClampedArray(s*l*4);if(yield d.copyTo(g,function(x,b,w,M,C){const E=4*Math.max(1,0),k=(Math.max(0,w)-w)*M*4+E,O=4*M,Z=Math.max(0,b),ee=Math.max(0,w);return{rect:{x:Z,y:ee,width:Math.min(x.width,b+M)-Z,height:Math.min(x.height,w+C)-ee},layout:[{offset:k,stride:O}]}}(n,t,r,s,l)),m)for(let x=0;xQi(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,tr=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const s=Jn(n.url);if(s)return s(n,t);if(Qi(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:Xr},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(Wr())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,l){return c(this,void 0,void 0,function*(){const d=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Wr(),signal:l.signal});let p,m;s.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(x){throw new er(0,x.message,s.url,new Blob)}if(!p.ok){const x=yield p.blob();throw new er(p.status,p.statusText,s.url,x)}m=s.type==="arrayBuffer"||s.type==="image"?p.arrayBuffer():s.type==="json"?p.json():p.text();const g=yield m;if(l.signal.aborted)throw Hr();return{data:g,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(n,t);if(Qi(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:Xr},t)}var r;return function(s,l){return new Promise((d,p)=>{var m;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const x in s.headers)g.setRequestHeader(x,s.headers[x]);s.type==="json"&&(g.responseType="text",!((m=s.headers)===null||m===void 0)&&m.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{p(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let x=g.response;if(s.type==="json")try{x=JSON.parse(g.response)}catch(b){return void p(b)}d({data:x,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const x=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});p(new er(g.status,g.statusText,s.url,x))}},l.signal.addEventListener("abort",()=>{g.abort(),p(Hr())}),g.send(s.body)})}(n,t)};function Kr(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Tr(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function vn(n,t,r){if(r&&r[n]){const s=r[n].indexOf(t);s!==-1&&r[n].splice(s,1)}}class bn{constructor(t,r={}){Wt(this,r),this.type=t}}class Qn extends bn{constructor(t,r={}){super("error",Wt({error:t},r))}}class Pr{on(t,r){return this._listeners=this._listeners||{},Tr(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return vn(t,r,this._listeners),vn(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Tr(t,r,this._oneTimeListeners),this):new Promise(s=>this.once(t,s))}fire(t,r){typeof t=="string"&&(t=new bn(t,r||{}));const s=t.type;if(this.listens(s)){t.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const m of l)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const m of d)vn(s,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Wt(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof Qn&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var j={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{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:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},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 D=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function L(n,t){const r={};for(const s in n)s!=="ref"&&(r[s]=n[s]);return D.forEach(s=>{s in t&&(r[s]=t[s])}),r}function B(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const es=[Ue,ge,Ce,De,qe,Je,Mr,Ve,_i(ze),jt,Rt,mt];function wn(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!wn(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of es)if(!wn(r,t))return null}}return`Expected ${_t(n)} but found ${_t(t)} instead.`}function La(n,t){return t.some(r=>r.kind===n.kind)}function Yr(n,t){return t.some(r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n)}function Jr(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const rl=.96422,Ba=.82521,nl=4/29,Tn=6/29,sl=3*Tn*Tn,Pc=Tn*Tn*Tn,Mc=Math.PI/180,Sc=180/Math.PI;function al(n){return(n%=360)<0&&(n+=360),n}function Fa([n,t,r,s]){let l,d;const p=Oa((.2225045*(n=Qr(n))+.7168786*(t=Qr(t))+.0606169*(r=Qr(r)))/1);n===t&&t===r?l=d=p:(l=Oa((.4360747*n+.3850649*t+.1430804*r)/rl),d=Oa((.0139322*n+.0971045*t+.7141733*r)/Ba));const m=116*p-16;return[m<0?0:m,500*(l-p),200*(p-d),s]}function Qr(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Oa(n){return n>Pc?Math.pow(n,1/3):n/sl+nl}function ol([n,t,r,s]){let l=(n+16)/116,d=isNaN(t)?l:l+t/500,p=isNaN(r)?l:l-r/200;return l=1*ja(l),d=rl*ja(d),p=Ba*ja(p),[en(3.1338561*d-1.6168667*l-.4906146*p),en(-.9787684*d+1.9161415*l+.033454*p),en(.0719453*d-.2289914*l+1.4052427*p),s]}function en(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function ja(n){return n>Tn?n*n*n:sl*(n-nl)}function Ls(n){return parseInt(n.padEnd(2,n),16)/255}function ll(n,t){return tn(t?n/100:n,0,1)}function tn(n,t,r){return Math.min(Math.max(t,n),r)}function Na(n){return!n.some(Number.isNaN)}const qi={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]};function He(n,t,r){return n+r*(t-n)}function Hi(n,t,r){return n.map((s,l)=>He(s,t[l],r))}class Xe{constructor(t,r,s,l=1,d=!0){this.r=t,this.g=r,this.b=s,this.a=l,d||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,s,l]))}static parse(t){if(t instanceof Xe)return t;if(typeof t!="string")return;const r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=qi[s];if(l){const[p,m,g]=l;return[p/255,m/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const p=s.length<6?1:2;let m=1;return[Ls(s.slice(m,m+=p)),Ls(s.slice(m,m+=p)),Ls(s.slice(m,m+=p)),Ls(s.slice(m,m+p)||"ff")]}if(s.startsWith("rgb")){const p=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,g,x,b,w,M,C,E,k,O,Z,ee]=p,q=[b||" ",C||" ",O].join("");if(q===" "||q===" /"||q===",,"||q===",,,"){const I=[x,M,k].join(""),F=I==="%%%"?100:I===""?255:0;if(F){const H=[tn(+g/F,0,1),tn(+w/F,0,1),tn(+E/F,0,1),Z?ll(+Z,ee):1];if(Na(H))return H}}return}}const d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,g,x,b,w,M,C,E]=d,k=[g||" ",b||" ",M].join("");if(k===" "||k===" /"||k===",,"||k===",,,"){const O=[+m,tn(+x,0,100),tn(+w,0,100),C?ll(+C,E):1];if(Na(O))return function([Z,ee,q,I]){function F(H){const ae=(H+Z/30)%12,xe=ee*Math.min(q,1-q);return q-xe*Math.max(-1,Math.min(ae-3,9-ae,1))}return Z=al(Z),ee/=100,q/=100,[F(0),F(8),F(4),I]}(O)}}}(t);return r?new Xe(...r,!1):void 0}get rgb(){const{r:t,g:r,b:s,a:l}=this,d=l||1/0;return this.overwriteGetter("rgb",[t/d,r/d,s/d,l])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,s,l,d]=Fa(t),p=Math.sqrt(s*s+l*l);return[Math.round(1e4*p)?al(Math.atan2(l,s)*Sc):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Fa(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,s,l]=this.rgb;return`rgba(${[t,r,s].map(d=>Math.round(255*d)).join(",")},${l})`}static interpolate(t,r,s,l="rgb"){switch(l){case"rgb":{const[d,p,m,g]=Hi(t.rgb,r.rgb,s);return new Xe(d,p,m,g,!1)}case"hcl":{const[d,p,m,g]=t.hcl,[x,b,w,M]=r.hcl;let C,E;if(isNaN(d)||isNaN(x))isNaN(d)?isNaN(x)?C=NaN:(C=x,m!==1&&m!==0||(E=b)):(C=d,w!==1&&w!==0||(E=p));else{let q=x-d;x>d&&q>180?q-=360:x180&&(q+=360),C=d+s*q}const[k,O,Z,ee]=function([q,I,F,H]){return q=isNaN(q)?0:q*Mc,ol([F,Math.cos(q)*I,Math.sin(q)*I,H])}([C,E??He(p,b,s),He(m,w,s),He(g,M,s)]);return new Xe(k,O,Z,ee,!1)}case"lab":{const[d,p,m,g]=ol(Hi(t.lab,r.lab,s));return new Xe(d,p,m,g,!1)}}}}Xe.black=new Xe(0,0,0,1),Xe.white=new Xe(1,1,1,1),Xe.transparent=new Xe(0,0,0,0),Xe.red=new Xe(1,0,0,1);class Bs{constructor(t,r,s){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const cl=["bottom","center","top"];class ts{constructor(t,r,s,l,d,p){this.text=t,this.image=r,this.scale=s,this.fontStack=l,this.textColor=d,this.verticalAlign=p}}class Et{constructor(t){this.sections=t}static fromString(t){return new Et([new ts(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Et?t:Et.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Nt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Nt)return t;if(typeof t=="number")return new Nt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Nt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,s){return new Nt(Hi(t.values,r.values,s))}}class wt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Va=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ii{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ii)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[n,t,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[n,t,r,s]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function rn(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof ni||n instanceof Xe||n instanceof Bs||n instanceof Et||n instanceof Nt||n instanceof ii||n instanceof ri)return!0;if(Array.isArray(n)){for(const t of n)if(!rn(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!rn(n[t]))return!1;return!0}return!1}function ut(n){if(n===null)return Ue;if(typeof n=="string")return Ce;if(typeof n=="boolean")return De;if(typeof n=="number")return ge;if(n instanceof Xe)return qe;if(n instanceof ni)return Je;if(n instanceof Bs)return St;if(n instanceof Et)return Mr;if(n instanceof Nt)return jt;if(n instanceof ii)return mt;if(n instanceof ri)return Rt;if(Array.isArray(n)){const t=n.length;let r;for(const s of n){const l=ut(s);if(r){if(r===l)continue;r=ze;break}r=l}return _i(r||ze,t)}return Ve}function is(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof Xe||n instanceof ni||n instanceof Et||n instanceof Nt||n instanceof ii||n instanceof ri?n.toString():JSON.stringify(n)}class Xi{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!rn(t[1]))return r.error("invalid value");const s=t[1];let l=ut(s);const d=r.expectedType;return l.kind!=="array"||l.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(l=d),new Xi(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const ir={string:Ce,number:ge,boolean:De,object:Ve};class Ci{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s,l=1;const d=t[0];if(d==="array"){let m,g;if(t.length>2){const x=t[1];if(typeof x!="string"||!(x in ir)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=ir[x],l++}else m=ze;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}s=_i(m,g)}else{if(!ir[d])throw new Error(`Types doesn't contain name = ${d}`);s=ir[d]}const p=[];for(;lt.outputDefined())}}const Za={"to-boolean":De,"to-color":qe,"to-number":ge,"to-string":Ce};class rr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const s=t[0];if(!Za[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&t.length!==2)return r.error("Expected one argument.");const l=Za[s],d=[];for(let p=1;p4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Ua(r[0],r[1],r[2],r[3]),!s))return new Xe(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new wt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const s of this.args){r=s.evaluate(t);const l=Nt.parse(r);if(l)return l}throw new wt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const s of this.args){r=s.evaluate(t);const l=ii.parse(r);if(l)return l}throw new wt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const s of this.args){if(r=s.evaluate(t),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new wt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Et.fromString(is(this.args[0].evaluate(t)));case"resolvedImage":return ri.fromString(is(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return is(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Fs=["Unknown","Point","LineString","Polygon"];class dt{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"?Fs[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=Xe.parse(t)),r}}class Pn{constructor(t,r,s=[],l,d=new je,p=[]){this.registry=t,this.path=s,this.key=s.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=l,this._isConstant=r}parse(t,r,s,l,d={}){return r?this.concat(r,s,l)._parse(t,d):this._parse(t,d)}_parse(t,r){function s(l,d,p){return p==="assert"?new Ci(d,[l]):p==="coerce"?new rr(d,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[l];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,g=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="projectionDefinition"||g.kind!=="string"&&g.kind!=="array")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(m.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else p=s(p,m,r.typeAnnotation||"coerce");else p=s(p,m,r.typeAnnotation||"coerce");else p=s(p,m,r.typeAnnotation||"coerce");else p=s(p,m,r.typeAnnotation||"coerce");else p=s(p,m,r.typeAnnotation||"assert")}if(!(p instanceof Xi)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new dt;try{p=new Xi(p.type,p.evaluate(m))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,s){const l=typeof t=="number"?this.path.concat(t):this.path,d=s?this.scope.concat(s):this.scope;return new Pn(this.registry,this._isConstant,l,r||null,d,this.errors)}error(t,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Me(s,t))}checkSubtype(t,r){const s=wn(t,r);return s&&this.error(s),s}}class Ye{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const s=[];for(let d=1;d=s.length)throw new wt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new wt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Qe{constructor(t,r){this.type=De,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,ze),l=r.parse(t[2],2,ze);return s&&l?La(s.type,[De,Ce,ge,Ue,ze])?new Qe(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(s.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!Yr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${_t(ut(r))} instead.`);if(!Yr(s,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${_t(ut(s))} instead.`);return s.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Mn{constructor(t,r,s){this.type=ge,this.needle=t,this.haystack=r,this.fromIndex=s}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,ze),l=r.parse(t[2],2,ze);if(!s||!l)return null;if(!La(s.type,[De,Ce,ge,Ue,ze]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(s.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,ge);return d?new Mn(s,l,d):null}return new Mn(s,l)}evaluate(t){const r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!Yr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${_t(ut(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),Yr(s,["string"])){const d=s.indexOf(r,l);return d===-1?-1:[...s.slice(0,d)].length}if(Yr(s,["array"]))return s.indexOf(r,l);throw new wt(`Expected second argument to be of type array or string, but found ${_t(ut(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Fi{constructor(t,r,s,l,d,p){this.inputType=t,this.type=r,this.input=s,this.cases=l,this.outputs=d,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const d={},p=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return M.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof E=="number"&&Math.floor(E)!==E)return M.error("Numeric branch labels must be integer values.");if(s){if(M.checkSubtype(s,ut(E)))return null}else s=ut(E);if(d[String(E)]!==void 0)return M.error("Branch labels must be unique.");d[String(E)]=p.length}const C=r.parse(w,x,l);if(!C)return null;l=l||C.type,p.push(C)}const m=r.parse(t[1],1,ze);if(!m)return null;const g=r.parse(t[t.length-1],t.length-1,l);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(s,m.type)?null:new Fi(s,l,m,d,p,g):null}evaluate(t){const r=this.input.evaluate(t);return(ut(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class ns{constructor(t,r,s){this.type=t,this.branches=r,this.otherwise=s}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let p=1;pr.outputDefined())&&this.otherwise.outputDefined()}}class ss{constructor(t,r,s,l){this.type=t,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const s=r.parse(t[1],1,ze),l=r.parse(t[2],2,ge);if(!s||!l)return null;if(!La(s.type,[_i(ze),Ce,ze]))return r.error(`Expected first argument to be of type array or string, but found ${_t(s.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,ge);return d?new ss(s.type,s,l,d):null}return new ss(s.type,s,l)}evaluate(t){const r=this.input.evaluate(t),s=this.beginIndex.evaluate(t);let l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),Yr(r,["string"]))return[...r].slice(s,l).join("");if(Yr(r,["array"]))return r.slice(s,l);throw new wt(`Expected first argument to be of type array or string, but found ${_t(ut(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function as(n,t){const r=n.length-1;let s,l,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),s=n[m],l=n[m+1],s<=t){if(m===r||tt))throw new wt("Input is not a number.");p=m-1}return 0}class nn{constructor(t,r,s){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[l,d]of s)this.labels.push(l),this.outputs.push(d)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(t[1],1,ge);if(!s)return null;const l=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const w=r.parse(g,b,d);if(!w)return null;d=d||w.type,l.push([m,w])}return new nn(d,s,l)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);const d=r.length;return l>=r[d-1]?s[d-1].evaluate(t):s[as(r,l)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function hl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ga,$a,ul=function(){if($a)return Ga;function n(t,r,s,l){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(l-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=s,this.p2y=l}return $a=1,Ga=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,l=0;l<8;l++){var d=this.sampleCurveX(s)-t;if(Math.abs(d)d?m=s:g=s,s=.5*(g-m)+m;return s},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ga}(),os=hl(ul);class ct{constructor(t,r,s,l,d){this.type=t,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,r,s,l){let d=0;if(t.name==="exponential")d=Sn(r,t.base,s,l);else if(t.name==="linear")d=Sn(r,1,s,l);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new os(p[0],p[1],p[2],p[3]).solve(Sn(r,1,s,l))}return d}static parse(t,r){let[s,l,d,...p]=t;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const x=l[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:x}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const x=l.slice(1);if(x.length!==4||x.some(b=>typeof b!="number"||b<0||b>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,ge),!d)return null;const m=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=qe:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',M);const E=r.parse(w,C,g);if(!E)return null;g=g||E.type,m.push([b,E])}return Jr(g,ge)||Jr(g,Je)||Jr(g,qe)||Jr(g,jt)||Jr(g,mt)||Jr(g,_i(ge))?new ct(g,s,l,d,m):r.error(`Type ${_t(g)} is not interpolatable.`)}evaluate(t){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);const l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);const d=r.length;if(l>=r[d-1])return s[d-1].evaluate(t);const p=as(r,l),m=ct.interpolationFactor(this.interpolation,l,r[p],r[p+1]),g=s[p].evaluate(t),x=s[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return He(g,x,m);case"color":return Xe.interpolate(g,x,m);case"padding":return Nt.interpolate(g,x,m);case"variableAnchorOffsetCollection":return ii.interpolate(g,x,m);case"array":return Hi(g,x,m);case"projectionDefinition":return ni.interpolate(g,x,m)}case"interpolate-hcl":return Xe.interpolate(g,x,m,"hcl");case"interpolate-lab":return Xe.interpolate(g,x,m,"lab")}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Sn(n,t,r,s){const l=s-r,d=n-r;return l===0?0:t===1?d/l:(Math.pow(t,d)-1)/(Math.pow(t,l)-1)}const Oi={color:Xe.interpolate,number:He,padding:Nt.interpolate,variableAnchorOffsetCollection:ii.interpolate,array:Hi};class sn{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const d=[];for(const m of t.slice(1)){const g=r.parse(m,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,d.push(g)}if(!s)throw new Error("No output type");const p=l&&d.some(m=>wn(l,m.type));return new sn(p?ze:s,d)}evaluate(t){let r,s=null,l=0;for(const d of this.args)if(l++,s=d.evaluate(t),s&&s instanceof ri&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Vt(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function qa(n,t,r,s){return s.compare(t,r)===0}function Sr(n,t,r){const s=n!=="=="&&n!=="!=";return class md{constructor(d,p,m){this.type=De,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let g=p.parse(d[1],1,ze);if(!g)return null;if(!Vt(m,g.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${_t(g.type)}'.`);let x=p.parse(d[2],2,ze);if(!x)return null;if(!Vt(m,x.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${_t(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${_t(g.type)}' and '${_t(x.type)}'.`);s&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Ci(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ci(g.type,[x])));let b=null;if(d.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(b=p.parse(d[3],3,St),!b)return null}return new md(g,x,b)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){const g=ut(p),x=ut(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new wt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=ut(p),x=ut(m);if(g.kind!=="string"||x.kind!=="string")return t(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):t(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const dl=Sr("==",function(n,t,r){return t===r},qa),Ic=Sr("!=",function(n,t,r){return t!==r},function(n,t,r,s){return!qa(0,t,r,s)}),Os=Sr("<",function(n,t,r){return t",function(n,t,r){return t>r},function(n,t,r,s){return s.compare(t,r)>0}),Cc=Sr("<=",function(n,t,r){return t<=r},function(n,t,r,s){return s.compare(t,r)<=0}),js=Sr(">=",function(n,t,r){return t>=r},function(n,t,r,s){return s.compare(t,r)>=0});class an{constructor(t,r,s){this.type=St,this.locale=s,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const s=t[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,De);if(!l)return null;const d=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,De);if(!d)return null;let p=null;return s.locale&&(p=r.parse(s.locale,1,Ce),!p)?null:new an(l,d,p)}evaluate(t){return new Bs(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class gi{constructor(t,r,s,l,d){this.type=Ce,this.number=t,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=d}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const s=r.parse(t[1],1,ge);if(!s)return null;const l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let d=null;if(l.locale&&(d=r.parse(l.locale,1,Ce),!d))return null;let p=null;if(l.currency&&(p=r.parse(l.currency,1,Ce),!p))return null;let m=null;if(l["min-fraction-digits"]&&(m=r.parse(l["min-fraction-digits"],1,ge),!m))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,ge),!g)?null:new gi(s,d,p,m,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class ls{constructor(t){this.type=Mr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const s=t[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let d=!1;for(let p=1;p<=t.length-1;++p){const m=t[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,ge),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,_i(Ce)),!x))return null;let b=null;if(m["text-color"]&&(b=r.parse(m["text-color"],1,qe),!b))return null;let w=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!cl.includes(m["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(w=r.parse(m["vertical-align"],1,Ce),!w)return null}const M=l[l.length-1];M.scale=g,M.font=x,M.textColor=b,M.verticalAlign=w}else{const g=r.parse(t[p],1,ze);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,l.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new ls(l)}evaluate(t){return new Et(this.sections.map(r=>{const s=r.content.evaluate(t);return ut(s)===Rt?new ts("",s,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new ts(is(s),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class In{constructor(t){this.type=Rt,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const s=r.parse(t[1],1,Ce);return s?new In(s):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),s=ri.fromString(r);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(r)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class Xa{constructor(t){this.type=ge,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=r.parse(t[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${_t(s.type)} instead.`):new Xa(s):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new wt(`Expected value to be of type string or array, but found ${_t(ut(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Ei=8192;function Ec(n,t){const r=(180+n[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*Ei),Math.round(s*l*Ei)]}function Wa(n,t){const r=Math.pow(2,t.z);return[(l=(n[0]/Ei+t.x)/r,360*l-180),(s=(n[1]/Ei+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function cs(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function hs(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function Ns(n,t,r){const s=n[0]-t[0],l=n[1]-t[1],d=n[0]-r[0],p=n[1]-r[1];return s*p-d*l==0&&s*d<=0&&l*p<=0}function Vs(n,t,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(d=[t[0]-n[0],t[1]-n[1]])[1]-l[1]*d[0]!=0&&!(!fl(n,t,r,s)||!fl(r,s,n,t));var l,d}function pl(n,t,r){for(const s of r)for(let l=0;l(l=n)[1]!=(p=m[g+1])[1]>l[1]&&l[0]<(p[0]-d[0])*(l[1]-d[1])/(p[1]-d[1])+d[0]&&(s=!s)}var l,d,p;return s}function Ac(n,t){for(const r of t)if(on(n,r))return!0;return!1}function Ka(n,t){for(const r of n)if(!on(r,t))return!1;for(let r=0;r0&&m<0||p<0&&m>0}function Ya(n,t,r){const s=[];for(let l=0;lr[2]){const l=.5*s;let d=n[0]-r[0]>l?-s:r[0]-n[0]>l?s:0;d===0&&(d=n[0]-r[2]>l?-s:r[2]-n[0]>l?s:0),n[0]+=d}cs(t,n)}function Ja(n,t,r,s){const l=Math.pow(2,s.z)*Ei,d=[s.x*Ei,s.y*Ei],p=[];for(const m of n)for(const g of m){const x=[g.x+d[0],g.y+d[1]];_l(x,t,r,l),p.push(x)}return p}function Qa(n,t,r,s){const l=Math.pow(2,s.z)*Ei,d=[s.x*Ei,s.y*Ei],p=[];for(const g of n){const x=[];for(const b of g){const w=[b.x+d[0],b.y+d[1]];cs(t,w),x.push(w)}p.push(x)}if(t[2]-t[0]<=l/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of p)for(const x of g)_l(x,t,r,l)}var m;return p}class Ir{constructor(t,r){this.type=De,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(rn(t[1])){const s=t[1];if(s.type==="FeatureCollection"){const l=[];for(const d of s.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&l.push(m),p==="MultiPolygon"&&l.push(...m)}if(l.length)return new Ir(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){const l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Ir(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Ir(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const m=Ya(s.coordinates,d,p),g=Ja(r.geometry(),l,d,p);if(!hs(l,d))return!1;for(const x of g)if(!on(x,m))return!1}if(s.type==="MultiPolygon"){const m=ml(s.coordinates,d,p),g=Ja(r.geometry(),l,d,p);if(!hs(l,d))return!1;for(const x of g)if(!Ac(x,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(s.type==="Polygon"){const m=Ya(s.coordinates,d,p),g=Qa(r.geometry(),l,d,p);if(!hs(l,d))return!1;for(const x of g)if(!Ka(x,m))return!1}if(s.type==="MultiPolygon"){const m=ml(s.coordinates,d,p),g=Qa(r.geometry(),l,d,p);if(!hs(l,d))return!1;for(const x of g)if(!zc(x,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let gl=class{constructor(n=[],t=(r,s)=>rs?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,s=t[n];for(;n>0;){const l=n-1>>1,d=t[l];if(r(s,d)>=0)break;t[n]=d,n=l}t[n]=s}_down(n){const{data:t,compare:r}=this,s=this.length>>1,l=t[n];for(;n=0)break;t[n]=t[d],n=d}t[n]=l}};function yl(n,t,r=0,s=n.length-1,l=eo){for(;s>r;){if(s-r>600){const g=s-r+1,x=t-r+1,b=Math.log(g),w=.5*Math.exp(2*b/3),M=.5*Math.sqrt(b*w*(g-w)/g)*(x-g/2<0?-1:1);yl(n,t,Math.max(r,Math.floor(t-x*w/g+M)),Math.min(s,Math.floor(t+(g-x)*w/g+M)),l)}const d=n[t];let p=r,m=s;for(us(n,r,t),l(n[s],d)>0&&us(n,r,s);p0;)m--}l(n[r],d)===0?us(n,r,m):(m++,us(n,m,s)),m<=t&&(r=m+1),t<=m&&(s=m-1)}}function us(n,t,r){const s=n[t];n[t]=n[r],n[r]=s}function eo(n,t){return nt?1:0}function Us(n,t){if(n.length<=1)return[n];const r=[];let s,l;for(const d of n){const p=Dc(d);p!==0&&(d.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(s&&r.push(s),s=[d]):s.push(d))}if(s&&r.push(s),t>1)for(let d=0;d1?(x=t[g+1][0],b=t[g+1][1]):C>0&&(x+=w/this.kx*C,b+=M/this.ky*C)),w=this.wrap(r[0]-x)*this.kx,M=(r[1]-b)*this.ky;const E=w*w+M*M;E180;)t-=360;return t}}function no(n,t){return t[0]-n[0]}function ds(n){return n[1]-n[0]+1}function nr(n,t){return n[1]>=n[0]&&n[1]n[1])return[null,null];const r=ds(n);if(t){if(r===2)return[n,null];const l=Math.floor(r/2);return[[n[0],n[0]+l],[n[0]+l,n[1]]]}if(r===1)return[n,null];const s=Math.floor(r/2)-1;return[[n[0],n[0]+s],[n[0]+s+1,n[1]]]}function ao(n,t){if(!nr(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let s=t[0];s<=t[1];++s)cs(r,n[s]);return r}function Zs(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const s of r)cs(t,s);return t}function vl(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function oo(n,t,r){if(!vl(n)||!vl(t))return NaN;let s=0,l=0;return n[2]t[2]&&(s=n[0]-t[2]),n[1]>t[3]&&(l=n[1]-t[3]),n[3]=s)return s;if(hs(l,d)){if(bl(n,t))return 0}else if(bl(t,n))return 0;let p=1/0;for(const m of n)for(let g=0,x=m.length,b=x-1;g0;){const g=p.pop();if(g[0]>=d)continue;const x=g[1],b=t?50:100;if(ds(x)<=b){if(!nr(x,n.length))return NaN;if(t){const w=Bc(n,x,r,s);if(isNaN(w)||w===0)return w;d=Math.min(d,w)}else for(let w=x[0];w<=x[1];++w){const M=Lc(n[w],r,s);if(d=Math.min(d,M),d===0)return 0}}else{const w=so(x,t);wl(p,d,s,n,m,w[0]),wl(p,d,s,n,m,w[1])}}return d}function qs(n,t,r,s,l,d=1/0){let p=Math.min(d,l.distance(n[0],r[0]));if(p===0)return p;const m=new gl([[0,[0,n.length-1],[0,r.length-1]]],no);for(;m.length>0;){const g=m.pop();if(g[0]>=p)continue;const x=g[1],b=g[2],w=t?50:100,M=s?50:100;if(ds(x)<=w&&ds(b)<=M){if(!nr(x,n.length)&&nr(b,r.length))return NaN;let C;if(t&&s)C=it(n,x,r,b,l),p=Math.min(p,C);else if(t&&!s){const E=n.slice(x[0],x[1]+1);for(let k=b[0];k<=b[1];++k)if(C=ln(r[k],E,l),p=Math.min(p,C),p===0)return p}else if(!t&&s){const E=r.slice(b[0],b[1]+1);for(let k=x[0];k<=x[1];++k)if(C=ln(n[k],E,l),p=Math.min(p,C),p===0)return p}else C=Rc(n,x,r,b,l),p=Math.min(p,C)}else{const C=so(x,t),E=so(b,s);Gs(m,p,l,n,r,C[0],E[0]),Gs(m,p,l,n,r,C[0],E[1]),Gs(m,p,l,n,r,C[1],E[0]),Gs(m,p,l,n,r,C[1],E[1])}}return p}function co(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class cn{constructor(t,r){this.type=ge,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(rn(t[1])){const s=t[1];if(s.type==="FeatureCollection")return new cn(s,s.features.map(l=>co(l.geometry)).flat());if(s.type==="Feature")return new cn(s,co(s.geometry));if("type"in s&&"coordinates"in s)return new cn(s,co(s))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>Wa([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new ro(d[0][1]);let m=1/0;for(const g of s){switch(g.type){case"Point":m=Math.min(m,qs(d,!1,[g.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,qs(d,!1,g.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,$s(d,!1,g.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){const l=r.geometry(),d=l.flat().map(g=>Wa([g.x,g.y],r.canonical));if(l.length===0)return NaN;const p=new ro(d[0][1]);let m=1/0;for(const g of s){switch(g.type){case"Point":m=Math.min(m,qs(d,!0,[g.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,qs(d,!0,g.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,$s(d,!0,g.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,s){const l=r.geometry();if(l.length===0||l[0].length===0)return NaN;const d=Us(l,0).map(g=>g.map(x=>x.map(b=>Wa([b.x,b.y],r.canonical)))),p=new ro(d[0][0][0][1]);let m=1/0;for(const g of s)for(const x of d){switch(g.type){case"Point":m=Math.min(m,$s([g.coordinates],!1,x,p,m));break;case"LineString":m=Math.min(m,$s(g.coordinates,!0,x,p,m));break;case"Polygon":m=Math.min(m,Fc(x,g.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Cn={"==":dl,"!=":Ic,">":Ha,"<":Os,">=":js,"<=":Cc,array:Ci,at:rs,boolean:Ci,case:ns,coalesce:sn,collator:an,format:ls,image:In,in:Qe,"index-of":Mn,interpolate:ct,"interpolate-hcl":ct,"interpolate-lab":ct,length:Xa,let:Ye,literal:Xi,match:Fi,number:Ci,"number-format":gi,object:Ci,slice:ss,step:nn,string:Ci,"to-boolean":rr,"to-color":rr,"to-number":rr,"to-string":rr,var:Ge,within:Ir,distance:cn};class Ai{constructor(t,r,s,l){this.name=t,this.type=r,this._evaluate=s,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const s=t[0],l=Ai.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,m=p.filter(([x])=>!Array.isArray(x)||x.length===t.length-1);let g=null;for(const[x,b]of m){g=new Pn(r.registry,Hs,r.path,null,r.scope);const w=[];let M=!1;for(let C=1;C{return M=w,Array.isArray(M)?`(${M.map(_t).join(", ")})`:`(${_t(M.type)}...)`;var M}).join(" | "),b=[];for(let w=1;w{r=t?r&&Hs(s):r&&s instanceof Xi}),!!r&&Xs(n)&&Ws(n,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Xs(n){if(n instanceof Ai&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof Ir||n instanceof cn)return!1;let t=!0;return n.eachChild(r=>{t&&!Xs(r)&&(t=!1)}),t}function ps(n){if(n instanceof Ai&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(r=>{t&&!ps(r)&&(t=!1)}),t}function Ws(n,t){if(n instanceof Ai&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild(s=>{r&&!Ws(s,t)&&(r=!1)}),r}function Ml(n){return{result:"success",value:n}}function En(n){return{result:"error",value:n}}function An(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function Sl(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function uo(n){return!!n.expression&&n.expression.interpolated}function tt(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function Ks(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Oc(n){return n}function Il(n,t){const r=t.type==="color",s=n.stops&&typeof n.stops[0][0]=="object",l=s||!(s||n.property!==void 0),d=n.type||(uo(t)?"exponential":"interval");if(r||t.type==="padding"){const b=r?Xe.parse:Nt.parse;(n=Ie({},n)).stops&&(n.stops=n.stops.map(w=>[w[0],b(w[1])])),n.default=b(n.default?n.default:t.default)}if(n.colorSpace&&(p=n.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var p;let m,g,x;if(d==="exponential")m=Cl;else if(d==="interval")m=jc;else if(d==="categorical"){m=po,g=Object.create(null);for(const b of n.stops)g[b[0]]=b[1];x=typeof n.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);m=Nc}if(s){const b={},w=[];for(let E=0;EE[0]),evaluate:({zoom:E},k)=>Cl({stops:M,base:n.base},t,E).evaluate(E,k)}}if(l){const b=d==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:ct.interpolationFactor.bind(void 0,b),zoomStops:n.stops.map(w=>w[0]),evaluate:({zoom:w})=>m(n,t,w,g,x)}}return{kind:"source",evaluate(b,w){const M=w&&w.properties?w.properties[n.property]:void 0;return M===void 0?fs(n.default,t.default):m(n,t,M,g,x)}}}function fs(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function po(n,t,r,s,l){return fs(typeof r===l?s[r]:void 0,n.default,t.default)}function jc(n,t,r){if(tt(r)!=="number")return fs(n.default,t.default);const s=n.stops.length;if(s===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[s-1][0])return n.stops[s-1][1];const l=as(n.stops.map(d=>d[0]),r);return n.stops[l][1]}function Cl(n,t,r){const s=n.base!==void 0?n.base:1;if(tt(r)!=="number")return fs(n.default,t.default);const l=n.stops.length;if(l===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[l-1][0])return n.stops[l-1][1];const d=as(n.stops.map(b=>b[0]),r),p=function(b,w,M,C){const E=C-M,k=b-M;return E===0?0:w===1?k/E:(Math.pow(w,k)-1)/(Math.pow(w,E)-1)}(r,s,n.stops[d][0],n.stops[d+1][0]),m=n.stops[d][1],g=n.stops[d+1][1],x=Oi[t.type]||Oc;return typeof m.evaluate=="function"?{evaluate(...b){const w=m.evaluate.apply(void 0,b),M=g.evaluate.apply(void 0,b);if(w!==void 0&&M!==void 0)return x(w,M,p,n.colorSpace)}}:x(m,g,p,n.colorSpace)}function Nc(n,t,r){switch(t.type){case"color":r=Xe.parse(r);break;case"formatted":r=Et.fromString(r.toString());break;case"resolvedImage":r=ri.fromString(r.toString());break;case"padding":r=Nt.parse(r);break;default:tt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return fs(r,n.default,t.default)}Ai.register(Cn,{error:[{kind:"error"},[Ce],(n,[t])=>{throw new wt(t.evaluate(n))}],typeof:[Ce,[ze],(n,[t])=>_t(ut(t.evaluate(n)))],"to-rgba":[_i(ge,4),[qe],(n,[t])=>{const[r,s,l,d]=t.evaluate(n).rgb;return[255*r,255*s,255*l,d]}],rgb:[qe,[ge,ge,ge],Tl],rgba:[qe,[ge,ge,ge,ge],Tl],has:{type:De,overloads:[[[Ce],(n,[t])=>Pl(t.evaluate(n),n.properties())],[[Ce,Ve],(n,[t,r])=>Pl(t.evaluate(n),r.evaluate(n))]]},get:{type:ze,overloads:[[[Ce],(n,[t])=>ho(t.evaluate(n),n.properties())],[[Ce,Ve],(n,[t,r])=>ho(t.evaluate(n),r.evaluate(n))]]},"feature-state":[ze,[Ce],(n,[t])=>ho(t.evaluate(n),n.featureState||{})],properties:[Ve,[],n=>n.properties()],"geometry-type":[Ce,[],n=>n.geometryType()],id:[ze,[],n=>n.id()],zoom:[ge,[],n=>n.globals.zoom],"heatmap-density":[ge,[],n=>n.globals.heatmapDensity||0],"line-progress":[ge,[],n=>n.globals.lineProgress||0],accumulated:[ze,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[ge,hn(ge),(n,t)=>{let r=0;for(const s of t)r+=s.evaluate(n);return r}],"*":[ge,hn(ge),(n,t)=>{let r=1;for(const s of t)r*=s.evaluate(n);return r}],"-":{type:ge,overloads:[[[ge,ge],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[ge],(n,[t])=>-t.evaluate(n)]]},"/":[ge,[ge,ge],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[ge,[ge,ge],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[ge,[],()=>Math.LN2],pi:[ge,[],()=>Math.PI],e:[ge,[],()=>Math.E],"^":[ge,[ge,ge],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[ge,[ge],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[ge,[ge],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[ge,[ge],(n,[t])=>Math.log(t.evaluate(n))],log2:[ge,[ge],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[ge,[ge],(n,[t])=>Math.sin(t.evaluate(n))],cos:[ge,[ge],(n,[t])=>Math.cos(t.evaluate(n))],tan:[ge,[ge],(n,[t])=>Math.tan(t.evaluate(n))],asin:[ge,[ge],(n,[t])=>Math.asin(t.evaluate(n))],acos:[ge,[ge],(n,[t])=>Math.acos(t.evaluate(n))],atan:[ge,[ge],(n,[t])=>Math.atan(t.evaluate(n))],min:[ge,hn(ge),(n,t)=>Math.min(...t.map(r=>r.evaluate(n)))],max:[ge,hn(ge),(n,t)=>Math.max(...t.map(r=>r.evaluate(n)))],abs:[ge,[ge],(n,[t])=>Math.abs(t.evaluate(n))],round:[ge,[ge],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[ge,[ge],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[ge,[ge],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[De,[Ce,ze],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[De,[ze],(n,[t])=>n.id()===t.value],"filter-type-==":[De,[Ce],(n,[t])=>n.geometryType()===t.value],"filter-<":[De,[Ce,ze],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s{const r=n.id(),s=t.value;return typeof r==typeof s&&r":[De,[Ce,ze],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[De,[ze],(n,[t])=>{const r=n.id(),s=t.value;return typeof r==typeof s&&r>s}],"filter-<=":[De,[Ce,ze],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[De,[ze],(n,[t])=>{const r=n.id(),s=t.value;return typeof r==typeof s&&r<=s}],"filter->=":[De,[Ce,ze],(n,[t,r])=>{const s=n.properties()[t.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[De,[ze],(n,[t])=>{const r=n.id(),s=t.value;return typeof r==typeof s&&r>=s}],"filter-has":[De,[ze],(n,[t])=>t.value in n.properties()],"filter-has-id":[De,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[De,[_i(Ce)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[De,[_i(ze)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[De,[Ce,_i(ze)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[De,[Ce,_i(ze)],(n,[t,r])=>function(s,l,d,p){for(;d<=p;){const m=d+p>>1;if(l[m]===s)return!0;l[m]>s?p=m-1:d=m+1}return!1}(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:De,overloads:[[[De,De],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[hn(De),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:De,overloads:[[[De,De],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[hn(De),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[De,[De],(n,[t])=>!t.evaluate(n)],"is-supported-script":[De,[Ce],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[Ce,[Ce],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[Ce,[Ce],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[Ce,hn(ze),(n,t)=>t.map(r=>is(r.evaluate(n))).join("")],"resolved-locale":[Ce,[St],(n,[t])=>t.evaluate(n).resolvedLocale()]});class Ys{constructor(t,r){var s;this.expression=t,this._warningHistory={},this._evaluator=new dt,this._defaultValue=r?(s=r).type==="color"&&Ks(s.default)?new Xe(0,0,0,0):s.type==="color"?Xe.parse(s.default)||null:s.type==="padding"?Nt.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?ii.parse(s.default)||null:s.type==="projectionDefinition"?ni.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,s,l,d,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,s,l,d,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new wt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Js(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Cn}function Qs(n,t){const r=new Pn(Cn,Hs,[],t?function(l){const d={color:qe,string:Ce,number:ge,enum:Ce,boolean:De,formatted:Mr,padding:jt,projectionDefinition:Je,resolvedImage:Rt,variableAnchorOffsetCollection:mt};return l.type==="array"?_i(d[l.value]||ze,l.length):d[l.type]}(t):void 0),s=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Ml(new Ys(s,t)):En(r.errors)}class zn{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!ps(r.expression)}evaluateWithoutErrorHandling(t,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,d,p)}evaluate(t,r,s,l,d,p){return this._styleExpression.evaluate(t,r,s,l,d,p)}}class ea{constructor(t,r,s,l){this.kind=t,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!ps(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,s,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,d,p)}evaluate(t,r,s,l,d,p){return this._styleExpression.evaluate(t,r,s,l,d,p)}interpolationFactor(t,r,s){return this.interpolationType?ct.interpolationFactor(this.interpolationType,t,r,s):0}}function El(n,t){const r=Qs(n,t);if(r.result==="error")return r;const s=r.value.expression,l=Xs(s);if(!l&&!An(t))return En([new Me("","data expressions not supported")]);const d=Ws(s,["zoom"]);if(!d&&!Sl(t))return En([new Me("","zoom expressions not supported")]);const p=ia(s);return p||d?p instanceof Me?En([p]):p instanceof ct&&!uo(t)?En([new Me("",'"interpolate" expressions cannot be used with this property')]):Ml(p?new ea(l?"camera":"composite",r.value,p.labels,p instanceof ct?p.interpolation:void 0):new zn(l?"constant":"source",r.value)):En([new Me("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ta{constructor(t,r){this._parameters=t,this._specification=r,Ie(this,Il(this._parameters,this._specification))}static deserialize(t){return new ta(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function ia(n){let t=null;if(n instanceof Ye)t=ia(n.result);else if(n instanceof sn){for(const r of n.args)if(t=ia(r),t)break}else(n instanceof nn||n instanceof ct)&&n.input instanceof Ai&&n.input.name==="zoom"&&(t=n);return t instanceof Me||n.eachChild(r=>{const s=ia(r);s instanceof Me?t=s:!t&&s?t=new Me("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new Me("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function fo(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!fo(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Vc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ra(n){if(n==null)return{filter:()=>!0,needGeometry:!1};fo(n)||(n=na(n));const t=Qs(n,Vc);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>t.value.evaluate(r,s,{},l),needGeometry:zl(n)}}function Al(n,t){return nt?1:0}function zl(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t"||t==="<="||t===">="?sa(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(na))):t==="all"?["all"].concat(n.slice(1).map(na)):t==="none"?["all"].concat(n.slice(1).map(na).map(ms)):t==="in"?mo(n[1],n.slice(2)):t==="!in"?ms(mo(n[1],n.slice(2))):t==="has"?_o(n[1]):t!=="!has"||ms(_o(n[1]));var r}function sa(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function mo(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",n,["literal",t.sort(Al)]]:["filter-in-small",n,["literal",t]]}}function _o(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function ms(n){return["!",n]}function _s(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let l="[";for(const d of n)l+=`${_s(d)},`;return`${l}]`}const r=Object.keys(n).sort();let s="{";for(let l=0;ls.maximum?[new te(t,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function kl(n){const t=n.valueSpec,r=gt(n.value.type);let s,l,d,p={};const m=r!=="categorical"&&n.value.property===void 0,g=!m,x=tt(n.value.stops)==="array"&&tt(n.value.stops[0])==="array"&&tt(n.value.stops[0][0])==="object",b=zi({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(C){if(r==="identity")return[new te(C.key,C.value,'identity function may not have a "stops" property')];let E=[];const k=C.value;return E=E.concat(yo({key:C.key,value:k,valueSpec:C.valueSpec,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:w})),tt(k)==="array"&&k.length===0&&E.push(new te(C.key,k,"array must have at least one stop")),E},default:function(C){return C.validateSpec({key:C.key,value:C.value,valueSpec:t,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec})}}});return r==="identity"&&m&&b.push(new te(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||b.push(new te(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!uo(n.valueSpec)&&b.push(new te(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(g&&!An(n.valueSpec)?b.push(new te(n.key,n.value,"property functions not supported")):m&&!Sl(n.valueSpec)&&b.push(new te(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!x||n.value.property!==void 0||b.push(new te(n.key,n.value,'"property" property is required')),b;function w(C){let E=[];const k=C.value,O=C.key;if(tt(k)!=="array")return[new te(O,k,`array expected, ${tt(k)} found`)];if(k.length!==2)return[new te(O,k,`array length 2 expected, length ${k.length} found`)];if(x){if(tt(k[0])!=="object")return[new te(O,k,`object expected, ${tt(k[0])} found`)];if(k[0].zoom===void 0)return[new te(O,k,"object stop key must have zoom")];if(k[0].value===void 0)return[new te(O,k,"object stop key must have value")];if(d&&d>gt(k[0].zoom))return[new te(O,k[0].zoom,"stop zoom values must appear in ascending order")];gt(k[0].zoom)!==d&&(d=gt(k[0].zoom),l=void 0,p={}),E=E.concat(zi({key:`${O}[0]`,value:k[0],valueSpec:{zoom:{}},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:xo,value:M}}))}else E=E.concat(M({key:`${O}[0]`,value:k[0],validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec},k));return Js(un(k[1]))?E.concat([new te(`${O}[1]`,k[1],"expressions are not allowed in function stops.")]):E.concat(C.validateSpec({key:`${O}[1]`,value:k[1],valueSpec:t,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec}))}function M(C,E){const k=tt(C.value),O=gt(C.value),Z=C.value!==null?C.value:E;if(s){if(k!==s)return[new te(C.key,Z,`${k} stop domain type must match previous stop domain type ${s}`)]}else s=k;if(k!=="number"&&k!=="string"&&k!=="boolean")return[new te(C.key,Z,"stop domain value must be a number, string, or boolean")];if(k!=="number"&&r!=="categorical"){let ee=`number expected, ${k} found`;return An(t)&&r===void 0&&(ee+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new te(C.key,Z,ee)]}return r!=="categorical"||k!=="number"||isFinite(O)&&Math.floor(O)===O?r!=="categorical"&&k==="number"&&l!==void 0&&Onew te(`${n.key}${s.key}`,n.value,s.message));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new te(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!ps(r))return[new te(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!ps(r))return[new te(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!Ws(r,["zoom","feature-state"]))return[new te(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!Xs(r))return[new te(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Dn(n){const t=n.key,r=n.value,s=n.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(gt(r))===-1&&l.push(new te(t,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(gt(r))===-1&&l.push(new te(t,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function oa(n){return fo(un(n.value))?kn(Ie({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):gs(n)}function gs(n){const t=n.value,r=n.key;if(tt(t)!=="array")return[new te(r,t,`array expected, ${tt(t)} found`)];const s=n.styleSpec;let l,d=[];if(t.length<1)return[new te(r,t,"filter array must have at least 1 element")];switch(d=d.concat(Dn({key:`${r}[0]`,value:t[0],valueSpec:s.filter_operator,style:n.style,styleSpec:n.styleSpec})),gt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&>(t[1])==="$type"&&d.push(new te(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new te(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=tt(t[1]),l!=="string"&&d.push(new te(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let p=2;p{x in r&&t.push(new te(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{gt(x.id)===m&&(g=x)}),g?g.ref?t.push(new te(s,r.ref,"ref cannot reference another ref layer")):p=gt(g.type):t.push(new te(s,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const g=l.sources&&l.sources[r.source],x=g&>(g.type);g?x==="vector"&&p==="raster"?t.push(new te(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&p==="hillshade"?t.push(new te(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&p!=="raster"?t.push(new te(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?t.push(new te(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||t.push(new te(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new te(s,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new te(s,r.source,`source "${r.source}" not found`))}else t.push(new te(s,r,'missing required property "source"'));return t=t.concat(zi({key:s,value:r,valueSpec:d.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${s}.type`,value:r.type,valueSpec:d.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:oa,layout:g=>zi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>bo(Ie({layerType:p},x))}}),paint:g=>zi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":x=>vo(Ie({layerType:p},x))}})}})),t}function Cr(n){const t=n.value,r=n.key,s=tt(t);return s!=="string"?[new te(r,t,`string expected, ${s} found`)]:[]}const wo={promoteId:function({key:n,value:t}){if(tt(t)==="string")return Cr({key:n,value:t});{const r=[];for(const s in t)r.push(...Cr({key:`${n}.${s}`,value:t[s]}));return r}}};function Rn(n){const t=n.value,r=n.key,s=n.styleSpec,l=n.style,d=n.validateSpec;if(!t.type)return[new te(r,t,'"type" is required')];const p=gt(t.type);let m;switch(p){case"vector":case"raster":return m=zi({key:r,value:t,valueSpec:s[`source_${p.replace("-","_")}`],style:n.style,styleSpec:s,objectElementValidators:wo,validateSpec:d}),m;case"raster-dem":return m=function(g){var x;const b=(x=g.sourceName)!==null&&x!==void 0?x:"",w=g.value,M=g.styleSpec,C=M.source_raster_dem,E=g.style;let k=[];const O=tt(w);if(w===void 0)return k;if(O!=="object")return k.push(new te("source_raster_dem",w,`object expected, ${O} found`)),k;const Z=gt(w.encoding)==="custom",ee=["redFactor","greenFactor","blueFactor","baseShift"],q=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const I in w)!Z&&ee.includes(I)?k.push(new te(I,w[I],`In "${b}": "${I}" is only valid when "encoding" is set to "custom". ${q} encoding found`)):C[I]?k=k.concat(g.validateSpec({key:I,value:w[I],valueSpec:C[I],validateSpec:g.validateSpec,style:E,styleSpec:M})):k.push(new te(I,w[I],`unknown property "${I}"`));return k}({sourceName:r,value:t,style:n.style,styleSpec:s,validateSpec:d}),m;case"geojson":if(m=zi({key:r,value:t,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:d,objectElementValidators:wo}),t.cluster)for(const g in t.clusterProperties){const[x,b]=t.clusterProperties[g],w=typeof x=="string"?[x,["accumulated"],["get",g]]:x;m.push(...kn({key:`${r}.${g}.map`,value:b,expressionContext:"cluster-map"})),m.push(...kn({key:`${r}.${g}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return m;case"video":return zi({key:r,value:t,valueSpec:s.source_video,style:l,validateSpec:d,styleSpec:s});case"image":return zi({key:r,value:t,valueSpec:s.source_image,style:l,validateSpec:d,styleSpec:s});case"canvas":return[new te(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Ll(n){const t=n.value,r=n.styleSpec,s=r.light,l=n.style;let d=[];const p=tt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new te("light",t,`object expected, ${p} found`)]),d;for(const m in t){const g=m.match(/^(.*)-transition$/);d=d.concat(g&&s[g[1]]&&s[g[1]].transition?n.validateSpec({key:m,value:t[m],valueSpec:r.transition,validateSpec:n.validateSpec,style:l,styleSpec:r}):s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],validateSpec:n.validateSpec,style:l,styleSpec:r}):[new te(m,t[m],`unknown property "${m}"`)])}return d}function Bl(n){const t=n.value,r=n.styleSpec,s=r.sky,l=n.style,d=tt(t);if(t===void 0)return[];if(d!=="object")return[new te("sky",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],style:l,styleSpec:r}):[new te(m,t[m],`unknown property "${m}"`)]);return p}function Fl(n){const t=n.value,r=n.styleSpec,s=r.terrain,l=n.style;let d=[];const p=tt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new te("terrain",t,`object expected, ${p} found`)]),d;for(const m in t)d=d.concat(s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],validateSpec:n.validateSpec,style:l,styleSpec:r}):[new te(m,t[m],`unknown property "${m}"`)]);return d}function Ol(n){let t=[];const r=n.value,s=n.key;if(Array.isArray(r)){const l=[],d=[];for(const p in r)r[p].id&&l.includes(r[p].id)&&t.push(new te(s,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),l.push(r[p].id),r[p].url&&d.includes(r[p].url)&&t.push(new te(s,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),t=t.concat(zi({key:`${s}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return t}return Cr({key:s,value:r})}const jl={"*":()=>[],array:yo,boolean:function(n){const t=n.value,r=n.key,s=tt(t);return s!=="boolean"?[new te(r,t,`boolean expected, ${s} found`)]:[]},number:xo,color:function(n){const t=n.key,r=n.value,s=tt(r);return s!=="string"?[new te(t,r,`color expected, ${s} found`)]:Xe.parse(String(r))?[]:[new te(t,r,`color expected, "${r}" found`)]},constants:aa,enum:Dn,filter:oa,function:kl,layer:Rl,object:zi,source:Rn,light:Ll,sky:Bl,terrain:Fl,projection:function(n){const t=n.value,r=n.styleSpec,s=r.projection,l=n.style,d=tt(t);if(t===void 0)return[];if(d!=="object")return[new te("projection",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(s[m]?n.validateSpec({key:m,value:t[m],valueSpec:s[m],style:l,styleSpec:r}):[new te(m,t[m],`unknown property "${m}"`)]);return p},projectionDefinition:function(n){const t=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const s=tt(r);return s!=="array"||function(l){return Array.isArray(l)&&l.length===3&&typeof l[0]=="string"&&typeof l[1]=="string"&&typeof l[2]=="number"}(r)||function(l){return!!["interpolate","step","literal"].includes(l[0])}(r)?["array","string"].includes(s)?[]:[new te(t,r,`projection expected, invalid type "${s}" found`)]:[new te(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Cr,formatted:function(n){return Cr(n).length===0?[]:kn(n)},resolvedImage:function(n){return Cr(n).length===0?[]:kn(n)},padding:function(n){const t=n.key,r=n.value;if(tt(r)==="array"){if(r.length<1||r.length>4)return[new te(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let d=0;d[]}})),n.constants&&(r=r.concat(aa({key:"constants",value:n.constants}))),Bn(r)}function At(n){return function(t){return n({...t,validateSpec:la})}}function Bn(n){return[].concat(n).sort((t,r)=>t.line-r.line)}function ji(n){return function(...t){return Bn(n.apply(this,t))}}li.source=ji(At(Rn)),li.sprite=ji(At(Ol)),li.glyphs=ji(At(Ln)),li.light=ji(At(Ll)),li.sky=ji(At(Bl)),li.terrain=ji(At(Fl)),li.layer=ji(At(Rl)),li.filter=ji(At(oa)),li.paintProperty=ji(At(vo)),li.layoutProperty=ji(At(bo));const Fn=li,Uc=Fn.light,ys=Fn.sky,Nl=Fn.paintProperty,To=Fn.layoutProperty;function Vl(n,t){let r=!1;if(t&&t.length)for(const s of t)n.fire(new Qn(new Error(s.message))),r=!0;return r}class dn{constructor(t,r,s){const l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(r=p[1])+2*(s=p[2]);for(let g=0;g=w[E+0]&&l>=w[E+1])?(m[C]=!0,p.push(b[C])):m[C]=!1}}}}_forEachCell(t,r,s,l,d,p,m,g){const x=this._convertToCellCoord(t),b=this._convertToCellCoord(r),w=this._convertToCellCoord(s),M=this._convertToCellCoord(l);for(let C=x;C<=w;C++)for(let E=b;E<=M;E++){const k=this.d*E+C;if((!g||g(this._convertFromCellCoord(C),this._convertFromCellCoord(E),this._convertFromCellCoord(C+1),this._convertFromCellCoord(E+1)))&&d.call(this,t,r,s,l,k,p,m,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let s=0;for(let p=0;p=0)continue;const p=n[d];l[d]=sr[r].shallow.indexOf(d)>=0?p:xs(p,t)}n instanceof Error&&(l.message=n.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function Er(n){if(Zl(n))return n;if(Array.isArray(n))return n.map(Er);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const t=pn(n)||"Object";if(!sr[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=sr[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(n);const s=Object.create(r.prototype);for(const l of Object.keys(n)){if(l==="$name")continue;const d=n[l];s[l]=sr[t].shallow.indexOf(l)>=0?d:Er(d)}return s}class Gl{constructor(){this.first=!0}update(t,r){const s=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomn>=128&&n<=255,"Hangul Jamo":n=>n>=4352&&n<=4607,Khmer:n=>n>=6016&&n<=6143,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Katakana:n=>n>=12448&&n<=12543,Kanbun:n=>n>=12688&&n<=12703,"CJK Strokes":n=>n>=12736&&n<=12783,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"Private Use Area":n=>n>=57344&&n<=63743,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function On(n){for(const t of n)if(ua(t.charCodeAt(0)))return!0;return!1}function $l(n){for(const t of n)if(!Hl(t.charCodeAt(0)))return!1;return!0}function ca(n){const t=n.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const ql=ca(["Arab","Dupl","Mong","Ougr","Syrc"]);function Hl(n){return!ql.test(String.fromCodePoint(n))}const ha=ca(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function ua(n){return!(n!==746&&n!==747&&(n<4352||!(We["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||We["CJK Compatibility"](n)||We["CJK Strokes"](n)||!(!We["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||We["Enclosed CJK Letters and Months"](n)||We["Ideographic Description Characters"](n)||We.Kanbun(n)||We.Katakana(n)&&n!==12540||!(!We["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!We["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||We["Vertical Forms"](n)||We["Yijing Hexagram Symbols"](n)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(n))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(n))||ha.test(String.fromCodePoint(n)))))}function Xl(n){return!(ua(n)||function(t){return!!(We["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||We["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||We["Letterlike Symbols"](t)||We["Number Forms"](t)||We["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||We["Control Pictures"](t)&&t!==9251||We["Optical Character Recognition"](t)||We["Enclosed Alphanumerics"](t)||We["Geometric Shapes"](t)||We["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||We["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||We["CJK Symbols and Punctuation"](t)||We.Katakana(t)||We["Private Use Area"](t)||We["CJK Compatibility Forms"](t)||We["Small Form Variants"](t)||We["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(n))}const Wl=ca(["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 Kl(n){return Wl.test(String.fromCodePoint(n))}function Yl(n,t){return!(!t&&Kl(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||We.Khmer(n))}function Jl(n){for(const t of n)if(Kl(t.charCodeAt(0)))return!0;return!1}const ar=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(ar.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,t){return c(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,s=new Promise(d=>{this.loadScriptResolve=d});t(r);const l=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([s,l]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:r};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class yt{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gl,this.transition={})}isSupportedScript(t){return function(r,s){for(const l of r)if(!Yl(l.charCodeAt(0),s))return!1;return!0}(t,ar.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),s=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class da{constructor(t,r){this.property=t,this.value=r,this.expression=function(s,l){if(Ks(s))return new ta(s,l);if(Js(s)){const d=El(s,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=s;return l.type==="color"&&typeof s=="string"?d=Xe.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)?d=ii.parse(s):l.type==="projectionDefinition"&&typeof s=="string"&&(d=ni.parse(s)):d=Nt.parse(s),{kind:"constant",evaluate:()=>d}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,s){return this.property.possiblyEvaluate(this,t,r,s)}}class pa{constructor(t){this.property=t,this.value=new da(t,void 0)}transitioned(t,r){return new Mo(this.property,this.value,r,Wt({},t.transition,this.transition),t.now)}untransitioned(){return new Mo(this.property,this.value,null,{},0)}}class Po{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return fi(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new pa(this._values[t].property)),this._values[t].value=new da(this._values[t].property,r===null?void 0:fi(r))}getTransition(t){return fi(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new pa(this._values[t].property)),this._values[t].transition=fi(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(t[r]=s);const l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){const s=new So(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(t,r._values[l]);return s}untransitioned(){const t=new So(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Mo{constructor(t,r,s,l,d){this.property=t,this.value=r,this.begin=d+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(t,r,s){const l=t.now||0,d=this.value.possiblyEvaluate(t,r,s),p=this.prior;if(p){if(l>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(ll.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class ma{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},s,l);return this._calculate(d,d,d,r)}return this._calculate(t.expression.evaluate(new yt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new yt(Math.floor(r.zoom),r)),t.expression.evaluate(new yt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class _a{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){return!!t.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class ui{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const s=t[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new da(s,void 0),d=this.defaultTransitionablePropertyValues[r]=new pa(s);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ae("DataDrivenProperty",Ne),Ae("DataConstantProperty",Le),Ae("CrossFadedDataDrivenProperty",vs),Ae("CrossFadedProperty",ma),Ae("ColorRampProperty",_a);const Ql="-transition";class Ki extends Pr{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new fa(r.layout)),r.paint)){this._transitionablePaint=new Po(r.paint);for(const s in t.paint)this.setPaintProperty(s,t.paint[s],{validate:!1});for(const s in t.layout)this.setLayoutProperty(s,t.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new jn(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,s={}){r!=null&&this._validate(To,`layers.${this.id}.layout.${t}`,t,r,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(Ql)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,s={}){if(r!=null&&this._validate(Nl,`layers.${this.id}.paint.${t}`,t,r,s))return!1;if(t.endsWith(Ql))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[t],d=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),m=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const g=this._transitionablePaint._values[t].value;return g.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,m,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,s){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Zr(t,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(t,r,s,l,d={}){return(!d||d.validate!==!1)&&Vl(this,t.call(Fn,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:j,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof Wi&&An(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Zc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class bs{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ht{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function kt(n,t=1){let r=0,s=0;return{members:n.map(l=>{const d=Zc[l.type].BYTES_PER_ELEMENT,p=r=ec(r,Math.max(t,d)),m=l.components||1;return s=Math.max(s,d),r+=d*m,{name:l.name,type:l.type,components:m,offset:p}}),size:ec(r,Math.max(s,t)),alignment:t}}function ec(n,t){return Math.ceil(n/t)*t}class ws extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.int16[l+0]=r,this.int16[l+1]=s,t}}ws.prototype.bytesPerElement=4,Ae("StructArrayLayout2i4",ws);class Ts extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,t}}Ts.prototype.bytesPerElement=6,Ae("StructArrayLayout3i6",Ts);class Io extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,s,l)}emplace(t,r,s,l,d){const p=4*t;return this.int16[p+0]=r,this.int16[p+1]=s,this.int16[p+2]=l,this.int16[p+3]=d,t}}Io.prototype.bytesPerElement=8,Ae("StructArrayLayout4i8",Io);class Co extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=m,t}}Co.prototype.bytesPerElement=12,Ae("StructArrayLayout2i4i12",Co);class or extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=4*t,x=8*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=d,this.uint8[x+6]=p,this.uint8[x+7]=m,t}}or.prototype.bytesPerElement=8,Ae("StructArrayLayout2i4ub8",or);class Nn extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.float32[l+0]=r,this.float32[l+1]=s,t}}Nn.prototype.bytesPerElement=8,Ae("StructArrayLayout2f8",Nn);class Ps extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b){const w=this.length;return this.resize(w+1),this.emplace(w,t,r,s,l,d,p,m,g,x,b)}emplace(t,r,s,l,d,p,m,g,x,b,w){const M=10*t;return this.uint16[M+0]=r,this.uint16[M+1]=s,this.uint16[M+2]=l,this.uint16[M+3]=d,this.uint16[M+4]=p,this.uint16[M+5]=m,this.uint16[M+6]=g,this.uint16[M+7]=x,this.uint16[M+8]=b,this.uint16[M+9]=w,t}}Ps.prototype.bytesPerElement=20,Ae("StructArrayLayout10ui20",Ps);class ga extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b,w,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,r,s,l,d,p,m,g,x,b,w,M)}emplace(t,r,s,l,d,p,m,g,x,b,w,M,C){const E=12*t;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=l,this.int16[E+3]=d,this.uint16[E+4]=p,this.uint16[E+5]=m,this.uint16[E+6]=g,this.uint16[E+7]=x,this.int16[E+8]=b,this.int16[E+9]=w,this.int16[E+10]=M,this.int16[E+11]=C,t}}ga.prototype.bytesPerElement=24,Ae("StructArrayLayout4i4ui4i24",ga);class Ms extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,t}}Ms.prototype.bytesPerElement=12,Ae("StructArrayLayout3f12",Ms);class Eo extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}Eo.prototype.bytesPerElement=4,Ae("StructArrayLayout1ul4",Eo);class Vn extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x){const b=this.length;return this.resize(b+1),this.emplace(b,t,r,s,l,d,p,m,g,x)}emplace(t,r,s,l,d,p,m,g,x,b){const w=10*t,M=5*t;return this.int16[w+0]=r,this.int16[w+1]=s,this.int16[w+2]=l,this.int16[w+3]=d,this.int16[w+4]=p,this.int16[w+5]=m,this.uint32[M+3]=g,this.uint16[w+8]=x,this.uint16[w+9]=b,t}}Vn.prototype.bytesPerElement=20,Ae("StructArrayLayout6i1ul2ui20",Vn);class fn extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=6*t;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=d,this.int16[g+4]=p,this.int16[g+5]=m,t}}fn.prototype.bytesPerElement=12,Ae("StructArrayLayout2i2i2i12",fn);class Ao extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,s,l,d)}emplace(t,r,s,l,d,p){const m=4*t,g=8*t;return this.float32[m+0]=r,this.float32[m+1]=s,this.float32[m+2]=l,this.int16[g+6]=d,this.int16[g+7]=p,t}}Ao.prototype.bytesPerElement=16,Ae("StructArrayLayout2f1f2i16",Ao);class ya extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,s,l,d,p)}emplace(t,r,s,l,d,p,m){const g=16*t,x=4*t,b=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=s,this.float32[x+1]=l,this.float32[x+2]=d,this.int16[b+6]=p,this.int16[b+7]=m,t}}ya.prototype.bytesPerElement=16,Ae("StructArrayLayout2ub2f2i16",ya);class Ar extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.uint16[d+0]=r,this.uint16[d+1]=s,this.uint16[d+2]=l,t}}Ar.prototype.bytesPerElement=6,Ae("StructArrayLayout3ui6",Ar);class zo extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b,w,M,C,E,k,O,Z){const ee=this.length;return this.resize(ee+1),this.emplace(ee,t,r,s,l,d,p,m,g,x,b,w,M,C,E,k,O,Z)}emplace(t,r,s,l,d,p,m,g,x,b,w,M,C,E,k,O,Z,ee){const q=24*t,I=12*t,F=48*t;return this.int16[q+0]=r,this.int16[q+1]=s,this.uint16[q+2]=l,this.uint16[q+3]=d,this.uint32[I+2]=p,this.uint32[I+3]=m,this.uint32[I+4]=g,this.uint16[q+10]=x,this.uint16[q+11]=b,this.uint16[q+12]=w,this.float32[I+7]=M,this.float32[I+8]=C,this.uint8[F+36]=E,this.uint8[F+37]=k,this.uint8[F+38]=O,this.uint32[I+10]=Z,this.int16[q+22]=ee,t}}zo.prototype.bytesPerElement=48,Ae("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",zo);class ko extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l,d,p,m,g,x,b,w,M,C,E,k,O,Z,ee,q,I,F,H,ae,xe,ce,pe,we,be){const Te=this.length;return this.resize(Te+1),this.emplace(Te,t,r,s,l,d,p,m,g,x,b,w,M,C,E,k,O,Z,ee,q,I,F,H,ae,xe,ce,pe,we,be)}emplace(t,r,s,l,d,p,m,g,x,b,w,M,C,E,k,O,Z,ee,q,I,F,H,ae,xe,ce,pe,we,be,Te){const _e=32*t,ke=16*t;return this.int16[_e+0]=r,this.int16[_e+1]=s,this.int16[_e+2]=l,this.int16[_e+3]=d,this.int16[_e+4]=p,this.int16[_e+5]=m,this.int16[_e+6]=g,this.int16[_e+7]=x,this.uint16[_e+8]=b,this.uint16[_e+9]=w,this.uint16[_e+10]=M,this.uint16[_e+11]=C,this.uint16[_e+12]=E,this.uint16[_e+13]=k,this.uint16[_e+14]=O,this.uint16[_e+15]=Z,this.uint16[_e+16]=ee,this.uint16[_e+17]=q,this.uint16[_e+18]=I,this.uint16[_e+19]=F,this.uint16[_e+20]=H,this.uint16[_e+21]=ae,this.uint16[_e+22]=xe,this.uint32[ke+12]=ce,this.float32[ke+13]=pe,this.float32[ke+14]=we,this.uint16[_e+30]=be,this.uint16[_e+31]=Te,t}}ko.prototype.bytesPerElement=64,Ae("StructArrayLayout8i15ui1ul2f2ui64",ko);class Ss extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}Ss.prototype.bytesPerElement=4,Ae("StructArrayLayout1f4",Ss);class Do extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=3*t;return this.uint16[6*t+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,t}}Do.prototype.bytesPerElement=12,Ae("StructArrayLayout1ui2f12",Do);class h extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){const d=4*t;return this.uint32[2*t+0]=r,this.uint16[d+2]=s,this.uint16[d+3]=l,t}}h.prototype.bytesPerElement=8,Ae("StructArrayLayout1ul2ui8",h);class e extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){const l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=s,t}}e.prototype.bytesPerElement=4,Ae("StructArrayLayout2ui4",e);class i extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}i.prototype.bytesPerElement=2,Ae("StructArrayLayout1ui2",i);class a extends ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,s,l)}emplace(t,r,s,l,d){const p=4*t;return this.float32[p+0]=r,this.float32[p+1]=s,this.float32[p+2]=l,this.float32[p+3]=d,t}}a.prototype.bytesPerElement=16,Ae("StructArrayLayout4f16",a);class o extends bs{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 Oe(this.anchorPointX,this.anchorPointY)}}o.prototype.size=20;class u extends Vn{get(t){return new o(this,t)}}Ae("CollisionBoxArray",u);class f extends bs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}f.prototype.size=48;class _ extends zo{get(t){return new f(this,t)}}Ae("PlacedSymbolArray",_);class y extends bs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}y.prototype.size=64;class v extends ko{get(t){return new y(this,t)}}Ae("SymbolInstanceArray",v);class T extends Ss{getoffsetX(t){return this.float32[1*t+0]}}Ae("GlyphOffsetArray",T);class P extends Ts{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ae("SymbolLineVertexArray",P);class S extends bs{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]}}S.prototype.size=12;class A extends Do{get(t){return new S(this,t)}}Ae("TextAnchorOffsetArray",A);class R extends bs{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]}}R.prototype.size=8;class V extends h{get(t){return new R(this,t)}}Ae("FeatureIndexArray",V);class N extends ws{}class U extends ws{}class G extends ws{}class X extends Co{}class W extends or{}class K extends Nn{}class Q extends Ps{}class J extends ga{}class se extends Ms{}class oe extends Eo{}class me extends fn{}class ye extends ya{}class de extends Ar{}class Se extends e{}const Pe=kt([{name:"a_pos",components:2,type:"Int16"}],4),{members:ve}=Pe;class Ee{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,s,l){const d=this.segments[this.segments.length-1];return t>Ee.MAX_VERTEX_ARRAY_LENGTH&&ti(`Max vertices per segment is ${Ee.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Ee.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>Ee.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l?this.createNewSegment(r,s,l):d}createNewSegment(t,r,s){const l={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(l.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(l),l}getOrCreateLatestSegment(t,r,s){return this.prepareSegment(0,t,r,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,s,l){return new Ee([{vertexOffset:t,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function $e(n,t){return 256*(n=Li(Math.floor(n),0,255))+Li(Math.floor(t),0,255)}Ee.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ae("SegmentVector",Ee);const et=kt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var xt,st,vt,at={exports:{}},nt={exports:{}},ot={exports:{}},Kt=function(){if(vt)return at.exports;vt=1;var n=(xt||(xt=1,nt.exports=function(r,s){var l,d,p,m,g,x,b,w;for(d=r.length-(l=3&r.length),p=s,g=3432918353,x=461845907,w=0;w>>16)*g&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(b=0,l){case 3:b^=(255&r.charCodeAt(w+2))<<16;case 2:b^=(255&r.charCodeAt(w+1))<<8;case 1:p^=b=(65535&(b=(b=(65535&(b^=255&r.charCodeAt(w)))*g+(((b>>>16)*g&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295}return p^=r.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),nt.exports),t=(st||(st=1,ot.exports=function(r,s){for(var l,d=r.length,p=s^d,m=0;d>=4;)l=1540483477*(65535&(l=255&r.charCodeAt(m)|(255&r.charCodeAt(++m))<<8|(255&r.charCodeAt(++m))<<16|(255&r.charCodeAt(++m))<<24))+((1540483477*(l>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(l=1540483477*(65535&(l^=l>>>24))+((1540483477*(l>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&r.charCodeAt(m+2))<<16;case 2:p^=(255&r.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&r.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),ot.exports);return at.exports=n,at.exports.murmur3=n,at.exports.murmur2=t,at.exports}(),Lt=Pi(Kt);class Bt{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,s,l){this.ids.push(ci(t)),this.positions.push(r,s,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=ci(t);let s=0,l=this.ids.length-1;for(;s>1;this.ids[p]>=r?l=p:s=p+1}const d=[];for(;this.ids[s]===r;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(t,r){const s=new Float64Array(t.ids),l=new Uint32Array(t.positions);return lr(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(t){const r=new Bt;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function ci(n){const t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Lt(String(n))}function lr(n,t,r,s){for(;r>1];let d=r-1,p=s+1;for(;;){do d++;while(n[d]l);if(d>=p)break;Yi(n,d,p),Yi(t,3*d,3*p),Yi(t,3*d+1,3*p+1),Yi(t,3*d+2,3*p+2)}p-r`u_${l}`),this.type=s}setUniform(t,r,s){t.set(s.constantOr(this.value))}getBinding(t,r,s){return this.type==="color"?new Cs(t,r):new cr(t,r)}}class Di{constructor(t,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,s,l){const d=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,r,s){return s.substr(0,9)==="u_pattern"?new Is(t,r):new cr(t,r)}}class xi{constructor(t,r,s,l){this.expression=t,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,r,s,l,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new yt(0),r,{},l,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,r,s,l){const d=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(t,r,d)}_setPaintValue(t,r,s){if(this.type==="color"){const l=di(s);for(let d=t;d`u_${m}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,r,s,l,d){const p=this.expression.evaluate(new yt(this.zoom),r,{},l,[],d),m=this.expression.evaluate(new yt(this.zoom+1),r,{},l,[],d),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,p,m)}updatePaintArray(t,r,s,l){const d=this.expression.evaluate({zoom:this.zoom},s,l),p=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(t,r,d,p)}_setPaintValue(t,r,s,l){if(this.type==="color"){const d=di(s),p=di(l);for(let m=t;m`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof xi||s instanceof lt)for(let l=0;l!0){this.programConfigurations={};for(const l of t)this.programConfigurations[l.id]=new vi(l,r,s);this.needsUpload=!1,this._featureMap=new Bt,this._bufferOffset=0}populatePaintArrays(t,r,s,l,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,r,l,d,p);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,s,l){for(const d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,r,d,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Gc(n,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[n]||[n.replace(`${t}-`,"").replace(/-/g,"_")]}function tc(n,t,r){const s={color:{source:Nn,composite:a},number:{source:Ss,composite:Nn}},l=function(d){return{"line-pattern":{source:Q,composite:Q},"fill-pattern":{source:Q,composite:Q},"fill-extrusion-pattern":{source:Q,composite:Q}}[d]}(n);return l&&l[r]||s[t][r]}Ae("ConstantBinder",ki),Ae("CrossFadedConstantBinder",Di),Ae("SourceExpressionBinder",xi),Ae("CrossFadedCompositeBinder",bt),Ae("CompositeExpressionBinder",lt),Ae("ProgramConfiguration",vi,{omit:["_buffers"]}),Ae("ProgramConfigurationSet",Tt);const Ro=Math.pow(2,14)-1,ic=-Ro-1;function mn(n){const t=rt/n.extent,r=n.loadGeometry();for(let s=0;sp.x+1||gp.y+1)&&ti("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function _n(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?mn(n):[]}}const zr=-32768;function rc(n,t,r,s,l){n.emplaceBack(zr+8*t+s,zr+8*r+l)}class xa{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new U,this.indexArray=new de,this.segments=new Ee,this.programConfigurations=new Tt(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){const l=this.layers[0],d=[];let p=null,m=!1,g=l.type==="heatmap";if(l.type==="circle"){const b=l;p=b.layout.get("circle-sort-key"),m=!p.isConstant(),g=g||b.paint.get("circle-pitch-alignment")==="map"}const x=g?r.subdivisionGranularity.circle:1;for(const{feature:b,id:w,index:M,sourceLayerIndex:C}of t){const E=this.layers[0]._featureFilter.needGeometry,k=_n(b,E);if(!this.layers[0]._featureFilter.filter(new yt(this.zoom),k,s))continue;const O=m?p.evaluate(k,{},s):void 0,Z={id:w,properties:b.properties,type:b.type,sourceLayerIndex:C,index:M,geometry:E?k.geometry:mn(b),patterns:{},sortKey:O};d.push(Z)}m&&d.sort((b,w)=>b.sortKey-w.sortKey);for(const b of d){const{geometry:w,index:M,sourceLayerIndex:C}=b,E=t[M].feature;this.addFeature(b,w,M,s,x),r.featureIndex.insert(E,w,M,C,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ve),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,s,l,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const m=p.length;for(const g of r)for(const x of g){const b=x.x,w=x.y;if(b<0||b>=rt||w<0||w>=rt)continue;const M=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),C=M.vertexLength;for(let E=0;E1){if($c(n,t))return!0;for(let s=0;s1?r:r.sub(t)._mult(l)._add(t))}function Rh(n,t){let r,s,l,d=!1;for(let p=0;pt.y!=l.y>t.y&&t.x<(l.x-s.x)*(t.y-s.y)/(l.y-s.y)+s.x&&(d=!d)}return d}function va(n,t){let r=!1;for(let s=0,l=n.length-1;st.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(r=!r)}return r}function yd(n,t,r){const s=r[0],l=r[2];if(n.xl.x&&t.x>l.x||n.yl.y&&t.y>l.y)return!1;const d=Ot(n,t,r[0]);return d!==Ot(n,t,r[1])||d!==Ot(n,t,r[2])||d!==Ot(n,t,r[3])}function jo(n,t,r){const s=t.paint.get(n).value;return s.kind==="constant"?s.value:r.programConfigurations.get(t.id).getMaxValue(n)}function nc(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function sc(n,t,r,s,l){if(!t[0]&&!t[1])return n;const d=Oe.convert(t)._mult(l);r==="viewport"&&d._rotate(-s);const p=[];for(let m=0;mFh(k,E))}(g,m),M=b?x*p:x;for(const C of l)for(const E of C){const k=b?E:Fh(E,m);let O=M;const Z=Ji([],[E.x,E.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?O*=Z[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(O*=d.cameraToCenterDistance/Z[3]),Bo(w,k,O))return!0}return!1}}function Fh(n,t){const r=Ji([],[n.x,n.y,0,1],t);return new Oe(r[0]/r[3],r[1]/r[3])}class Oh extends xa{}let jh;Ae("HeatmapBucket",Oh,{omit:["layers"]});var bd={get paint(){return jh=jh||new ui({"heatmap-radius":new Ne(j.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ne(j.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Le(j.paint_heatmap["heatmap-intensity"]),"heatmap-color":new _a(j.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Le(j.paint_heatmap["heatmap-opacity"])})}};function Hc(n,{width:t,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*s}`)}else l=new Uint8Array(t*r*s);return n.width=t,n.height=r,n.data=l,n}function Nh(n,{width:t,height:r},s){if(t===n.width&&r===n.height)return;const l=Hc({},{width:t,height:r},s);Xc(n,l,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,r)},s),n.width=t,n.height=r,n.data=l.data}function Xc(n,t,r,s,l,d){if(l.width===0||l.height===0)return t;if(l.width>n.width||l.height>n.height||r.x>n.width-l.width||r.y>n.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||s.x>t.width-l.width||s.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const p=n.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g{t[n.evaluationKey]=g;const x=n.expression.evaluate(t);l.data[p+m+0]=Math.floor(255*x.r/x.a),l.data[p+m+1]=Math.floor(255*x.g/x.a),l.data[p+m+2]=Math.floor(255*x.b/x.a),l.data[p+m+3]=Math.floor(255*x.a)};if(n.clips)for(let p=0,m=0;p0)for(let p=t;p=t;p-=s)d=Hh(p/s|0,n[p],n[p+1],d);return d&&ba(d,d.next)&&(Go(d),d=d.next),d}function Es(n,t){if(!n)return n;t||(t=n);let r,s=n;do if(r=!1,s.steiner||!ba(s,s.next)&&Dt(s.prev,s,s.next)!==0)s=s.next;else{if(Go(s),s=t=s.prev,s===s.next)break;r=!0}while(r||s!==t);return t}function Vo(n,t,r,s,l,d,p){if(!n)return;!p&&d&&function(g,x,b,w){let M=g;do M.z===0&&(M.z=Jc(M.x,M.y,x,b,w)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==g);M.prevZ.nextZ=null,M.prevZ=null,function(C){let E,k=1;do{let O,Z=C;C=null;let ee=null;for(E=0;Z;){E++;let q=Z,I=0;for(let H=0;H0||F>0&&q;)I!==0&&(F===0||!q||Z.z<=q.z)?(O=Z,Z=Z.nextZ,I--):(O=q,q=q.nextZ,F--),ee?ee.nextZ=O:C=O,O.prevZ=ee,ee=O;Z=q}ee.nextZ=null,k*=2}while(E>1)}(M)}(n,s,l,d);let m=n;for(;n.prev!==n.next;){const g=n.prev,x=n.next;if(d?Cd(n,s,l,d):Id(n))t.push(g.i,n.i,x.i),Go(n),n=x.next,m=x.next;else if((n=x)===m){p?p===1?Vo(n=Ed(Es(n),t),t,r,s,l,d,2):p===2&&Ad(n,t,r,s,l,d):Vo(Es(n),t,r,s,l,d,1);break}}}function Id(n){const t=n.prev,r=n,s=n.next;if(Dt(t,r,s)>=0)return!1;const l=t.x,d=r.x,p=s.x,m=t.y,g=r.y,x=s.y,b=Math.min(l,d,p),w=Math.min(m,g,x),M=Math.max(l,d,p),C=Math.max(m,g,x);let E=s.next;for(;E!==t;){if(E.x>=b&&E.x<=M&&E.y>=w&&E.y<=C&&Uo(l,m,d,g,p,x,E.x,E.y)&&Dt(E.prev,E,E.next)>=0)return!1;E=E.next}return!0}function Cd(n,t,r,s){const l=n.prev,d=n,p=n.next;if(Dt(l,d,p)>=0)return!1;const m=l.x,g=d.x,x=p.x,b=l.y,w=d.y,M=p.y,C=Math.min(m,g,x),E=Math.min(b,w,M),k=Math.max(m,g,x),O=Math.max(b,w,M),Z=Jc(C,E,t,r,s),ee=Jc(k,O,t,r,s);let q=n.prevZ,I=n.nextZ;for(;q&&q.z>=Z&&I&&I.z<=ee;){if(q.x>=C&&q.x<=k&&q.y>=E&&q.y<=O&&q!==l&&q!==p&&Uo(m,b,g,w,x,M,q.x,q.y)&&Dt(q.prev,q,q.next)>=0||(q=q.prevZ,I.x>=C&&I.x<=k&&I.y>=E&&I.y<=O&&I!==l&&I!==p&&Uo(m,b,g,w,x,M,I.x,I.y)&&Dt(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;q&&q.z>=Z;){if(q.x>=C&&q.x<=k&&q.y>=E&&q.y<=O&&q!==l&&q!==p&&Uo(m,b,g,w,x,M,q.x,q.y)&&Dt(q.prev,q,q.next)>=0)return!1;q=q.prevZ}for(;I&&I.z<=ee;){if(I.x>=C&&I.x<=k&&I.y>=E&&I.y<=O&&I!==l&&I!==p&&Uo(m,b,g,w,x,M,I.x,I.y)&&Dt(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function Ed(n,t){let r=n;do{const s=r.prev,l=r.next.next;!ba(s,l)&&$h(s,r,r.next,l)&&Zo(s,l)&&Zo(l,s)&&(t.push(s.i,r.i,l.i),Go(r),Go(r.next),r=n=l),r=r.next}while(r!==n);return Es(r)}function Ad(n,t,r,s,l,d){let p=n;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&Ld(p,m)){let g=qh(p,m);return p=Es(p,p.next),g=Es(g,g.next),Vo(p,t,r,s,l,d,0),void Vo(g,t,r,s,l,d,0)}m=m.next}p=p.next}while(p!==n)}function zd(n,t){let r=n.x-t.x;return r===0&&(r=n.y-t.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function kd(n,t){const r=function(l,d){let p=d;const m=l.x,g=l.y;let x,b=-1/0;if(ba(l,p))return p;do{if(ba(l,p.next))return p.next;if(g<=p.y&&g>=p.next.y&&p.next.y!==p.y){const k=p.x+(g-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(k<=m&&k>b&&(b=k,x=p.x=p.x&&p.x>=M&&m!==p.x&&Gh(gx.x||p.x===x.x&&Dd(x,p)))&&(x=p,E=k)}p=p.next}while(p!==w);return x}(n,t);if(!r)return t;const s=qh(r,n);return Es(s,s.next),Es(r,r.next)}function Dd(n,t){return Dt(n.prev,n,t.prev)<0&&Dt(t.next,n,n.next)<0}function Jc(n,t,r,s,l){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*l|0)|n<<8))|n<<4))|n<<2))|n<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Rd(n){let t=n,r=n;do(t.x=(n-p)*(d-m)&&(n-p)*(s-m)>=(r-p)*(t-m)&&(r-p)*(d-m)>=(l-p)*(s-m)}function Uo(n,t,r,s,l,d,p,m){return!(n===p&&t===m)&&Gh(n,t,r,s,l,d,p,m)}function Ld(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&$h(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(n,t)&&(Zo(n,t)&&Zo(t,n)&&function(r,s){let l=r,d=!1;const p=(r.x+s.x)/2,m=(r.y+s.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&p<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==r);return d}(n,t)&&(Dt(n.prev,n,t.prev)||Dt(n,t.prev,t))||ba(n,t)&&Dt(n.prev,n,n.next)>0&&Dt(t.prev,t,t.next)>0)}function Dt(n,t,r){return(t.y-n.y)*(r.x-t.x)-(t.x-n.x)*(r.y-t.y)}function ba(n,t){return n.x===t.x&&n.y===t.y}function $h(n,t,r,s){const l=oc(Dt(n,t,r)),d=oc(Dt(n,t,s)),p=oc(Dt(r,s,n)),m=oc(Dt(r,s,t));return l!==d&&p!==m||!(l!==0||!ac(n,r,t))||!(d!==0||!ac(n,s,t))||!(p!==0||!ac(r,n,s))||!(m!==0||!ac(r,t,s))}function ac(n,t,r){return t.x<=Math.max(n.x,r.x)&&t.x>=Math.min(n.x,r.x)&&t.y<=Math.max(n.y,r.y)&&t.y>=Math.min(n.y,r.y)}function oc(n){return n>0?1:n<0?-1:0}function Zo(n,t){return Dt(n.prev,n,n.next)<0?Dt(n,t,n.next)>=0&&Dt(n,n.prev,t)>=0:Dt(n,t,n.prev)<0||Dt(n,n.next,t)<0}function qh(n,t){const r=Qc(n.i,n.x,n.y),s=Qc(t.i,t.x,t.y),l=n.next,d=t.prev;return n.next=t,t.prev=n,r.next=l,l.prev=r,s.next=r,r.prev=s,d.next=s,s.prev=d,s}function Hh(n,t,r,s){const l=Qc(n,t,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function Go(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Qc(n,t,r){return{i:n,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class wa{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(t),l=0|Math.round(r),d=this._getKey(s,l);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(s,l),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(l,d){const p=[];for(let m=0;m0?(p.push(g),p.push(b),p.push(x)):(p.push(g),p.push(x),p.push(b))}return p}(this._vertexBuffer,t);const r=[],s=t.length;for(let l=0;l=1||F<=0)||Z&&(xd)){w>=l&&w<=d&&p.push(s[(m+1)%3]);continue}!Z&&I>0&&p.push(this._vertexToIndex(g+E*I,x+k*I));const H=g+E*Math.max(I,0),ae=g+E*Math.min(F,1);O||this._generateIntraEdgeVertices(p,g,x,b,w,H,ae),!Z&&F<1&&p.push(this._vertexToIndex(g+E*F,x+k*F)),(Z||w>=l&&w<=d)&&p.push(s[(m+1)%3]),!Z&&(w<=l||w>=d)&&this._generateInterEdgeVertices(p,g,x,b,w,M,C,ae,l,d)}return p}_generateIntraEdgeVertices(t,r,s,l,d,p,m){const g=l-r,x=d-s,b=x===0,w=b?Math.min(r,l):Math.min(p,m),M=b?Math.max(r,l):Math.max(p,m),C=Math.floor(w/this._granularityCellSize)+1,E=Math.ceil(M/this._granularityCellSize)-1;if(b?r=C;k--){const O=k*this._granularityCellSize;t.push(this._vertexToIndex(O,s+x*(O-r)/g))}}_generateInterEdgeVertices(t,r,s,l,d,p,m,g,x,b){const w=d-s,M=p-l,C=m-d,E=(x-d)/C,k=(b-d)/C,O=Math.min(E,k),Z=Math.max(E,k),ee=l+M*O;let q=Math.floor(Math.min(ee,g)/this._granularityCellSize)+1,I=Math.ceil(Math.max(ee,g)/this._granularityCellSize)-1,F=g=1||Z<=0){const xe=s-m,ce=p+(r-p)*Math.min((x-m)/xe,(b-m)/xe);q=Math.floor(Math.min(ce,g)/this._granularityCellSize)+1,I=Math.ceil(Math.max(ce,g)/this._granularityCellSize)-1,F=g0?b:x;if(F)for(let xe=q;xe<=I;xe++)t.push(this._vertexToIndex(xe*this._granularityCellSize,ae));else for(let xe=I;xe>=q;xe--)t.push(this._vertexToIndex(xe*this._granularityCellSize,ae))}_generateOutline(t){const r=[];for(const s of t){const l=As(s,this._granularity,!0),d=this._pointArrayToIndices(l),p=[];for(let m=1;md!=(p===Ta)?(t.push(r),t.push(s),t.push(this._vertexToIndex(l,p)),t.push(s),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(l,p))):(t.push(s),t.push(r),t.push(this._vertexToIndex(l,p)),t.push(this._vertexToIndex(d,p)),t.push(s),t.push(this._vertexToIndex(l,p)))}_fillPoles(t,r,s){const l=this._vertexBuffer,d=rt,p=t.length;for(let m=2;m80*w){O=1/0,Z=1/0;let q=-1/0,I=-1/0;for(let F=w;Fq&&(q=H),ae>I&&(I=ae)}ee=Math.max(q-O,I-Z),ee=ee!==0?32767/ee:0}return Vo(E,k,w,O,Z,ee,0),k}(s,l),g=this._convertIndices(s,m);d=this._subdivideTrianglesScanline(g)}catch(m){console.error(m)}let p=[];return r&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,r){const s=[];for(let l=0;l0?(Math.floor(ae/p)+1)*p:(Math.ceil(ae/p)-1)*p,we=I>0?(Math.floor(xe/p)+1)*p:(Math.ceil(xe/p)-1)*p,be=Math.abs(ae-pe),Te=Math.abs(xe-we),_e=Math.abs(ae-k),ke=Math.abs(xe-O),Fe=Z?be/F:Number.POSITIVE_INFINITY,Be=ee?Te/H:Number.POSITIVE_INFINITY;if((_e<=be||!Z)&&(ke<=Te||!ee))break;if(Fe=0?p-1:d-1,x=(m+1)%d,b=n[2*t[g]],w=n[2*t[x]],M=n[2*t[p]],C=n[2*t[p]+1],E=n[2*t[m]+1];let k=!1;if(bw)k=!1;else{const O=E-C,Z=-(n[2*t[m]]-M),ee=C((w-M)*O+(n[2*t[x]+1]-C)*Z)*ee&&(k=!0)}if(k){const O=t[g],Z=t[p],ee=t[m];O!==Z&&O!==ee&&Z!==ee&&r.push(ee,Z,O),p--,p<0&&(p=d-1)}else{const O=t[x],Z=t[p],ee=t[m];O!==Z&&O!==ee&&Z!==ee&&r.push(ee,Z,O),m++,m>=d&&(m=0)}if(g===x)break}}function Wh(n,t,r,s,l,d,p,m,g){const x=l.length/2,b=p&&m&&g;if(xEe.MAX_VERTEX_ARRAY_LENGTH&&(I=w.createNewSegment(M,C),q=ee.count,pe=!0,we=!0,be=!0,F=0);const Te=qo(Z,E,O,ee,ae,pe,I),_e=qo(Z,E,O,ee,xe,we,I),ke=qo(Z,E,O,ee,ce,be,I);C.emplaceBack(F+Te-q,F+_e-q,F+ke-q),I.primitiveLength++}})(t,r,s,l,d,n),b&&function(w,M,C,E,k,O){const Z=[];for(let H=0;HEe.MAX_VERTEX_ARRAY_LENGTH&&(I=w.createNewSegment(M,C),q=ee.count,we=!0,be=!0,F=0);const Te=qo(Z,E,O,ee,ce,we,I),_e=qo(Z,E,O,ee,pe,be,I);C.emplaceBack(F+Te-q,F+_e-q),I.primitiveLength++}}}(p,r,m,l,g,n),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function qo(n,t,r,s,l,d,p){if(d){const m=s.count;return r(t[2*l],t[2*l+1]),n[l]=s.count,s.count++,p.vertexLength++,m}return n[l]}class eh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new G,this.indexArray=new de,this.indexArray2=new Se,this.programConfigurations=new Tt(t.layers,t.zoom),this.segments=new Ee,this.segments2=new Ee,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=Kc("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:b}of t){const w=this.layers[0]._featureFilter.needGeometry,M=_n(m,w);if(!this.layers[0]._featureFilter.filter(new yt(this.zoom),M,s))continue;const C=d?l.evaluate(M,{},s,r.availableImages):void 0,E={id:g,properties:m.properties,type:m.type,sourceLayerIndex:b,index:x,geometry:w?M.geometry:mn(m),patterns:{},sortKey:C};p.push(E)}d&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:b}=m;if(this.hasPattern){const w=Yc("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(m,g,x,s,{},r.subdivisionGranularity);r.featureIndex.insert(t[x].feature,g,x,b,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Sd),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,s,l,d,p){for(const m of Us(r,500)){const g=Xh(m,l,p.fill.getGranularityForZoomLevel(l.z)),x=this.layoutVertexArray;Wh((b,w)=>{x.emplaceBack(b,w)},this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,d,l)}}let Kh,Yh;Ae("FillBucket",eh,{omit:["layers","patternFeatures"]});var Od={get paint(){return Yh=Yh||new ui({"fill-antialias":new Le(j.paint_fill["fill-antialias"]),"fill-opacity":new Ne(j.paint_fill["fill-opacity"]),"fill-color":new Ne(j.paint_fill["fill-color"]),"fill-outline-color":new Ne(j.paint_fill["fill-outline-color"]),"fill-translate":new Le(j.paint_fill["fill-translate"]),"fill-translate-anchor":new Le(j.paint_fill["fill-translate-anchor"]),"fill-pattern":new vs(j.paint_fill["fill-pattern"])})},get layout(){return Kh=Kh||new ui({"fill-sort-key":new Ne(j.layout_fill["fill-sort-key"])})}};class jd extends Ki{constructor(t){super(t,Od)}recalculate(t,r){super.recalculate(t,r);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new eh(t)}queryRadius(){return nc(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:s,pixelsToTileUnits:l}){return Fo(sc(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,l),r)}isTileClipped(){return!0}}const Nd=kt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Vd=kt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Ud}=Nd;var th,Jh,ih,Qh,rh,eu,tu,cc={};function iu(){if(Jh)return th;Jh=1;var n=mr();function t(l,d,p,m,g){this.properties={},this.extent=p,this.type=0,this._pbf=l,this._geometry=-1,this._keys=m,this._values=g,l.readFields(r,this,d)}function r(l,d,p){l==1?d.id=p.readVarint():l==2?function(m,g){for(var x=m.readVarint()+m.pos;m.pos>3}if(g--,m===1||m===2)x+=l.readSVarint(),b+=l.readSVarint(),m===1&&(d&&w.push(d),d=[]),d.push(new n(x,b));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&w.push(d),w},t.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var d=l.readVarint()+l.pos,p=1,m=0,g=0,x=0,b=1/0,w=-1/0,M=1/0,C=-1/0;l.pos>3}if(m--,p===1||p===2)(g+=l.readSVarint())w&&(w=g),(x+=l.readSVarint())C&&(C=x);else if(p!==7)throw new Error("unknown command "+p)}return[b,M,w,C]},t.prototype.toGeoJSON=function(l,d,p){var m,g,x=this.extent*Math.pow(2,p),b=this.extent*l,w=this.extent*d,M=this.loadGeometry(),C=t.types[this.type];function E(Z){for(var ee=0;ee>3;m=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return m}(d))}return ih=t,t.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var l=this._pbf.readVarint()+this._pbf.pos;return new n(this._pbf,l,this.extent,this._keys,this._values)},ih}function nu(){return tu||(tu=1,cc.VectorTile=function(){if(eu)return rh;eu=1;var n=ru();function t(r,s,l){if(r===3){var d=new n(l,l.readVarint()+l.pos);d.length&&(s[d.name]=d)}}return rh=function(r,s){this.layers=r.readFields(t,{},s)},rh}(),cc.VectorTileFeature=iu(),cc.VectorTileLayer=ru()),cc}var Ho=Pi(nu());const Zd=Ho.VectorTileFeature.types,nh=Math.pow(2,13);function Xo(n,t,r,s,l,d,p,m){n.emplaceBack(t,r,2*Math.floor(s*nh)+p,l*nh*2,d*nh*2,Math.round(m))}class sh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new X,this.centroidVertexArray=new N,this.indexArray=new de,this.programConfigurations=new Tt(t.layers,t.zoom),this.segments=new Ee,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.features=[],this.hasPattern=Kc("fill-extrusion",this.layers,r);for(const{feature:l,id:d,index:p,sourceLayerIndex:m}of t){const g=this.layers[0]._featureFilter.needGeometry,x=_n(l,g);if(!this.layers[0]._featureFilter.filter(new yt(this.zoom),x,s))continue;const b={id:d,sourceLayerIndex:m,index:p,geometry:g?x.geometry:mn(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(Yc("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,p,s,{},r.subdivisionGranularity),r.featureIndex.insert(l,b.geometry,p,m,this.index,!0)}}addFeatures(t,r,s){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,l.index,r,s,t.subdivisionGranularity)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ud),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Vd.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,s,l,d,p){for(const m of Us(r,500)){const g={x:0,y:0,sampleCount:0},x=this.layoutVertexArray.length;this.processPolygon(g,l,t,m,p);const b=this.layoutVertexArray.length-x,w=Math.floor(g.x/g.sampleCount),M=Math.floor(g.y/g.sampleCount);for(let C=0;C{Xo(b,w,M,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,x.verticesFlattened,x.indicesTriangles)}_generateSideFaces(t,r){let s=0;for(let l=1;lEe.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const m=d.sub(p)._perp()._unit(),g=p.dist(d);s+g>32768&&(s=0),Xo(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,s),Xo(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,s),s+=g,Xo(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,s),Xo(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,s);const x=r.segment.vertexLength;this.indexArray.emplaceBack(x,x+2,x+1),this.indexArray.emplaceBack(x+1,x+2,x+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function Gd(n,t){for(let r=0;rrt)||n.y===t.y&&(n.y<0||n.y>rt)}function su(n){return n.every(t=>t.x<0)||n.every(t=>t.x>rt)||n.every(t=>t.y<0)||n.every(t=>t.y>rt)}let au;Ae("FillExtrusionBucket",sh,{omit:["layers","features"]});var qd={get paint(){return au=au||new ui({"fill-extrusion-opacity":new Le(j["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ne(j["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Le(j["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Le(j["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new vs(j["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ne(j["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ne(j["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Le(j["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Hd extends Ki{constructor(t){super(t,qd)}createBucket(t){return new sh(t)}queryRadius(){return nc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:l,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const g=sc(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),x=this.paint.get("fill-extrusion-height").evaluate(r,s),b=this.paint.get("fill-extrusion-base").evaluate(r,s),w=function(C,E,k){const O=[];for(const Z of C){const ee=[Z.x,Z.y,0,1];Ji(ee,ee,E),O.push(new Oe(ee[0]/ee[3],ee[1]/ee[3]))}return O}(g,m),M=function(C,E,k,O){const Z=[],ee=[],q=O[8]*E,I=O[9]*E,F=O[10]*E,H=O[11]*E,ae=O[8]*k,xe=O[9]*k,ce=O[10]*k,pe=O[11]*k;for(const we of C){const be=[],Te=[];for(const _e of we){const ke=_e.x,Fe=_e.y,Be=O[0]*ke+O[4]*Fe+O[12],Re=O[1]*ke+O[5]*Fe+O[13],Ke=O[2]*ke+O[6]*Fe+O[14],It=O[3]*ke+O[7]*Fe+O[15],Zt=Ke+F,ai=It+H,Ui=Be+ae,wi=Re+xe,Yt=Ke+ce,Pt=It+pe,$t=new Oe((Be+q)/ai,(Re+I)/ai);$t.z=Zt/ai,be.push($t);const Jt=new Oe(Ui/Pt,wi/Pt);Jt.z=Yt/Pt,Te.push(Jt)}Z.push(be),ee.push(Te)}return[Z,ee]}(l,b,x,m);return function(C,E,k){let O=1/0;Fo(k,E)&&(O=ou(k,E[0]));for(let Z=0;Zr.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new W,this.layoutVertexArray2=new K,this.indexArray=new de,this.programConfigurations=new Tt(t.layers,t.zoom),this.segments=new Ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=Kc("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:b}of t){const w=this.layers[0]._featureFilter.needGeometry,M=_n(m,w);if(!this.layers[0]._featureFilter.filter(new yt(this.zoom),M,s))continue;const C=d?l.evaluate(M,{},s):void 0,E={id:g,properties:m.properties,type:m.type,sourceLayerIndex:b,index:x,geometry:w?M.geometry:mn(m),patterns:{},sortKey:C};p.push(E)}d&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:b}=m;if(this.hasPattern){const w=Yc("line",this.layers,m,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(m,g,x,s,{},r.subdivisionGranularity);r.featureIndex.insert(t[x].feature,g,x,b,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Yd)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wd),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,s,l,d,p){const m=this.layers[0].layout,g=m.get("line-join").evaluate(t,{}),x=m.get("line-cap"),b=m.get("line-miter-limit"),w=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const M of r)this.addLine(M,t,g,x,b,w,l,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,d,l)}addLine(t,r,s,l,d,p,m,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=As(t,m?g.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let q=0;q=2&&t[b-1].equals(t[b-2]);)b--;let w=0;for(;w0;if(ce&&q>w){const Te=E.dist(k);if(Te>2*M){const _e=E.sub(E.sub(k)._mult(M/Te)._round());this.updateDistance(k,_e),this.addCurrentVertex(_e,Z,0,0,C),k=_e}}const we=k&&O;let be=we?s:x?"butt":l;if(we&&be==="round"&&(aed&&(be="bevel"),be==="bevel"&&(ae>2&&(be="flipbevel"),ae100)I=ee.mult(-1);else{const Te=ae*Z.add(ee).mag()/Z.sub(ee).mag();I._perp()._mult(Te*(pe?-1:1))}this.addCurrentVertex(E,I,0,0,C),this.addCurrentVertex(E,I.mult(-1),0,0,C)}else if(be==="bevel"||be==="fakeround"){const Te=-Math.sqrt(ae*ae-1),_e=pe?Te:0,ke=pe?0:Te;if(k&&this.addCurrentVertex(E,Z,_e,ke,C),be==="fakeround"){const Fe=Math.round(180*xe/Math.PI/20);for(let Be=1;Be2*M){const _e=E.add(O.sub(E)._mult(M/Te)._round());this.updateDistance(E,_e),this.addCurrentVertex(_e,ee,0,0,C),E=_e}}}}addCurrentVertex(t,r,s,l,d,p=!1){const m=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*s,r.y-r.x*s,p,!1,s,d),this.addHalfVertex(t,m,g,p,!0,-l,d),this.distance>lu/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,s,l,d,p))}addHalfVertex({x:t,y:r},s,l,d,p,m,g){const x=.5*(this.lineClips?this.scaledDistance*(lu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const b=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,b,this.e2),g.primitiveLength++),p?this.e2=b:this.e1=b}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let cu,hu;Ae("LineBucket",ah,{omit:["layers","patternFeatures"]});var uu={get paint(){return hu=hu||new ui({"line-opacity":new Ne(j.paint_line["line-opacity"]),"line-color":new Ne(j.paint_line["line-color"]),"line-translate":new Le(j.paint_line["line-translate"]),"line-translate-anchor":new Le(j.paint_line["line-translate-anchor"]),"line-width":new Ne(j.paint_line["line-width"]),"line-gap-width":new Ne(j.paint_line["line-gap-width"]),"line-offset":new Ne(j.paint_line["line-offset"]),"line-blur":new Ne(j.paint_line["line-blur"]),"line-dasharray":new ma(j.paint_line["line-dasharray"]),"line-pattern":new vs(j.paint_line["line-pattern"]),"line-gradient":new _a(j.paint_line["line-gradient"])})},get layout(){return cu=cu||new ui({"line-cap":new Le(j.layout_line["line-cap"]),"line-join":new Ne(j.layout_line["line-join"]),"line-miter-limit":new Le(j.layout_line["line-miter-limit"]),"line-round-limit":new Le(j.layout_line["line-round-limit"]),"line-sort-key":new Ne(j.layout_line["line-sort-key"])})}};class ep extends Ne{possiblyEvaluate(t,r){return r=new yt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,s,l){return r=Wt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,s,l)}}let hc;class tp extends Ki{constructor(t){super(t,uu),this.gradientVersion=0,hc||(hc=new ep(uu.paint.properties["line-width"].specification),hc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof nn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=hc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ah(t)}queryRadius(t){const r=t,s=du(jo("line-width",this,r),jo("line-gap-width",this,r)),l=jo("line-offset",this,r);return s/2+Math.abs(l)+nc(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:s,geometry:l,transform:d,pixelsToTileUnits:p}){const m=sc(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),g=p/2*du(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),x=this.paint.get("line-offset").evaluate(r,s);return x&&(l=function(b,w){const M=[];for(let C=0;C=3){for(let k=0;k0?t+2*n:n}const ip=kt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rp=kt([{name:"a_projected_pos",components:3,type:"Float32"}],4);kt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const np=kt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);kt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const pu=kt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),sp=kt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ap(n,t,r){return n.sections.forEach(s=>{s.text=function(l,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),ar.applyArabicShaping&&(l=ar.applyArabicShaping(l)),l}(s.text,t,r)}),n}kt([{name:"triangle",components:3,type:"Uint16"}]),kt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),kt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),kt([{type:"Float32",name:"offsetX"}]),kt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),kt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ko={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var fu,oh,mu,Ut=24,lh={};function op(){return fu||(fu=1,lh.read=function(n,t,r,s,l){var d,p,m=8*l-s-1,g=(1<>1,b=-7,w=r?l-1:0,M=r?-1:1,C=n[t+w];for(w+=M,d=C&(1<<-b)-1,C>>=-b,b+=m;b>0;d=256*d+n[t+w],w+=M,b-=8);for(p=d&(1<<-b)-1,d>>=-b,b+=s;b>0;p=256*p+n[t+w],w+=M,b-=8);if(d===0)d=1-x;else{if(d===g)return p?NaN:1/0*(C?-1:1);p+=Math.pow(2,s),d-=x}return(C?-1:1)*p*Math.pow(2,d-s)},lh.write=function(n,t,r,s,l,d){var p,m,g,x=8*d-l-1,b=(1<>1,M=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=s?0:d-1,E=s?1:-1,k=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=b):(p=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-p))<1&&(p--,g*=2),(t+=p+w>=1?M/g:M*Math.pow(2,1-w))*g>=2&&(p++,g/=2),p+w>=b?(m=0,p=b):p+w>=1?(m=(t*g-1)*Math.pow(2,l),p+=w):(m=t*Math.pow(2,w-1)*Math.pow(2,l),p=0));l>=8;n[r+C]=255&m,C+=E,m/=256,l-=8);for(p=p<0;n[r+C]=255&p,C+=E,p/=256,x-=8);n[r+C-E]|=128*k}),lh}function _u(){if(mu)return oh;mu=1,oh=t;var n=op();function t(I){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(I)?I:new Uint8Array(I||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var r=4294967296,s=1/r,l=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(I){return I.type===t.Bytes?I.readVarint()+I.pos:I.pos+1}function p(I,F,H){return H?4294967296*F+(I>>>0):4294967296*(F>>>0)+(I>>>0)}function m(I,F,H){var ae=F<=16383?1:F<=2097151?2:F<=268435455?3:Math.floor(Math.log(F)/(7*Math.LN2));H.realloc(ae);for(var xe=H.pos-1;xe>=I;xe--)H.buf[xe+ae]=H.buf[xe]}function g(I,F){for(var H=0;H>>8,I[H+2]=F>>>16,I[H+3]=F>>>24}function q(I,F){return(I[F]|I[F+1]<<8|I[F+2]<<16)+(I[F+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(I,F,H){for(H=H||this.length;this.pos>3,ce=this.pos;this.type=7&ae,I(xe,F,this),this.pos===ce&&this.skip(ae)}return F},readMessage:function(I,F){return this.readFields(I,F,this.readVarint()+this.pos)},readFixed32:function(){var I=Z(this.buf,this.pos);return this.pos+=4,I},readSFixed32:function(){var I=q(this.buf,this.pos);return this.pos+=4,I},readFixed64:function(){var I=Z(this.buf,this.pos)+Z(this.buf,this.pos+4)*r;return this.pos+=8,I},readSFixed64:function(){var I=Z(this.buf,this.pos)+q(this.buf,this.pos+4)*r;return this.pos+=8,I},readFloat:function(){var I=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,I},readDouble:function(){var I=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,I},readVarint:function(I){var F,H,ae=this.buf;return F=127&(H=ae[this.pos++]),H<128?F:(F|=(127&(H=ae[this.pos++]))<<7,H<128?F:(F|=(127&(H=ae[this.pos++]))<<14,H<128?F:(F|=(127&(H=ae[this.pos++]))<<21,H<128?F:function(xe,ce,pe){var we,be,Te=pe.buf;if(we=(112&(be=Te[pe.pos++]))>>4,be<128||(we|=(127&(be=Te[pe.pos++]))<<3,be<128)||(we|=(127&(be=Te[pe.pos++]))<<10,be<128)||(we|=(127&(be=Te[pe.pos++]))<<17,be<128)||(we|=(127&(be=Te[pe.pos++]))<<24,be<128)||(we|=(1&(be=Te[pe.pos++]))<<31,be<128))return p(xe,we,ce);throw new Error("Expected varint not more than 10 bytes")}(F|=(15&(H=ae[this.pos]))<<28,I,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var I=this.readVarint();return I%2==1?(I+1)/-2:I/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var I=this.readVarint()+this.pos,F=this.pos;return this.pos=I,I-F>=12&&l?function(H,ae,xe){return l.decode(H.subarray(ae,xe))}(this.buf,F,I):function(H,ae,xe){for(var ce="",pe=ae;pe239?4:_e>223?3:_e>191?2:1;if(pe+Fe>xe)break;Fe===1?_e<128&&(ke=_e):Fe===2?(192&(we=H[pe+1]))==128&&(ke=(31&_e)<<6|63&we)<=127&&(ke=null):Fe===3?(be=H[pe+2],(192&(we=H[pe+1]))==128&&(192&be)==128&&((ke=(15&_e)<<12|(63&we)<<6|63&be)<=2047||ke>=55296&&ke<=57343)&&(ke=null)):Fe===4&&(be=H[pe+2],Te=H[pe+3],(192&(we=H[pe+1]))==128&&(192&be)==128&&(192&Te)==128&&((ke=(15&_e)<<18|(63&we)<<12|(63&be)<<6|63&Te)<=65535||ke>=1114112)&&(ke=null)),ke===null?(ke=65533,Fe=1):ke>65535&&(ke-=65536,ce+=String.fromCharCode(ke>>>10&1023|55296),ke=56320|1023&ke),ce+=String.fromCharCode(ke),pe+=Fe}return ce}(this.buf,F,I)},readBytes:function(){var I=this.readVarint()+this.pos,F=this.buf.subarray(this.pos,I);return this.pos=I,F},readPackedVarint:function(I,F){if(this.type!==t.Bytes)return I.push(this.readVarint(F));var H=d(this);for(I=I||[];this.pos127;);else if(F===t.Bytes)this.pos=this.readVarint()+this.pos;else if(F===t.Fixed32)this.pos+=4;else{if(F!==t.Fixed64)throw new Error("Unimplemented type: "+F);this.pos+=8}},writeTag:function(I,F){this.writeVarint(I<<3|F)},realloc:function(I){for(var F=this.length||16;F268435455||I<0?function(F,H){var ae,xe;if(F>=0?(ae=F%4294967296|0,xe=F/4294967296|0):(xe=~(-F/4294967296),4294967295^(ae=~(-F%4294967296))?ae=ae+1|0:(ae=0,xe=xe+1|0)),F>=18446744073709552e3||F<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");H.realloc(10),function(ce,pe,we){we.buf[we.pos++]=127&ce|128,ce>>>=7,we.buf[we.pos++]=127&ce|128,ce>>>=7,we.buf[we.pos++]=127&ce|128,ce>>>=7,we.buf[we.pos++]=127&ce|128,we.buf[we.pos]=127&(ce>>>=7)}(ae,0,H),function(ce,pe){var we=(7&ce)<<4;pe.buf[pe.pos++]|=we|((ce>>>=3)?128:0),ce&&(pe.buf[pe.pos++]=127&ce|((ce>>>=7)?128:0),ce&&(pe.buf[pe.pos++]=127&ce|((ce>>>=7)?128:0),ce&&(pe.buf[pe.pos++]=127&ce|((ce>>>=7)?128:0),ce&&(pe.buf[pe.pos++]=127&ce|((ce>>>=7)?128:0),ce&&(pe.buf[pe.pos++]=127&ce)))))}(xe,H)}(I,this):(this.realloc(4),this.buf[this.pos++]=127&I|(I>127?128:0),I<=127||(this.buf[this.pos++]=127&(I>>>=7)|(I>127?128:0),I<=127||(this.buf[this.pos++]=127&(I>>>=7)|(I>127?128:0),I<=127||(this.buf[this.pos++]=I>>>7&127))))},writeSVarint:function(I){this.writeVarint(I<0?2*-I-1:2*I)},writeBoolean:function(I){this.writeVarint(!!I)},writeString:function(I){I=String(I),this.realloc(4*I.length),this.pos++;var F=this.pos;this.pos=function(ae,xe,ce){for(var pe,we,be=0;be55295&&pe<57344){if(!we){pe>56319||be+1===xe.length?(ae[ce++]=239,ae[ce++]=191,ae[ce++]=189):we=pe;continue}if(pe<56320){ae[ce++]=239,ae[ce++]=191,ae[ce++]=189,we=pe;continue}pe=we-55296<<10|pe-56320|65536,we=null}else we&&(ae[ce++]=239,ae[ce++]=191,ae[ce++]=189,we=null);pe<128?ae[ce++]=pe:(pe<2048?ae[ce++]=pe>>6|192:(pe<65536?ae[ce++]=pe>>12|224:(ae[ce++]=pe>>18|240,ae[ce++]=pe>>12&63|128),ae[ce++]=pe>>6&63|128),ae[ce++]=63&pe|128)}return ce}(this.buf,I,this.pos);var H=this.pos-F;H>=128&&m(F,H,this),this.pos=F-1,this.writeVarint(H),this.pos+=H},writeFloat:function(I){this.realloc(4),n.write(this.buf,I,this.pos,!0,23,4),this.pos+=4},writeDouble:function(I){this.realloc(8),n.write(this.buf,I,this.pos,!0,52,8),this.pos+=8},writeBytes:function(I){var F=I.length;this.writeVarint(F),this.realloc(F);for(var H=0;H=128&&m(H,ae,this),this.pos=H-1,this.writeVarint(ae),this.pos+=ae},writeMessage:function(I,F,H){this.writeTag(I,t.Bytes),this.writeRawMessage(F,H)},writePackedVarint:function(I,F){F.length&&this.writeMessage(I,g,F)},writePackedSVarint:function(I,F){F.length&&this.writeMessage(I,x,F)},writePackedBoolean:function(I,F){F.length&&this.writeMessage(I,M,F)},writePackedFloat:function(I,F){F.length&&this.writeMessage(I,b,F)},writePackedDouble:function(I,F){F.length&&this.writeMessage(I,w,F)},writePackedFixed32:function(I,F){F.length&&this.writeMessage(I,C,F)},writePackedSFixed32:function(I,F){F.length&&this.writeMessage(I,E,F)},writePackedFixed64:function(I,F){F.length&&this.writeMessage(I,k,F)},writePackedSFixed64:function(I,F){F.length&&this.writeMessage(I,O,F)},writeBytesField:function(I,F){this.writeTag(I,t.Bytes),this.writeBytes(F)},writeFixed32Field:function(I,F){this.writeTag(I,t.Fixed32),this.writeFixed32(F)},writeSFixed32Field:function(I,F){this.writeTag(I,t.Fixed32),this.writeSFixed32(F)},writeFixed64Field:function(I,F){this.writeTag(I,t.Fixed64),this.writeFixed64(F)},writeSFixed64Field:function(I,F){this.writeTag(I,t.Fixed64),this.writeSFixed64(F)},writeVarintField:function(I,F){this.writeTag(I,t.Varint),this.writeVarint(F)},writeSVarintField:function(I,F){this.writeTag(I,t.Varint),this.writeSVarint(F)},writeStringField:function(I,F){this.writeTag(I,t.Bytes),this.writeString(F)},writeFloatField:function(I,F){this.writeTag(I,t.Fixed32),this.writeFloat(F)},writeDoubleField:function(I,F){this.writeTag(I,t.Fixed64),this.writeDouble(F)},writeBooleanField:function(I,F){this.writeVarintField(I,!!F)}},oh}var ch=Pi(_u());const hh=3;function lp(n,t,r){n===1&&r.readMessage(cp,t)}function cp(n,t,r){if(n===3){const{id:s,bitmap:l,width:d,height:p,left:m,top:g,advance:x}=r.readMessage(hp,{});t.push({id:s,bitmap:new No({width:d+2*hh,height:p+2*hh},l),metrics:{width:d,height:p,left:m,top:g,advance:x}})}}function hp(n,t,r){n===1?t.id=r.readVarint():n===2?t.bitmap=r.readBytes():n===3?t.width=r.readVarint():n===4?t.height=r.readVarint():n===5?t.left=r.readSVarint():n===6?t.top=r.readSVarint():n===7&&(t.advance=r.readVarint())}const up=hh;function gu(n){let t=0,r=0;for(const p of n)t+=p.w*p.h,r=Math.max(r,p.w);n.sort((p,m)=>m.h-p.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let l=0,d=0;for(const p of n)for(let m=s.length-1;m>=0;m--){const g=s[m];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,d=Math.max(d,p.y+p.h),l=Math.max(l,p.x+p.w),p.w===g.w&&p.h===g.h){const x=s.pop();m=0&&s>=t&&pc[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const s=new Pa;return s.text=this.text.substring(t,r),s.sectionIndex=this.sectionIndex.slice(t,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,s=0;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function dc(n,t,r,s,l,d,p,m,g,x,b,w,M,C,E){const k=Pa.fromFeature(n,l);let O;w===z.ai.vertical&&k.verticalizePunctuation();const{processBidirectionalText:Z,processStyledBidirectionalText:ee}=ar;if(Z&&k.sections.length===1){O=[];const F=Z(k.toString(),dh(k,x,d,t,s,C));for(const H of F){const ae=new Pa;ae.text=H,ae.sections=k.sections;for(let xe=0;xe=0;let x=0;for(let w=0;wx){const b=Math.ceil(d/x);l*=b/p,p=b}return{x1:s,y1:l,x2:s+d,y2:l+p}}function Mu(n,t,r,s,l,d){const p=n.image;let m;if(p.content){const O=p.content,Z=p.pixelRatio||1;m=[O[0]/Z,O[1]/Z,p.displaySize[0]-O[2]/Z,p.displaySize[1]-O[3]/Z]}const g=t.left*d,x=t.right*d;let b,w,M,C;r==="width"||r==="both"?(C=l[0]+g-s[3],w=l[0]+x+s[1]):(C=l[0]+(g+x-p.displaySize[0])/2,w=C+p.displaySize[0]);const E=t.top*d,k=t.bottom*d;return r==="height"||r==="both"?(b=l[1]+E-s[0],M=l[1]+k+s[2]):(b=l[1]+(E+k-p.displaySize[1])/2,M=b+p.displaySize[1]),{image:p,top:b,right:w,bottom:M,left:C,collisionPadding:m}}const Jo=255,kr=128,Gn=Jo*kr;function Su(n,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new yt(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:l}=r;let d=0;for(;dp.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Su(this.zoom,r["text-size"]),this.iconSizeData=Su(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=fh(s,"text-overlap","text-allow-overlap")!=="never"||fh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(p=>z.ai[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new _h(new Tt(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new _h(new Tt(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new T,this.lineVertexArray=new P,this.symbolInstances=new v,this.textAnchorOffsets=new A}calculateGlyphDependencies(t,r,s,l,d){for(let p=0;p0)&&(p.value.kind!=="constant"||p.value.value.length>0),b=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,w=d.get("symbol-sort-key");if(this.features=[],!x&&!b)return;const M=r.iconDependencies,C=r.glyphDependencies,E=r.availableImages,k=new yt(this.zoom);for(const{feature:O,id:Z,index:ee,sourceLayerIndex:q}of t){const I=l._featureFilter.needGeometry,F=_n(O,I);if(!l._featureFilter.filter(k,F,s))continue;let H,ae;if(I||(F.geometry=mn(O)),x){const ce=l.getValueAndResolveTokens("text-field",F,s,E),pe=Et.factory(ce),we=this.hasRTLText=this.hasRTLText||Tp(pe);(!we||ar.getRTLTextPluginStatus()==="unavailable"||we&&ar.isParsed())&&(H=ap(pe,l,F))}if(b){const ce=l.getValueAndResolveTokens("icon-image",F,s,E);ae=ce instanceof ri?ce:ri.fromString(ce)}if(!H&&!ae)continue;const xe=this.sortFeaturesByKey?w.evaluate(F,{},s):void 0;if(this.features.push({id:Z,text:H,icon:ae,index:ee,sourceLayerIndex:q,geometry:F.geometry,properties:O.properties,type:bp[O.type],sortKey:xe}),ae&&(M[ae.name]=!0),H){const ce=p.evaluate(F,{},s).join(","),pe=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(z.ai.vertical)>=0;for(const we of H.sections)if(we.image)M[we.image.name]=!0;else{const be=On(H.toString()),Te=we.fontStack||ce,_e=C[Te]=C[Te]||{};this.calculateGlyphDependencies(we.text,_e,pe,this.allowVerticalPlacement,be)}}}d.get("symbol-placement")==="line"&&(this.features=function(O){const Z={},ee={},q=[];let I=0;function F(ce){q.push(O[ce]),I++}function H(ce,pe,we){const be=ee[ce];return delete ee[ce],ee[pe]=be,q[be].geometry[0].pop(),q[be].geometry[0]=q[be].geometry[0].concat(we[0]),be}function ae(ce,pe,we){const be=Z[pe];return delete Z[pe],Z[ce]=be,q[be].geometry[0].shift(),q[be].geometry[0]=we[0].concat(q[be].geometry[0]),be}function xe(ce,pe,we){const be=we?pe[0][pe[0].length-1]:pe[0][0];return`${ce}:${be.x}:${be.y}`}for(let ce=0;cece.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((O,Z)=>O.sortKey-Z.sortKey)}update(t,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){const s=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),d=t.dist(r[t.segment]);const p={};for(let m=t.segment+1;m=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){const s=t.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let d=s.vertexStartIndex;dl[m]-l[g]||d[g]-d[m]),p}addToSortKeyRanges(t,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,d,p)=>{l>=0&&p.indexOf(l)===d&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Iu,Cu;Ae("SymbolBucket",Ma,{omit:["layers","collisionBoxArray","features","compareText"]}),Ma.MAX_GLYPHS=65535,Ma.addDynamicAttributes=mh;var yh={get paint(){return Cu=Cu||new ui({"icon-opacity":new Ne(j.paint_symbol["icon-opacity"]),"icon-color":new Ne(j.paint_symbol["icon-color"]),"icon-halo-color":new Ne(j.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ne(j.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ne(j.paint_symbol["icon-halo-blur"]),"icon-translate":new Le(j.paint_symbol["icon-translate"]),"icon-translate-anchor":new Le(j.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ne(j.paint_symbol["text-opacity"]),"text-color":new Ne(j.paint_symbol["text-color"],{runtimeType:qe,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new Ne(j.paint_symbol["text-halo-color"]),"text-halo-width":new Ne(j.paint_symbol["text-halo-width"]),"text-halo-blur":new Ne(j.paint_symbol["text-halo-blur"]),"text-translate":new Le(j.paint_symbol["text-translate"]),"text-translate-anchor":new Le(j.paint_symbol["text-translate-anchor"])})},get layout(){return Iu=Iu||new ui({"symbol-placement":new Le(j.layout_symbol["symbol-placement"]),"symbol-spacing":new Le(j.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Le(j.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ne(j.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Le(j.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Le(j.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Le(j.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Le(j.layout_symbol["icon-ignore-placement"]),"icon-optional":new Le(j.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Le(j.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ne(j.layout_symbol["icon-size"]),"icon-text-fit":new Le(j.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Le(j.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ne(j.layout_symbol["icon-image"]),"icon-rotate":new Ne(j.layout_symbol["icon-rotate"]),"icon-padding":new Ne(j.layout_symbol["icon-padding"]),"icon-keep-upright":new Le(j.layout_symbol["icon-keep-upright"]),"icon-offset":new Ne(j.layout_symbol["icon-offset"]),"icon-anchor":new Ne(j.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Le(j.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Le(j.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Le(j.layout_symbol["text-rotation-alignment"]),"text-field":new Ne(j.layout_symbol["text-field"]),"text-font":new Ne(j.layout_symbol["text-font"]),"text-size":new Ne(j.layout_symbol["text-size"]),"text-max-width":new Ne(j.layout_symbol["text-max-width"]),"text-line-height":new Le(j.layout_symbol["text-line-height"]),"text-letter-spacing":new Ne(j.layout_symbol["text-letter-spacing"]),"text-justify":new Ne(j.layout_symbol["text-justify"]),"text-radial-offset":new Ne(j.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Le(j.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ne(j.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ne(j.layout_symbol["text-anchor"]),"text-max-angle":new Le(j.layout_symbol["text-max-angle"]),"text-writing-mode":new Le(j.layout_symbol["text-writing-mode"]),"text-rotate":new Ne(j.layout_symbol["text-rotate"]),"text-padding":new Le(j.layout_symbol["text-padding"]),"text-keep-upright":new Le(j.layout_symbol["text-keep-upright"]),"text-transform":new Ne(j.layout_symbol["text-transform"]),"text-offset":new Ne(j.layout_symbol["text-offset"]),"text-allow-overlap":new Le(j.layout_symbol["text-allow-overlap"]),"text-overlap":new Le(j.layout_symbol["text-overlap"]),"text-ignore-placement":new Le(j.layout_symbol["text-ignore-placement"]),"text-optional":new Le(j.layout_symbol["text-optional"])})}};class Eu{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Ue,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ae("FormatSectionOverride",Eu,{omit:["defaultValue"]});class mc extends Ki{constructor(t){super(t,yh)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const l=[];for(const d of s)l.indexOf(d)<0&&l.push(d);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,s,l){const d=this.layout.get(t).evaluate(r,{},s,l),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||Js(p.value)||!d?d:function(m,g){return g.replace(/{([^{}]+)}/g,(x,b)=>m&&b in m?String(m[b]):"")}(r.properties,d)}createBucket(t){return new Ma(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of yh.paint.overridableProperties){if(!mc.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),s=new Eu(r),l=new Ys(s,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new zn("source",l):new ea("composite",l,r.value.zoomStops),this.paint._values[t]=new Wi(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&mc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const s=t.get("text-field"),l=yh.paint.properties[r];let d=!1;const p=m=>{for(const g of m)if(l.overrides&&l.overrides.hasOverride(g))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Et)p(s.value.value.sections);else if(s.value.kind==="source"){const m=x=>{d||(x instanceof Xi&&ut(x.value)===Mr?p(x.value.sections):x instanceof ls?p(x.sections):x.eachChild(m))},g=s.value;g._styleExpression&&m(g._styleExpression.expression)}return d}}let Au;var Pp={get paint(){return Au=Au||new ui({"background-color":new Le(j.paint_background["background-color"]),"background-pattern":new ma(j.paint_background["background-pattern"]),"background-opacity":new Le(j.paint_background["background-opacity"])})}};class Mp extends Ki{constructor(t){super(t,Pp)}}let zu;var Sp={get paint(){return zu=zu||new ui({"raster-opacity":new Le(j.paint_raster["raster-opacity"]),"raster-hue-rotate":new Le(j.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Le(j.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Le(j.paint_raster["raster-brightness-max"]),"raster-saturation":new Le(j.paint_raster["raster-saturation"]),"raster-contrast":new Le(j.paint_raster["raster-contrast"]),"raster-resampling":new Le(j.paint_raster["raster-resampling"]),"raster-fade-duration":new Le(j.paint_raster["raster-fade-duration"])})}};class Ip extends Ki{constructor(t){super(t,Sp)}}class Cp extends Ki{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Ep{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const xh=63710088e-1;class $n{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $n(Ii(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,s=this.lat*r,l=t.lat*r,d=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return xh*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof $n)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new $n(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new $n(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const ku=2*Math.PI*xh;function Du(n){return ku*Math.cos(n*Math.PI/180)}function Ru(n){return(180+n)/360}function Lu(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function Bu(n,t){return n/Du(t)}function vh(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function Fu(n,t){return n*Du(vh(t))}class Qo{constructor(t,r,s=0){this.x=+t,this.y=+r,this.z=+s}static fromLngLat(t,r=0){const s=$n.convert(t);return new Qo(Ru(s.lng),Lu(s.lat),Bu(r,s.lat))}toLngLat(){return new $n(360*this.x-180,vh(this.y))}toAltitude(){return Fu(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ku*(t=vh(this.y),1/Math.cos(t*Math.PI/180));var t}}function Ou(n,t,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[n*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class bh{constructor(t,r,s){if(!function(l,d,p){return!(l<0||l>25||p<0||p>=Math.pow(2,l)||d<0||d>=Math.pow(2,l))}(t,r,s))throw new Error(`x=${r}, y=${s}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=s,this.key=Sa(0,t,t,r,s)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,s){const l=(p=this.y,m=this.z,g=Ou(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),x=Ou(256*(d+1),256*(p+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var d,p,m,g,x;const b=function(w,M,C){let E,k="";for(let O=w;O>0;O--)E=1<1?"@2x":"").replace(/{quadkey}/g,b).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new Oe((t.x*r-this.x)*rt,(t.y*r-this.y)*rt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ju{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Sa(t,r.z,r.z,r.x,r.y)}}class Vi{constructor(t,r,s,l,d){if(this.terrainRttPosMatrix32f=null,t= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=r,this.canonical=new bh(s,+l,+d),this.key=Sa(r,t,s,l,d)}clone(){return new Vi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new Vi(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vi(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-t;return t>this.canonical.z?Sa(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Sa(this.wrap*+r,t,t,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Vi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new Vi(r,this.wrap,r,s,l),new Vi(r,this.wrap,r,s+1,l),new Vi(r,this.wrap,r,s,l+1),new Vi(r,this.wrap,r,s+1,l+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=w),w=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,s){return t*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new Ni({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,s){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,d=r*this.dim+this.dim,p=s*this.dim,m=s*this.dim+this.dim;switch(r){case-1:l=d-1;break;case 1:d=l+1}switch(s){case-1:p=m-1;break;case 1:m=p+1}const g=-r*this.dim,x=-s*this.dim;for(let b=p;b=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Uu{constructor(t,r,s,l,d){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=s,t._y=l,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class Zu{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new dn(rt,16,0),this.grid3D=new dn(rt,16,0),this.featureIndexArray=new V,this.promoteId=r}insert(t,r,s,l,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,d);const g=p?this.grid3D:this.grid;for(let x=0;x=0&&w[3]>=0&&g.insert(m,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ho.VectorTile(new ch(this.rawTileData)).layers,this.sourceLayerCoder=new Vu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,s,l){this.loadVTLayers();const d=t.params,p=rt/t.tileSize/t.scale,m=ra(d.filter),g=t.queryGeometry,x=t.queryPadding*p,b=$u(g),w=this.grid.query(b.minX-x,b.minY-x,b.maxX+x,b.maxY+x),M=$u(t.cameraQueryGeometry),C=this.grid3D.query(M.minX-x,M.minY-x,M.maxX+x,M.maxY+x,(O,Z,ee,q)=>function(I,F,H,ae,xe){for(const pe of I)if(F<=pe.x&&H<=pe.y&&ae>=pe.x&&xe>=pe.y)return!0;const ce=[new Oe(F,H),new Oe(F,xe),new Oe(ae,xe),new Oe(ae,H)];if(I.length>2){for(const pe of ce)if(va(I,pe))return!0}for(let pe=0;pe(q||(q=mn(I)),F.queryIntersectsFeature({queryGeometry:g,feature:I,featureState:H,geometry:q,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix})))}return E}loadMatchingFeature(t,r,s,l,d,p,m,g,x,b,w){const M=this.bucketLayerIDs[r];if(p&&!M.some(O=>p.has(O)))return;const C=this.sourceLayerCoder.decode(s),E=this.vtLayers[C].feature(l);if(d.needGeometry){const O=_n(E,!0);if(!d.filter(new yt(this.tileID.overscaledZ),O,this.tileID.canonical))return}else if(!d.filter(new yt(this.tileID.overscaledZ),E))return;const k=this.getId(E,C);for(let O=0;O{const m=t instanceof jn?t.get(p):null;return m&&m.evaluate?m.evaluate(r,s,l):m})}function $u(n){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return{minX:t,minY:r,maxX:s,maxY:l}}function Ap(n,t){return t-n}function qu(n,t,r,s,l){const d=[];for(let p=0;p=s&&w.x>=s||(b.x>=s?b=new Oe(s,b.y+(s-b.x)/(w.x-b.x)*(w.y-b.y))._round():w.x>=s&&(w=new Oe(s,b.y+(s-b.x)/(w.x-b.x)*(w.y-b.y))._round()),b.y>=l&&w.y>=l||(b.y>=l?b=new Oe(b.x+(l-b.y)/(w.y-b.y)*(w.x-b.x),l)._round():w.y>=l&&(w=new Oe(b.x+(l-b.y)/(w.y-b.y)*(w.x-b.x),l)._round()),g&&b.equals(g[g.length-1])||(g=[b],d.push(g)),g.push(w)))))}}return d}Ae("FeatureIndex",Zu,{omit:["rawTileData","sourceLayerCoder"]});class qn extends Oe{constructor(t,r,s,l){super(t,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new qn(this.x,this.y,this.angle,this.segment)}}function Hu(n,t,r,s,l){if(t.segment===void 0||r===0)return!0;let d=t,p=t.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=n[p].dist(d),d=n[p]}m+=n[p].dist(n[p+1]),p++;const g=[];let x=0;for(;ms;)x-=g.shift().angleDelta;if(x>l)return!1;p++,m+=b.dist(w)}return!0}function Xu(n){let t=0;for(let r=0;rx){const E=(x-g)/C,k=Oi.number(w.x,M.x,E),O=Oi.number(w.y,M.y,E),Z=new qn(k,O,M.angleTo(w),b);return Z._round(),!p||Hu(n,Z,m,p,t)?Z:void 0}g+=C}}function kp(n,t,r,s,l,d,p,m,g){const x=Wu(s,d,p),b=Ku(s,l),w=b*p,M=n[0].x===0||n[0].x===g||n[0].y===0||n[0].y===g;return t-w=0&&I=0&&F=0&&M+x<=b){const H=new qn(I,F,ee,E);H._round(),s&&!Hu(n,H,d,s,l)||C.push(H)}}w+=Z}return m||C.length||p||(C=Yu(n,w/2,r,s,l,d,p,!0,g)),C}Ae("Anchor",qn);const el=bi;function Ju(n,t,r,s){const l=[],d=n.image,p=d.pixelRatio,m=d.paddedRect.w-2*el,g=d.paddedRect.h-2*el;let x={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const b=d.stretchX||[[0,m]],w=d.stretchY||[[0,g]],M=(_e,ke)=>_e+ke[1]-ke[0],C=b.reduce(M,0),E=w.reduce(M,0),k=m-C,O=g-E;let Z=0,ee=C,q=0,I=E,F=0,H=k,ae=0,xe=O;if(d.content&&s){const _e=d.content,ke=_e[2]-_e[0],Fe=_e[3]-_e[1];(d.textFitWidth||d.textFitHeight)&&(x=Pu(n)),Z=_c(b,0,_e[0]),q=_c(w,0,_e[1]),ee=_c(b,_e[0],_e[2]),I=_c(w,_e[1],_e[3]),F=_e[0]-Z,ae=_e[1]-q,H=ke-ee,xe=Fe-I}const ce=x.x1,pe=x.y1,we=x.x2-ce,be=x.y2-pe,Te=(_e,ke,Fe,Be)=>{const Re=gc(_e.stretch-Z,ee,we,ce),Ke=yc(_e.fixed-F,H,_e.stretch,C),It=gc(ke.stretch-q,I,be,pe),Zt=yc(ke.fixed-ae,xe,ke.stretch,E),ai=gc(Fe.stretch-Z,ee,we,ce),Ui=yc(Fe.fixed-F,H,Fe.stretch,C),wi=gc(Be.stretch-q,I,be,pe),Yt=yc(Be.fixed-ae,xe,Be.stretch,E),Pt=new Oe(Re,It),$t=new Oe(ai,It),Jt=new Oe(ai,wi),Qt=new Oe(Re,wi),pi=new Oe(Ke/p,Zt/p),Zi=new Oe(Ui/p,Yt/p),qt=t*Math.PI/180;if(qt){const Ht=Math.sin(qt),Xt=Math.cos(qt),Ft=[Xt,-Ht,Ht,Xt];Pt._matMult(Ft),$t._matMult(Ft),Qt._matMult(Ft),Jt._matMult(Ft)}const Ti=_e.stretch+_e.fixed,Gt=ke.stretch+ke.fixed;return{tl:Pt,tr:$t,bl:Qt,br:Jt,tex:{x:d.paddedRect.x+el+Ti,y:d.paddedRect.y+el+Gt,w:Fe.stretch+Fe.fixed-Ti,h:Be.stretch+Be.fixed-Gt},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:pi,pixelOffsetBR:Zi,minFontScaleX:H/p/we,minFontScaleY:xe/p/be,isSDF:r}};if(s&&(d.stretchX||d.stretchY)){const _e=Qu(b,k,C),ke=Qu(w,O,E);for(let Fe=0;Fe<_e.length-1;Fe++){const Be=_e[Fe],Re=_e[Fe+1];for(let Ke=0;Ke0&&(k=Math.max(10,k),this.circleDiameter=k)}else{const M=!((w=p.image)===null||w===void 0)&&w.content&&(p.image.textFitWidth||p.image.textFitHeight)?Pu(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};M.y1=M.y1*m-g[0],M.y2=M.y2*m+g[2],M.x1=M.x1*m-g[3],M.x2=M.x2*m+g[1];const C=p.collisionPadding;if(C&&(M.x1-=C[0]*m,M.y1-=C[1]*m,M.x2+=C[2]*m,M.y2+=C[3]*m),b){const E=new Oe(M.x1,M.y1),k=new Oe(M.x2,M.y1),O=new Oe(M.x1,M.y2),Z=new Oe(M.x2,M.y2),ee=b*Math.PI/180;E._rotate(ee),k._rotate(ee),O._rotate(ee),Z._rotate(ee),M.x1=Math.min(E.x,k.x,O.x,Z.x),M.x2=Math.max(E.x,k.x,O.x,Z.x),M.y1=Math.min(E.y,k.y,O.y,Z.y),M.y2=Math.max(E.y,k.y,O.y,Z.y)}t.emplaceBack(r.x,r.y,M.x1,M.y1,M.x2,M.y2,s,l,d)}this.boxEndIndex=t.length}}class Dp{constructor(t=[],r=(s,l)=>sl?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:s}=this,l=r[t];for(;t>0;){const d=t-1>>1,p=r[d];if(s(l,p)>=0)break;r[t]=p,t=d}r[t]=l}_down(t){const{data:r,compare:s}=this,l=this.length>>1,d=r[t];for(;t=0)break;r[t]=r[p],t=p}r[t]=d}}function Rp(n,t=1,r=!1){let s=1/0,l=1/0,d=-1/0,p=-1/0;const m=n[0];for(let C=0;Cd)&&(d=E.x),(!C||E.y>p)&&(p=E.y)}const g=Math.min(d-s,p-l);let x=g/2;const b=new Dp([],Lp);if(g===0)return new Oe(s,l);for(let C=s;Cw.d||!w.d)&&(w=C,r&&console.log("found best %d after %d probes",Math.round(1e4*C.d)/1e4,M)),C.max-w.d<=t||(x=C.h/2,b.push(new Ia(C.p.x-x,C.p.y-x,x,n)),b.push(new Ia(C.p.x+x,C.p.y-x,x,n)),b.push(new Ia(C.p.x-x,C.p.y+x,x,n)),b.push(new Ia(C.p.x+x,C.p.y+x,x,n)),M+=4)}return r&&(console.log(`num probes: ${M}`),console.log(`best distance: ${w.d}`)),w.p}function Lp(n,t){return t.max-n.max}function Ia(n,t,r,s){this.p=new Oe(n,t),this.h=r,this.d=function(l,d){let p=!1,m=1/0;for(let g=0;gl.y!=E.y>l.y&&l.x<(E.x-C.x)*(l.y-C.y)/(E.y-C.y)+C.x&&(p=!p),m=Math.min(m,Dh(l,C,E))}}return(p?1:-1)*Math.sqrt(m)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var si;z.av=void 0,(si=z.av||(z.av={}))[si.center=1]="center",si[si.left=2]="left",si[si.right=3]="right",si[si.top=4]="top",si[si.bottom=5]="bottom",si[si["top-left"]=6]="top-left",si[si["top-right"]=7]="top-right",si[si["bottom-left"]=8]="bottom-left",si[si["bottom-right"]=9]="bottom-right";const Hn=7,wh=Number.POSITIVE_INFINITY;function ed(n,t){return t[1]!==wh?function(r,s,l){let d=0,p=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":p=l-Hn;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+Hn}switch(r){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,p]}(n,t[0],t[1]):function(r,s){let l=0,d=0;s<0&&(s=0);const p=s/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-Hn;break;case"bottom-right":case"bottom-left":d=-p+Hn;break;case"bottom":d=-s+Hn;break;case"top":d=s-Hn}switch(r){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=s;break;case"right":l=-s}return[l,d]}(n,t[0])}function td(n,t,r){var s;const l=n.layout,d=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},r);if(d){const m=d.values,g=[];for(let x=0;xM*Ut);b.startsWith("top")?w[1]-=Hn:b.startsWith("bottom")&&(w[1]+=Hn),g[x+1]=w}return new ii(g)}const p=l.get("text-variable-anchor");if(p){let m;m=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*Ut,wh]:l.get("text-offset").evaluate(t,{},r).map(x=>x*Ut);const g=[];for(const x of p)g.push(x,ed(x,m));return new ii(g)}return null}function Th(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Bp(n,t,r,s,l,d,p,m,g,x,b,w){let M=d.textMaxSize.evaluate(t,{});M===void 0&&(M=p);const C=n.layers[0].layout,E=C.get("icon-offset").evaluate(t,{},b),k=rd(r.horizontal),O=p/24,Z=n.tilePixelRatio*O,ee=n.tilePixelRatio*M/24,q=n.tilePixelRatio*m,I=n.tilePixelRatio*C.get("symbol-spacing"),F=C.get("text-padding")*n.tilePixelRatio,H=function(Fe,Be,Re,Ke=1){const It=Fe.get("icon-padding").evaluate(Be,{},Re),Zt=It&&It.values;return[Zt[0]*Ke,Zt[1]*Ke,Zt[2]*Ke,Zt[3]*Ke]}(C,t,b,n.tilePixelRatio),ae=C.get("text-max-angle")/180*Math.PI,xe=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",ce=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",pe=C.get("symbol-placement"),we=I/2,be=C.get("icon-text-fit");let Te;s&&be!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(Te=Mu(s,r.vertical,be,C.get("icon-text-fit-padding"),E,O)),k&&(s=Mu(s,k,be,C.get("icon-text-fit-padding"),E,O)));const _e=b?w.line.getGranularityForZoomLevel(b.z):1,ke=(Fe,Be)=>{Be.x<0||Be.x>=rt||Be.y<0||Be.y>=rt||function(Re,Ke,It,Zt,ai,Ui,wi,Yt,Pt,$t,Jt,Qt,pi,Zi,qt,Ti,Gt,Ht,Xt,Ft,pt,hr,Ca,ur,jp){const Ea=Re.addToLineVertexArray(Ke,It);let zs,Aa,za,ka,od=0,ld=0,cd=0,hd=0,zh=-1,kh=-1;const gn={};let ud=Lt("");if(Re.allowVerticalPlacement&&Zt.vertical){const hi=Yt.layout.get("text-rotate").evaluate(pt,{},ur)+90;za=new xc(Pt,Ke,$t,Jt,Qt,Zt.vertical,pi,Zi,qt,hi),wi&&(ka=new xc(Pt,Ke,$t,Jt,Qt,wi,Gt,Ht,qt,hi))}if(ai){const hi=Yt.layout.get("icon-rotate").evaluate(pt,{}),Gi=Yt.layout.get("icon-text-fit")!=="none",ks=Ju(ai,hi,Ca,Gi),pr=wi?Ju(wi,hi,Ca,Gi):void 0;Aa=new xc(Pt,Ke,$t,Jt,Qt,ai,Gt,Ht,!1,hi),od=4*ks.length;const Ds=Re.iconSizeData;let Dr=null;Ds.kind==="source"?(Dr=[kr*Yt.layout.get("icon-size").evaluate(pt,{})],Dr[0]>Gn&&ti(`${Re.layerIds[0]}: Value for "icon-size" is >= ${Jo}. Reduce your "icon-size".`)):Ds.kind==="composite"&&(Dr=[kr*hr.compositeIconSizes[0].evaluate(pt,{},ur),kr*hr.compositeIconSizes[1].evaluate(pt,{},ur)],(Dr[0]>Gn||Dr[1]>Gn)&&ti(`${Re.layerIds[0]}: Value for "icon-size" is >= ${Jo}. Reduce your "icon-size".`)),Re.addSymbols(Re.icon,ks,Dr,Ft,Xt,pt,z.ai.none,Ke,Ea.lineStartIndex,Ea.lineLength,-1,ur),zh=Re.icon.placedSymbolArray.length-1,pr&&(ld=4*pr.length,Re.addSymbols(Re.icon,pr,Dr,Ft,Xt,pt,z.ai.vertical,Ke,Ea.lineStartIndex,Ea.lineLength,-1,ur),kh=Re.icon.placedSymbolArray.length-1)}const dd=Object.keys(Zt.horizontal);for(const hi of dd){const Gi=Zt.horizontal[hi];if(!zs){ud=Lt(Gi.text);const pr=Yt.layout.get("text-rotate").evaluate(pt,{},ur);zs=new xc(Pt,Ke,$t,Jt,Qt,Gi,pi,Zi,qt,pr)}const ks=Gi.positionedLines.length===1;if(cd+=id(Re,Ke,Gi,Ui,Yt,qt,pt,Ti,Ea,Zt.vertical?z.ai.horizontal:z.ai.horizontalOnly,ks?dd:[hi],gn,zh,hr,ur),ks)break}Zt.vertical&&(hd+=id(Re,Ke,Zt.vertical,Ui,Yt,qt,pt,Ti,Ea,z.ai.vertical,["vertical"],gn,kh,hr,ur));const Np=zs?zs.boxStartIndex:Re.collisionBoxArray.length,Vp=zs?zs.boxEndIndex:Re.collisionBoxArray.length,Up=za?za.boxStartIndex:Re.collisionBoxArray.length,Zp=za?za.boxEndIndex:Re.collisionBoxArray.length,Gp=Aa?Aa.boxStartIndex:Re.collisionBoxArray.length,$p=Aa?Aa.boxEndIndex:Re.collisionBoxArray.length,qp=ka?ka.boxStartIndex:Re.collisionBoxArray.length,Hp=ka?ka.boxEndIndex:Re.collisionBoxArray.length;let dr=-1;const bc=(hi,Gi)=>hi&&hi.circleDiameter?Math.max(hi.circleDiameter,Gi):Gi;dr=bc(zs,dr),dr=bc(za,dr),dr=bc(Aa,dr),dr=bc(ka,dr);const pd=dr>-1?1:0;pd&&(dr*=jp/Ut),Re.glyphOffsetArray.length>=Ma.MAX_GLYPHS&&ti("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pt.sortKey!==void 0&&Re.addToSortKeyRanges(Re.symbolInstances.length,pt.sortKey);const Xp=td(Yt,pt,ur),[Wp,Kp]=function(hi,Gi){const ks=hi.length,pr=Gi==null?void 0:Gi.values;if((pr==null?void 0:pr.length)>0)for(let Ds=0;Ds=0?gn.right:-1,gn.center>=0?gn.center:-1,gn.left>=0?gn.left:-1,gn.vertical||-1,zh,kh,ud,Np,Vp,Up,Zp,Gp,$p,qp,Hp,$t,cd,hd,od,ld,pd,0,pi,dr,Wp,Kp)}(n,Be,Fe,r,s,l,Te,n.layers[0],n.collisionBoxArray,t.index,t.sourceLayerIndex,n.index,Z,[F,F,F,F],xe,g,q,H,ce,E,t,d,x,b,p)};if(pe==="line")for(const Fe of qu(t.geometry,0,0,rt,rt)){const Be=As(Fe,_e),Re=kp(Be,I,ae,r.vertical||k,s,24,ee,n.overscaling,rt);for(const Ke of Re)k&&Fp(n,k.text,we,Ke)||ke(Be,Ke)}else if(pe==="line-center"){for(const Fe of t.geometry)if(Fe.length>1){const Be=As(Fe,_e),Re=zp(Be,ae,r.vertical||k,s,24,ee);Re&&ke(Be,Re)}}else if(t.type==="Polygon")for(const Fe of Us(t.geometry,0)){const Be=Rp(Fe,16);ke(As(Fe[0],_e,!0),new qn(Be.x,Be.y,0))}else if(t.type==="LineString")for(const Fe of t.geometry){const Be=As(Fe,_e);ke(Be,new qn(Be[0].x,Be[0].y,0))}else if(t.type==="Point")for(const Fe of t.geometry)for(const Be of Fe)ke([Be],new qn(Be.x,Be.y,0))}function id(n,t,r,s,l,d,p,m,g,x,b,w,M,C,E){const k=function(ee,q,I,F,H,ae,xe,ce){const pe=F.layout.get("text-rotate").evaluate(ae,{})*Math.PI/180,we=[];for(const be of q.positionedLines)for(const Te of be.positionedGlyphs){if(!Te.rect)continue;const _e=Te.rect||{};let ke=up+1,Fe=!0,Be=1,Re=0;const Ke=(H||ce)&&Te.vertical,It=Te.metrics.advance*Te.scale/2;if(ce&&q.verticalizable&&(Re=be.lineOffset/2-(Te.imageName?-(Ut-Te.metrics.width*Te.scale)/2:(Te.scale-1)*Ut)),Te.imageName){const Ht=xe[Te.imageName];Fe=Ht.sdf,Be=Ht.pixelRatio,ke=bi/Be}const Zt=H?[Te.x+It,Te.y]:[0,0];let ai=H?[0,0]:[Te.x+It+I[0],Te.y+I[1]-Re],Ui=[0,0];Ke&&(Ui=ai,ai=[0,0]);const wi=Te.metrics.isDoubleResolution?2:1,Yt=(Te.metrics.left-ke)*Te.scale-It+ai[0],Pt=(-Te.metrics.top-ke)*Te.scale+ai[1],$t=Yt+_e.w/wi*Te.scale/Be,Jt=Pt+_e.h/wi*Te.scale/Be,Qt=new Oe(Yt,Pt),pi=new Oe($t,Pt),Zi=new Oe(Yt,Jt),qt=new Oe($t,Jt);if(Ke){const Ht=new Oe(-It,It-uc),Xt=-Math.PI/2,Ft=Ut/2-It,pt=new Oe(5-uc-Ft,-(Te.imageName?Ft:0)),hr=new Oe(...Ui);Qt._rotateAround(Xt,Ht)._add(pt)._add(hr),pi._rotateAround(Xt,Ht)._add(pt)._add(hr),Zi._rotateAround(Xt,Ht)._add(pt)._add(hr),qt._rotateAround(Xt,Ht)._add(pt)._add(hr)}if(pe){const Ht=Math.sin(pe),Xt=Math.cos(pe),Ft=[Xt,-Ht,Ht,Xt];Qt._matMult(Ft),pi._matMult(Ft),Zi._matMult(Ft),qt._matMult(Ft)}const Ti=new Oe(0,0),Gt=new Oe(0,0);we.push({tl:Qt,tr:pi,bl:Zi,br:qt,tex:_e,writingMode:q.writingMode,glyphOffset:Zt,sectionIndex:Te.sectionIndex,isSDF:Fe,pixelOffsetTL:Ti,pixelOffsetBR:Gt,minFontScaleX:0,minFontScaleY:0})}return we}(0,r,m,l,d,p,s,n.allowVerticalPlacement),O=n.textSizeData;let Z=null;O.kind==="source"?(Z=[kr*l.layout.get("text-size").evaluate(p,{})],Z[0]>Gn&&ti(`${n.layerIds[0]}: Value for "text-size" is >= ${Jo}. Reduce your "text-size".`)):O.kind==="composite"&&(Z=[kr*C.compositeTextSizes[0].evaluate(p,{},E),kr*C.compositeTextSizes[1].evaluate(p,{},E)],(Z[0]>Gn||Z[1]>Gn)&&ti(`${n.layerIds[0]}: Value for "text-size" is >= ${Jo}. Reduce your "text-size".`)),n.addSymbols(n.text,k,Z,m,d,p,x,t,g.lineStartIndex,g.lineLength,M,E);for(const ee of b)w[ee]=n.text.placedSymbolArray.length-1;return 4*k.length}function rd(n){for(const t in n)return n[t];return null}function Fp(n,t,r,s){const l=n.compareText;if(t in l){const d=l[t];for(let p=d.length-1;p>=0;p--)if(s.dist(d[p])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const d=nd[15&s];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[m]=new Uint32Array(t,4,1);return new Ph(m,p,d,t)}constructor(t,r=64,s=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=nd.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-m%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=r,s}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Mh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,g=[0,d.length-1,0],x=[];for(;g.length;){const b=g.pop()||0,w=g.pop()||0,M=g.pop()||0;if(w-M<=m){for(let O=M;O<=w;O++){const Z=p[2*O],ee=p[2*O+1];Z>=t&&Z<=s&&ee>=r&&ee<=l&&x.push(d[O])}continue}const C=M+w>>1,E=p[2*C],k=p[2*C+1];E>=t&&E<=s&&k>=r&&k<=l&&x.push(d[C]),(b===0?t<=E:r<=k)&&(g.push(M),g.push(C-1),g.push(1-b)),(b===0?s>=E:l>=k)&&(g.push(C+1),g.push(w),g.push(1-b))}return x}within(t,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:d,nodeSize:p}=this,m=[0,l.length-1,0],g=[],x=s*s;for(;m.length;){const b=m.pop()||0,w=m.pop()||0,M=m.pop()||0;if(w-M<=p){for(let O=M;O<=w;O++)ad(d[2*O],d[2*O+1],t,r)<=x&&g.push(l[O]);continue}const C=M+w>>1,E=d[2*C],k=d[2*C+1];ad(E,k,t,r)<=x&&g.push(l[C]),(b===0?t-s<=E:r-s<=k)&&(m.push(M),m.push(C-1),m.push(1-b)),(b===0?t+s>=E:r+s>=k)&&(m.push(C+1),m.push(w),m.push(1-b))}return g}}function Mh(n,t,r,s,l,d){if(l-s<=r)return;const p=s+l>>1;sd(n,t,p,s,l,d),Mh(n,t,r,s,p-1,1-d),Mh(n,t,r,p+1,l,1-d)}function sd(n,t,r,s,l,d){for(;l>s;){if(l-s>600){const x=l-s+1,b=r-s+1,w=Math.log(x),M=.5*Math.exp(2*w/3),C=.5*Math.sqrt(w*M*(x-M)/x)*(b-x/2<0?-1:1);sd(n,t,r,Math.max(s,Math.floor(r-b*M/x+C)),Math.min(l,Math.floor(r+(x-b)*M/x+C)),d)}const p=t[2*r+d];let m=s,g=l;for(tl(n,t,s,r),t[2*l+d]>p&&tl(n,t,s,l);mp;)g--}t[2*s+d]===p?tl(n,t,s,g):(g++,tl(n,t,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function tl(n,t,r,s){Sh(n,r,s),Sh(t,2*r,2*s),Sh(t,2*r+1,2*s+1)}function Sh(n,t,r){const s=n[t];n[t]=n[r],n[r]=s}function ad(n,t,r,s){const l=n-r,d=t-s;return l*l+d*d}var Ih;z.ce=void 0,(Ih=z.ce||(z.ce={})).create="create",Ih.load="load",Ih.fullLoad="fullLoad";let vc=null,il=[];const Ch=1e3/60,Eh="loadTime",Ah="fullLoadTime",Op={mark(n){performance.mark(n)},frame(n){const t=n;vc!=null&&il.push(t-vc),vc=t},clearMetrics(){vc=null,il=[],performance.clearMeasures(Eh),performance.clearMeasures(Ah);for(const n in z.ce)performance.clearMarks(z.ce[n])},getPerformanceMetrics(){performance.measure(Eh,z.ce.create,z.ce.load),performance.measure(Ah,z.ce.create,z.ce.fullLoad);const n=performance.getEntriesByName(Eh)[0].duration,t=performance.getEntriesByName(Ah)[0].duration,r=il.length,s=1/(il.reduce((d,p)=>d+p,0)/r/1e3),l=il.filter(d=>d>Ch).reduce((d,p)=>d+(p-Ch)/Ch,0);return{loadTime:n,fullLoadTime:t,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};z.$=te,z.A=ft,z.B=ys,z.C=function(n){if(zt==null){const t=n.navigator?n.navigator.userAgent:null;zt=!!n.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return zt},z.D=Le,z.E=Pr,z.F=class{constructor(n,t){this.target=n,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Ep(()=>this.process()),this.subscription=function(r,s,l,d){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=Qi(self)?n:window}registerMessageHandler(n,t){this.messageHandlers[n]=t}sendAsync(n,t){return new Promise((r,s)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];const m={id:l,type:"",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(m)},{once:!0});const d=[],p=Object.assign(Object.assign({},n),{id:l,sourceMapId:this.mapId,origin:location.origin,data:xs(n.data,d)});this.target.postMessage(p,{transfer:d})})}receive(n){const t=n.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===""){delete this.tasks[r];const s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(Qi(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),t=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(n,t)}processTask(n,t){return c(this,void 0,void 0,function*(){if(t.type===""){const l=this.resolveRejects[n];return delete this.resolveRejects[n],l?void(t.error?l.reject(Er(t.error)):l.resolve(Er(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Er(t.data),s=new AbortController;this.abortControllers[n]=s;try{const l=yield this.messageHandlers[t.type](t.sourceMapId,r,s);this.completeTask(n,null,l)}catch(l){this.completeTask(n,l)}})}completeTask(n,t,r){const s=[];delete this.abortControllers[n];const l={id:n,type:"",sourceMapId:this.mapId,origin:location.origin,error:t?xs(t):null,data:xs(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},z.G=Xr,z.H=function(){var n=new ft(16);return ft!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},z.I=uh,z.J=function(n,t,r){var s,l,d,p,m,g,x,b,w,M,C,E,k=r[0],O=r[1],Z=r[2];return t===n?(n[12]=t[0]*k+t[4]*O+t[8]*Z+t[12],n[13]=t[1]*k+t[5]*O+t[9]*Z+t[13],n[14]=t[2]*k+t[6]*O+t[10]*Z+t[14],n[15]=t[3]*k+t[7]*O+t[11]*Z+t[15]):(l=t[1],d=t[2],p=t[3],m=t[4],g=t[5],x=t[6],b=t[7],w=t[8],M=t[9],C=t[10],E=t[11],n[0]=s=t[0],n[1]=l,n[2]=d,n[3]=p,n[4]=m,n[5]=g,n[6]=x,n[7]=b,n[8]=w,n[9]=M,n[10]=C,n[11]=E,n[12]=s*k+m*O+w*Z+t[12],n[13]=l*k+g*O+M*Z+t[13],n[14]=d*k+x*O+C*Z+t[14],n[15]=p*k+b*O+E*Z+t[15]),n},z.K=function(n,t,r){var s=r[0],l=r[1],d=r[2];return n[0]=t[0]*s,n[1]=t[1]*s,n[2]=t[2]*s,n[3]=t[3]*s,n[4]=t[4]*l,n[5]=t[5]*l,n[6]=t[6]*l,n[7]=t[7]*l,n[8]=t[8]*d,n[9]=t[9]*d,n[10]=t[10]*d,n[11]=t[11]*d,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},z.L=function(n,t,r){var s=t[0],l=t[1],d=t[2],p=t[3],m=t[4],g=t[5],x=t[6],b=t[7],w=t[8],M=t[9],C=t[10],E=t[11],k=t[12],O=t[13],Z=t[14],ee=t[15],q=r[0],I=r[1],F=r[2],H=r[3];return n[0]=q*s+I*m+F*w+H*k,n[1]=q*l+I*g+F*M+H*O,n[2]=q*d+I*x+F*C+H*Z,n[3]=q*p+I*b+F*E+H*ee,n[4]=(q=r[4])*s+(I=r[5])*m+(F=r[6])*w+(H=r[7])*k,n[5]=q*l+I*g+F*M+H*O,n[6]=q*d+I*x+F*C+H*Z,n[7]=q*p+I*b+F*E+H*ee,n[8]=(q=r[8])*s+(I=r[9])*m+(F=r[10])*w+(H=r[11])*k,n[9]=q*l+I*g+F*M+H*O,n[10]=q*d+I*x+F*C+H*Z,n[11]=q*p+I*b+F*E+H*ee,n[12]=(q=r[12])*s+(I=r[13])*m+(F=r[14])*w+(H=r[15])*k,n[13]=q*l+I*g+F*M+H*O,n[14]=q*d+I*x+F*C+H*Z,n[15]=q*p+I*b+F*E+H*ee,n},z.M=function(n,t){const r={};for(let s=0;s{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const s of n){const l=window.document.createElement("source");Kr(s)||(t.crossOrigin="Anonymous"),l.src=s,t.appendChild(l)}})},z.a1=function(){return Vr++},z.a2=u,z.a3=Ma,z.a4=ra,z.a5=_n,z.a6=Uu,z.a7=function(n){const t={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,d)=>{const p=l||d;return t[s]=!p||p.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},z.a8=function(n){return Math.log(n)/Math.LN2},z.a9=function(n){var t=n[0],r=n[1];return t*t+r*r},z.aA=kt,z.aB=lc,z.aC=N,z.aD=Ee,z.aE=de,z.aF=85.051129,z.aG=function(n){return Math.pow(2,n)},z.aH=Bu,z.aI=Ii,z.aJ=mi,z.aK=Fu,z.aL=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n},z.aM=function(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n[2]=t[2]+r[2],n},z.aN=function(n){var t=new ft(3);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},z.aO=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n[2]=t[2]*r[2],n[3]=t[3]*r[3],n},z.aP=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],n},z.aQ=function(n,t){var r=t[0],s=t[1],l=t[2],d=r*r+s*s+l*l;return d>0&&(d=1/Math.sqrt(d)),n[0]=t[0]*d,n[1]=t[1]*d,n[2]=t[2]*d,n},z.aR=function(n,t,r){var s=t[0],l=t[1],d=t[2],p=r[0],m=r[1],g=r[2];return n[0]=l*g-d*m,n[1]=d*p-s*g,n[2]=s*m-l*p,n},z.aS=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]},z.aT=ju,z.aU=Sa,z.aV=function(n,t,r,s,l){var d,p=1/Math.tan(t/2);return n[0]=p/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=p,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,l!=null&&l!==1/0?(n[10]=(l+s)*(d=1/(s-l)),n[14]=2*l*s*d):(n[10]=-1,n[14]=-2*s),n},z.aW=function(n){var t=new ft(16);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},z.aX=function(n,t,r){var s=Math.sin(r),l=Math.cos(r),d=t[0],p=t[1],m=t[2],g=t[3],x=t[4],b=t[5],w=t[6],M=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*l+x*s,n[1]=p*l+b*s,n[2]=m*l+w*s,n[3]=g*l+M*s,n[4]=x*l-d*s,n[5]=b*l-p*s,n[6]=w*l-m*s,n[7]=M*l-g*s,n},z.aY=function(n,t,r){var s=Math.sin(r),l=Math.cos(r),d=t[4],p=t[5],m=t[6],g=t[7],x=t[8],b=t[9],w=t[10],M=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=d*l+x*s,n[5]=p*l+b*s,n[6]=m*l+w*s,n[7]=g*l+M*s,n[8]=x*l-d*s,n[9]=b*l-p*s,n[10]=w*l-m*s,n[11]=M*l-g*s,n},z.aZ=function(){const n=new Float32Array(16);return Wn(n),n},z.a_=function(){const n=new Float64Array(16);return Wn(n),n},z.aa=function(n){return n*Math.PI/180},z.ab=Li,z.ac=function(n,t){const r=[];for(const s in n)s in t||r.push(s);return r},z.ad=ei,z.ae=function(n){return Math.hypot(n[0],n[1])},z.af=function(n){return n[0]=0,n[1]=0,n},z.ag=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},z.ah=function(n,t){let r=0,s=0;if(n.kind==="constant")s=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=n,m=l?Li(ct.interpolationFactor(l,t,d,p),0,1):0;n.kind==="camera"?s=Oi.number(n.minSize,n.maxSize,m):r=m}return{uSizeT:r,uSize:s}},z.aj=function(n,{uSize:t,uSizeT:r},{lowerSize:s,upperSize:l}){return n.kind==="source"?s/kr:n.kind==="composite"?Oi.number(s/kr,l/kr,r):t},z.ak=mh,z.al=Ji,z.am=function(n,t,r,s){const l=t.y-n.y,d=t.x-n.x,p=s.y-r.y,m=s.x-r.x,g=p*d-m*l;if(g===0)return null;const x=(m*(n.y-r.y)-p*(n.x-r.x))/g;return new Oe(n.x+x*d,n.y+x*l)},z.an=function(n,t){var r=t[0],s=t[1],l=t[2],d=t[3],p=t[4],m=t[5],g=t[6],x=t[7],b=t[8],w=t[9],M=t[10],C=t[11],E=t[12],k=t[13],O=t[14],Z=t[15],ee=r*m-s*p,q=r*g-l*p,I=r*x-d*p,F=s*g-l*m,H=s*x-d*m,ae=l*x-d*g,xe=b*k-w*E,ce=b*O-M*E,pe=b*Z-C*E,we=w*O-M*k,be=w*Z-C*k,Te=M*Z-C*O,_e=ee*Te-q*be+I*we+F*pe-H*ce+ae*xe;return _e?(n[0]=(m*Te-g*be+x*we)*(_e=1/_e),n[1]=(l*be-s*Te-d*we)*_e,n[2]=(k*ae-O*H+Z*F)*_e,n[3]=(M*H-w*ae-C*F)*_e,n[4]=(g*pe-p*Te-x*ce)*_e,n[5]=(r*Te-l*pe+d*ce)*_e,n[6]=(O*I-E*ae-Z*q)*_e,n[7]=(b*ae-M*I+C*q)*_e,n[8]=(p*be-m*pe+x*xe)*_e,n[9]=(s*pe-r*be-d*xe)*_e,n[10]=(E*H-k*I+Z*ee)*_e,n[11]=(w*I-b*H-C*ee)*_e,n[12]=(m*ce-p*we-g*xe)*_e,n[13]=(r*we-s*ce+l*xe)*_e,n[14]=(k*q-E*F-O*ee)*_e,n[15]=(b*F-w*q+M*ee)*_e,n):null},z.ao=qu,z.ap=Lo,z.aq=Wn,z.ar=function(n){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),s=Math.max(s,d.x),l=Math.max(l,d.y);return[t,r,s,l]},z.as=Ut,z.at=yn,z.au=function(n,t,r,s,l=!1){if(!r[0]&&!r[1])return[0,0];const d=l?s==="map"?-n.bearingInRadians:0:s==="viewport"?n.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);r=[r[0]*m-r[1]*p,r[0]*p+r[1]*m]}return[l?r[0]:yn(t,r[0],n.zoom),l?r[1]:yn(t,r[1],n.zoom)]},z.aw=fh,z.ax=Th,z.ay=ph,z.az=Ph,z.b=Gr,z.b$=n=>n.type==="line",z.b0=function(n,t,r){const s=new Float64Array(4);return function(l,d,p,m){var g=.5*Math.PI/180;d*=g,p*=g,m*=g;var x=Math.sin(d),b=Math.cos(d),w=Math.sin(p),M=Math.cos(p),C=Math.sin(m),E=Math.cos(m);l[0]=x*M*E-b*w*C,l[1]=b*w*E+x*M*C,l[2]=b*M*C-x*w*E,l[3]=b*M*E+x*w*C}(s,n,t-90,r),s},z.b1=function(n,t,r,s){var l,d,p,m,g,x=t[0],b=t[1],w=t[2],M=t[3],C=r[0],E=r[1],k=r[2],O=r[3];return(d=x*C+b*E+w*k+M*O)<0&&(d=-d,C=-C,E=-E,k=-k,O=-O),1-d>Mt?(l=Math.acos(d),p=Math.sin(l),m=Math.sin((1-s)*l)/p,g=Math.sin(s*l)/p):(m=1-s,g=s),n[0]=m*x+g*C,n[1]=m*b+g*E,n[2]=m*w+g*k,n[3]=m*M+g*O,n},z.b2=function(n){const t=new Float64Array(9);var r,s,l,d,p,m,g,x,b,w,M,C,E,k,O,Z,ee,q;w=(l=(s=n)[0])*(g=l+l),M=(d=s[1])*g,E=(p=s[2])*g,k=p*(x=d+d),Z=(m=s[3])*g,ee=m*x,q=m*(b=p+p),(r=t)[0]=1-(C=d*x)-(O=p*b),r[3]=M-q,r[6]=E+ee,r[1]=M+q,r[4]=1-w-O,r[7]=k-Z,r[2]=E-ee,r[5]=k+Z,r[8]=1-w-C;const I=mi(-Math.asin(Li(t[2],-1,1)));let F,H;return Math.hypot(t[5],t[8])<.001?(F=0,H=-mi(Math.atan2(t[3],t[4]))):(F=mi(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),H=mi(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:F,pitch:I+90,bearing:H}},z.b3=function(n,t){return n.roll==t.roll&&n.pitch==t.pitch&&n.bearing==t.bearing},z.b4=Xe,z.b5=cr,z.b6=Ta,z.b7=$o,z.b8=wa,z.b9=jr,z.bA=Ur,z.bB=Zr,z.bC=class extends yi{constructor(n,t){super(n,t),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},z.bD=class extends yi{constructor(n,t){super(n,t),this.current=Un}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let t=1;t<16;t++)if(n[t]!==this.current[t]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},z.bE=Is,z.bF=Cs,z.bG=class extends yi{constructor(n,t){super(n,t),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},z.bH=class extends yi{constructor(n,t){super(n,t),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},z.bI=Ct,z.bJ=function(n,t){var r=Math.sin(t),s=Math.cos(t);return n[0]=s,n[1]=r,n[2]=0,n[3]=-r,n[4]=s,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},z.bK=function(n,t,r){var s=t[0],l=t[1],d=t[2];return n[0]=s*r[0]+l*r[3]+d*r[6],n[1]=s*r[1]+l*r[4]+d*r[7],n[2]=s*r[2]+l*r[5]+d*r[8],n},z.bL=function(n,t,r,s,l,d,p){var m=1/(t-r),g=1/(s-l),x=1/(d-p);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*g,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*x,n[11]=0,n[12]=(t+r)*m,n[13]=(l+s)*g,n[14]=(p+d)*x,n[15]=1,n},z.bM=class extends Ao{},z.bN=sp,z.bO=class extends Ar{},z.bP=Wc,z.bQ=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},z.bR=Vh,z.bS=function(n,t,r){var s=t[0],l=t[1],d=t[2],p=r[3]*s+r[7]*l+r[11]*d+r[15];return n[0]=(r[0]*s+r[4]*l+r[8]*d+r[12])/(p=p||1),n[1]=(r[1]*s+r[5]*l+r[9]*d+r[13])/p,n[2]=(r[2]*s+r[6]*l+r[10]*d+r[14])/p,n},z.bT=class extends Io{},z.bU=class extends i{},z.bV=function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},z.bW=function(n,t){var r=n[0],s=n[1],l=n[2],d=n[3],p=n[4],m=n[5],g=n[6],x=n[7],b=n[8],w=n[9],M=n[10],C=n[11],E=n[12],k=n[13],O=n[14],Z=n[15],ee=t[0],q=t[1],I=t[2],F=t[3],H=t[4],ae=t[5],xe=t[6],ce=t[7],pe=t[8],we=t[9],be=t[10],Te=t[11],_e=t[12],ke=t[13],Fe=t[14],Be=t[15];return Math.abs(r-ee)<=Mt*Math.max(1,Math.abs(r),Math.abs(ee))&&Math.abs(s-q)<=Mt*Math.max(1,Math.abs(s),Math.abs(q))&&Math.abs(l-I)<=Mt*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(d-F)<=Mt*Math.max(1,Math.abs(d),Math.abs(F))&&Math.abs(p-H)<=Mt*Math.max(1,Math.abs(p),Math.abs(H))&&Math.abs(m-ae)<=Mt*Math.max(1,Math.abs(m),Math.abs(ae))&&Math.abs(g-xe)<=Mt*Math.max(1,Math.abs(g),Math.abs(xe))&&Math.abs(x-ce)<=Mt*Math.max(1,Math.abs(x),Math.abs(ce))&&Math.abs(b-pe)<=Mt*Math.max(1,Math.abs(b),Math.abs(pe))&&Math.abs(w-we)<=Mt*Math.max(1,Math.abs(w),Math.abs(we))&&Math.abs(M-be)<=Mt*Math.max(1,Math.abs(M),Math.abs(be))&&Math.abs(C-Te)<=Mt*Math.max(1,Math.abs(C),Math.abs(Te))&&Math.abs(E-_e)<=Mt*Math.max(1,Math.abs(E),Math.abs(_e))&&Math.abs(k-ke)<=Mt*Math.max(1,Math.abs(k),Math.abs(ke))&&Math.abs(O-Fe)<=Mt*Math.max(1,Math.abs(O),Math.abs(Fe))&&Math.abs(Z-Be)<=Mt*Math.max(1,Math.abs(Z),Math.abs(Be))},z.bX=function(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},z.bY=n=>n.type==="symbol",z.bZ=n=>n.type==="circle",z.b_=n=>n.type==="heatmap",z.ba=Nr,z.bb=ni,z.bc=function(n,t,r,s,l){return jr(s,l,Li((n-t)/(r-t),0,1))},z.bd=xr,z.be=function(){return new Float64Array(4)},z.bf=function(){return new Float64Array(3)},z.bg=function(n,t,r,s){var l=[],d=[];return l[0]=t[0]-r[0],l[1]=t[1]-r[1],l[2]=t[2]-r[2],d[0]=l[0]*Math.cos(s)-l[1]*Math.sin(s),d[1]=l[0]*Math.sin(s)+l[1]*Math.cos(s),d[2]=l[2],n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},z.bh=function(n,t,r,s){var l=[],d=[];return l[0]=t[0]-r[0],l[1]=t[1]-r[1],l[2]=t[2]-r[2],d[0]=l[0],d[1]=l[1]*Math.cos(s)-l[2]*Math.sin(s),d[2]=l[1]*Math.sin(s)+l[2]*Math.cos(s),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},z.bi=function(n,t,r,s){var l=[],d=[];return l[0]=t[0]-r[0],l[1]=t[1]-r[1],l[2]=t[2]-r[2],d[0]=l[2]*Math.sin(s)+l[0]*Math.cos(s),d[1]=l[1],d[2]=l[2]*Math.cos(s)-l[0]*Math.sin(s),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},z.bj=function(n,t,r){var s=Math.sin(r),l=Math.cos(r),d=t[0],p=t[1],m=t[2],g=t[3],x=t[8],b=t[9],w=t[10],M=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*l-x*s,n[1]=p*l-b*s,n[2]=m*l-w*s,n[3]=g*l-M*s,n[8]=d*s+x*l,n[9]=p*s+b*l,n[10]=m*s+w*l,n[11]=g*s+M*l,n},z.bk=function(n,t){const r=xr(n,360),s=xr(t,360),l=s-r,d=s>r?l-360:l+360;return Math.abs(l)0?p:-p},z.bn=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]},z.bo=xh,z.bp=function(n,t){const r=xr(n,2*Math.PI),s=xr(t,2*Math.PI);return Math.min(Math.abs(r-s),Math.abs(r-s+2*Math.PI),Math.abs(r-s-2*Math.PI))},z.bq=function(n){return Math.hypot(n[0],n[1],n[2])},z.br=function(){const n={},t=j.$version;for(const r in j.$root){const s=j.$root[r];if(s.required){let l=null;l=r==="version"?t:s.type==="array"?[]:{},l!=null&&(n[r]=l)}}return n},z.bs=Gl,z.bt=Wr,z.bu=function(n){n=n.slice();const t=Object.create(null);for(let r=0;r{"source"in p&&s[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(l),function(p,m,g){m=m||[];const x=(p=p||[]).map(he),b=m.map(he),w=p.reduce(ne,{}),M=m.reduce(ne,{}),C=x.slice(),E=Object.create(null);let k,O,Z,ee,q;for(let I=0,F=0;In.type==="fill",z.c1=n=>n.type==="fill-extrusion",z.c2=n=>n.type==="hillshade",z.c3=n=>n.type==="raster",z.c4=n=>n.type==="background",z.c5=n=>n.type==="custom",z.c6=xn,z.c7=function(n,t,r){const s=Kn(t.x-r.x,t.y-r.y),l=Kn(n.x-r.x,n.y-r.y);var d,p;return mi(Math.atan2(s[0]*l[1]-s[1]*l[0],(d=s)[0]*(p=l)[0]+d[1]*p[1]))},z.c8=$i,z.c9=function(n,t,r){var s=t[0],l=t[1];return n[0]=r[0]*s+r[4]*l+r[12],n[1]=r[1]*s+r[5]*l+r[13],n},z.cA=_u,z.cB=Qs,z.cC=ar,z.ca=function(n,t){const{x:r,y:s}=Qo.fromLngLat(t);return!(n<0||n>25||s<0||s>=1||r<0||r>=1)},z.cb=function(n,t){return n[0]=t[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=t[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},z.cc=class extends Ts{},z.cd=Op,z.cf=function(n){return n.message===qr},z.cg=er,z.ch=function(n,t){wr.REGISTERED_PROTOCOLS[n]=t},z.ci=function(n){delete wr.REGISTERED_PROTOCOLS[n]},z.cj=function(n,t){const r={};for(let l=0;lTe*Ut)}let ce=p?"center":r.get("text-justify").evaluate(x,{},n.canonical);const pe=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},n.canonical)*Ut:1/0,we=()=>{n.bucket.allowVerticalPlacement&&On(I)&&(E.vertical=dc(k,n.glyphMap,n.glyphPositions,n.imagePositions,b,pe,d,ae,"left",H,Z,z.ai.vertical,!0,M,w))};if(!p&&xe){const be=new Set;if(ce==="auto")for(let _e=0;_ec(void 0,void 0,void 0,function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),z.e=Wt,z.f=n=>new Promise((t,r)=>{const s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=$r})},s.onerror=()=>r(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 l=new Blob([new Uint8Array(n)],{type:"image/png"});s.src=n.byteLength?URL.createObjectURL(l):$r}),z.g=Jn,z.h=(n,t)=>tr(Wt(n,{type:"json"}),t),z.i=Qi,z.j=Qn,z.k=bn,z.l=(n,t)=>tr(Wt(n,{type:"arrayBuffer"}),t),z.m=tr,z.n=function(n){return new ch(n).readFields(lp,[])},z.o=No,z.p=gu,z.q=ui,z.r=Uc,z.s=Kr,z.t=Vl,z.u=Fn,z.v=j,z.w=ti,z.x=function([n,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(r),y:n*Math.sin(t)*Math.sin(r),z:n*Math.cos(r)}},z.y=Oi,z.z=yt}),Lr("worker",["./shared"],function(z){class c{constructor(D){this.keyCache={},D&&this.replace(D)}replace(D){this._layerConfigs={},this._layers={},this.update(D,[])}update(D,L){for(const $ of D){this._layerConfigs[$.id]=$;const Y=this._layers[$.id]=z.bv($);Y._featureFilter=z.a4(Y.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of L)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const B=z.cj(Object.values(this._layerConfigs),this.keyCache);for(const $ of B){const Y=$.map(ne=>this._layers[ne.id]),re=Y[0];if(re.visibility==="none")continue;const le=re.source||"";let ie=this.familiesBySource[le];ie||(ie=this.familiesBySource[le]={});const fe=re.sourceLayer||"_geojsonTileLayer";let he=ie[fe];he||(he=ie[fe]=[]),he.push(Y)}}}class Pi{constructor(D){const L={},B=[];for(const le in D){const ie=D[le],fe=L[le]={};for(const he in ie){const ne=ie[+he];if(!ne||ne.bitmap.width===0||ne.bitmap.height===0)continue;const te={x:0,y:0,w:ne.bitmap.width+2,h:ne.bitmap.height+2};B.push(te),fe[he]={rect:te,metrics:ne.metrics}}}const{w:$,h:Y}=z.p(B),re=new z.o({width:$||1,height:Y||1});for(const le in D){const ie=D[le];for(const fe in ie){const he=ie[+fe];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const ne=L[le][fe].rect;z.o.copy(he.bitmap,re,{x:0,y:0},{x:ne.x+1,y:ne.y+1},he.bitmap)}}this.image=re,this.positions=L}}z.ck("GlyphAtlas",Pi);class fr{constructor(D){this.tileID=new z.S(D.tileID.overscaledZ,D.tileID.wrap,D.tileID.canonical.z,D.tileID.canonical.x,D.tileID.canonical.y),this.uid=D.uid,this.zoom=D.zoom,this.pixelRatio=D.pixelRatio,this.tileSize=D.tileSize,this.source=D.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=D.showCollisionBoxes,this.collectResourceTiming=!!D.collectResourceTiming,this.returnDependencies=!!D.returnDependencies,this.promoteId=D.promoteId,this.inFlightDependencies=[]}parse(D,L,B,$,Y){return z._(this,void 0,void 0,function*(){this.status="parsing",this.data=D,this.collisionBoxArray=new z.a2;const re=new z.cl(Object.keys(D.layers).sort()),le=new z.cm(this.tileID,this.promoteId);le.bucketLayerIDs=[];const ie={},fe={featureIndex:le,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:B,subdivisionGranularity:Y},he=L.familiesBySource[this.source];for(const Ve in he){const ze=D.layers[Ve];if(!ze)continue;ze.version===1&&z.w(`Vector tile source "${this.source}" layer "${Ve}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const St=re.encode(Ve),Mr=[];for(let jt=0;jt=Rt.maxzoom||Rt.visibility!=="none"&&(Mi(jt,this.zoom,B),(ie[Rt.id]=Rt.createBucket({index:le.bucketLayerIDs.length,layers:jt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:St,sourceID:this.source})).populate(Mr,fe,this.tileID.canonical),le.bucketLayerIDs.push(jt.map(mt=>mt.id)))}}const ne=z.bA(fe.glyphDependencies,Ve=>Object.keys(Ve).map(Number));this.inFlightDependencies.forEach(Ve=>Ve==null?void 0:Ve.abort()),this.inFlightDependencies=[];let te=Promise.resolve({});if(Object.keys(ne).length){const Ve=new AbortController;this.inFlightDependencies.push(Ve),te=$.sendAsync({type:"GG",data:{stacks:ne,source:this.source,tileID:this.tileID,type:"glyphs"}},Ve)}const Ie=Object.keys(fe.iconDependencies);let Me=Promise.resolve({});if(Ie.length){const Ve=new AbortController;this.inFlightDependencies.push(Ve),Me=$.sendAsync({type:"GI",data:{icons:Ie,source:this.source,tileID:this.tileID,type:"icons"}},Ve)}const je=Object.keys(fe.patternDependencies);let Ue=Promise.resolve({});if(je.length){const Ve=new AbortController;this.inFlightDependencies.push(Ve),Ue=$.sendAsync({type:"GI",data:{icons:je,source:this.source,tileID:this.tileID,type:"patterns"}},Ve)}const[ge,Ce,De]=yield Promise.all([te,Me,Ue]),qe=new Pi(ge),Je=new z.cn(Ce,De);for(const Ve in ie){const ze=ie[Ve];ze instanceof z.a3?(Mi(ze.layers,this.zoom,B),z.co({bucket:ze,glyphMap:ge,glyphPositions:qe.positions,imageMap:Ce,imagePositions:Je.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:fe.subdivisionGranularity})):ze.hasPattern&&(ze instanceof z.cp||ze instanceof z.cq||ze instanceof z.cr)&&(Mi(ze.layers,this.zoom,B),ze.addFeatures(fe,this.tileID.canonical,Je.patternPositions))}return this.status="done",{buckets:Object.values(ie).filter(Ve=>!Ve.isEmpty()),featureIndex:le,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:qe.image,imageAtlas:Je,glyphMap:this.returnDependencies?ge:null,iconMap:this.returnDependencies?Ce:null,glyphPositions:this.returnDependencies?qe.positions:null}})}}function Mi(j,D,L){const B=new z.z(D);for(const $ of j)$.recalculate(B,L)}class mr{constructor(D,L,B){this.actor=D,this.layerIndex=L,this.availableImages=B,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(D,L){return z._(this,void 0,void 0,function*(){const B=yield z.l(D.request,L);try{return{vectorTile:new z.cs.VectorTile(new z.ct(B.data)),rawData:B.data,cacheControl:B.cacheControl,expires:B.expires}}catch($){const Y=new Uint8Array(B.data);let re=`Unable to parse the tile at ${D.request.url}, `;throw re+=Y[0]===31&&Y[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${$.message}`,new Error(re)}})}loadTile(D){return z._(this,void 0,void 0,function*(){const L=D.uid,B=!!(D&&D.request&&D.request.collectResourceTiming)&&new z.cu(D.request),$=new fr(D);this.loading[L]=$;const Y=new AbortController;$.abort=Y;try{const re=yield this.loadVectorTile(D,Y);if(delete this.loading[L],!re)return null;const le=re.rawData,ie={};re.expires&&(ie.expires=re.expires),re.cacheControl&&(ie.cacheControl=re.cacheControl);const fe={};if(B){const ne=B.finish();ne&&(fe.resourceTiming=JSON.parse(JSON.stringify(ne)))}$.vectorTile=re.vectorTile;const he=$.parse(re.vectorTile,this.layerIndex,this.availableImages,this.actor,D.subdivisionGranularity);this.loaded[L]=$,this.fetching[L]={rawTileData:le,cacheControl:ie,resourceTiming:fe};try{const ne=yield he;return z.e({rawTileData:le.slice(0)},ne,ie,fe)}finally{delete this.fetching[L]}}catch(re){throw delete this.loading[L],$.status="done",this.loaded[L]=$,re}})}reloadTile(D){return z._(this,void 0,void 0,function*(){const L=D.uid;if(!this.loaded||!this.loaded[L])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const B=this.loaded[L];if(B.showCollisionBoxes=D.showCollisionBoxes,B.status==="parsing"){const $=yield B.parse(B.vectorTile,this.layerIndex,this.availableImages,this.actor,D.subdivisionGranularity);let Y;if(this.fetching[L]){const{rawTileData:re,cacheControl:le,resourceTiming:ie}=this.fetching[L];delete this.fetching[L],Y=z.e({rawTileData:re.slice(0)},$,le,ie)}else Y=$;return Y}if(B.status==="done"&&B.vectorTile)return B.parse(B.vectorTile,this.layerIndex,this.availableImages,this.actor,D.subdivisionGranularity)})}abortTile(D){return z._(this,void 0,void 0,function*(){const L=this.loading,B=D.uid;L&&L[B]&&L[B].abort&&(L[B].abort.abort(),delete L[B])})}removeTile(D){return z._(this,void 0,void 0,function*(){this.loaded&&this.loaded[D.uid]&&delete this.loaded[D.uid]})}}class Ze{constructor(){this.loaded={}}loadTile(D){return z._(this,void 0,void 0,function*(){const{uid:L,encoding:B,rawImageData:$,redFactor:Y,greenFactor:re,blueFactor:le,baseShift:ie}=D,fe=$.width+2,he=$.height+2,ne=z.b($)?new z.R({width:fe,height:he},yield z.cv($,-1,-1,fe,he)):$,te=new z.cw(L,ne,B,Y,re,le,ie);return this.loaded=this.loaded||{},this.loaded[L]=te,te})}removeTile(D){const L=this.loaded,B=D.uid;L&&L[B]&&delete L[B]}}var ue,Oe,Br=function(){if(Oe)return ue;function j(L,B){if(L.length!==0){D(L[0],B);for(var $=1;$=Math.abs(fe)?$-he+fe:fe-he+$,$=he}$+Y>=0!=!!B&&L.reverse()}return Oe=1,ue=function L(B,$){var Y,re=B&&B.type;if(re==="FeatureCollection")for(Y=0;Y>31}function ie(he,ne){for(var te=he.loadGeometry(),Ie=he.type,Me=0,je=0,Ue=te.length,ge=0;gej},yr=Math.fround||(Ji=new Float32Array(1),j=>(Ji[0]=+j,Ji[0]));var Ji;const Si=3,ei=5,Kn=6;class rt{constructor(D){this.options=Object.assign(Object.create(Rs),D),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(D){const{log:L,minZoom:B,maxZoom:$}=this.options;L&&console.time("total time");const Y=`prepare ${D.length} points`;L&&console.time(Y),this.points=D;const re=[];for(let ie=0;ie=B;ie--){const fe=+Date.now();le=this.trees[ie]=this._createTree(this._cluster(le,ie)),L&&console.log("z%d: %d clusters in %dms",ie,le.numItems,+Date.now()-fe)}return L&&console.timeEnd("total time"),this}getClusters(D,L){let B=((D[0]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,D[1]));let Y=D[2]===180?180:((D[2]+180)%360+360)%360-180;const re=Math.max(-90,Math.min(90,D[3]));if(D[2]-D[0]>=360)B=-180,Y=180;else if(B>Y){const ne=this.getClusters([B,$,180,re],L),te=this.getClusters([-180,$,Y,re],L);return ne.concat(te)}const le=this.trees[this._limitZoom(L)],ie=le.range(jr(B),Nr(re),jr(Y),Nr($)),fe=le.data,he=[];for(const ne of ie){const te=this.stride*ne;he.push(fe[te+ei]>1?yn(fe,te,this.clusterProps):this.points[fe[te+Si]])}return he}getChildren(D){const L=this._getOriginId(D),B=this._getOriginZoom(D),$="No cluster with the specified id.",Y=this.trees[B];if(!Y)throw new Error($);const re=Y.data;if(L*this.stride>=re.length)throw new Error($);const le=this.options.radius/(this.options.extent*Math.pow(2,B-1)),ie=Y.within(re[L*this.stride],re[L*this.stride+1],le),fe=[];for(const he of ie){const ne=he*this.stride;re[ne+4]===D&&fe.push(re[ne+ei]>1?yn(re,ne,this.clusterProps):this.points[re[ne+Si]])}if(fe.length===0)throw new Error($);return fe}getLeaves(D,L,B){const $=[];return this._appendLeaves($,D,L=L||10,B=B||0,0),$}getTile(D,L,B){const $=this.trees[this._limitZoom(D)],Y=Math.pow(2,D),{extent:re,radius:le}=this.options,ie=le/re,fe=(B-ie)/Y,he=(B+1+ie)/Y,ne={features:[]};return this._addTileFeatures($.range((L-ie)/Y,fe,(L+1+ie)/Y,he),$.data,L,B,Y,ne),L===0&&this._addTileFeatures($.range(1-ie/Y,fe,1,he),$.data,Y,B,Y,ne),L===Y-1&&this._addTileFeatures($.range(0,fe,ie/Y,he),$.data,-1,B,Y,ne),ne.features.length?ne:null}getClusterExpansionZoom(D){let L=this._getOriginZoom(D)-1;for(;L<=this.options.maxZoom;){const B=this.getChildren(D);if(L++,B.length!==1)break;D=B[0].properties.cluster_id}return L}_appendLeaves(D,L,B,$,Y){const re=this.getChildren(L);for(const le of re){const ie=le.properties;if(ie&&ie.cluster?Y+ie.point_count<=$?Y+=ie.point_count:Y=this._appendLeaves(D,ie.cluster_id,B,$,Y):Y<$?Y++:D.push(le),D.length===B)break}return Y}_createTree(D){const L=new z.az(D.length/this.stride|0,this.options.nodeSize,Float32Array);for(let B=0;B1;let he,ne,te;if(fe)he=xr(L,ie,this.clusterProps),ne=L[ie],te=L[ie+1];else{const je=this.points[L[ie+Si]];he=je.properties;const[Ue,ge]=je.geometry.coordinates;ne=jr(Ue),te=Nr(ge)}const Ie={type:1,geometry:[[Math.round(this.options.extent*(ne*Y-B)),Math.round(this.options.extent*(te*Y-$))]],tags:he};let Me;Me=fe||this.options.generateId?L[ie+Si]:this.points[L[ie+Si]].id,Me!==void 0&&(Ie.id=Me),re.features.push(Ie)}}_limitZoom(D){return Math.max(this.options.minZoom,Math.min(Math.floor(+D),this.options.maxZoom+1))}_cluster(D,L){const{radius:B,extent:$,reduce:Y,minPoints:re}=this.options,le=B/($*Math.pow(2,L)),ie=D.data,fe=[],he=this.stride;for(let ne=0;neL&&(Ue+=ie[Ce+ei])}if(Ue>je&&Ue>=re){let ge,Ce=te*je,De=Ie*je,qe=-1;const Je=((ne/he|0)<<5)+(L+1)+this.points.length;for(const Ve of Me){const ze=Ve*he;if(ie[ze+2]<=L)continue;ie[ze+2]=L;const St=ie[ze+ei];Ce+=ie[ze]*St,De+=ie[ze+1]*St,ie[ze+4]=Je,Y&&(ge||(ge=this._map(ie,ne,!0),qe=this.clusterProps.length,this.clusterProps.push(ge)),Y(ge,this._map(ie,ze)))}ie[ne+4]=Je,fe.push(Ce/Ue,De/Ue,1/0,Je,-1,Ue),Y&&fe.push(qe)}else{for(let ge=0;ge1)for(const ge of Me){const Ce=ge*he;if(!(ie[Ce+2]<=L)){ie[Ce+2]=L;for(let De=0;De>5}_getOriginZoom(D){return(D-this.points.length)%32}_map(D,L,B){if(D[L+ei]>1){const re=this.clusterProps[D[L+Kn]];return B?Object.assign({},re):re}const $=this.points[D[L+Si]].properties,Y=this.options.map($);return B&&Y===$?Object.assign({},Y):Y}}function yn(j,D,L){return{type:"Feature",id:j[D+Si],properties:xr(j,D,L),geometry:{type:"Point",coordinates:[(B=j[D],360*(B-.5)),xn(j[D+1])]}};var B}function xr(j,D,L){const B=j[D+ei],$=B>=1e4?`${Math.round(B/1e3)}k`:B>=1e3?Math.round(B/100)/10+"k":B,Y=j[D+Kn],re=Y===-1?{}:Object.assign({},L[Y]);return Object.assign(re,{cluster:!0,cluster_id:j[D+Si],point_count:B,point_count_abbreviated:$})}function jr(j){return j/360+.5}function Nr(j){const D=Math.sin(j*Math.PI/180),L=.5-.25*Math.log((1+D)/(1-D))/Math.PI;return L<0?0:L>1?1:L}function xn(j){const D=(180-360*j)*Math.PI/180;return 360*Math.atan(Math.exp(D))/Math.PI-90}function $i(j,D,L,B){let $=B;const Y=D+(L-D>>1);let re,le=L-D;const ie=j[D],fe=j[D+1],he=j[L],ne=j[L+1];for(let te=D+3;te$)re=te,$=Ie;else if(Ie===$){const Me=Math.abs(te-Y);MeB&&(re-D>3&&$i(j,D,re,B),j[re+2]=$,L-re>3&&$i(j,re,L,B))}function Li(j,D,L,B,$,Y){let re=$-L,le=Y-B;if(re!==0||le!==0){const ie=((j-L)*re+(D-B)*le)/(re*re+le*le);ie>1?(L=$,B=Y):ie>0&&(L+=re*ie,B+=le*ie)}return re=j-L,le=D-B,re*re+le*le}function Ii(j,D,L,B){const $={id:j??null,type:D,geometry:L,tags:B,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(D==="Point"||D==="MultiPoint"||D==="LineString")Wt($,L);else if(D==="Polygon")Wt($,L[0]);else if(D==="MultiLineString")for(const Y of L)Wt($,Y);else if(D==="MultiPolygon")for(const Y of L)Wt($,Y[0]);return $}function Wt(j,D){for(let L=0;L0&&(re+=B?($*he-fe*Y)/2:Math.sqrt(Math.pow(fe-$,2)+Math.pow(he-Y,2))),$=fe,Y=he}const le=D.length-3;D[2]=1,$i(D,0,le,L),D[le+2]=1,D.size=Math.abs(re),D.start=0,D.end=D.size}function fi(j,D,L,B){for(let $=0;$1?1:L}function Ot(j,D,L,B,$,Y,re,le){if(B/=D,Y>=(L/=D)&&re=B)return null;const ie=[];for(const fe of j){const he=fe.geometry;let ne=fe.type;const te=$===0?fe.minX:fe.minY,Ie=$===0?fe.maxX:fe.maxY;if(te>=L&&Ie=B)continue;let Me=[];if(ne==="Point"||ne==="MultiPoint")Qi(he,Me,L,B,$);else if(ne==="LineString")zt(he,Me,L,B,$,!1,le.lineMetrics);else if(ne==="MultiLineString")$r(he,Me,L,B,$,!1);else if(ne==="Polygon")$r(he,Me,L,B,$,!0);else if(ne==="MultiPolygon")for(const je of he){const Ue=[];$r(je,Ue,L,B,$,!0),Ue.length&&Me.push(Ue)}if(Me.length){if(le.lineMetrics&&ne==="LineString"){for(const je of Me)ie.push(Ii(fe.id,ne,je,fe.tags));continue}ne!=="LineString"&&ne!=="MultiLineString"||(Me.length===1?(ne="LineString",Me=Me[0]):ne="MultiLineString"),ne!=="Point"&&ne!=="MultiPoint"||(ne=Me.length===3?"Point":"MultiPoint"),ie.push(Ii(fe.id,ne,Me,fe.tags))}}return ie.length?ie:null}function Qi(j,D,L,B,$){for(let Y=0;Y=L&&re<=B&&Bi(D,j[Y],j[Y+1],j[Y+2])}}function zt(j,D,L,B,$,Y,re){let le=Gr(j);const ie=$===0?vr:br;let fe,he,ne=j.start;for(let Ue=0;UeL&&(he=ie(le,ge,Ce,qe,Je,L),re&&(le.start=ne+fe*he)):Ve>B?ze=L&&(he=ie(le,ge,Ce,qe,Je,L),St=!0),ze>B&&Ve<=B&&(he=ie(le,ge,Ce,qe,Je,B),St=!0),!Y&&St&&(re&&(le.end=ne+fe*he),D.push(le),le=Gr(j)),re&&(ne+=fe)}let te=j.length-3;const Ie=j[te],Me=j[te+1],je=$===0?Ie:Me;je>=L&&je<=B&&Bi(le,Ie,Me,j[te+2]),te=le.length-3,Y&&te>=3&&(le[te]!==le[0]||le[te+1]!==le[1])&&Bi(le,le[0],le[1],le[2]),le.length&&D.push(le)}function Gr(j){const D=[];return D.size=j.size,D.start=j.start,D.end=j.end,D}function $r(j,D,L,B,$,Y){for(const re of j)zt(re,D,L,B,$,Y,!1)}function Bi(j,D,L,B){j.push(D,L,B)}function vr(j,D,L,B,$,Y){const re=(Y-D)/(B-D);return Bi(j,Y,L+($-L)*re,1),re}function br(j,D,L,B,$,Y){const re=(Y-L)/($-L);return Bi(j,D+(B-D)*re,Y,1),re}function mi(j,D){const L=[];for(let B=0;B0&&D.size<($?re:B))return void(L.numPoints+=D.length/3);const le=[];for(let ie=0;iere)&&(L.numSimplified++,le.push(D[ie],D[ie+1])),L.numPoints++;$&&function(ie,fe){let he=0;for(let ne=0,te=ie.length,Ie=te-2;ne0===fe)for(let ne=0,te=ie.length;ne24)throw new Error("maxZoom should be in the 0-24 range");if(L.promoteId&&L.generateId)throw new Error("promoteId and generateId cannot be used together.");let $=function(Y,re){const le=[];if(Y.type==="FeatureCollection")for(let ie=0;ie1&&console.time("creation"),Ie=this.tiles[te]=Jn(D,L,B,$,fe),this.tileCoords.push({z:L,x:B,y:$}),he)){he>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",L,B,$,Ie.numFeatures,Ie.numPoints,Ie.numSimplified),console.timeEnd("creation"));const St=`z${L}`;this.stats[St]=(this.stats[St]||0)+1,this.total++}if(Ie.source=D,Y==null){if(L===fe.indexMaxZoom||Ie.numPoints<=fe.indexMaxPoints)continue}else{if(L===fe.maxZoom||L===Y)continue;if(Y!=null){const St=Y-L;if(B!==re>>St||$!==le>>St)continue}}if(Ie.source=null,D.length===0)continue;he>1&&console.time("clipping");const Me=.5*fe.buffer/fe.extent,je=.5-Me,Ue=.5+Me,ge=1+Me;let Ce=null,De=null,qe=null,Je=null,Ve=Ot(D,ne,B-Me,B+Ue,0,Ie.minX,Ie.maxX,fe),ze=Ot(D,ne,B+je,B+ge,0,Ie.minX,Ie.maxX,fe);D=null,Ve&&(Ce=Ot(Ve,ne,$-Me,$+Ue,1,Ie.minY,Ie.maxY,fe),De=Ot(Ve,ne,$+je,$+ge,1,Ie.minY,Ie.maxY,fe),Ve=null),ze&&(qe=Ot(ze,ne,$-Me,$+Ue,1,Ie.minY,Ie.maxY,fe),Je=Ot(ze,ne,$+je,$+ge,1,Ie.minY,Ie.maxY,fe),ze=null),he>1&&console.timeEnd("clipping"),ie.push(Ce||[],L+1,2*B,2*$),ie.push(De||[],L+1,2*B,2*$+1),ie.push(qe||[],L+1,2*B+1,2*$),ie.push(Je||[],L+1,2*B+1,2*$+1)}}getTile(D,L,B){D=+D,L=+L,B=+B;const $=this.options,{extent:Y,debug:re}=$;if(D<0||D>24)return null;const le=1<1&&console.log("drilling down to z%d-%d-%d",D,L,B);let fe,he=D,ne=L,te=B;for(;!fe&&he>0;)he--,ne>>=1,te>>=1,fe=this.tiles[Kr(he,ne,te)];return fe&&fe.source?(re>1&&(console.log("found parent tile z%d-%d-%d",he,ne,te),console.time("drilling down")),this.splitTile(fe.source,he,ne,te,D,L,B),re>1&&console.timeEnd("drilling down"),this.tiles[ie]?Hr(this.tiles[ie],Y):null):null}}function Kr(j,D,L){return 32*((1<{ne.properties=Ie;const Me={};for(const je of te)Me[je]=ie[je].evaluate(he,ne);return Me},re.reduce=(Ie,Me)=>{ne.properties=Me;for(const je of te)he.accumulated=Ie[je],Ie[je]=fe[je].evaluate(he,ne)},re}(D)).load((yield this._pendingData).features):($=yield this._pendingData,new tr($,D.geojsonVtOptions)),this.loaded={};const Y={};if(B){const re=B.finish();re&&(Y.resourceTiming={},Y.resourceTiming[D.source]=JSON.parse(JSON.stringify(re)))}return Y}catch(Y){if(delete this._pendingRequest,z.cf(Y))return{abandoned:!0};throw Y}var $})}getData(){return z._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(D){const L=this.loaded;return L&&L[D.uid]?super.reloadTile(D):this.loadTile(D)}loadAndProcessGeoJSON(D,L){return z._(this,void 0,void 0,function*(){let B=yield this.loadGeoJSON(D,L);if(delete this._pendingRequest,typeof B!="object")throw new Error(`Input data given to '${D.source}' is not a valid GeoJSON object.`);if(_r(B,!0),D.filter){const $=z.cB(D.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if($.result==="error")throw new Error($.value.map(re=>`${re.key}: ${re.message}`).join(", "));B={type:"FeatureCollection",features:B.features.filter(re=>$.value.evaluate({zoom:0},re))}}return B})}loadGeoJSON(D,L){return z._(this,void 0,void 0,function*(){const{promoteId:B}=D;if(D.request){const $=yield z.h(D.request,L);return this._dataUpdateable=vn($.data,B)?bn($.data,B):void 0,$.data}if(typeof D.data=="string")try{const $=JSON.parse(D.data);return this._dataUpdateable=vn($,B)?bn($,B):void 0,$}catch{throw new Error(`Input data given to '${D.source}' is not a valid GeoJSON object.`)}if(!D.dataDiff)throw new Error(`Input data given to '${D.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${D.source}`);return function($,Y,re){var le,ie,fe,he;if(Y.removeAll&&$.clear(),Y.remove)for(const ne of Y.remove)$.delete(ne);if(Y.add)for(const ne of Y.add){const te=Tr(ne,re);te!=null&&$.set(te,ne)}if(Y.update)for(const ne of Y.update){let te=$.get(ne.id);if(te==null)continue;const Ie=!ne.removeAllProperties&&(((le=ne.removeProperties)===null||le===void 0?void 0:le.length)>0||((ie=ne.addOrUpdateProperties)===null||ie===void 0?void 0:ie.length)>0);if((ne.newGeometry||ne.removeAllProperties||Ie)&&(te=Object.assign({},te),$.set(ne.id,te),Ie&&(te.properties=Object.assign({},te.properties))),ne.newGeometry&&(te.geometry=ne.newGeometry),ne.removeAllProperties)te.properties={};else if(((fe=ne.removeProperties)===null||fe===void 0?void 0:fe.length)>0)for(const Me of ne.removeProperties)Object.prototype.hasOwnProperty.call(te.properties,Me)&&delete te.properties[Me];if(((he=ne.addOrUpdateProperties)===null||he===void 0?void 0:he.length)>0)for(const{key:Me,value:je}of ne.addOrUpdateProperties)te.properties[Me]=je}}(this._dataUpdateable,D.dataDiff,B),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(D){return z._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(D){return this._geoJSONIndex.getClusterExpansionZoom(D.clusterId)}getClusterChildren(D){return this._geoJSONIndex.getChildren(D.clusterId)}getClusterLeaves(D){return this._geoJSONIndex.getLeaves(D.clusterId,D.limit,D.offset)}}class Pr{constructor(D){this.self=D,this.actor=new z.F(D),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(L,B)=>{if(this.externalWorkerSourceTypes[L])throw new Error(`Worker source with name "${L}" already registered.`);this.externalWorkerSourceTypes[L]=B},this.self.addProtocol=z.ch,this.self.removeProtocol=z.ci,this.self.registerRTLTextPlugin=L=>{z.cC.setMethods(L)},this.actor.registerMessageHandler("LDT",(L,B)=>this._getDEMWorkerSource(L,B.source).loadTile(B)),this.actor.registerMessageHandler("RDT",(L,B)=>z._(this,void 0,void 0,function*(){this._getDEMWorkerSource(L,B.source).removeTile(B)})),this.actor.registerMessageHandler("GCEZ",(L,B)=>z._(this,void 0,void 0,function*(){return this._getWorkerSource(L,B.type,B.source).getClusterExpansionZoom(B)})),this.actor.registerMessageHandler("GCC",(L,B)=>z._(this,void 0,void 0,function*(){return this._getWorkerSource(L,B.type,B.source).getClusterChildren(B)})),this.actor.registerMessageHandler("GCL",(L,B)=>z._(this,void 0,void 0,function*(){return this._getWorkerSource(L,B.type,B.source).getClusterLeaves(B)})),this.actor.registerMessageHandler("LD",(L,B)=>this._getWorkerSource(L,B.type,B.source).loadData(B)),this.actor.registerMessageHandler("GD",(L,B)=>this._getWorkerSource(L,B.type,B.source).getData()),this.actor.registerMessageHandler("LT",(L,B)=>this._getWorkerSource(L,B.type,B.source).loadTile(B)),this.actor.registerMessageHandler("RT",(L,B)=>this._getWorkerSource(L,B.type,B.source).reloadTile(B)),this.actor.registerMessageHandler("AT",(L,B)=>this._getWorkerSource(L,B.type,B.source).abortTile(B)),this.actor.registerMessageHandler("RMT",(L,B)=>this._getWorkerSource(L,B.type,B.source).removeTile(B)),this.actor.registerMessageHandler("RS",(L,B)=>z._(this,void 0,void 0,function*(){if(!this.workerSources[L]||!this.workerSources[L][B.type]||!this.workerSources[L][B.type][B.source])return;const $=this.workerSources[L][B.type][B.source];delete this.workerSources[L][B.type][B.source],$.removeSource!==void 0&&$.removeSource(B)})),this.actor.registerMessageHandler("RM",L=>z._(this,void 0,void 0,function*(){delete this.layerIndexes[L],delete this.availableImages[L],delete this.workerSources[L],delete this.demWorkerSources[L]})),this.actor.registerMessageHandler("SR",(L,B)=>z._(this,void 0,void 0,function*(){this.referrer=B})),this.actor.registerMessageHandler("SRPS",(L,B)=>this._syncRTLPluginState(L,B)),this.actor.registerMessageHandler("IS",(L,B)=>z._(this,void 0,void 0,function*(){this.self.importScripts(B)})),this.actor.registerMessageHandler("SI",(L,B)=>this._setImages(L,B)),this.actor.registerMessageHandler("UL",(L,B)=>z._(this,void 0,void 0,function*(){this._getLayerIndex(L).update(B.layers,B.removedIds)})),this.actor.registerMessageHandler("SL",(L,B)=>z._(this,void 0,void 0,function*(){this._getLayerIndex(L).replace(B)}))}_setImages(D,L){return z._(this,void 0,void 0,function*(){this.availableImages[D]=L;for(const B in this.workerSources[D]){const $=this.workerSources[D][B];for(const Y in $)$[Y].availableImages=L}})}_syncRTLPluginState(D,L){return z._(this,void 0,void 0,function*(){return yield z.cC.syncState(L,this.self.importScripts)})}_getAvailableImages(D){let L=this.availableImages[D];return L||(L=[]),L}_getLayerIndex(D){let L=this.layerIndexes[D];return L||(L=this.layerIndexes[D]=new c),L}_getWorkerSource(D,L,B){if(this.workerSources[D]||(this.workerSources[D]={}),this.workerSources[D][L]||(this.workerSources[D][L]={}),!this.workerSources[D][L][B]){const $={sendAsync:(Y,re)=>(Y.targetMapId=D,this.actor.sendAsync(Y,re))};switch(L){case"vector":this.workerSources[D][L][B]=new mr($,this._getLayerIndex(D),this._getAvailableImages(D));break;case"geojson":this.workerSources[D][L][B]=new Qn($,this._getLayerIndex(D),this._getAvailableImages(D));break;default:this.workerSources[D][L][B]=new this.externalWorkerSourceTypes[L]($,this._getLayerIndex(D),this._getAvailableImages(D))}}return this.workerSources[D][L][B]}_getDEMWorkerSource(D,L){return this.demWorkerSources[D]||(this.demWorkerSources[D]={}),this.demWorkerSources[D][L]||(this.demWorkerSources[D][L]=new Ze),this.demWorkerSources[D][L]}}return z.i(self)&&(self.worker=new Pr(self)),Pr}),Lr("index",["exports","./shared"],function(z,c){var Pi="5.1.0";function fr(){var h=new c.A(4);return c.A!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h}let Mi,mr;const Ze={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(h,e,i){const a=requestAnimationFrame(e);h.signal.addEventListener("abort",()=>{cancelAnimationFrame(a),i(c.c())})},frameAsync(h){return new Promise((e,i)=>{this.frame(h,e,i)})},getImageData(h,e=0){return this.getImageCanvasContext(h).getImageData(-e,-e,h.width+2*e,h.height+2*e)},getImageCanvasContext(h){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=h.width,e.height=h.height,i.drawImage(h,0,0,h.width,h.height),i},resolveURL:h=>(Mi||(Mi=document.createElement("a")),Mi.href=h,Mi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(mr==null&&(mr=matchMedia("(prefers-reduced-motion: reduce)")),mr.matches)}};class ue{static testProp(e){if(!ue.docStyle)return e[0];for(let i=0;i{window.removeEventListener("click",ue.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,a){const o=i.boundingClientRect;return new c.P((a.clientX-o.left)/i.x-e.clientLeft,(a.clientY-o.top)/i.y-e.clientTop)}static mousePos(e,i){const a=ue.getScale(e);return ue.getPoint(e,a,i)}static touchPos(e,i){const a=[],o=ue.getScale(e);for(let u=0;u{Br&&Xn(Br),Br=null,Or=!0},_r.onerror=()=>{Fr=!0,Br=null},_r.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(h){let e,i,a,o;h.resetRequestQueue=()=>{e=[],i=0,a=0,o={}},h.addThrottleControl=y=>{const v=a++;return o[v]=y,v},h.removeThrottleControl=y=>{delete o[y],f()},h.getImage=(y,v,T=!0)=>new Promise((P,S)=>{Oe.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),c.e(y,{type:"image"}),e.push({abortController:v,requestParameters:y,supportImageRefresh:T,state:"queued",onError:A=>{S(A)},onSuccess:A=>{P(A)}}),f()});const u=y=>c._(this,void 0,void 0,function*(){y.state="running";const{requestParameters:v,supportImageRefresh:T,onError:P,onSuccess:S,abortController:A}=y,R=T===!1&&!c.i(self)&&!c.g(v.url)&&(!v.headers||Object.keys(v.headers).reduce((U,G)=>U&&G==="accept",!0));i++;const V=R?_(v,A):c.m(v,A);try{const U=yield V;delete y.abortController,y.state="completed",U.data instanceof HTMLImageElement||c.b(U.data)?S(U):U.data&&S({data:yield(N=U.data,typeof createImageBitmap=="function"?c.d(N):c.f(N)),cacheControl:U.cacheControl,expires:U.expires})}catch(U){delete y.abortController,P(U)}finally{i--,f()}var N}),f=()=>{const y=(()=>{for(const v of Object.keys(o))if(o[v]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let v=i;v0;v++){const T=e.shift();T.abortController.signal.aborted?v--:u(T)}},_=(y,v)=>new Promise((T,P)=>{const S=new Image,A=y.url,R=y.credentials;R&&R==="include"?S.crossOrigin="use-credentials":(R&&R==="same-origin"||!c.s(A))&&(S.crossOrigin="anonymous"),v.signal.addEventListener("abort",()=>{S.src="",P(c.c())}),S.fetchPriority="high",S.onload=()=>{S.onerror=S.onload=null,T({data:S})},S.onerror=()=>{S.onerror=S.onload=null,v.signal.aborted||P(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."))},S.src=A})}(oi||(oi={})),oi.resetRequestQueue();class gr{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Mt(h){const e=[];if(typeof h=="string")e.push({id:"default",url:h});else if(h&&h.length>0){const i=[];for(const{id:a,url:o}of h){const u=`${a}${o}`;i.indexOf(u)===-1&&(i.push(u),e.push({id:a,url:o}))}}return e}function ft(h,e,i){try{const a=new URL(h);return a.pathname+=`${e}${i}`,a.toString()}catch{throw new Error(`Invalid sprite URL "${h}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class Ct{constructor(e,i,a,o){this.context=e,this.format=a,this.texture=e.gl.createTexture(),this.update(i,o)}update(e,i,a){const{width:o,height:u}=e,f=!(this.size&&this.size[0]===o&&this.size[1]===u||a),{context:_}=this,{gl:y}=_;if(this.useMipmap=!!(i&&i.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!i||i.premultiply!==!1)),f)this.size=[o,u],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||c.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,u,0,this.format,y.UNSIGNED_BYTE,e.data);else{const{x:v,y:T}=a||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||c.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,v,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,v,T,o,u,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,i,a){const{context:o}=this,{gl:u}=o;u.bindTexture(u.TEXTURE_2D,this.texture),a!==u.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=u.LINEAR),e!==this.filter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,a||e),this.filter=e),i!==this.wrap&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Wn(h){const{userImage:e}=h;return!!(e&&e.render&&e.render())&&(h.data.replace(new Uint8Array(e.data.buffer)),!0)}class Rs extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:a}of this.requestors)a(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const a=i.spriteData;i.data=new c.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let a=!0;const o=i.data||i.spriteData;return this._validateStretch(i.stretchX,o&&o.width)||(this.fire(new c.j(new Error(`Image "${e}" has invalid "stretchX" value`))),a=!1),this._validateStretch(i.stretchY,o&&o.height)||(this.fire(new c.j(new Error(`Image "${e}" has invalid "stretchY" value`))),a=!1),this._validateContent(i.content,i)||(this.fire(new c.j(new Error(`Image "${e}" has invalid "content" value`))),a=!1),a}_validateStretch(e,i){if(!e)return!0;let a=0;for(const o of e){if(o[0]{let o=!0;if(!this.isLoaded())for(const u of e)this.images[u]||(o=!1);this.isLoaded()||o?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const a of e){let o=this.getImage(a);o||(this.fire(new c.k("styleimagemissing",{id:a})),o=this.getImage(a)),o?i[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:c.w(`Image "${a}" 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 i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],a=this.getImage(e);if(!a)return null;if(i&&i.position.version===a.version)return i.position;if(i)i.position.version=a.version;else{const o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},u=new c.I(o,a);this.patterns[e]={bin:o,position:u}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ct(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const u in this.patterns)e.push(this.patterns[u].bin);const{w:i,h:a}=c.p(e),o=this.atlasImage;o.resize({width:i||1,height:a||1});for(const u in this.patterns){const{bin:f}=this.patterns[u],_=f.x+1,y=f.y+1,v=this.getImage(u).data,T=v.width,P=v.height;c.R.copy(v,o,{x:0,y:0},{x:_,y},{width:T,height:P}),c.R.copy(v,o,{x:0,y:P-1},{x:_,y:y-1},{width:T,height:1}),c.R.copy(v,o,{x:0,y:0},{x:_,y:y+P},{width:T,height:1}),c.R.copy(v,o,{x:T-1,y:0},{x:_-1,y},{width:1,height:P}),c.R.copy(v,o,{x:0,y:0},{x:_+T,y},{width:1,height:P})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const a=this.getImage(i);a||c.w(`Image with ID: "${i}" was not found`),Wn(a)&&this.updateImage(i,a)}}}const yr=1e20;function Ji(h,e,i,a,o,u,f,_,y){for(let v=e;v-1);y++,u[y]=_,f[y]=v,f[y+1]=yr}for(let _=0,y=0;_65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[u])return{stack:e,id:i,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[u]){const _=ei.loadGlyphRange(e,u,this.url,this.requestManager);a.requests[u]=_}const f=yield a.requests[u];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(a.glyphs[+_]=f[+_]);return a.ranges[u]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,i,a){const o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let u=e.tinySDF;if(!u){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),u=e.tinySDF=new ei.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}const f=u.draw(String.fromCharCode(a));return{id:a,bitmap:new c.o({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}ei.loadGlyphRange=function(h,e,i,a){return c._(this,void 0,void 0,function*(){const o=256*e,u=o+255,f=a.transformRequest(i.replace("{fontstack}",h).replace("{range}",`${o}-${u}`),"Glyphs"),_=yield c.l(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${u}`);const y={};for(const v of c.n(_.data))y[v.id]=v;return y})},ei.TinySDF=class{constructor({fontSize:h=24,buffer:e=3,radius:i=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:u="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=a,this.radius=i;const _=this.size=h+4*e,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${u} ${h}px ${o}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(h){const e=document.createElement("canvas");return e.width=e.height=h,e}draw(h){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:u}=this.ctx.measureText(h),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-o))),y=Math.min(this.size-this.buffer,f+Math.ceil(a)),v=_+2*this.buffer,T=y+2*this.buffer,P=Math.max(v*T,0),S=new Uint8ClampedArray(P),A={data:S,width:v,height:T,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return A;const{ctx:R,buffer:V,gridInner:N,gridOuter:U}=this;R.clearRect(V,V,_,y),R.fillText(h,V,V+f);const G=R.getImageData(V,V,_,y);U.fill(yr,0,P),N.fill(0,0,P);for(let X=0;X0?J*J:0,N[Q]=J<0?J*J:0}}Ji(U,0,0,v,T,v,this.f,this.v,this.z),Ji(N,V,V,_,y,v,this.f,this.v,this.z);for(let X=0;X1&&(y=e[++_]);const T=Math.abs(v-y.left),P=Math.abs(v-y.right),S=Math.min(T,P);let A;const R=u/a*(o+1);if(y.isDash){const V=o-Math.abs(R);A=Math.sqrt(S*S+V*V)}else A=o-Math.sqrt(S*S+R*R);this.data[f+v]=Math.max(0,Math.min(255,A+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const y=e[_],v=e[_+1];y.zeroLength?e.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,e.splice(_,1))}const i=e[0],a=e[e.length-1];i.isDash===a.isDash&&(i.left=a.left-this.width,a.right=i.right+this.width);const o=this.width*this.nextRow;let u=0,f=e[u];for(let _=0;_1&&(f=e[++u]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),T=Math.min(y,v);this.data[o+_]=Math.max(0,Math.min(255,(f.isDash?T:-T)+128))}}addDash(e,i){const a=i?7:0,o=2*a+1;if(this.nextRow+o>this.height)return c.w("LineAtlas out of space"),null;let u=0;for(let _=0;_{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[xn]}numActive(){return Object.keys(this.active).length}}const Li=Math.floor(Ze.hardwareConcurrency/2);let Ii,Wt;function Vr(){return Ii||(Ii=new $i),Ii}$i.workerCount=c.C(globalThis)?Math.max(Math.min(Li,3),1):1;class Ur{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const a=this.workerPool.acquire(i);for(let o=0;o{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const a of this.actors)a.registerMessageHandler(e,i)}}function Zr(){return Wt||(Wt=new Ur(Vr(),c.G),Wt.registerMessageHandler("GR",(h,e,i)=>c.m(e,i))),Wt}function fi(h,e){const i=c.H();return c.J(i,i,[1,1,0]),c.K(i,i,[.5*h.width,.5*h.height,1]),h.calculatePosMatrix?c.L(i,i,h.calculatePosMatrix(e.toUnwrapped())):i}function Yn(h,e,i,a,o,u){var f;const _=function(P,S,A){if(P)for(const R of P){const V=S[R];if(V&&V.source===A&&V.type==="fill-extrusion")return!0}else for(const R in S){const V=S[R];if(V.source===A&&V.type==="fill-extrusion")return!0}return!1}((f=o==null?void 0:o.layers)!==null&&f!==void 0?f:null,e,h.id),y=u.maxPitchScaleFactor(),v=h.tilesIn(a,y,_);v.sort(ti);const T=[];for(const P of v)T.push({wrappedTileID:P.tileID.wrapped().key,queryResults:P.tile.queryRenderedFeatures(e,i,h._state,P.queryGeometry,P.cameraQueryGeometry,P.scale,o,u,y,fi(h.transform,P.tileID))});return function(P,S){for(const A in P)for(const R of P[A])Ot(R,S);return P}(function(P){const S={},A={};for(const R of P){const V=R.queryResults,N=R.wrappedTileID,U=A[N]=A[N]||{};for(const G in V){const X=V[G],W=U[G]=U[G]||{},K=S[G]=S[G]||[];for(const Q of X)W[Q.featureIndex]||(W[Q.featureIndex]=!0,K.push(Q))}}return S}(T),h)}function ti(h,e){const i=h.tileID,a=e.tileID;return i.overscaledZ-a.overscaledZ||i.canonical.y-a.canonical.y||i.wrap-a.wrap||i.canonical.x-a.canonical.x}function Ot(h,e){const i=h.feature,a=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=a}function Qi(h,e,i){return c._(this,void 0,void 0,function*(){let a=h;if(h.url?a=(yield c.h(e.transformRequest(h.url,"Source"),i)).data:yield Ze.frameAsync(i),!a)return null;const o=c.M(c.e(a,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map(u=>u.id)),o})}class zt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof c.N?new c.N(e.lng,e.lat):c.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof c.N?new c.N(e.lng,e.lat):c.N.convert(e),this}extend(e){const i=this._sw,a=this._ne;let o,u;if(e instanceof c.N)o=e,u=e;else{if(!(e instanceof zt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(zt.convert(e)):this.extend(c.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(c.N.convert(e)):this;if(o=e._sw,u=e._ne,!o||!u)return this}return i||a?(i.lng=Math.min(o.lng,i.lng),i.lat=Math.min(o.lat,i.lat),a.lng=Math.max(u.lng,a.lng),a.lat=Math.max(u.lat,a.lat)):(this._sw=new c.N(o.lng,o.lat),this._ne=new c.N(u.lng,u.lat)),this}getCenter(){return new c.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 c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:a}=c.N.convert(e);let o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(e){return e instanceof zt?e:e&&new zt(e)}static fromLngLat(e,i=0){const a=360*i/40075017,o=a/Math.cos(Math.PI/180*e.lat);return new zt(new c.N(e.lng-o,e.lat-a),new c.N(e.lng+o,e.lat+a))}adjustAntiMeridian(){const e=new c.N(this._sw.lng,this._sw.lat),i=new c.N(this._ne.lng,this._ne.lat);return new zt(e,e.lng>i.lng?new c.N(i.lng+360,i.lat):i)}}class Gr{constructor(e,i,a){this.bounds=zt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),a=Math.floor(c.O(this.bounds.getWest())*i),o=Math.floor(c.Q(this.bounds.getNorth())*i),u=Math.ceil(c.O(this.bounds.getEast())*i),f=Math.ceil(c.Q(this.bounds.getSouth())*i);return e.x>=a&&e.x=o&&e.y{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};a.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((u,f)=>{e.reloadPromise={resolve:u,reject:f}})}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{const u=yield e.actor.sendAsync({type:o,data:a},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,u)}catch(u){if(delete e.abortController,e.aborted)return;if(u&&u.status!==404)throw u;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const a=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(a.resolve).catch(a.reject)}}abortTile(e){return c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return c._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Bi extends c.E{constructor(e,i,a,o){super(),this.id=e,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},i),c.e(this,c.M(i,["url","scheme","tileSize"]))}load(){return c._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Qi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(c.e(this,i),i.bounds&&(this.tileBounds=new Gr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new c.j(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return c.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const a=yield oi.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const o=this.map.painter.context,u=o.gl,f=a.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new Ct(o,f,u.RGBA,{useMipmap:!0}),e.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}})}abortTile(e){return c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return c._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class vr extends Bi{constructor(e,i,a,o){super(e,i,a,o),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const o=yield oi.getImage(a,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){const u=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const f=c.b(u)&&c.U()?u:yield this.readImageNow(u),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const i=e.width+2,a=e.height+2;try{return new c.R({width:i,height:a},yield c.W(e,-1,-1,i,a))}catch{}}return Ze.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,a=Math.pow(2,i.z),o=(i.x-1+a)%a,u=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+a)%a,_=i.x+1===a?e.wrap+1:e.wrap,y={};return y[new c.S(e.overscaledZ,u,i.z,o,i.y).key]={backfilled:!1},y[new c.S(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(y[new c.S(e.overscaledZ,u,i.z,o,i.y-1).key]={backfilled:!1},y[new c.S(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},y[new c.S(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+10&&c.e(u,{resourceTiming:o}),this.fire(new c.k("data",Object.assign(Object.assign({},u),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},u),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(a))}})}loaded(){return this._pendingLoads===0}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const o=yield this.actor.sendAsync({type:i,data:a},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,i==="RT")})}abortTile(e){return c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return c._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class mi extends c.E{constructor(e,i,a,o){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=a,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=i}load(e){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield oi.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new c.j(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(c.Y.fromLngLat);var a;return this.tileID=function(o){let u=1/0,f=1/0,_=-1/0,y=-1/0;for(const S of o)u=Math.min(u,S.x),f=Math.min(f,S.y),_=Math.max(_,S.x),y=Math.max(y,S.y);const v=Math.max(_-u,y-f),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),P=Math.pow(2,T);return new c.Z(T,Math.floor((u+_)/2*P),Math.floor((f+y)/2*P))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(o=>this.tileID.getTilePoint(o)._round()),this.flippedWindingOrder=((a=this.tileCoords)[1].x-a[0].x)*(a[2].y-a[0].y)-(a[1].y-a[0].y)*(a[2].x-a[0].x)<0,this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new Ct(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,a=!0)}a&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class qr extends mi{constructor(e,i,a,o){super(e,i,a,o),this.roundZoom=!0,this.type="video",this.options=i}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield c.a0(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new c.j(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;ei.end(0)?this.fire(new c.j(new c.$(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new Ct(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let a=!1;for(const o in this.tiles){const u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,a=!0)}a&&this.fire(new c.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 Hr extends mi{constructor(e,i,a,o){super(e,i,a,o),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(u=>!Array.isArray(u)||u.length!==2||u.some(f=>typeof f!="number"))||this.fire(new c.j(new c.$(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.$(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new c.j(new c.$(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.$(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.j(new c.$(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return c._(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 c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,a=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ct(i,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(const u in this.tiles){const f=this.tiles[u];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,o=!0)}o&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const wr={},Jn=h=>{switch(h){case"geojson":return br;case"image":return mi;case"raster":return Bi;case"raster-dem":return vr;case"vector":return $r;case"video":return qr;case"canvas":return Hr}return wr[h]},Xr="RTLPluginLoaded";class er extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Zr()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return c._(this,arguments,void 0,function*(i,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ze.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(Xr))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Wr=null;function tr(){return Wr||(Wr=new er),Wr}class Kr{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=c.a1(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;iu.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const u=this.buckets[o];if(u instanceof c.a3){if(this.hasSymbolBuckets=!0,!a)break;u.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const u=this.buckets[o];if(u instanceof c.a3&&u.hasRTLText){this.hasRTLText=!0,tr().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const u=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(o).queryRadius(u))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new c.a2}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const a in this.buckets){const o=this.buckets[a];o.uploadPending()&&o.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ct(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ct(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,a,o,u,f,_,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:u,scale:f,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*v},e,i,a):{}}querySourceFeatures(e,i){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const o=a.loadVTLayers(),u=i&&i.sourceLayer?i.sourceLayer:"",f=o._geojsonTileLayer||o[u];if(!f)return;const _=c.a4(i&&i.filter),{z:y,x:v,y:T}=this.tileID.canonical,P={z:y,x:v,y:T};for(let S=0;Sa)o=!1;else if(i)if(this.expirationTime{this.remove(e,u)},a)),this.data[o].push(u),this.order.push(o),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const a=e.wrapped().key,o=i===void 0?0:this.data[a].indexOf(i),u=this.data[a][o];return this.data[a].splice(o,1),u.timeout&&clearTimeout(u.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(u.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const a in this.data)for(const o of this.data[a])e(o.value)||i.push(o);for(const a of i)this.remove(a.value.tileID,a)}}class vn{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,a){const o=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},c.e(this.stateChanges[e][o],a),this.deletedStates[e]===null){this.deletedStates[e]={};for(const u in this.state[e])u!==o&&(this.deletedStates[e][u]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const u in this.state[e][o])a[u]||(this.deletedStates[e][o][u]=null)}else for(const u in a)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][u]===null&&delete this.deletedStates[e][o][u]}removeFeatureState(e,i,a){if(this.deletedStates[e]===null)return;const o=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},a&&i!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][a]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(a in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][a]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,i){const a=String(i),o=c.e({},(this.state[e]||{})[a],(this.stateChanges[e]||{})[a]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const u=this.deletedStates[e][i];if(u===null)return{};for(const f in u)delete o[f]}return o}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const a={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const u={};for(const f in this.stateChanges[o])this.state[o][f]||(this.state[o][f]={}),c.e(this.state[o][f],this.stateChanges[o][f]),u[f]=this.state[o][f];a[o]=u}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const u={};if(this.deletedStates[o]===null)for(const f in this.state[o])u[f]={},this.state[o][f]={};else for(const f in this.deletedStates[o]){if(this.deletedStates[o][f]===null)this.state[o][f]={};else for(const _ of Object.keys(this.deletedStates[o][f]))delete this.state[o][f][_];u[f]=this.state[o][f]}a[o]=a[o]||{},c.e(a[o],u)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const o in e)e[o].setFeatureState(a,i)}}function bn(h,e,i){const a=e.intersectsFrustum(h);if(!i)return a;const o=e.intersectsPlane(i);return a===0||o===0?0:a===2&&o===2?2:1}function Qn(h,e,i,a,o){let u=h;const f=Math.atan(e/i),_=Math.hypot(e,i);return u=h+c.a8(a/_/Math.max(.5,Math.cos(c.aa(o/2)))),u+=1*c.a8(Math.cos(f))/2,u+=c.ab(h-u,-0,0),u}function Pr(h,e){const i=(e.roundZoom?Math.round:Math.floor)(h.zoom+c.a8(h.tileSize/e.tileSize));return Math.max(0,i)}function j(h,e){const i=h.getCameraFrustum(),a=h.getClippingPlane(),o=h.screenPointToMercatorCoordinate(h.getCameraPoint()),u=c.Y.fromLngLat(h.center,h.elevation);o.z=u.z+Math.cos(h.pitchInRadians)*h.cameraToCenterDistance/h.worldSize;const f=h.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(h,e),y=Pr(h,e),v=e.minzoom||0,T=e.maxzoom!==void 0?e.maxzoom:h.maxZoom,P=Math.min(Math.max(0,y),T),S=Math.pow(2,P),A=[S*o.x,S*o.y,0],R=[S*u.x,S*u.y,0],V=Math.hypot(u.x-o.x,u.y-o.y),N=Math.abs(u.z-o.z),U=Math.hypot(V,N),G=K=>({zoom:0,x:0,y:0,wrap:K,fullyVisible:!1}),X=[],W=[];if(h.renderWorldCopies&&f.allowWorldCopies())for(let K=1;K<=3;K++)X.push(G(-K)),X.push(G(K));for(X.push(G(0));X.length>0;){const K=X.pop(),Q=K.x,J=K.y;let se=K.fullyVisible;const oe={x:Q,y:J,z:K.zoom},me=f.getTileAABB(oe,K.wrap,h.elevation,e);if(!se){const Pe=bn(i,me,a);if(Pe===0)continue;se=Pe===2}const ye=f.distanceToTile2d(o.x,o.y,oe,me);let de=y;_&&(de=(e.calculateTileZoom||Qn)(h.zoom+c.a8(h.tileSize/e.tileSize),ye,N,U,h.fov)),de=(e.roundZoom?Math.round:Math.floor)(de),de=Math.max(0,de);const Se=Math.min(de,T);if(K.wrap=f.getWrap(u,oe,K.wrap),K.zoom>=Se){if(K.zoom>1),wrap:K.wrap,fullyVisible:se})}return W.sort((K,Q)=>K.distanceSq-Q.distanceSq).map(K=>K.tileID)}class D extends c.E{constructor(e,i,a){super(),this.id=e,this.dispatcher=a,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,u,f,_)=>{const y=new(Jn(u.type))(o,u,f,_);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,i,a,this),this._tiles={},this._cache=new Tr(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new vn,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,a){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,a)}catch(o){e.state="errored",o.status!==404?this._source.fire(new c.j(o,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new c.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const a=this._tiles[i];a.upload(e),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(L).map(e=>e.key)}getRenderableIds(e){const i=[];for(const a in this._tiles)this._isIdRenderable(a,e)&&i.push(this._tiles[a]);return e?i.sort((a,o)=>{const u=a.tileID,f=o.tileID,_=new c.P(u.canonical.x,u.canonical.y)._rotate(-this.transform.bearingInRadians),y=new c.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return u.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(a=>a.tileID.key):i.map(a=>a.tileID).sort(L).map(a=>a.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return c._(this,void 0,void 0,function*(){const a=this._tiles[e];a&&(a.state!=="loading"&&(a.state=i),yield this._loadTile(a,e,i))})}_tileLoaded(e,i,a){e.timeAdded=Ze.now(),a==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let o=0;o1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),u.dem&&o.dem&&(o.dem.backfillBorder(u.dem,f,_),o.neighboringTiles&&o.neighboringTiles[v]&&(o.neighboringTiles[v].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,a,o){for(const u in this._tiles){let f=this._tiles[u];if(o[u]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>a)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>i;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]||e[y.canonical.key]){o[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const a=this._loadedParentTiles[e.key];return a&&a.tileID.overscaledZ>=i?a:null}for(let a=e.overscaledZ-1;a>=i;a--){const o=e.scaledTo(a),u=this._getLoadedTile(o);if(u)return u}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,a=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(i*a*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),u=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(u)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const a={};for(const o in this._tiles){const u=this._tiles[o];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+i),a[u.tileID.key]=u}this._tiles=a;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,i,a,o,u,f){const _={},y={},v=Object.keys(e),T=Ze.now();for(const P of v){const S=e[P],A=this._tiles[P];if(!A||A.fadeEndTime!==0&&A.fadeEndTime<=T)continue;const R=this.findLoadedParent(S,i),V=this.findLoadedSibling(S),N=R||V||null;N&&(this._addTile(N.tileID),_[N.tileID.key]=N.tileID),y[P]=S}this._retainLoadedChildren(y,o,a,e);for(const P in _)e[P]||(this._coveredTiles[P]=!0,e[P]=_[P]);if(f){const P={},S={};for(const A of u)this._tiles[A.key].hasData()?P[A.key]=A:S[A.key]=A;for(const A in S){const R=S[A].children(this._source.maxzoom);this._tiles[R[0].key]&&this._tiles[R[1].key]&&this._tiles[R[2].key]&&this._tiles[R[3].key]&&(P[R[0].key]=e[R[0].key]=R[0],P[R[1].key]=e[R[1].key]=R[1],P[R[2].key]=e[R[2].key]=R[2],P[R[3].key]=e[R[3].key]=R[3],delete S[A])}for(const A in S){const R=S[A],V=this.findLoadedParent(R,this._source.minzoom),N=this.findLoadedSibling(R),U=V||N||null;if(U){P[U.tileID.key]=e[U.tileID.key]=U.tileID;for(const G in P)P[G].isChildOf(U.tileID)&&delete P[G]}}for(const A in this._tiles)P[A]||(this._coveredTiles[A]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let a;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new c.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(a=j(e,{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:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(a=a.filter(T=>this._source.hasTile(T)))):a=[];const o=Pr(e,this._source),u=Math.max(o-D.maxOverzooming,this._source.minzoom),f=Math.max(o+D.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const T={};for(const P of a)if(P.canonical.z>this._source.minzoom){const S=P.scaledTo(P.canonical.z-1);T[S.key]=S;const A=P.scaledTo(Math.max(this._source.minzoom,Math.min(P.canonical.z,5)));T[A.key]=A}a=a.concat(Object.values(T))}const _=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const y=this._updateRetainedTiles(a,o);B(this._source.type)&&this._updateCoveredAndRetainedTiles(y,u,f,o,a,i);for(const T in y)this._tiles[T].clearFadeHold();const v=c.ac(this._tiles,y);for(const T of v){const P=this._tiles[T];P.hasSymbolBuckets&&!P.holdingForFade()?P.setHoldDuration(this.map._fadeDuration):P.hasSymbolBuckets&&!P.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var a;const o={},u={},f=Math.max(i-D.maxOverzooming,this._source.minzoom),_=Math.max(i+D.maxUnderzooming,this._source.minzoom),y={};for(const v of e){const T=this._addTile(v);o[v.key]=v,T.hasData()||ithis._source.maxzoom){const S=v.children(this._source.maxzoom)[0],A=this.getTile(S);if(A&&A.hasData()){o[S.key]=S;continue}}else{const S=v.children(this._source.maxzoom);if(o[S[0].key]&&o[S[1].key]&&o[S[2].key]&&o[S[3].key])continue}let P=T.wasRequested();for(let S=v.overscaledZ-1;S>=f;--S){const A=v.scaledTo(S);if(u[A.key])break;if(u[A.key]=!0,T=this.getTile(A),!T&&P&&(T=this._addTile(A)),T){const R=T.hasData();if((R||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||P)&&(o[A.key]=A),P=T.wasRequested(),R)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let a,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}i.push(o.key);const u=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(u),a)break;o=u}for(const u of i)this._loadedParentTiles[u]=a}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,a=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=a}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const a=i;return i||(i=new Kr(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,a||this._source.fire(new c.k("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const a=i.getExpiryTimeout();a&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},a))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,a){const o=[],u=this.transform;if(!u)return o;const f=a?u.getCameraQueryGeometry(e):e,_=e.map(R=>u.screenPointToMercatorCoordinate(R,this.terrain)),y=f.map(R=>u.screenPointToMercatorCoordinate(R,this.terrain)),v=this.getIds();let T=1/0,P=1/0,S=-1/0,A=-1/0;for(const R of y)T=Math.min(T,R.x),P=Math.min(P,R.y),S=Math.max(S,R.x),A=Math.max(A,R.y);for(let R=0;R=0&&X[1].y+G>=0){const W=_.map(Q=>N.getTilePoint(Q)),K=y.map(Q=>N.getTilePoint(Q));o.push({tile:V,tileID:N,queryGeometry:W,cameraQueryGeometry:K,scale:U})}}return o}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(a=>this._tiles[a].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(B(this._source.type)){const e=Ze.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,a){this._state.updateState(e=e||"_geojsonTileLayer",i,a)}removeFeatureState(e,i,a){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,a)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,a){const o=this._tiles[e];o&&o.setDependencies(i,a)}reloadTilesForDependencies(e,i){for(const a in this._tiles)this._tiles[a].hasDependency(e,i)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(e,i))}}function L(h,e){const i=Math.abs(2*h.wrap)-+(h.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return h.overscaledZ-e.overscaledZ||a-i||e.canonical.y-h.canonical.y||e.canonical.x-h.canonical.x}function B(h){return h==="raster"||h==="image"||h==="video"}D.maxOverzooming=10,D.maxUnderzooming=3;class ${constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let a=1;a0?(o-f)/_:0;return this.points[u].mult(1-y).add(this.points[i].mult(y))}}function Y(h,e){let i=!0;return h==="always"||h!=="never"&&e!=="never"||(i=!1),i}class re{constructor(e,i,a){const o=this.boxCells=[],u=this.circleCells=[];this.xCellCount=Math.ceil(e/a),this.yCellCount=Math.ceil(i/a);for(let f=0;fthis.width||o<0||i>this.height)return[];const y=[];if(e<=0&&i<=0&&this.width<=a&&this.height<=o){if(u)return[{key:null,x1:e,y1:i,x2:a,y2:o}];for(let v=0;v0}hitTestCircle(e,i,a,o,u){const f=e-a,_=e+a,y=i-a,v=i+a;if(_<0||f>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:i,radius:a},seenUids:{box:{},circle:{}}},u),T.length>0}_queryCell(e,i,a,o,u,f,_,y){const{seenUids:v,hitTest:T,overlapMode:P}=_,S=this.boxCells[u];if(S!==null){const R=this.bboxes;for(const V of S)if(!v.box[V]){v.box[V]=!0;const N=4*V,U=this.boxKeys[V];if(e<=R[N+2]&&i<=R[N+3]&&a>=R[N+0]&&o>=R[N+1]&&(!y||y(U))&&(!T||!Y(P,U.overlapMode))&&(f.push({key:U,x1:R[N],y1:R[N+1],x2:R[N+2],y2:R[N+3]}),T))return!0}}const A=this.circleCells[u];if(A!==null){const R=this.circles;for(const V of A)if(!v.circle[V]){v.circle[V]=!0;const N=3*V,U=this.circleKeys[V];if(this._circleAndRectCollide(R[N],R[N+1],R[N+2],e,i,a,o)&&(!y||y(U))&&(!T||!Y(P,U.overlapMode))){const G=R[N],X=R[N+1],W=R[N+2];if(f.push({key:U,x1:G-W,y1:X-W,x2:G+W,y2:X+W}),T)return!0}}}return!1}_queryCellCircle(e,i,a,o,u,f,_,y){const{circle:v,seenUids:T,overlapMode:P}=_,S=this.boxCells[u];if(S!==null){const R=this.bboxes;for(const V of S)if(!T.box[V]){T.box[V]=!0;const N=4*V,U=this.boxKeys[V];if(this._circleAndRectCollide(v.x,v.y,v.radius,R[N+0],R[N+1],R[N+2],R[N+3])&&(!y||y(U))&&!Y(P,U.overlapMode))return f.push(!0),!0}}const A=this.circleCells[u];if(A!==null){const R=this.circles;for(const V of A)if(!T.circle[V]){T.circle[V]=!0;const N=3*V,U=this.circleKeys[V];if(this._circlesCollide(R[N],R[N+1],R[N+2],v.x,v.y,v.radius)&&(!y||y(U))&&!Y(P,U.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,a,o,u,f,_,y){const v=this._convertToXCellCoord(e),T=this._convertToYCellCoord(i),P=this._convertToXCellCoord(a),S=this._convertToYCellCoord(o);for(let A=v;A<=P;A++)for(let R=T;R<=S;R++)if(u.call(this,e,i,a,o,this.xCellCount*R+A,f,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,a,o,u,f){const _=o-e,y=u-i,v=a+f;return v*v>_*_+y*y}_circleAndRectCollide(e,i,a,o,u,f,_){const y=(f-o)/2,v=Math.abs(e-(o+y));if(v>y+a)return!1;const T=(_-u)/2,P=Math.abs(i-(u+T));if(P>T+a)return!1;if(v<=y||P<=T)return!0;const S=v-y,A=P-T;return S*S+A*A<=a*a}}function le(h,e,i){const a=c.H();if(!h){const{vecSouth:P,vecEast:S}=fe(e),A=fr();A[0]=S[0],A[1]=S[1],A[2]=P[0],A[3]=P[1],o=A,(T=(f=(u=A)[0])*(v=u[3])-(y=u[2])*(_=u[1]))&&(o[0]=v*(T=1/T),o[1]=-_*T,o[2]=-y*T,o[3]=f*T),a[0]=A[0],a[1]=A[1],a[4]=A[2],a[5]=A[3]}var o,u,f,_,y,v,T;return c.K(a,a,[1/i,1/i,1]),a}function ie(h,e,i,a){if(h){const o=c.H();if(!e){const{vecSouth:u,vecEast:f}=fe(i);o[0]=f[0],o[1]=f[1],o[4]=u[0],o[5]=u[1]}return c.K(o,o,[a,a,1]),o}return i.pixelsToClipSpaceMatrix}function fe(h){const e=Math.cos(h.rollInRadians),i=Math.sin(h.rollInRadians),a=Math.cos(h.pitchInRadians),o=Math.cos(h.bearingInRadians),u=Math.sin(h.bearingInRadians),f=c.ad();f[0]=-o*a*i-u*e,f[1]=-u*a*i+o*e;const _=c.ae(f);_<1e-9?c.af(f):c.ag(f,f,1/_);const y=c.ad();y[0]=o*a*e-u*i,y[1]=u*a*e+o*i;const v=c.ae(y);return v<1e-9?c.af(y):c.ag(y,y,1/v),{vecEast:y,vecSouth:f}}function he(h,e,i,a){let o;a?(o=[h,e,a(h,e),1],c.al(o,o,i)):(o=[h,e,0,1],Rt(o,o,i));const u=o[3];return{point:new c.P(o[0]/u,o[1]/u),signedDistanceFromCamera:u,isOccluded:!1}}function ne(h,e){return .5+h/e*.5}function te(h,e){return h.x>=-e[0]&&h.x<=e[0]&&h.y>=-e[1]&&h.y<=e[1]}function Ie(h,e,i,a,o,u,f,_,y,v,T,P,S){const A=i?h.textSizeData:h.iconSizeData,R=c.ah(A,e.transform.zoom),V=[256/e.width*2+1,256/e.height*2+1],N=i?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;N.clear();const U=h.lineVertexArray,G=i?h.text.placedSymbolArray:h.icon.placedSymbolArray,X=e.transform.width/e.transform.height;let W=!1;for(let K=0;KMath.abs(i.x-e.x)*a?{useVertical:!0}:(h===c.ai.vertical?e.yi.x)?{needsFlipping:!0}:null}function Ue(h){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:a,fontSize:o,flip:u,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:y,aspectRatio:v,rotateToLine:T}=h,P=o/24,S=a.lineOffsetX*P,A=a.lineOffsetY*P;let R;if(a.numGlyphs>1){const V=a.glyphStartIndex+a.numGlyphs,N=a.lineStartIndex,U=a.lineStartIndex+a.lineLength,G=Me(P,_,S,A,u,a,T,e);if(!G)return{notEnoughRoom:!0};const X=qe(G.first.point.x,G.first.point.y,e,i),W=qe(G.last.point.x,G.last.point.y,e,i);if(f&&!u){const K=je(a.writingMode,X,W,v);if(K)return K}R=[G.first];for(let K=a.glyphStartIndex+1;K0?X.point:ge(e.tileAnchorPoint,G,N,1,e),K=qe(N.x,N.y,e,i),Q=qe(W.x,W.y,e,i),J=je(a.writingMode,K,Q,v);if(J)return J}const V=St(P*_.getoffsetX(a.glyphStartIndex),S,A,u,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,e,T);if(!V||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};R=[V]}for(const V of R)c.ak(y,V.point,V.angle);return{}}function ge(h,e,i,a,o){const u=h.add(h.sub(e)._unit()),f=De(u.x,u.y,o).point,_=i.sub(f);return i.add(_._mult(a/_.mag()))}function Ce(h,e,i){const a=e.projectionCache;if(a.projections[h])return a.projections[h];const o=new c.P(e.lineVertexArray.getx(h),e.lineVertexArray.gety(h)),u=De(o.x,o.y,e);if(u.signedDistanceFromCamera>0)return a.projections[h]=u.point,a.anyProjectionOccluded=a.anyProjectionOccluded||u.isOccluded,u.point;const f=h-i.direction;return ge(i.distanceFromAnchor===0?e.tileAnchorPoint:new c.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function De(h,e,i){const a=h+i.translation[0],o=e+i.translation[1];let u;return i.pitchWithMap?(u=he(a,o,i.pitchedLabelPlaneMatrix,i.getElevation),u.isOccluded=!1):(u=i.transform.projectTileCoordinates(a,o,i.unwrappedTileID,i.getElevation),u.point.x=(.5*u.point.x+.5)*i.width,u.point.y=(.5*-u.point.y+.5)*i.height),u}function qe(h,e,i,a){if(i.pitchWithMap){const o=[h,e,0,1];return c.al(o,o,a),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:h/i.width*2-1,y:e/i.height*2-1}}function Je(h,e,i){return i.transform.projectTileCoordinates(h,e,i.unwrappedTileID,i.getElevation)}function Ve(h,e,i){return h._unit()._perp()._mult(e*i)}function ze(h,e,i,a,o,u,f,_,y){if(_.projectionCache.offsets[h])return _.projectionCache.offsets[h];const v=i.add(e);if(h+y.direction=o)return _.projectionCache.offsets[h]=v,v;const T=Ce(h+y.direction,_,y),P=Ve(T.sub(i),f,y.direction),S=i.add(P),A=T.add(P);return _.projectionCache.offsets[h]=c.am(u,v,S,A)||v,_.projectionCache.offsets[h]}function St(h,e,i,a,o,u,f,_,y){const v=a?h-e:h+e;let T=v>0?1:-1,P=0;a&&(T*=-1,P=Math.PI),T<0&&(P+=Math.PI);let S,A=T>0?u+o:u+o+1;_.projectionCache.cachedAnchorPoint?S=_.projectionCache.cachedAnchorPoint:(S=De(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=S);let R,V,N=S,U=S,G=0,X=0;const W=Math.abs(v),K=[];let Q;for(;G+X<=W;){if(A+=T,A=f)return null;G+=X,U=N,V=R;const oe={absOffsetX:W,direction:T,distanceFromAnchor:G,previousVertex:U};if(N=Ce(A,_,oe),i===0)K.push(U),Q=N.sub(U);else{let me;const ye=N.sub(U);me=ye.mag()===0?Ve(Ce(A+T,_,oe).sub(N),i,T):Ve(ye,i,T),V||(V=U.add(me)),R=ze(A,me,N,u,f,V,i,_,oe),K.push(V),Q=R.sub(V)}X=Q.mag()}const J=Q._mult((W-G)/X)._add(V||U),se=P+Math.atan2(N.y-U.y,N.x-U.x);return K.push(J),{point:J,angle:y?se:0,path:K}}const Mr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function jt(h,e){for(let i=0;i=1;$e--)Pe.push(de.path[$e]);for(let $e=1;$eet.signedDistanceFromCamera<=0)?[]:$e.map(et=>et.point)}let Ee=[];if(Pe.length>0){const $e=Pe[0].clone(),et=Pe[0].clone();for(let xt=1;xt=oe.x&&et.x<=me.x&&$e.y>=oe.y&&et.y<=me.y?[Pe]:et.xme.x||et.yme.y?[]:c.ao([Pe],oe.x,oe.y,me.x,me.y)}for(const $e of Ee){ye.reset($e,.25*se);let et=0;et=ye.length<=.5*se?1:Math.ceil(ye.paddedLength/ve)+1;for(let xt=0;xt{const y=he(_.x,_.y,f,u.getElevation),v=u.transform.projectTileCoordinates(y.point.x,y.point.y,u.unwrappedTileID,u.getElevation);return v.point.x=(.5*v.point.x+.5)*u.width,v.point.y=(.5*-v.point.y+.5)*u.height,v})}(e,i);return function(o){let u=0,f=0,_=0,y=0;for(let v=0;vf&&(f=y,u=_));return o.slice(u,u+f)}(a)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let a=1/0,o=1/0,u=-1/0,f=-1/0;for(const T of e){const P=new c.P(T.x+mt,T.y+mt);a=Math.min(a,P.x),o=Math.min(o,P.y),u=Math.max(u,P.x),f=Math.max(f,P.y),i.push(P)}const _=this.grid.query(a,o,u,f).concat(this.ignoredGrid.query(a,o,u,f)),y={},v={};for(const T of _){const P=T.key;if(y[P.bucketInstanceId]===void 0&&(y[P.bucketInstanceId]={}),y[P.bucketInstanceId][P.featureIndex])continue;const S=[new c.P(T.x1,T.y1),new c.P(T.x2,T.y1),new c.P(T.x2,T.y2),new c.P(T.x1,T.y2)];c.ap(i,S)&&(y[P.bucketInstanceId][P.featureIndex]=!0,v[P.bucketInstanceId]===void 0&&(v[P.bucketInstanceId]=[]),v[P.bucketInstanceId].push(P.featureIndex))}return v}insertCollisionBox(e,i,a,o,u,f){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:u,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,a,o,u,f){const _=a?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:u,collisionGroupID:f,overlapMode:i};for(let v=0;v=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(e,i,a,o){return a>=0&&e=0&&ithis.projectAndGetPerspectiveRatio(ve.x,ve.y,o,v,P));Se=Pe.some(ve=>!ve.isOccluded),de=Pe.map(ve=>new c.P(ve.x,ve.y))}else Se=!0;return{box:c.ar(de),allPointsOccluded:!Se}}}class _t{constructor(e,i,a,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):o&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class es{constructor(e,i,a,o,u){this.text=new _t(e?e.text:null,i,a,u),this.icon=new _t(e?e.icon:null,i,o,u)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class wn{constructor(e,i,a){this.text=e,this.icon=i,this.skipFade=a}}class La{constructor(e,i,a,o,u){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=a,this.bucketIndex=o,this.tileID=u}}class Yr{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:a=>a.collisionGroupID===i}}return this.collisionGroups[e]}}function Jr(h,e,i,a,o){const{horizontalAlign:u,verticalAlign:f}=c.ay(h);return new c.P(-(u-.5)*e+a[0]*o,-(f-.5)*i+a[1]*o)}class rl{constructor(e,i,a,o,u){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new _i(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Yr(o),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=u,u&&(u.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(a,o)=>i.getElevation(e,a,o):null}getBucketParts(e,i,a,o){const u=a.getBucket(i),f=a.latestFeatureIndex;if(!u||!f||i.id!==u.layerIds[0])return;const _=a.collisionBoxArray,y=u.layers[0].layout,v=u.layers[0].paint,T=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),P=a.tileSize/c.X,S=a.tileID.toUnwrapped(),A=y.get("text-rotation-alignment")==="map",R=c.at(a,1,this.transform.zoom),V=c.au(this.collisionIndex.transform,a,v.get("text-translate"),v.get("text-translate-anchor")),N=c.au(this.collisionIndex.transform,a,v.get("icon-translate"),v.get("icon-translate-anchor")),U=le(A,this.transform,R);this.retainedQueryData[u.bucketInstanceId]=new La(u.bucketInstanceId,f,u.sourceLayerIndex,u.index,a.tileID);const G={bucket:u,layout:y,translationText:V,translationIcon:N,unwrappedTileID:S,pitchedLabelPlaneMatrix:U,scale:T,textPixelRatio:P,holdingForFade:a.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.ah(u.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(o)for(const X of u.sortKeyRanges){const{sortKey:W,symbolInstanceStart:K,symbolInstanceEnd:Q}=X;e.push({sortKey:W,symbolInstanceStart:K,symbolInstanceEnd:Q,parameters:G})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:G})}attemptAnchorPlacement(e,i,a,o,u,f,_,y,v,T,P,S,A,R,V,N,U,G,X,W){const K=c.av[e.textAnchor],Q=[e.textOffset0,e.textOffset1],J=Jr(K,a,o,Q,u),se=this.collisionIndex.placeCollisionBox(i,S,y,v,T,_,f,N,P.predicate,X,J,W);if((!G||this.collisionIndex.placeCollisionBox(G,S,y,v,T,_,f,U,P.predicate,X,J,W).placeable)&&se.placeable){let oe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[A.crossTileID]&&this.prevPlacement.placements[A.crossTileID]&&this.prevPlacement.placements[A.crossTileID].text&&(oe=this.prevPlacement.variableOffsets[A.crossTileID].anchor),A.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[A.crossTileID]={textOffset:Q,width:a,height:o,anchor:K,textBoxScale:u,prevAnchor:oe},this.markUsedJustification(R,K,A,V),R.allowVerticalPlacement&&(this.markUsedOrientation(R,V,A),this.placedOrientations[A.crossTileID]=V),{shift:J,placedGlyphBoxes:se}}}placeLayerBucketPart(e,i,a){const{bucket:o,layout:u,translationText:f,translationIcon:_,unwrappedTileID:y,pitchedLabelPlaneMatrix:v,textPixelRatio:T,holdingForFade:P,collisionBoxArray:S,partiallyEvaluatedTextSize:A,collisionGroup:R}=e.parameters,V=u.get("text-optional"),N=u.get("icon-optional"),U=c.aw(u,"text-overlap","text-allow-overlap"),G=U==="always",X=c.aw(u,"icon-overlap","icon-allow-overlap"),W=X==="always",K=u.get("text-rotation-alignment")==="map",Q=u.get("text-pitch-alignment")==="map",J=u.get("icon-text-fit")!=="none",se=u.get("symbol-z-order")==="viewport-y",oe=G&&(W||!o.hasIconData()||N),me=W&&(G||!o.hasTextData()||V);!o.collisionArrays&&S&&o.deserializeCollisionBoxes(S);const ye=this.retainedQueryData[o.bucketInstanceId].tileID,de=this._getTerrainElevationFunc(ye),Se=this.transform.getFastPathSimpleProjectionMatrix(ye),Pe=(ve,Ee,$e)=>{var et,xt;if(i[ve.crossTileID])return;if(P)return void(this.placements[ve.crossTileID]=new wn(!1,!1,!1));let st=!1,vt=!1,at=!0,nt=null,ot={box:null,placeable:!1,offscreen:null,occluded:!1},Kt={placeable:!1},Lt=null,Bt=null,ci=null,lr=0,Yi=0,yi=0;Ee.textFeatureIndex?lr=Ee.textFeatureIndex:ve.useRuntimeCollisionCircles&&(lr=ve.featureIndex),Ee.verticalTextFeatureIndex&&(Yi=Ee.verticalTextFeatureIndex);const cr=Ee.textBox;if(cr){const di=lt=>{let bt=c.ai.horizontal;if(o.allowVerticalPlacement&&!lt&&this.prevPlacement){const vi=this.prevPlacement.placedOrientations[ve.crossTileID];vi&&(this.placedOrientations[ve.crossTileID]=vi,bt=vi,this.markUsedOrientation(o,bt,ve))}return bt},ki=(lt,bt)=>{if(o.allowVerticalPlacement&&ve.numVerticalGlyphVertices>0&&Ee.verticalTextBox){for(const vi of o.writingModes)if(vi===c.ai.vertical?(ot=bt(),Kt=ot):ot=lt(),ot&&ot.placeable)break}else ot=lt()},Di=ve.textAnchorOffsetStartIndex,xi=ve.textAnchorOffsetEndIndex;if(xi===Di){const lt=(bt,vi)=>{const Tt=this.collisionIndex.placeCollisionBox(bt,U,T,ye,y,Q,K,f,R.predicate,de,void 0,Se);return Tt&&Tt.placeable&&(this.markUsedOrientation(o,vi,ve),this.placedOrientations[ve.crossTileID]=vi),Tt};ki(()=>lt(cr,c.ai.horizontal),()=>{const bt=Ee.verticalTextBox;return o.allowVerticalPlacement&&ve.numVerticalGlyphVertices>0&&bt?lt(bt,c.ai.vertical):{box:null,offscreen:null}}),di(ot&&ot.placeable)}else{let lt=c.av[(xt=(et=this.prevPlacement)===null||et===void 0?void 0:et.variableOffsets[ve.crossTileID])===null||xt===void 0?void 0:xt.anchor];const bt=(Tt,Gc,tc)=>{const Ro=Tt.x2-Tt.x1,ic=Tt.y2-Tt.y1,mn=ve.textBoxScale,_n=J&&X==="never"?Gc:null;let zr=null,rc=U==="never"?1:2,xa="never";lt&&rc++;for(let Lo=0;Lobt(cr,Ee.iconBox,c.ai.horizontal),()=>{const Tt=Ee.verticalTextBox;return o.allowVerticalPlacement&&(!ot||!ot.placeable)&&ve.numVerticalGlyphVertices>0&&Tt?bt(Tt,Ee.verticalIconBox,c.ai.vertical):{box:null,occluded:!0,offscreen:null}}),ot&&(st=ot.placeable,at=ot.offscreen);const vi=di(ot&&ot.placeable);if(!st&&this.prevPlacement){const Tt=this.prevPlacement.variableOffsets[ve.crossTileID];Tt&&(this.variableOffsets[ve.crossTileID]=Tt,this.markUsedJustification(o,Tt.anchor,ve,vi))}}}if(Lt=ot,st=Lt&&Lt.placeable,at=Lt&&Lt.offscreen,ve.useRuntimeCollisionCircles){const di=o.text.placedSymbolArray.get(ve.centerJustifiedTextSymbolIndex),ki=c.aj(o.textSizeData,A,di),Di=u.get("text-padding");Bt=this.collisionIndex.placeCollisionCircles(U,di,o.lineVertexArray,o.glyphOffsetArray,ki,y,v,a,Q,R.predicate,ve.collisionCircleDiameter,Di,f,de),Bt.circles.length&&Bt.collisionDetected&&!a&&c.w("Collisions detected, but collision boxes are not shown"),st=G||Bt.circles.length>0&&!Bt.collisionDetected,at=at&&Bt.offscreen}if(Ee.iconFeatureIndex&&(yi=Ee.iconFeatureIndex),Ee.iconBox){const di=ki=>this.collisionIndex.placeCollisionBox(ki,X,T,ye,y,Q,K,_,R.predicate,de,J&&nt?nt:void 0,Se);Kt&&Kt.placeable&&Ee.verticalIconBox?(ci=di(Ee.verticalIconBox),vt=ci.placeable):(ci=di(Ee.iconBox),vt=ci.placeable),at=at&&ci.offscreen}const Is=V||ve.numHorizontalGlyphVertices===0&&ve.numVerticalGlyphVertices===0,Cs=N||ve.numIconVertices===0;Is||Cs?Cs?Is||(vt=vt&&st):st=vt&&st:vt=st=vt&&st;const Un=vt&&ci.placeable;if(st&&Lt.placeable&&this.collisionIndex.insertCollisionBox(Lt.box,U,u.get("text-ignore-placement"),o.bucketInstanceId,Kt&&Kt.placeable&&Yi?Yi:lr,R.ID),Un&&this.collisionIndex.insertCollisionBox(ci.box,X,u.get("icon-ignore-placement"),o.bucketInstanceId,yi,R.ID),Bt&&st&&this.collisionIndex.insertCollisionCircles(Bt.circles,U,u.get("text-ignore-placement"),o.bucketInstanceId,lr,R.ID),a&&this.storeCollisionData(o.bucketInstanceId,$e,Ee,Lt,ci,Bt),ve.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ve.crossTileID]=new wn((st||oe)&&!(Lt!=null&&Lt.occluded),(vt||me)&&!(ci!=null&&ci.occluded),at||o.justReloaded),i[ve.crossTileID]=!0};if(se){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ve=o.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Ee=ve.length-1;Ee>=0;--Ee){const $e=ve[Ee];Pe(o.symbolInstances.get($e),o.collisionArrays[$e],$e)}}else for(let ve=e.symbolInstanceStart;ve=0&&(e.text.placedSymbolArray.get(_).crossTileID=u>=0&&_!==u?0:a.crossTileID)}markUsedOrientation(e,i,a){const o=i===c.ai.horizontal||i===c.ai.horizontalOnly?i:0,u=i===c.ai.vertical?i:0,f=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=u)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let a=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const o=i?i.symbolFadeChange(e):1,u=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=u[y];T?(this.opacities[y]=new es(T,o,v.text,v.icon),a=a||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new es(null,o,v.text,v.icon,v.skipFade),a=a||v.text||v.icon)}for(const y in u){const v=u[y];if(!this.opacities[y]){const T=new es(v,o,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const a={};for(const o of i){const u=o.getBucket(e);u&&o.latestFeatureIndex&&e.id===u.layerIds[0]&&this.updateBucketOpacities(u,o.tileID,a,o.collisionBoxArray)}}updateBucketOpacities(e,i,a,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const u=e.layers[0],f=u.layout,_=new es(null,0,!1,!1,!0),y=f.get("text-allow-overlap"),v=f.get("icon-allow-overlap"),T=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=f.get("text-rotation-alignment")==="map",S=f.get("text-pitch-alignment")==="map",A=f.get("icon-text-fit")!=="none",R=new es(null,0,y&&(v||!e.hasIconData()||f.get("icon-optional")),v&&(y||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const V=(U,G,X)=>{for(let W=0;W0,se=this.placedOrientations[G.crossTileID],oe=se===c.ai.vertical,me=se===c.ai.horizontal||se===c.ai.horizontalOnly;if(X>0||W>0){const de=Fa(Q.text);V(e.text,X,oe?Qr:de),V(e.text,W,me?Qr:de);const Se=Q.text.isHidden();[G.rightJustifiedTextSymbolIndex,G.centerJustifiedTextSymbolIndex,G.leftJustifiedTextSymbolIndex].forEach(Ee=>{Ee>=0&&(e.text.placedSymbolArray.get(Ee).hidden=Se||oe?1:0)}),G.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(G.verticalPlacedTextSymbolIndex).hidden=Se||me?1:0);const Pe=this.variableOffsets[G.crossTileID];Pe&&this.markUsedJustification(e,Pe.anchor,G,se);const ve=this.placedOrientations[G.crossTileID];ve&&(this.markUsedJustification(e,"left",G,ve),this.markUsedOrientation(e,ve,G))}if(J){const de=Fa(Q.icon),Se=!(A&&G.verticalPlacedIconSymbolIndex&&oe);G.placedIconSymbolIndex>=0&&(V(e.icon,G.numIconVertices,Se?de:Qr),e.icon.placedSymbolArray.get(G.placedIconSymbolIndex).hidden=Q.icon.isHidden()),G.verticalPlacedIconSymbolIndex>=0&&(V(e.icon,G.numVerticalIconVertices,Se?Qr:de),e.icon.placedSymbolArray.get(G.verticalPlacedIconSymbolIndex).hidden=Q.icon.isHidden())}const ye=N&&N.has(U)?N.get(U):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const de=e.collisionArrays[U];if(de){let Se=new c.P(0,0);if(de.textBox||de.verticalTextBox){let Pe=!0;if(T){const ve=this.variableOffsets[K];ve?(Se=Jr(ve.anchor,ve.width,ve.height,ve.textOffset,ve.textBoxScale),P&&Se._rotate(S?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Pe=!1}if(de.textBox||de.verticalTextBox){let ve;de.textBox&&(ve=oe),de.verticalTextBox&&(ve=me),Ba(e.textCollisionBox.collisionVertexArray,Q.text.placed,!Pe||ve,ye.text,Se.x,Se.y)}}if(de.iconBox||de.verticalIconBox){const Pe=!!(!me&&de.verticalIconBox);let ve;de.iconBox&&(ve=Pe),de.verticalIconBox&&(ve=!Pe),Ba(e.iconCollisionBox.collisionVertexArray,Q.icon.placed,ve,ye.icon,A?Se.x:0,A?Se.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function Ba(h,e,i,a,o,u){a&&a.length!==0||(a=[0,0,0,0]);const f=a[0]-mt,_=a[1]-mt,y=a[2]-mt,v=a[3]-mt;h.emplaceBack(e?1:0,i?1:0,o||0,u||0,f,_),h.emplaceBack(e?1:0,i?1:0,o||0,u||0,y,_),h.emplaceBack(e?1:0,i?1:0,o||0,u||0,y,v),h.emplaceBack(e?1:0,i?1:0,o||0,u||0,f,v)}const nl=Math.pow(2,25),Tn=Math.pow(2,24),sl=Math.pow(2,17),Pc=Math.pow(2,16),Mc=Math.pow(2,9),Sc=Math.pow(2,8),al=Math.pow(2,1);function Fa(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;const e=h.placed?1:0,i=Math.floor(127*h.opacity);return i*nl+e*Tn+i*sl+e*Pc+i*Mc+e*Sc+i*al+e}const Qr=0;class Oa{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,a,o,u){const f=this._bucketParts;for(;this._currentTileIndex_.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&Ze.now()-o>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Oa(f)),this._inProgressLayer.continuePlacement(a[f.source],this.placement,this._showCollisionBoxes,f,u))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const en=512/c.X/2;class ja{constructor(e,i,a){this.tileID=e,this.bucketInstanceId=a,this._symbolsByKey={};const o=new Map;for(let u=0;u({x:Math.floor(y.anchorX*en),y:Math.floor(y.anchorY*en)})),crossTileIDs:f.map(y=>y.crossTileID)};if(_.positions.length>128){const y=new c.az(_.positions.length,16,Uint16Array);for(const{x:v,y:T}of _.positions)y.add(v,T);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[u]=_}}getScaledCoordinates(e,i){const{x:a,y:o,z:u}=this.tileID.canonical,{x:f,y:_,z:y}=i.canonical,v=en/Math.pow(2,y-u),T=(_*c.X+e.anchorY)*v,P=o*c.X*en;return{x:Math.floor((f*c.X+e.anchorX)*v-a*c.X*en),y:Math.floor(T-P)}}findMatches(e,i,a){const o=this.tileID.canonical.ze)}}class Ls{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ll{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const a in this.indexes){const o=this.indexes[a],u={};for(const f in o){const _=o[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),u[_.tileID.key]=_}this.indexes[a]=u}this.lng=e}addBucket(e,i,a){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let u=0;ue.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(e)&&y.findMatches(i.symbolInstances,e,o)}else{const _=f[e.scaledTo(Number(u)).key];_&&_.findMatches(i.symbolInstances,e,o)}}for(let u=0;u{i[a]=!0});for(const a in this.layerIndexes)i[a]||delete this.layerIndexes[a]}}var Na="void main() {fragColor=vec4(1.0);}";const qi={prelude:He(`#ifdef GL_ES +precision mediump float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +out highp vec4 fragColor;`,`#ifdef GL_ES +precision highp float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 +);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c +);} +#ifdef TERRAIN3D +uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; +#endif +const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { +#ifdef TERRAIN3D +highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); +#else +return 1.0; +#endif +}float calculate_visibility(vec4 pos) { +#ifdef TERRAIN3D +vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; +#else +return 1.0; +#endif +}float ele(vec2 pos) { +#ifdef TERRAIN3D +vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; +#else +return 0.0; +#endif +}float get_elevation(vec2 pos) { +#ifdef TERRAIN3D +#ifdef GLOBE +if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} +#endif +vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; +#else +return 0.0; +#endif +}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:He("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:He("",`#define GLOBE_RADIUS 6371008.8 +uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos +);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); +if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len +);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:He(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:He(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:He(`in vec3 v_data;in float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;} +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main(void) { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { +#ifdef GLOBE +vec3 center_vector=projectToSphere(circle_center); +#endif +float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else { +#ifdef GLOBE +vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); +#else +vec4 projected_center=projectTileWithElevation(circle_center,ele); +#endif +corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);} +#ifdef GLOBE +vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); +#else +gl_Position=projectTileWithElevation(corner_position,ele); +#endif +} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:He(Na,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:He(`uniform highp float u_intensity;in vec2 v_extrude; +#pragma mapbox: define highp float weight +#define GAUSS_COEF 0.3989422804014327 +void main() { +#pragma mapbox: initialize highp float weight +float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0); +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude; +#pragma mapbox: define highp float weight +#pragma mapbox: define mediump float radius +const highp float ZERO=1.0/255.0/16.0; +#define GAUSS_COEF 0.3989422804014327 +void main(void) { +#pragma mapbox: initialize highp float weight +#pragma mapbox: initialize mediump float radius +vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0); +#ifdef GLOBE +vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0); +#else +gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); +#endif +}`),heatmapTexture:He(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(0.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:He("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:He("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:He("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:He(Na,`in vec2 a_pos;void main() { +#ifdef GLOBE +gl_Position=projectTileFor3D(a_pos,0.0); +#else +gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); +#endif +}`),fill:He(`#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +fragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform vec2 u_fill_translate;in vec2 a_pos; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:He(`in vec2 v_pos; +#ifdef GLOBE +in float v_depth; +#endif +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); +#ifdef GLOBE +if (v_depth > 1.0) {discard;} +#endif +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos; +#ifdef GLOBE +out float v_depth; +#endif +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; +#ifdef GLOBE +v_depth=gl_Position.z/gl_Position.w; +#endif +}`),fillOutlinePattern:He(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos; +#ifdef GLOBE +in float v_depth; +#endif +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity; +#ifdef GLOBE +if (v_depth > 1.0) {discard;} +#endif +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; +#ifdef GLOBE +out float v_depth; +#endif +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; +#ifdef GLOBE +v_depth=gl_Position.z/gl_Position.w; +#endif +}`),fillPattern:He(`#ifdef GL_ES +precision highp float; +#endif +uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:He(`in vec4 v_color;void main() {fragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed; +#ifdef TERRAIN3D +in vec2 a_centroid; +#endif +out vec4 v_color; +#pragma mapbox: define highp float base +#pragma mapbox: define highp float height +#pragma mapbox: define highp vec4 color +void main() { +#pragma mapbox: initialize highp float base +#pragma mapbox: initialize highp float height +#pragma mapbox: initialize highp vec4 color +vec3 normal=a_normal_ed.xyz; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; +#ifdef GLOBE +vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); +#else +gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); +#endif +float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0); +#ifdef GLOBE +mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); +#endif +directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:He(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed; +#ifdef TERRAIN3D +in vec2 a_centroid; +#endif +#ifdef GLOBE +out vec3 v_sphere_pos; +#endif +out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; +#ifdef GLOBE +vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); +#else +gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); +#endif +vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 +? a_pos +: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:He(`#ifdef GL_ES +precision highp float; +#endif +uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:He(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +#define PI 3.141592653589793 +void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:He(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; +#ifdef GLOBE +in float v_depth; +#endif +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity); +#ifdef GLOBE +if (v_depth > 1.0) {discard;} +#endif +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar; +#ifdef GLOBE +out float v_depth; +#endif +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; +#ifdef GLOBE +v_depth=gl_Position.z/gl_Position.w; +#endif +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),lineGradient:He(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv; +#ifdef GLOBE +in float v_depth; +#endif +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity); +#ifdef GLOBE +if (v_depth > 1.0) {discard;} +#endif +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; +#ifdef GLOBE +out float v_depth; +#endif +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; +#ifdef GLOBE +v_depth=gl_Position.z/gl_Position.w; +#endif +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),linePattern:He(`#ifdef GL_ES +precision highp float; +#endif +uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width; +#ifdef GLOBE +in float v_depth; +#endif +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity; +#ifdef GLOBE +if (v_depth > 1.0) {discard;} +#endif +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width; +#ifdef GLOBE +out float v_depth; +#endif +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; +#ifdef GLOBE +v_depth=gl_Position.z/gl_Position.w; +#endif +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:He(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; +#ifdef GLOBE +in float v_depth; +#endif +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity); +#ifdef GLOBE +if (v_depth > 1.0) {discard;} +#endif +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; +#ifdef GLOBE +out float v_depth; +#endif +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; +#ifdef GLOBE +v_depth=gl_Position.z/gl_Position.w; +#endif +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:He(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5; +#ifdef GLOBE +if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;} +#endif +v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:He(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; +#ifdef GLOBE +if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} +#endif +vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:He(`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; +#ifdef GLOBE +if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} +#endif +vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:He(`#define SDF_PX 8.0 +#define SDF 1.0 +#define ICON 0.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +fragColor=vec4(1.0); +#endif +}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; +#ifdef GLOBE +if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} +#endif +vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:He("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:He("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:He("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:He("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:He(`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 +);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:He("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function He(h,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=e.match(/in ([\w]+) ([\w]+)/g),o=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),u=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=u?u.concat(o):o,_={};return{fragmentSource:h=h.replace(i,(y,v,T,P,S)=>(_[S]=!0,v==="define"?` +#ifndef HAS_UNIFORM_u_${S} +in ${T} ${P} ${S}; +#else +uniform ${T} ${P} u_${S}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${S} + ${T} ${P} ${S} = u_${S}; +#endif +`)),vertexSource:e=e.replace(i,(y,v,T,P,S)=>{const A=P==="float"?"vec2":"vec4",R=S.match(/color/)?"color":A;return _[S]?v==="define"?` +#ifndef HAS_UNIFORM_u_${S} +uniform lowp float u_${S}_t; +in ${T} ${A} a_${S}; +out ${T} ${P} ${S}; +#else +uniform ${T} ${P} u_${S}; +#endif +`:R==="vec4"?` +#ifndef HAS_UNIFORM_u_${S} + ${S} = a_${S}; +#else + ${T} ${P} ${S} = u_${S}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${S} + ${S} = unpack_mix_${R}(a_${S}, u_${S}_t); +#else + ${T} ${P} ${S} = u_${S}; +#endif +`:v==="define"?` +#ifndef HAS_UNIFORM_u_${S} +uniform lowp float u_${S}_t; +in ${T} ${A} a_${S}; +#else +uniform ${T} ${P} u_${S}; +#endif +`:R==="vec4"?` +#ifndef HAS_UNIFORM_u_${S} + ${T} ${P} ${S} = a_${S}; +#else + ${T} ${P} ${S} = u_${S}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${S} + ${T} ${P} ${S} = unpack_mix_${R}(a_${S}, u_${S}_t); +#else + ${T} ${P} ${S} = u_${S}; +#endif +`}),staticAttributes:a,staticUniforms:f}}class Hi{constructor(e,i,a){this.vertexBuffer=e,this.indexBuffer=i,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Xe=c.aA([{name:"a_pos",type:"Int16",components:2}]);const Bs="#define PROJECTION_MERCATOR",cl="mercator";class ts{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return cl}get shaderDefine(){return Bs}get shaderPreludeCode(){return qi.projectionMercator}get vertexShaderPreludeCode(){return qi.projectionMercator.vertexSource}get subdivisionGranularity(){return c.aB.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,a,o,u){if(this._cachedMesh)return this._cachedMesh;const f=new c.aC;f.emplaceBack(0,0),f.emplaceBack(c.X,0),f.emplaceBack(0,c.X),f.emplaceBack(c.X,c.X);const _=e.createVertexBuffer(f,Xe.members),y=c.aD.simpleSegment(0,0,4,2),v=new c.aE;v.emplaceBack(1,0,2),v.emplaceBack(1,2,3);const T=e.createIndexBuffer(v);return this._cachedMesh=new Hi(_,T,y),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}function Et(h,e){const i=c.ab(e.lat,-85.051129,c.aF);return new c.P(c.O(e.lng)*h,c.Q(i)*h)}function Nt(h,e){return new c.Y(e.x/h,e.y/h).toLngLat()}function wt(h){return h.cameraToCenterDistance*Math.min(.85*Math.tan(c.aa(90-h.pitch)),Math.tan(c.aa(89.25-h.pitch)))}function Va(h,e){const i=h.canonical,a=e/c.aG(i.z),o=i.x+Math.pow(2,i.z)*h.wrap,u=c.aq(new Float64Array(16));return c.J(u,u,[o*a,i.y*a,0]),c.K(u,u,[a/c.X,a/c.X,1]),u}function ii(h,e,i,a,o){const u=c.Y.fromLngLat(h,e),f=o*c.aH(1,h.lat),_=f*Math.cos(c.aa(i)),y=Math.sqrt(f*f-_*_),v=y*Math.sin(c.aa(-a)),T=y*Math.cos(c.aa(-a));return new c.Y(u.x+v,u.y+T,u.z+_)}class ri{constructor(e=0,i=0,a=0,o=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=a,this.right=o}interpolate(e,i,a){return i.top!=null&&e.top!=null&&(this.top=c.y.number(e.top,i.top,a)),i.bottom!=null&&e.bottom!=null&&(this.bottom=c.y.number(e.bottom,i.bottom,a)),i.left!=null&&e.left!=null&&(this.left=c.y.number(e.left,i.left,a)),i.right!=null&&e.right!=null&&(this.right=c.y.number(e.right,i.right,a)),this}getCenter(e,i){const a=c.ab((this.left+e-this.right)/2,0,e),o=c.ab((this.top+i-this.bottom)/2,0,i);return new c.P(a,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new ri(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ni(h,e){if(!h.renderWorldCopies||h.lngRange)return;const i=e.lng-h.center.lng;e.lng+=i>180?-360:i<-180?360:0}function Ua(h){return Math.max(0,Math.floor(h))}class rn{constructor(e,i,a,o,u,f){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=f===void 0||!!f,this._minZoom=i||0,this._maxZoom=a||22,this._minPitch=o??0,this._maxPitch=u??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new c.N(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ua(this._zoom),this._scale=c.aG(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new ri,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,a){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Ua(this._zoom),this._scale=c.aG(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new ri(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!a&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=c.aI(e,-180,180)*Math.PI/180;var a,o,u,f,_,y,v,T,P;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=fr(),a=this._rotationMatrix,u=-this._bearingInRadians,f=(o=this._rotationMatrix)[0],_=o[1],y=o[2],v=o[3],T=Math.sin(u),P=Math.cos(u),a[0]=f*P+y*T,a[1]=_*P+v*T,a[2]=f*-T+y*P,a[3]=_*-T+v*P)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=c.ab(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const i=e/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return c.aJ(this._fovInRadians)}setFov(e){e=c.ab(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=c.aa(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=c.aG(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,i){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,a){this._unmodified=!1,this._edgeInsets.interpolate(e,i,a),this._constrain(),this._calcMatrices()}resize(e,i,a=!0){this._width=e,this._height=i,a&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new zt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,c.aF])}getConstrained(e,i){return this._callbacks.getConstrained(e,i)}getCameraQueryGeometry(e,i){if(i.length===1)return[i[0],e];{let a=e.x,o=e.y,u=e.x,f=e.y;for(const _ of i)a=Math.min(a,_.x),o=Math.min(o,_.y),u=Math.max(u,_.x),f=Math.max(f,_.y);return[new c.P(a,o),new c.P(u,o),new c.P(u,f),new c.P(a,f),new c.P(a,o)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:i,zoom:a}=this.getConstrained(this.center,this.zoom);this.setCenter(i),this.setZoom(a),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=c.aq(new Float64Array(16));c.K(e,e,[this._width/2,-this._height/2,1]),c.J(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=c.aq(new Float64Array(16)),c.K(e,e,[1,-1,1]),c.J(e,e,[-1,-1,0]),c.K(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,a,o){const u=a!==void 0?a:this.bearing,f=o=o!==void 0?o:this.pitch,_=c.Y.fromLngLat(e,i),y=-Math.cos(c.aa(f)),v=Math.sin(c.aa(f)),T=v*Math.sin(c.aa(u)),P=-v*Math.cos(c.aa(u));let S=this.elevation;const A=i-S;let R;y*A>=0||Math.abs(y)<.1?(R=1e4,S=i+R*y):R=-A/y;let V,N,U=c.aK(1,_.y),G=0;do{if(G+=1,G>10)break;N=R/U,V=new c.Y(_.x+T*N,_.y+P*N),U=1/V.meterInMercatorCoordinateUnits()}while(Math.abs(R-N*U)>1e-12);return{center:V.toLngLat(),elevation:S,zoom:c.a8(this.height/2/Math.tan(this.fovInRadians/2)/N/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=c.aH(1,this.center.lat)*this.worldSize,a=this.cameraToCenterDistance/i,o=c.Y.fromLngLat(this.center,this.elevation),u=ii(this.center,this.elevation,this.pitch,this.bearing,a);this._elevation=e;const f=this.calculateCenterFromCameraLngLatAlt(u.toLngLat(),c.aK(u.z,o.y),this.bearing,this.pitch);this._elevation=f.elevation,this._center=f.center,this.setZoom(f.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=c.aH(1,this.center.lat)*this.worldSize;return ii(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]0?(i+=e[o]*this.min[o],a+=e[o]*this.max[o]):(a+=e[o]*this.min[o],i+=e[o]*this.max[o]);return i>=0?2:a<0?0:1}}class is{distanceToTile2d(e,i,a,o){const u=o.distanceX([e,i]),f=o.distanceY([e,i]);return Math.hypot(u,f)}getWrap(e,i,a){return a}getTileAABB(e,i,a,o){var u,f;let _=a,y=a;if(o.terrain){const T=new c.S(e.z,i,e.z,e.x,e.y),P=o.terrain.getMinMaxElevation(T);_=(u=P.minElevation)!==null&&u!==void 0?u:a,y=(f=P.maxElevation)!==null&&f!==void 0?f:a}const v=1<o||e.padding.top>=.1}allowWorldCopies(){return!0}recalculateCache(){}}class Xi{constructor(e,i,a){this.points=e,this.planes=i,this.aabb=a}static fromInvProjectionMatrix(e,i=1,a=0){const o=Math.pow(2,a),u=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(v=>{const T=1/(v=c.al([],v,e))[3]/i*o;return c.aO(v,v,[T,T,1/v[3],T])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(v=>{const T=c.aP([],u[v[0]],u[v[1]]),P=c.aP([],u[v[2]],u[v[1]]),S=c.aQ([],c.aR([],T,P)),A=-c.aS(S,u[v[1]]);return S.concat(A)}),_=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],y=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const v of u)for(let T=0;T<3;T++)_[T]=Math.min(_[T],v[T]),y[T]=Math.max(y[T],v[T]);return new Xi(u,f,new ut(_,y))}}class ir{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,a){return this._helper.interpolatePadding(e,i,a)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,a=!0){this._helper.resize(e,i,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,i){}constructor(e,i,a,o,u){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},getConstrained:(f,_)=>this.getConstrained(f,_)},e,i,a,o,u),this._coveringTilesDetailsProvider=new is}clone(){const e=new ir;return e.apply(this),e}apply(e,i,a){this._helper.apply(e,i,a)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new c.aT(0,e)];if(this._helper._renderWorldCopies){const a=this.screenPointToMercatorCoordinate(new c.P(0,0)),o=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,0)),u=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,this._helper._height)),f=this.screenPointToMercatorCoordinate(new c.P(0,this._helper._height)),_=Math.floor(Math.min(a.x,o.x,u.x,f.x)),y=Math.floor(Math.max(a.x,o.x,u.x,f.x)),v=1;for(let T=_-v;T<=y+v;T++)T!==0&&i.push(new c.aT(T,e))}return i}getCameraFrustum(){return Xi.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const i=this.screenPointToLocation(this.centerPoint,e),a=e?e.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(a)}setLocationAtPoint(e,i){const a=c.aH(this.elevation,this.center.lat),o=this.screenPointToMercatorCoordinateAtZ(i,a),u=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,a),f=c.Y.fromLngLat(e),_=new c.Y(f.x-(o.x-u.x),f.y-(o.y-u.y));this.setCenter(_==null?void 0:_.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(c.Y.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(c.Y.fromLngLat(e))}screenPointToLocation(e,i){var a;return(a=this.screenPointToMercatorCoordinate(e,i))===null||a===void 0?void 0:a.toLngLat()}screenPointToMercatorCoordinate(e,i){if(i){const a=i.pointCoordinate(e);if(a!=null)return a}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const a=i||0,o=[e.x,e.y,0,1],u=[e.x,e.y,1,1];c.al(o,o,this._pixelMatrixInverse),c.al(u,u,this._pixelMatrixInverse);const f=o[3],_=u[3],y=o[1]/f,v=u[1]/_,T=o[2]/f,P=u[2]/_,S=T===P?0:(a-T)/(P-T);return new c.Y(c.y.number(o[0]/f,u[0]/_,S)/this.worldSize,c.y.number(y,v,S)/this.worldSize,a)}coordinatePoint(e,i=0,a=this._pixelMatrix){const o=[e.x*this.worldSize,e.y*this.worldSize,i,1];return c.al(o,o,a),new c.P(o[0]/o[3],o[1]/o[3])}getBounds(){const e=Math.max(0,this._helper._height/2-wt(this));return new zt().extend(this.screenPointToLocation(new c.P(0,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new c.P(0,this._helper._height)))}isPointOnMapSurface(e,i){return i?i.pointCoordinate(e)!=null:e.y>this.height/2-wt(this)}calculatePosMatrix(e,i=!1,a){var o;const u=(o=e.key)!==null&&o!==void 0?o:c.aU(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),f=i?this._alignedPosMatrixCache:this._posMatrixCache;if(f.has(u)){const v=f.get(u);return a?v.f32:v.f64}const _=Va(e,this.worldSize);c.L(_,i?this._alignedProjMatrix:this._viewProjMatrix,_);const y={f64:_,f32:new Float32Array(_)};return f.set(u,y),a?y.f32:y.f64}calculateFogMatrix(e){const i=e.key,a=this._fogMatrixCacheF32;if(a.has(i))return a.get(i);const o=Va(e,this.worldSize);return c.L(o,this._fogMatrix,o),a.set(i,new Float32Array(o)),a.get(i)}getConstrained(e,i){i=c.ab(+i,this.minZoom,this.maxZoom);const a={center:new c.N(e.lng,e.lat),zoom:i};let o=this._helper._lngRange;this._helper._renderWorldCopies||o!==null||(o=[-179.9999999999,180-1e-10]);const u=this.tileSize*c.aG(a.zoom);let f=0,_=u,y=0,v=u,T=0,P=0;const{x:S,y:A}=this.size;if(this._helper._latRange){const X=this._helper._latRange;f=c.Q(X[1])*u,_=c.Q(X[0])*u,_-f_&&(U=_-X)}if(o){const X=(y+v)/2;let W=R;this._helper._renderWorldCopies&&(W=c.aI(R,X-u/2,X+u/2));const K=S/2;W-Kv&&(N=v-K)}if(N!==void 0||U!==void 0){const X=new c.P(N??R,U??V);a.center=Nt(u,X).wrap()}return a}calculateCenterFromCameraLngLatAlt(e,i,a,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,a,o)}_calculateNearFarZIfNeeded(e,i,a){if(!this._helper.autoCalculateNearFarZ)return;const o=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),u=e-o*this._helper._pixelPerMeter/Math.cos(i),f=o<0?u:e,_=Math.PI/2+this.pitchInRadians,y=c.aa(this.fov)*(Math.abs(Math.cos(c.aa(this.roll)))*this.height+Math.abs(Math.sin(c.aa(this.roll)))*this.width)/this.height*(.5+a.y/this.height),v=Math.sin(y)*f/Math.sin(c.ab(Math.PI-_-y,.01,Math.PI-.01)),T=wt(this),P=Math.atan(T/this._helper.cameraToCenterDistance),S=c.aa(.75),A=P>S?2*P*(.5+a.y/(2*T)):S,R=Math.sin(A)*f/Math.sin(c.ab(Math.PI-_-A,.01,Math.PI-.01)),V=Math.min(v,R);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*V+f),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=Et(this.worldSize,this.center),a=i.x,o=i.y;this._helper._pixelPerMeter=c.aH(1,this.center.lat)*this.worldSize;const u=c.aa(Math.min(this.pitch,89.25)),f=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(u));let _;this._calculateNearFarZIfNeeded(f,u,e),_=new Float64Array(16),c.aV(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),c.an(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=c.aW(_),c.K(_,_,[1,-1,1]),c.J(_,_,[0,0,-this._helper.cameraToCenterDistance]),c.aX(_,_,-this.rollInRadians),c.aY(_,_,this.pitchInRadians),c.aX(_,_,-this.bearingInRadians),c.J(_,_,[-a,-o,0]),this._mercatorMatrix=c.K([],_,[this.worldSize,this.worldSize,this.worldSize]),c.K(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=c.L(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),c.J(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=c.an([],_);const y=[0,0,-1,1];c.al(y,y,this._invViewProjMatrix),this._cameraPosition=[y[0]/y[3],y[1]/y[3],y[2]/y[3]],this._fogMatrix=new Float64Array(16),c.aV(this._fogMatrix,this.fovInRadians,this.width/this.height,f,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,c.K(this._fogMatrix,this._fogMatrix,[1,-1,1]),c.J(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),c.aX(this._fogMatrix,this._fogMatrix,-this.rollInRadians),c.aY(this._fogMatrix,this._fogMatrix,this.pitchInRadians),c.aX(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),c.J(this._fogMatrix,this._fogMatrix,[-a,-o,0]),c.K(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),c.J(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=c.L(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const v=this._helper._width%2/2,T=this._helper._height%2/2,P=Math.cos(this.bearingInRadians),S=Math.sin(-this.bearingInRadians),A=a-Math.round(a)+P*v+S*T,R=o-Math.round(o)+P*T+S*v,V=new Float64Array(_);if(c.J(V,V,[A>.5?A-1:A,R>.5?R-1:R,0]),this._alignedProjMatrix=V,_=c.an(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new c.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return c.al(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=c.aH(1,this.center.lat)*this.worldSize;return ii(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const a=c.Y.fromLngLat(e),o=[a.x*this.worldSize,a.y*this.worldSize,i,1];return c.al(o,o,this._viewProjMatrix),o[2]/o[3]}getProjectionData(e){const{overscaledTileID:i,aligned:a,applyTerrainMatrix:o}=e,u=this._helper.getMercatorTileCoordinates(i),f=i?this.calculatePosMatrix(i,a,!0):null;let _;return _=i&&i.terrainRttPosMatrix32f&&o?i.terrainRttPosMatrix32f:f||c.aZ(),{mainMatrix:_,tileMercatorCoords:u,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,i,a){return 1}transformLightDirection(e){return c.aN(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,a,o){const u=this.calculatePosMatrix(a);let f;o?(f=[e,i,o(e,i),1],c.al(f,f,u)):(f=[e,i,0,1],Rt(f,f,u));const _=f[3];return{point:new c.P(f[0]/_,f[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const i of e)this.calculatePosMatrix(i)}getMatrixForModel(e,i){const a=c.Y.fromLngLat(e,i),o=a.meterInMercatorCoordinateUnits(),u=c.a_();return c.J(u,u,[a.x,a.y,a.z]),c.aX(u,u,Math.PI),c.aY(u,u,Math.PI/2),c.K(u,u,[-o,o,o]),u}getProjectionDataForCustomLayer(e=!0){const i=new c.S(0,0,0,0,0),a=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),o=Va(i,this.worldSize);c.L(o,this._viewProjMatrix,o),a.tileMercatorCoords=[0,0,1,1];const u=[c.X,c.X,this.worldSize/this._helper.pixelsPerMeter],f=c.a$();return c.K(f,o,u),a.fallbackMatrix=f,a.mainMatrix=f,a}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Ci(){c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Za(h){if(h.useSlerp)if(h.k<1){const e=c.b0(h.startEulerAngles.roll,h.startEulerAngles.pitch,h.startEulerAngles.bearing),i=c.b0(h.endEulerAngles.roll,h.endEulerAngles.pitch,h.endEulerAngles.bearing),a=new Float64Array(4);c.b1(a,e,i,h.k);const o=c.b2(a);h.tr.setRoll(o.roll),h.tr.setPitch(o.pitch),h.tr.setBearing(o.bearing)}else h.tr.setRoll(h.endEulerAngles.roll),h.tr.setPitch(h.endEulerAngles.pitch),h.tr.setBearing(h.endEulerAngles.bearing);else h.tr.setRoll(c.y.number(h.startEulerAngles.roll,h.endEulerAngles.roll,h.k)),h.tr.setPitch(c.y.number(h.startEulerAngles.pitch,h.endEulerAngles.pitch,h.k)),h.tr.setBearing(c.y.number(h.startEulerAngles.bearing,h.endEulerAngles.bearing,h.k))}function rr(h,e,i,a,o){const u=o.padding,f=Et(o.worldSize,i.getNorthWest()),_=Et(o.worldSize,i.getNorthEast()),y=Et(o.worldSize,i.getSouthEast()),v=Et(o.worldSize,i.getSouthWest()),T=c.aa(-a),P=f.rotate(T),S=_.rotate(T),A=y.rotate(T),R=v.rotate(T),V=new c.P(Math.max(P.x,S.x,R.x,A.x),Math.max(P.y,S.y,R.y,A.y)),N=new c.P(Math.min(P.x,S.x,R.x,A.x),Math.min(P.y,S.y,R.y,A.y)),U=V.sub(N),G=(o.width-(u.left+u.right+e.left+e.right))/U.x,X=(o.height-(u.top+u.bottom+e.top+e.bottom))/U.y;if(X<0||G<0)return void Ci();const W=Math.min(c.a8(o.scale*Math.min(G,X)),h.maxZoom),K=c.P.convert(h.offset),Q=new c.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(c.aa(a)),J=K.add(Q).mult(o.scale/c.aG(W));return{center:Nt(o.worldSize,f.add(y).div(2).sub(J)),zoom:W,bearing:a}}class Fs{get useGlobeControls(){return!1}handlePanInertia(e,i){return{easingOffset:e,easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(e,i){e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta),e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta)}handleMapControlsPan(e,i,a){e.around.distSqr(i.centerPoint)<.01||i.setLocationAtPoint(a,e.around)}cameraForBoxAndBearing(e,i,a,o,u){return rr(e,i,a,o,u)}handleJumpToCenterZoom(e,i){e.zoom!==(i.zoom!==void 0?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),i.center!==void 0&&e.setCenter(c.N.convert(i.center))}handleEaseTo(e,i){const a=e.zoom,o=e.padding,u={roll:e.roll,pitch:e.pitch,bearing:e.bearing},f={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},_=i.zoom!==void 0,y=!e.isPaddingEqual(i.padding);let v=!1;const T=_?+i.zoom:e.zoom;let P=e.centerPoint.add(i.offsetAsPoint);const S=e.screenPointToLocation(P),{center:A,zoom:R}=e.getConstrained(c.N.convert(i.center||S),T??a);ni(e,A);const V=Et(e.worldSize,S),N=Et(e.worldSize,A).sub(V),U=c.aG(R-a);return v=R!==a,{easeFunc:G=>{if(v&&e.setZoom(c.y.number(a,R,G)),c.b3(u,f)||Za({startEulerAngles:u,endEulerAngles:f,tr:e,k:G,useSlerp:u.roll!=f.roll}),y&&(e.interpolatePadding(o,i.padding,G),P=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const X=c.aG(e.zoom-a),W=R>a?Math.min(2,U):Math.max(.5,U),K=Math.pow(W,1-G),Q=Nt(e.worldSize,V.add(N.mult(G*K)).mult(X));e.setLocationAtPoint(e.renderWorldCopies?Q.wrap():Q,P)}},isZooming:v,elevationCenter:A}}handleFlyTo(e,i){const a=i.zoom!==void 0,o=e.zoom,u=e.getConstrained(c.N.convert(i.center||i.locationAtOffset),a?+i.zoom:o),f=u.center,_=u.zoom;ni(e,f);const y=Et(e.worldSize,i.locationAtOffset),v=Et(e.worldSize,f).sub(y),T=v.mag(),P=c.aG(_-o);let S;if(i.minZoom!==void 0){const A=Math.min(+i.minZoom,o,_),R=e.getConstrained(f,A).zoom;S=c.aG(R-o)}return{easeFunc:(A,R,V,N)=>{e.setZoom(A===1?_:o+c.a8(R));const U=A===1?f:Nt(e.worldSize,y.add(v.mult(V)).mult(R));e.setLocationAtPoint(e.renderWorldCopies?U.wrap():U,N)},scaleOfZoom:P,targetCenter:f,scaleOfMinZoom:S,pixelPathLength:T}}}class dt{constructor(e,i,a){this.blendFunction=e,this.blendColor=i,this.mask=a}}dt.Replace=[1,0],dt.disabled=new dt(dt.Replace,c.b4.transparent,[!1,!1,!1,!1]),dt.unblended=new dt(dt.Replace,c.b4.transparent,[!0,!0,!0,!0]),dt.alphaBlended=new dt([1,771],c.b4.transparent,[!0,!0,!0,!0]);const Pn=2305;class Ye{constructor(e,i,a){this.enable=e,this.mode=i,this.frontFace=a}}Ye.disabled=new Ye(!1,1029,Pn),Ye.backCCW=new Ye(!0,1029,Pn),Ye.frontCCW=new Ye(!0,1028,Pn);class Ge{constructor(e,i,a){this.func=e,this.mask=i,this.range=a}}Ge.ReadOnly=!1,Ge.ReadWrite=!0,Ge.disabled=new Ge(519,Ge.ReadOnly,[0,1]);const rs=7680;class Qe{constructor(e,i,a,o,u,f){this.test=e,this.ref=i,this.mask=a,this.fail=o,this.depthFail=u,this.pass=f}}Qe.disabled=new Qe({func:519,mask:0},0,0,rs,rs,rs);const Mn=new WeakMap;function Fi(h){var e;if(Mn.has(h))return Mn.get(h);{const i=(e=h.getParameter(h.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Mn.set(h,i),i}}class ns{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,a=i.gl;this._texFormat=a.RGBA,this._texType=a.UNSIGNED_BYTE;const o=new c.aC;o.emplaceBack(-1,-1),o.emplaceBack(2,-1),o.emplaceBack(-1,2);const u=new c.aE;u.emplaceBack(0,1,2),this._fullscreenTriangle=new Hi(i.createVertexBuffer(o,Xe.members),i.createIndexBuffer(u),c.aD.simpleSegment(0,0,o.length,u.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(a.TEXTURE1);const f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(f),Fi(a)&&(this._pbo=a.createBuffer(),a.bindBuffer(a.PIXEL_PACK_BUFFER,this._pbo),a.bufferData(a.PIXEL_PACK_BUFFER,4,a.STREAM_READ),a.bindBuffer(a.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,i){const a=this._updateCount;return this._readbackQueue?a>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():a>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,i),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,i=e.gl;e.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const a=this._cachedRenderContext.context,o=a.gl;if(this._bindFramebuffer(),a.viewport.set([0,0,this._texWidth,this._texHeight]),a.clear({color:c.b4.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(a,o.TRIANGLES,Ge.disabled,Qe.disabled,dt.unblended,Ye.disabled,((u,f)=>({u_input:u,u_output_expected:f}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Fi(o)){o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.readBuffer(o.COLOR_ATTACHMENT0),o.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null);const u=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);o.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:u}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Fi(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return c.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ns._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let i=0;return i+=e[0]/256,i+=e[1]/65536,i+=e[2]/16777216,e[3]<127&&(i=-i),i/128}}const ss=c.X/128;function as(h,e){const i=h.granularity!==void 0?Math.max(h.granularity,1):1,a=i+(h.generateBorders?2:0),o=i+(h.extendToNorthPole||h.generateBorders?1:0)+(h.extendToSouthPole||h.generateBorders?1:0),u=a+1,f=o+1,_=h.generateBorders?-1:0,y=h.generateBorders||h.extendToNorthPole?-1:0,v=i+(h.generateBorders?1:0),T=i+(h.generateBorders||h.extendToSouthPole?1:0),P=u*f,S=a*o*6,A=u*f>65536;if(A&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const R=A||e==="32bit",V=new Int16Array(2*P);let N=0;for(let X=y;X<=T;X++)for(let W=_;W<=v;W++){let K=W/i*c.X;W===-1&&(K=-64),W===i+1&&(K=c.X+ss);let Q=X/i*c.X;X===-1&&(Q=h.extendToNorthPole?c.b6:-64),X===i+1&&(Q=h.extendToSouthPole?c.b7:c.X+ss),V[N++]=K,V[N++]=Q}const U=R?new Uint32Array(S):new Uint16Array(S);let G=0;for(let X=0;X0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,i,a,o,u){return this.currentProjection.getMeshFromTileID(e,i,a,o,u)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function ul(h){const e=Sn(h.worldSize,h.center.lat);return 2*Math.PI*e}function os(h,e,i,a,o){const u=1/(1<1e-6){const a=h[0]/i,o=Math.acos(h[2]/i),u=(a>0?o:-o)/Math.PI*180;return new c.N(c.aI(u,-180,180),e)}return new c.N(0,e)}function sn(h){return Math.cos(h*Math.PI/180)}function Vt(h,e){const i=sn(h),a=sn(e);return c.a8(a/i)}function qa(h,e){const i=h.rotate(e.bearingInRadians),a=e.zoom+Vt(e.center.lat,0),o=c.b9(1/sn(e.center.lat),1/sn(Math.min(Math.abs(e.center.lat),60)),c.bc(a,7,3,0,1)),u=360/ul({worldSize:e.worldSize,center:{lat:e.center.lat}});return new c.N(e.center.lng-i.x*u*o,c.ab(e.center.lat+i.y*u,-85.051129,c.aF))}function Sr(h){const e=.5*h,i=Math.sin(e),a=Math.cos(e);return Math.log(i+a)-Math.log(a-i)}function dl(h,e,i,a){const o=h.lat+i*a;if(Math.abs(i)>1){const u=(Math.sign(h.lat+i)!==Math.sign(h.lat)?-Math.abs(h.lat):Math.abs(h.lat))*Math.PI/180,f=Math.abs(h.lat+i)*Math.PI/180,_=Sr(u+a*(f-u)),y=Sr(u),v=Sr(f);return new c.N(h.lng+e*((_-y)/(v-y)),o)}return new c.N(h.lng+e*a,o)}class Ic{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=e}recalculateCache(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(e,i,a,o){const u=`${e.z}_${e.x}_${e.y}`,f=this._cache.get(u);if(f)return f;const _=this._cachePrevious.get(u);if(_)return this._cache.set(u,_),_;const y=this._aabbFactory(e,i,a,o);return this._cache.set(u,y),this._hadAnyChanges=!0,y}}function Os(h,e,i){const a=h-e;return a<0?-a:Math.max(0,a-i)}function Ha(h,e,i,a,o){const u=h-i;let f;return f=u<0?Math.min(-u,1+u-o):u>1?Math.min(Math.max(u-o,0),1-u):0,Math.max(f,Os(e,a,o))}class Cc{constructor(){this._aabbCache=new Ic(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(e,i,a,o){const u=1<4}allowWorldCopies(){return!1}getTileAABB(e,i,a,o){return this._aabbCache.getTileAABB(e,i,a,o)}_computeTileAABB(e,i,a,o){if(e.z<=0)return new ut([-1,-1,-1],[1,1,1]);if(e.z===1)return new ut([e.x===0?-1:0,e.y===0?0:-1,-1],[e.x===0?0:1,e.y===0?1:0,1]);{const u=[os(0,0,e.x,e.y,e.z),os(c.X,0,e.x,e.y,e.z),os(c.X,c.X,e.x,e.y,e.z),os(0,c.X,e.x,e.y,e.z)],f=[1,1,1],_=[-1,-1,-1];for(const y of u)for(let v=0;v<3;v++)f[v]=Math.min(f[v],y[v]),_[v]=Math.max(_[v],y[v]);if(e.y===0||e.y===(1<{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._coveringTilesDetailsProvider=new Cc}clone(){const e=new js;return e.apply(this),e}apply(e,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=c.bf();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:i,applyGlobeMatrix:a}=e,o=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:o,clippingPlane:this._cachedClippingPlane,projectionTransition:a?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,a=this.cameraToCenterDistance/e,o=Math.sin(i)*a,u=Math.cos(i)*a+1,f=1/Math.sqrt(o*o+u*u)*1;let _=-o,y=u;const v=Math.sqrt(_*_+y*y);_/=v,y/=v;const T=[0,_,y];return c.bg(T,T,[0,0,0],-this.bearingInRadians),c.bh(T,T,[0,0,0],-1*this.center.lat*Math.PI/180),c.bi(T,T,[0,0,0],this.center.lng*Math.PI/180),c.aL(T,T,.25),[...T,.25*-f]}isLocationOccluded(e){return!this.isSurfacePointVisible(ct(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,a=this._helper._center.lat*Math.PI/180,o=Math.cos(a),u=[Math.sin(i)*o,Math.sin(a),Math.cos(i)*o],f=[u[2],0,-u[0]],_=[0,0,0];c.aR(_,f,u),c.aQ(f,f),c.aQ(_,_);const y=[0,0,0];return c.aQ(y,[f[0]*e[0]+_[0]*e[1]+u[0]*e[2],f[1]*e[0]+_[1]*e[1]+u[1]*e[2],f[2]*e[0]+_[2]*e[1]+u[2]*e[2]]),y}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,a){const o=function(_,y,v){const T=1/(1<u&&(u=S),A_&&(_=A)}const T=[v.lng+f,v.lat+y,v.lng+u,v.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(T[3]=90,T[0]=-180,T[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(T[1]=-90,T[0]=-180,T[2]=180),new zt(T)}getConstrained(e,i){const a=c.ab(e.lat,-85.051129,c.aF),o=c.ab(+i,this.minZoom+Vt(0,a),this.maxZoom);return{center:new c.N(e.lng,a),zoom:o}}calculateCenterFromCameraLngLatAlt(e,i,a,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,a,o)}setLocationAtPoint(e,i){const a=ct(this.unprojectScreenPoint(i)),o=ct(e),u=c.bf();c.bl(u);const f=c.bf();c.bi(f,a,u,-this.center.lng*Math.PI/180),c.bh(f,f,u,this.center.lat*Math.PI/180);const _=o[0]*o[0]+o[2]*o[2],y=f[0]*f[0];if(_=-U&&R<=U,X=N>=-U&&N<=U;let W,K;if(G&&X){const oe=this.center.lng*Math.PI/180,me=this.center.lat*Math.PI/180;c.bp(P,oe)+c.bp(R,me)=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=c.be();return c.al(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const a=c.aS(e,i),o=c.bf(),u=c.bf();c.aL(u,i,a),c.aP(o,e,u);const f=1-c.aS(o,o);if(f<0)return null;const _=c.aS(e,e)-1,y=-a+(a<0?1:-1)*Math.sqrt(f),v=_/y,T=y;return{tMin:Math.min(v,T),tMax:Math.max(v,T)}}unprojectScreenPoint(e){const i=this._cameraPosition,a=this.getRayDirectionFromPixel(e),o=this.rayPlanetIntersection(i,a);if(o){const v=c.bf();c.aM(v,i,[a[0]*o.tMin,a[1]*o.tMin,a[2]*o.tMin]);const T=c.bf();return c.aQ(T,v),Oi(T)}const u=this._cachedClippingPlane[0]*a[0]+this._cachedClippingPlane[1]*a[1]+this._cachedClippingPlane[2]*a[2],f=-c.bn(this._cachedClippingPlane,i)/u,_=c.bf();if(f>0)c.aM(_,i,[a[0]*f,a[1]*f,a[2]*f]);else{const v=c.bf();c.aM(v,i,[2*a[0],2*a[1],2*a[2]]);const T=c.bn(this._cachedClippingPlane,v);c.aP(_,v,[this._cachedClippingPlane[0]*T,this._cachedClippingPlane[1]*T,this._cachedClippingPlane[2]*T])}const y=c.bf();return c.aQ(y,_),Oi(y)}getMatrixForModel(e,i){const a=c.N.convert(e),o=1/c.bo,u=c.a_();return c.bj(u,u,a.lng/180*Math.PI),c.aY(u,u,-a.lat/180*Math.PI),c.J(u,u,[0,0,1+i/c.bo]),c.aY(u,u,.5*Math.PI),c.K(u,u,[o,o,o]),u}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new c.S(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class an{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,a){return this._helper.interpolatePadding(e,i,a)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,a=!0){this._helper.resize(e,i,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,i){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new rn({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._globeness=1,this._mercatorTransform=new ir,this._verticalPerspectiveTransform=new js}clone(){const e=new an;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const i=this._mercatorTransform.getProjectionData(e),a=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?a.mainMatrix:i.mainMatrix,clippingPlane:a.clippingPlane,tileMercatorCoords:a.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return c.b9(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return c.b9(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,a){const o=this._mercatorTransform.getPitchedTextCorrection(e,i,a),u=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,a);return c.b9(o,u,this._globeness)}projectTileCoordinates(e,i,a,o){return this.currentTransform.projectTileCoordinates(e,i,a,o)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){return this.currentTransform.lngLatToCameraDepth(e,i)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,i){return this.currentTransform.getConstrained(e,i)}calculateCenterFromCameraLngLatAlt(e,i,a,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,a,o)}setLocationAtPoint(e,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,i),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,i){return this.currentTransform.locationToScreenPoint(e,i)}screenPointToMercatorCoordinate(e,i){return this.currentTransform.screenPointToMercatorCoordinate(e,i)}screenPointToLocation(e,i){return this.currentTransform.screenPointToLocation(e,i)}isPointOnMapSurface(e,i){return this.currentTransform.isPointOnMapSurface(e,i)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,i){return this.currentTransform.getMatrixForModel(e,i)}getProjectionDataForCustomLayer(e=!0){const i=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return i;const a=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return a.fallbackMatrix=i.mainMatrix,a}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class gi{get useGlobeControls(){return!0}handlePanInertia(e,i){const a=qa(e,i);return Math.abs(a.lng-i.center.lng)>180&&(a.lng=i.center.lng+179.5*Math.sign(a.lng-i.center.lng)),{easingCenter:a,easingOffset:new c.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const a=e.around,o=i.screenPointToLocation(a);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const u=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const f=i.zoom-u;if(f===0)return;const _=c.bk(i.center.lng,o.lng),y=_/(Math.abs(_/180)+1),v=c.bk(i.center.lat,o.lat),T=i.getRayDirectionFromPixel(a),P=i.cameraPosition,S=-1*c.aS(P,T),A=c.bf();c.aM(A,P,[T[0]*S,T[1]*S,T[2]*S]);const R=c.bq(A)-1,V=Math.exp(.5*-Math.max(R-.3,0)),N=Sn(i.worldSize,i.center.lat)/Math.min(i.width,i.height),U=c.bc(N,.9,.5,1,.25),G=(1-c.aG(-f))*Math.min(V,U),X=i.center.lat,W=i.zoom,K=new c.N(i.center.lng+y*G,c.ab(i.center.lat+v*G,-85.051129,c.aF));i.setLocationAtPoint(o,a);const Q=i.center,J=c.bc(Math.abs(_),45,85,0,1),se=c.bc(N,.75,.35,0,1),oe=Math.pow(Math.max(J,se),.25),me=c.bk(Q.lng,K.lng),ye=c.bk(Q.lat,K.lat);i.setCenter(new c.N(Q.lng+me*oe,Q.lat+ye*oe).wrap()),i.setZoom(W+Vt(X,i.center.lat))}handleMapControlsPan(e,i,a){if(!e.panDelta)return;const o=i.center.lat,u=i.zoom;i.setCenter(qa(e.panDelta,i).wrap()),i.setZoom(u+Vt(o,i.center.lat))}cameraForBoxAndBearing(e,i,a,o,u){const f=rr(e,i,a,o,u),_=i.left/u.width*2-1,y=(u.width-i.right)/u.width*2-1,v=i.top/u.height*-2+1,T=(u.height-i.bottom)/u.height*-2+1,P=c.bk(a.getWest(),a.getEast())<0,S=P?a.getEast():a.getWest(),A=P?a.getWest():a.getEast(),R=Math.max(a.getNorth(),a.getSouth()),V=Math.min(a.getNorth(),a.getSouth()),N=S+.5*c.bk(S,A),U=R+.5*c.bk(R,V),G=u.clone();G.setCenter(f.center),G.setBearing(f.bearing),G.setPitch(0),G.setRoll(0),G.setZoom(f.zoom);const X=G.modelViewProjectionMatrix,W=[ct(a.getNorthWest()),ct(a.getNorthEast()),ct(a.getSouthWest()),ct(a.getSouthEast()),ct(new c.N(A,U)),ct(new c.N(S,U)),ct(new c.N(N,R)),ct(new c.N(N,V))],K=ct(f.center);let Q=Number.POSITIVE_INFINITY;for(const J of W)_<0&&(Q=gi.getLesserNonNegativeNonNull(Q,gi.solveVectorScale(J,K,X,"x",_))),y>0&&(Q=gi.getLesserNonNegativeNonNull(Q,gi.solveVectorScale(J,K,X,"x",y))),v>0&&(Q=gi.getLesserNonNegativeNonNull(Q,gi.solveVectorScale(J,K,X,"y",v))),T<0&&(Q=gi.getLesserNonNegativeNonNull(Q,gi.solveVectorScale(J,K,X,"y",T)));if(Number.isFinite(Q)&&Q!==0)return f.zoom=G.zoom+c.a8(Q),f;Ci()}handleJumpToCenterZoom(e,i){const a=e.center.lat,o=e.getConstrained(i.center?c.N.convert(i.center):e.center,e.zoom).center;e.setCenter(o.wrap());const u=i.zoom!==void 0?+i.zoom:e.zoom+Vt(a,o.lat);e.zoom!==u&&e.setZoom(u)}handleEaseTo(e,i){const a=e.zoom,o=e.center,u=e.padding,f={roll:e.roll,pitch:e.pitch,bearing:e.bearing},_={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},y=i.zoom!==void 0,v=!e.isPaddingEqual(i.padding);let T=!1;const P=i.center?c.N.convert(i.center):o,S=e.getConstrained(P,a).center;ni(e,S);const A=e.clone();A.setCenter(S),A.setZoom(y?+i.zoom:a+Vt(o.lat,P.lat)),A.setBearing(i.bearing);const R=new c.P(c.ab(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),c.ab(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));A.setLocationAtPoint(S,R);const V=(i.offset&&i.offsetAsPoint.mag())>0?A.center:S,N=y?+i.zoom:a+Vt(o.lat,V.lat),U=a+Vt(o.lat,0),G=N+Vt(V.lat,0),X=c.bk(o.lng,V.lng),W=c.bk(o.lat,V.lat),K=c.aG(G-U);return T=N!==a,{easeFunc:Q=>{if(c.b3(f,_)||Za({startEulerAngles:f,endEulerAngles:_,tr:e,k:Q,useSlerp:f.roll!=_.roll}),v&&e.interpolatePadding(u,i.padding,Q),i.around)c.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const J=G>U?Math.min(2,K):Math.max(.5,K),se=Math.pow(J,1-Q),oe=dl(o,X,W,Q*se);e.setCenter(oe.wrap())}if(T){const J=c.y.number(U,G,Q)+Vt(0,e.center.lat);e.setZoom(J)}},isZooming:T,elevationCenter:V}}handleFlyTo(e,i){const a=i.zoom!==void 0,o=e.center,u=e.zoom,f=!e.isPaddingEqual(i.padding),_=e.getConstrained(c.N.convert(i.center||i.locationAtOffset),u).center,y=a?+i.zoom:e.zoom+Vt(e.center.lat,_.lat),v=e.clone();v.setCenter(_),f&&v.setPadding(i.padding),v.setZoom(y),v.setBearing(i.bearing);const T=new c.P(c.ab(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),c.ab(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));v.setLocationAtPoint(_,T);const P=v.center;ni(e,P);const S=function(X,W,K){const Q=ct(W),J=ct(K),se=c.aS(Q,J),oe=Math.acos(se),me=ul(X);return oe/(2*Math.PI)*me}(e,o,P),A=u+Vt(o.lat,0),R=y+Vt(P.lat,0),V=c.aG(R-A);let N;if(typeof i.minZoom=="number"){const X=+i.minZoom+Vt(P.lat,0),W=Math.min(X,A,R)+Vt(0,P.lat),K=e.getConstrained(P,W).zoom+Vt(P.lat,0);N=c.aG(K-A)}const U=c.bk(o.lng,P.lng),G=c.bk(o.lat,P.lat);return{easeFunc:(X,W,K,Q)=>{const J=dl(o,U,G,K),se=X===1?P:J;e.setCenter(se.wrap());const oe=A+c.a8(W);e.setZoom(X===1?y:oe+Vt(0,se.lat))},scaleOfZoom:V,targetCenter:P,scaleOfMinZoom:N,pixelPathLength:S}}static solveVectorScale(e,i,a,o,u){const f=o==="x"?[a[0],a[4],a[8],a[12]]:[a[1],a[5],a[9],a[13]],_=[a[3],a[7],a[11],a[15]],y=e[0]*f[0]+e[1]*f[1]+e[2]*f[2],v=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],T=i[0]*f[0]+i[1]*f[1]+i[2]*f[2],P=i[0]*_[0]+i[1]*_[1]+i[2]*_[2];return T+u*v===y+u*P||_[3]*(y-T)+f[3]*(P-v)+y*P==T*v?null:(T+f[3]-u*P-u*_[3])/(T-y-u*P+u*v)}static getLesserNonNegativeNonNull(e,i){return i!==null&&i>=0&&ic.t(h,e&&e.filter(i=>i.identifier!=="source.canvas")),Xa=c.br();class Ei extends c.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const a in this.sourceCaches){const o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=e,this.dispatcher=new Ur(Vr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(a,o)=>this.getGlyphs(a,o)),this.dispatcher.registerMessageHandler("GI",(a,o)=>this.getImages(a,o)),this.imageManager=new Rs,this.imageManager.setEventedParent(this),this.glyphManager=new ei(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new Nr(256,512),this.crossTileSymbolIndex=new tn,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.bs,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.bt()),tr().on(Xr,this._rtlPluginLoaded),this.on("data",a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;const o=this.sourceCaches[a.sourceId];if(!o)return;const u=o.getSource();if(u&&u.vectorLayerIds)for(const f in this._layers){const _=this._layers[f];_.source===u.id&&this._validateLayer(_)}})}loadURL(e,i={},a){this.fire(new c.k("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate;const o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const u=this._loadStyleRequest;c.h(o,this._loadStyleRequest).then(f=>{this._loadStyleRequest=null,this._load(f.data,i,a)}).catch(f=>{this._loadStyleRequest=null,f&&!u.signal.aborted&&this.fire(new c.j(f))})}loadJSON(e,i={},a){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Ze.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(e,i,a)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(Xa,{validate:!1})}_load(e,i,a){var o,u;const f=i.transformStyle?i.transformStyle(a,e):e;if(!i.validate||!In(this,c.u(f))){this._loaded=!0,this.stylesheet=f;for(const _ in f.sources)this.addSource(_,f.sources[_],{validate:!1});f.sprite?this._loadSprite(f.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(f.glyphs),this._createLayers(),this.light=new yn(this.stylesheet.light),this._setProjectionInternal(((o=this.stylesheet.projection)===null||o===void 0?void 0:o.type)||"mercator"),this.sky=new jr(this.stylesheet.sky),this.map.setTerrain((u=this.stylesheet.terrain)!==null&&u!==void 0?u:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const e=c.bu(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(i=>i.id),this._layers={},this._serializedLayers=null;for(const i of e){const a=c.bv(i);a.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=a}}_loadSprite(e,i=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(u,f,_,y){return c._(this,void 0,void 0,function*(){const v=Mt(u),T=_>1?"@2x":"",P={},S={};for(const{id:A,url:R}of v){const V=f.transformRequest(ft(R,T,".json"),"SpriteJSON");P[A]=c.h(V,y);const N=f.transformRequest(ft(R,T,".png"),"SpriteImage");S[A]=oi.getImage(N,y)}return yield Promise.all([...Object.values(P),...Object.values(S)]),function(A,R){return c._(this,void 0,void 0,function*(){const V={};for(const N in A){V[N]={};const U=Ze.getImageCanvasContext((yield R[N]).data),G=(yield A[N]).data;for(const X in G){const{width:W,height:K,x:Q,y:J,sdf:se,pixelRatio:oe,stretchX:me,stretchY:ye,content:de,textFitWidth:Se,textFitHeight:Pe}=G[X];V[N][X]={data:null,pixelRatio:oe,sdf:se,stretchX:me,stretchY:ye,content:de,textFitWidth:Se,textFitHeight:Pe,spriteData:{width:W,height:K,x:Q,y:J,context:U}}}}return V})}(P,S)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(u=>{if(this._spriteRequest=null,u)for(const f in u){this._spritesImagesIds[f]=[];const _=this._spritesImagesIds[f]?this._spritesImagesIds[f].filter(y=>!(y in u)):[];for(const y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(const y in u[f]){const v=f==="default"?y:`${f}:${y}`;this._spritesImagesIds[f].push(v),v in this.imageManager.images?this.imageManager.updateImage(v,u[f][y],!1):this.imageManager.addImage(v,u[f][y]),i&&(this._changedImages[v]=!0)}}}).catch(u=>{this._spriteRequest=null,o=u,this.fire(new c.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),a&&a(o)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const a=e.sourceLayer;if(!a)return;const o=i.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new c.j(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const a=this._serializedAllLayers();if(!e||e.length===0)return Object.values(i?c.bw(a):a);const o=[];for(const u of e)if(a[u]){const f=i?c.bw(a[u]):a[u];o.push(f)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const i=Object.keys(this._layers);for(const a of i){const o=this._layers[a];o.type!=="custom"&&(e[a]=o.serialize())}return e}hasTransitions(){var e,i,a;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((i=this.sky)===null||i===void 0)&&i.hasTransition()||!((a=this.projection)===null||a===void 0)&&a.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(e){if(!this._loaded)return;const i=this._changed;if(i){const o=Object.keys(this._updatedLayers),u=Object.keys(this._removedLayers);(o.length||u.length)&&this._updateWorkerLayers(o,u);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const a={};for(const o in this.sourceCaches){const u=this.sourceCaches[o];a[o]=u.used,u.used=!1}for(const o of this._order){const u=this._layers[o];u.recalculate(e,this._availableImages),!u.isHidden(e.zoom)&&u.source&&(this.sourceCaches[u.source].used=!0)}for(const o in a){const u=this.sourceCaches[o];!!a[o]!=!!u.used&&u.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var a;this._checkLoaded();const o=this.serialize();if(e=i.transformStyle?i.transformStyle(o,e):e,((a=i.validate)===null||a===void 0||a)&&In(this,c.u(e)))return!1;(e=c.bw(e)).layers=c.bu(e.layers);const u=c.bx(o,e),f=this._getOperationsToPerform(u);if(f.unimplemented.length>0)throw new Error(`Unimplemented: ${f.unimplemented.join(", ")}.`);if(f.operations.length===0)return!1;for(const _ of f.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const i=[],a=[];for(const o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":i.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":i.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setSky":i.push(()=>this.setSky.apply(this,o.args));break;case"setProjection":this.setProjection.apply(this,o.args);break;case"setTransition":i.push(()=>{});break;default:a.push(o.command)}return{operations:i,unimplemented:a}}addImage(e,i){if(this.getImage(e))return this.fire(new c.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,i){this.imageManager.updateImage(e,i)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new c.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,a={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(c.u.source,`sources.${e}`,i,null,a))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const o=this.sourceCaches[e]=new D(e,i,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===e)return this.fire(new c.j(new Error(`Source "${e}" cannot be removed while layer "${a}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,i){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const a=this.sourceCaches[e].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(i),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,a={}){this._checkLoaded();const o=e.id;if(this.getLayer(o))return void this.fire(new c.j(new Error(`Layer "${o}" already exists on this map.`)));let u;if(e.type==="custom"){if(In(this,c.by(e)))return;u=c.bv(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=c.bw(e),e=c.e(e,{source:o})),this._validate(c.u.layer,`layers.${o}`,e,{arrayIndex:-1},a))return;u=c.bv(e),this._validateLayer(u),u.setEventedParent(this,{layer:{id:o}})}const f=i?this._order.indexOf(i):this._order.length;if(i&&f===-1)this.fire(new c.j(new Error(`Cannot add layer "${o}" before non-existing layer "${i}".`)));else{if(this._order.splice(f,0,o),this._layerOrderChanged=!0,this._layers[o]=u,this._removedLayers[o]&&u.source&&u.type!=="custom"){const _=this._removedLayers[o];delete this._removedLayers[o],_.type!==u.type?this._updatedSources[u.source]="clear":(this._updatedSources[u.source]="reload",this.sourceCaches[u.source].pause())}this._updateLayer(u),u.onAdd&&u.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new c.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const a=this._order.indexOf(e);this._order.splice(a,1);const o=i?this._order.indexOf(i):this._order.length;i&&o===-1?this.fire(new c.j(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const a=this._order.indexOf(e);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,a){this._checkLoaded();const o=this.getLayer(e);o?o.minzoom===i&&o.maxzoom===a||(i!=null&&(o.minzoom=i),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,a={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!c.bz(o.filter,i))return i==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(c.u.filter,`layers.${o.id}.filter`,i,null,a)||(o.filter=c.bw(i),this._updateLayer(o)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return c.bw(this.getLayer(e).filter)}setLayoutProperty(e,i,a,o={}){this._checkLoaded();const u=this.getLayer(e);u?c.bz(u.getLayoutProperty(i),a)||(u.setLayoutProperty(i,a,o),this._updateLayer(u)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const a=this.getLayer(e);if(a)return a.getLayoutProperty(i);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,a,o={}){this._checkLoaded();const u=this.getLayer(e);u?c.bz(u.getPaintProperty(i),a)||(u.setPaintProperty(i,a,o)&&this._updateLayer(u),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,i){return this.getLayer(e).getPaintProperty(i)}setFeatureState(e,i){this._checkLoaded();const a=e.source,o=e.sourceLayer,u=this.sourceCaches[a];if(u===void 0)return void this.fire(new c.j(new Error(`The source '${a}' does not exist in the map's style.`)));const f=u.getSource().type;f==="geojson"&&o?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||o?(e.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),u.setFeatureState(o,e.id,i)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const a=e.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new c.j(new Error(`The source '${a}' does not exist in the map's style.`)));const u=o.getSource().type,f=u==="vector"?e.sourceLayer:void 0;u!=="vector"||f?i&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(f,e.id,i):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,a=e.sourceLayer,o=this.sourceCaches[i];if(o!==void 0)return o.getSource().type!=="vector"||a?(e.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,e.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=c.bA(this.sourceCaches,u=>u.serialize()),i=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,o=this.stylesheet;return c.bB({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,projection:o.projection,sources:e,layers:i,terrain:a},u=>u!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const i=f=>this._layers[f].type==="fill-extrusion",a={},o=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_)){a[_]=f;for(const y of e){const v=y[_];if(v)for(const T of v)o.push(T)}}}o.sort((f,_)=>_.intersectionZ-f.intersectionZ);const u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_))for(let y=o.length-1;y>=0;y--){const v=o[y].feature;if(a[v.layer.id]{const me=X.featureSortOrder;if(me){const ye=me.indexOf(se.featureIndex);return me.indexOf(oe.featureIndex)-ye}return oe.featureIndex-se.featureIndex});for(const se of J)Q.push(se)}}return function(X,W,K){for(const Q in X)for(const J of X[Q])Ot(J,K[W[Q].source]);return X}(N,v,P)}(this._layers,f,this.sourceCaches,e,y,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)}querySourceFeatures(e,i){i&&i.filter&&this._validate(c.u.filter,"querySourceFeatures.filter",i.filter,null,i);const a=this.sourceCaches[e];return a?function(o,u){const f=o.getRenderableIds().map(v=>o.getTileByID(v)),_=[],y={};for(let v=0;vS.getTileByID(A)).sort((A,R)=>R.tileID.overscaledZ-A.tileID.overscaledZ||(A.tileID.isLessThan(R.tileID)?-1:1))}const P=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);f=f||P}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((u=u||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Ze.now(),e.zoom))&&(this.pauseablePlacement=new ol(e,this.map.terrain,this._order,u,i,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Ze.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Ze.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return c._(this,void 0,void 0,function*(){const a=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,i.icons),a})}getGlyphs(e,i){return c._(this,void 0,void 0,function*(){const a=yield this.glyphManager.getGlyphs(i.stacks),o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,[""]),a})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(c.u.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,a={},o){this._checkLoaded();const u=[{id:e,url:i}],f=[...Mt(this.stylesheet.sprite),...u];this._validate(c.u.sprite,"sprite",f,null,a)||(this.stylesheet.sprite=f,this._loadSprite(u,!0,o))}removeSprite(e){this._checkLoaded();const i=Mt(this.stylesheet.sprite);if(i.find(a=>a.id===e)){if(this._spritesImagesIds[e])for(const a of this._spritesImagesIds[e])this.imageManager.removeImage(a),this._changedImages[a]=!0;i.splice(i.findIndex(a=>a.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return Mt(this.stylesheet.sprite)}setSprite(e,i={},a){this._checkLoaded(),e&&this._validate(c.u.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,a):(this._unloadSprite(),a&&a(null)))}}var Ec=c.aA([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Wa{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,i,a,o,u,f,_,y,v){this.context=e;let T=this.boundPaintVertexBuffers.length!==o.length;for(let P=0;!T&&P({u_texture:0,u_ele_delta:h,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):c.b4.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:i?i.calculateFogBlendOpacity(a):0,u_horizon_color:i?i.properties.get("horizon-color"):c.b4.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),hs={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Ns(h){const e=[];for(let i=0;i({u_depth:new c.bC(oe,me.u_depth),u_terrain:new c.bC(oe,me.u_terrain),u_terrain_dim:new c.b5(oe,me.u_terrain_dim),u_terrain_matrix:new c.bD(oe,me.u_terrain_matrix),u_terrain_unpack:new c.bE(oe,me.u_terrain_unpack),u_terrain_exaggeration:new c.b5(oe,me.u_terrain_exaggeration)}))(e,se),this.projectionUniforms=((oe,me)=>({u_projection_matrix:new c.bD(oe,me.u_projection_matrix),u_projection_tile_mercator_coords:new c.bE(oe,me.u_projection_tile_mercator_coords),u_projection_clipping_plane:new c.bE(oe,me.u_projection_clipping_plane),u_projection_transition:new c.b5(oe,me.u_projection_transition),u_projection_fallback_matrix:new c.bD(oe,me.u_projection_fallback_matrix)}))(e,se),this.binderUniforms=a?a.getUniforms(e,se):[]}draw(e,i,a,o,u,f,_,y,v,T,P,S,A,R,V,N,U,G,X){const W=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(a),e.setStencilMode(o),e.setColorMode(u),e.setCullFace(f),y){e.activeTexture.set(W.TEXTURE2),W.bindTexture(W.TEXTURE_2D,y.depthTexture),e.activeTexture.set(W.TEXTURE3),W.bindTexture(W.TEXTURE_2D,y.texture);for(const Q in this.terrainUniforms)this.terrainUniforms[Q].set(y[Q])}if(v)for(const Q in v)this.projectionUniforms[hs[Q]].set(v[Q]);if(_)for(const Q in this.fixedUniforms)this.fixedUniforms[Q].set(_[Q]);N&&N.setUniforms(e,this.binderUniforms,R,{zoom:V});let K=0;switch(i){case W.LINES:K=2;break;case W.TRIANGLES:K=3;break;case W.LINE_STRIP:K=1}for(const Q of A.get()){const J=Q.vaos||(Q.vaos={});(J[T]||(J[T]=new Wa)).bind(e,this,P,N?N.getPaintVertexBuffers():[],S,Q.vertexOffset,U,G,X),W.drawElements(i,Q.primitiveLength*K,W.UNSIGNED_SHORT,Q.primitiveOffset*K*2)}}}function pl(h,e,i){const a=1/c.at(i,1,e.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),u=i.tileSize*Math.pow(2,e.transform.tileZoom)/o,f=u*(i.tileID.canonical.x+i.tileID.wrap*o),_=u*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[a,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const on=(h,e,i,a)=>{const o=h.style.light,u=o.properties.get("position"),f=[u.x,u.y,u.z],_=c.bI();o.properties.get("anchor")==="viewport"&&c.bJ(_,h.transform.bearingInRadians),c.bK(f,f,_);const y=h.transform.transformLightDirection(f),v=o.properties.get("color");return{u_lightpos:f,u_lightpos_globe:y,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:a}},Ac=(h,e,i,a,o,u,f)=>c.e(on(h,e,i,a),pl(u,h,f),{u_height_factor:-Math.pow(2,o.overscaledZ)/f.tileSize/8}),Ka=(h,e,i,a)=>c.e(pl(e,h,i),{u_fill_translate:a}),zc=(h,e)=>({u_world:h,u_fill_translate:e}),fl=(h,e,i,a,o)=>c.e(Ka(h,e,i,o),{u_world:a}),Ya=(h,e,i,a,o)=>{const u=h.transform;let f,_,y=0;if(i.paint.get("circle-pitch-alignment")==="map"){const v=c.at(e,1,u.zoom);f=!0,_=[v,v],y=v/(c.X*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*o}else f=!1,_=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:y,u_translate:a}},ml=h=>({u_pixel_extrude_scale:[1/h.width,1/h.height]}),_l=h=>({u_viewport_size:[h.width,h.height]}),Ja=(h,e=1)=>({u_color:h,u_overlay:0,u_overlay_scale:e}),Qa=(h,e,i,a)=>{const o=c.at(h,1,e)/(c.X*Math.pow(2,h.tileID.overscaledZ))*2*Math.PI*a;return{u_extrude_scale:c.at(h,1,e),u_intensity:i,u_globe_extrude_scale:o}},Ir=(h,e,i,a)=>{const o=c.H();c.bL(o,0,h.width,h.height,0,0,1);const u=h.context.gl;return{u_matrix:o,u_world:[u.drawingBufferWidth,u.drawingBufferHeight],u_image:i,u_color_ramp:a,u_opacity:e.paint.get("heatmap-opacity")}},gl=(h,e,i)=>{const a=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),u=i.paint.get("hillshade-accent-color");let f=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return i.paint.get("hillshade-illumination-anchor")==="viewport"&&(f+=h.transform.bearingInRadians),{u_image:0,u_latrange:us(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:a,u_highlight:o,u_accent:u}},yl=(h,e)=>{const i=e.stride,a=c.H();return c.bL(a,0,c.X,-8192,0,0,1),c.J(a,a,[0,-8192,0]),{u_matrix:a,u_image:1,u_dimension:[i,i],u_zoom:h.overscaledZ,u_unpack:e.getUnpackVector()}};function us(h,e){const i=Math.pow(2,e.canonical.z),a=e.canonical.y;return[new c.Y(0,a/i).toLngLat().lat,new c.Y(0,(a+1)/i).toLngLat().lat]}const eo=(h,e,i,a)=>{const o=h.transform;return{u_translation:io(h,e,i),u_ratio:a/c.at(e,1,o.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Us=(h,e,i,a,o)=>c.e(eo(h,e,i,a),{u_image:0,u_image_height:o}),kc=(h,e,i,a,o)=>{const u=h.transform,f=to(e,u);return{u_translation:io(h,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:a/c.at(e,1,u.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[f,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},Dc=(h,e,i,a,o,u)=>{const f=h.lineAtlas,_=to(e,h.transform),y=i.layout.get("line-cap")==="round",v=f.getDash(o.from,y),T=f.getDash(o.to,y),P=v.width*u.fromScale,S=T.width*u.toScale;return c.e(eo(h,e,i,a),{u_patternscale_a:[_/P,-v.height/2],u_patternscale_b:[_/S,-T.height/2],u_sdfgamma:f.width/(256*Math.min(P,S)*h.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:T.y,u_mix:u.t})};function to(h,e){return 1/c.at(h,1,e.tileZoom)}function io(h,e,i){return c.au(h.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const xl=(h,e,i,a,o)=>{return{u_tl_parent:h,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(f=a.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(u=a.paint.get("raster-contrast"),u>0?1/(1-u):1+u),u_spin_weights:ro(a.paint.get("raster-hue-rotate")),u_coords_top:[o[0].x,o[0].y,o[1].x,o[1].y],u_coords_bottom:[o[3].x,o[3].y,o[2].x,o[2].y]};var u,f};function ro(h){h*=Math.PI/180;const e=Math.sin(h),i=Math.cos(h);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const no=(h,e,i,a,o,u,f,_,y,v,T,P,S)=>{const A=f.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:A.cameraToCenterDistance,u_pitch:A.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:A.width/A.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:y,u_is_text:+T,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:u,u_texsize:P,u_texture:0,u_translation:v,u_pitched_scale:S}},ds=(h,e,i,a,o,u,f,_,y,v,T,P,S,A)=>{const R=f.transform;return c.e(no(h,e,i,a,o,u,f,_,y,v,T,P,A),{u_gamma_scale:a?Math.cos(R.pitch*Math.PI/180)*R.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},nr=(h,e,i,a,o,u,f,_,y,v,T,P,S)=>c.e(ds(h,e,i,a,o,u,f,_,y,v,!0,T,0,S),{u_texsize_icon:P,u_texture_icon:1}),so=(h,e)=>({u_opacity:h,u_color:e}),ao=(h,e,i,a,o)=>c.e(function(u,f,_,y){const v=_.imageManager.getPattern(u.from.toString()),T=_.imageManager.getPattern(u.to.toString()),{width:P,height:S}=_.imageManager.getPixelSize(),A=Math.pow(2,y.tileID.overscaledZ),R=y.tileSize*Math.pow(2,_.transform.tileZoom)/A,V=R*(y.tileID.canonical.x+y.tileID.wrap*A),N=R*y.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:v.tl,u_pattern_br_a:v.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[P,S],u_mix:f.t,u_pattern_size_a:v.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/c.at(y,1,_.transform.tileZoom),u_pixel_coord_upper:[V>>16,N>>16],u_pixel_coord_lower:[65535&V,65535&N]}}(i,o,e,a),{u_opacity:h}),Zs=(h,e)=>{},vl={fillExtrusion:(h,e)=>({u_lightpos:new c.bG(h,e.u_lightpos),u_lightpos_globe:new c.bG(h,e.u_lightpos_globe),u_lightintensity:new c.b5(h,e.u_lightintensity),u_lightcolor:new c.bG(h,e.u_lightcolor),u_vertical_gradient:new c.b5(h,e.u_vertical_gradient),u_opacity:new c.b5(h,e.u_opacity),u_fill_translate:new c.bH(h,e.u_fill_translate)}),fillExtrusionPattern:(h,e)=>({u_lightpos:new c.bG(h,e.u_lightpos),u_lightpos_globe:new c.bG(h,e.u_lightpos_globe),u_lightintensity:new c.b5(h,e.u_lightintensity),u_lightcolor:new c.bG(h,e.u_lightcolor),u_vertical_gradient:new c.b5(h,e.u_vertical_gradient),u_height_factor:new c.b5(h,e.u_height_factor),u_opacity:new c.b5(h,e.u_opacity),u_fill_translate:new c.bH(h,e.u_fill_translate),u_image:new c.bC(h,e.u_image),u_texsize:new c.bH(h,e.u_texsize),u_pixel_coord_upper:new c.bH(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bH(h,e.u_pixel_coord_lower),u_scale:new c.bG(h,e.u_scale),u_fade:new c.b5(h,e.u_fade)}),fill:(h,e)=>({u_fill_translate:new c.bH(h,e.u_fill_translate)}),fillPattern:(h,e)=>({u_image:new c.bC(h,e.u_image),u_texsize:new c.bH(h,e.u_texsize),u_pixel_coord_upper:new c.bH(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bH(h,e.u_pixel_coord_lower),u_scale:new c.bG(h,e.u_scale),u_fade:new c.b5(h,e.u_fade),u_fill_translate:new c.bH(h,e.u_fill_translate)}),fillOutline:(h,e)=>({u_world:new c.bH(h,e.u_world),u_fill_translate:new c.bH(h,e.u_fill_translate)}),fillOutlinePattern:(h,e)=>({u_world:new c.bH(h,e.u_world),u_image:new c.bC(h,e.u_image),u_texsize:new c.bH(h,e.u_texsize),u_pixel_coord_upper:new c.bH(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bH(h,e.u_pixel_coord_lower),u_scale:new c.bG(h,e.u_scale),u_fade:new c.b5(h,e.u_fade),u_fill_translate:new c.bH(h,e.u_fill_translate)}),circle:(h,e)=>({u_camera_to_center_distance:new c.b5(h,e.u_camera_to_center_distance),u_scale_with_map:new c.bC(h,e.u_scale_with_map),u_pitch_with_map:new c.bC(h,e.u_pitch_with_map),u_extrude_scale:new c.bH(h,e.u_extrude_scale),u_device_pixel_ratio:new c.b5(h,e.u_device_pixel_ratio),u_globe_extrude_scale:new c.b5(h,e.u_globe_extrude_scale),u_translate:new c.bH(h,e.u_translate)}),collisionBox:(h,e)=>({u_pixel_extrude_scale:new c.bH(h,e.u_pixel_extrude_scale)}),collisionCircle:(h,e)=>({u_viewport_size:new c.bH(h,e.u_viewport_size)}),debug:(h,e)=>({u_color:new c.bF(h,e.u_color),u_overlay:new c.bC(h,e.u_overlay),u_overlay_scale:new c.b5(h,e.u_overlay_scale)}),depth:Zs,clippingMask:Zs,heatmap:(h,e)=>({u_extrude_scale:new c.b5(h,e.u_extrude_scale),u_intensity:new c.b5(h,e.u_intensity),u_globe_extrude_scale:new c.b5(h,e.u_globe_extrude_scale)}),heatmapTexture:(h,e)=>({u_matrix:new c.bD(h,e.u_matrix),u_world:new c.bH(h,e.u_world),u_image:new c.bC(h,e.u_image),u_color_ramp:new c.bC(h,e.u_color_ramp),u_opacity:new c.b5(h,e.u_opacity)}),hillshade:(h,e)=>({u_image:new c.bC(h,e.u_image),u_latrange:new c.bH(h,e.u_latrange),u_light:new c.bH(h,e.u_light),u_shadow:new c.bF(h,e.u_shadow),u_highlight:new c.bF(h,e.u_highlight),u_accent:new c.bF(h,e.u_accent)}),hillshadePrepare:(h,e)=>({u_matrix:new c.bD(h,e.u_matrix),u_image:new c.bC(h,e.u_image),u_dimension:new c.bH(h,e.u_dimension),u_zoom:new c.b5(h,e.u_zoom),u_unpack:new c.bE(h,e.u_unpack)}),line:(h,e)=>({u_translation:new c.bH(h,e.u_translation),u_ratio:new c.b5(h,e.u_ratio),u_device_pixel_ratio:new c.b5(h,e.u_device_pixel_ratio),u_units_to_pixels:new c.bH(h,e.u_units_to_pixels)}),lineGradient:(h,e)=>({u_translation:new c.bH(h,e.u_translation),u_ratio:new c.b5(h,e.u_ratio),u_device_pixel_ratio:new c.b5(h,e.u_device_pixel_ratio),u_units_to_pixels:new c.bH(h,e.u_units_to_pixels),u_image:new c.bC(h,e.u_image),u_image_height:new c.b5(h,e.u_image_height)}),linePattern:(h,e)=>({u_translation:new c.bH(h,e.u_translation),u_texsize:new c.bH(h,e.u_texsize),u_ratio:new c.b5(h,e.u_ratio),u_device_pixel_ratio:new c.b5(h,e.u_device_pixel_ratio),u_image:new c.bC(h,e.u_image),u_units_to_pixels:new c.bH(h,e.u_units_to_pixels),u_scale:new c.bG(h,e.u_scale),u_fade:new c.b5(h,e.u_fade)}),lineSDF:(h,e)=>({u_translation:new c.bH(h,e.u_translation),u_ratio:new c.b5(h,e.u_ratio),u_device_pixel_ratio:new c.b5(h,e.u_device_pixel_ratio),u_units_to_pixels:new c.bH(h,e.u_units_to_pixels),u_patternscale_a:new c.bH(h,e.u_patternscale_a),u_patternscale_b:new c.bH(h,e.u_patternscale_b),u_sdfgamma:new c.b5(h,e.u_sdfgamma),u_image:new c.bC(h,e.u_image),u_tex_y_a:new c.b5(h,e.u_tex_y_a),u_tex_y_b:new c.b5(h,e.u_tex_y_b),u_mix:new c.b5(h,e.u_mix)}),raster:(h,e)=>({u_tl_parent:new c.bH(h,e.u_tl_parent),u_scale_parent:new c.b5(h,e.u_scale_parent),u_buffer_scale:new c.b5(h,e.u_buffer_scale),u_fade_t:new c.b5(h,e.u_fade_t),u_opacity:new c.b5(h,e.u_opacity),u_image0:new c.bC(h,e.u_image0),u_image1:new c.bC(h,e.u_image1),u_brightness_low:new c.b5(h,e.u_brightness_low),u_brightness_high:new c.b5(h,e.u_brightness_high),u_saturation_factor:new c.b5(h,e.u_saturation_factor),u_contrast_factor:new c.b5(h,e.u_contrast_factor),u_spin_weights:new c.bG(h,e.u_spin_weights),u_coords_top:new c.bE(h,e.u_coords_top),u_coords_bottom:new c.bE(h,e.u_coords_bottom)}),symbolIcon:(h,e)=>({u_is_size_zoom_constant:new c.bC(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bC(h,e.u_is_size_feature_constant),u_size_t:new c.b5(h,e.u_size_t),u_size:new c.b5(h,e.u_size),u_camera_to_center_distance:new c.b5(h,e.u_camera_to_center_distance),u_pitch:new c.b5(h,e.u_pitch),u_rotate_symbol:new c.bC(h,e.u_rotate_symbol),u_aspect_ratio:new c.b5(h,e.u_aspect_ratio),u_fade_change:new c.b5(h,e.u_fade_change),u_label_plane_matrix:new c.bD(h,e.u_label_plane_matrix),u_coord_matrix:new c.bD(h,e.u_coord_matrix),u_is_text:new c.bC(h,e.u_is_text),u_pitch_with_map:new c.bC(h,e.u_pitch_with_map),u_is_along_line:new c.bC(h,e.u_is_along_line),u_is_variable_anchor:new c.bC(h,e.u_is_variable_anchor),u_texsize:new c.bH(h,e.u_texsize),u_texture:new c.bC(h,e.u_texture),u_translation:new c.bH(h,e.u_translation),u_pitched_scale:new c.b5(h,e.u_pitched_scale)}),symbolSDF:(h,e)=>({u_is_size_zoom_constant:new c.bC(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bC(h,e.u_is_size_feature_constant),u_size_t:new c.b5(h,e.u_size_t),u_size:new c.b5(h,e.u_size),u_camera_to_center_distance:new c.b5(h,e.u_camera_to_center_distance),u_pitch:new c.b5(h,e.u_pitch),u_rotate_symbol:new c.bC(h,e.u_rotate_symbol),u_aspect_ratio:new c.b5(h,e.u_aspect_ratio),u_fade_change:new c.b5(h,e.u_fade_change),u_label_plane_matrix:new c.bD(h,e.u_label_plane_matrix),u_coord_matrix:new c.bD(h,e.u_coord_matrix),u_is_text:new c.bC(h,e.u_is_text),u_pitch_with_map:new c.bC(h,e.u_pitch_with_map),u_is_along_line:new c.bC(h,e.u_is_along_line),u_is_variable_anchor:new c.bC(h,e.u_is_variable_anchor),u_texsize:new c.bH(h,e.u_texsize),u_texture:new c.bC(h,e.u_texture),u_gamma_scale:new c.b5(h,e.u_gamma_scale),u_device_pixel_ratio:new c.b5(h,e.u_device_pixel_ratio),u_is_halo:new c.bC(h,e.u_is_halo),u_translation:new c.bH(h,e.u_translation),u_pitched_scale:new c.b5(h,e.u_pitched_scale)}),symbolTextAndIcon:(h,e)=>({u_is_size_zoom_constant:new c.bC(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bC(h,e.u_is_size_feature_constant),u_size_t:new c.b5(h,e.u_size_t),u_size:new c.b5(h,e.u_size),u_camera_to_center_distance:new c.b5(h,e.u_camera_to_center_distance),u_pitch:new c.b5(h,e.u_pitch),u_rotate_symbol:new c.bC(h,e.u_rotate_symbol),u_aspect_ratio:new c.b5(h,e.u_aspect_ratio),u_fade_change:new c.b5(h,e.u_fade_change),u_label_plane_matrix:new c.bD(h,e.u_label_plane_matrix),u_coord_matrix:new c.bD(h,e.u_coord_matrix),u_is_text:new c.bC(h,e.u_is_text),u_pitch_with_map:new c.bC(h,e.u_pitch_with_map),u_is_along_line:new c.bC(h,e.u_is_along_line),u_is_variable_anchor:new c.bC(h,e.u_is_variable_anchor),u_texsize:new c.bH(h,e.u_texsize),u_texsize_icon:new c.bH(h,e.u_texsize_icon),u_texture:new c.bC(h,e.u_texture),u_texture_icon:new c.bC(h,e.u_texture_icon),u_gamma_scale:new c.b5(h,e.u_gamma_scale),u_device_pixel_ratio:new c.b5(h,e.u_device_pixel_ratio),u_is_halo:new c.bC(h,e.u_is_halo),u_translation:new c.bH(h,e.u_translation),u_pitched_scale:new c.b5(h,e.u_pitched_scale)}),background:(h,e)=>({u_opacity:new c.b5(h,e.u_opacity),u_color:new c.bF(h,e.u_color)}),backgroundPattern:(h,e)=>({u_opacity:new c.b5(h,e.u_opacity),u_image:new c.bC(h,e.u_image),u_pattern_tl_a:new c.bH(h,e.u_pattern_tl_a),u_pattern_br_a:new c.bH(h,e.u_pattern_br_a),u_pattern_tl_b:new c.bH(h,e.u_pattern_tl_b),u_pattern_br_b:new c.bH(h,e.u_pattern_br_b),u_texsize:new c.bH(h,e.u_texsize),u_mix:new c.b5(h,e.u_mix),u_pattern_size_a:new c.bH(h,e.u_pattern_size_a),u_pattern_size_b:new c.bH(h,e.u_pattern_size_b),u_scale_a:new c.b5(h,e.u_scale_a),u_scale_b:new c.b5(h,e.u_scale_b),u_pixel_coord_upper:new c.bH(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bH(h,e.u_pixel_coord_lower),u_tile_units_to_pixels:new c.b5(h,e.u_tile_units_to_pixels)}),terrain:(h,e)=>({u_texture:new c.bC(h,e.u_texture),u_ele_delta:new c.b5(h,e.u_ele_delta),u_fog_matrix:new c.bD(h,e.u_fog_matrix),u_fog_color:new c.bF(h,e.u_fog_color),u_fog_ground_blend:new c.b5(h,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.b5(h,e.u_fog_ground_blend_opacity),u_horizon_color:new c.bF(h,e.u_horizon_color),u_horizon_fog_blend:new c.b5(h,e.u_horizon_fog_blend),u_is_globe_mode:new c.b5(h,e.u_is_globe_mode)}),terrainDepth:(h,e)=>({u_ele_delta:new c.b5(h,e.u_ele_delta)}),terrainCoords:(h,e)=>({u_texture:new c.bC(h,e.u_texture),u_terrain_coords_id:new c.b5(h,e.u_terrain_coords_id),u_ele_delta:new c.b5(h,e.u_ele_delta)}),projectionErrorMeasurement:(h,e)=>({u_input:new c.b5(h,e.u_input),u_output_expected:new c.b5(h,e.u_output_expected)}),atmosphere:(h,e)=>({u_sun_pos:new c.bG(h,e.u_sun_pos),u_atmosphere_blend:new c.b5(h,e.u_atmosphere_blend),u_globe_position:new c.bG(h,e.u_globe_position),u_globe_radius:new c.b5(h,e.u_globe_radius),u_inv_proj_matrix:new c.bD(h,e.u_inv_proj_matrix)}),sky:(h,e)=>({u_sky_color:new c.bF(h,e.u_sky_color),u_horizon_color:new c.bF(h,e.u_horizon_color),u_horizon:new c.bH(h,e.u_horizon),u_horizon_normal:new c.bH(h,e.u_horizon_normal),u_sky_horizon_blend:new c.b5(h,e.u_sky_horizon_blend),u_sky_blend:new c.b5(h,e.u_sky_blend)})};class oo{constructor(e,i,a){this.context=e;const o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ln={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class lo{constructor(e,i,a,o){this.length=i.length,this.attributes=a,this.itemSize=i.bytesPerElement,this.dynamicDraw=o,this.context=e;const u=e.gl;this.buffer=u.createBuffer(),e.bindVertexBuffer.set(this.buffer),u.bufferData(u.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let a=0;a0&&(v.push({circleArray:K,circleOffset:P,coord:G}),T+=K.length/4,P=T),W&&y.draw(u,_.LINES,Ge.disabled,Qe.disabled,h.colorModeForRenderPass(),Ye.disabled,ml(h.transform),h.style.map.terrain&&h.style.map.terrain.getTerrainData(G),f.getProjectionData({overscaledTileID:G,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,W.layoutVertexBuffer,W.indexBuffer,W.segments,null,h.transform.zoom,null,null,W.collisionVertexBuffer)}if(!o||!v.length)return;const S=h.useProgram("collisionCircle"),A=new c.bM;A.resize(4*T),A._trim();let R=0;for(const U of v)for(let G=0;G=0&&(V[U.associatedIconIndex]={shiftedAnchor:ve,angle:Ee})}else jt(U.numGlyphs,A)}if(y){R.clear();const N=h.icon.placedSymbolArray;for(let U=0;Uh.style.map.terrain.getElevation(me,vi,Tt):null,bt=i.layout.get("text-rotation-alignment")==="map";Ie(de,h,o,ci,lr,U,v,bt,me.toUnwrapped(),V.width,V.height,yi,lt)}const Un=o&&J||Cs,di=G||Un?El:U?ci:h.transform.clipSpaceToPixelsMatrix,ki=ve&&i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Di;Di=ve?de.iconsInText?nr(Ee.kind,xt,X,U,G,Un,h,di,Yi,yi,vt,Kt,oe):ds(Ee.kind,xt,X,U,G,Un,h,di,Yi,yi,o,vt,0,oe):no(Ee.kind,xt,X,U,G,Un,h,di,Yi,yi,o,vt,oe);const xi={program:et,buffers:Se,uniformValues:Di,projectionData:cr,atlasTexture:at,atlasTextureIcon:Lt,atlasInterpolation:nt,atlasInterpolationIcon:ot,isSDF:ve,hasHalo:ki};if(W&&de.canOverlap){K=!0;const lt=Se.segments.get();for(const bt of lt)se.push({segments:new c.aD([bt]),sortKey:bt.sortKey,state:xi,terrainData:st})}else se.push({segments:Se.segments,sortKey:0,state:xi,terrainData:st})}K&&se.sort((me,ye)=>me.sortKey-ye.sortKey);for(const me of se){const ye=me.state;if(A.activeTexture.set(R.TEXTURE0),ye.atlasTexture.bind(ye.atlasInterpolation,R.CLAMP_TO_EDGE),ye.atlasTextureIcon&&(A.activeTexture.set(R.TEXTURE1),ye.atlasTextureIcon&&ye.atlasTextureIcon.bind(ye.atlasInterpolationIcon,R.CLAMP_TO_EDGE)),ye.isSDF){const de=ye.uniformValues;ye.hasHalo&&(de.u_is_halo=1,Al(ye.buffers,me.segments,i,h,ye.program,Q,T,P,de,ye.projectionData,me.terrainData)),de.u_is_halo=0}Al(ye.buffers,me.segments,i,h,ye.program,Q,T,P,ye.uniformValues,ye.projectionData,me.terrainData)}}function Al(h,e,i,a,o,u,f,_,y,v,T){const P=a.context;o.draw(P,P.gl.TRIANGLES,u,f,_,Ye.backCCW,y,T,v,i.id,h.layoutVertexBuffer,h.indexBuffer,e,i.paint,a.transform.zoom,h.programConfigurations.get(i.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function zl(h,e,i,a,o){const u=h.context,f=u.gl,_=Qe.disabled,y=new dt([f.ONE,f.ONE],c.b4.transparent,[!0,!0,!0,!0]),v=e.getBucket(i);if(!v)return;const T=a.key;let P=i.heatmapFbos.get(T);P||(P=sa(u,e.tileSize,e.tileSize),i.heatmapFbos.set(T,P)),u.bindFramebuffer.set(P.framebuffer),u.viewport.set([0,0,e.tileSize,e.tileSize]),u.clear({color:c.b4.transparent});const S=v.programConfigurations.get(i.id),A=h.useProgram("heatmap",S,!o),R=h.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),V=h.style.map.terrain.getTerrainData(a);A.draw(u,f.TRIANGLES,Ge.disabled,_,y,Ye.disabled,Qa(e,h.transform.zoom,i.paint.get("heatmap-intensity"),1),V,R,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,h.transform.zoom,S)}function na(h,e,i,a,o){const u=h.context,f=u.gl,_=h.transform;u.setColorMode(h.colorModeForRenderPass());const y=mo(u,e),v=i.key,T=e.heatmapFbos.get(v);if(!T)return;u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,T.colorAttachment.get()),u.activeTexture.set(f.TEXTURE1),y.bind(f.LINEAR,f.CLAMP_TO_EDGE);const P=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:o,applyGlobeMatrix:!a});h.useProgram("heatmapTexture").draw(u,f.TRIANGLES,Ge.disabled,Qe.disabled,h.colorModeForRenderPass(),Ye.disabled,Ir(h,e,0,1),null,P,e.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments,e.paint,_.zoom),T.destroy(),e.heatmapFbos.delete(v)}function sa(h,e,i){var a,o;const u=h.gl,f=u.createTexture();u.bindTexture(u.TEXTURE_2D,f),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR);const _=(a=h.HALF_FLOAT)!==null&&a!==void 0?a:u.UNSIGNED_BYTE,y=(o=h.RGBA16F)!==null&&o!==void 0?o:u.RGBA;u.texImage2D(u.TEXTURE_2D,0,y,e,i,0,u.RGBA,_,null);const v=h.createFramebuffer(e,i,!1,!1);return v.colorAttachment.set(f),v}function mo(h,e){return e.colorRampTexture||(e.colorRampTexture=new Ct(h,e.colorRamp,h.gl.RGBA)),e.colorRampTexture}function _o(h,e,i,a,o){if(!i||!a||!a.imageAtlas)return;const u=a.imageAtlas.patternPositions;let f=u[i.to.toString()],_=u[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const y=o.getPaintProperty(e);f=u[y],_=u[y]}f&&_&&h.setConstantPatternPositions(f,_)}function ms(h,e,i,a,o,u,f,_){const y=h.context.gl,v="fill-pattern",T=i.paint.get(v),P=T&&T.constantOr(1),S=i.getCrossfadeParameters();let A,R,V,N,U;const G=h.transform,X=i.paint.get("fill-translate"),W=i.paint.get("fill-translate-anchor");f?(R=P&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",A=y.LINES):(R=P?"fillPattern":"fill",A=y.TRIANGLES);const K=T.constantOr(null);for(const Q of a){const J=e.getTile(Q);if(P&&!J.patternsLoaded())continue;const se=J.getBucket(i);if(!se)continue;const oe=se.programConfigurations.get(i.id),me=h.useProgram(R,oe),ye=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Q);P&&(h.context.activeTexture.set(y.TEXTURE0),J.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),oe.updatePaintBuffers(S)),_o(oe,v,K,J,i);const de=G.getProjectionData({overscaledTileID:Q,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Se=c.au(G,J,X,W);if(f){N=se.indexBuffer2,U=se.segments2;const ve=[y.drawingBufferWidth,y.drawingBufferHeight];V=R==="fillOutlinePattern"&&P?fl(h,S,J,ve,Se):zc(ve,Se)}else N=se.indexBuffer,U=se.segments,V=P?Ka(h,S,J,Se):{u_fill_translate:Se};let Pe;if(h.renderPass==="translucent"&&_){const[ve]=h.getStencilConfigForOverlapAndUpdateStencilID(a);Pe=ve[Q.overscaledZ]}else Pe=h.stencilModeForClipping(Q);me.draw(h.context,A,o,Pe,u,Ye.backCCW,V,ye,de,i.id,se.layoutVertexBuffer,N,U,i.paint,h.transform.zoom,oe)}}function _s(h,e,i,a,o,u,f,_){const y=h.context,v=y.gl,T="fill-extrusion-pattern",P=i.paint.get(T),S=P.constantOr(1),A=i.getCrossfadeParameters(),R=i.paint.get("fill-extrusion-opacity"),V=P.constantOr(null),N=h.transform;for(const U of a){const G=e.getTile(U),X=G.getBucket(i);if(!X)continue;const W=h.style.map.terrain&&h.style.map.terrain.getTerrainData(U),K=X.programConfigurations.get(i.id),Q=h.useProgram(S?"fillExtrusionPattern":"fillExtrusion",K);S&&(h.context.activeTexture.set(v.TEXTURE0),G.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),K.updatePaintBuffers(A));const J=N.getProjectionData({overscaledTileID:U,applyGlobeMatrix:!_,applyTerrainMatrix:!0});_o(K,T,V,G,i);const se=c.au(N,G,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),oe=i.paint.get("fill-extrusion-vertical-gradient"),me=S?Ac(h,oe,R,se,U,A,G):on(h,oe,R,se);Q.draw(y,y.gl.TRIANGLES,o,u,f,Ye.backCCW,me,W,J,i.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,i.paint,h.transform.zoom,K,h.style.map.terrain&&X.centroidVertexBuffer)}}function go(h,e,i,a,o,u,f,_,y){var v;const T=h.style.projection,P=h.context,S=h.transform,A=P.gl,R=h.useProgram("hillshade"),V=!h.options.moving;for(const N of a){const U=e.getTile(N),G=U.fbo;if(!G)continue;const X=T.getMeshFromTileID(P,N.canonical,_,!0,"raster"),W=(v=h.style.map.terrain)===null||v===void 0?void 0:v.getTerrainData(N);P.activeTexture.set(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,G.colorAttachment.get());const K=S.getProjectionData({overscaledTileID:N,aligned:V,applyGlobeMatrix:!y,applyTerrainMatrix:!0});R.draw(P,A.TRIANGLES,u,o[N.overscaledZ],f,Ye.backCCW,gl(h,U,i),W,K,i.id,X.vertexBuffer,X.indexBuffer,X.segments)}}const aa=[new c.P(0,0),new c.P(c.X,0),new c.P(c.X,c.X),new c.P(0,c.X)];function gt(h,e,i,a,o,u,f,_,y=!1,v=!1){const T=a[a.length-1].overscaledZ,P=h.context,S=P.gl,A=h.useProgram("raster"),R=h.transform,V=h.style.projection,N=h.colorModeForRenderPass(),U=!h.options.moving;for(const G of a){const X=h.getDepthModeForSublayer(G.overscaledZ-T,i.paint.get("raster-opacity")===1?Ge.ReadWrite:Ge.ReadOnly,S.LESS),W=e.getTile(G);W.registerFadeDuration(i.paint.get("raster-fade-duration"));const K=e.findLoadedParent(G,0),Q=e.findLoadedSibling(G),J=un(W,K||Q||null,e,i,h.transform,h.style.map.terrain);let se,oe;const me=i.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;P.activeTexture.set(S.TEXTURE0),W.texture.bind(me,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),P.activeTexture.set(S.TEXTURE1),K?(K.texture.bind(me,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),se=Math.pow(2,K.tileID.overscaledZ-W.tileID.overscaledZ),oe=[W.tileID.canonical.x*se%1,W.tileID.canonical.y*se%1]):W.texture.bind(me,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),W.texture.useMipmap&&P.extTextureFilterAnisotropic&&h.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,P.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,P.extTextureFilterAnisotropicMax);const ye=h.style.map.terrain&&h.style.map.terrain.getTerrainData(G),de=R.getProjectionData({overscaledTileID:G,aligned:U,applyGlobeMatrix:!v,applyTerrainMatrix:!0}),Se=xl(oe||[0,0],se||1,J,i,_),Pe=V.getMeshFromTileID(P,G.canonical,u,f,"raster");A.draw(P,S.TRIANGLES,X,o?o[G.overscaledZ]:Qe.disabled,N,y?Ye.frontCCW:Ye.backCCW,Se,ye,de,i.id,Pe.vertexBuffer,Pe.indexBuffer,Pe.segments)}}function un(h,e,i,a,o,u){const f=a.paint.get("raster-fade-duration");if(!u&&f>0){const _=Ze.now(),y=(_-h.timeAdded)/f,v=e?(_-e.timeAdded)/f:-1,T=i.getSource(),P=Pr(o,{tileSize:T.tileSize,roundZoom:T.roundZoom}),S=!e||Math.abs(e.tileID.overscaledZ-P)>Math.abs(h.tileID.overscaledZ-P),A=S&&h.refreshedUponExpiration?1:c.ab(S?y:1-v,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),e?{opacity:1,mix:1-A}:{opacity:A,mix:0}}return{opacity:1,mix:0}}const zi=new c.b4(1,0,0,1),yo=new c.b4(0,1,0,1),xo=new c.b4(0,0,1,1),kl=new c.b4(1,0,1,1),kn=new c.b4(0,1,1,1);function Dn(h,e,i,a){gs(h,0,e+i/2,h.transform.width,i,a)}function oa(h,e,i,a){gs(h,e-i/2,0,i,h.transform.height,a)}function gs(h,e,i,a,o,u){const f=h.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*h.pixelRatio,i*h.pixelRatio,a*h.pixelRatio,o*h.pixelRatio),f.clear({color:u}),_.disable(_.SCISSOR_TEST)}function Dl(h,e,i){const a=h.context,o=a.gl,u=h.useProgram("debug"),f=Ge.disabled,_=Qe.disabled,y=h.colorModeForRenderPass(),v="$debug",T=h.style.map.terrain&&h.style.map.terrain.getTerrainData(i);a.activeTexture.set(o.TEXTURE0);const P=e.getTileByID(i.key).latestRawTileData,S=Math.floor((P&&P.byteLength||0)/1024),A=e.getTile(i).tileSize,R=512/Math.min(A,512)*(i.overscaledZ/h.transform.zoom)*.5;let V=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(V+=` => ${i.overscaledZ}`),function(U,G){U.initDebugOverlayCanvas();const X=U.debugOverlayCanvas,W=U.context.gl,K=U.debugOverlayCanvas.getContext("2d");K.clearRect(0,0,X.width,X.height),K.shadowColor="white",K.shadowBlur=2,K.lineWidth=1.5,K.strokeStyle="white",K.textBaseline="top",K.font="bold 36px Open Sans, sans-serif",K.fillText(G,5,5),K.strokeText(G,5,5),U.debugOverlayTexture.update(X),U.debugOverlayTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE)}(h,`${V} ${S}kB`);const N=h.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});u.draw(a,o.TRIANGLES,f,_,dt.alphaBlended,Ye.disabled,Ja(c.b4.transparent,R),null,N,v,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),u.draw(a,o.LINE_STRIP,f,_,y,Ye.disabled,Ja(c.b4.red),T,N,v,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function vo(h,e,i,a){const{isRenderingGlobe:o}=a,u=h.context,f=u.gl,_=h.transform,y=h.colorModeForRenderPass(),v=h.getDepthModeFor3D(),T=h.useProgram("terrain");u.bindFramebuffer.set(null),u.viewport.set([0,0,h.width,h.height]);for(const P of i){const S=e.getTerrainMesh(P.tileID),A=h.renderToTexture.getTexture(P),R=e.getTerrainData(P.tileID);u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,A.texture);const V=e.getMeshFrameDelta(_.zoom),N=_.calculateFogMatrix(P.tileID.toUnwrapped()),U=cs(V,N,h.style.sky,_.pitch,o),G=_.getProjectionData({overscaledTileID:P.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});T.draw(u,f.TRIANGLES,v,Qe.disabled,y,Ye.backCCW,U,R,G,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}}function bo(h,e){if(!e.mesh){const i=new c.aC;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const a=new c.aE;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),e.mesh=new Hi(h.createVertexBuffer(i,Xe.members),h.createIndexBuffer(a),c.aD.simpleSegment(0,0,i.length,a.length))}return e.mesh}class Rl{constructor(e,i){this.context=new Qs(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.aq(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=D.maxUnderzooming+D.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new tn}resize(e,i,a){if(this.width=Math.floor(e*a),this.height=Math.floor(i*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const o of this.style._order)this.style._layers[o].resize()}setup(){const e=this.context,i=new c.aC;i.emplaceBack(0,0),i.emplaceBack(c.X,0),i.emplaceBack(0,c.X),i.emplaceBack(c.X,c.X),this.tileExtentBuffer=e.createVertexBuffer(i,Xe.members),this.tileExtentSegments=c.aD.simpleSegment(0,0,4,2);const a=new c.aC;a.emplaceBack(0,0),a.emplaceBack(c.X,0),a.emplaceBack(0,c.X),a.emplaceBack(c.X,c.X),this.debugBuffer=e.createVertexBuffer(a,Xe.members),this.debugSegments=c.aD.simpleSegment(0,0,4,5);const o=new c.bT;o.emplaceBack(0,0,0,0),o.emplaceBack(c.X,0,c.X,0),o.emplaceBack(0,c.X,0,c.X),o.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,Ec.members),this.rasterBoundsSegments=c.aD.simpleSegment(0,0,4,2);const u=new c.aC;u.emplaceBack(0,0),u.emplaceBack(c.X,0),u.emplaceBack(0,c.X),u.emplaceBack(c.X,c.X),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(u,Xe.members),this.rasterBoundsSegmentsPosOnly=c.aD.simpleSegment(0,0,4,5);const f=new c.aC;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,Xe.members),this.viewportSegments=c.aD.simpleSegment(0,0,4,2);const _=new c.bU;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const y=new c.aE;y.emplaceBack(1,0,2),y.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(y);const v=this.context.gl;this.stencilClearMode=new Qe({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO),this.tileExtentMesh=new Hi(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=c.H();c.bL(a,0,this.width,this.height,0,0,1),c.K(a,a,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const o={mainMatrix:a,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,Ge.disabled,this.stencilClearMode,dt.disabled,Ye.disabled,null,null,o,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,a){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const o=this.context;o.setColorMode(dt.disabled),o.setDepthMode(Ge.disabled);const u={};for(const f of i)u[f.key]=this.nextStencilID++;this._renderTileMasks(u,i,a,!0),this._renderTileMasks(u,i,a,!1),this._tileClippingMaskIDs=u}_renderTileMasks(e,i,a,o){const u=this.context,f=u.gl,_=this.style.projection,y=this.transform,v=this.useProgram("clippingMask");for(const T of i){const P=e[T.key],S=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T),A=_.getMeshFromTileID(this.context,T.canonical,o,!0,"stencil"),R=y.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!0,applyTerrainMatrix:!0});v.draw(u,f.TRIANGLES,Ge.disabled,new Qe({func:f.ALWAYS,mask:0},P,255,f.KEEP,f.KEEP,f.REPLACE),dt.disabled,a?Ye.disabled:Ye.backCCW,null,S,R,"$clipping",A.vertexBuffer,A.indexBuffer,A.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,a=this.style.projection,o=this.transform,u=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=j(o,{tileSize:o.tileSize});for(const y of _){const v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(y),T=a.getMeshFromTileID(this.context,y.canonical,!0,!0,"raster"),P=o.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!0,applyTerrainMatrix:!0});u.draw(e,i.TRIANGLES,f,Qe.disabled,dt.disabled,Ye.backCCW,null,v,P,"$clipping",T.vertexBuffer,T.indexBuffer,T.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new Qe({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new Qe({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,a=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),o=a[a.length-1].overscaledZ,u=a[0].overscaledZ-o+1;if(u>1){this.currentStencilSource=void 0,this.nextStencilID+u>256&&this.clearStencil();const f={};for(let _=0;__.overscaledZ-f.overscaledZ),o=a[a.length-1].overscaledZ,u=a[0].overscaledZ-o+1;if(this.clearStencil(),u>1){const f={},_={};for(let y=0;y0};for(const S in f){const A=f[S];A.used&&A.prepare(this.context),_[S]=A.getVisibleCoordinates(!1),y[S]=_[S].slice().reverse(),v[S]=A.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let S=0;Sthis.useProgram(S)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?c.b4.black:c.b4.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(S,A){const R=S.context,V=R.gl,N=((Q,J,se)=>{const oe=Math.cos(J.rollInRadians),me=Math.sin(J.rollInRadians),ye=wt(J),de=J.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:Q.properties.get("sky-color"),u_horizon_color:Q.properties.get("horizon-color"),u_horizon:[(J.width/2-ye*me)*se,(J.height/2+ye*oe)*se],u_horizon_normal:[-me,oe],u_sky_horizon_blend:Q.properties.get("sky-horizon-blend")*J.height/2*se,u_sky_blend:de}})(A,S.style.map.transform,S.pixelRatio),U=new Ge(V.LEQUAL,Ge.ReadWrite,[0,1]),G=Qe.disabled,X=S.colorModeForRenderPass(),W=S.useProgram("sky"),K=bo(R,A);W.draw(R,V.TRIANGLES,U,G,X,Ye.disabled,N,null,void 0,"sky",K.vertexBuffer,K.indexBuffer,K.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const S=this.style._layers[u[this.currentLayer]],A=f[S.source],R=_[S.source];this._renderTileClippingMasks(S,R,!1),this.renderLayer(this,A,S,R,T)}this.renderPass="translucent";let P=!1;for(this.currentLayer=0;this.currentLayer({u_sun_pos:de,u_atmosphere_blend:Se,u_globe_position:Pe,u_globe_radius:ve,u_inv_proj_matrix:Ee}))(W,Q,[oe[0],oe[1],oe[2]],J,se),ye=bo(V,A);U.draw(V,N.TRIANGLES,G,Qe.disabled,dt.alphaBlended,Ye.disabled,me,null,null,"atmosphere",ye.vertexBuffer,ye.indexBuffer,ye.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const S=function(A,R){let V=null;const N=Object.values(A._layers).flatMap(W=>W.source&&!W.isHidden(R)?[A.sourceCaches[W.source]]:[]),U=N.filter(W=>W.getSource().type==="vector"),G=N.filter(W=>W.getSource().type!=="vector"),X=W=>{(!V||V.getSource().maxzoomX(W)),V||G.forEach(W=>X(W)),V}(this.style,this.transform.zoom);S&&function(A,R,V){for(let N=0;Noe.getElevation(de,vt,at):null;fo(Pe,me,ye,J,se,$e,xt,ve,et,c.au(se,Se,K,Q),de.toUnwrapped(),st)}}}(v,f,y,_,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),T),y.paint.get("icon-opacity").constantOr(1)!==0&&ra(f,_,y,v,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),A,R,S),y.paint.get("text-opacity").constantOr(1)!==0&&ra(f,_,y,v,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),A,R,S),_.map.showCollisionBoxes&&(ea(f,_,y,v,!0),ea(f,_,y,v,!1))}(e,i,a,o,this.style.placement.variableOffsets,u):c.bZ(a)?function(f,_,y,v,T){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:P}=T,S=y.paint.get("circle-opacity"),A=y.paint.get("circle-stroke-width"),R=y.paint.get("circle-stroke-opacity"),V=!y.layout.get("circle-sort-key").isConstant();if(S.constantOr(1)===0&&(A.constantOr(1)===0||R.constantOr(1)===0))return;const N=f.context,U=N.gl,G=f.transform,X=f.getDepthModeForSublayer(0,Ge.ReadOnly),W=Qe.disabled,K=f.colorModeForRenderPass(),Q=[],J=G.getCircleRadiusCorrection();for(let se=0;sese.sortKey-oe.sortKey);for(const se of Q){const{programConfiguration:oe,program:me,layoutVertexBuffer:ye,indexBuffer:de,uniformValues:Se,terrainData:Pe,projectionData:ve}=se.state;me.draw(N,U.TRIANGLES,X,W,K,Ye.backCCW,Se,Pe,ve,y.id,ye,de,se.segments,y.paint,f.transform.zoom,oe)}}(e,i,a,o,u):c.b_(a)?function(f,_,y,v,T){if(y.paint.get("heatmap-opacity")===0)return;const P=f.context,{isRenderingToTexture:S,isRenderingGlobe:A}=T;if(f.style.map.terrain){for(const R of v){const V=_.getTile(R);_.hasRenderableParent(R)||(f.renderPass==="offscreen"?zl(f,V,y,R,A):f.renderPass==="translucent"&&na(f,y,R,S,A))}P.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(R,V,N,U){const G=R.context,X=G.gl,W=R.transform,K=Qe.disabled,Q=new dt([X.ONE,X.ONE],c.b4.transparent,[!0,!0,!0,!0]);(function(J,se,oe){const me=J.gl;J.activeTexture.set(me.TEXTURE1),J.viewport.set([0,0,se.width/4,se.height/4]);let ye=oe.heatmapFbos.get(c.bP);ye?(me.bindTexture(me.TEXTURE_2D,ye.colorAttachment.get()),J.bindFramebuffer.set(ye.framebuffer)):(ye=sa(J,se.width/4,se.height/4),oe.heatmapFbos.set(c.bP,ye))})(G,R,N),G.clear({color:c.b4.transparent});for(let J=0;J0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),a=this.imageManager.getPattern(e.to.toString());return!i||!a}useProgram(e,i,a=!1){this.cache=this.cache||{};const o=!!this.style.map.terrain,u=this.style.projection,f=e+(i?i.cacheKey:"")+`/${a?cl:u.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"");return this.cache[f]||(this.cache[f]=new Vs(this.context,qi[e],i,vl[e],this._showOverdrawInspector,o,a?qi.projectionMercator:u.shaderPreludeCode,a?Bs:u.shaderDefine)),this.cache[f]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ct(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Cr(h,e){let i,a=!1,o=null,u=null;const f=()=>{o=null,a&&(h.apply(u,i),o=setTimeout(f,e),a=!1)};return(..._)=>(a=!0,u=this,i=_,o||f(),o)}class wo{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let a;return i.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(a=o)}),(a&&a[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:a,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const a=i.join("/");let o=a;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${a}`);let u=window.location.hash.replace(o,"");u.startsWith("#&")?u=u.slice(0,1)+u.slice(2):u==="#"&&(u="");let f=window.location.href.replace(/(#.+)?$/,u);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Cr(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),u=Math.pow(10,o),f=Math.round(i.lng*u)/u,_=Math.round(i.lat*u)/u,y=this._map.getBearing(),v=this._map.getPitch();let T="";if(T+=e?`/${f}/${_}/${a}`:`${a}/${_}/${f}`,(y||v)&&(T+="/"+Math.round(10*y)/10),v&&(T+=`/${Math.round(v)}`),this._hashName){const P=this._hashName;let S=!1;const A=window.location.hash.slice(1).split("&").map(R=>{const V=R.split("=")[0];return V===P?(S=!0,`${V}=${T}`):R}).filter(R=>R);return S||A.push(`${P}=${T}`),`#${A.join("&")}`}return`#${T}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new c.N(+e[2],+e[1])}catch{return!1}const i=+e[0],a=+(e[3]||0),o=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&a>=0&&a<=180&&o>=this._map.getMinPitch()&&o<=this._map.getMaxPitch()}}const Rn={linearity:.3,easing:c.c6(0,0,.3,1)},Ll=c.e({deceleration:2500,maxSpeed:1400},Rn),Bl=c.e({deceleration:20,maxSpeed:1400},Rn),Fl=c.e({deceleration:1e3,maxSpeed:360},Rn),Ol=c.e({deceleration:1e3,maxSpeed:90},Rn),jl=c.e({deceleration:1e3,maxSpeed:360},Rn);class la{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ze.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ze.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:u}of this._inertiaBuffer)i.zoom+=u.zoomDelta||0,i.bearing+=u.bearingDelta||0,i.pitch+=u.pitchDelta||0,i.roll+=u.rollDelta||0,u.panDelta&&i.pan._add(u.panDelta),u.around&&(i.around=u.around),u.pinchAround&&(i.pinchAround=u.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(i.pan.mag()){const u=li(i.pan.mag(),a,c.e({},Ll,e||{})),f=i.pan.mult(u.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);o.center=_.easingCenter,o.offset=_.easingOffset,Ln(o,u)}if(i.zoom){const u=li(i.zoom,a,Bl);o.zoom=this._map.transform.zoom+u.amount,Ln(o,u)}if(i.bearing){const u=li(i.bearing,a,Fl);o.bearing=this._map.transform.bearing+c.ab(u.amount,-179,179),Ln(o,u)}if(i.pitch){const u=li(i.pitch,a,Ol);o.pitch=this._map.transform.pitch+u.amount,Ln(o,u)}if(i.roll){const u=li(i.roll,a,jl);o.roll=this._map.transform.roll+c.ab(u.amount,-179,179),Ln(o,u)}if(o.zoom||o.bearing){const u=i.pinchAround===void 0?i.around:i.pinchAround;o.around=u?this._map.unproject(u):this._map.getCenter()}return this.clear(),c.e(o,{noMoveStart:!0})}}function Ln(h,e){(!h.duration||h.durationi.unproject(y)),_=u.reduce((y,v,T,P)=>y.add(v.div(P.length)),new c.P(0,0));super(e,{points:u,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class ji extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,a){super(e,{originalEvent:a}),this._defaultPrevented=!1}}class Fn{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ji(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new At(e.type,this._map,e))}mouseup(e){this._map.fire(new At(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new At(e.type,this._map,e))}dblclick(e){return this._firePreventable(new At(e.type,this._map,e))}mouseover(e){this._map.fire(new At(e.type,this._map,e))}mouseout(e){this._map.fire(new At(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Bn(e.type,this._map,e))}touchmove(e){this._map.fire(new Bn(e.type,this._map,e))}touchend(e){this._map.fire(new Bn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Bn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Uc{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new At(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new At("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new At(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ys{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(c.P.convert(e),this._map.terrain)}}class Nl{constructor(e,i){this._map=e,this._tr=new ys(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(ue.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const a=i;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)u.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ue.remove(this._box),this._box=null),ue.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new c.k(e,{originalEvent:i}))}}function To(h,e){if(h.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${e.length}`);const i={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),a.length===this.numTouches&&(this.centroid=function(o){const u=new c.P(0,0);for(const f of o)u._add(f);return u.div(o.length)}(i),this.touches=To(a,i)))}touchmove(e,i,a){if(this.aborted||!this.centroid)return;const o=To(a,i);for(const u in this.touches){const f=o[u];(!f||f.dist(this.touches[u])>30)&&(this.aborted=!0)}}touchend(e,i,a){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class dn{constructor(e){this.singleTap=new Vl(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,a){this.singleTap.touchstart(e,i,a)}touchmove(e,i,a){this.singleTap.touchmove(e,i,a)}touchend(e,i,a){const o=this.singleTap.touchend(e,i,a);if(o){const u=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(o)<30;if(u&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class sr{constructor(e){this._tr=new ys(e),this._zoomIn=new dn({numTouches:1,numTaps:2}),this._zoomOut=new dn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,a){this._zoomIn.touchstart(e,i,a),this._zoomOut.touchstart(e,i,a)}touchmove(e,i,a){this._zoomIn.touchmove(e,i,a),this._zoomOut.touchmove(e,i,a)}touchend(e,i,a){const o=this._zoomIn.touchend(e,i,a),u=this._zoomOut.touchend(e,i,a),f=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(o)},{originalEvent:e})}):u?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(u)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ae{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const o=Array.isArray(i)?i[0]:i;return!this._moved&&o.dist(a)!0}),i=new Zl){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,a){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?a(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const Er=h=>{h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=e=>{e.preventDefault()}};class Gl{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,a){return this._calculateTransform(e,i,a)}touchmove(e,i,a){if(this._active){if(!this._shouldBePrevented(a.length))return e.preventDefault(),this._calculateTransform(e,i,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,a){this._calculateTransform(e,i,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,a){a.length>0&&(this._active=!0);const o=To(a,i),u=new c.P(0,0),f=new c.P(0,0);let _=0;for(const v in o){const T=o[v],P=this._touches[v];P&&(u._add(T),f._add(T.sub(P)),_++,o[v]=T)}if(this._touches=o,this._shouldBePrevented(_)||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()Math.abs(h.x)}class ua extends We{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,a){super.touchstart(e,i,a),this._currentTouchCount=a.length}_start(e){this._lastPoints=e,ha(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=e[0].sub(this._lastPoints[0]),u=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,u,a.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+u.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,a){if(this._valid!==void 0)return this._valid;const o=e.mag()>=2,u=i.mag()>=2;if(!o&&!u)return;if(!o||!u)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return ha(e)&&ha(i)&&f}}const Xl={panStep:100,bearingStep:15,pitchStep:10};class Wl{constructor(e){this._tr=new ys(e);const i=Xl;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,a=0,o=0,u=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),u=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),u=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:_=>{const y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Kl,zoom:i?Math.round(y.zoom)+i*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-u*this._panStep,-f*this._panStep],center:y.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Kl(h){return h*(2-h)}const Yl=4.000244140625;class Jl{constructor(e,i){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=e,this._tr=new ys(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const a=Ze.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,i!==0&&i%Yl==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=ue.mousePos(this._map.getCanvas(),e),a=this._tr;this._aroundPoint=this._aroundCenter?a.transform.locationToScreenPoint(c.N.convert(a.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Yl?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom!="number"?e.scale:c.aG(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,c.a8(v*y))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,a=this._startZoom,o=this._easing;let u,f=!1;if(this._type==="wheel"&&a&&o){const _=Ze.now()-this._lastWheelEventTime,y=Math.min((_+5)/200,1),v=o(y);u=c.y.number(a,i,v),y<1?this._frameId||(this._frameId=!0):f=!0}else u=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=u,{noInertia:!0,needsRenderFrame:!f,zoomDelta:u-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=c.c8;if(this._prevEase){const a=this._prevEase,o=(Ze.now()-a.start)/a.duration,u=a.easing(o+.01)-a.easing(o),f=.27/Math.sqrt(u*u+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=c.c6(f,_,.25,1)}return this._prevEase={start:Ze.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ar{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class yt{constructor(e){this._tr=new ys(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class da{constructor(){this._tap=new dn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,a){if(!this._swipePoint)if(this._tapTime){const o=i[0],u=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(o)<30;u&&f?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(e,i,a)}touchmove(e,i,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const o=i[0],u=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:u/128}}}else this._tap.touchmove(e,i,a)}touchend(e,i,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const o=this._tap.touchend(e,i,a);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class pa{constructor(e,i,a){this._el=e,this._mousePan=i,this._touchPan=a}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Po{constructor(e,i,a,o){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=a,this._mouseRoll=o}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Mo{constructor(e,i,a,o){this._el=e,this._touchZoom=i,this._touchRotate=a,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class So{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ue.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=i,this._container.appendChild(o);const u=document.createElement("div");u.className="maplibregl-mobile-message",u.textContent=a,this._container.appendChild(u),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ue.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const fa=h=>h.zoom||h.drag||h.roll||h.pitch||h.rotate;class Wi extends c.k{}function jn(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta||h.rollDelta}class Le{constructor(e,i){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,u)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},y={},v={},T=o.touches,P=T?this._getMapTouches(T):void 0,S=P?ue.touchPos(this._map.getCanvas(),P):ue.mousePos(this._map.getCanvas(),o);for(const{handlerName:V,handler:N,allowed:U}of this._handlers){if(!N.isEnabled())continue;let G;this._blockedByActive(v,U,V)?N.reset():N[u||o.type]&&(G=N[u||o.type](o,S,P),this.mergeHandlerResult(_,y,G,V,f),G&&G.needsRenderFrame&&this._triggerRenderFrame()),(G||N.isActive())&&(v[V]=N)}const A={};for(const V in this._previousActiveHandlers)v[V]||(A[V]=f);this._previousActiveHandlers=v,(Object.keys(A).length||jn(_))&&(this._changes.push([_,y,A]),this._triggerRenderFrame()),(Object.keys(v).length||jn(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:R}=_;R&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],R(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new la(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[o,u,f]of this._listeners)ue.addEventListener(o,u,o===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,a]of this._listeners)ue.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(e){const i=this._map,a=i.getCanvasContainer();this._add("mapEvent",new Fn(i,e));const o=i.boxZoom=new Nl(i,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();const u=i.cooperativeGestures=new So(i,e.cooperativeGestures);this._add("cooperativeGestures",u),e.cooperativeGestures&&u.enable();const f=new sr(i),_=new yt(i);i.doubleClickZoom=new ar(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const y=new da;this._add("tapDragZoom",y);const v=i.touchPitch=new ua(i);this._add("touchPitch",v),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const T=()=>i.project(i.getCenter()),P=function({enable:W,clickTolerance:K,aroundCenter:Q=!0,minPixelCenterThreshold:J=100,rotateDegreesPerPixelMoved:se=.8},oe){const me=new pn({checkCorrectEvent:ye=>ue.mouseButton(ye)===0&&ye.ctrlKey||ue.mouseButton(ye)===2&&!ye.ctrlKey});return new Ae({clickTolerance:K,move:(ye,de)=>{const Se=oe();if(Q&&Math.abs(Se.y-ye.y)>J)return{bearingDelta:c.c7(new c.P(ye.x,de.y),de,Se)};let Pe=(de.x-ye.x)*se;return Q&&de.yue.mouseButton(se)===0&&se.ctrlKey||ue.mouseButton(se)===2});return new Ae({clickTolerance:K,move:(se,oe)=>({pitchDelta:(oe.y-se.y)*Q}),moveStateManager:J,enable:W,assignEvents:Er})}(e),A=function({enable:W,clickTolerance:K,rollDegreesPerPixelMoved:Q=.3},J){const se=new pn({checkCorrectEvent:oe=>ue.mouseButton(oe)===2&&oe.ctrlKey});return new Ae({clickTolerance:K,move:(oe,me)=>{const ye=J();let de=(me.x-oe.x)*Q;return me.yue.mouseButton(J)===0&&!J.ctrlKey});return new Ae({clickTolerance:K,move:(J,se)=>({around:se,panDelta:se.sub(J)}),activateOnStart:!0,moveStateManager:Q,enable:W,assignEvents:Er})}(e),V=new Gl(e,i);i.dragPan=new pa(a,R,V),this._add("mousePan",R),this._add("touchPan",V,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const N=new Hl,U=new ca;i.touchZoomRotate=new Mo(a,U,N,y),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const G=i.scrollZoom=new Jl(i,()=>this._triggerRenderFrame());this._add("scrollZoom",G,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const X=i.keyboard=new Wl(i);this._add("keyboard",X),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Uc(i))}_add(e,i,a){this._handlers.push({handlerName:e,handler:i,allowed:a}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!fa(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,a){for(const o in e)if(o!==a&&(!i||i.indexOf(o)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const a of e)this._el.contains(a.target)&&i.push(a);return i}mergeHandlerResult(e,i,a,o,u){if(!a)return;c.e(e,a);const f={handlerName:o,originalEvent:a.originalEvent||u};a.zoomDelta!==void 0&&(i.zoom=f),a.panDelta!==void 0&&(i.drag=f),a.rollDelta!==void 0&&(i.roll=f),a.pitchDelta!==void 0&&(i.pitch=f),a.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},a={};for(const[o,u,f]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new c.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.rollDelta&&(e.rollDelta=(e.rollDelta||0)+o.rollDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),c.e(i,u),c.e(a,f);this._updateMapTransform(e,i,a),this._changes=[]}_updateMapTransform(e,i,a){const o=this._map,u=o._getTransformForUpdate(),f=o.terrain;if(!(jn(e)||f&&this._terrainMovement))return this._fireEvents(i,a,!0);o._stop(!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:T,rollDelta:P,around:S,pinchAround:A}=e;A!==void 0&&(S=A),S=S||o.transform.centerPoint,f&&!u.isPointOnMapSurface(S)&&(S=u.centerPoint);const R={panDelta:_,zoomDelta:y,rollDelta:P,pitchDelta:T,bearingDelta:v,around:S};this._map.cameraHelper.useGlobeControls&&!u.isPointOnMapSurface(S)&&(S=u.centerPoint);const V=S.distSqr(u.centerPoint)<.01?u.center:u.screenPointToLocation(_?S.sub(_):S);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(R,u),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?u.setCenter(u.screenPointToLocation(u.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(R,u,V):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(R,u,V))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(R,u),this._map.cameraHelper.handleMapControlsPan(R,u,V)),o._applyUpdatedTransform(u),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,a,!0)}_fireEvents(e,i,a){const o=fa(this._eventsInProgress),u=fa(e),f={};for(const P in e){const{originalEvent:S}=e[P];this._eventsInProgress[P]||(f[`${P}start`]=S),this._eventsInProgress[P]=e[P]}!o&&u&&this._fireEvent("movestart",u.originalEvent);for(const P in f)this._fireEvent(P,f[P]);u&&this._fireEvent("move",u.originalEvent);for(const P in e){const{originalEvent:S}=e[P];this._fireEvent(P,S)}const _={};let y;for(const P in this._eventsInProgress){const{handlerName:S,originalEvent:A}=this._eventsInProgress[P];this._handlersById[S].isActive()||(delete this._eventsInProgress[P],y=i[S]||A,_[`${P}end`]=y)}for(const P in _)this._fireEvent(P,_[P]);const v=fa(this._eventsInProgress),T=(o||u)&&!v;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const P=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&P.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(P)}if(a&&T){this._updatingCamera=!0;const P=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),S=A=>A!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Wi("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Ne extends c.E{constructor(e,i,a){super(),this._renderFrameCallback=()=>{const o=Math.min((Ze.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=a.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,a){return e=c.P.convert(e).mult(-1),this.panTo(this.transform.center,c.e({offset:e},i),a)}panTo(e,i,a){return this.easeTo(c.e({center:e},i),a)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,a){return this.easeTo(c.e({zoom:e},i),a)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new c.k("movestart",i)).fire(new c.k("move",i)).fire(new c.k("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,a){return this.easeTo(c.e({bearing:e},i),a)}resetNorth(e,i){return this.rotateTo(0,c.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(c.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing()){V.easeFunc(N),this.terrain&&!e.freezeElevation&&this._updateElevation(N),this._applyUpdatedTransform(a),this._fireMoveEvents(i)},N=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,N)},e),this}_prepareEase(e,i,a={}){this._moving=!0,i||a.moving||this.fire(new c.k("movestart",e)),this._zooming&&!a.zooming&&this.fire(new c.k("zoomstart",e)),this._rotating&&!a.rotating&&this.fire(new c.k("rotatestart",e)),this._pitching&&!a.pitching&&this.fire(new c.k("pitchstart",e)),this._rolling&&!a.rolling&&this.fire(new c.k("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(a-(i-(a*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(c.y.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),a=e.getCameraAltitude(),o=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(athis._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&i.push(o=>this.transformCameraUpdate(o)),!i.length)return;const a=e.clone();for(const o of i){const u=a.clone(),{center:f,zoom:_,roll:y,pitch:v,bearing:T,elevation:P}=o(u);f&&u.setCenter(f),P!==void 0&&u.setElevation(P),_!==void 0&&u.setZoom(_),y!==void 0&&u.setRoll(y),v!==void 0&&u.setPitch(v),T!==void 0&&u.setBearing(T),a.apply(u)}this.transform.apply(a)}_fireMoveEvents(e){this.fire(new c.k("move",e)),this._zooming&&this.fire(new c.k("zoom",e)),this._rotating&&this.fire(new c.k("rotate",e)),this._pitching&&this.fire(new c.k("pitch",e)),this._rolling&&this.fire(new c.k("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const a=this._zooming,o=this._rotating,u=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,a&&this.fire(new c.k("zoomend",e)),o&&this.fire(new c.k("rotateend",e)),u&&this.fire(new c.k("pitchend",e)),f&&this.fire(new c.k("rollend",e)),this.fire(new c.k("moveend",e))}flyTo(e,i){if(!e.essential&&Ze.prefersReducedMotion){const de=c.M(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(de,i)}this.stop(),e=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.c8},e);const a=this._getTransformForUpdate(),o=a.bearing,u=a.pitch,f=a.roll,_=a.padding,y="bearing"in e?this._normalizeBearing(e.bearing,o):o,v="pitch"in e?+e.pitch:u,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:a.padding,S=c.P.convert(e.offset);let A=a.centerPoint.add(S);const R=a.screenPointToLocation(A),V=this.cameraHelper.handleFlyTo(a,{bearing:y,pitch:v,roll:T,padding:P,locationAtOffset:R,offsetAsPoint:S,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let N=e.curve;const U=Math.max(a.width,a.height),G=U/V.scaleOfZoom,X=V.pixelPathLength;typeof V.scaleOfMinZoom=="number"&&(N=Math.sqrt(U/V.scaleOfMinZoom/X*2));const W=N*N;function K(de){const Se=(G*G-U*U+(de?-1:1)*W*W*X*X)/(2*(de?G:U)*W*X);return Math.log(Math.sqrt(Se*Se+1)-Se)}function Q(de){return(Math.exp(de)-Math.exp(-de))/2}function J(de){return(Math.exp(de)+Math.exp(-de))/2}const se=K(!1);let oe=function(de){return J(se)/J(se+N*de)},me=function(de){return U*((J(se)*(Q(Se=se+N*de)/J(Se))-Q(se))/W)/X;var Se},ye=(K(!0)-se)/N;if(Math.abs(X)<2e-6||!isFinite(ye)){if(Math.abs(U-G)<1e-6)return this.easeTo(e,i);const de=G0,oe=Se=>Math.exp(de*N*Se)}return e.duration="duration"in e?+e.duration:1e3*ye/("screenSpeed"in e?+e.screenSpeed/N:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==y,this._pitching=v!==u,this._rolling=T!==f,this._padding=!a.isPaddingEqual(P),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(V.targetCenter),this._ease(de=>{const Se=de*ye,Pe=1/oe(Se),ve=me(Se);this._rotating&&a.setBearing(c.y.number(o,y,de)),this._pitching&&a.setPitch(c.y.number(u,v,de)),this._rolling&&a.setRoll(c.y.number(f,T,de)),this._padding&&(a.interpolatePadding(_,P,de),A=a.centerPoint.add(S)),V.easeFunc(de,Pe,ve,A),this.terrain&&!e.freezeElevation&&this._updateElevation(de),this._applyUpdatedTransform(a),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,i)}return e||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(e,i,a){a.animate===!1||a.duration===0?(e(1),i()):(this._easeStart=Ze.now(),this._easeOptions=a,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=c.aI(e,-180,180);const a=Math.abs(e-i);return Math.abs(e-360-i)MapLibre'};class ma{constructor(e=vs){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ue.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ue.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ue.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){ue.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._sanitizedAttributionHTML=void 0}_setElementTitle(e,i){const a=this._map._getUIString(`AttributionControl.${i}`);e.title=a,e.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const i=this._map.style.sourceCaches;for(const o in i){const u=i[o];if(u.used||u.usedForTerrain){const f=u.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,u)=>o.length-u.length),e=e.filter((o,u)=>{for(let f=u+1;f=0)return!1;return!0});const a=e.join(" | ");a!==this._sanitizedAttributionHTML&&(this._sanitizedAttributionHTML=ue.sanitize(a),e.length?(this._innerContainer.innerHTML=this._sanitizedAttributionHTML,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class _a{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const a=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ue.create("div","maplibregl-ctrl");const i=ue.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ue.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ui{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,a=i?this._queue.concat(i):this._queue;for(const o of a)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const a of i)if(!a.cancelled&&(a.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ql=c.aA([{name:"a_pos3d",type:"Int16",components:3}]);class Ki extends c.E{constructor(e){super(),this._lastTilesetChange=Ze.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const a={};for(const o of j(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.terrainRttPosMatrix32f=new Float64Array(16),c.bL(o.terrainRttPosMatrix32f,0,c.X,c.X,0,0,1),this._tiles[o.key]=new Kr(o,this.tileSize),this._lastTilesetChange=Ze.now());for(const o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(e){for(const i in this._tiles){const a=this._tiles[i];(!e||a.tileID.equals(e)||a.tileID.isChildOf(e)||e.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){const i={};for(const a of this._renderableTilesKeys){const o=this._tiles[a].tileID,u=e.clone(),f=c.a$();if(o.canonical.equals(e.canonical))c.bL(f,0,c.X,c.X,0,0,1);else if(o.canonical.isChildOf(e.canonical)){const _=o.canonical.z-e.canonical.z,y=o.canonical.x-(o.canonical.x>>_<<_),v=o.canonical.y-(o.canonical.y>>_<<_),T=c.X>>_;c.bL(f,0,T,T,0,0,1),c.J(f,f,[-y*T,-v*T,0])}else{if(!e.canonical.isChildOf(o.canonical))continue;{const _=e.canonical.z-o.canonical.z,y=e.canonical.x-(e.canonical.x>>_<<_),v=e.canonical.y-(e.canonical.y>>_<<_),T=c.X>>_;c.bL(f,0,c.X,c.X,0,0,1),c.J(f,f,[y*T,v*T,0]),c.K(f,f,[1/2**_,1/2**_,0])}}u.terrainRttPosMatrix32f=new Float32Array(f),i[a]=u}return i}getSourceTile(e,i){const a=this.sourceCache._source;let o=e.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o=a.minzoom&&(!u||!u.dem);)u=this.sourceCache.getTileByID(e.scaledTo(o--).key);return u}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}}class Zc{constructor(e,i,a){this._meshCache={},this.painter=e,this.sourceCache=new Ki(i),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,a,o=c.X){var u;if(!(i>=0&&i=0&&ae.canonical.z&&(e.canonical.z>=o?u=e.canonical.z-o:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>u<>u<>8<<4|u>>8,i[f+3]=0;const a=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),o=new Ct(e,a,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),a=this.painter.context,o=a.gl,u=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(u,_-f-1,1,1,o.RGBA,o.UNSIGNED_BYTE,i),a.bindFramebuffer.set(null);const y=i[0]+(i[2]>>4<<8),v=i[1]+((15&i[2])<<8),T=this.coordsIndex[255-i[3]],P=T&&this.sourceCache.getTileByID(T);if(!P)return null;const S=this._coordsTextureSize,A=(1<0,o=a&&e.canonical.y===0,u=a&&e.canonical.y===(1<e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse)===!1}}const ht={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class kt{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new bs(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(a=>!e._layers[a].isHidden(i)),this._coordsAscending={};for(const a in e.sourceCaches){this._coordsAscending[a]={};const o=e.sourceCaches[a].getVisibleCoordinates();for(const u of o){const f=this.terrain.sourceCache.getTerrainCoords(u);for(const _ in f)this._coordsAscending[a][_]||(this._coordsAscending[a][_]=[]),this._coordsAscending[a][_].push(f[_])}}this._coordsAscendingStr={};for(const a of e._order){const o=e._layers[a],u=o.source;if(ht[o.type]&&!this._coordsAscendingStr[u]){this._coordsAscendingStr[u]={};for(const f in this._coordsAscending[u])this._coordsAscendingStr[u][f]=this._coordsAscending[u][f].map(_=>_.key).sort().join()}}for(const a of this._renderableTiles)for(const o in this._coordsAscendingStr){const u=this._coordsAscendingStr[o][a.tileID.key];u&&u!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const a=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),o=e.type,u=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ht[o]&&(this._prevType&&ht[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(ht[this._prevType]||ht[o]&&f){this._prevType=o;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(this.pool.isFull()&&(vo(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(v),v.rtt[_]){const P=this.pool.getObjectForId(v.rtt[_].id);if(P.stamp===v.rtt[_].stamp){this.pool.useObject(P);continue}}const T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),v.rtt[_]={id:T.id,stamp:T.stamp},u.context.bindFramebuffer.set(T.fbo.framebuffer),u.context.clear({color:c.b4.transparent,stencil:0}),u.currentStencilSource=void 0;for(let P=0;P{this.startMove(u,ue.mousePos(this.element,u)),ue.addEventListener(window,"mousemove",this.mousemove),ue.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=u=>{this.move(u,ue.mousePos(this.element,u))},this.mouseup=u=>{this._rotatePitchHanlder.dragEnd(u),this.offTemp()},this.touchstart=u=>{u.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ue.touchPos(this.element,u.targetTouches)[0],this.startMove(u,this._startPos),ue.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ue.addEventListener(window,"touchend",this.touchend))},this.touchmove=u=>{u.targetTouches.length!==1?this.reset():(this._lastPos=ue.touchPos(this.element,u.targetTouches)[0],this.move(u,this._lastPos))},this.touchend=u=>{u.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const o=new xs;this._rotatePitchHanlder=new Ae({clickTolerance:3,move:(u,f)=>{const _=i.getBoundingClientRect(),y=new c.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:c.c7(new c.P(u.x,f.y),f,y),pitchDelta:a?-.5*(f.y-u.y):void 0}},moveStateManager:o,enable:!0,assignEvents:()=>{}}),this.map=e,ue.addEventListener(i,"mousedown",this.mousedown),ue.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ue.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ue.disableDrag()}move(e,i){const a=this.map,{bearingDelta:o,pitchDelta:u}=this._rotatePitchHanlder.dragMove(e,i)||{};o&&a.setBearing(a.getBearing()+o),u&&a.setPitch(a.getPitch()+u)}off(){const e=this.element;ue.removeEventListener(e,"mousedown",this.mousedown),ue.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ue.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ue.removeEventListener(window,"touchend",this.touchend),ue.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ue.enableDrag(),ue.removeEventListener(window,"mousemove",this.mousemove),ue.removeEventListener(window,"mouseup",this.mouseup),ue.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ue.removeEventListener(window,"touchend",this.touchend)}}let or;function Nn(h,e,i){const a=new c.N(h.lng,h.lat);if(h=new c.N(h.lng,h.lat),e){const o=new c.N(h.lng-360,h.lat),u=new c.N(h.lng+360,h.lat),f=i.locationToScreenPoint(h).distSqr(e);i.locationToScreenPoint(o).distSqr(e)180;){const o=i.locationToScreenPoint(h);if(o.x>=0&&o.y>=0&&o.x<=i.width&&o.y<=i.height)break;h.lng>i.center.lng?h.lng-=360:h.lng+=360}return h.lng!==a.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(h))?h:a}const Ps={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ga(h,e,i){const a=h.classList;for(const o in Ps)a.remove(`maplibregl-${i}-anchor-${o}`);a.add(`maplibregl-${i}-anchor-${e}`)}class Ms extends c.E{constructor(e){if(super(),this._onKeyPress=i=>{const a=i.code,o=i.charCode||i.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=i=>{const a=i.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=i=>{var a;if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Nn(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),ue.setTransform(this._element,`${Ps[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${u}`),Ze.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=c.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=ue.create("div");const i=ue.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${a}px`),i.setAttributeNS(null,"width",`${o}px`),i.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);const u=ue.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"stroke","none"),u.setAttributeNS(null,"stroke-width","1"),u.setAttributeNS(null,"fill","none"),u.setAttributeNS(null,"fill-rule","evenodd");const f=ue.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ue.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const U of y){const G=ue.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",U.rx),G.setAttributeNS(null,"ry",U.ry),_.appendChild(G)}const v=ue.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"fill",this._color);const T=ue.createNS("http://www.w3.org/2000/svg","path");T.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),v.appendChild(T);const P=ue.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"opacity","0.25"),P.setAttributeNS(null,"fill","#000000");const S=ue.createNS("http://www.w3.org/2000/svg","path");S.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),P.appendChild(S);const A=ue.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"transform","translate(6.0, 7.0)"),A.setAttributeNS(null,"fill","#FFFFFF");const R=ue.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(8.0, 8.0)");const V=ue.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");const N=ue.createNS("http://www.w3.org/2000/svg","circle");N.setAttributeNS(null,"fill","#FFFFFF"),N.setAttributeNS(null,"cx","5.5"),N.setAttributeNS(null,"cy","5.5"),N.setAttributeNS(null,"r","5.4999962"),R.appendChild(V),R.appendChild(N),f.appendChild(_),f.appendChild(v),f.appendChild(P),f.appendChild(A),f.appendChild(R),i.appendChild(f),i.setAttributeNS(null,"height",a*this._scale+"px"),i.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(i),this._offset=c.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),ga(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),ue.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=c.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,a;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const P=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==P&&(this._element.style.opacity=P))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const o=this._map,u=o.terrain.depthAtPoint(this._pos),f=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,f)-u<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/o.transform.pixelsPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*_,v=o.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,f+y)-v>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=c.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return e===void 0&&i===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const Eo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Vn=0,fn=!1;const Ao={maxWidth:100,unit:"metric"};function ya(h,e,i){const a=i&&i.maxWidth||100,o=h._container.clientHeight/2,u=h._container.clientWidth/2,f=h.unproject([u-a/2,o]),_=h.unproject([u+a/2,o]),y=Math.round(h.project(_).x-h.project(f).x),v=Math.min(a,y,h._container.clientWidth),T=f.distanceTo(_);if(i&&i.unit==="imperial"){const P=3.2808*T;P>5280?Ar(e,v,P/5280,h._getUIString("ScaleControl.Miles")):Ar(e,v,P,h._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ar(e,v,T/1852,h._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Ar(e,v,T/1e3,h._getUIString("ScaleControl.Kilometers")):Ar(e,v,T,h._getUIString("ScaleControl.Meters"))}function Ar(h,e,i,a){const o=function(u){const f=Math.pow(10,`${Math.floor(u)}`.length-1);let _=u/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(i);h.style.width=e*(o/i)+"px",h.innerHTML=`${o} ${a}`}const zo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},ko=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ss(h){if(h){if(typeof h=="number"){const e=Math.round(Math.abs(h)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,h),"top-left":new c.P(e,e),"top-right":new c.P(-e,e),bottom:new c.P(0,-h),"bottom-left":new c.P(e,-e),"bottom-right":new c.P(-e,-e),left:new c.P(h,0),right:new c.P(-h,0)}}if(h instanceof c.P||Array.isArray(h)){const e=c.P.convert(h);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:c.P.convert(h.center||[0,0]),top:c.P.convert(h.top||[0,0]),"top-left":c.P.convert(h["top-left"]||[0,0]),"top-right":c.P.convert(h["top-right"]||[0,0]),bottom:c.P.convert(h.bottom||[0,0]),"bottom-left":c.P.convert(h["bottom-left"]||[0,0]),"bottom-right":c.P.convert(h["bottom-right"]||[0,0]),left:c.P.convert(h.left||[0,0]),right:c.P.convert(h.right||[0,0])}}return Ss(new c.P(0,0))}const Do=Pi;z.AJAXError=c.cg,z.Event=c.k,z.Evented=c.E,z.LngLat=c.N,z.MercatorCoordinate=c.Y,z.Point=c.P,z.addProtocol=c.ch,z.config=c.a,z.removeProtocol=c.ci,z.AttributionControl=ma,z.BoxZoomHandler=Nl,z.CanvasSource=Hr,z.CooperativeGesturesHandler=So,z.DoubleClickZoomHandler=ar,z.DragPanHandler=pa,z.DragRotateHandler=Po,z.EdgeInsets=ri,z.FullscreenControl=class extends c.E{constructor(h={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ue.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const h=this._fullscreenButton=ue.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ue.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},z.GeoJSONSource=br,z.GeolocateControl=class extends c.E{constructor(h){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new c.N(e.coords.longitude,e.coords.latitude),a=e.coords.accuracy,o=this._map.getBearing(),u=c.e({bearing:o},this.options.fitBoundsOptions),f=zt.fromLngLat(i,a);this._map.fitBounds(f,u,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new c.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&fn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=ue.create("button","maplibregl-ctrl-geolocate",this._container),ue.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ue.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ms({element:this._dotElement}),this._circleElement=ue.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ms({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},Eo,h)}onAdd(h){return this._map=h,this._container=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(e=!1){if(or!==void 0&&!e)return or;if(window.navigator.permissions===void 0)return or=!!window.navigator.geolocation,or;try{or=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{or=!!window.navigator.geolocation}return or})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),ue.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Vn=0,fn=!1}_isOutOfMapMaxBounds(h){const e=this._map.getMaxBounds(),i=h.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const h=this._map.getBounds(),e=h.getSouthEast(),i=h.getNorthEast(),a=e.distanceTo(i),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Vn--,fn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart")),this.fire(new c.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Vn++,Vn>1?(h={maximumAge:6e5,timeout:0},fn=!0):(h=this.options.positionOptions,fn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},z.GlobeControl=class{constructor(){this._toggleProjection=()=>{var h;const e=(h=this._map.getProjection())===null||h===void 0?void 0:h.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var h;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((h=this._map.getProjection())===null||h===void 0?void 0:h.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(h){return this._map=h,this._container=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ue.create("button","maplibregl-ctrl-globe",this._container),ue.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){ue.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},z.Hash=wo,z.ImageSource=mi,z.KeyboardHandler=Wl,z.LngLatBounds=zt,z.LogoControl=_a,z.Map=class extends Ne{constructor(h){var e,i;c.cd.mark(c.ce.create);const a=Object.assign(Object.assign(Object.assign({},Ts),h),{canvasContextAttributes:Object.assign(Object.assign({},Ts.canvasContextAttributes),h.canvasContextAttributes)});if(a.minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new ir,u=new Fs;if(a.minZoom!==void 0&&o.setMinZoom(a.minZoom),a.maxZoom!==void 0&&o.setMaxZoom(a.maxZoom),a.minPitch!==void 0&&o.setMinPitch(a.minPitch),a.maxPitch!==void 0&&o.setMaxPitch(a.maxPitch),a.renderWorldCopies!==void 0&&o.setRenderWorldCopies(a.renderWorldCopies),super(o,u,{bearingSnap:a.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ui,this._controls=[],this._mapId=c.a1(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},a.canvasContextAttributes),this._trackResize=a.trackResize===!0,this._bearingSnap=a.bearingSnap,this._centerClampedToGround=a.centerClampedToGround,this._refreshExpiredTiles=a.refreshExpiredTiles===!0,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions===!0,this._collectResourceTiming=a.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ec),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this.transformCameraUpdate=a.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=a.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=oi.addThrottleControl(()=>this.isMoving()),this._requestManager=new gr(a.transformRequest),typeof a.container=="string"){if(this._container=document.getElementById(a.container),!this._container)throw new Error(`Container '${a.container}' not found.`)}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const y=Cr(v=>{this._trackResize&&!this._removed&&(this.resize(v),this.redraw())},50);this._resizeObserver=new ResizeObserver(v=>{_?y(v):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Le(this,a),this._hash=a.hash&&new wo(typeof a.hash=="string"&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,c.e({},a.fitBoundsOptions,{duration:0}))));const f=typeof a.style=="string"||((i=(e=a.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new ma(typeof a.attributionControl=="boolean"?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new _a,a.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=c.M(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new c.k(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new c.k(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new c.k("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(h,e){if(e===void 0&&(e=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=h.onAdd(this);this._controls.push(h);const a=this._controlPositions[e];return e.indexOf("bottom")!==-1?a.insertBefore(i,a.firstChild):a.appendChild(i),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(h);return e>-1&&this._controls.splice(e,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,e,i,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,e,i,a)}resize(h,e=!0){const[i,a]=this._containerDimensions(),o=this._getClampedPixelRatio(i,a);if(this._resizeCanvas(i,a,o),this.painter.resize(i,a,o),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,a);this._resizeCanvas(i,a,_),this.painter.resize(i,a,_)}this._resizeTransform(e);const u=!this._moving;return u&&(this.stop(),this.fire(new c.k("movestart",h)).fire(new c.k("move",h))),this.fire(new c.k("resize",h)),u&&this.fire(new c.k("moveend",h)),this}_resizeTransform(h=!0){var e;const[i,a]=this._containerDimensions();this.transform.resize(i,a,h),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,a,h)}_getClampedPixelRatio(h,e){const{0:i,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),u=h*o,f=e*o;return Math.min(u>i?i/u:1,f>a?a/f:1)*o}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(zt.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.setMinZoom(h),this._update(),this.getZoom()=this.transform.minZoom)return this.transform.setMaxZoom(h),this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.setMinPitch(h),this._update(),this.getPitch()180)throw new Error("maxPitch must be less than or equal to 180");if(h>=this.transform.minPitch)return this.transform.setMaxPitch(h),this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.setRenderWorldCopies(h),this._update()}project(h){return this.transform.locationToScreenPoint(c.N.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.screenPointToLocation(c.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,e,i){if(h==="mouseenter"||h==="mouseover"){let a=!1;return{layers:e,listener:i,delegates:{mousemove:u=>{const f=e.filter(y=>this.getLayer(y)),_=f.length!==0?this.queryRenderedFeatures(u.point,{layers:f}):[];_.length?a||(a=!0,i.call(this,new At(h,this,u.originalEvent,{features:_}))):a=!1},mouseout:()=>{a=!1}}}}if(h==="mouseleave"||h==="mouseout"){let a=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(y=>this.getLayer(y));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?a=!0:a&&(a=!1,i.call(this,new At(h,this,f.originalEvent)))},mouseout:f=>{a&&(a=!1,i.call(this,new At(h,this,f.originalEvent)))}}}}{const a=o=>{const u=e.filter(_=>this.getLayer(_)),f=u.length!==0?this.queryRenderedFeatures(o.point,{layers:u}):[];f.length&&(o.features=f,i.call(this,o),delete o.features)};return{layers:e,listener:i,delegates:{[h]:a}}}}_saveDelegatedListener(h,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(e)}_removeDelegatedListener(h,e,i){if(!this._delegatedListeners||!this._delegatedListeners[h])return;const a=this._delegatedListeners[h];for(let o=0;oe.includes(f))){for(const f in u.delegates)this.off(f,u.delegates[f]);return void a.splice(o,1)}}}on(h,e,i){if(i===void 0)return super.on(h,e);const a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(h,a,i);this._saveDelegatedListener(h,o);for(const u in o.delegates)this.on(u,o.delegates[u]);return{unsubscribe:()=>{this._removeDelegatedListener(h,a,i)}}}once(h,e,i){if(i===void 0)return super.once(h,e);const a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(h,a,i);for(const u in o.delegates){const f=o.delegates[u];o.delegates[u]=(..._)=>{this._removeDelegatedListener(h,a,i),f(..._)}}this._saveDelegatedListener(h,o);for(const u in o.delegates)this.once(u,o.delegates[u]);return this}off(h,e,i){return i===void 0?super.off(h,e):(this._removeDelegatedListener(h,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(h,e){if(!this.style)return[];let i;const a=h instanceof c.P||Array.isArray(h),o=a?h:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(a?{}:h)||{},o instanceof c.P||typeof o[0]=="number")i=[c.P.convert(o)];else{const u=c.P.convert(o[0]),f=c.P.convert(o[1]);i=[u,new c.P(f.x,u.y),f,new c.P(u.x,f.y),u]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(h,e){return this.style.querySourceFeatures(h,e)}setStyle(h,e){return(e=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(h,e))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){const e=this._locale[h];if(e==null)throw new Error(`Missing UI string '${h}'`);return e}_updateStyle(h,e){var i,a;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(h,e));const o=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new Ei(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,e,o):this.style.loadJSON(h,e,o),this):((a=(i=this.style)===null||i===void 0?void 0:i.projection)===null||a===void 0||a.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ei(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,e){if(typeof h=="string"){const i=this._requestManager.transformRequest(h,"Style");c.h(i,new AbortController).then(a=>{this._updateDiff(a.data,e)}).catch(a=>{a&&this.fire(new c.j(a))})}else typeof h=="object"&&this._updateDiff(h,e)}_updateDiff(h,e){try{this.style.setState(h,e)&&this._update(!0)}catch(i){c.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(h,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(h,e){return this._lazyInitEmptyStyle(),this.style.addSource(h,e),this._update(!0)}isSourceLoaded(h){const e=this.style&&this.style.sourceCaches[h];if(e!==void 0)return e.loaded();this.fire(new c.j(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){const e=this.style.sourceCaches[h.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const a=this.style._layers[i];a.type==="hillshade"&&a.source===h.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Zc(this.painter,e,h),this.painter.renderToTexture=new kt(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==h.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new c.k("terrain",{terrain:h})),this}getTerrain(){var h,e;return(e=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const h=this.style&&this.style.sourceCaches;for(const e in h){const i=h[e]._tiles;for(const a in i){const o=i[a];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,e,i={}){const{pixelRatio:a=1,sdf:o=!1,stretchX:u,stretchY:f,content:_,textFitWidth:y,textFitHeight:v}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||c.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:T,height:P,data:S}=e,A=e;return this.style.addImage(h,{data:new c.R({width:T,height:P},new Uint8Array(S)),pixelRatio:a,stretchX:u,stretchY:f,content:_,textFitWidth:y,textFitHeight:v,sdf:o,version:0,userImage:A}),A.onAdd&&A.onAdd(this,h),this}}{const{width:T,height:P,data:S}=Ze.getImageData(e);this.style.addImage(h,{data:new c.R({width:T,height:P},S),pixelRatio:a,stretchX:u,stretchY:f,content:_,textFitWidth:y,textFitHeight:v,sdf:o,version:0})}}updateImage(h,e){const i=this.style.getImage(h);if(!i)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=e instanceof HTMLImageElement||c.b(e)?Ze.getImageData(e):e,{width:o,height:u,data:f}=a;if(o===void 0||u===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==i.data.width||u!==i.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||c.b(e));return i.data.replace(f,_),this.style.updateImage(h,i),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h){return oi.getImage(this._requestManager.transformRequest(h,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(h,e){return this._lazyInitEmptyStyle(),this.style.addLayer(h,e),this._update(!0)}moveLayer(h,e){return this.style.moveLayer(h,e),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(h,e,i){return this.style.setLayerZoomRange(h,e,i),this._update(!0)}setFilter(h,e,i={}){return this.style.setFilter(h,e,i),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,e,i,a={}){return this.style.setPaintProperty(h,e,i,a),this._update(!0)}getPaintProperty(h,e){return this.style.getPaintProperty(h,e)}setLayoutProperty(h,e,i,a={}){return this.style.setLayoutProperty(h,e,i,a),this._update(!0)}getLayoutProperty(h,e){return this.style.getLayoutProperty(h,e)}setGlyphs(h,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,e,i,a=>{a||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,e,i=>{i||this._update(!0)}),this}setLight(h,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(h,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(h,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(h,e){return this.style.setFeatureState(h,e),this._update()}removeFeatureState(h,e){return this.style.removeFeatureState(h,e),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,e=0;return this._container&&(h=this._container.clientWidth||400,e=this._container.clientHeight||300),[h,e]}_setupContainer(){const h=this._container;h.classList.add("maplibregl-map");const e=this._canvasContainer=ue.create("div","maplibregl-canvas-container",h);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ue.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),a=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],a);const o=this._controlContainer=ue.create("div","maplibregl-control-container",h),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{u[f]=ue.create("div",`maplibregl-ctrl-${f} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(h,e,i){this._canvas.width=Math.floor(i*h),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const h=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{e={requestedAttributes:h},a&&(e.statusMessage=a.statusMessage,e.type=a.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,h):this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h),!i){const a="Failed to initialize WebGL";throw e?(e.message=a,new Error(JSON.stringify(e))):new Error(a)}this.painter=new Rl(i,this.transform),Oe.testSupport(i)}migrateProjection(h,e){super.migrateProjection(h,e),this.painter.transform=h,this.fire(new c.k("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){var e,i,a,o,u;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let y=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const P=this.transform.zoom,S=Ze.now();this.style.zoomHistory.update(P,S);const A=new c.z(P,{now:S,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),R=A.crossFadingFactor();R===1&&R===this._crossFadingFactor||(y=!0,this._crossFadingFactor=R),this.style.update(A)}const v=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(a=this.style.projection)===null||a===void 0||a.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((o=this.style.projection)===null||o===void 0?void 0:o.transitionState,(u=this.style.projection)===null||u===void 0?void 0:u.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||v)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,v),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.cd.mark(c.ce.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||y)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const T=this._sourcesDirty||this._styleDirty||this._placementDirty;return T||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||T||(this._fullyLoaded=!0,c.cd.mark(c.ce.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),oi.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ue.remove(this._canvasContainer),ue.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),c.cd.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ze.frame(this._frameRequest,h=>{c.cd.frame(h),this._frameRequest=null;try{this._render(h)}catch(e){if(!c.cf(e)&&!function(i){return i.message===Ys}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return ws}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(h){return this._lazyInitEmptyStyle(),this.style.setProjection(h),this._update(!0)}},z.MapMouseEvent=At,z.MapTouchEvent=Bn,z.MapWheelEvent=ji,z.Marker=Ms,z.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),a=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const a=this._map._getUIString(`NavigationControl.${i}`);e.title=a,e.setAttribute("aria-label",a)},this.options=c.e({},Io,h),this._container=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),ue.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),ue.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=ue.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Co(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ue.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,e){const i=ue.create("button",h,this._container);return i.type="button",i.addEventListener("click",e),i}},z.Popup=class extends c.E{constructor(h){super(),this.remove=()=>(this._content&&ue.remove(this._content),this._container&&(ue.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var i;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ue.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ue.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Nn(this._lngLat,this._flatPos,this._map.transform):(i=this._lngLat)===null||i===void 0?void 0:i.wrap(),this._trackPointer&&!e)return;const a=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor;const u=Ss(this.options.offset);if(!o){const _=this._container.offsetWidth,y=this._container.offsetHeight;let v;v=a.y+u.bottom.ythis._map.transform.height-y?["bottom"]:[],a.x<_/2?v.push("left"):a.x>this._map.transform.width-_/2&&v.push("right"),o=v.length===0?"bottom":v.join("-")}let f=a.add(u[o]);this.options.subpixelPositioning||(f=f.round()),ue.setTransform(this._container,`${Ps[o]} translate(${f.x}px,${f.y}px)`),ga(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(zo),h)}addTo(h){return this._map&&this.remove(),this._map=h,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=c.N.convert(h),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){const e=document.createDocumentFragment(),i=document.createElement("body");let a;for(i.innerHTML=h;a=i.firstChild,a;)e.appendChild(a);return this.setDOMContent(e)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ue.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){return this._container&&this._container.classList.add(h),this}removeClassName(h){return this._container&&this._container.classList.remove(h),this}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}setSubpixelPositioning(h){this.options.subpixelPositioning=h}_createCloseButton(){this.options.closeButton&&(this._closeButton=ue.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const h=this._container.querySelector(ko);h&&h.focus()}},z.RasterDEMTileSource=vr,z.RasterTileSource=Bi,z.ScaleControl=class{constructor(h){this._onMove=()=>{ya(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ya(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ao),h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=ue.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ue.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},z.ScrollZoomHandler=Jl,z.Style=Ei,z.TerrainControl=class{constructor(h){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=h}onAdd(h){return this._map=h,this._container=ue.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ue.create("button","maplibregl-ctrl-terrain",this._container),ue.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){ue.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},z.TwoFingersTouchPitchHandler=ua,z.TwoFingersTouchRotateHandler=Hl,z.TwoFingersTouchZoomHandler=ca,z.TwoFingersTouchZoomRotateHandler=Mo,z.VectorTileSource=$r,z.VideoSource=qr,z.addSourceType=(h,e)=>c._(void 0,void 0,void 0,function*(){if(Jn(h))throw new Error(`A source type called "${h}" already exists.`);((i,a)=>{wr[i]=a})(h,e)}),z.clearPrewarmedResources=function(){const h=Ii;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(xn),Ii=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},z.createTileMesh=as,z.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},z.getRTLTextPluginStatus=function(){return tr().getRTLTextPluginStatus()},z.getVersion=function(){return Do},z.getWorkerCount=function(){return $i.workerCount},z.getWorkerUrl=function(){return c.a.WORKER_URL},z.importScriptInWorkers=function(h){return Zr().broadcast("IS",h)},z.prewarm=function(){Vr().acquire(xn)},z.setMaxParallelImageRequests=function(h){c.a.MAX_PARALLEL_IMAGE_REQUESTS=h},z.setRTLTextPlugin=function(h,e){return tr().setRTLTextPlugin(h,e)},z.setWorkerCount=function(h){$i.workerCount=h},z.setWorkerUrl=function(h){c.a.WORKER_URL=h}});var Ra=Rr;return Ra})}(wc)),wc.exports}var _d=ef();const tf=Yp(_d),nf=Jp({__proto__:null,default:tf},[_d]);export{nf as m}; diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..55dea8d --- /dev/null +++ b/dist/index.html @@ -0,0 +1,14 @@ + + + + + + + Vite + React + TS + + + + +
+ + diff --git a/src/App.tsx b/src/App.tsx index 115bb82..c5bdcd5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -22,6 +22,10 @@ function App() { queryFn: () => load(`./${day}.csv.gz`, CSVLoader, { csv: {} }), }) + if (error) { + console.log(error) + } + const layers = [ new ScatterplotLayer({ id: 'deckgl-circle', diff --git a/tsconfig.app.tsbuildinfo b/tsconfig.app.tsbuildinfo new file mode 100644 index 0000000..5220242 --- /dev/null +++ b/tsconfig.app.tsbuildinfo @@ -0,0 +1 @@ +{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts"],"version":"5.7.3"} \ No newline at end of file