@arenarium/maps 1.0.185 → 1.0.187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var xs=Object.defineProperty;var Jr=r=>{throw TypeError(r)};var bs=(r,e,t)=>e in r?xs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var h=(r,e,t)=>bs(r,typeof e!="symbol"?e+"":e,t),Jt=(r,e,t)=>e.has(r)||Jr("Cannot "+t);var k=(r,e,t)=>(Jt(r,e,"read from private field"),t?t.call(r):e.get(r)),P=(r,e,t)=>e.has(r)?Jr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Z=(r,e,t,n)=>(Jt(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),lt=(r,e,t)=>(Jt(r,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./states-D6BEdwDG.cjs"),Kr=!1;var An=Array.isArray,Es=Array.prototype.indexOf,Ss=Array.from,nr=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Cs=Object.prototype,Ts=Array.prototype,As=Object.getPrototypeOf,Qr=Object.isExtensible;function Ms(r){for(var e=0;e<r.length;e++)r[e]()}function Os(){var r,e,t=new Promise((n,s)=>{r=n,e=s});return{promise:t,resolve:r,reject:e}}const G=2,Mr=4,Mn=8,Wt=16,Ce=32,nt=64,On=128,X=256,Rt=512,z=1024,te=2048,Pe=4096,Ge=8192,st=16384,Or=32768,Ns=65536,en=1<<17,Rs=1<<18,Nr=1<<19,Nn=1<<20,sr=1<<21,Rr=1<<22,Oe=1<<23,Mt=Symbol("$state"),Ir=new class extends Error{constructor(){super(...arguments);h(this,"name","StaleReactionError");h(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Is(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function Ls(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ds(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ps(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Zs(r){throw new Error("https://svelte.dev/e/effect_orphan")}function js(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Fs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zs(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Vs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}const Bs=2,j=Symbol();function Rn(r){return r===this.v}let Us=!1,se=null;function It(r){se=r}function Lr(r,e=!1,t){se={p:se,c:null,e:null,s:r,x:null,l:null}}function Dr(r){var e=se,t=e.e;if(t!==null){e.e=null;for(var n of t)Yn(n)}return r!==void 0&&(e.x=r),se=e.p,r??{}}function In(){return!0}const $s=new WeakMap;function qs(r){var e=M;if(e===null)return S.f|=Oe,r;if((e.f&Or)===0){if((e.f&On)===0)throw!e.parent&&r instanceof Error&&Ln(r),r;e.b.error(r)}else Pr(r,e)}function Pr(r,e){for(;e!==null;){if((e.f&On)!==0)try{e.b.error(r);return}catch{}e=e.parent}throw r instanceof Error&&Ln(r),r}function Ln(r){const e=$s.get(r);e&&(nr(r,"message",{value:e.message}),nr(r,"stack",{value:e.stack}))}let Lt=[];function Ws(){var r=Lt;Lt=[],Ms(r)}function Ys(r){Lt.length===0&&queueMicrotask(Ws),Lt.push(r)}function Hs(){for(var r=M.b;r!==null&&!r.has_pending_snippet();)r=r.parent;return r===null&&Is(),r}function Xs(r){var e=G|te,t=S!==null&&(S.f&G)!==0?S:null;return M===null||t!==null&&(t.f&X)!==0?e|=X:M.f|=Nr,{ctx:se,deps:null,effects:null,equals:Rn,f:e,fn:r,reactions:null,rv:0,v:j,wv:0,parent:t??M,ac:null}}function Gs(r,e){let t=M;t===null&&Ls();var n=t.b,s=void 0,a=zn(j),i=null,o=!S;return la(()=>{try{var l=r()}catch(v){l=Promise.reject(v)}var u=()=>l;s=(i==null?void 0:i.then(u,u))??Promise.resolve(l),i=s;var d=ne,f=n.pending;o&&(n.update_pending_count(1),f||d.increment());const p=(v,x=void 0)=>{i=null,f||d.activate(),x?x!==Ir&&(a.f|=Oe,or(a,x)):((a.f&Oe)!==0&&(a.f^=Oe),or(a,v)),o&&(n.update_pending_count(-1),f||d.decrement()),Zn()};if(s.then(p,v=>p(null,v||"unknown")),d)return()=>{queueMicrotask(()=>d.neuter())}}),new Promise(l=>{function u(d){function f(){d===s?l(a):u(s)}d.then(f,f)}u(s)})}function Dn(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Le(e[t])}}function Js(r){for(var e=r.parent;e!==null;){if((e.f&G)===0)return e;e=e.parent}return null}function Zr(r){var e,t=M;Je(Js(r));try{Dn(r),e=rs(r)}finally{Je(t)}return e}function Pn(r){var e=Zr(r);if(r.equals(e)||(r.v=e,r.wv=es()),!at)if(ye!==null)ye.set(r,r.v);else{var t=(we||(r.f&X)!==0)&&r.deps!==null?Pe:z;U(r,t)}}function Ks(r,e,t){const n=Xs;if(e.length===0){t(r.map(n));return}var s=ne,a=M,i=Qs(),o=Hs();Promise.all(e.map(l=>Gs(l))).then(l=>{s==null||s.activate(),i();try{t([...r.map(n),...l])}catch(u){(a.f&st)===0&&Pr(u,a)}s==null||s.deactivate(),Zn()}).catch(l=>{o.error(l)})}function Qs(){var r=M,e=S,t=se;return function(){Je(r),be(e),It(t)}}function Zn(){Je(null),be(null),It(null)}const Tt=new Set;let ne=null,ye=null;let ut=[],Dt=null,ar=!1;var wt,We,Ye,ge,kt,xt,Te,He,_e,ce,Ae,pe,jn,Fn,ir;const Ur=class Ur{constructor(){P(this,pe);P(this,wt,new Map);P(this,We,new Map);P(this,Ye,new Set);P(this,ge,0);P(this,kt,null);P(this,xt,!1);P(this,Te,[]);P(this,He,[]);P(this,_e,[]);P(this,ce,[]);P(this,Ae,[]);h(this,"skipped_effects",new Set)}capture(e,t){k(this,We).has(e)||k(this,We).set(e,t),k(this,wt).set(e,e.v)}activate(){ne=this}deactivate(){ne=null}neuter(){Z(this,xt,!0)}flush(){ut.length>0?this.flush_effects():lt(this,pe,ir).call(this),ne===this&&(k(this,ge)===0&&Tt.delete(this),ne=null)}flush_effects(){var e=$e;ar=!0;try{var t=0;for(nn(!0);ut.length>0;)t++>1e3&&ea(),lt(this,pe,jn).call(this,ut),Re.clear()}finally{ar=!1,nn(e),Dt=null}}increment(){Z(this,ge,k(this,ge)+1)}decrement(){if(Z(this,ge,k(this,ge)-1),k(this,ge)===0){for(const e of k(this,_e))U(e,te),Ne(e);for(const e of k(this,ce))U(e,te),Ne(e);for(const e of k(this,Ae))U(e,te),Ne(e);Z(this,_e,[]),Z(this,ce,[]),this.flush()}}add_callback(e){k(this,Ye).add(e)}settled(){return(k(this,kt)??Z(this,kt,Os())).promise}static ensure(){if(ne===null){const e=ne=new Ur;Tt.add(ne),queueMicrotask(()=>{ne===e&&e.flush()})}return ne}};wt=new WeakMap,We=new WeakMap,Ye=new WeakMap,ge=new WeakMap,kt=new WeakMap,xt=new WeakMap,Te=new WeakMap,He=new WeakMap,_e=new WeakMap,ce=new WeakMap,Ae=new WeakMap,pe=new WeakSet,jn=function(e){var a;ut=[];var t=null;if(Tt.size>1){t=new Map,ye=new Map;for(const[i,o]of k(this,wt))t.set(i,{v:i.v,wv:i.wv}),i.v=o;for(const i of Tt)if(i!==this)for(const[o,l]of k(i,We))t.has(o)||(t.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(const i of e)lt(this,pe,Fn).call(this,i);if(k(this,Te).length===0&&k(this,ge)===0){var n=k(this,_e),s=k(this,ce);Z(this,_e,[]),Z(this,ce,[]),Z(this,Ae,[]),lt(this,pe,ir).call(this),tn(n),tn(s),(a=k(this,kt))==null||a.resolve()}else{for(const i of k(this,_e))U(i,z);for(const i of k(this,ce))U(i,z);for(const i of k(this,Ae))U(i,z)}if(t){for(const[i,{v:o,wv:l}]of t)i.wv<=l&&(i.v=o);ye=null}for(const i of k(this,Te))ht(i);for(const i of k(this,He))ht(i);Z(this,Te,[]),Z(this,He,[])},Fn=function(e){var d;e.f^=z;for(var t=e.first;t!==null;){var n=t.f,s=(n&(Ce|nt))!==0,a=s&&(n&z)!==0,i=a||(n&Ge)!==0||this.skipped_effects.has(t);if(!i&&t.fn!==null){if(s)t.f^=z;else if((n&Mr)!==0)k(this,ce).push(t);else if(Yt(t))if((n&Rr)!==0){var o=(d=t.b)!=null&&d.pending?k(this,He):k(this,Te);o.push(t)}else(t.f&Wt)!==0&&k(this,Ae).push(t),ht(t);var l=t.first;if(l!==null){t=l;continue}}var u=t.parent;for(t=t.next;t===null&&u!==null;)t=u.next,u=u.parent}},ir=function(){if(!k(this,xt))for(const e of k(this,Ye))e();k(this,Ye).clear()};let Pt=Ur;function ea(){try{js()}catch(r){if(Dt!==null)Pr(r,Dt);else throw r}}function tn(r){var e=r.length;if(e!==0){for(var t=0;t<e;t++){var n=r[t];if((n.f&(st|Ge))===0&&Yt(n)){var s=Zt;if(ht(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Kn(n):n.fn=null),Zt>s&&(n.f&Nn)!==0)break}}for(;t<e;t+=1)Ne(r[t])}}function Ne(r){for(var e=Dt=r;e.parent!==null;){e=e.parent;var t=e.f;if(ar&&e===M&&(t&Wt)!==0)return;if((t&(nt|Ce))!==0){if((t&z)===0)return;e.f^=z}}ut.push(e)}const Re=new Map;function zn(r,e){var t={f:0,v:r,reactions:null,equals:Rn,rv:0,wv:0};return t}function q(r,e){const t=zn(r);return pa(t),t}function F(r,e,t=!1){S!==null&&(!ae||(S.f&en)!==0)&&In()&&(S.f&(G|Wt|Rr|en))!==0&&!($!=null&&$.includes(r))&&Vs();let n=t?dt(e):e;return or(r,n)}function or(r,e){if(!r.equals(e)){var t=r.v;at?Re.set(r,e):Re.set(r,t),r.v=e,Pt.ensure().capture(r,t),(r.f&G)!==0&&((r.f&te)!==0&&Zr(r),U(r,(r.f&X)===0?z:Pe)),r.wv=es(),Vn(r,te),M!==null&&(M.f&z)!==0&&(M.f&(Ce|nt))===0&&(ee===null?ma([r]):ee.push(r))}return e}function Kt(r){F(r,r.v+1)}function Vn(r,e){var t=r.reactions;if(t!==null)for(var n=t.length,s=0;s<n;s++){var a=t[s],i=a.f;(i&te)===0&&(U(a,e),(i&(z|X))!==0&&((i&G)!==0?Vn(a,Pe):Ne(a)))}}function dt(r){if(typeof r!="object"||r===null||Mt in r)return r;const e=As(r);if(e!==Cs&&e!==Ts)return r;var t=new Map,n=An(r),s=q(0),a=Ie,i=o=>{if(Ie===a)return o();var l=S,u=Ie;be(null),an(a);var d=o();return be(l),an(u),d};return n&&t.set("length",q(r.length)),new Proxy(r,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Fs();var d=t.get(l);return d===void 0?d=i(()=>{var f=q(u.value);return t.set(l,f),f}):F(d,u.value,!0),!0},deleteProperty(o,l){var u=t.get(l);if(u===void 0){if(l in o){const p=i(()=>q(j));t.set(l,p),Kt(s)}}else{if(n&&typeof l=="string"){var d=t.get("length"),f=Number(l);Number.isInteger(f)&&f<d.v&&F(d,f)}F(u,j),Kt(s)}return!0},get(o,l,u){var v;if(l===Mt)return r;var d=t.get(l),f=l in o;if(d===void 0&&(!f||(v=ft(o,l))!=null&&v.writable)&&(d=i(()=>{var x=dt(f?o[l]:j),N=q(x);return N}),t.set(l,d)),d!==void 0){var p=L(d);return p===j?void 0:p}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var d=t.get(l);d&&(u.value=L(d))}else if(u===void 0){var f=t.get(l),p=f==null?void 0:f.v;if(f!==void 0&&p!==j)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(o,l){var p;if(l===Mt)return!0;var u=t.get(l),d=u!==void 0&&u.v!==j||Reflect.has(o,l);if(u!==void 0||M!==null&&(!d||(p=ft(o,l))!=null&&p.writable)){u===void 0&&(u=i(()=>{var v=d?dt(o[l]):j,x=q(v);return x}),t.set(l,u));var f=L(u);if(f===j)return!1}return d},set(o,l,u,d){var V;var f=t.get(l),p=l in o;if(n&&l==="length")for(var v=u;v<f.v;v+=1){var x=t.get(v+"");x!==void 0?F(x,j):v in o&&(x=i(()=>q(j)),t.set(v+"",x))}if(f===void 0)(!p||(V=ft(o,l))!=null&&V.writable)&&(f=i(()=>q(void 0)),F(f,dt(u)),t.set(l,f));else{p=f.v!==j;var N=i(()=>dt(u));F(f,N)}var I=Reflect.getOwnPropertyDescriptor(o,l);if(I!=null&&I.set&&I.set.call(d,u),!p){if(n&&typeof l=="string"){var K=t.get("length"),T=Number(l);Number.isInteger(T)&&T>=K.v&&F(K,T+1)}Kt(s)}return!0},ownKeys(o){L(s);var l=Reflect.ownKeys(o).filter(f=>{var p=t.get(f);return p===void 0||p.v!==j});for(var[u,d]of t)d.v!==j&&!(u in o)&&l.push(u);return l},setPrototypeOf(){zs()}})}var rn,Bn,Un,$n;function ta(){if(rn===void 0){rn=window,Bn=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;Un=ft(e,"firstChild").get,$n=ft(e,"nextSibling").get,Qr(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),Qr(t)&&(t.__t=void 0)}}function ra(r=""){return document.createTextNode(r)}function qn(r){return Un.call(r)}function Wn(r){return $n.call(r)}function lr(r,e){return qn(r)}function na(r,e=1,t=!1){let n=r;for(;e--;)n=Wn(n);return n}function sa(r){M===null&&S===null&&Zs(),S!==null&&(S.f&X)!==0&&M===null&&Ps(),at&&Ds()}function aa(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Ze(r,e,t,n=!0){var s=M;s!==null&&(s.f&Ge)!==0&&(r|=Ge);var a={ctx:se,deps:null,nodes_start:null,nodes_end:null,f:r|te,first:null,fn:e,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(t)try{ht(a),a.f|=Or}catch(l){throw Le(a),l}else e!==null&&Ne(a);var i=t&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&Nr)===0;if(!i&&n&&(s!==null&&aa(a,s),S!==null&&(S.f&G)!==0)){var o=S;(o.effects??(o.effects=[])).push(a)}return a}function de(r){sa();var e=M.f,t=!S&&(e&Ce)!==0&&(e&Or)===0;if(t){var n=se;(n.e??(n.e=[])).push(r)}else return Yn(r)}function Yn(r){return Ze(Mr|Nn,r,!1)}function ia(r){Pt.ensure();const e=Ze(nt,r,!0);return(t={})=>new Promise(n=>{t.outro?fa(e,()=>{Le(e),n(void 0)}):(Le(e),n(void 0))})}function oa(r){return Ze(Mr,r,!1)}function la(r){return Ze(Rr|Nr,r,!0)}function Hn(r,e=0){return Ze(Mn|e,r,!0)}function Xn(r,e=[],t=[]){Ks(e,t,n=>{Ze(Mn,()=>r(...n.map(L)),!0)})}function ua(r,e=!0){return Ze(Ce,r,!0,e)}function Gn(r){var e=r.teardown;if(e!==null){const t=at,n=S;sn(!0),be(null);try{e.call(null)}finally{sn(t),be(n)}}}function Jn(r,e=!1){var s;var t=r.first;for(r.first=r.last=null;t!==null;){(s=t.ac)==null||s.abort(Ir);var n=t.next;(t.f&nt)!==0?t.parent=null:Le(t,e),t=n}}function da(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&Ce)===0&&Le(e),e=t}}function Le(r,e=!0){var t=!1;(e||(r.f&Rs)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(ca(r.nodes_start,r.nodes_end),t=!0),Jn(r,e&&!t),jt(r,0),U(r,st);var n=r.transitions;if(n!==null)for(const a of n)a.stop();Gn(r);var s=r.parent;s!==null&&s.first!==null&&Kn(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=r.ac=null}function ca(r,e){for(;r!==null;){var t=r===e?null:Wn(r);r.remove(),r=t}}function Kn(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function fa(r,e){var t=[];Qn(r,t,!0),ha(t,()=>{Le(r),e&&e()})}function ha(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var s of r)s.out(n)}else e()}function Qn(r,e,t){if((r.f&Ge)===0){if(r.f^=Ge,r.transitions!==null)for(const i of r.transitions)(i.is_global||t)&&e.push(i);for(var n=r.first;n!==null;){var s=n.next,a=(n.f&Ns)!==0||(n.f&Ce)!==0;Qn(n,e,a?t:!1),n=s}}}let $e=!1;function nn(r){$e=r}let at=!1;function sn(r){at=r}let S=null,ae=!1;function be(r){S=r}let M=null;function Je(r){M=r}let $=null;function pa(r){S!==null&&($===null?$=[r]:$.push(r))}let B=null,Y=0,ee=null;function ma(r){ee=r}let Zt=1,mt=0,Ie=mt;function an(r){Ie=r}let we=!1;function es(){return++Zt}function Yt(r){var f;var e=r.f;if((e&te)!==0)return!0;if((e&Pe)!==0){var t=r.deps,n=(e&X)!==0;if(t!==null){var s,a,i=(e&Rt)!==0,o=n&&M!==null&&!we,l=t.length;if((i||o)&&(M===null||(M.f&st)===0)){var u=r,d=u.parent;for(s=0;s<l;s++)a=t[s],(i||!((f=a==null?void 0:a.reactions)!=null&&f.includes(u)))&&(a.reactions??(a.reactions=[])).push(u);i&&(u.f^=Rt),o&&d!==null&&(d.f&X)===0&&(u.f^=X)}for(s=0;s<l;s++)if(a=t[s],Yt(a)&&Pn(a),a.wv>r.wv)return!0}(!n||M!==null&&!we)&&U(r,z)}return!1}function ts(r,e,t=!0){var n=r.reactions;if(n!==null&&!($!=null&&$.includes(r)))for(var s=0;s<n.length;s++){var a=n[s];(a.f&G)!==0?ts(a,e,!1):e===a&&(t?U(a,te):(a.f&z)!==0&&U(a,Pe),Ne(a))}}function rs(r){var x;var e=B,t=Y,n=ee,s=S,a=we,i=$,o=se,l=ae,u=Ie,d=r.f;B=null,Y=0,ee=null,we=(d&X)!==0&&(ae||!$e||S===null),S=(d&(Ce|nt))===0?r:null,$=null,It(r.ctx),ae=!1,Ie=++mt,r.ac!==null&&(r.ac.abort(Ir),r.ac=null);try{r.f|=sr;var f=(0,r.fn)(),p=r.deps;if(B!==null){var v;if(jt(r,Y),p!==null&&Y>0)for(p.length=Y+B.length,v=0;v<B.length;v++)p[Y+v]=B[v];else r.deps=p=B;if(!we||(d&G)!==0&&r.reactions!==null)for(v=Y;v<p.length;v++)((x=p[v]).reactions??(x.reactions=[])).push(r)}else p!==null&&Y<p.length&&(jt(r,Y),p.length=Y);if(In()&&ee!==null&&!ae&&p!==null&&(r.f&(G|Pe|te))===0)for(v=0;v<ee.length;v++)ts(ee[v],r);return s!==null&&s!==r&&(mt++,ee!==null&&(n===null?n=ee:n.push(...ee))),(r.f&Oe)!==0&&(r.f^=Oe),f}catch(N){return qs(N)}finally{r.f^=sr,B=e,Y=t,ee=n,S=s,we=a,$=i,It(o),ae=l,Ie=u}}function va(r,e){let t=e.reactions;if(t!==null){var n=Es.call(t,r);if(n!==-1){var s=t.length-1;s===0?t=e.reactions=null:(t[n]=t[s],t.pop())}}t===null&&(e.f&G)!==0&&(B===null||!B.includes(e))&&(U(e,Pe),(e.f&(X|Rt))===0&&(e.f^=Rt),Dn(e),jt(e,0))}function jt(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)va(r,t[n])}function ht(r){var e=r.f;if((e&st)===0){U(r,z);var t=M,n=$e;M=r,$e=!0;try{(e&Wt)!==0?da(r):Jn(r),Gn(r);var s=rs(r);r.teardown=typeof s=="function"?s:null,r.wv=Zt;var a;Kr&&Us&&(r.f&te)!==0&&r.deps}finally{$e=n,M=t}}}function L(r){var e=r.f,t=(e&G)!==0;if(S!==null&&!ae){var n=M!==null&&(M.f&st)!==0;if(!n&&!($!=null&&$.includes(r))){var s=S.deps;if((S.f&sr)!==0)r.rv<mt&&(r.rv=mt,B===null&&s!==null&&s[Y]===r?Y++:B===null?B=[r]:(!we||!B.includes(r))&&B.push(r));else{(S.deps??(S.deps=[])).push(r);var a=r.reactions;a===null?r.reactions=[S]:a.includes(S)||a.push(S)}}}else if(t&&r.deps===null&&r.effects===null){var i=r,o=i.parent;o!==null&&(o.f&X)===0&&(i.f^=X)}if(at){if(Re.has(r))return Re.get(r);if(t){i=r;var l=i.v;return((i.f&z)!==0||ns(i))&&(l=Zr(i)),Re.set(i,l),l}}else if(t){if(i=r,ye!=null&&ye.has(i))return ye.get(i);Yt(i)&&Pn(i)}if((r.f&Oe)!==0)throw r.v;return r.v}function ns(r){if(r.v===j)return!0;if(r.deps===null)return!1;for(const e of r.deps)if(Re.has(e)||(e.f&G)!==0&&ns(e))return!0;return!1}function ga(r){var e=ae;try{return ae=!0,r()}finally{ae=e}}const _a=-7169;function U(r,e){r.f=r.f&_a|e}const ya=["touchstart","touchmove"];function wa(r){return ya.includes(r)}const ka=new Set,on=new Set;function At(r){var T;var e=this,t=e.ownerDocument,n=r.type,s=((T=r.composedPath)==null?void 0:T.call(r))||[],a=s[0]||r.target,i=0,o=r.__root;if(o){var l=s.indexOf(o);if(l!==-1&&(e===document||e===window)){r.__root=e;return}var u=s.indexOf(e);if(u===-1)return;l<=u&&(i=l)}if(a=s[i]||r.target,a!==e){nr(r,"currentTarget",{configurable:!0,get(){return a||t}});var d=S,f=M;be(null),Je(null);try{for(var p,v=[];a!==null;){var x=a.assignedSlot||a.parentNode||a.host||null;try{var N=a["__"+n];if(N!=null&&(!a.disabled||r.target===a))if(An(N)){var[I,...K]=N;I.apply(a,[r,...K])}else N.call(a,r)}catch(V){p?v.push(V):p=V}if(r.cancelBubble||x===e||x===null)break;a=x}if(p){for(let V of v)queueMicrotask(()=>{throw V});throw p}}finally{r.__root=e,delete r.currentTarget,be(d),Je(f)}}}function xa(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function ba(r,e){var t=M;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function ss(r,e){var t=(e&Bs)!==0,n,s=!r.startsWith("<!>");return()=>{n===void 0&&(n=xa(s?r:"<!>"+r),n=qn(n));var a=t||Bn?document.importNode(n,!0):n.cloneNode(!0);return ba(a,a),a}}function as(r,e){r!==null&&r.before(e)}function jr(r,e){return Ea(r,e)}const Fe=new Map;function Ea(r,{target:e,anchor:t,props:n={},events:s,context:a,intro:i=!0}){ta();var o=new Set,l=f=>{for(var p=0;p<f.length;p++){var v=f[p];if(!o.has(v)){o.add(v);var x=wa(v);e.addEventListener(v,At,{passive:x});var N=Fe.get(v);N===void 0?(document.addEventListener(v,At,{passive:x}),Fe.set(v,1)):Fe.set(v,N+1)}}};l(Ss(ka)),on.add(l);var u=void 0,d=ia(()=>{var f=t??e.appendChild(ra());return ua(()=>{if(a){Lr({});var p=se;p.c=a}s&&(n.$$events=s),u=r(f,n)||{},a&&Dr()}),()=>{var x;for(var p of o){e.removeEventListener(p,At);var v=Fe.get(p);--v===0?(document.removeEventListener(p,At),Fe.delete(p)):Fe.set(p,v)}on.delete(l),f!==t&&((x=f.parentNode)==null||x.removeChild(f))}});return Sa.set(u,d),u}let Sa=new WeakMap;const ln=[...`
2
- \r\f \v\uFEFF`];function Ca(r,e,t){var n=r==null?"":""+r;if(t){for(var s in t)if(t[s])n=n?n+" "+s:s;else if(n.length)for(var a=s.length,i=0;(i=n.indexOf(s,i))>=0;){var o=i+a;(i===0||ln.includes(n[i-1]))&&(o===n.length||ln.includes(n[o]))?n=(i===0?"":n.substring(0,i))+n.substring(o+1):i=o}}return n===""?null:n}function un(r,e=!1){var t=e?" !important;":";",n="";for(var s in r){var a=r[s];a!=null&&a!==""&&(n+=" "+s+": "+a+t)}return n}function Qt(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Ta(r,e){if(e){var t="",n,s;if(Array.isArray(e)?(n=e[0],s=e[1]):n=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var a=!1,i=0,o=!1,l=[];n&&l.push(...Object.keys(n).map(Qt)),s&&l.push(...Object.keys(s).map(Qt));var u=0,d=-1;const N=r.length;for(var f=0;f<N;f++){var p=r[f];if(o?p==="/"&&r[f-1]==="*"&&(o=!1):a?a===p&&(a=!1):p==="/"&&r[f+1]==="*"?o=!0:p==='"'||p==="'"?a=p:p==="("?i++:p===")"&&i--,!o&&a===!1&&i===0){if(p===":"&&d===-1)d=f;else if(p===";"||f===N-1){if(d!==-1){var v=Qt(r.substring(u,d).trim());if(!l.includes(v)){p!==";"&&f++;var x=r.substring(u,f).trim();t+=" "+x+";"}}u=f+1,d=-1}}}}return n&&(t+=un(n)),s&&(t+=un(s,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function is(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Ca(t,n,a);o==null?r.removeAttribute("class"):r.className=o,r.__className=t}else if(a&&s!==a)for(var l in a){var u=!!a[l];(s==null||u!==!!s[l])&&r.classList.toggle(l,u)}return a}function er(r,e={},t,n){for(var s in t){var a=t[s];e[s]!==a&&(t[s]==null?r.style.removeProperty(s):r.style.setProperty(s,a,n))}}function Ft(r,e,t,n){var s=r.__style;if(s!==e){var a=Ta(e,n);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}else n&&(Array.isArray(n)?(er(r,t==null?void 0:t[0],n[0]),er(r,t==null?void 0:t[1],n[1],"important")):er(r,t,n));return n}const Aa=()=>performance.now(),ie={tick:r=>requestAnimationFrame(r),now:()=>Aa(),tasks:new Set};function os(){const r=ie.now();ie.tasks.forEach(e=>{e.c(r)||(ie.tasks.delete(e),e.f())}),ie.tasks.size!==0&&ie.tick(os)}function Ma(r){let e;return ie.tasks.size===0&&ie.tick(os),{promise:new Promise(t=>{ie.tasks.add(e={c:r,f:t})}),abort(){ie.tasks.delete(e)}}}function dn(r,e){return r===e||(r==null?void 0:r[Mt])===e}function Ve(r={},e,t,n){return oa(()=>{var s,a;return Hn(()=>{s=a,a=[],ga(()=>{r!==t(...a)&&(e(r,...a),s&&dn(t(...s),r)&&e(null,...s))})}),()=>{Ys(()=>{a&&dn(t(...a),r)&&e(null,...a)})}}),r}const Oa="5";var Tn;typeof window<"u"&&((Tn=window.__svelte??(window.__svelte={})).v??(Tn.v=new Set)).add(Oa);function Na(r){return r}function ur(r){return-.5*(Math.cos(Math.PI*r)-1)}function Ra(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function Ia(r){return Math.sin(r*Math.PI/2)}const La=128,Da=0,Pa=1,Za=2;class ja{constructor(){h(this,"animationsStarted",!1);h(this,"animationsCount",0);h(this,"animationsLimit",La);h(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let e=0;e<this.layers.length;e++){const t=this.layers[e];if(t==null)continue;const n=t.animations;if(n!=null)for(let s=0;s<n.length;s++){const a=n[s];if(a!=null){for(const i of a.values())if(!i.executed&&(i.executed=!0,i.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}catch{}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,t,n,s){let a=this.layers[e];a==null&&(a=this.layers[e]={animations:new Array});let i=a.animations[t];i==null&&(i=a.animations[t]=new Map);let o={id:n,priority:t,executed:!1,function:s};i.set(n,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,t){for(let n=0;n<this.layers.length;n++){let s=this.layers[n];if(s==null)continue;let a=s.animations[e];if(a==null)return;let i=a.get(t);if(i==null||i.executed==!1)return;a.delete(t)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const ve=new ja;function cn(r){return Object.prototype.toString.call(r)==="[object Date]"}function dr(r,e){if(r===e||r!==r)return()=>r;const t=typeof r;if(t!==typeof e||Array.isArray(r)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(r)){const n=e.map((s,a)=>dr(r[a],s));return s=>n.map(a=>a(s))}if(t==="object"){if(!r||!e)throw new Error("Object cannot be null");if(cn(r)&&cn(e)){const a=r.getTime(),o=e.getTime()-a;return l=>new Date(a+l*o)}const n=Object.keys(e),s={};return n.forEach(a=>{s[a]=dr(r[a],e[a])}),a=>{const i={};return n.forEach(o=>{i[o]=s[o](a)}),i}}if(t==="number"){const n=e-r;return s=>r+s*n}return()=>e}var fe,Xe,bt,Me;const $r=class $r{constructor(e,t={}){P(this,fe);P(this,Xe);P(this,bt);P(this,Me,null);Z(this,fe,q(e)),Z(this,Xe,q(e)),Z(this,bt,t)}static of(e,t){const n=new $r(e(),t);return Hn(()=>{n.set(e())}),n}set(e,t){var f;F(k(this,Xe),e);let{delay:n=0,duration:s=400,easing:a=Na,interpolate:i=dr}={...k(this,bt),...t};if(s===0)return(f=k(this,Me))==null||f.abort(),F(k(this,fe),e),Promise.resolve();const o=ie.now()+n;let l,u=!1,d=k(this,Me);return Z(this,Me,Ma(p=>{if(p<o)return!0;if(!u){u=!0;const x=k(this,fe).v;l=i(x,e),typeof s=="function"&&(s=s(x,e)),d==null||d.abort()}const v=p-o;return v>s?(F(k(this,fe),e),!1):(F(k(this,fe),l(a(v/s))),!0)})),k(this,Me).promise}get current(){return L(k(this,fe))}get target(){return L(k(this,Xe))}set target(e){this.set(e)}};fe=new WeakMap,Xe=new WeakMap,bt=new WeakMap,Me=new WeakMap;let cr=$r;class Ot{constructor(e,t){h(this,"value");h(this,"motion");this.value=e,this.motion=new cr(e,t)}set(e,t){this.value=e,this.motion.set(e,t)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}var Fa=ss('<div><div class="body svelte-1nfn9j8"></div></div>');function za(r,e){Lr(e,!0);let t,n;function s(){return n}let a=q(!1);function i(T){F(a,T,!0)}function o(){return L(a)}let l=new Ot(0,{easing:ur});de(()=>{u(l.motion.current)}),de(()=>{L(a)==!1&&(l.snap(),ve.clear(e.priority,e.id))});function u(T){t&&ve.equeue(e.layer,e.priority,e.id,()=>{t.style.scale=T.toString(),t.style.filter=`brightness(${.25+.75*T})`,n.style.opacity=T.toString()})}function d(T){T!=l.value&&l.set(T,{duration:75})}function f(){return l.motion.current==0}function p(){return l.value}var v=Fa();let x,N;var I=lr(v);let K;return Ve(I,T=>n=T,()=>n),Ve(v,T=>t=T,()=>t),Xn((T,V,Q)=>{x=is(v,1,"pin svelte-1nfn9j8",null,x,T),N=Ft(v,"",N,V),K=Ft(I,"",K,Q)},[()=>({displayed:L(a)}),()=>({width:`${e.width}px`,height:`${e.height}px`,"border-radius":`${e.radius}px`}),()=>({width:`${e.width-4}px`,height:`${e.height-4}px`,"border-radius":`${e.radius-2}px`})]),as(r,v),Dr({getBody:s,setDisplayed:i,getDisplayed:o,setScale:d,getCollapsed:f,getScale:p})}var Va=ss('<div><div class="pointer svelte-j5igi2"></div> <div class="bubble svelte-j5igi2"><div class="body svelte-j5igi2"></div></div></div>');function ls(r,e){Lr(e,!0);let t,n,s,a;const i=e.width+2*e.margin,o=e.height+2*e.margin,l=()=>a;de(()=>{s.style.width=`${e.margin*4}px`,s.style.height=`${e.margin*4}px`});let u=q(!0);function d(O){F(u,O,!0)}function f(){return L(u)}let p=q(!0);function v(O){F(p,O,!0)}function x(){return I.motion.current==0}function N(){return I.motion.current==1}let I=new Ot(0);de(()=>{K(I.motion.current)}),de(()=>{L(u)==!1&&(I.snap(),ve.clear(e.priority,e.id+"_scale"))}),de(()=>{L(p)==!0&&I.value!=0&&(ve.stacked()?I.set(0,{duration:0}):I.set(0,{duration:150,easing:Ra})),L(p)==!1&&I.value!=1&&I.set(1,{duration:150,easing:Ia})});function K(O){!t||!n||!s||ve.equeue(L(p)?0:e.layer,e.priority,e.id+"_scale",()=>{t.style.opacity=`${O}`,n.style.scale=`${O}`,s.style.scale=`${O}`})}let T=NaN,V=q(!1),Q=new Ot(-i/2,{easing:ur}),Et=new Ot(-o/2,{easing:ur});de(()=>{qr(Q.motion.current,Et.motion.current)}),de(()=>{L(u)==!1&&(Q.snap(),Q.snap(),ve.clear(e.priority,e.id+"_angle"))}),de(()=>{L(p)==!0&&L(V)&&(Q.update({duration:75}),Q.update({duration:75}))});function qr(O,ue){if(!t||!n||!s)return;const Ct=O+i/2,it=ue+o/2,je=o<i?Ct*o/i:Ct,Xt=o>i?it*i/o:it,gs=Math.atan2(Xt,je)/Math.PI*180-45,Xr=0,_s=30,Gt=Math.sqrt(je*je+Xt*Xt),ot=Math.min(i,o)/2,ys=ot*Math.SQRT2,ws=(Gt-ot)/(ys-ot),Gr=Xr+ws*(_s-Xr),ks=Gt<ot?Gt/ot:1;ve.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(O)}px, ${Math.round(ue)}px)`,s.style.transform=`scale(${ks}) rotate(${gs}deg) skew(${Gr}deg, ${Gr}deg)`})}function ms(O){if(L(V)==!1){let ue=H.Rectangle.getOffsets(i,o,O);Q.set(Math.round(ue.offsetX),{duration:0}),Et.set(Math.round(ue.offsetY),{duration:0}),qr(Q.value,Et.value),T=O,F(V,!0)}else if(O!=T){let ue=Math.abs(O-T),Ct=ue<180?ue:360-ue,it=Math.log(Ct)*75,je=H.Rectangle.getOffsets(i,o,O);Q.set(Math.round(je.offsetX),{duration:it}),Et.set(Math.round(je.offsetY),{duration:it}),T=O}}function vs(){return H.Rectangle.getOffsets(i,o,T)}var St=Va();let Wr;var Yr=lr(St);Ve(Yr,O=>s=O,()=>s);var Ht=na(Yr,2),Hr=lr(Ht);return Ve(Hr,O=>a=O,()=>a),Ve(Ht,O=>n=O,()=>n),Ve(St,O=>t=O,()=>t),Xn(O=>{Wr=is(St,1,"anchor svelte-j5igi2",null,Wr,O),Ft(Ht,`margin: ${e.margin}px;`),Ft(Hr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)},[()=>({displayed:L(u)})]),as(r,St),Dr({getBody:l,setDisplayed:d,getDisplayed:f,setCollapsed:v,getCollapsed:x,getExpanded:N,setAngle:ms,getOffsets:vs})}class us{constructor(e,t,n,s,a){h(this,"swLat");h(this,"swLng");h(this,"neLat");h(this,"neLng");const i=n*Math.pow(2,t),o=H.Mercator.project(e.sw.lat,e.sw.lng,i),l=H.Mercator.project(e.ne.lat,e.ne.lng,i),u=o.x-s,d=o.y+a,f=l.x+s,p=l.y-a,v=H.Mercator.unproject(u,d,i),x=H.Mercator.unproject(f,p,i);this.swLat=v.lat,this.swLng=v.lng,this.neLat=x.lat,this.neLng=x.lng}contains(e,t){return this.swLat<=e&&e<=this.neLat?this.swLng<this.neLng?this.swLng<=t&&t<=this.neLng:t<=this.neLng||this.swLng<=t:!1}}var A;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(A||(A={}));var fn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(fn||(fn={}));const g=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),me=r=>{switch(typeof r){case"undefined":return g.undefined;case"string":return g.string;case"number":return Number.isNaN(r)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(r)?g.array:r===null?g.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?g.promise:typeof Map<"u"&&r instanceof Map?g.map:typeof Set<"u"&&r instanceof Set?g.set:typeof Date<"u"&&r instanceof Date?g.date:g.object;default:return g.unknown}},c=A.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class re extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return s(this),n}static assert(e){if(!(e instanceof re))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}re.create=r=>new re(r);const vt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===g.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,A.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${A.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${A.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${A.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:A.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,A.assertNever(r)}return{message:t}};let Ba=vt;function fr(){return Ba}const hr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function m(r,e){const t=fr(),n=hr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===vt?void 0:vt].filter(s=>!!s)});r.common.issues.push(n)}class J{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return J.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),ct=r=>({status:"dirty",value:r}),W=r=>({status:"valid",value:r}),hn=r=>r.status==="aborted",pn=r=>r.status==="dirty",Ke=r=>r.status==="valid",zt=r=>typeof Promise<"u"&&r instanceof Promise;var _;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_||(_={}));class Ee{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const mn=(r,e)=>{if(Ke(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new re(r.common.issues);return this._error=t,this._error}}};function b(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:l}=r;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:s}}class C{get description(){return this._def.description}_getType(e){return me(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new J,ctx:{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(zt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},s=this._parseSync({data:e,path:n.path,parent:n});return mn(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Ke(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>Ke(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(zt(s)?s:Promise.resolve(s));return mn(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new tt({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return xe.create(this,this._def)}nullable(){return rt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return yt.create(this,this._def)}or(e){return Bt.create([this,e],this._def)}and(e){return Ut.create(this,e,this._def)}transform(e){return new tt({...b(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new _r({...b(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new ci({typeName:w.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new yr({...b(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Fr.create(this,e)}readonly(){return wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ua=/^c[^\s-]{8,}$/i,$a=/^[0-9a-z]+$/,qa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wa=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ya=/^[a-z0-9_-]{21}$/i,Ha=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Xa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ga=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ja="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let tr;const Ka=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ei=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ti=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ri=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ni=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ds="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",si=new RegExp(`^${ds}$`);function cs(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ai(r){return new RegExp(`^${cs(r)}$`)}function ii(r){let e=`${ds}T${cs(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function oi(r,e){return!!((e==="v4"||!e)&&Ka.test(r)||(e==="v6"||!e)&&ei.test(r))}function li(r,e){if(!Ha.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function ui(r,e){return!!((e==="v4"||!e)&&Qa.test(r)||(e==="v6"||!e)&&ti.test(r))}class ke extends C{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.string,received:a.parsedType}),y}const n=new J;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?m(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&m(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Ga.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")tr||(tr=new RegExp(Ja,"u")),tr.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Wa.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ya.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Ua.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")$a.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")qa.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ii(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?si.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ai(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Xa.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?oi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?li(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?ui(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ri.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?ni.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,..._.errToObj(n)})}_addCheck(e){return new ke({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,..._.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,..._.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,..._.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new ke({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ke({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ke({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ke.create=r=>new ke({checks:[],typeName:w.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});function di(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class Qe extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.number,received:a.parsedType}),y}let n;const s=new J;for(const a of this._def.checks)a.kind==="int"?A.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?di(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_finite,message:a.message}),s.dirty()):A.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,s){return new Qe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new Qe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&A.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Qe.create=r=>new Qe({checks:[],typeName:w.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class gt extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let n;const s=new J;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):A.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,s){return new gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}gt.create=r=>new gt({checks:[],typeName:w.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});class pr extends C{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.boolean,received:n.parsedType}),y}return W(e.data)}}pr.create=r=>new pr({typeName:w.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class Vt extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_date}),y}const n=new J;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):A.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Vt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Vt.create=r=>new Vt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:w.ZodDate,...b(r)});class vn extends C{_parse(e){if(this._getType(e)!==g.symbol){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.symbol,received:n.parsedType}),y}return W(e.data)}}vn.create=r=>new vn({typeName:w.ZodSymbol,...b(r)});class gn extends C{_parse(e){if(this._getType(e)!==g.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.undefined,received:n.parsedType}),y}return W(e.data)}}gn.create=r=>new gn({typeName:w.ZodUndefined,...b(r)});class _n extends C{_parse(e){if(this._getType(e)!==g.null){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.null,received:n.parsedType}),y}return W(e.data)}}_n.create=r=>new _n({typeName:w.ZodNull,...b(r)});class mr extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}mr.create=r=>new mr({typeName:w.ZodAny,...b(r)});class qe extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}qe.create=r=>new qe({typeName:w.ZodUnknown,...b(r)});class Se extends C{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.never,received:t.parsedType}),y}}Se.create=r=>new Se({typeName:w.ZodNever,...b(r)});class vr extends C{_parse(e){if(this._getType(e)!==g.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.void,received:n.parsedType}),y}return W(e.data)}}vr.create=r=>new vr({typeName:w.ZodVoid,...b(r)});class le extends C{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==g.array)return m(t,{code:c.invalid_type,expected:g.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(m(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Ee(t,i,t.path,o)))).then(i=>J.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Ee(t,i,t.path,o)));return J.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new le({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new le({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new le({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}le.create=(r,e)=>new le({type:r,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...b(e)});function ze(r){if(r instanceof D){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=xe.create(ze(n))}return new D({...r._def,shape:()=>e})}else return r instanceof le?new le({...r._def,type:ze(r.element)}):r instanceof xe?xe.create(ze(r.unwrap())):r instanceof rt?rt.create(ze(r.unwrap())):r instanceof he?he.create(r.items.map(e=>ze(e))):r}class D extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=A.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==g.object){const u=this._getOrReturnCtx(e);return m(u,{code:c.invalid_type,expected:g.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Se&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const d=a[u],f=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Ee(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Se){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")o.length>0&&(m(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of o){const f=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Ee(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>J.mergeObjectSync(n,u)):J.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new D({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:_.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new D({...this._def,unknownKeys:"strip"})}passthrough(){return new D({...this._def,unknownKeys:"passthrough"})}extend(e){return new D({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new D({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new D({...this._def,catchall:e})}pick(e){const t={};for(const n of A.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new D({...this._def,shape:()=>t})}omit(e){const t={};for(const n of A.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new D({...this._def,shape:()=>t})}deepPartial(){return ze(this)}partial(e){const t={};for(const n of A.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new D({...this._def,shape:()=>t})}required(e){const t={};for(const n of A.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof xe;)a=a._def.innerType;t[n]=a}return new D({...this._def,shape:()=>t})}keyof(){return fs(A.objectKeys(this.shape))}}D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:Se.create(),typeName:w.ZodObject,...b(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:Se.create(),typeName:w.ZodObject,...b(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:Se.create(),typeName:w.ZodObject,...b(e)});class Bt extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new re(o.ctx.common.issues));return m(t,{code:c.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const l of n){const u={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(l=>new re(l));return m(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}Bt.create=(r,e)=>new Bt({options:r,typeName:w.ZodUnion,...b(e)});function gr(r,e){const t=me(r),n=me(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&n===g.object){const s=A.objectKeys(e),a=A.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=gr(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===g.array&&n===g.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],l=gr(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===g.date&&n===g.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Ut extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(hn(a)||hn(i))return y;const o=gr(a.value,i.value);return o.valid?((pn(a)||pn(i))&&t.dirty(),{status:t.value,value:o.data}):(m(n,{code:c.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ut.create=(r,e,t)=>new Ut({left:r,right:e,typeName:w.ZodIntersection,...b(t)});class he extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.array)return m(n,{code:c.invalid_type,expected:g.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return m(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Ee(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>J.mergeArray(t,i)):J.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new he({...this._def,rest:e})}}he.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:r,typeName:w.ZodTuple,rest:null,...b(e)})};class yn extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.map)return m(n,{code:c.invalid_type,expected:g.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:s._parse(new Ee(n,o,n.path,[u,"key"])),value:a._parse(new Ee(n,l,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return y;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return y;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}}}}yn.create=(r,e,t)=>new yn({valueType:e,keyType:r,typeName:w.ZodMap,...b(t)});class _t extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.set)return m(n,{code:c.invalid_type,expected:g.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(m(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(m(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const d of l){if(d.status==="aborted")return y;d.status==="dirty"&&t.dirty(),u.add(d.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>a._parse(new Ee(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new _t({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new _t({...this._def,maxSize:{value:e,message:_.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_t.create=(r,e)=>new _t({valueType:r,minSize:null,maxSize:null,typeName:w.ZodSet,...b(e)});class pt extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return m(t,{code:c.invalid_type,expected:g.function,received:t.parsedType}),y;function n(o,l){return hr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fr(),vt].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:l}})}function s(o,l){return hr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fr(),vt].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof yt){const o=this;return W(async function(...l){const u=new re([]),d=await o._def.args.parseAsync(l,a).catch(v=>{throw u.addIssue(n(l,v)),u}),f=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(f,a).catch(v=>{throw u.addIssue(s(f,v)),u})})}else{const o=this;return W(function(...l){const u=o._def.args.safeParse(l,a);if(!u.success)throw new re([n(l,u.error)]);const d=Reflect.apply(i,this,u.data),f=o._def.returns.safeParse(d,a);if(!f.success)throw new re([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pt({...this._def,args:he.create(e).rest(qe.create())})}returns(e){return new pt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new pt({args:e||he.create([]).rest(qe.create()),returns:t||qe.create(),typeName:w.ZodFunction,...b(n)})}}class wn extends C{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}wn.create=(r,e)=>new wn({getter:r,typeName:w.ZodLazy,...b(e)});class kn extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}kn.create=(r,e)=>new kn({value:r,typeName:w.ZodLiteral,...b(e)});function fs(r,e){return new et({values:r,typeName:w.ZodEnum,...b(e)})}class et extends C{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:A.joinValues(n),received:t.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{received:t.data,code:c.invalid_enum_value,options:n}),y}return W(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return et.create(e,{...this._def,...t})}exclude(e,t=this._def){return et.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}et.create=fs;class xn extends C{_parse(e){const t=A.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==g.string&&n.parsedType!==g.number){const s=A.objectValues(t);return m(n,{expected:A.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=A.objectValues(t);return m(n,{received:n.data,code:c.invalid_enum_value,options:s}),y}return W(e.data)}get enum(){return this._def.values}}xn.create=(r,e)=>new xn({values:r,typeName:w.ZodNativeEnum,...b(e)});class yt extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return m(t,{code:c.invalid_type,expected:g.promise,received:t.parsedType}),y;const n=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return W(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}yt.create=(r,e)=>new yt({type:r,typeName:w.ZodPromise,...b(e)});class tt extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{m(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?ct(l.value):l});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?ct(o.value):o}}if(s.type==="refinement"){const i=o=>{const l=s.refinement(o,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ke(i))return y;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ke(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);A.assertNever(s)}}tt.create=(r,e,t)=>new tt({schema:r,typeName:w.ZodEffects,effect:e,...b(t)});tt.createWithPreprocess=(r,e,t)=>new tt({schema:e,effect:{type:"preprocess",transform:r},typeName:w.ZodEffects,...b(t)});class xe extends C{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xe.create=(r,e)=>new xe({innerType:r,typeName:w.ZodOptional,...b(e)});class rt extends C{_parse(e){return this._getType(e)===g.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rt.create=(r,e)=>new rt({innerType:r,typeName:w.ZodNullable,...b(e)});class _r extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===g.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}_r.create=(r,e)=>new _r({innerType:r,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class yr extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return zt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}yr.create=(r,e)=>new yr({innerType:r,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class bn extends C{_parse(e){if(this._getType(e)!==g.nan){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}bn.create=r=>new bn({typeName:w.ZodNaN,...b(r)});class ci extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Fr extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),ct(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Fr({in:e,out:t,typeName:w.ZodPipeline})}}class wr extends C{_parse(e){const t=this._def.innerType._parse(e),n=s=>(Ke(s)&&(s.value=Object.freeze(s.value)),s);return zt(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}wr.create=(r,e)=>new wr({innerType:r,typeName:w.ZodReadonly,...b(e)});var w;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(w||(w={}));const De=ke.create,E=Qe.create,kr=pr.create,zr=mr.create;qe.create;Se.create;const Nt=vr.create,Vr=le.create,R=D.create;Bt.create;Ut.create;const En=he.create,oe=pt.create,fi=et.create,hi=yt.create;xe.create;rt.create;R({pin:R({fade:kr().optional(),maxCount:E().optional(),maxZoom:E().optional()}).optional(),animation:R({queue:R({limit:E().optional()}).optional()}).optional(),api:R({states:R({url:De().optional(),key:De()}).optional(),log:R({enabled:kr()}).optional()}).optional()});const xr=E().min(-90).max(90),br=E().min(-180).max(180),pi=R({sw:R({lat:xr,lng:br}),ne:R({lat:xr,lng:br})}),Er=zr().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),hs=R({mapSize:E(),zoomMin:E(),zoomMax:E(),zoomScale:E()}),mi=R({instance:zr(),inserted:oe().returns(kr()),insert:oe().returns(Nt()),remove:oe().returns(Nt()),update:oe().args(E()).returns(Nt())}),vi=R({parameters:hs,getContainer:oe().args().returns(Er),getZoom:oe().args().returns(E()),getBounds:oe().args().returns(pi),panBy:oe().args(E(),E()).returns(Nt()),createMarker:oe().args(Er,xr,br,E()).returns(mi)}),rr=oe().args(De()).returns(hi(Er)),gi=R({id:De().min(1),rank:E(),lat:E().min(-90).max(90),lng:E().min(-180).max(180),tooltip:R({style:R({width:E(),height:E(),margin:E(),radius:E()}).refine(r=>Math.min(r.width,r.height)/r.margin>=5,"Tooltip width and height must be at least 5 times the margin"),body:rr}),pin:R({style:R({width:E(),height:E(),radius:E()}),body:rr}).optional(),popup:R({style:R({width:E(),height:E(),radius:E(),margin:E()}),body:rr}).optional()}),_i=Vr(gi);En([E(),Vr(En([E(),E()]))]);const yi=R({id:De(),rank:E(),lat:E(),lng:E(),width:E(),height:E(),margin:E()});R({key:De(),parameters:hs,input:Vr(yi)});const wi=fi(["info","warn","error"]);R({title:De(),level:wi,content:zr()});const ps="https://arenarium.dev/api/public/v1",ki=`${ps}/log`,xi=`${ps}/tooltip/states`,Sn="1.0.184";class bi{constructor(e,t){h(this,"provider");h(this,"apiStatesUrl");h(this,"apiStatesKey");h(this,"apiLogEnabled");h(this,"markerDataArray",new Array);h(this,"markerDataMap",new Map);h(this,"markerDataUpdating",!1);h(this,"markerPinProcessor");h(this,"markerTooltipProcessor");h(this,"markerPopupProcessor");vi.parse(e),this.provider=e,this.markerPinProcessor=new Cr(e),this.markerTooltipProcessor=new Ei(e),this.markerPopupProcessor=new Si(e),this.configuration=t,this.log("info","Loaded")}set configuration(e){var t,n,s,a,i,o,l,u;this.apiStatesUrl=(n=(t=e==null?void 0:e.api)==null?void 0:t.states)==null?void 0:n.url,this.apiStatesKey=(a=(s=e==null?void 0:e.api)==null?void 0:s.states)==null?void 0:a.key,this.apiLogEnabled=(o=(i=e==null?void 0:e.api)==null?void 0:i.log)==null?void 0:o.enabled,this.markerPinProcessor.setConfiguration(e),ve.setLimit(((u=(l=e==null?void 0:e.animation)==null?void 0:l.queue)==null?void 0:u.limit)??8*navigator.hardwareConcurrency)}async updateMarkers(e){_i.parse(e);try{let t;if(e.length>1){const n=e.map(s=>({id:s.id,rank:s.rank,lat:s.lat,lng:s.lng,width:s.tooltip.style.width,height:s.tooltip.style.height,margin:s.tooltip.style.margin}));if(this.apiStatesKey!=null){const s={key:this.apiStatesKey,parameters:this.provider.parameters,input:n},a=await fetch(this.apiStatesUrl??xi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok||!a.body)throw new Error("Failed to get marker states: "+a.statusText);t=await a.json()}else t=H.getStates(this.provider.parameters,n)}else t=[[0,[[0,H.Angles.DEGREES.indexOf(H.Angles.DEFAULT)]]]];this.updateMarkerData(e,t),this.processMarkerDataCallback()}catch(t){throw console.error(t),this.removeMarkerData(),t instanceof Error&&this.log("error","Failed to update markers",t),t}}removeMarkers(){try{this.removeMarkerData()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove markers",e),e}}showPopup(e){try{for(const t of this.markerDataArray)t.marker.id==e?this.markerPopupProcessor.show(t):this.markerPopupProcessor.hide(t)}catch(t){console.error(t);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t instanceof Error&&this.log("error","Failed to show popup",t),t}}hidePopup(e){try{if(e){const t=this.markerDataMap.get(e);if(t==null)return;this.markerPopupProcessor.hide(t)}else for(const t of this.markerDataArray)this.markerPopupProcessor.hide(t)}catch(t){console.error(t);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t instanceof Error&&this.log("error","Failed to hide popup",t),t}}updateMarkerData(e,t){try{this.markerDataUpdating=!0;const n=new Map(e.map((a,i)=>[a.id,new Cn(this.provider,a,t[i])])),s=Array.from(this.markerDataArray);for(const a of s)n.has(a.marker.id)==!1&&(a.remove(),this.markerDataMap.delete(a.marker.id),this.markerDataArray.splice(this.markerDataArray.indexOf(a),1));for(let a=0;a<e.length;a++){const i=e[a],o=t[a],l=this.markerDataMap.get(i.id);if(l)l.update(o);else{const u=new Cn(this.provider,i,o);u.create(),this.markerDataMap.set(i.id,u),this.markerDataArray.push(u)}}this.markerDataArray.sort((a,i)=>a.zoom-i.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(a=>a.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(a=>a.tooltip))}catch(n){throw console.error(n),this.markerDataArray.forEach(s=>s.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),n instanceof Error&&this.log("error","Failed to update marker data",n),n}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerPinProcessor.removeElements(),this.markerTooltipProcessor.removeElements(),this.markerPopupProcessor.clear(),this.markerDataArray.length=0,this.markerDataMap.clear()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove marker data",e),e}finally{this.markerDataUpdating=!1}}processMarkerDataCallback(){if(this.markerDataArray.length!=0)try{this.processMarkerData(),window.setTimeout(this.processMarkerDataCallback.bind(this),25)}catch(e){console.error(e),e instanceof Error&&this.log("error","Failed to process marker data",e)}}processMarkerData(){if(this.markerDataUpdating)return;const e=this.provider.getBounds(),t=this.provider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,t),this.markerPinProcessor.process(e,t)}async log(e,t,n){if(!(this.apiLogEnabled==null&&(window!=null&&window.location.host.startsWith("localhost")))&&this.apiLogEnabled!=!1)try{const s={title:`[CLIENT:${Sn}] ${t}`,level:e,content:{version:Sn,...n}};await fetch(ki,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(s){console.error(s)}}}class Cn{constructor(e,t,n){h(this,"marker");h(this,"zoom");h(this,"pin");h(this,"tooltip");this.marker=t,this.zoom=n[0],this.pin=new Sr(e,t,n),this.tooltip=new Tr(e,t,n)}create(){this.pin.create(),this.tooltip.create()}update(e){this.pin.update(e),this.tooltip.update(e)}remove(){this.pin.remove(),this.tooltip.remove()}}class Br{constructor(e,t){h(this,"provider");h(this,"id");h(this,"lat");h(this,"lng");h(this,"shown");h(this,"element");h(this,"component");h(this,"marker");this.provider=e,this.id=t.id,this.lat=t.lat,this.lng=t.lng,this.shown=!0}create(){this.createElement(),this.createMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createMarker(){const e=this.element;if(!e)throw new Error("Failed to create provider marker");this.marker=this.provider.createMarker(e,this.lat,this.lng,this.getZindex())}updateZIndex(){if(this.marker==null)throw new Error("Failed to update provider marker z-index");this.marker.update(this.getZindex())}updateMap(e){const t=this.marker,n=this.component;if(t==null||n==null)throw new Error("Failed to update provider marker map");e?t.inserted()==!1&&t.insert():t.inserted()==!0&&t.remove()}getZindex(){throw new Error("Get z-index not implemented")}remove(){var e,t;(e=this.marker)==null||e.remove(),(t=this.element)==null||t.remove()}}const Be=class Be extends Br{constructor(t,n,s){var a,i,o,l;super(t,n);h(this,"width");h(this,"height");h(this,"radius");h(this,"zoom");h(this,"bodyLoading",!1);h(this,"bodyLoaded",!1);h(this,"bodyCallback");this.width=((a=n.pin)==null?void 0:a.style.width)??Be.DEFAULT_SIZE,this.height=((i=n.pin)==null?void 0:i.style.height)??Be.DEFAULT_SIZE,this.radius=((o=n.pin)==null?void 0:o.style.radius)??Be.DEFAULT_SIZE,this.zoom=s[0],this.bodyCallback=(l=n.pin)==null?void 0:l.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("pin"),this.component=jr(za,{target:this.element,props:{id:this.id+"_pin",layer:Za,priority:this.zoom*this.provider.parameters.zoomScale,width:this.width,height:this.height,radius:this.radius}})}update(t){this.zoom=t[0],this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){if(this.component==null)throw new Error("Failed to update pin state");this.component.setScale(this.getScale(t))}updateBody(){var n;if(this.bodyCallback==null||this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load pin body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}setCollapsed(t){if(this.component==null)throw new Error("Failed to set pin collapsed");this.component.setScale(t?0:1)}getScale(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};h(Be,"DEFAULT_SIZE",16);let Sr=Be;const Ue=class Ue{constructor(e){h(this,"provider");h(this,"pinElements",new Array);h(this,"pinMaxWidth",0);h(this,"pinMaxHeight",0);h(this,"pinFade",!1);h(this,"pinMaxCount",0);h(this,"pinMaxZoomDelta",0);this.provider=e}setConfiguration(e){var t,n,s;this.pinFade=((t=e==null?void 0:e.pin)==null?void 0:t.fade)??!0,this.pinMaxCount=((n=e==null?void 0:e.pin)==null?void 0:n.maxCount)??Math.max(Ue.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=e==null?void 0:e.pin)==null?void 0:s.maxZoom)??Ue.MAP_PINS_MAX_ZOOM}updateElements(e){this.pinElements=e,this.pinMaxWidth=e.reduce((t,n)=>Math.max(t,n.width),0),this.pinMaxHeight=e.reduce((t,n)=>Math.max(t,n.height),0)}removeElements(){this.pinElements.forEach(e=>e.remove()),this.pinElements.length=0}process(e,t){const n=this.provider.parameters.mapSize,s=new us(e,t,n,this.pinMaxWidth*2,this.pinMaxHeight*2);let a=0;for(const i of this.pinElements)s.contains(i.lat,i.lng)?i.shown&&t<=i.zoom&&i.zoom<=t+this.pinMaxZoomDelta?(a<this.pinMaxCount&&(this.pinFade==!0?i.updateState(t):i.setCollapsed(!1),i.updateMap(!0),i.isBodyLoaded()==!1&&i.updateBody()),a++):(i.setCollapsed(!0),i.isCollapsed()&&i.updateMap(!1)):i.updateMap(!1)}};h(Ue,"MAP_PINS_MAX_ZOOM",2),h(Ue,"MAP_PINS_MAX_COUNT",128);let Cr=Ue;const $t=class $t extends Br{constructor(t,n,s){super(t,n);h(this,"width");h(this,"height");h(this,"margin");h(this,"radius");h(this,"zoom");h(this,"angle");h(this,"states");h(this,"bodyLoading",!1);h(this,"bodyLoaded",!1);h(this,"bodyCallback");this.width=n.tooltip.style.width,this.height=n.tooltip.style.height,this.margin=n.tooltip.style.margin,this.radius=n.tooltip.style.radius,this.zoom=s[0],this.angle=H.Angles.DEFAULT,this.states=s[1].map(a=>[a[0],H.Angles.DEGREES[a[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=jr(ls,{target:this.element,props:{id:this.id+"_tooltip",layer:Pa,priority:this.zoom*this.provider.parameters.zoomScale,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}update(t){this.zoom=t[0],this.states=t[1].map(n=>[n[0],H.Angles.DEGREES[n[1]]]),this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){if(this.component==null)throw new Error("Failed to update tooltip state");this.angle=this.getAngle(t),this.component.setAngle(this.angle)}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load tooltip body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getAngle(t){const n=this.states.findLast(s=>s[0]<=t);if(!n)throw new Error("Angle not found");return n[1]}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)+$t.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};h($t,"Z_INDEX_OFFSET",1e6);let Tr=$t;class Ei{constructor(e){h(this,"provider");h(this,"tooltipElements",new Array);h(this,"tooltipMaxWidth",0);h(this,"tooltipMaxHeight",0);this.provider=e}updateElements(e){this.tooltipElements=e,this.tooltipMaxWidth=this.tooltipElements.reduce((t,n)=>Math.max(t,n.width),0),this.tooltipMaxHeight=this.tooltipElements.reduce((t,n)=>Math.max(t,n.height),0)}removeElements(){this.tooltipElements.forEach(e=>e.remove()),this.tooltipElements.length=0}process(e,t){const n=this.provider.parameters.mapSize,s=new us(e,t,n,this.tooltipMaxWidth*2,this.tooltipMaxHeight*2);for(const a of this.tooltipElements)s.contains(a.lat,a.lng)?a.shown&&a.zoom<=t?(a.updateState(t),a.setCollapsed(!1),a.updateMap(!0),a.isCollapsed()==!1&&a.isBodyLoaded()==!1&&a.updateBody()):(a.setCollapsed(!0),a.isCollapsed()&&a.updateMap(!1)):a.updateMap(!1)}}const qt=class qt extends Br{constructor(t,n){if(n.popup==null)throw new Error("Failed to create popup");super(t,n);h(this,"width");h(this,"height");h(this,"margin");h(this,"radius");h(this,"bodyLoading",!1);h(this,"bodyLoaded",!1);h(this,"bodyCallback");this.shown=!1,this.width=n.popup.style.width,this.height=n.popup.style.height,this.margin=n.popup.style.margin,this.radius=n.popup.style.radius,this.bodyCallback=n.popup.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("popup"),this.component=jr(ls,{target:this.element,props:{id:this.id+"_popup",layer:Da,priority:0,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load popup body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getZindex(){return qt.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set popup collapsed");this.component.setCollapsed(t)}setAngle(t){if(this.component==null)throw new Error("Failed to set popup angle");this.component.setAngle(t)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};h(qt,"Z_INDEX_OFFSET",2e6);let Ar=qt;class Si{constructor(e){h(this,"provider");h(this,"popupElements",new Map);h(this,"popupPositioned",new Map);this.provider=e}show(e){e.pin.shown=!1,e.tooltip.shown=!1;const t=new Ar(this.provider,e.marker);this.popupElements.set(e.marker.id,t),this.popupPositioned.set(e.marker.id,!1),t.create(),t.setAngle(e.tooltip.angle),t.shown=!0}hide(e){e.pin.shown=!0,e.tooltip.shown=!0;const t=this.popupElements.get(e.marker.id);t!=null&&(t.shown=!1)}clear(){this.popupElements.values().forEach(e=>e.remove()),this.popupElements.clear(),this.popupPositioned.clear()}process(){var e,t;for(const n of this.popupElements.values())if(n.shown){if(n.setCollapsed(!1),n.updateMap(!0),n.isExpanded()&&n.isBodyLoaded()==!1&&n.updateBody(),n.isCollapsed()==!1&&this.popupPositioned.get(n.id)==!1){const s=(e=n.component)==null?void 0:e.getBody();if(s==null)continue;const a=(t=n.component)==null?void 0:t.getOffsets();if(a==null)continue;const i=s.getBoundingClientRect();if(i.x==0&&i.y==0&&i.width==0&&i.height==0)continue;const o=i.x+i.width/2,l=i.y+i.height/2,u=o+a.offsetX,d=l+a.offsetY,f=u+n.width,p=d+n.height,v=this.provider.getContainer().getBoundingClientRect(),x=u-v.left,N=v.right-f,I=d-v.top,K=v.bottom-p,T=Math.min(n.width,n.height)/4,V=x<0?x-T:N<0?-N+T:0,Q=I<0?I-T:K<0?-K+T:0;this.provider.panBy(V,Q),this.popupPositioned.set(n.id,!0)}}else n.setCollapsed(!0),n.isCollapsed()&&(n.updateMap(!1),n.remove(),this.popupElements.delete(n.id),this.popupPositioned.delete(n.id))}}exports.MapManager=bi;
1
+ "use strict";var bs=Object.defineProperty;var Jr=r=>{throw TypeError(r)};var Es=(r,e,t)=>e in r?bs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var h=(r,e,t)=>Es(r,typeof e!="symbol"?e+"":e,t),Gt=(r,e,t)=>e.has(r)||Jr("Cannot "+t);var k=(r,e,t)=>(Gt(r,e,"read from private field"),t?t.call(r):e.get(r)),P=(r,e,t)=>e.has(r)?Jr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Z=(r,e,t,n)=>(Gt(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),lt=(r,e,t)=>(Gt(r,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./states-D6BEdwDG.cjs"),An=!1;var Mn=Array.isArray,Ss=Array.prototype.indexOf,Cs=Array.from,rr=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Ts=Object.prototype,As=Array.prototype,Ms=Object.getPrototypeOf,Kr=Object.isExtensible;function Os(r){for(var e=0;e<r.length;e++)r[e]()}function Ns(){var r,e,t=new Promise((n,s)=>{r=n,e=s});return{promise:t,resolve:r,reject:e}}const G=2,Ar=4,On=8,qt=16,Ce=32,nt=64,Nn=128,X=256,Rt=512,F=1024,te=2048,Pe=4096,Ge=8192,st=16384,Mr=32768,Rs=65536,Qr=1<<17,Is=1<<18,Or=1<<19,Rn=1<<20,nr=1<<21,Nr=1<<22,Oe=1<<23,Mt=Symbol("$state"),Rr=new class extends Error{constructor(){super(...arguments);h(this,"name","StaleReactionError");h(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Ls(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function Ds(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ps(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Zs(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function js(r){throw new Error("https://svelte.dev/e/effect_orphan")}function Fs(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function zs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Vs(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Bs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}const Us=2,j=Symbol();function In(r){return r===this.v}let $s=!1,se=null;function It(r){se=r}function Ir(r,e=!1,t){se={p:se,c:null,e:null,s:r,x:null,l:null}}function Lr(r){var e=se,t=e.e;if(t!==null){e.e=null;for(var n of t)Hn(n)}return r!==void 0&&(e.x=r),se=e.p,r??{}}function Ln(){return!0}const qs=new WeakMap;function Ws(r){var e=M;if(e===null)return S.f|=Oe,r;if((e.f&Mr)===0){if((e.f&Nn)===0)throw!e.parent&&r instanceof Error&&Dn(r),r;e.b.error(r)}else Dr(r,e)}function Dr(r,e){for(;e!==null;){if((e.f&Nn)!==0)try{e.b.error(r);return}catch(t){r=t}e=e.parent}throw r instanceof Error&&Dn(r),r}function Dn(r){const e=qs.get(r);e&&(rr(r,"message",{value:e.message}),rr(r,"stack",{value:e.stack}))}let Lt=[];function Ys(){var r=Lt;Lt=[],Os(r)}function Hs(r){Lt.length===0&&queueMicrotask(Ys),Lt.push(r)}function Xs(){for(var r=M.b;r!==null&&!r.has_pending_snippet();)r=r.parent;return r===null&&Ls(),r}function Gs(r){var e=G|te,t=S!==null&&(S.f&G)!==0?S:null;return M===null||t!==null&&(t.f&X)!==0?e|=X:M.f|=Or,{ctx:se,deps:null,effects:null,equals:In,f:e,fn:r,reactions:null,rv:0,v:j,wv:0,parent:t??M,ac:null}}function Js(r,e){let t=M;t===null&&Ds();var n=t.b,s=void 0,a=Vn(j),i=null,o=!S;return ua(()=>{try{var l=r()}catch(v){l=Promise.reject(v)}var u=()=>l;s=(i==null?void 0:i.then(u,u))??Promise.resolve(l),i=s;var d=ne,f=n.pending;o&&(n.update_pending_count(1),f||d.increment());const p=(v,x=void 0)=>{i=null,f||d.activate(),x?x!==Rr&&(a.f|=Oe,ir(a,x)):((a.f&Oe)!==0&&(a.f^=Oe),ir(a,v)),o&&(n.update_pending_count(-1),f||d.decrement()),jn()};if(s.then(p,v=>p(null,v||"unknown")),d)return()=>{queueMicrotask(()=>d.neuter())}}),new Promise(l=>{function u(d){function f(){d===s?l(a):u(s)}d.then(f,f)}u(s)})}function Pn(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Le(e[t])}}function Ks(r){for(var e=r.parent;e!==null;){if((e.f&G)===0)return e;e=e.parent}return null}function Pr(r){var e,t=M;Je(Ks(r));try{Pn(r),e=ns(r)}finally{Je(t)}return e}function Zn(r){var e=Pr(r);if(r.equals(e)||(r.v=e,r.wv=ts()),!at)if(ye!==null)ye.set(r,r.v);else{var t=(we||(r.f&X)!==0)&&r.deps!==null?Pe:F;U(r,t)}}function Qs(r,e,t){const n=Gs;if(e.length===0){t(r.map(n));return}var s=ne,a=M,i=ea(),o=Xs();Promise.all(e.map(l=>Js(l))).then(l=>{s==null||s.activate(),i();try{t([...r.map(n),...l])}catch(u){(a.f&st)===0&&Dr(u,a)}s==null||s.deactivate(),jn()}).catch(l=>{o.error(l)})}function ea(){var r=M,e=S,t=se;return function(){Je(r),be(e),It(t)}}function jn(){Je(null),be(null),It(null)}const Tt=new Set;let ne=null,ye=null,en=new Set,ut=[],Zr=null,sr=!1;var wt,We,Ye,ge,kt,xt,Te,He,_e,ce,Ae,pe,Fn,zn,ar;const Ur=class Ur{constructor(){P(this,pe);P(this,wt,new Map);P(this,We,new Map);P(this,Ye,new Set);P(this,ge,0);P(this,kt,null);P(this,xt,!1);P(this,Te,[]);P(this,He,[]);P(this,_e,[]);P(this,ce,[]);P(this,Ae,[]);h(this,"skipped_effects",new Set)}capture(e,t){k(this,We).has(e)||k(this,We).set(e,t),k(this,wt).set(e,e.v)}activate(){ne=this}deactivate(){ne=null;for(const e of en)if(en.delete(e),e(),ne!==null)break}neuter(){Z(this,xt,!0)}flush(){ut.length>0?this.flush_effects():lt(this,pe,ar).call(this),ne===this&&(k(this,ge)===0&&Tt.delete(this),this.deactivate())}flush_effects(){var e=$e;sr=!0;try{var t=0;for(nn(!0);ut.length>0;){if(t++>1e3){var n,s;ta()}lt(this,pe,Fn).call(this,ut),Re.clear()}}finally{sr=!1,nn(e),Zr=null}}increment(){Z(this,ge,k(this,ge)+1)}decrement(){if(Z(this,ge,k(this,ge)-1),k(this,ge)===0){for(const e of k(this,_e))U(e,te),Ne(e);for(const e of k(this,ce))U(e,te),Ne(e);for(const e of k(this,Ae))U(e,te),Ne(e);Z(this,_e,[]),Z(this,ce,[]),this.flush()}else this.deactivate()}add_callback(e){k(this,Ye).add(e)}settled(){return(k(this,kt)??Z(this,kt,Ns())).promise}static ensure(e=!0){if(ne===null){const t=ne=new Ur;Tt.add(ne),e&&queueMicrotask(()=>{ne===t&&t.flush()})}return ne}};wt=new WeakMap,We=new WeakMap,Ye=new WeakMap,ge=new WeakMap,kt=new WeakMap,xt=new WeakMap,Te=new WeakMap,He=new WeakMap,_e=new WeakMap,ce=new WeakMap,Ae=new WeakMap,pe=new WeakSet,Fn=function(e){var a;ut=[];var t=null;if(Tt.size>1){t=new Map,ye=new Map;for(const[i,o]of k(this,wt))t.set(i,{v:i.v,wv:i.wv}),i.v=o;for(const i of Tt)if(i!==this)for(const[o,l]of k(i,We))t.has(o)||(t.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(const i of e)lt(this,pe,zn).call(this,i);if(k(this,Te).length===0&&k(this,ge)===0){var n=k(this,_e),s=k(this,ce);Z(this,_e,[]),Z(this,ce,[]),Z(this,Ae,[]),lt(this,pe,ar).call(this),tn(n),tn(s),(a=k(this,kt))==null||a.resolve()}else{for(const i of k(this,_e))U(i,F);for(const i of k(this,ce))U(i,F);for(const i of k(this,Ae))U(i,F)}if(t){for(const[i,{v:o,wv:l}]of t)i.wv<=l&&(i.v=o);ye=null}for(const i of k(this,Te))ht(i);for(const i of k(this,He))ht(i);Z(this,Te,[]),Z(this,He,[])},zn=function(e){var d;e.f^=F;for(var t=e.first;t!==null;){var n=t.f,s=(n&(Ce|nt))!==0,a=s&&(n&F)!==0,i=a||(n&Ge)!==0||this.skipped_effects.has(t);if(!i&&t.fn!==null){if(s)t.f^=F;else if((n&Ar)!==0)k(this,ce).push(t);else if(Wt(t))if((n&Nr)!==0){var o=(d=t.b)!=null&&d.pending?k(this,He):k(this,Te);o.push(t)}else(t.f&qt)!==0&&k(this,Ae).push(t),ht(t);var l=t.first;if(l!==null){t=l;continue}}var u=t.parent;for(t=t.next;t===null&&u!==null;)t=u.next,u=u.parent}},ar=function(){if(!k(this,xt))for(const e of k(this,Ye))e();k(this,Ye).clear()};let Dt=Ur;function ta(){try{Fs()}catch(r){Dr(r,Zr)}}function tn(r){var e=r.length;if(e!==0){for(var t=0;t<e;t++){var n=r[t];if((n.f&(st|Ge))===0&&Wt(n)){var s=Pt;if(ht(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?Qn(n):n.fn=null),Pt>s&&(n.f&Rn)!==0)break}}for(;t<e;t+=1)Ne(r[t])}}function Ne(r){for(var e=Zr=r;e.parent!==null;){e=e.parent;var t=e.f;if(sr&&e===M&&(t&qt)!==0)return;if((t&(nt|Ce))!==0){if((t&F)===0)return;e.f^=F}}ut.push(e)}const Re=new Map;function Vn(r,e){var t={f:0,v:r,reactions:null,equals:In,rv:0,wv:0};return t}function q(r,e){const t=Vn(r);return ma(t),t}function B(r,e,t=!1){S!==null&&(!ae||(S.f&Qr)!==0)&&Ln()&&(S.f&(G|qt|Nr|Qr))!==0&&!($!=null&&$.includes(r))&&Bs();let n=t?dt(e):e;return ir(r,n)}function ir(r,e){if(!r.equals(e)){var t=r.v;at?Re.set(r,e):Re.set(r,t),r.v=e,Dt.ensure().capture(r,t),(r.f&G)!==0&&((r.f&te)!==0&&Pr(r),U(r,(r.f&X)===0?F:Pe)),r.wv=ts(),Bn(r,te),M!==null&&(M.f&F)!==0&&(M.f&(Ce|nt))===0&&(ee===null?va([r]):ee.push(r))}return e}function Jt(r){B(r,r.v+1)}function Bn(r,e){var t=r.reactions;if(t!==null)for(var n=t.length,s=0;s<n;s++){var a=t[s],i=a.f;(i&te)===0&&(U(a,e),(i&(F|X))!==0&&((i&G)!==0?Bn(a,Pe):Ne(a)))}}function dt(r){if(typeof r!="object"||r===null||Mt in r)return r;const e=Ms(r);if(e!==Ts&&e!==As)return r;var t=new Map,n=Mn(r),s=q(0),a=Ie,i=o=>{if(Ie===a)return o();var l=S,u=Ie;be(null),an(a);var d=o();return be(l),an(u),d};return n&&t.set("length",q(r.length)),new Proxy(r,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&zs();var d=t.get(l);return d===void 0?d=i(()=>{var f=q(u.value);return t.set(l,f),f}):B(d,u.value,!0),!0},deleteProperty(o,l){var u=t.get(l);if(u===void 0){if(l in o){const d=i(()=>q(j));t.set(l,d),Jt(s)}}else B(u,j),Jt(s);return!0},get(o,l,u){var v;if(l===Mt)return r;var d=t.get(l),f=l in o;if(d===void 0&&(!f||(v=ft(o,l))!=null&&v.writable)&&(d=i(()=>{var x=dt(f?o[l]:j),N=q(x);return N}),t.set(l,d)),d!==void 0){var p=L(d);return p===j?void 0:p}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var d=t.get(l);d&&(u.value=L(d))}else if(u===void 0){var f=t.get(l),p=f==null?void 0:f.v;if(f!==void 0&&p!==j)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(o,l){var p;if(l===Mt)return!0;var u=t.get(l),d=u!==void 0&&u.v!==j||Reflect.has(o,l);if(u!==void 0||M!==null&&(!d||(p=ft(o,l))!=null&&p.writable)){u===void 0&&(u=i(()=>{var v=d?dt(o[l]):j,x=q(v);return x}),t.set(l,u));var f=L(u);if(f===j)return!1}return d},set(o,l,u,d){var z;var f=t.get(l),p=l in o;if(n&&l==="length")for(var v=u;v<f.v;v+=1){var x=t.get(v+"");x!==void 0?B(x,j):v in o&&(x=i(()=>q(j)),t.set(v+"",x))}if(f===void 0)(!p||(z=ft(o,l))!=null&&z.writable)&&(f=i(()=>q(void 0)),B(f,dt(u)),t.set(l,f));else{p=f.v!==j;var N=i(()=>dt(u));B(f,N)}var I=Reflect.getOwnPropertyDescriptor(o,l);if(I!=null&&I.set&&I.set.call(d,u),!p){if(n&&typeof l=="string"){var K=t.get("length"),T=Number(l);Number.isInteger(T)&&T>=K.v&&B(K,T+1)}Jt(s)}return!0},ownKeys(o){L(s);var l=Reflect.ownKeys(o).filter(f=>{var p=t.get(f);return p===void 0||p.v!==j});for(var[u,d]of t)d.v!==j&&!(u in o)&&l.push(u);return l},setPrototypeOf(){Vs()}})}var rn,Un,$n,qn;function ra(){if(rn===void 0){rn=window,Un=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;$n=ft(e,"firstChild").get,qn=ft(e,"nextSibling").get,Kr(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),Kr(t)&&(t.__t=void 0)}}function na(r=""){return document.createTextNode(r)}function Wn(r){return $n.call(r)}function Yn(r){return qn.call(r)}function or(r,e){return Wn(r)}function sa(r,e=1,t=!1){let n=r;for(;e--;)n=Yn(n);return n}function aa(r){M===null&&S===null&&js(),S!==null&&(S.f&X)!==0&&M===null&&Zs(),at&&Ps()}function ia(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Ze(r,e,t,n=!0){var s=M;s!==null&&(s.f&Ge)!==0&&(r|=Ge);var a={ctx:se,deps:null,nodes_start:null,nodes_end:null,f:r|te,first:null,fn:e,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(t)try{ht(a),a.f|=Mr}catch(l){throw Le(a),l}else e!==null&&Ne(a);var i=t&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&Or)===0;if(!i&&n&&(s!==null&&ia(a,s),S!==null&&(S.f&G)!==0)){var o=S;(o.effects??(o.effects=[])).push(a)}return a}function de(r){aa();var e=M.f,t=!S&&(e&Ce)!==0&&(e&Mr)===0;if(t){var n=se;(n.e??(n.e=[])).push(r)}else return Hn(r)}function Hn(r){return Ze(Ar|Rn,r,!1)}function oa(r){Dt.ensure();const e=Ze(nt,r,!0);return(t={})=>new Promise(n=>{t.outro?ha(e,()=>{Le(e),n(void 0)}):(Le(e),n(void 0))})}function la(r){return Ze(Ar,r,!1)}function ua(r){return Ze(Nr|Or,r,!0)}function Xn(r,e=0){return Ze(On|e,r,!0)}function Gn(r,e=[],t=[]){Qs(e,t,n=>{Ze(On,()=>r(...n.map(L)),!0)})}function da(r,e=!0){return Ze(Ce,r,!0,e)}function Jn(r){var e=r.teardown;if(e!==null){const t=at,n=S;sn(!0),be(null);try{e.call(null)}finally{sn(t),be(n)}}}function Kn(r,e=!1){var s;var t=r.first;for(r.first=r.last=null;t!==null;){(s=t.ac)==null||s.abort(Rr);var n=t.next;(t.f&nt)!==0?t.parent=null:Le(t,e),t=n}}function ca(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&Ce)===0&&Le(e),e=t}}function Le(r,e=!0){var t=!1;(e||(r.f&Is)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(fa(r.nodes_start,r.nodes_end),t=!0),Kn(r,e&&!t),Zt(r,0),U(r,st);var n=r.transitions;if(n!==null)for(const a of n)a.stop();Jn(r);var s=r.parent;s!==null&&s.first!==null&&Qn(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=r.ac=null}function fa(r,e){for(;r!==null;){var t=r===e?null:Yn(r);r.remove(),r=t}}function Qn(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function ha(r,e){var t=[];es(r,t,!0),pa(t,()=>{Le(r),e&&e()})}function pa(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var s of r)s.out(n)}else e()}function es(r,e,t){if((r.f&Ge)===0){if(r.f^=Ge,r.transitions!==null)for(const i of r.transitions)(i.is_global||t)&&e.push(i);for(var n=r.first;n!==null;){var s=n.next,a=(n.f&Rs)!==0||(n.f&Ce)!==0;es(n,e,a?t:!1),n=s}}}let $e=!1;function nn(r){$e=r}let at=!1;function sn(r){at=r}let S=null,ae=!1;function be(r){S=r}let M=null;function Je(r){M=r}let $=null;function ma(r){S!==null&&($===null?$=[r]:$.push(r))}let V=null,Y=0,ee=null;function va(r){ee=r}let Pt=1,mt=0,Ie=mt;function an(r){Ie=r}let we=!1;function ts(){return++Pt}function Wt(r){var f;var e=r.f;if((e&te)!==0)return!0;if((e&Pe)!==0){var t=r.deps,n=(e&X)!==0;if(t!==null){var s,a,i=(e&Rt)!==0,o=n&&M!==null&&!we,l=t.length;if((i||o)&&(M===null||(M.f&st)===0)){var u=r,d=u.parent;for(s=0;s<l;s++)a=t[s],(i||!((f=a==null?void 0:a.reactions)!=null&&f.includes(u)))&&(a.reactions??(a.reactions=[])).push(u);i&&(u.f^=Rt),o&&d!==null&&(d.f&X)===0&&(u.f^=X)}for(s=0;s<l;s++)if(a=t[s],Wt(a)&&Zn(a),a.wv>r.wv)return!0}(!n||M!==null&&!we)&&U(r,F)}return!1}function rs(r,e,t=!0){var n=r.reactions;if(n!==null&&!($!=null&&$.includes(r)))for(var s=0;s<n.length;s++){var a=n[s];(a.f&G)!==0?rs(a,e,!1):e===a&&(t?U(a,te):(a.f&F)!==0&&U(a,Pe),Ne(a))}}function ns(r){var x;var e=V,t=Y,n=ee,s=S,a=we,i=$,o=se,l=ae,u=Ie,d=r.f;V=null,Y=0,ee=null,we=(d&X)!==0&&(ae||!$e||S===null),S=(d&(Ce|nt))===0?r:null,$=null,It(r.ctx),ae=!1,Ie=++mt,r.ac!==null&&(r.ac.abort(Rr),r.ac=null);try{r.f|=nr;var f=(0,r.fn)(),p=r.deps;if(V!==null){var v;if(Zt(r,Y),p!==null&&Y>0)for(p.length=Y+V.length,v=0;v<V.length;v++)p[Y+v]=V[v];else r.deps=p=V;if(!we||(d&G)!==0&&r.reactions!==null)for(v=Y;v<p.length;v++)((x=p[v]).reactions??(x.reactions=[])).push(r)}else p!==null&&Y<p.length&&(Zt(r,Y),p.length=Y);if(Ln()&&ee!==null&&!ae&&p!==null&&(r.f&(G|Pe|te))===0)for(v=0;v<ee.length;v++)rs(ee[v],r);return s!==null&&s!==r&&(mt++,ee!==null&&(n===null?n=ee:n.push(...ee))),(r.f&Oe)!==0&&(r.f^=Oe),f}catch(N){return Ws(N)}finally{r.f^=nr,V=e,Y=t,ee=n,S=s,we=a,$=i,It(o),ae=l,Ie=u}}function ga(r,e){let t=e.reactions;if(t!==null){var n=Ss.call(t,r);if(n!==-1){var s=t.length-1;s===0?t=e.reactions=null:(t[n]=t[s],t.pop())}}t===null&&(e.f&G)!==0&&(V===null||!V.includes(e))&&(U(e,Pe),(e.f&(X|Rt))===0&&(e.f^=Rt),Pn(e),Zt(e,0))}function Zt(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)ga(r,t[n])}function ht(r){var e=r.f;if((e&st)===0){U(r,F);var t=M,n=$e;M=r,$e=!0;try{(e&qt)!==0?ca(r):Kn(r),Jn(r);var s=ns(r);r.teardown=typeof s=="function"?s:null,r.wv=Pt;var a;An&&$s&&(r.f&te)!==0&&r.deps}finally{$e=n,M=t}}}function L(r){var e=r.f,t=(e&G)!==0;if(S!==null&&!ae){var n=M!==null&&(M.f&st)!==0;if(!n&&!($!=null&&$.includes(r))){var s=S.deps;if((S.f&nr)!==0)r.rv<mt&&(r.rv=mt,V===null&&s!==null&&s[Y]===r?Y++:V===null?V=[r]:(!we||!V.includes(r))&&V.push(r));else{(S.deps??(S.deps=[])).push(r);var a=r.reactions;a===null?r.reactions=[S]:a.includes(S)||a.push(S)}}}else if(t&&r.deps===null&&r.effects===null){var i=r,o=i.parent;o!==null&&(o.f&X)===0&&(i.f^=X)}if(at){if(Re.has(r))return Re.get(r);if(t){i=r;var l=i.v;return((i.f&F)!==0||ss(i))&&(l=Pr(i)),Re.set(i,l),l}}else if(t){if(i=r,ye!=null&&ye.has(i))return ye.get(i);Wt(i)&&Zn(i)}if((r.f&Oe)!==0)throw r.v;return r.v}function ss(r){if(r.v===j)return!0;if(r.deps===null)return!1;for(const e of r.deps)if(Re.has(e)||(e.f&G)!==0&&ss(e))return!0;return!1}function _a(r){var e=ae;try{return ae=!0,r()}finally{ae=e}}const ya=-7169;function U(r,e){r.f=r.f&ya|e}const wa=["touchstart","touchmove"];function ka(r){return wa.includes(r)}const xa=new Set,on=new Set;function At(r){var T;var e=this,t=e.ownerDocument,n=r.type,s=((T=r.composedPath)==null?void 0:T.call(r))||[],a=s[0]||r.target,i=0,o=r.__root;if(o){var l=s.indexOf(o);if(l!==-1&&(e===document||e===window)){r.__root=e;return}var u=s.indexOf(e);if(u===-1)return;l<=u&&(i=l)}if(a=s[i]||r.target,a!==e){rr(r,"currentTarget",{configurable:!0,get(){return a||t}});var d=S,f=M;be(null),Je(null);try{for(var p,v=[];a!==null;){var x=a.assignedSlot||a.parentNode||a.host||null;try{var N=a["__"+n];if(N!=null&&(!a.disabled||r.target===a))if(Mn(N)){var[I,...K]=N;I.apply(a,[r,...K])}else N.call(a,r)}catch(z){p?v.push(z):p=z}if(r.cancelBubble||x===e||x===null)break;a=x}if(p){for(let z of v)queueMicrotask(()=>{throw z});throw p}}finally{r.__root=e,delete r.currentTarget,be(d),Je(f)}}}function ba(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function Ea(r,e){var t=M;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function as(r,e){var t=(e&Us)!==0,n,s=!r.startsWith("<!>");return()=>{n===void 0&&(n=ba(s?r:"<!>"+r),n=Wn(n));var a=t||Un?document.importNode(n,!0):n.cloneNode(!0);return Ea(a,a),a}}function is(r,e){r!==null&&r.before(e)}function jr(r,e){return Sa(r,e)}const Fe=new Map;function Sa(r,{target:e,anchor:t,props:n={},events:s,context:a,intro:i=!0}){ra();var o=new Set,l=f=>{for(var p=0;p<f.length;p++){var v=f[p];if(!o.has(v)){o.add(v);var x=ka(v);e.addEventListener(v,At,{passive:x});var N=Fe.get(v);N===void 0?(document.addEventListener(v,At,{passive:x}),Fe.set(v,1)):Fe.set(v,N+1)}}};l(Cs(xa)),on.add(l);var u=void 0,d=oa(()=>{var f=t??e.appendChild(na());return da(()=>{if(a){Ir({});var p=se;p.c=a}s&&(n.$$events=s),u=r(f,n)||{},a&&Lr()}),()=>{var x;for(var p of o){e.removeEventListener(p,At);var v=Fe.get(p);--v===0?(document.removeEventListener(p,At),Fe.delete(p)):Fe.set(p,v)}on.delete(l),f!==t&&((x=f.parentNode)==null||x.removeChild(f))}});return Ca.set(u,d),u}let Ca=new WeakMap;const ln=[...`
2
+ \r\f \v\uFEFF`];function Ta(r,e,t){var n=r==null?"":""+r;if(t){for(var s in t)if(t[s])n=n?n+" "+s:s;else if(n.length)for(var a=s.length,i=0;(i=n.indexOf(s,i))>=0;){var o=i+a;(i===0||ln.includes(n[i-1]))&&(o===n.length||ln.includes(n[o]))?n=(i===0?"":n.substring(0,i))+n.substring(o+1):i=o}}return n===""?null:n}function un(r,e=!1){var t=e?" !important;":";",n="";for(var s in r){var a=r[s];a!=null&&a!==""&&(n+=" "+s+": "+a+t)}return n}function Kt(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Aa(r,e){if(e){var t="",n,s;if(Array.isArray(e)?(n=e[0],s=e[1]):n=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var a=!1,i=0,o=!1,l=[];n&&l.push(...Object.keys(n).map(Kt)),s&&l.push(...Object.keys(s).map(Kt));var u=0,d=-1;const N=r.length;for(var f=0;f<N;f++){var p=r[f];if(o?p==="/"&&r[f-1]==="*"&&(o=!1):a?a===p&&(a=!1):p==="/"&&r[f+1]==="*"?o=!0:p==='"'||p==="'"?a=p:p==="("?i++:p===")"&&i--,!o&&a===!1&&i===0){if(p===":"&&d===-1)d=f;else if(p===";"||f===N-1){if(d!==-1){var v=Kt(r.substring(u,d).trim());if(!l.includes(v)){p!==";"&&f++;var x=r.substring(u,f).trim();t+=" "+x+";"}}u=f+1,d=-1}}}}return n&&(t+=un(n)),s&&(t+=un(s,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function os(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Ta(t,n,a);o==null?r.removeAttribute("class"):r.className=o,r.__className=t}else if(a&&s!==a)for(var l in a){var u=!!a[l];(s==null||u!==!!s[l])&&r.classList.toggle(l,u)}return a}function Qt(r,e={},t,n){for(var s in t){var a=t[s];e[s]!==a&&(t[s]==null?r.style.removeProperty(s):r.style.setProperty(s,a,n))}}function jt(r,e,t,n){var s=r.__style;if(s!==e){var a=Aa(e,n);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}else n&&(Array.isArray(n)?(Qt(r,t==null?void 0:t[0],n[0]),Qt(r,t==null?void 0:t[1],n[1],"important")):Qt(r,t,n));return n}const Ma=()=>performance.now(),ie={tick:r=>requestAnimationFrame(r),now:()=>Ma(),tasks:new Set};function ls(){const r=ie.now();ie.tasks.forEach(e=>{e.c(r)||(ie.tasks.delete(e),e.f())}),ie.tasks.size!==0&&ie.tick(ls)}function Oa(r){let e;return ie.tasks.size===0&&ie.tick(ls),{promise:new Promise(t=>{ie.tasks.add(e={c:r,f:t})}),abort(){ie.tasks.delete(e)}}}function dn(r,e){return r===e||(r==null?void 0:r[Mt])===e}function Ve(r={},e,t,n){return la(()=>{var s,a;return Xn(()=>{s=a,a=[],_a(()=>{r!==t(...a)&&(e(r,...a),s&&dn(t(...s),r)&&e(null,...s))})}),()=>{Hs(()=>{a&&dn(t(...a),r)&&e(null,...a)})}}),r}const Na="5";var Tn;typeof window<"u"&&((Tn=window.__svelte??(window.__svelte={})).v??(Tn.v=new Set)).add(Na);function Ra(r){return r}function lr(r){return-.5*(Math.cos(Math.PI*r)-1)}function Ia(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function La(r){return Math.sin(r*Math.PI/2)}const Da=128,Pa=0,Za=1,ja=2;class Fa{constructor(){h(this,"animationsStarted",!1);h(this,"animationsCount",0);h(this,"animationsLimit",Da);h(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let e=0;e<this.layers.length;e++){const t=this.layers[e];if(t==null)continue;const n=t.animations;if(n!=null)for(let s=0;s<n.length;s++){const a=n[s];if(a!=null){for(const i of a.values())if(!i.executed&&(i.executed=!0,i.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}catch{}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,t,n,s){let a=this.layers[e];a==null&&(a=this.layers[e]={animations:new Array});let i=a.animations[t];i==null&&(i=a.animations[t]=new Map);let o={id:n,priority:t,executed:!1,function:s};i.set(n,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,t){for(let n=0;n<this.layers.length;n++){let s=this.layers[n];if(s==null)continue;let a=s.animations[e];if(a==null)return;let i=a.get(t);if(i==null||i.executed==!1)return;a.delete(t)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const ve=new Fa;function cn(r){return Object.prototype.toString.call(r)==="[object Date]"}function ur(r,e){if(r===e||r!==r)return()=>r;const t=typeof r;if(t!==typeof e||Array.isArray(r)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(r)){const n=e.map((s,a)=>ur(r[a],s));return s=>n.map(a=>a(s))}if(t==="object"){if(!r||!e)throw new Error("Object cannot be null");if(cn(r)&&cn(e)){const a=r.getTime(),o=e.getTime()-a;return l=>new Date(a+l*o)}const n=Object.keys(e),s={};return n.forEach(a=>{s[a]=ur(r[a],e[a])}),a=>{const i={};return n.forEach(o=>{i[o]=s[o](a)}),i}}if(t==="number"){const n=e-r;return s=>r+s*n}return()=>e}var fe,Xe,bt,Me;const $r=class $r{constructor(e,t={}){P(this,fe);P(this,Xe);P(this,bt);P(this,Me,null);Z(this,fe,q(e)),Z(this,Xe,q(e)),Z(this,bt,t)}static of(e,t){const n=new $r(e(),t);return Xn(()=>{n.set(e())}),n}set(e,t){var f;B(k(this,Xe),e);let{delay:n=0,duration:s=400,easing:a=Ra,interpolate:i=ur}={...k(this,bt),...t};if(s===0)return(f=k(this,Me))==null||f.abort(),B(k(this,fe),e),Promise.resolve();const o=ie.now()+n;let l,u=!1,d=k(this,Me);return Z(this,Me,Oa(p=>{if(p<o)return!0;if(!u){u=!0;const x=k(this,fe).v;l=i(x,e),typeof s=="function"&&(s=s(x,e)),d==null||d.abort()}const v=p-o;return v>s?(B(k(this,fe),e),!1):(B(k(this,fe),l(a(v/s))),!0)})),k(this,Me).promise}get current(){return L(k(this,fe))}get target(){return L(k(this,Xe))}set target(e){this.set(e)}};fe=new WeakMap,Xe=new WeakMap,bt=new WeakMap,Me=new WeakMap;let dr=$r;class Ot{constructor(e,t){h(this,"value");h(this,"motion");this.value=e,this.motion=new dr(e,t)}set(e,t){this.value=e,this.motion.set(e,t)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}var za=as('<div><div class="body svelte-1nfn9j8"></div></div>');function Va(r,e){Ir(e,!0);let t,n;function s(){return n}let a=q(!1);function i(T){B(a,T,!0)}function o(){return L(a)}let l=new Ot(0,{easing:lr});de(()=>{u(l.motion.current)}),de(()=>{L(a)==!1&&(l.snap(),ve.clear(e.priority,e.id))});function u(T){t&&ve.equeue(e.layer,e.priority,e.id,()=>{t.style.scale=T.toString(),t.style.filter=`brightness(${.25+.75*T})`,n.style.opacity=T.toString()})}function d(T){T!=l.value&&l.set(T,{duration:75})}function f(){return l.motion.current==0}function p(){return l.value}var v=za();let x,N;var I=or(v);let K;return Ve(I,T=>n=T,()=>n),Ve(v,T=>t=T,()=>t),Gn((T,z,Q)=>{x=os(v,1,"pin svelte-1nfn9j8",null,x,T),N=jt(v,"",N,z),K=jt(I,"",K,Q)},[()=>({displayed:L(a)}),()=>({width:`${e.width}px`,height:`${e.height}px`,"border-radius":`${e.radius}px`}),()=>({width:`${e.width-4}px`,height:`${e.height-4}px`,"border-radius":`${e.radius-2}px`})]),is(r,v),Lr({getBody:s,setDisplayed:i,getDisplayed:o,setScale:d,getCollapsed:f,getScale:p})}var Ba=as('<div><div class="pointer svelte-j5igi2"></div> <div class="bubble svelte-j5igi2"><div class="body svelte-j5igi2"></div></div></div>');function us(r,e){Ir(e,!0);let t,n,s,a;const i=e.width+2*e.margin,o=e.height+2*e.margin,l=()=>a;de(()=>{s.style.width=`${e.margin*4}px`,s.style.height=`${e.margin*4}px`});let u=q(!0);function d(O){B(u,O,!0)}function f(){return L(u)}let p=q(!0);function v(O){B(p,O,!0)}function x(){return I.motion.current==0}function N(){return I.motion.current==1}let I=new Ot(0);de(()=>{K(I.motion.current)}),de(()=>{L(u)==!1&&(I.snap(),ve.clear(e.priority,e.id+"_scale"))}),de(()=>{L(p)==!0&&I.value!=0&&(ve.stacked()?I.set(0,{duration:0}):I.set(0,{duration:150,easing:Ia})),L(p)==!1&&I.value!=1&&I.set(1,{duration:150,easing:La})});function K(O){!t||!n||!s||ve.equeue(L(p)?0:e.layer,e.priority,e.id+"_scale",()=>{t.style.opacity=`${O}`,n.style.scale=`${O}`,s.style.scale=`${O}`})}let T=NaN,z=q(!1),Q=new Ot(-i/2,{easing:lr}),Et=new Ot(-o/2,{easing:lr});de(()=>{qr(Q.motion.current,Et.motion.current)}),de(()=>{L(u)==!1&&(Q.snap(),Q.snap(),ve.clear(e.priority,e.id+"_angle"))}),de(()=>{L(p)==!0&&L(z)&&(Q.update({duration:75}),Q.update({duration:75}))});function qr(O,ue){if(!t||!n||!s)return;const Ct=O+i/2,it=ue+o/2,je=o<i?Ct*o/i:Ct,Ht=o>i?it*i/o:it,_s=Math.atan2(Ht,je)/Math.PI*180-45,Xr=0,ys=30,Xt=Math.sqrt(je*je+Ht*Ht),ot=Math.min(i,o)/2,ws=ot*Math.SQRT2,ks=(Xt-ot)/(ws-ot),Gr=Xr+ks*(ys-Xr),xs=Xt<ot?Xt/ot:1;ve.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(O)}px, ${Math.round(ue)}px)`,s.style.transform=`scale(${xs}) rotate(${_s}deg) skew(${Gr}deg, ${Gr}deg)`})}function vs(O){if(L(z)==!1){let ue=H.Rectangle.getOffsets(i,o,O);Q.set(Math.round(ue.offsetX),{duration:0}),Et.set(Math.round(ue.offsetY),{duration:0}),qr(Q.value,Et.value),T=O,B(z,!0)}else if(O!=T){let ue=Math.abs(O-T),Ct=ue<180?ue:360-ue,it=Math.log(Ct)*75,je=H.Rectangle.getOffsets(i,o,O);Q.set(Math.round(je.offsetX),{duration:it}),Et.set(Math.round(je.offsetY),{duration:it}),T=O}}function gs(){return H.Rectangle.getOffsets(i,o,T)}var St=Ba();let Wr;var Yr=or(St);Ve(Yr,O=>s=O,()=>s);var Yt=sa(Yr,2),Hr=or(Yt);return Ve(Hr,O=>a=O,()=>a),Ve(Yt,O=>n=O,()=>n),Ve(St,O=>t=O,()=>t),Gn(O=>{Wr=os(St,1,"anchor svelte-j5igi2",null,Wr,O),jt(Yt,`margin: ${e.margin}px;`),jt(Hr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)},[()=>({displayed:L(u)})]),is(r,St),Lr({getBody:l,setDisplayed:d,getDisplayed:f,setCollapsed:v,getCollapsed:x,getExpanded:N,setAngle:vs,getOffsets:gs})}class ds{constructor(e,t,n,s,a){h(this,"swLat");h(this,"swLng");h(this,"neLat");h(this,"neLng");const i=n*Math.pow(2,t),o=H.Mercator.project(e.sw.lat,e.sw.lng,i),l=H.Mercator.project(e.ne.lat,e.ne.lng,i),u=o.x-s,d=o.y+a,f=l.x+s,p=l.y-a,v=H.Mercator.unproject(u,d,i),x=H.Mercator.unproject(f,p,i);this.swLat=v.lat,this.swLng=v.lng,this.neLat=x.lat,this.neLng=x.lng}contains(e,t){return this.swLat<=e&&e<=this.neLat?this.swLng<this.neLng?this.swLng<=t&&t<=this.neLng:t<=this.neLng||this.swLng<=t:!1}}var A;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(A||(A={}));var fn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(fn||(fn={}));const g=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),me=r=>{switch(typeof r){case"undefined":return g.undefined;case"string":return g.string;case"number":return Number.isNaN(r)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(r)?g.array:r===null?g.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?g.promise:typeof Map<"u"&&r instanceof Map?g.map:typeof Set<"u"&&r instanceof Set?g.set:typeof Date<"u"&&r instanceof Date?g.date:g.object;default:return g.unknown}},c=A.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class re extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return s(this),n}static assert(e){if(!(e instanceof re))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}re.create=r=>new re(r);const vt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===g.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,A.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${A.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${A.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${A.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:A.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,A.assertNever(r)}return{message:t}};let Ua=vt;function cr(){return Ua}const fr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const l=n.filter(u=>!!u).slice().reverse();for(const u of l)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function m(r,e){const t=cr(),n=fr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===vt?void 0:vt].filter(s=>!!s)});r.common.issues.push(n)}class J{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return J.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const y=Object.freeze({status:"aborted"}),ct=r=>({status:"dirty",value:r}),W=r=>({status:"valid",value:r}),hn=r=>r.status==="aborted",pn=r=>r.status==="dirty",Ke=r=>r.status==="valid",Ft=r=>typeof Promise<"u"&&r instanceof Promise;var _;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_||(_={}));class Ee{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const mn=(r,e)=>{if(Ke(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new re(r.common.issues);return this._error=t,this._error}}};function b(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:l}=r;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:s}}class C{get description(){return this._def.description}_getType(e){return me(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new J,ctx:{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ft(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},s=this._parseSync({data:e,path:n.path,parent:n});return mn(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Ke(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>Ke(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ft(s)?s:Promise.resolve(s));return mn(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new tt({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return xe.create(this,this._def)}nullable(){return rt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return yt.create(this,this._def)}or(e){return Vt.create([this,e],this._def)}and(e){return Bt.create(this,e,this._def)}transform(e){return new tt({...b(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new gr({...b(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new fi({typeName:w.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new _r({...b(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Fr.create(this,e)}readonly(){return yr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const $a=/^c[^\s-]{8,}$/i,qa=/^[0-9a-z]+$/,Wa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ya=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ha=/^[a-z0-9_-]{21}$/i,Xa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ga=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ja=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ka="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let er;const Qa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ei=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ti=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ri=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ni=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,si=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cs="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ai=new RegExp(`^${cs}$`);function fs(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ii(r){return new RegExp(`^${fs(r)}$`)}function oi(r){let e=`${cs}T${fs(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function li(r,e){return!!((e==="v4"||!e)&&Qa.test(r)||(e==="v6"||!e)&&ti.test(r))}function ui(r,e){if(!Xa.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function di(r,e){return!!((e==="v4"||!e)&&ei.test(r)||(e==="v6"||!e)&&ri.test(r))}class ke extends C{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.string,received:a.parsedType}),y}const n=new J;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?m(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&m(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Ja.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")er||(er=new RegExp(Ka,"u")),er.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Ya.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ha.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")$a.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")qa.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Wa.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?oi(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ai.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ii(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Ga.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?li(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?ui(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?di(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ni.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?si.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,..._.errToObj(n)})}_addCheck(e){return new ke({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,..._.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,..._.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,..._.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new ke({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ke({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ke({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ke.create=r=>new ke({checks:[],typeName:w.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});function ci(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class Qe extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.number,received:a.parsedType}),y}let n;const s=new J;for(const a of this._def.checks)a.kind==="int"?A.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?ci(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_finite,message:a.message}),s.dirty()):A.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,s){return new Qe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new Qe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&A.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Qe.create=r=>new Qe({checks:[],typeName:w.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class gt extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let n;const s=new J;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),m(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):A.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,n,s){return new gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}gt.create=r=>new gt({checks:[],typeName:w.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});class hr extends C{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.boolean,received:n.parsedType}),y}return W(e.data)}}hr.create=r=>new hr({typeName:w.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class zt extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_type,expected:g.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return m(a,{code:c.invalid_date}),y}const n=new J;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):A.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new zt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}zt.create=r=>new zt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:w.ZodDate,...b(r)});class vn extends C{_parse(e){if(this._getType(e)!==g.symbol){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.symbol,received:n.parsedType}),y}return W(e.data)}}vn.create=r=>new vn({typeName:w.ZodSymbol,...b(r)});class gn extends C{_parse(e){if(this._getType(e)!==g.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.undefined,received:n.parsedType}),y}return W(e.data)}}gn.create=r=>new gn({typeName:w.ZodUndefined,...b(r)});class _n extends C{_parse(e){if(this._getType(e)!==g.null){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.null,received:n.parsedType}),y}return W(e.data)}}_n.create=r=>new _n({typeName:w.ZodNull,...b(r)});class pr extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}pr.create=r=>new pr({typeName:w.ZodAny,...b(r)});class qe extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}qe.create=r=>new qe({typeName:w.ZodUnknown,...b(r)});class Se extends C{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.never,received:t.parsedType}),y}}Se.create=r=>new Se({typeName:w.ZodNever,...b(r)});class mr extends C{_parse(e){if(this._getType(e)!==g.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.void,received:n.parsedType}),y}return W(e.data)}}mr.create=r=>new mr({typeName:w.ZodVoid,...b(r)});class le extends C{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==g.array)return m(t,{code:c.invalid_type,expected:g.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(m(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Ee(t,i,t.path,o)))).then(i=>J.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Ee(t,i,t.path,o)));return J.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new le({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new le({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new le({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}le.create=(r,e)=>new le({type:r,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...b(e)});function ze(r){if(r instanceof D){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=xe.create(ze(n))}return new D({...r._def,shape:()=>e})}else return r instanceof le?new le({...r._def,type:ze(r.element)}):r instanceof xe?xe.create(ze(r.unwrap())):r instanceof rt?rt.create(ze(r.unwrap())):r instanceof he?he.create(r.items.map(e=>ze(e))):r}class D extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=A.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==g.object){const u=this._getOrReturnCtx(e);return m(u,{code:c.invalid_type,expected:g.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Se&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const l=[];for(const u of i){const d=a[u],f=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Ee(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Se){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")o.length>0&&(m(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of o){const f=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Ee(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>J.mergeObjectSync(n,u)):J.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new D({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:_.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new D({...this._def,unknownKeys:"strip"})}passthrough(){return new D({...this._def,unknownKeys:"passthrough"})}extend(e){return new D({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new D({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new D({...this._def,catchall:e})}pick(e){const t={};for(const n of A.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new D({...this._def,shape:()=>t})}omit(e){const t={};for(const n of A.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new D({...this._def,shape:()=>t})}deepPartial(){return ze(this)}partial(e){const t={};for(const n of A.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new D({...this._def,shape:()=>t})}required(e){const t={};for(const n of A.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof xe;)a=a._def.innerType;t[n]=a}return new D({...this._def,shape:()=>t})}keyof(){return hs(A.objectKeys(this.shape))}}D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:Se.create(),typeName:w.ZodObject,...b(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:Se.create(),typeName:w.ZodObject,...b(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:Se.create(),typeName:w.ZodObject,...b(e)});class Vt extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new re(o.ctx.common.issues));return m(t,{code:c.invalid_union,unionErrors:i}),y}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const l of n){const u={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(l=>new re(l));return m(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}Vt.create=(r,e)=>new Vt({options:r,typeName:w.ZodUnion,...b(e)});function vr(r,e){const t=me(r),n=me(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&n===g.object){const s=A.objectKeys(e),a=A.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=vr(r[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(t===g.array&&n===g.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],l=vr(i,o);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===g.date&&n===g.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Bt extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(hn(a)||hn(i))return y;const o=vr(a.value,i.value);return o.valid?((pn(a)||pn(i))&&t.dirty(),{status:t.value,value:o.data}):(m(n,{code:c.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Bt.create=(r,e,t)=>new Bt({left:r,right:e,typeName:w.ZodIntersection,...b(t)});class he extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.array)return m(n,{code:c.invalid_type,expected:g.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return m(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Ee(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>J.mergeArray(t,i)):J.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new he({...this._def,rest:e})}}he.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:r,typeName:w.ZodTuple,rest:null,...b(e)})};class yn extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.map)return m(n,{code:c.invalid_type,expected:g.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,l],u)=>({key:s._parse(new Ee(n,o,n.path,[u,"key"])),value:a._parse(new Ee(n,l,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return y;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of i){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return y;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}}}}yn.create=(r,e,t)=>new yn({valueType:e,keyType:r,typeName:w.ZodMap,...b(t)});class _t extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.set)return m(n,{code:c.invalid_type,expected:g.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(m(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(m(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(l){const u=new Set;for(const d of l){if(d.status==="aborted")return y;d.status==="dirty"&&t.dirty(),u.add(d.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((l,u)=>a._parse(new Ee(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new _t({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new _t({...this._def,maxSize:{value:e,message:_.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_t.create=(r,e)=>new _t({valueType:r,minSize:null,maxSize:null,typeName:w.ZodSet,...b(e)});class pt extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return m(t,{code:c.invalid_type,expected:g.function,received:t.parsedType}),y;function n(o,l){return fr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,cr(),vt].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:l}})}function s(o,l){return fr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,cr(),vt].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof yt){const o=this;return W(async function(...l){const u=new re([]),d=await o._def.args.parseAsync(l,a).catch(v=>{throw u.addIssue(n(l,v)),u}),f=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(f,a).catch(v=>{throw u.addIssue(s(f,v)),u})})}else{const o=this;return W(function(...l){const u=o._def.args.safeParse(l,a);if(!u.success)throw new re([n(l,u.error)]);const d=Reflect.apply(i,this,u.data),f=o._def.returns.safeParse(d,a);if(!f.success)throw new re([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pt({...this._def,args:he.create(e).rest(qe.create())})}returns(e){return new pt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new pt({args:e||he.create([]).rest(qe.create()),returns:t||qe.create(),typeName:w.ZodFunction,...b(n)})}}class wn extends C{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}wn.create=(r,e)=>new wn({getter:r,typeName:w.ZodLazy,...b(e)});class kn extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}kn.create=(r,e)=>new kn({value:r,typeName:w.ZodLiteral,...b(e)});function hs(r,e){return new et({values:r,typeName:w.ZodEnum,...b(e)})}class et extends C{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:A.joinValues(n),received:t.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{received:t.data,code:c.invalid_enum_value,options:n}),y}return W(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return et.create(e,{...this._def,...t})}exclude(e,t=this._def){return et.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}et.create=hs;class xn extends C{_parse(e){const t=A.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==g.string&&n.parsedType!==g.number){const s=A.objectValues(t);return m(n,{expected:A.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=A.objectValues(t);return m(n,{received:n.data,code:c.invalid_enum_value,options:s}),y}return W(e.data)}get enum(){return this._def.values}}xn.create=(r,e)=>new xn({values:r,typeName:w.ZodNativeEnum,...b(e)});class yt extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return m(t,{code:c.invalid_type,expected:g.promise,received:t.parsedType}),y;const n=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return W(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}yt.create=(r,e)=>new yt({type:r,typeName:w.ZodPromise,...b(e)});class tt extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{m(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?y:l.status==="dirty"||t.value==="dirty"?ct(l.value):l});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?ct(o.value):o}}if(s.type==="refinement"){const i=o=>{const l=s.refinement(o,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ke(i))return y;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ke(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);A.assertNever(s)}}tt.create=(r,e,t)=>new tt({schema:r,typeName:w.ZodEffects,effect:e,...b(t)});tt.createWithPreprocess=(r,e,t)=>new tt({schema:e,effect:{type:"preprocess",transform:r},typeName:w.ZodEffects,...b(t)});class xe extends C{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xe.create=(r,e)=>new xe({innerType:r,typeName:w.ZodOptional,...b(e)});class rt extends C{_parse(e){return this._getType(e)===g.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rt.create=(r,e)=>new rt({innerType:r,typeName:w.ZodNullable,...b(e)});class gr extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===g.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}gr.create=(r,e)=>new gr({innerType:r,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class _r extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ft(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new re(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}_r.create=(r,e)=>new _r({innerType:r,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class bn extends C{_parse(e){if(this._getType(e)!==g.nan){const n=this._getOrReturnCtx(e);return m(n,{code:c.invalid_type,expected:g.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}bn.create=r=>new bn({typeName:w.ZodNaN,...b(r)});class fi extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Fr extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),ct(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Fr({in:e,out:t,typeName:w.ZodPipeline})}}class yr extends C{_parse(e){const t=this._def.innerType._parse(e),n=s=>(Ke(s)&&(s.value=Object.freeze(s.value)),s);return Ft(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}yr.create=(r,e)=>new yr({innerType:r,typeName:w.ZodReadonly,...b(e)});var w;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(w||(w={}));const De=ke.create,E=Qe.create,wr=hr.create,zr=pr.create;qe.create;Se.create;const Nt=mr.create,Vr=le.create,R=D.create;Vt.create;Bt.create;const En=he.create,oe=pt.create,hi=et.create,pi=yt.create;xe.create;rt.create;R({pin:R({fade:wr().optional(),maxCount:E().optional(),maxZoom:E().optional()}).optional(),animation:R({queue:R({limit:E().optional()}).optional()}).optional(),api:R({states:R({url:De().optional(),key:De()}).optional(),log:R({enabled:wr()}).optional()}).optional()});const kr=E().min(-90).max(90),xr=E().min(-180).max(180),mi=R({sw:R({lat:kr,lng:xr}),ne:R({lat:kr,lng:xr})}),br=zr().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),ps=R({mapSize:E(),zoomMin:E(),zoomMax:E(),zoomScale:E()}),vi=R({instance:zr(),inserted:oe().returns(wr()),insert:oe().returns(Nt()),remove:oe().returns(Nt()),update:oe().args(E()).returns(Nt())}),gi=R({parameters:ps,getContainer:oe().args().returns(br),getZoom:oe().args().returns(E()),getBounds:oe().args().returns(mi),panBy:oe().args(E(),E()).returns(Nt()),createMarker:oe().args(br,kr,xr,E()).returns(vi)}),tr=oe().args(De()).returns(pi(br)),_i=R({id:De().min(1),rank:E(),lat:E().min(-90).max(90),lng:E().min(-180).max(180),tooltip:R({style:R({width:E(),height:E(),margin:E(),radius:E()}).refine(r=>Math.min(r.width,r.height)/r.margin>=5,"Tooltip width and height must be at least 5 times the margin"),body:tr}),pin:R({style:R({width:E(),height:E(),radius:E()}),body:tr}).optional(),popup:R({style:R({width:E(),height:E(),radius:E(),margin:E()}),body:tr}).optional()}),yi=Vr(_i);En([E(),Vr(En([E(),E()]))]);const wi=R({id:De(),rank:E(),lat:E(),lng:E(),width:E(),height:E(),margin:E()});R({key:De(),parameters:ps,input:Vr(wi)});const ki=hi(["info","warn","error"]);R({title:De(),level:ki,content:zr()});const ms="https://arenarium.dev/api/public/v1",xi=`${ms}/log`,bi=`${ms}/tooltip/states`,Sn="1.0.186";class Ei{constructor(e,t){h(this,"provider");h(this,"apiStatesUrl");h(this,"apiStatesKey");h(this,"apiLogEnabled");h(this,"markerDataArray",new Array);h(this,"markerDataMap",new Map);h(this,"markerDataUpdating",!1);h(this,"markerPinProcessor");h(this,"markerTooltipProcessor");h(this,"markerPopupProcessor");gi.parse(e),this.provider=e,this.markerPinProcessor=new Sr(e),this.markerTooltipProcessor=new Si(e),this.markerPopupProcessor=new Ci(e),this.configuration=t,this.log("info","Loaded")}set configuration(e){var t,n,s,a,i,o,l,u;this.apiStatesUrl=(n=(t=e==null?void 0:e.api)==null?void 0:t.states)==null?void 0:n.url,this.apiStatesKey=(a=(s=e==null?void 0:e.api)==null?void 0:s.states)==null?void 0:a.key,this.apiLogEnabled=(o=(i=e==null?void 0:e.api)==null?void 0:i.log)==null?void 0:o.enabled,this.markerPinProcessor.setConfiguration(e),ve.setLimit(((u=(l=e==null?void 0:e.animation)==null?void 0:l.queue)==null?void 0:u.limit)??8*navigator.hardwareConcurrency)}async updateMarkers(e){yi.parse(e);try{let t;if(e.length>1){const n=e.map(s=>({id:s.id,rank:s.rank,lat:s.lat,lng:s.lng,width:s.tooltip.style.width,height:s.tooltip.style.height,margin:s.tooltip.style.margin}));if(this.apiStatesKey!=null){const s={key:this.apiStatesKey,parameters:this.provider.parameters,input:n},a=await fetch(this.apiStatesUrl??bi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok||!a.body)throw new Error("Failed to get marker states: "+a.statusText);t=await a.json()}else t=H.getStates(this.provider.parameters,n)}else t=[[0,[[0,H.Angles.DEGREES.indexOf(H.Angles.DEFAULT)]]]];this.updateMarkerData(e,t),this.processMarkerDataCallback()}catch(t){throw console.error(t),this.removeMarkerData(),t instanceof Error&&this.log("error","Failed to update markers",t),t}}removeMarkers(){try{this.removeMarkerData()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove markers",e),e}}showPopup(e){try{for(const t of this.markerDataArray)t.marker.id==e?this.markerPopupProcessor.show(t):this.markerPopupProcessor.hide(t)}catch(t){console.error(t);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t instanceof Error&&this.log("error","Failed to show popup",t),t}}hidePopup(e){try{if(e){const t=this.markerDataMap.get(e);if(t==null)return;this.markerPopupProcessor.hide(t)}else for(const t of this.markerDataArray)this.markerPopupProcessor.hide(t)}catch(t){console.error(t);for(const n of this.markerDataArray)this.markerPopupProcessor.hide(n);throw t instanceof Error&&this.log("error","Failed to hide popup",t),t}}updateMarkerData(e,t){try{this.markerDataUpdating=!0;const n=new Map(e.map((a,i)=>[a.id,new Cn(this.provider,a,t[i])])),s=Array.from(this.markerDataArray);for(const a of s)n.has(a.marker.id)==!1&&(a.remove(),this.markerDataMap.delete(a.marker.id),this.markerDataArray.splice(this.markerDataArray.indexOf(a),1));for(let a=0;a<e.length;a++){const i=e[a],o=t[a],l=this.markerDataMap.get(i.id);if(l)l.update(o);else{const u=new Cn(this.provider,i,o);u.create(),this.markerDataMap.set(i.id,u),this.markerDataArray.push(u)}}this.markerDataArray.sort((a,i)=>a.zoom-i.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(a=>a.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(a=>a.tooltip))}catch(n){throw console.error(n),this.markerDataArray.forEach(s=>s.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),n instanceof Error&&this.log("error","Failed to update marker data",n),n}finally{this.markerDataUpdating=!1}}removeMarkerData(){try{this.markerDataUpdating=!0,this.markerPinProcessor.removeElements(),this.markerTooltipProcessor.removeElements(),this.markerPopupProcessor.clear(),this.markerDataArray.length=0,this.markerDataMap.clear()}catch(e){throw console.error(e),e instanceof Error&&this.log("error","Failed to remove marker data",e),e}finally{this.markerDataUpdating=!1}}processMarkerDataCallback(){if(this.markerDataArray.length!=0)try{this.processMarkerData(),window.setTimeout(this.processMarkerDataCallback.bind(this),25)}catch(e){console.error(e),e instanceof Error&&this.log("error","Failed to process marker data",e)}}processMarkerData(){if(this.markerDataUpdating)return;const e=this.provider.getBounds(),t=this.provider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,t),this.markerPinProcessor.process(e,t)}async log(e,t,n){if(!(this.apiLogEnabled==null&&(window!=null&&window.location.host.startsWith("localhost")))&&this.apiLogEnabled!=!1)try{const s={title:`[CLIENT:${Sn}] ${t}`,level:e,content:{version:Sn,...n}};await fetch(xi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(s){console.error(s)}}}class Cn{constructor(e,t,n){h(this,"marker");h(this,"zoom");h(this,"pin");h(this,"tooltip");this.marker=t,this.zoom=n[0],this.pin=new Er(e,t,n),this.tooltip=new Cr(e,t,n)}create(){this.pin.create(),this.tooltip.create()}update(e){this.pin.update(e),this.tooltip.update(e)}remove(){this.pin.remove(),this.tooltip.remove()}}class Br{constructor(e,t){h(this,"provider");h(this,"id");h(this,"lat");h(this,"lng");h(this,"shown");h(this,"element");h(this,"component");h(this,"marker");this.provider=e,this.id=t.id,this.lat=t.lat,this.lng=t.lng,this.shown=!0}create(){this.createElement(),this.createMarker(),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createMarker(){const e=this.element;if(!e)throw new Error("Failed to create provider marker");this.marker=this.provider.createMarker(e,this.lat,this.lng,this.getZindex())}updateZIndex(){if(this.marker==null)throw new Error("Failed to update provider marker z-index");this.marker.update(this.getZindex())}updateMap(e){const t=this.marker,n=this.component;if(t==null||n==null)throw new Error("Failed to update provider marker map");e?t.inserted()==!1&&t.insert():t.inserted()==!0&&t.remove()}getZindex(){throw new Error("Get z-index not implemented")}remove(){var e,t;(e=this.marker)==null||e.remove(),(t=this.element)==null||t.remove()}}const Be=class Be extends Br{constructor(t,n,s){var a,i,o,l;super(t,n);h(this,"width");h(this,"height");h(this,"radius");h(this,"zoom");h(this,"bodyLoading",!1);h(this,"bodyLoaded",!1);h(this,"bodyCallback");this.width=((a=n.pin)==null?void 0:a.style.width)??Be.DEFAULT_SIZE,this.height=((i=n.pin)==null?void 0:i.style.height)??Be.DEFAULT_SIZE,this.radius=((o=n.pin)==null?void 0:o.style.radius)??Be.DEFAULT_SIZE,this.zoom=s[0],this.bodyCallback=(l=n.pin)==null?void 0:l.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("pin"),this.component=jr(Va,{target:this.element,props:{id:this.id+"_pin",layer:ja,priority:this.zoom*this.provider.parameters.zoomScale,width:this.width,height:this.height,radius:this.radius}})}update(t){this.zoom=t[0],this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){if(this.component==null)throw new Error("Failed to update pin state");this.component.setScale(this.getScale(t))}updateBody(){var n;if(this.bodyCallback==null||this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load pin body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}setCollapsed(t){if(this.component==null)throw new Error("Failed to set pin collapsed");this.component.setScale(t?0:1)}getScale(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};h(Be,"DEFAULT_SIZE",16);let Er=Be;const Ue=class Ue{constructor(e){h(this,"provider");h(this,"pinElements",new Array);h(this,"pinMaxWidth",0);h(this,"pinMaxHeight",0);h(this,"pinFade",!1);h(this,"pinMaxCount",0);h(this,"pinMaxZoomDelta",0);this.provider=e}setConfiguration(e){var t,n,s;this.pinFade=((t=e==null?void 0:e.pin)==null?void 0:t.fade)??!0,this.pinMaxCount=((n=e==null?void 0:e.pin)==null?void 0:n.maxCount)??Math.max(Ue.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=e==null?void 0:e.pin)==null?void 0:s.maxZoom)??Ue.MAP_PINS_MAX_ZOOM}updateElements(e){this.pinElements=e,this.pinMaxWidth=e.reduce((t,n)=>Math.max(t,n.width),0),this.pinMaxHeight=e.reduce((t,n)=>Math.max(t,n.height),0)}removeElements(){this.pinElements.forEach(e=>e.remove()),this.pinElements.length=0}process(e,t){const n=this.provider.parameters.mapSize,s=new ds(e,t,n,this.pinMaxWidth*2,this.pinMaxHeight*2);let a=0;for(const i of this.pinElements)s.contains(i.lat,i.lng)?i.shown&&t<=i.zoom&&i.zoom<=t+this.pinMaxZoomDelta?(a<this.pinMaxCount&&(this.pinFade==!0?i.updateState(t):i.setCollapsed(!1),i.updateMap(!0),i.isBodyLoaded()==!1&&i.updateBody()),a++):(i.setCollapsed(!0),i.isCollapsed()&&i.updateMap(!1)):i.updateMap(!1)}};h(Ue,"MAP_PINS_MAX_ZOOM",2),h(Ue,"MAP_PINS_MAX_COUNT",128);let Sr=Ue;const Ut=class Ut extends Br{constructor(t,n,s){super(t,n);h(this,"width");h(this,"height");h(this,"margin");h(this,"radius");h(this,"zoom");h(this,"angle");h(this,"states");h(this,"bodyLoading",!1);h(this,"bodyLoaded",!1);h(this,"bodyCallback");this.width=n.tooltip.style.width,this.height=n.tooltip.style.height,this.margin=n.tooltip.style.margin,this.radius=n.tooltip.style.radius,this.zoom=s[0],this.angle=H.Angles.DEFAULT,this.states=s[1].map(a=>[a[0],H.Angles.DEGREES[a[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=jr(us,{target:this.element,props:{id:this.id+"_tooltip",layer:Za,priority:this.zoom*this.provider.parameters.zoomScale,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}update(t){this.zoom=t[0],this.states=t[1].map(n=>[n[0],H.Angles.DEGREES[n[1]]]),this.updateZIndex()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateState(t){if(this.component==null)throw new Error("Failed to update tooltip state");this.angle=this.getAngle(t),this.component.setAngle(this.angle)}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load tooltip body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getAngle(t){const n=this.states.findLast(s=>s[0]<=t);if(!n)throw new Error("Angle not found");return n[1]}getZindex(){return Math.round((this.provider.parameters.zoomMax-this.zoom)*this.provider.parameters.zoomScale)+Ut.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set tooltip collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};h(Ut,"Z_INDEX_OFFSET",1e6);let Cr=Ut;class Si{constructor(e){h(this,"provider");h(this,"tooltipElements",new Array);h(this,"tooltipMaxWidth",0);h(this,"tooltipMaxHeight",0);this.provider=e}updateElements(e){this.tooltipElements=e,this.tooltipMaxWidth=this.tooltipElements.reduce((t,n)=>Math.max(t,n.width),0),this.tooltipMaxHeight=this.tooltipElements.reduce((t,n)=>Math.max(t,n.height),0)}removeElements(){this.tooltipElements.forEach(e=>e.remove()),this.tooltipElements.length=0}process(e,t){const n=this.provider.parameters.mapSize,s=new ds(e,t,n,this.tooltipMaxWidth*2,this.tooltipMaxHeight*2);for(const a of this.tooltipElements)s.contains(a.lat,a.lng)?a.shown&&a.zoom<=t?(a.updateState(t),a.setCollapsed(!1),a.updateMap(!0),a.isCollapsed()==!1&&a.isBodyLoaded()==!1&&a.updateBody()):(a.setCollapsed(!0),a.isCollapsed()&&a.updateMap(!1)):a.updateMap(!1)}}const $t=class $t extends Br{constructor(t,n){if(n.popup==null)throw new Error("Failed to create popup");super(t,n);h(this,"width");h(this,"height");h(this,"margin");h(this,"radius");h(this,"bodyLoading",!1);h(this,"bodyLoaded",!1);h(this,"bodyCallback");this.shown=!1,this.width=n.popup.style.width,this.height=n.popup.style.height,this.margin=n.popup.style.margin,this.radius=n.popup.style.radius,this.bodyCallback=n.popup.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("popup"),this.component=jr(us,{target:this.element,props:{id:this.id+"_popup",layer:Pa,priority:0,width:this.width,height:this.height,margin:this.margin,radius:this.radius}})}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t)}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(s=>{s instanceof HTMLElement?t.appendChild(s):console.error("Failed to load popup body")}).catch(s=>console.error(s)).finally(()=>{this.bodyLoaded=!0,this.bodyLoading=!1}))}getZindex(){return $t.Z_INDEX_OFFSET}setCollapsed(t){if(this.component==null)throw new Error("Failed to set popup collapsed");this.component.setCollapsed(t)}setAngle(t){if(this.component==null)throw new Error("Failed to set popup angle");this.component.setAngle(t)}isExpanded(){return this.component==null?!1:this.component.getExpanded()}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyLoaded}};h($t,"Z_INDEX_OFFSET",2e6);let Tr=$t;class Ci{constructor(e){h(this,"provider");h(this,"popupElements",new Map);h(this,"popupPositioned",new Map);this.provider=e}show(e){e.pin.shown=!1,e.tooltip.shown=!1;const t=new Tr(this.provider,e.marker);this.popupElements.set(e.marker.id,t),this.popupPositioned.set(e.marker.id,!1),t.create(),t.setAngle(e.tooltip.angle),t.shown=!0}hide(e){e.pin.shown=!0,e.tooltip.shown=!0;const t=this.popupElements.get(e.marker.id);t!=null&&(t.shown=!1)}clear(){this.popupElements.values().forEach(e=>e.remove()),this.popupElements.clear(),this.popupPositioned.clear()}process(){var e,t;for(const n of this.popupElements.values())if(n.shown){if(n.setCollapsed(!1),n.updateMap(!0),n.isExpanded()&&n.isBodyLoaded()==!1&&n.updateBody(),n.isCollapsed()==!1&&this.popupPositioned.get(n.id)==!1){const s=(e=n.component)==null?void 0:e.getBody();if(s==null)continue;const a=(t=n.component)==null?void 0:t.getOffsets();if(a==null)continue;const i=s.getBoundingClientRect();if(i.x==0&&i.y==0&&i.width==0&&i.height==0)continue;const o=i.x+i.width/2,l=i.y+i.height/2,u=o+a.offsetX,d=l+a.offsetY,f=u+n.width,p=d+n.height,v=this.provider.getContainer().getBoundingClientRect(),x=u-v.left,N=v.right-f,I=d-v.top,K=v.bottom-p,T=Math.min(n.width,n.height)/4,z=x<0?x-T:N<0?-N+T:0,Q=I<0?I-T:K<0?-K+T:0;this.provider.panBy(z,Q),this.popupPositioned.set(n.id,!0)}}else n.setCollapsed(!0),n.isCollapsed()&&(n.updateMap(!1),n.remove(),this.popupElements.delete(n.id),this.popupPositioned.delete(n.id))}}exports.MapManager=Ei;