@arenarium/maps 1.0.187 → 1.0.188

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 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;
1
+ "use strict";var Cs=Object.defineProperty;var Qr=r=>{throw TypeError(r)};var Ts=(r,e,t)=>e in r?Cs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var f=(r,e,t)=>Ts(r,typeof e!="symbol"?e+"":e,t),Qt=(r,e,t)=>e.has(r)||Qr("Cannot "+t);var k=(r,e,t)=>(Qt(r,e,"read from private field"),t?t.call(r):e.get(r)),P=(r,e,t)=>e.has(r)?Qr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),j=(r,e,t,n)=>(Qt(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Te=(r,e,t)=>(Qt(r,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./states-Dr9TQeEe.cjs"),On=!1;var Nn=Array.isArray,As=Array.prototype.indexOf,Ms=Array.from,ar=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Os=Object.prototype,Ns=Array.prototype,Rs=Object.getPrototypeOf,en=Object.isExtensible;function Is(r){for(var e=0;e<r.length;e++)r[e]()}function Ls(){var r,e,t=new Promise((n,s)=>{r=n,e=s});return{promise:t,resolve:r,reject:e}}const X=2,Nr=4,Rn=8,Ht=16,Se=32,Pe=64,In=128,ee=256,Dt=512,q=1024,se=2048,Ce=4096,Je=8192,at=16384,Rr=32768,Ds=65536,tn=1<<17,Ps=1<<18,Ir=1<<19,Ln=1<<20,ir=1<<21,Lr=1<<22,Ne=1<<23,Nt=Symbol("$state"),Dr=new class extends Error{constructor(){super(...arguments);f(this,"name","StaleReactionError");f(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Zs(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function js(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Fs(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 Vs(r){throw new Error("https://svelte.dev/e/effect_orphan")}function Bs(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Us(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function $s(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function qs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}const Ws=2,F=Symbol();function Dn(r){return r===this.v}let Ys=!1,ae=null;function Pt(r){ae=r}function Pr(r,e=!1,t){ae={p:ae,c:null,e:null,s:r,x:null,l:null}}function Zr(r){var e=ae,t=e.e;if(t!==null){e.e=null;for(var n of t)Gn(n)}return r!==void 0&&(e.x=r),ae=e.p,r??{}}function Pn(){return!0}const Hs=new WeakMap;function Xs(r){var e=M;if(e===null)return S.f|=Ne,r;if((e.f&Rr)===0){if((e.f&In)===0)throw!e.parent&&r instanceof Error&&Zn(r),r;e.b.error(r)}else jr(r,e)}function jr(r,e){for(;e!==null;){if((e.f&In)!==0)try{e.b.error(r);return}catch(t){r=t}e=e.parent}throw r instanceof Error&&Zn(r),r}function Zn(r){const e=Hs.get(r);e&&(ar(r,"message",{value:e.message}),ar(r,"stack",{value:e.stack}))}let Zt=[];function Gs(){var r=Zt;Zt=[],Is(r)}function Js(r){Zt.length===0&&queueMicrotask(Gs),Zt.push(r)}function Ks(){for(var r=M.b;r!==null&&!r.has_pending_snippet();)r=r.parent;return r===null&&Zs(),r}function Qs(r){var e=X|se,t=S!==null&&(S.f&X)!==0?S:null;return M===null||t!==null&&(t.f&ee)!==0?e|=ee:M.f|=Ir,{ctx:ae,deps:null,effects:null,equals:Dn,f:e,fn:r,reactions:null,rv:0,v:F,wv:0,parent:t??M,ac:null}}function ea(r,e){let t=M;t===null&&js();var n=t.b,s=void 0,a=Un(F),i=null,o=!S;return ha(()=>{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=Z,h=n.pending;o&&(n.update_pending_count(1),h||d.increment());const p=(v,x=void 0)=>{i=null,h||d.activate(),x?x!==Dr&&(a.f|=Ne,ur(a,x)):((a.f&Ne)!==0&&(a.f^=Ne),ur(a,v)),o&&(n.update_pending_count(-1),h||d.decrement()),zn()};if(s.then(p,v=>p(null,v||"unknown")),d)return()=>{queueMicrotask(()=>d.neuter())}}),new Promise(l=>{function u(d){function h(){d===s?l(a):u(s)}d.then(h,h)}u(s)})}function jn(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Le(e[t])}}function ta(r){for(var e=r.parent;e!==null;){if((e.f&X)===0)return e;e=e.parent}return null}function Fr(r){var e,t=M;Qe(ta(r));try{jn(r),e=is(r)}finally{Qe(t)}return e}function Fn(r){var e=Fr(r);if(r.equals(e)||(r.v=e,r.wv=ss()),!it)if(_e!==null)_e.set(r,r.v);else{var t=(ye||(r.f&ee)!==0)&&r.deps!==null?Ce:q;te(r,t)}}function ra(r,e,t){const n=Qs;if(e.length===0){t(r.map(n));return}var s=Z,a=M,i=na(),o=Ks();Promise.all(e.map(l=>ea(l))).then(l=>{s==null||s.activate(),i();try{t([...r.map(n),...l])}catch(u){(a.f&at)===0&&jr(u,a)}s==null||s.deactivate(),zn()}).catch(l=>{o.error(l)})}function na(){var r=M,e=S,t=ae;return function(){Qe(r),xe(e),Pt(t)}}function zn(){Qe(null),xe(null),Pt(null)}const ut=new Set;let Z=null,_e=null,rn=new Set,jt=[];function Vn(){const r=jt.shift();jt.length>0&&queueMicrotask(Vn),r()}let mt=[],zr=null,or=!1;var We,Ye,ve,xt,bt,Ae,He,Me,ge,Xe,Et,St,ne,Bn,Rt,lr;const qt=class qt{constructor(){P(this,ne);f(this,"current",new Map);P(this,We,new Map);P(this,Ye,new Set);P(this,ve,0);P(this,xt,null);P(this,bt,!1);P(this,Ae,[]);P(this,He,[]);P(this,Me,[]);P(this,ge,[]);P(this,Xe,[]);P(this,Et,[]);P(this,St,[]);f(this,"skipped_effects",new Set)}process(e){var a;mt=[];var t=null;if(ut.size>1){t=new Map,_e=new Map;for(const[i,o]of this.current)t.set(i,{v:i.v,wv:i.wv}),i.v=o;for(const i of ut)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)Te(this,ne,Bn).call(this,i);if(k(this,Ae).length===0&&k(this,ve)===0){Te(this,ne,lr).call(this);var n=k(this,Me),s=k(this,ge);j(this,Me,[]),j(this,ge,[]),j(this,Xe,[]),Z=null,nn(n),nn(s),Z===null?Z=this:ut.delete(this),(a=k(this,xt))==null||a.resolve()}else Te(this,ne,Rt).call(this,k(this,Me)),Te(this,ne,Rt).call(this,k(this,ge)),Te(this,ne,Rt).call(this,k(this,Xe));if(t){for(const[i,{v:o,wv:l}]of t)i.wv<=l&&(i.v=o);_e=null}for(const i of k(this,Ae))ht(i);for(const i of k(this,He))ht(i);j(this,Ae,[]),j(this,He,[])}capture(e,t){k(this,We).has(e)||k(this,We).set(e,t),this.current.set(e,e.v)}activate(){Z=this}deactivate(){Z=null;for(const e of rn)if(rn.delete(e),e(),Z!==null)break}neuter(){j(this,bt,!0)}flush(){mt.length>0?sa():Te(this,ne,lr).call(this),Z===this&&(k(this,ve)===0&&ut.delete(this),this.deactivate())}increment(){j(this,ve,k(this,ve)+1)}decrement(){if(j(this,ve,k(this,ve)-1),k(this,ve)===0){for(const e of k(this,Et))te(e,se),Ke(e);for(const e of k(this,St))te(e,Ce),Ke(e);j(this,Me,[]),j(this,ge,[]),this.flush()}else this.deactivate()}add_callback(e){k(this,Ye).add(e)}settled(){return(k(this,xt)??j(this,xt,Ls())).promise}static ensure(){if(Z===null){const e=Z=new qt;ut.add(Z),qt.enqueue(()=>{Z===e&&e.flush()})}return Z}static enqueue(e){jt.length===0&&queueMicrotask(Vn),jt.unshift(e)}};We=new WeakMap,Ye=new WeakMap,ve=new WeakMap,xt=new WeakMap,bt=new WeakMap,Ae=new WeakMap,He=new WeakMap,Me=new WeakMap,ge=new WeakMap,Xe=new WeakMap,Et=new WeakMap,St=new WeakMap,ne=new WeakSet,Bn=function(e){var d;e.f^=q;for(var t=e.first;t!==null;){var n=t.f,s=(n&(Se|Pe))!==0,a=s&&(n&q)!==0,i=a||(n&Je)!==0||this.skipped_effects.has(t);if(!i&&t.fn!==null){if(s)t.f^=q;else if((n&q)===0)if((n&Nr)!==0)k(this,ge).push(t);else if((n&Lr)!==0){var o=(d=t.b)!=null&&d.pending?k(this,He):k(this,Ae);o.push(t)}else Xt(t)&&((t.f&Ht)!==0&&k(this,Xe).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}},Rt=function(e){for(const t of e)((t.f&se)!==0?k(this,Et):k(this,St)).push(t),te(t,q);e.length=0},lr=function(){if(!k(this,bt))for(const e of k(this,Ye))e();k(this,Ye).clear()};let vt=qt;function sa(){var r=$e;or=!0;try{var e=0;for(an(!0);mt.length>0;){var t=vt.ensure();if(e++>1e3){var n,s;aa()}t.process(mt),Re.clear()}}finally{or=!1,an(r),zr=null}}function aa(){try{Bs()}catch(r){jr(r,zr)}}function nn(r){var e=r.length;if(e!==0){for(var t=0;t<e;){var n=r[t++];if((n.f&(at|Je))===0&&Xt(n)){var s=Z?Z.current.size:0;if(ht(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?ts(n):n.fn=null),Z!==null&&Z.current.size>s&&(n.f&Ln)!==0)break}}for(;t<e;)Ke(r[t++])}}function Ke(r){for(var e=zr=r;e.parent!==null;){e=e.parent;var t=e.f;if(or&&e===M&&(t&Ht)!==0)return;if((t&(Pe|Se))!==0){if((t&q)===0)return;e.f^=q}}mt.push(e)}const Re=new Map;function Un(r,e){var t={f:0,v:r,reactions:null,equals:Dn,rv:0,wv:0};return t}function $(r,e){const t=Un(r);return ya(t),t}function B(r,e,t=!1){S!==null&&(!ie||(S.f&tn)!==0)&&Pn()&&(S.f&(X|Ht|Lr|tn))!==0&&!(U!=null&&U.includes(r))&&qs();let n=t?dt(e):e;return ur(r,n)}function ur(r,e){if(!r.equals(e)){var t=r.v;it?Re.set(r,e):Re.set(r,t),r.v=e;var n=vt.ensure();n.capture(r,t),(r.f&X)!==0&&((r.f&se)!==0&&Fr(r),te(r,(r.f&ee)===0?q:Ce)),r.wv=ss(),$n(r,se),M!==null&&(M.f&q)!==0&&(M.f&(Se|Pe))===0&&(Q===null?wa([r]):Q.push(r))}return e}function er(r){B(r,r.v+1)}function $n(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,o=(i&se)===0;o&&te(a,e),(i&X)!==0?$n(a,Ce):o&&Ke(a)}}function dt(r){if(typeof r!="object"||r===null||Nt in r)return r;const e=Rs(r);if(e!==Os&&e!==Ns)return r;var t=new Map,n=Nn(r),s=$(0),a=Ie,i=o=>{if(Ie===a)return o();var l=S,u=Ie;xe(null),ln(a);var d=o();return xe(l),ln(u),d};return n&&t.set("length",$(r.length)),new Proxy(r,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Us();var d=t.get(l);return d===void 0?d=i(()=>{var h=$(u.value);return t.set(l,h),h}):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(()=>$(F));t.set(l,d),er(s)}}else B(u,F),er(s);return!0},get(o,l,u){var v;if(l===Nt)return r;var d=t.get(l),h=l in o;if(d===void 0&&(!h||(v=ft(o,l))!=null&&v.writable)&&(d=i(()=>{var x=dt(h?o[l]:F),N=$(x);return N}),t.set(l,d)),d!==void 0){var p=L(d);return p===F?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 h=t.get(l),p=h==null?void 0:h.v;if(h!==void 0&&p!==F)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(o,l){var p;if(l===Nt)return!0;var u=t.get(l),d=u!==void 0&&u.v!==F||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]):F,x=$(v);return x}),t.set(l,u));var h=L(u);if(h===F)return!1}return d},set(o,l,u,d){var z;var h=t.get(l),p=l in o;if(n&&l==="length")for(var v=u;v<h.v;v+=1){var x=t.get(v+"");x!==void 0?B(x,F):v in o&&(x=i(()=>$(F)),t.set(v+"",x))}if(h===void 0)(!p||(z=ft(o,l))!=null&&z.writable)&&(h=i(()=>$(void 0)),B(h,dt(u)),t.set(l,h));else{p=h.v!==F;var N=i(()=>dt(u));B(h,N)}var I=Reflect.getOwnPropertyDescriptor(o,l);if(I!=null&&I.set&&I.set.call(d,u),!p){if(n&&typeof l=="string"){var J=t.get("length"),T=Number(l);Number.isInteger(T)&&T>=J.v&&B(J,T+1)}er(s)}return!0},ownKeys(o){L(s);var l=Reflect.ownKeys(o).filter(h=>{var p=t.get(h);return p===void 0||p.v!==F});for(var[u,d]of t)d.v!==F&&!(u in o)&&l.push(u);return l},setPrototypeOf(){$s()}})}var sn,qn,Wn,Yn;function ia(){if(sn===void 0){sn=window,qn=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;Wn=ft(e,"firstChild").get,Yn=ft(e,"nextSibling").get,en(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),en(t)&&(t.__t=void 0)}}function oa(r=""){return document.createTextNode(r)}function Hn(r){return Wn.call(r)}function Xn(r){return Yn.call(r)}function dr(r,e){return Hn(r)}function la(r,e=1,t=!1){let n=r;for(;e--;)n=Xn(n);return n}function ua(r){M===null&&S===null&&Vs(),S!==null&&(S.f&ee)!==0&&M===null&&zs(),it&&Fs()}function da(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&Je)!==0&&(r|=Je);var a={ctx:ae,deps:null,nodes_start:null,nodes_end:null,f:r|se,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|=Rr}catch(l){throw Le(a),l}else e!==null&&Ke(a);var i=t&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&Ir)===0;if(!i&&n&&(s!==null&&da(a,s),S!==null&&(S.f&X)!==0&&(r&Pe)===0)){var o=S;(o.effects??(o.effects=[])).push(a)}return a}function ce(r){ua();var e=M.f,t=!S&&(e&Se)!==0&&(e&Rr)===0;if(t){var n=ae;(n.e??(n.e=[])).push(r)}else return Gn(r)}function Gn(r){return Ze(Nr|Ln,r,!1)}function ca(r){vt.ensure();const e=Ze(Pe,r,!0);return(t={})=>new Promise(n=>{t.outro?ga(e,()=>{Le(e),n(void 0)}):(Le(e),n(void 0))})}function fa(r){return Ze(Nr,r,!1)}function ha(r){return Ze(Lr|Ir,r,!0)}function Jn(r,e=0){return Ze(Rn|e,r,!0)}function Kn(r,e=[],t=[]){ra(e,t,n=>{Ze(Rn,()=>r(...n.map(L)),!0)})}function pa(r,e=!0){return Ze(Se,r,!0,e)}function Qn(r){var e=r.teardown;if(e!==null){const t=it,n=S;on(!0),xe(null);try{e.call(null)}finally{on(t),xe(n)}}}function es(r,e=!1){var s;var t=r.first;for(r.first=r.last=null;t!==null;){(s=t.ac)==null||s.abort(Dr);var n=t.next;(t.f&Pe)!==0?t.parent=null:Le(t,e),t=n}}function ma(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&Se)===0&&Le(e),e=t}}function Le(r,e=!0){var t=!1;(e||(r.f&Ps)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(va(r.nodes_start,r.nodes_end),t=!0),es(r,e&&!t),Ft(r,0),te(r,at);var n=r.transitions;if(n!==null)for(const a of n)a.stop();Qn(r);var s=r.parent;s!==null&&s.first!==null&&ts(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes_start=r.nodes_end=r.ac=null}function va(r,e){for(;r!==null;){var t=r===e?null:Xn(r);r.remove(),r=t}}function ts(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 ga(r,e){var t=[];rs(r,t,!0),_a(t,()=>{Le(r),e&&e()})}function _a(r,e){var t=r.length;if(t>0){var n=()=>--t||e();for(var s of r)s.out(n)}else e()}function rs(r,e,t){if((r.f&Je)===0){if(r.f^=Je,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&Ds)!==0||(n.f&Se)!==0;rs(n,e,a?t:!1),n=s}}}let $e=!1;function an(r){$e=r}let it=!1;function on(r){it=r}let S=null,ie=!1;function xe(r){S=r}let M=null;function Qe(r){M=r}let U=null;function ya(r){S!==null&&(U===null?U=[r]:U.push(r))}let V=null,Y=0,Q=null;function wa(r){Q=r}let ns=1,gt=0,Ie=gt;function ln(r){Ie=r}let ye=!1;function ss(){return++ns}function Xt(r){var h;var e=r.f;if((e&se)!==0)return!0;if((e&Ce)!==0){var t=r.deps,n=(e&ee)!==0;if(t!==null){var s,a,i=(e&Dt)!==0,o=n&&M!==null&&!ye,l=t.length;if((i||o)&&(M===null||(M.f&at)===0)){var u=r,d=u.parent;for(s=0;s<l;s++)a=t[s],(i||!((h=a==null?void 0:a.reactions)!=null&&h.includes(u)))&&(a.reactions??(a.reactions=[])).push(u);i&&(u.f^=Dt),o&&d!==null&&(d.f&ee)===0&&(u.f^=ee)}for(s=0;s<l;s++)if(a=t[s],Xt(a)&&Fn(a),a.wv>r.wv)return!0}(!n||M!==null&&!ye)&&te(r,q)}return!1}function as(r,e,t=!0){var n=r.reactions;if(n!==null&&!(U!=null&&U.includes(r)))for(var s=0;s<n.length;s++){var a=n[s];(a.f&X)!==0?as(a,e,!1):e===a&&(t?te(a,se):(a.f&q)!==0&&te(a,Ce),Ke(a))}}function is(r){var x;var e=V,t=Y,n=Q,s=S,a=ye,i=U,o=ae,l=ie,u=Ie,d=r.f;V=null,Y=0,Q=null,ye=(d&ee)!==0&&(ie||!$e||S===null),S=(d&(Se|Pe))===0?r:null,U=null,Pt(r.ctx),ie=!1,Ie=++gt,r.ac!==null&&(r.ac.abort(Dr),r.ac=null);try{r.f|=ir;var h=(0,r.fn)(),p=r.deps;if(V!==null){var v;if(Ft(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(!ye||(d&X)!==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&&(Ft(r,Y),p.length=Y);if(Pn()&&Q!==null&&!ie&&p!==null&&(r.f&(X|Ce|se))===0)for(v=0;v<Q.length;v++)as(Q[v],r);return s!==null&&s!==r&&(gt++,Q!==null&&(n===null?n=Q:n.push(...Q))),(r.f&Ne)!==0&&(r.f^=Ne),h}catch(N){return Xs(N)}finally{r.f^=ir,V=e,Y=t,Q=n,S=s,ye=a,U=i,Pt(o),ie=l,Ie=u}}function ka(r,e){let t=e.reactions;if(t!==null){var n=As.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&X)!==0&&(V===null||!V.includes(e))&&(te(e,Ce),(e.f&(ee|Dt))===0&&(e.f^=Dt),jn(e),Ft(e,0))}function Ft(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)ka(r,t[n])}function ht(r){var e=r.f;if((e&at)===0){te(r,q);var t=M,n=$e;M=r,$e=!0;try{(e&Ht)!==0?ma(r):es(r),Qn(r);var s=is(r);r.teardown=typeof s=="function"?s:null,r.wv=ns;var a;On&&Ys&&(r.f&se)!==0&&r.deps}finally{$e=n,M=t}}}function L(r){var e=r.f,t=(e&X)!==0;if(S!==null&&!ie){var n=M!==null&&(M.f&at)!==0;if(!n&&!(U!=null&&U.includes(r))){var s=S.deps;if((S.f&ir)!==0)r.rv<gt&&(r.rv=gt,V===null&&s!==null&&s[Y]===r?Y++:V===null?V=[r]:(!ye||!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&ee)===0&&(i.f^=ee)}if(it){if(Re.has(r))return Re.get(r);if(t){i=r;var l=i.v;return((i.f&q)===0&&i.reactions!==null||os(i))&&(l=Fr(i)),Re.set(i,l),l}}else if(t){if(i=r,_e!=null&&_e.has(i))return _e.get(i);Xt(i)&&Fn(i)}if((r.f&Ne)!==0)throw r.v;return r.v}function os(r){if(r.v===F)return!0;if(r.deps===null)return!1;for(const e of r.deps)if(Re.has(e)||(e.f&X)!==0&&os(e))return!0;return!1}function xa(r){var e=ie;try{return ie=!0,r()}finally{ie=e}}const ba=-7169;function te(r,e){r.f=r.f&ba|e}const Ea=["touchstart","touchmove"];function Sa(r){return Ea.includes(r)}const Ca=new Set,un=new Set;function Ot(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){ar(r,"currentTarget",{configurable:!0,get(){return a||t}});var d=S,h=M;xe(null),Qe(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(Nn(N)){var[I,...J]=N;I.apply(a,[r,...J])}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,xe(d),Qe(h)}}}function Ta(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function Aa(r,e){var t=M;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function ls(r,e){var t=(e&Ws)!==0,n,s=!r.startsWith("<!>");return()=>{n===void 0&&(n=Ta(s?r:"<!>"+r),n=Hn(n));var a=t||qn?document.importNode(n,!0):n.cloneNode(!0);return Aa(a,a),a}}function us(r,e){r!==null&&r.before(e)}function Vr(r,e){return Ma(r,e)}const Fe=new Map;function Ma(r,{target:e,anchor:t,props:n={},events:s,context:a,intro:i=!0}){ia();var o=new Set,l=h=>{for(var p=0;p<h.length;p++){var v=h[p];if(!o.has(v)){o.add(v);var x=Sa(v);e.addEventListener(v,Ot,{passive:x});var N=Fe.get(v);N===void 0?(document.addEventListener(v,Ot,{passive:x}),Fe.set(v,1)):Fe.set(v,N+1)}}};l(Ms(Ca)),un.add(l);var u=void 0,d=ca(()=>{var h=t??e.appendChild(oa());return pa(()=>{if(a){Pr({});var p=ae;p.c=a}s&&(n.$$events=s),u=r(h,n)||{},a&&Zr()}),()=>{var x;for(var p of o){e.removeEventListener(p,Ot);var v=Fe.get(p);--v===0?(document.removeEventListener(p,Ot),Fe.delete(p)):Fe.set(p,v)}un.delete(l),h!==t&&((x=h.parentNode)==null||x.removeChild(h))}});return Oa.set(u,d),u}let Oa=new WeakMap;const dn=[...`
2
+ \r\f \v\uFEFF`];function Na(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||dn.includes(n[i-1]))&&(o===n.length||dn.includes(n[o]))?n=(i===0?"":n.substring(0,i))+n.substring(o+1):i=o}}return n===""?null:n}function cn(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 tr(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Ra(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(tr)),s&&l.push(...Object.keys(s).map(tr));var u=0,d=-1;const N=r.length;for(var h=0;h<N;h++){var p=r[h];if(o?p==="/"&&r[h-1]==="*"&&(o=!1):a?a===p&&(a=!1):p==="/"&&r[h+1]==="*"?o=!0:p==='"'||p==="'"?a=p:p==="("?i++:p===")"&&i--,!o&&a===!1&&i===0){if(p===":"&&d===-1)d=h;else if(p===";"||h===N-1){if(d!==-1){var v=tr(r.substring(u,d).trim());if(!l.includes(v)){p!==";"&&h++;var x=r.substring(u,h).trim();t+=" "+x+";"}}u=h+1,d=-1}}}}return n&&(t+=cn(n)),s&&(t+=cn(s,!0)),t=t.trim(),t===""?null:t}return r==null?null:String(r)}function ds(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Na(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 rr(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 zt(r,e,t,n){var s=r.__style;if(s!==e){var a=Ra(e,n);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}else n&&(Array.isArray(n)?(rr(r,t==null?void 0:t[0],n[0]),rr(r,t==null?void 0:t[1],n[1],"important")):rr(r,t,n));return n}const Ia=()=>performance.now(),oe={tick:r=>requestAnimationFrame(r),now:()=>Ia(),tasks:new Set};function cs(){const r=oe.now();oe.tasks.forEach(e=>{e.c(r)||(oe.tasks.delete(e),e.f())}),oe.tasks.size!==0&&oe.tick(cs)}function La(r){let e;return oe.tasks.size===0&&oe.tick(cs),{promise:new Promise(t=>{oe.tasks.add(e={c:r,f:t})}),abort(){oe.tasks.delete(e)}}}function fn(r,e){return r===e||(r==null?void 0:r[Nt])===e}function Ve(r={},e,t,n){return fa(()=>{var s,a;return Jn(()=>{s=a,a=[],xa(()=>{r!==t(...a)&&(e(r,...a),s&&fn(t(...s),r)&&e(null,...s))})}),()=>{Js(()=>{a&&fn(t(...a),r)&&e(null,...a)})}}),r}const Da="5";var Mn;typeof window<"u"&&((Mn=window.__svelte??(window.__svelte={})).v??(Mn.v=new Set)).add(Da);function Pa(r){return r}function cr(r){return-.5*(Math.cos(Math.PI*r)-1)}function Za(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function ja(r){return Math.sin(r*Math.PI/2)}const Fa=128,za=0,Va=1,Ba=2;class Ua{constructor(){f(this,"animationsStarted",!1);f(this,"animationsCount",0);f(this,"animationsLimit",Fa);f(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 me=new Ua;function hn(r){return Object.prototype.toString.call(r)==="[object Date]"}function fr(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)=>fr(r[a],s));return s=>n.map(a=>a(s))}if(t==="object"){if(!r||!e)throw new Error("Object cannot be null");if(hn(r)&&hn(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]=fr(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,Ge,Ct,Oe;const Wr=class Wr{constructor(e,t={}){P(this,fe);P(this,Ge);P(this,Ct);P(this,Oe,null);j(this,fe,$(e)),j(this,Ge,$(e)),j(this,Ct,t)}static of(e,t){const n=new Wr(e(),t);return Jn(()=>{n.set(e())}),n}set(e,t){var h;B(k(this,Ge),e);let{delay:n=0,duration:s=400,easing:a=Pa,interpolate:i=fr}={...k(this,Ct),...t};if(s===0)return(h=k(this,Oe))==null||h.abort(),B(k(this,fe),e),Promise.resolve();const o=oe.now()+n;let l,u=!1,d=k(this,Oe);return j(this,Oe,La(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,Oe).promise}get current(){return L(k(this,fe))}get target(){return L(k(this,Ge))}set target(e){this.set(e)}};fe=new WeakMap,Ge=new WeakMap,Ct=new WeakMap,Oe=new WeakMap;let hr=Wr;class It{constructor(e,t){f(this,"value");f(this,"motion");this.value=e,this.motion=new hr(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 $a=ls('<div><div class="body svelte-1nfn9j8"></div></div>');function qa(r,e){Pr(e,!0);let t,n;function s(){return n}let a=$(!1);function i(T){B(a,T,!0)}function o(){return L(a)}let l=new It(0,{easing:cr});ce(()=>{u(l.motion.current)}),ce(()=>{L(a)==!1&&(l.snap(),me.clear(e.priority,e.id))});function u(T){t&&me.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 h(){return l.motion.current==0}function p(){return l.value}var v=$a();let x,N;var I=dr(v);let J;return Ve(I,T=>n=T,()=>n),Ve(v,T=>t=T,()=>t),Kn((T,z,K)=>{x=ds(v,1,"pin svelte-1nfn9j8",null,x,T),N=zt(v,"",N,z),J=zt(I,"",J,K)},[()=>({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`})]),us(r,v),Zr({getBody:s,setDisplayed:i,getDisplayed:o,setScale:d,getCollapsed:h,getScale:p})}var Wa=ls('<div><div class="pointer svelte-j5igi2"></div> <div class="bubble svelte-j5igi2"><div class="body svelte-j5igi2"></div></div></div>');function fs(r,e){Pr(e,!0);let t,n,s,a;const i=e.width+2*e.margin,o=e.height+2*e.margin,l=()=>a;ce(()=>{s.style.width=`${e.margin*4}px`,s.style.height=`${e.margin*4}px`});let u=$(!0);function d(O){B(u,O,!0)}function h(){return L(u)}let p=$(!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 It(0);ce(()=>{J(I.motion.current)}),ce(()=>{L(u)==!1&&(I.snap(),me.clear(e.priority,e.id+"_scale"))}),ce(()=>{L(p)==!0&&I.value!=0&&(me.stacked()?I.set(0,{duration:0}):I.set(0,{duration:150,easing:Za})),L(p)==!1&&I.value!=1&&I.set(1,{duration:150,easing:ja})});function J(O){!t||!n||!s||me.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=$(!1),K=new It(-i/2,{easing:cr}),Tt=new It(-o/2,{easing:cr});ce(()=>{Yr(K.motion.current,Tt.motion.current)}),ce(()=>{L(u)==!1&&(K.snap(),K.snap(),me.clear(e.priority,e.id+"_angle"))}),ce(()=>{L(p)==!0&&L(z)&&(K.update({duration:75}),K.update({duration:75}))});function Yr(O,de){if(!t||!n||!s)return;const Mt=O+i/2,ot=de+o/2,je=o<i?Mt*o/i:Mt,Jt=o>i?ot*i/o:ot,ks=Math.atan2(Jt,je)/Math.PI*180-45,Jr=0,xs=30,Kt=Math.sqrt(je*je+Jt*Jt),lt=Math.min(i,o)/2,bs=lt*Math.SQRT2,Es=(Kt-lt)/(bs-lt),Kr=Jr+Es*(xs-Jr),Ss=Kt<lt?Kt/lt:1;me.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(O)}px, ${Math.round(de)}px)`,s.style.transform=`scale(${Ss}) rotate(${ks}deg) skew(${Kr}deg, ${Kr}deg)`})}function ys(O){if(L(z)==!1){let de=H.Rectangle.getOffsets(i,o,O);K.set(Math.round(de.x),{duration:0}),Tt.set(Math.round(de.y),{duration:0}),Yr(K.value,Tt.value),T=O,B(z,!0)}else if(O!=T){let de=Math.abs(O-T),Mt=de<180?de:360-de,ot=Math.log(Mt)*75,je=H.Rectangle.getOffsets(i,o,O);K.set(Math.round(je.x),{duration:ot}),Tt.set(Math.round(je.y),{duration:ot}),T=O}}function ws(){return H.Rectangle.getOffsets(i,o,T)}var At=Wa();let Hr;var Xr=dr(At);Ve(Xr,O=>s=O,()=>s);var Gt=la(Xr,2),Gr=dr(Gt);return Ve(Gr,O=>a=O,()=>a),Ve(Gt,O=>n=O,()=>n),Ve(At,O=>t=O,()=>t),Kn(O=>{Hr=ds(At,1,"anchor svelte-j5igi2",null,Hr,O),zt(Gt,`margin: ${e.margin}px;`),zt(Gr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)},[()=>({displayed:L(u)})]),us(r,At),Zr({getBody:l,setDisplayed:d,getDisplayed:h,setCollapsed:v,getCollapsed:x,getExpanded:N,setAngle:ys,getOffsets:ws})}class hs{constructor(e,t,n,s,a){f(this,"swLat");f(this,"swLng");f(this,"neLat");f(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,h=l.x+s,p=l.y-a,v=H.Mercator.unproject(u,d,i),x=H.Mercator.unproject(h,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 pn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(pn||(pn={}));const g=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pe=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 _t=(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 Ya=_t;function pr(){return Ya}const mr=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=pr(),n=mr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===_t?void 0:_t].filter(s=>!!s)});r.common.issues.push(n)}class G{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 G.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}),mn=r=>r.status==="aborted",vn=r=>r.status==="dirty",et=r=>r.status==="valid",Vt=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 be{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 gn=(r,e)=>{if(et(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 pe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new G,ctx:{common:e.parent.common,data:e.data,parsedType:pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Vt(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:pe(e)},s=this._parseSync({data:e,path:n.path,parent:n});return gn(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:pe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return et(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=>et(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:pe(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Vt(s)?s:Promise.resolve(s));return gn(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 nt({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 ke.create(this,this._def)}nullable(){return st.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ue.create(this)}promise(){return kt.create(this,this._def)}or(e){return Ut.create([this,e],this._def)}and(e){return $t.create(this,e,this._def)}transform(e){return new nt({...b(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new wr({...b(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new vi({typeName:w.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new kr({...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 Br.create(this,e)}readonly(){return xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ha=/^c[^\s-]{8,}$/i,Xa=/^[0-9a-z]+$/,Ga=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ja=/^[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,Ka=/^[a-z0-9_-]{21}$/i,Qa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ei=/^[-+]?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)?)??$/,ti=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ri="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let nr;const ni=/^(?:(?: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])$/,si=/^(?:(?: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])$/,ai=/^(([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]))$/,ii=/^(([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])$/,oi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,li=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ps="((\\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])))",ui=new RegExp(`^${ps}$`);function ms(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 di(r){return new RegExp(`^${ms(r)}$`)}function ci(r){let e=`${ps}T${ms(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 fi(r,e){return!!((e==="v4"||!e)&&ni.test(r)||(e==="v6"||!e)&&ai.test(r))}function hi(r,e){if(!Qa.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 pi(r,e){return!!((e==="v4"||!e)&&si.test(r)||(e==="v6"||!e)&&ii.test(r))}class we 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 G;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")ti.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")nr||(nr=new RegExp(ri,"u")),nr.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")Ja.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")Ka.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")Ha.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")Xa.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")Ga.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"?ci(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"?ui.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?di(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"?ei.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?fi(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"?hi(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"?pi(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"?oi.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?li.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 we({...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 we({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new we({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new we({...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}}we.create=r=>new we({checks:[],typeName:w.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});function mi(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 tt 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 G;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"?mi(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 tt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new tt({...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)}}tt.create=r=>new tt({checks:[],typeName:w.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class yt 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 G;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 yt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new yt({...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}}yt.create=r=>new yt({checks:[],typeName:w.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});class vr 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)}}vr.create=r=>new vr({typeName:w.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class Bt 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 G;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 Bt({...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}}Bt.create=r=>new Bt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:w.ZodDate,...b(r)});class _n 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)}}_n.create=r=>new _n({typeName:w.ZodSymbol,...b(r)});class yn 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)}}yn.create=r=>new yn({typeName:w.ZodUndefined,...b(r)});class wn 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)}}wn.create=r=>new wn({typeName:w.ZodNull,...b(r)});class gr extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}gr.create=r=>new gr({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 Ee extends C{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.never,received:t.parsedType}),y}}Ee.create=r=>new Ee({typeName:w.ZodNever,...b(r)});class _r 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)}}_r.create=r=>new _r({typeName:w.ZodVoid,...b(r)});class ue 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 be(t,i,t.path,o)))).then(i=>G.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new be(t,i,t.path,o)));return G.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new ue({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new ue({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new ue({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}ue.create=(r,e)=>new ue({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]=ke.create(ze(n))}return new D({...r._def,shape:()=>e})}else return r instanceof ue?new ue({...r._def,type:ze(r.element)}):r instanceof ke?ke.create(ze(r.unwrap())):r instanceof st?st.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 Ee&&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],h=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new be(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Ee){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 h=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new be(s,h,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const h=await d.key,p=await d.value;u.push({key:h,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>G.mergeObjectSync(n,u)):G.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 ke;)a=a._def.innerType;t[n]=a}return new D({...this._def,shape:()=>t})}keyof(){return vs(A.objectKeys(this.shape))}}D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:Ee.create(),typeName:w.ZodObject,...b(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:Ee.create(),typeName:w.ZodObject,...b(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:Ee.create(),typeName:w.ZodObject,...b(e)});class Ut 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}}Ut.create=(r,e)=>new Ut({options:r,typeName:w.ZodUnion,...b(e)});function yr(r,e){const t=pe(r),n=pe(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=yr(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=yr(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 $t extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(mn(a)||mn(i))return y;const o=yr(a.value,i.value);return o.valid?((vn(a)||vn(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}))}}$t.create=(r,e,t)=>new $t({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 be(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>G.mergeArray(t,i)):G.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 kn 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 be(n,o,n.path,[u,"key"])),value:a._parse(new be(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}}}}kn.create=(r,e,t)=>new kn({valueType:e,keyType:r,typeName:w.ZodMap,...b(t)});class wt 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 be(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new wt({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new wt({...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)}}wt.create=(r,e)=>new wt({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 mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pr(),_t].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:l}})}function s(o,l){return mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pr(),_t].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 kt){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}),h=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(h,a).catch(v=>{throw u.addIssue(s(h,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),h=o._def.returns.safeParse(d,a);if(!h.success)throw new re([s(d,h.error)]);return h.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 xn 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})}}xn.create=(r,e)=>new xn({getter:r,typeName:w.ZodLazy,...b(e)});class bn 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}}bn.create=(r,e)=>new bn({value:r,typeName:w.ZodLiteral,...b(e)});function vs(r,e){return new rt({values:r,typeName:w.ZodEnum,...b(e)})}class rt 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 rt.create(e,{...this._def,...t})}exclude(e,t=this._def){return rt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}rt.create=vs;class En 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}}En.create=(r,e)=>new En({values:r,typeName:w.ZodNativeEnum,...b(e)});class kt 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})))}}kt.create=(r,e)=>new kt({type:r,typeName:w.ZodPromise,...b(e)});class nt 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(!et(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=>et(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);A.assertNever(s)}}nt.create=(r,e,t)=>new nt({schema:r,typeName:w.ZodEffects,effect:e,...b(t)});nt.createWithPreprocess=(r,e,t)=>new nt({schema:e,effect:{type:"preprocess",transform:r},typeName:w.ZodEffects,...b(t)});class ke extends C{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(r,e)=>new ke({innerType:r,typeName:w.ZodOptional,...b(e)});class st extends C{_parse(e){return this._getType(e)===g.null?W(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}st.create=(r,e)=>new st({innerType:r,typeName:w.ZodNullable,...b(e)});class wr 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}}wr.create=(r,e)=>new wr({innerType:r,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class kr 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 Vt(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}}kr.create=(r,e)=>new kr({innerType:r,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class Sn 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}}}Sn.create=r=>new Sn({typeName:w.ZodNaN,...b(r)});class vi 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 Br 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 Br({in:e,out:t,typeName:w.ZodPipeline})}}class xr extends C{_parse(e){const t=this._def.innerType._parse(e),n=s=>(et(s)&&(s.value=Object.freeze(s.value)),s);return Vt(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}xr.create=(r,e)=>new xr({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=we.create,E=tt.create,br=vr.create,Ur=gr.create;qe.create;Ee.create;const Lt=_r.create,$r=ue.create,R=D.create;Ut.create;$t.create;const Cn=he.create,le=pt.create,gi=rt.create,_i=kt.create;ke.create;st.create;R({pin:R({fade:br().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:br()}).optional()}).optional()});const Er=E().min(-90).max(90),Sr=E().min(-180).max(180),yi=R({sw:R({lat:Er,lng:Sr}),ne:R({lat:Er,lng:Sr})}),Cr=Ur().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),gs=R({mapSize:E(),zoomMin:E(),zoomMax:E(),zoomScale:E()}),wi=R({instance:Ur(),inserted:le().returns(br()),insert:le().returns(Lt()),remove:le().returns(Lt()),update:le().args(E()).returns(Lt())}),ki=R({parameters:gs,getContainer:le().args().returns(Cr),getZoom:le().args().returns(E()),getBounds:le().args().returns(yi),panBy:le().args(E(),E()).returns(Lt()),createMarker:le().args(Cr,Er,Sr,E()).returns(wi)}),sr=le().args(De()).returns(_i(Cr)),xi=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:sr}),pin:R({style:R({width:E(),height:E(),radius:E()}),body:sr}).optional(),popup:R({style:R({width:E(),height:E(),radius:E(),margin:E()}),body:sr}).optional()}),bi=$r(xi);Cn([E(),$r(Cn([E(),E()]))]);const Ei=R({id:De(),rank:E(),lat:E(),lng:E(),width:E(),height:E(),margin:E()});R({key:De(),parameters:gs,input:$r(Ei)});const Si=gi(["info","warn","error"]);R({title:De(),level:Si,content:Ur()});const _s="https://arenarium.dev/api/public/v1",Ci=`${_s}/log`,Ti=`${_s}/tooltip/states`,Tn="1.0.187";class Ai{constructor(e,t){f(this,"provider");f(this,"apiStatesUrl");f(this,"apiStatesKey");f(this,"apiLogEnabled");f(this,"markerDataArray",new Array);f(this,"markerDataMap",new Map);f(this,"markerDataUpdating",!1);f(this,"markerPinProcessor");f(this,"markerTooltipProcessor");f(this,"markerPopupProcessor");ki.parse(e),this.provider=e,this.markerPinProcessor=new Ar(e),this.markerTooltipProcessor=new Mi(e),this.markerPopupProcessor=new Oi(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),me.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){bi.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??Ti,{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.DEGREES_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 An(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 An(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:${Tn}] ${t}`,level:e,content:{version:Tn,...n}};await fetch(Ci,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(s){console.error(s)}}}class An{constructor(e,t,n){f(this,"marker");f(this,"zoom");f(this,"pin");f(this,"tooltip");this.marker=t,this.zoom=n[0],this.pin=new Tr(e,t,n),this.tooltip=new Mr(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 qr{constructor(e,t){f(this,"provider");f(this,"id");f(this,"lat");f(this,"lng");f(this,"shown");f(this,"element");f(this,"component");f(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 qr{constructor(t,n,s){var a,i,o,l;super(t,n);f(this,"width");f(this,"height");f(this,"radius");f(this,"zoom");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(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=Vr(qa,{target:this.element,props:{id:this.id+"_pin",layer:Ba,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}};f(Be,"DEFAULT_SIZE",16);let Tr=Be;const Ue=class Ue{constructor(e){f(this,"provider");f(this,"pinElements",new Array);f(this,"pinMaxWidth",0);f(this,"pinMaxHeight",0);f(this,"pinFade",!1);f(this,"pinMaxCount",0);f(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 hs(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)}};f(Ue,"MAP_PINS_MAX_ZOOM",2),f(Ue,"MAP_PINS_MAX_COUNT",128);let Ar=Ue;const Wt=class Wt extends qr{constructor(t,n,s){super(t,n);f(this,"width");f(this,"height");f(this,"margin");f(this,"radius");f(this,"zoom");f(this,"angle");f(this,"states");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(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.DEGREES_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=Vr(fs,{target:this.element,props:{id:this.id+"_tooltip",layer:Va,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)+Wt.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}};f(Wt,"Z_INDEX_OFFSET",1e6);let Mr=Wt;class Mi{constructor(e){f(this,"provider");f(this,"tooltipElements",new Array);f(this,"tooltipMaxWidth",0);f(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 hs(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 Yt=class Yt extends qr{constructor(t,n){if(n.popup==null)throw new Error("Failed to create popup");super(t,n);f(this,"width");f(this,"height");f(this,"margin");f(this,"radius");f(this,"bodyLoading",!1);f(this,"bodyLoaded",!1);f(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=Vr(fs,{target:this.element,props:{id:this.id+"_popup",layer:za,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 Yt.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}};f(Yt,"Z_INDEX_OFFSET",2e6);let Or=Yt;class Oi{constructor(e){f(this,"provider");f(this,"popupElements",new Map);f(this,"popupPositioned",new Map);this.provider=e}show(e){e.pin.shown=!1,e.tooltip.shown=!1;const t=new Or(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.x,d=l+a.y,h=u+n.width,p=d+n.height,v=this.provider.getContainer().getBoundingClientRect(),x=u-v.left,N=v.right-h,I=d-v.top,J=v.bottom-p,T=Math.min(n.width,n.height)/4,z=x<0?x-T:N<0?-N+T:0,K=I<0?I-T:J<0?-J+T:0;this.provider.panBy(z,K),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=Ai;