@arenarium/maps 1.0.199 → 1.0.200
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/index.js +1 -1
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1 -1
- package/package.json +5 -5
package/dist/main.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";var Es=Object.defineProperty;var Qr=r=>{throw TypeError(r)};var Ss=(r,e,t)=>e in r?Es(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var f=(r,e,t)=>Ss(r,typeof e!="symbol"?e+"":e,t),er=(r,e,t)=>e.has(r)||Qr("Cannot "+t);var k=(r,e,t)=>(er(r,e,"read from private field"),t?t.call(r):e.get(r)),D=(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)=>(er(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Ce=(r,e,t)=>(er(r,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Tn=!1;var An=Array.isArray,Cs=Array.prototype.indexOf,Ms=Array.from,ir=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Ts=Object.prototype,As=Array.prototype,Os=Object.getPrototypeOf,en=Object.isExtensible;function Rs(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 Y=2,Nr=4,On=8,Xt=16,Ee=32,Le=64,Rn=128,Q=256,Dt=512,$=1024,se=2048,Se=4096,Je=8192,at=16384,Ir=32768,Is=65536,tn=1<<17,Ps=1<<18,Pr=1<<19,Nn=1<<20,or=1<<21,Lr=1<<22,Oe=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 Ls(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function Ds(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Zs(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function js(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Fs(r){throw new Error("https://svelte.dev/e/effect_orphan")}function zs(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Vs(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Us(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Bs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}const qs=2,F=Symbol();function In(r){return r===this.v}let $s=!1,ae=null;function Zt(r){ae=r}function Zr(r,e=!1,t){ae={p:ae,c:null,e:null,s:r,x:null,l:null}}function jr(r){var e=ae,t=e.e;if(t!==null){e.e=null;for(var n of t)Yn(n)}return r!==void 0&&(e.x=r),ae=e.p,r??{}}function Pn(){return!0}const Ws=new WeakMap;function Hs(r){var e=T;if(e===null)return E.f|=Oe,r;if((e.f&Ir)===0){if((e.f&Rn)===0)throw!e.parent&&r instanceof Error&&Ln(r),r;e.b.error(r)}else Fr(r,e)}function Fr(r,e){for(;e!==null;){if((e.f&Rn)!==0)try{e.b.error(r);return}catch(t){r=t}e=e.parent}throw r instanceof Error&&Ln(r),r}function Ln(r){const e=Ws.get(r);e&&(ir(r,"message",{value:e.message}),ir(r,"stack",{value:e.stack}))}let jt=[];function Ys(){var r=jt;jt=[],Rs(r)}function Xs(r){jt.length===0&&queueMicrotask(Ys),jt.push(r)}function Gs(){for(var r=T.b;r!==null&&!r.has_pending_snippet();)r=r.parent;return r===null&&Ls(),r}function Js(r){var e=Y|se,t=E!==null&&(E.f&Y)!==0?E:null;return T===null||t!==null&&(t.f&Q)!==0?e|=Q:T.f|=Pr,{ctx:ae,deps:null,effects:null,equals:In,f:e,fn:r,reactions:null,rv:0,v:F,wv:0,parent:t??T,ac:null}}function Ks(r,e){let t=T;t===null&&Ds();var n=t.b,s=void 0,a=Vn(F),i=null,o=!E;return ca(()=>{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|=Oe,dr(a,x)):((a.f&Oe)!==0&&(a.f^=Oe),dr(a,v)),o&&(n.update_pending_count(-1),h||d.decrement()),jn()};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 Dn(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Pe(e[t])}}function Qs(r){for(var e=r.parent;e!==null;){if((e.f&Y)===0)return e;e=e.parent}return null}function zr(r){var e,t=T;Qe(Qs(r));try{Dn(r),e=ss(r)}finally{Qe(t)}return e}function Zn(r){var e=zr(r);if(r.equals(e)||(r.v=e,r.wv=rs()),!it)if(ge!==null)ge.set(r,r.v);else{var t=(_e||(r.f&Q)!==0)&&r.deps!==null?Se:$;ee(r,t)}}function ea(r,e,t){const n=Js;if(e.length===0){t(r.map(n));return}var s=Z,a=T,i=ta(),o=Gs();Promise.all(e.map(l=>Ks(l))).then(l=>{s==null||s.activate(),i();try{t([...r.map(n),...l])}catch(u){(a.f&at)===0&&Fr(u,a)}s==null||s.deactivate(),jn()}).catch(l=>{o.error(l)})}function ta(){var r=T,e=E,t=ae;return function(){Qe(r),ke(e),Zt(t)}}function jn(){Qe(null),ke(null),Zt(null)}const ut=new Set;let Z=null,ge=null,rn=new Set,Ft=[];function Fn(){const r=Ft.shift();Ft.length>0&&queueMicrotask(Fn),r()}let vt=[],Vr=null,lr=!1;var We,He,me,bt,Et,Me,Ye,Te,ve,Xe,St,Ct,ne,zn,It,ur;const Wt=class Wt{constructor(){D(this,ne);f(this,"current",new Map);D(this,We,new Map);D(this,He,new Set);D(this,me,0);D(this,bt,null);D(this,Et,!1);D(this,Me,[]);D(this,Ye,[]);D(this,Te,[]);D(this,ve,[]);D(this,Xe,[]);D(this,St,[]);D(this,Ct,[]);f(this,"skipped_effects",new Set)}process(e){var a;vt=[];var t=null;if(ut.size>1){t=new Map,ge=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)Ce(this,ne,zn).call(this,i);if(k(this,Me).length===0&&k(this,me)===0){Ce(this,ne,ur).call(this);var n=k(this,Te),s=k(this,ve);j(this,Te,[]),j(this,ve,[]),j(this,Xe,[]),Z=null,nn(n),nn(s),Z===null?Z=this:ut.delete(this),(a=k(this,bt))==null||a.resolve()}else Ce(this,ne,It).call(this,k(this,Te)),Ce(this,ne,It).call(this,k(this,ve)),Ce(this,ne,It).call(this,k(this,Xe));if(t){for(const[i,{v:o,wv:l}]of t)i.wv<=l&&(i.v=o);ge=null}for(const i of k(this,Me))ht(i);for(const i of k(this,Ye))ht(i);j(this,Me,[]),j(this,Ye,[])}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,Et,!0)}flush(){vt.length>0?ra():Ce(this,ne,ur).call(this),Z===this&&(k(this,me)===0&&ut.delete(this),this.deactivate())}increment(){j(this,me,k(this,me)+1)}decrement(){if(j(this,me,k(this,me)-1),k(this,me)===0){for(const e of k(this,St))ee(e,se),Ke(e);for(const e of k(this,Ct))ee(e,Se),Ke(e);j(this,Te,[]),j(this,ve,[]),this.flush()}else this.deactivate()}add_callback(e){k(this,He).add(e)}settled(){return(k(this,bt)??j(this,bt,Ns())).promise}static ensure(){if(Z===null){const e=Z=new Wt;ut.add(Z),Wt.enqueue(()=>{Z===e&&e.flush()})}return Z}static enqueue(e){Ft.length===0&&queueMicrotask(Fn),Ft.unshift(e)}};We=new WeakMap,He=new WeakMap,me=new WeakMap,bt=new WeakMap,Et=new WeakMap,Me=new WeakMap,Ye=new WeakMap,Te=new WeakMap,ve=new WeakMap,Xe=new WeakMap,St=new WeakMap,Ct=new WeakMap,ne=new WeakSet,zn=function(e){var d;e.f^=$;for(var t=e.first;t!==null;){var n=t.f,s=(n&(Ee|Le))!==0,a=s&&(n&$)!==0,i=a||(n&Je)!==0||this.skipped_effects.has(t);if(!i&&t.fn!==null){if(s)t.f^=$;else if((n&$)===0)if((n&Nr)!==0)k(this,ve).push(t);else if((n&Lr)!==0){var o=(d=t.b)!=null&&d.pending?k(this,Ye):k(this,Me);o.push(t)}else Gt(t)&&((t.f&Xt)!==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}},It=function(e){for(const t of e)((t.f&se)!==0?k(this,St):k(this,Ct)).push(t),ee(t,$);e.length=0},ur=function(){if(!k(this,Et))for(const e of k(this,He))e();k(this,He).clear()};let gt=Wt;function ra(){var r=qe;lr=!0;try{var e=0;for(an(!0);vt.length>0;){var t=gt.ensure();if(e++>1e3){var n,s;na()}t.process(vt),Re.clear()}}finally{lr=!1,an(r),Vr=null}}function na(){try{zs()}catch(r){Fr(r,Vr)}}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&&Gt(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?Qn(n):n.fn=null),Z!==null&&Z.current.size>s&&(n.f&Nn)!==0)break}}for(;t<e;)Ke(r[t++])}}function Ke(r){for(var e=Vr=r;e.parent!==null;){e=e.parent;var t=e.f;if(lr&&e===T&&(t&Xt)!==0)return;if((t&(Le|Ee))!==0){if((t&$)===0)return;e.f^=$}}vt.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 ga(t),t}function U(r,e,t=!1){E!==null&&(!ie||(E.f&tn)!==0)&&Pn()&&(E.f&(Y|Xt|Lr|tn))!==0&&!(B!=null&&B.includes(r))&&Bs();let n=t?dt(e):e;return dr(r,n)}function dr(r,e){if(!r.equals(e)){var t=r.v;it?Re.set(r,e):Re.set(r,t),r.v=e;var n=gt.ensure();n.capture(r,t),(r.f&Y)!==0&&((r.f&se)!==0&&zr(r),ee(r,(r.f&Q)===0?$:Se)),r.wv=rs(),Un(r,se),T!==null&&(T.f&$)!==0&&(T.f&(Ee|Le))===0&&(K===null?_a([r]):K.push(r))}return e}function tr(r){U(r,r.v+1)}function Un(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&&ee(a,e),(i&Y)!==0?Un(a,Se):o&&Ke(a)}}function dt(r){if(typeof r!="object"||r===null||Nt in r)return r;const e=Os(r);if(e!==Ts&&e!==As)return r;var t=new Map,n=An(r),s=q(0),a=Ne,i=o=>{if(Ne===a)return o();var l=E,u=Ne;ke(null),ln(a);var d=o();return ke(l),ln(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)&&Vs();var d=t.get(l);return d===void 0?d=i(()=>{var h=q(u.value);return t.set(l,h),h}):U(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(F));t.set(l,d),tr(s)}}else U(u,F),tr(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),R=q(x);return R}),t.set(l,d)),d!==void 0){var p=I(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=I(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||T!==null&&(!d||(p=ft(o,l))!=null&&p.writable)){u===void 0&&(u=i(()=>{var v=d?dt(o[l]):F,x=q(v);return x}),t.set(l,u));var h=I(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?U(x,F):v in o&&(x=i(()=>q(F)),t.set(v+"",x))}if(h===void 0)(!p||(z=ft(o,l))!=null&&z.writable)&&(h=i(()=>q(void 0)),U(h,dt(u)),t.set(l,h));else{p=h.v!==F;var R=i(()=>dt(u));U(h,R)}var N=Reflect.getOwnPropertyDescriptor(o,l);if(N!=null&&N.set&&N.set.call(d,u),!p){if(n&&typeof l=="string"){var G=t.get("length"),C=Number(l);Number.isInteger(C)&&C>=G.v&&U(G,C+1)}tr(s)}return!0},ownKeys(o){I(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(){Us()}})}var sn,Bn,qn,$n;function sa(){if(sn===void 0){sn=window,Bn=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;qn=ft(e,"firstChild").get,$n=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 aa(r=""){return document.createTextNode(r)}function Wn(r){return qn.call(r)}function Hn(r){return $n.call(r)}function cr(r,e){return Wn(r)}function ia(r,e=1,t=!1){let n=r;for(;e--;)n=Hn(n);return n}function oa(r){T===null&&E===null&&Fs(),E!==null&&(E.f&Q)!==0&&T===null&&js(),it&&Zs()}function la(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function De(r,e,t,n=!0){var s=T;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|=Ir}catch(l){throw Pe(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&Pr)===0;if(!i&&n&&(s!==null&&la(a,s),E!==null&&(E.f&Y)!==0&&(r&Le)===0)){var o=E;(o.effects??(o.effects=[])).push(a)}return a}function de(r){oa();var e=T.f,t=!E&&(e&Ee)!==0&&(e&Ir)===0;if(t){var n=ae;(n.e??(n.e=[])).push(r)}else return Yn(r)}function Yn(r){return De(Nr|Nn,r,!1)}function ua(r){gt.ensure();const e=De(Le,r,!0);return(t={})=>new Promise(n=>{t.outro?ma(e,()=>{Pe(e),n(void 0)}):(Pe(e),n(void 0))})}function da(r){return De(Nr,r,!1)}function ca(r){return De(Lr|Pr,r,!0)}function Xn(r,e=0){return De(On|e,r,!0)}function Gn(r,e=[],t=[]){ea(e,t,n=>{De(On,()=>r(...n.map(I)),!0)})}function fa(r,e=!0){return De(Ee,r,!0,e)}function Jn(r){var e=r.teardown;if(e!==null){const t=it,n=E;on(!0),ke(null);try{e.call(null)}finally{on(t),ke(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(Dr);var n=t.next;(t.f&Le)!==0?t.parent=null:Pe(t,e),t=n}}function ha(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&Ee)===0&&Pe(e),e=t}}function Pe(r,e=!0){var t=!1;(e||(r.f&Ps)!==0)&&r.nodes_start!==null&&r.nodes_end!==null&&(pa(r.nodes_start,r.nodes_end),t=!0),Kn(r,e&&!t),zt(r,0),ee(r,at);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 pa(r,e){for(;r!==null;){var t=r===e?null:Hn(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 ma(r,e){var t=[];es(r,t,!0),va(t,()=>{Pe(r),e&&e()})}function va(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&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&Is)!==0||(n.f&Ee)!==0;es(n,e,a?t:!1),n=s}}}let qe=!1;function an(r){qe=r}let it=!1;function on(r){it=r}let E=null,ie=!1;function ke(r){E=r}let T=null;function Qe(r){T=r}let B=null;function ga(r){E!==null&&(B===null?B=[r]:B.push(r))}let V=null,H=0,K=null;function _a(r){K=r}let ts=1,_t=0,Ne=_t;function ln(r){Ne=r}let _e=!1;function rs(){return++ts}function Gt(r){var h;var e=r.f;if((e&se)!==0)return!0;if((e&Se)!==0){var t=r.deps,n=(e&Q)!==0;if(t!==null){var s,a,i=(e&Dt)!==0,o=n&&T!==null&&!_e,l=t.length;if((i||o)&&(T===null||(T.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&Q)===0&&(u.f^=Q)}for(s=0;s<l;s++)if(a=t[s],Gt(a)&&Zn(a),a.wv>r.wv)return!0}(!n||T!==null&&!_e)&&ee(r,$)}return!1}function ns(r,e,t=!0){var n=r.reactions;if(n!==null&&!(B!=null&&B.includes(r)))for(var s=0;s<n.length;s++){var a=n[s];(a.f&Y)!==0?ns(a,e,!1):e===a&&(t?ee(a,se):(a.f&$)!==0&&ee(a,Se),Ke(a))}}function ss(r){var x;var e=V,t=H,n=K,s=E,a=_e,i=B,o=ae,l=ie,u=Ne,d=r.f;V=null,H=0,K=null,_e=(d&Q)!==0&&(ie||!qe||E===null),E=(d&(Ee|Le))===0?r:null,B=null,Zt(r.ctx),ie=!1,Ne=++_t,r.ac!==null&&(r.ac.abort(Dr),r.ac=null);try{r.f|=or;var h=(0,r.fn)(),p=r.deps;if(V!==null){var v;if(zt(r,H),p!==null&&H>0)for(p.length=H+V.length,v=0;v<V.length;v++)p[H+v]=V[v];else r.deps=p=V;if(!_e||(d&Y)!==0&&r.reactions!==null)for(v=H;v<p.length;v++)((x=p[v]).reactions??(x.reactions=[])).push(r)}else p!==null&&H<p.length&&(zt(r,H),p.length=H);if(Pn()&&K!==null&&!ie&&p!==null&&(r.f&(Y|Se|se))===0)for(v=0;v<K.length;v++)ns(K[v],r);return s!==null&&s!==r&&(_t++,K!==null&&(n===null?n=K:n.push(...K))),(r.f&Oe)!==0&&(r.f^=Oe),h}catch(R){return Hs(R)}finally{r.f^=or,V=e,H=t,K=n,E=s,_e=a,B=i,Zt(o),ie=l,Ne=u}}function ya(r,e){let t=e.reactions;if(t!==null){var n=Cs.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&Y)!==0&&(V===null||!V.includes(e))&&(ee(e,Se),(e.f&(Q|Dt))===0&&(e.f^=Dt),Dn(e),zt(e,0))}function zt(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)ya(r,t[n])}function ht(r){var e=r.f;if((e&at)===0){ee(r,$);var t=T,n=qe;T=r,qe=!0;try{(e&Xt)!==0?ha(r):Kn(r),Jn(r);var s=ss(r);r.teardown=typeof s=="function"?s:null,r.wv=ts;var a;Tn&&$s&&(r.f&se)!==0&&r.deps}finally{qe=n,T=t}}}function I(r){var e=r.f,t=(e&Y)!==0;if(E!==null&&!ie){var n=T!==null&&(T.f&at)!==0;if(!n&&!(B!=null&&B.includes(r))){var s=E.deps;if((E.f&or)!==0)r.rv<_t&&(r.rv=_t,V===null&&s!==null&&s[H]===r?H++:V===null?V=[r]:(!_e||!V.includes(r))&&V.push(r));else{(E.deps??(E.deps=[])).push(r);var a=r.reactions;a===null?r.reactions=[E]:a.includes(E)||a.push(E)}}}else if(t&&r.deps===null&&r.effects===null){var i=r,o=i.parent;o!==null&&(o.f&Q)===0&&(i.f^=Q)}if(it){if(Re.has(r))return Re.get(r);if(t){i=r;var l=i.v;return((i.f&$)===0&&i.reactions!==null||as(i))&&(l=zr(i)),Re.set(i,l),l}}else if(t){if(i=r,ge!=null&&ge.has(i))return ge.get(i);Gt(i)&&Zn(i)}if((r.f&Oe)!==0)throw r.v;return r.v}function as(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&Y)!==0&&as(e))return!0;return!1}function wa(r){var e=ie;try{return ie=!0,r()}finally{ie=e}}const ka=-7169;function ee(r,e){r.f=r.f&ka|e}const xa=["touchstart","touchmove"];function ba(r){return xa.includes(r)}const Ea=new Set,un=new Set;function Rt(r){var C;var e=this,t=e.ownerDocument,n=r.type,s=((C=r.composedPath)==null?void 0:C.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){ir(r,"currentTarget",{configurable:!0,get(){return a||t}});var d=E,h=T;ke(null),Qe(null);try{for(var p,v=[];a!==null;){var x=a.assignedSlot||a.parentNode||a.host||null;try{var R=a["__"+n];if(R!=null&&(!a.disabled||r.target===a))if(An(R)){var[N,...G]=R;N.apply(a,[r,...G])}else R.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,ke(d),Qe(h)}}}function Sa(r){var e=document.createElement("template");return e.innerHTML=r.replaceAll("<!>","<!---->"),e.content}function Ca(r,e){var t=T;t.nodes_start===null&&(t.nodes_start=r,t.nodes_end=e)}function is(r,e){var t=(e&qs)!==0,n,s=!r.startsWith("<!>");return()=>{n===void 0&&(n=Sa(s?r:"<!>"+r),n=Wn(n));var a=t||Bn?document.importNode(n,!0):n.cloneNode(!0);return Ca(a,a),a}}function os(r,e){r!==null&&r.before(e)}function Ur(r,e){return Ma(r,e)}const je=new Map;function Ma(r,{target:e,anchor:t,props:n={},events:s,context:a,intro:i=!0}){sa();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=ba(v);e.addEventListener(v,Rt,{passive:x});var R=je.get(v);R===void 0?(document.addEventListener(v,Rt,{passive:x}),je.set(v,1)):je.set(v,R+1)}}};l(Ms(Ea)),un.add(l);var u=void 0,d=ua(()=>{var h=t??e.appendChild(aa());return fa(()=>{if(a){Zr({});var p=ae;p.c=a}s&&(n.$$events=s),u=r(h,n)||{},a&&jr()}),()=>{var x;for(var p of o){e.removeEventListener(p,Rt);var v=je.get(p);--v===0?(document.removeEventListener(p,Rt),je.delete(p)):je.set(p,v)}un.delete(l),h!==t&&((x=h.parentNode)==null||x.removeChild(h))}});return Ta.set(u,d),u}let Ta=new WeakMap;const dn=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function Aa(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 rr(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Oa(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(rr)),s&&l.push(...Object.keys(s).map(rr));var u=0,d=-1;const R=r.length;for(var h=0;h<R;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===R-1){if(d!==-1){var v=rr(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 ls(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Aa(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 nr(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 Vt(r,e,t,n){var s=r.__style;if(s!==e){var a=Oa(e,n);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}else n&&(Array.isArray(n)?(nr(r,t==null?void 0:t[0],n[0]),nr(r,t==null?void 0:t[1],n[1],"important")):nr(r,t,n));return n}const Ra=()=>performance.now(),oe={tick:r=>requestAnimationFrame(r),now:()=>Ra(),tasks:new Set};function us(){const r=oe.now();oe.tasks.forEach(e=>{e.c(r)||(oe.tasks.delete(e),e.f())}),oe.tasks.size!==0&&oe.tick(us)}function Na(r){let e;return oe.tasks.size===0&&oe.tick(us),{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 ze(r={},e,t,n){return da(()=>{var s,a;return Xn(()=>{s=a,a=[],wa(()=>{r!==t(...a)&&(e(r,...a),s&&fn(t(...s),r)&&e(null,...s))})}),()=>{Xs(()=>{a&&fn(t(...a),r)&&e(null,...a)})}}),r}const Ia="5";var Mn;typeof window<"u"&&((Mn=window.__svelte??(window.__svelte={})).v??(Mn.v=new Set)).add(Ia);function Pa(r){return r}function fr(r){return-.5*(Math.cos(Math.PI*r)-1)}function La(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function Da(r){return Math.sin(r*Math.PI/2)}const Za=128,ja=0,Fa=1,za=2;class Va{constructor(){f(this,"animationsStarted",!1);f(this,"animationsCount",0);f(this,"animationsLimit",Za);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 pe=new Va;function hn(r){return Object.prototype.toString.call(r)==="[object Date]"}function hr(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)=>hr(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]=hr(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 ce,Ge,Mt,Ae;const Wr=class Wr{constructor(e,t={}){D(this,ce);D(this,Ge);D(this,Mt);D(this,Ae,null);j(this,ce,q(e)),j(this,Ge,q(e)),j(this,Mt,t)}static of(e,t){const n=new Wr(e(),t);return Xn(()=>{n.set(e())}),n}set(e,t){var h;U(k(this,Ge),e);let{delay:n=0,duration:s=400,easing:a=Pa,interpolate:i=hr}={...k(this,Mt),...t};if(s===0)return(h=k(this,Ae))==null||h.abort(),U(k(this,ce),e),Promise.resolve();const o=oe.now()+n;let l,u=!1,d=k(this,Ae);return j(this,Ae,Na(p=>{if(p<o)return!0;if(!u){u=!0;const x=k(this,ce).v;l=i(x,e),typeof s=="function"&&(s=s(x,e)),d==null||d.abort()}const v=p-o;return v>s?(U(k(this,ce),e),!1):(U(k(this,ce),l(a(v/s))),!0)})),k(this,Ae).promise}get current(){return I(k(this,ce))}get target(){return I(k(this,Ge))}set target(e){this.set(e)}};ce=new WeakMap,Ge=new WeakMap,Mt=new WeakMap,Ae=new WeakMap;let pr=Wr;class Pt{constructor(e,t){f(this,"value");f(this,"motion");this.value=e,this.motion=new pr(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 Ua=is('<div><div class="body svelte-1nfn9j8"></div></div>');function Ba(r,e){Zr(e,!0);let t,n;function s(){return n}let a=q(!1);function i(C){U(a,C,!0)}function o(){return I(a)}let l=new Pt(0,{easing:fr});de(()=>{u(l.motion.current)}),de(()=>{I(a)==!1&&(l.snap(),pe.clear(e.priority,e.id))});function u(C){t&&pe.equeue(e.layer,e.priority,e.id,()=>{t.style.scale=C.toString(),t.style.filter=`brightness(${.25+.75*C})`,n.style.opacity=C.toString()})}function d(C){C!=l.value&&l.set(C,{duration:75})}function h(){return l.motion.current==0}function p(){return l.value}var v=Ua();let x,R;var N=cr(v);let G;return ze(N,C=>n=C,()=>n),ze(v,C=>t=C,()=>t),Gn((C,z,J)=>{x=ls(v,1,"pin svelte-1nfn9j8",null,x,C),R=Vt(v,"",R,z),G=Vt(N,"",G,J)},[()=>({displayed:I(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`})]),os(r,v),jr({getBody:s,setDisplayed:i,getDisplayed:o,setScale:d,getCollapsed:h,getScale:p})}var pt;(r=>{function e(t,n,s){const a=t/2,i=n/2,o=Math.sqrt(a*a+i*i),l=Math.atan(i/a)*(180/Math.PI),u=s*(Math.PI/180);return s<180?s<90?s<l?{x:0,y:o*Math.sin(u)-i}:{x:o*Math.cos(u)-a,y:0}:s<180-l?{x:o*Math.cos(u)-a,y:0}:{x:-t,y:o*Math.sin(u)-i}:s<270?s<180+l?{x:-t,y:o*Math.sin(u)-i}:{x:o*Math.cos(u)-a,y:-n}:s<360-l?{x:o*Math.cos(u)-a,y:-n}:{x:0,y:o*Math.sin(u)-i}}r.getOffsets=e})(pt||(pt={}));var qa=is('<div><div class="pointer svelte-j5igi2"></div> <div class="bubble svelte-j5igi2"><div class="body svelte-j5igi2"></div></div></div>');function ds(r,e){Zr(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){U(u,O,!0)}function h(){return I(u)}let p=q(!0);function v(O){U(p,O,!0)}function x(){return N.motion.current==0}function R(){return N.motion.current==1}let N=new Pt(0);de(()=>{G(N.motion.current)}),de(()=>{I(u)==!1&&(N.snap(),pe.clear(e.priority,e.id+"_scale"))}),de(()=>{I(p)==!0&&N.value!=0&&(pe.stacked()?N.set(0,{duration:0}):N.set(0,{duration:150,easing:La})),I(p)==!1&&N.value!=1&&N.set(1,{duration:150,easing:Da})});function G(O){!t||!n||!s||pe.equeue(I(p)?0:e.layer,e.priority,e.id+"_scale",()=>{t.style.opacity=`${O}`,n.style.scale=`${O}`,s.style.scale=`${O}`})}let C=NaN,z=q(!1),J=new Pt(-i/2,{easing:fr}),Tt=new Pt(-o/2,{easing:fr});de(()=>{Hr(J.motion.current,Tt.motion.current)}),de(()=>{I(u)==!1&&(J.snap(),J.snap(),pe.clear(e.priority,e.id+"_angle"))}),de(()=>{I(p)==!0&&I(z)&&(J.update({duration:75}),J.update({duration:75}))});function Hr(O,ue){if(!t||!n||!s)return;const Ot=O+i/2,ot=ue+o/2,Ze=o<i?Ot*o/i:Ot,Kt=o>i?ot*i/o:ot,ys=Math.atan2(Kt,Ze)/Math.PI*180-45,Jr=0,ws=30,Qt=Math.sqrt(Ze*Ze+Kt*Kt),lt=Math.min(i,o)/2,ks=lt*Math.SQRT2,xs=(Qt-lt)/(ks-lt),Kr=Jr+xs*(ws-Jr),bs=Qt<lt?Qt/lt:1;pe.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(O)}px, ${Math.round(ue)}px)`,s.style.transform=`scale(${bs}) rotate(${ys}deg) skew(${Kr}deg, ${Kr}deg)`})}function gs(O){if(I(z)==!1){let ue=pt.getOffsets(i,o,O);J.set(Math.round(ue.x),{duration:0}),Tt.set(Math.round(ue.y),{duration:0}),Hr(J.value,Tt.value),C=O,U(z,!0)}else if(O!=C){let ue=Math.abs(O-C),Ot=ue<180?ue:360-ue,ot=Math.log(Ot)*75,Ze=pt.getOffsets(i,o,O);J.set(Math.round(Ze.x),{duration:ot}),Tt.set(Math.round(Ze.y),{duration:ot}),C=O}}function _s(){return pt.getOffsets(i,o,C)}var At=qa();let Yr;var Xr=cr(At);ze(Xr,O=>s=O,()=>s);var Jt=ia(Xr,2),Gr=cr(Jt);return ze(Gr,O=>a=O,()=>a),ze(Jt,O=>n=O,()=>n),ze(At,O=>t=O,()=>t),Gn(O=>{Yr=ls(At,1,"anchor svelte-j5igi2",null,Yr,O),Vt(Jt,`margin: ${e.margin}px;`),Vt(Gr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)},[()=>({displayed:I(u)})]),os(r,At),jr({getBody:l,setDisplayed:d,getDisplayed:h,setCollapsed:v,getCollapsed:x,getExpanded:R,setAngle:gs,getOffsets:_s})}var Ve;(r=>{function e(o,l,u){return{x:n(l)*u,y:s(o)*u}}r.project=e;function t(o,l,u){return{lat:i(l/u),lng:a(o/u)}}r.unproject=t;function n(o){return(180+o)/360}function s(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function a(o){return o*360-180}function i(o){return 360/Math.PI*Math.atan(Math.exp((180-o*360)*Math.PI/180))-90}})(Ve||(Ve={}));class cs{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=Ve.project(e.sw.lat,e.sw.lng,i),l=Ve.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=Ve.unproject(u,d,i),x=Ve.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 M;(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})(M||(M={}));var pn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(pn||(pn={}));const g=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),he=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=M.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 te 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 te))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.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()}}te.create=r=>new te(r);const yt=(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,M.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${M.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${M.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${M.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}"`:M.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,M.assertNever(r)}return{message:t}};let $a=yt;function mr(){return $a}const vr=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=mr(),n=vr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===yt?void 0:yt].filter(s=>!!s)});r.common.issues.push(n)}class X{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 X.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",Ut=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 xe{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 te(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 S{get description(){return this._def.description}_getType(e){return he(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ut(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:he(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:he(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:he(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ut(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 we.create(this,this._def)}nullable(){return st.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return xt.create(this,this._def)}or(e){return qt.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 kr({...b(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new pi({typeName:w.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new xr({...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 br.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Wa=/^c[^\s-]{8,}$/i,Ha=/^[0-9a-z]+$/,Ya=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xa=/^[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,Ga=/^[a-z0-9_-]{21}$/i,Ja=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ka=/^[-+]?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)?)??$/,Qa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ei="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sr;const ti=/^(?:(?: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])$/,ri=/^(?:(?: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])$/,ni=/^(([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]))$/,si=/^(([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])$/,ai=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ii=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fs="((\\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])))",oi=new RegExp(`^${fs}$`);function hs(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 li(r){return new RegExp(`^${hs(r)}$`)}function ui(r){let e=`${fs}T${hs(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 di(r,e){return!!((e==="v4"||!e)&&ti.test(r)||(e==="v6"||!e)&&ni.test(r))}function ci(r,e){if(!Ja.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 fi(r,e){return!!((e==="v4"||!e)&&ri.test(r)||(e==="v6"||!e)&&si.test(r))}class ye extends S{_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 X;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")Qa.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")sr||(sr=new RegExp(ei,"u")),sr.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")Xa.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")Ga.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")Wa.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")Ha.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")Ya.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"?ui(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"?oi.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?li(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"?Ka.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?di(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"?ci(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"?fi(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"?ai.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?ii.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):M.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 ye({...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 ye({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ye({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ye({...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}}ye.create=r=>new ye({checks:[],typeName:w.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});function hi(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 S{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 X;for(const a of this._def.checks)a.kind==="int"?M.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"?hi(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()):M.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"&&M.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 wt extends S{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 X;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()):M.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 wt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new wt({...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}}wt.create=r=>new wt({checks:[],typeName:w.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});class gr extends S{_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)}}gr.create=r=>new gr({typeName:w.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class Bt extends S{_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 X;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()):M.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 S{_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 S{_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 S{_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 _r extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}_r.create=r=>new _r({typeName:w.ZodAny,...b(r)});class $e extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}$e.create=r=>new $e({typeName:w.ZodUnknown,...b(r)});class be extends S{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.never,received:t.parsedType}),y}}be.create=r=>new be({typeName:w.ZodNever,...b(r)});class yr extends S{_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)}}yr.create=r=>new yr({typeName:w.ZodVoid,...b(r)});class le extends S{_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 xe(t,i,t.path,o)))).then(i=>X.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new xe(t,i,t.path,o)));return X.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 Fe(r){if(r instanceof P){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=we.create(Fe(n))}return new P({...r._def,shape:()=>e})}else return r instanceof le?new le({...r._def,type:Fe(r.element)}):r instanceof we?we.create(Fe(r.unwrap())):r instanceof st?st.create(Fe(r.unwrap())):r instanceof fe?fe.create(r.items.map(e=>Fe(e))):r}class P extends S{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=M.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 be&&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 xe(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof be){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 xe(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=>X.mergeObjectSync(n,u)):X.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new P({...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 P({...this._def,unknownKeys:"strip"})}passthrough(){return new P({...this._def,unknownKeys:"passthrough"})}extend(e){return new P({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new P({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 P({...this._def,catchall:e})}pick(e){const t={};for(const n of M.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new P({...this._def,shape:()=>t})}omit(e){const t={};for(const n of M.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new P({...this._def,shape:()=>t})}deepPartial(){return Fe(this)}partial(e){const t={};for(const n of M.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new P({...this._def,shape:()=>t})}required(e){const t={};for(const n of M.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof we;)a=a._def.innerType;t[n]=a}return new P({...this._def,shape:()=>t})}keyof(){return ps(M.objectKeys(this.shape))}}P.create=(r,e)=>new P({shape:()=>r,unknownKeys:"strip",catchall:be.create(),typeName:w.ZodObject,...b(e)});P.strictCreate=(r,e)=>new P({shape:()=>r,unknownKeys:"strict",catchall:be.create(),typeName:w.ZodObject,...b(e)});P.lazycreate=(r,e)=>new P({shape:r,unknownKeys:"strip",catchall:be.create(),typeName:w.ZodObject,...b(e)});class qt extends S{_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 te(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 te(l));return m(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}qt.create=(r,e)=>new qt({options:r,typeName:w.ZodUnion,...b(e)});function wr(r,e){const t=he(r),n=he(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&n===g.object){const s=M.objectKeys(e),a=M.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=wr(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=wr(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 S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(mn(a)||mn(i))return y;const o=wr(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 fe extends S{_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 xe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>X.mergeArray(t,i)):X.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new fe({...this._def,rest:e})}}fe.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fe({items:r,typeName:w.ZodTuple,rest:null,...b(e)})};class kn extends S{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 xe(n,o,n.path,[u,"key"])),value:a._parse(new xe(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 kt extends S{_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 xe(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new kt({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new kt({...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)}}kt.create=(r,e)=>new kt({valueType:r,minSize:null,maxSize:null,typeName:w.ZodSet,...b(e)});class mt extends S{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 vr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mr(),yt].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:l}})}function s(o,l){return vr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mr(),yt].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 xt){const o=this;return W(async function(...l){const u=new te([]),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 te([n(l,u.error)]);const d=Reflect.apply(i,this,u.data),h=o._def.returns.safeParse(d,a);if(!h.success)throw new te([s(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new mt({...this._def,args:fe.create(e).rest($e.create())})}returns(e){return new mt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new mt({args:e||fe.create([]).rest($e.create()),returns:t||$e.create(),typeName:w.ZodFunction,...b(n)})}}class xn extends S{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 S{_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 ps(r,e){return new rt({values:r,typeName:w.ZodEnum,...b(e)})}class rt extends S{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:M.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=ps;class En extends S{_parse(e){const t=M.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==g.string&&n.parsedType!==g.number){const s=M.objectValues(t);return m(n,{expected:M.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(M.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=M.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 xt extends S{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})))}}xt.create=(r,e)=>new xt({type:r,typeName:w.ZodPromise,...b(e)});class nt extends S{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);M.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 we extends S{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}we.create=(r,e)=>new we({innerType:r,typeName:w.ZodOptional,...b(e)});class st extends S{_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 kr extends S{_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}}kr.create=(r,e)=>new kr({innerType:r,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class xr extends S{_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 Ut(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new te(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}xr.create=(r,e)=>new xr({innerType:r,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class Sn extends S{_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 pi extends S{_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 S{_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 br extends S{_parse(e){const t=this._def.innerType._parse(e),n=s=>(et(s)&&(s.value=Object.freeze(s.value)),s);return Ut(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}br.create=(r,e)=>new br({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 qr=ye.create,A=tt.create,Er=gr.create,ms=_r.create;$e.create;be.create;const Lt=yr.create,mi=le.create,L=P.create;qt.create;$t.create;fe.create;const re=mt.create;rt.create;const vi=xt.create;we.create;st.create;L({pin:L({fade:Er().optional(),maxCount:A().optional(),maxZoom:A().optional()}).optional(),animation:L({queue:L({limit:A().optional()}).optional()}).optional(),api:L({states:L({url:qr(),singleRequest:Er().optional()}).optional()}).optional()});const Sr=A().min(-90).max(90),Cr=A().min(-180).max(180),gi=L({sw:L({lat:Sr,lng:Cr}),ne:L({lat:Sr,lng:Cr})}),Mr=ms().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),_i=L({mapSize:A().min(1),zoomMin:A().min(0),zoomMax:A().min(0),zoomScale:A().min(1).max(10)}),yi=L({instance:ms(),inserted:re().returns(Er()),insert:re().returns(Lt()),remove:re().returns(Lt()),update:re().args(A()).returns(Lt())}),wi=L({getParameters:re().args().returns(_i),getContainer:re().args().returns(Mr),getZoom:re().args().returns(A()),getBounds:re().args().returns(gi),panBy:re().args(A(),A()).returns(Lt()),createMarker:re().args(Mr,Sr,Cr,A()).returns(yi)}),ar=re().args(qr()).returns(vi(Mr)),ki=L({id:qr().min(1),rank:A(),lat:A().min(-90).max(90),lng:A().min(-180).max(180),tooltip:L({style:L({width:A(),height:A(),margin:A(),radius:A()}).refine(r=>Math.min(r.width,r.height)/r.margin>=5,"Tooltip width and height must be at least 5 times the margin"),body:ar}),pin:L({style:L({width:A(),height:A(),radius:A()}),body:ar}).optional(),popup:L({style:L({width:A(),height:A(),radius:A(),margin:A()}),body:ar}).optional()}),xi=mi(ki);var Ie;(r=>{r.COUNT=12,r.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],r.DEGREES_DEFAULT=270})(Ie||(Ie={}));const Cn="1.0.200",vs="https://maps.api.arenarium.dev",bi=`${vs}/log`,Ei=`${vs}/tooltip/states`;class Si{constructor(e,t,n){f(this,"apiKey");f(this,"apiStatesUrl");f(this,"apiStatesSingleRequest",!1);f(this,"mapProvider");f(this,"markerDataArray",new Array);f(this,"markerDataMap",new Map);f(this,"markerDataUpdating",!1);f(this,"markerPinProcessor");f(this,"markerTooltipProcessor");f(this,"markerPopupProcessor");wi.parse(t),this.apiKey=e,this.mapProvider=t,this.markerPinProcessor=new Ar(t),this.markerTooltipProcessor=new Mi(t),this.markerPopupProcessor=new Ti(t),this.configuration=n,this.log("info","Loaded")}set configuration(e){var t,n,s,a,i,o;this.markerPinProcessor.setConfiguration(e),this.apiStatesUrl=((n=(t=e==null?void 0:e.api)==null?void 0:t.states)==null?void 0:n.url)??void 0,this.apiStatesSingleRequest=((a=(s=e==null?void 0:e.api)==null?void 0:s.states)==null?void 0:a.singleRequest)??!1,pe.setLimit(((o=(i=e==null?void 0:e.animation)==null?void 0:i.queue)==null?void 0:o.limit)??8*navigator.hardwareConcurrency)}async updateMarkers(e){xi.parse(e);try{await this.updateMarkerData(e),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}}async updateMarkerData(e){try{let t=this.markerDataArray.map(s=>s.marker);for(let s=0;s<e.length;s++){const a=e[s];this.markerDataMap.get(a.id)||t.push(a)}let n;if(e.length>1){const s=this.mapProvider.getParameters(),a=t.map(u=>({id:u.id,rank:u.rank,lat:u.lat,lng:u.lng,width:u.tooltip.style.width,height:u.tooltip.style.height,margin:u.tooltip.style.margin})),i={key:this.apiKey,parameters:s,input:a},o=this.apiStatesUrl??Ei,l=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok||!l.body)throw new Error("Failed to get marker states: "+l.statusText);n=await l.json()}else n=[[0,[[0,Ie.DEGREES.indexOf(Ie.DEGREES_DEFAULT)]]]];try{this.markerDataUpdating=!0;for(let s=0;s<t.length;s++){const a=t[s],i=n[s],o=this.markerDataMap.get(a.id);if(o)o.update(i);else{const l=new Ci(this.mapProvider,a,i);l.create(),this.markerDataMap.set(a.id,l),this.markerDataArray.push(l)}}this.markerDataArray.sort((s,a)=>s.zoom-a.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(s=>s.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(s=>s.tooltip))}finally{this.markerDataUpdating=!1}}catch(t){throw console.error(t),this.markerDataArray.forEach(n=>n.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),t instanceof Error&&this.log("error","Failed to update marker data",t),t}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.mapProvider.getBounds(),t=this.mapProvider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,t),this.markerPinProcessor.process(e,t)}async log(e,t,n){if(!(window!=null&&window.location.host.startsWith("localhost")||window!=null&&window.location.host.startsWith("127.0.0.1")))try{const s={title:`[CLIENT:${Cn}] ${t}`,level:e,content:{version:Cn,...n}};await fetch(bi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(s){console.error(s)}}}class Ci{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 Or(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 $r{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 Ue=class Ue extends $r{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)??Ue.DEFAULT_SIZE,this.height=((i=n.pin)==null?void 0:i.style.height)??Ue.DEFAULT_SIZE,this.radius=((o=n.pin)==null?void 0:o.style.radius)??Ue.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=Ur(Ba,{target:this.element,props:{id:this.id+"_pin",layer:za,priority:this.zoom*this.provider.getParameters().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(){const t=this.provider.getParameters();return Math.round((t.zoomMax-this.zoom)*t.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};f(Ue,"DEFAULT_SIZE",16);let Tr=Ue;const Be=class Be{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(Be.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=e==null?void 0:e.pin)==null?void 0:s.maxZoom)??Be.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.getParameters().mapSize,s=new cs(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(Be,"MAP_PINS_MAX_ZOOM",2),f(Be,"MAP_PINS_MAX_COUNT",128);let Ar=Be;const Ht=class Ht extends $r{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=Ie.DEGREES_DEFAULT,this.states=s[1].map(a=>[a[0],Ie.DEGREES[a[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=Ur(ds,{target:this.element,props:{id:this.id+"_tooltip",layer:Fa,priority:this.zoom*this.provider.getParameters().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],Ie.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(){const t=this.provider.getParameters();return Math.round((t.zoomMax-this.zoom)*t.zoomScale)+Ht.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(Ht,"Z_INDEX_OFFSET",1e6);let Or=Ht;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.getParameters().mapSize,s=new cs(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 $r{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=Ur(ds,{target:this.element,props:{id:this.id+"_popup",layer:ja,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 Rr=Yt;class Ti{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 Rr(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,R=v.right-h,N=d-v.top,G=v.bottom-p,C=Math.min(n.width,n.height)/4,z=x<0?x-C:R<0?-R+C:0,J=N<0?N-C:G<0?-G+C:0;this.provider.panBy(z,J),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=Si;
|
|
2
|
+
\r\f \v\uFEFF`];function Aa(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 rr(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Oa(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(rr)),s&&l.push(...Object.keys(s).map(rr));var u=0,d=-1;const R=r.length;for(var h=0;h<R;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===R-1){if(d!==-1){var v=rr(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 ls(r,e,t,n,s,a){var i=r.__className;if(i!==t||i===void 0){var o=Aa(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 nr(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 Vt(r,e,t,n){var s=r.__style;if(s!==e){var a=Oa(e,n);a==null?r.removeAttribute("style"):r.style.cssText=a,r.__style=e}else n&&(Array.isArray(n)?(nr(r,t==null?void 0:t[0],n[0]),nr(r,t==null?void 0:t[1],n[1],"important")):nr(r,t,n));return n}const Ra=()=>performance.now(),oe={tick:r=>requestAnimationFrame(r),now:()=>Ra(),tasks:new Set};function us(){const r=oe.now();oe.tasks.forEach(e=>{e.c(r)||(oe.tasks.delete(e),e.f())}),oe.tasks.size!==0&&oe.tick(us)}function Na(r){let e;return oe.tasks.size===0&&oe.tick(us),{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 ze(r={},e,t,n){return da(()=>{var s,a;return Xn(()=>{s=a,a=[],wa(()=>{r!==t(...a)&&(e(r,...a),s&&fn(t(...s),r)&&e(null,...s))})}),()=>{Xs(()=>{a&&fn(t(...a),r)&&e(null,...a)})}}),r}const Ia="5";var Mn;typeof window<"u"&&((Mn=window.__svelte??(window.__svelte={})).v??(Mn.v=new Set)).add(Ia);function Pa(r){return r}function fr(r){return-.5*(Math.cos(Math.PI*r)-1)}function La(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function Da(r){return Math.sin(r*Math.PI/2)}const Za=128,ja=0,Fa=1,za=2;class Va{constructor(){f(this,"animationsStarted",!1);f(this,"animationsCount",0);f(this,"animationsLimit",Za);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 pe=new Va;function hn(r){return Object.prototype.toString.call(r)==="[object Date]"}function hr(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)=>hr(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]=hr(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 ce,Ge,Mt,Ae;const Wr=class Wr{constructor(e,t={}){D(this,ce);D(this,Ge);D(this,Mt);D(this,Ae,null);j(this,ce,q(e)),j(this,Ge,q(e)),j(this,Mt,t)}static of(e,t){const n=new Wr(e(),t);return Xn(()=>{n.set(e())}),n}set(e,t){var h;U(k(this,Ge),e);let{delay:n=0,duration:s=400,easing:a=Pa,interpolate:i=hr}={...k(this,Mt),...t};if(s===0)return(h=k(this,Ae))==null||h.abort(),U(k(this,ce),e),Promise.resolve();const o=oe.now()+n;let l,u=!1,d=k(this,Ae);return j(this,Ae,Na(p=>{if(p<o)return!0;if(!u){u=!0;const x=k(this,ce).v;l=i(x,e),typeof s=="function"&&(s=s(x,e)),d==null||d.abort()}const v=p-o;return v>s?(U(k(this,ce),e),!1):(U(k(this,ce),l(a(v/s))),!0)})),k(this,Ae).promise}get current(){return I(k(this,ce))}get target(){return I(k(this,Ge))}set target(e){this.set(e)}};ce=new WeakMap,Ge=new WeakMap,Mt=new WeakMap,Ae=new WeakMap;let pr=Wr;class Pt{constructor(e,t){f(this,"value");f(this,"motion");this.value=e,this.motion=new pr(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 Ua=is('<div><div class="body svelte-1nfn9j8"></div></div>');function Ba(r,e){Zr(e,!0);let t,n;function s(){return n}let a=q(!1);function i(C){U(a,C,!0)}function o(){return I(a)}let l=new Pt(0,{easing:fr});de(()=>{u(l.motion.current)}),de(()=>{I(a)==!1&&(l.snap(),pe.clear(e.priority,e.id))});function u(C){t&&pe.equeue(e.layer,e.priority,e.id,()=>{t.style.scale=C.toString(),t.style.filter=`brightness(${.25+.75*C})`,n.style.opacity=C.toString()})}function d(C){C!=l.value&&l.set(C,{duration:75})}function h(){return l.motion.current==0}function p(){return l.value}var v=Ua();let x,R;var N=cr(v);let G;return ze(N,C=>n=C,()=>n),ze(v,C=>t=C,()=>t),Gn((C,z,J)=>{x=ls(v,1,"pin svelte-1nfn9j8",null,x,C),R=Vt(v,"",R,z),G=Vt(N,"",G,J)},[()=>({displayed:I(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`})]),os(r,v),jr({getBody:s,setDisplayed:i,getDisplayed:o,setScale:d,getCollapsed:h,getScale:p})}var pt;(r=>{function e(t,n,s){const a=t/2,i=n/2,o=Math.sqrt(a*a+i*i),l=Math.atan(i/a)*(180/Math.PI),u=s*(Math.PI/180);return s<180?s<90?s<l?{x:0,y:o*Math.sin(u)-i}:{x:o*Math.cos(u)-a,y:0}:s<180-l?{x:o*Math.cos(u)-a,y:0}:{x:-t,y:o*Math.sin(u)-i}:s<270?s<180+l?{x:-t,y:o*Math.sin(u)-i}:{x:o*Math.cos(u)-a,y:-n}:s<360-l?{x:o*Math.cos(u)-a,y:-n}:{x:0,y:o*Math.sin(u)-i}}r.getOffsets=e})(pt||(pt={}));var qa=is('<div><div class="pointer svelte-j5igi2"></div> <div class="bubble svelte-j5igi2"><div class="body svelte-j5igi2"></div></div></div>');function ds(r,e){Zr(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){U(u,O,!0)}function h(){return I(u)}let p=q(!0);function v(O){U(p,O,!0)}function x(){return N.motion.current==0}function R(){return N.motion.current==1}let N=new Pt(0);de(()=>{G(N.motion.current)}),de(()=>{I(u)==!1&&(N.snap(),pe.clear(e.priority,e.id+"_scale"))}),de(()=>{I(p)==!0&&N.value!=0&&(pe.stacked()?N.set(0,{duration:0}):N.set(0,{duration:150,easing:La})),I(p)==!1&&N.value!=1&&N.set(1,{duration:150,easing:Da})});function G(O){!t||!n||!s||pe.equeue(I(p)?0:e.layer,e.priority,e.id+"_scale",()=>{t.style.opacity=`${O}`,n.style.scale=`${O}`,s.style.scale=`${O}`})}let C=NaN,z=q(!1),J=new Pt(-i/2,{easing:fr}),Tt=new Pt(-o/2,{easing:fr});de(()=>{Hr(J.motion.current,Tt.motion.current)}),de(()=>{I(u)==!1&&(J.snap(),J.snap(),pe.clear(e.priority,e.id+"_angle"))}),de(()=>{I(p)==!0&&I(z)&&(J.update({duration:75}),J.update({duration:75}))});function Hr(O,ue){if(!t||!n||!s)return;const Ot=O+i/2,ot=ue+o/2,Ze=o<i?Ot*o/i:Ot,Kt=o>i?ot*i/o:ot,ys=Math.atan2(Kt,Ze)/Math.PI*180-45,Jr=0,ws=30,Qt=Math.sqrt(Ze*Ze+Kt*Kt),lt=Math.min(i,o)/2,ks=lt*Math.SQRT2,xs=(Qt-lt)/(ks-lt),Kr=Jr+xs*(ws-Jr),bs=Qt<lt?Qt/lt:1;pe.equeue(e.layer,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(O)}px, ${Math.round(ue)}px)`,s.style.transform=`scale(${bs}) rotate(${ys}deg) skew(${Kr}deg, ${Kr}deg)`})}function gs(O){if(I(z)==!1){let ue=pt.getOffsets(i,o,O);J.set(Math.round(ue.x),{duration:0}),Tt.set(Math.round(ue.y),{duration:0}),Hr(J.value,Tt.value),C=O,U(z,!0)}else if(O!=C){let ue=Math.abs(O-C),Ot=ue<180?ue:360-ue,ot=Math.log(Ot)*75,Ze=pt.getOffsets(i,o,O);J.set(Math.round(Ze.x),{duration:ot}),Tt.set(Math.round(Ze.y),{duration:ot}),C=O}}function _s(){return pt.getOffsets(i,o,C)}var At=qa();let Yr;var Xr=cr(At);ze(Xr,O=>s=O,()=>s);var Jt=ia(Xr,2),Gr=cr(Jt);return ze(Gr,O=>a=O,()=>a),ze(Jt,O=>n=O,()=>n),ze(At,O=>t=O,()=>t),Gn(O=>{Yr=ls(At,1,"anchor svelte-j5igi2",null,Yr,O),Vt(Jt,`margin: ${e.margin}px;`),Vt(Gr,`width: ${e.width}px; height: ${e.height}px; border-radius: ${e.radius}px;`)},[()=>({displayed:I(u)})]),os(r,At),jr({getBody:l,setDisplayed:d,getDisplayed:h,setCollapsed:v,getCollapsed:x,getExpanded:R,setAngle:gs,getOffsets:_s})}var Ve;(r=>{function e(o,l,u){return{x:n(l)*u,y:s(o)*u}}r.project=e;function t(o,l,u){return{lat:i(l/u),lng:a(o/u)}}r.unproject=t;function n(o){return(180+o)/360}function s(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function a(o){return o*360-180}function i(o){return 360/Math.PI*Math.atan(Math.exp((180-o*360)*Math.PI/180))-90}})(Ve||(Ve={}));class cs{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=Ve.project(e.sw.lat,e.sw.lng,i),l=Ve.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=Ve.unproject(u,d,i),x=Ve.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 M;(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})(M||(M={}));var pn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(pn||(pn={}));const g=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),he=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=M.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 te 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 te))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.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()}}te.create=r=>new te(r);const yt=(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,M.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${M.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${M.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${M.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}"`:M.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,M.assertNever(r)}return{message:t}};let $a=yt;function mr(){return $a}const vr=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=mr(),n=vr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===yt?void 0:yt].filter(s=>!!s)});r.common.issues.push(n)}class X{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 X.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",Ut=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 xe{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 te(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 S{get description(){return this._def.description}_getType(e){return he(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ut(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:he(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:he(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:he(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ut(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 we.create(this,this._def)}nullable(){return st.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return xt.create(this,this._def)}or(e){return qt.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 kr({...b(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new pi({typeName:w.ZodBranded,type:this,...b(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new xr({...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 br.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Wa=/^c[^\s-]{8,}$/i,Ha=/^[0-9a-z]+$/,Ya=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xa=/^[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,Ga=/^[a-z0-9_-]{21}$/i,Ja=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ka=/^[-+]?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)?)??$/,Qa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ei="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sr;const ti=/^(?:(?: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])$/,ri=/^(?:(?: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])$/,ni=/^(([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]))$/,si=/^(([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])$/,ai=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ii=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fs="((\\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])))",oi=new RegExp(`^${fs}$`);function hs(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 li(r){return new RegExp(`^${hs(r)}$`)}function ui(r){let e=`${fs}T${hs(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 di(r,e){return!!((e==="v4"||!e)&&ti.test(r)||(e==="v6"||!e)&&ni.test(r))}function ci(r,e){if(!Ja.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 fi(r,e){return!!((e==="v4"||!e)&&ri.test(r)||(e==="v6"||!e)&&si.test(r))}class ye extends S{_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 X;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")Qa.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")sr||(sr=new RegExp(ei,"u")),sr.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")Xa.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")Ga.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")Wa.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")Ha.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")Ya.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"?ui(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"?oi.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:c.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?li(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"?Ka.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?di(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"?ci(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"?fi(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"?ai.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:c.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?ii.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:c.invalid_string,message:a.message}),n.dirty()):M.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 ye({...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 ye({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ye({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ye({...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}}ye.create=r=>new ye({checks:[],typeName:w.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});function hi(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 S{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 X;for(const a of this._def.checks)a.kind==="int"?M.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"?hi(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()):M.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"&&M.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 wt extends S{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 X;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()):M.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 wt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:_.toString(s)}]})}_addCheck(e){return new wt({...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}}wt.create=r=>new wt({checks:[],typeName:w.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...b(r)});class gr extends S{_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)}}gr.create=r=>new gr({typeName:w.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...b(r)});class Bt extends S{_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 X;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()):M.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 S{_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 S{_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 S{_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 _r extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return W(e.data)}}_r.create=r=>new _r({typeName:w.ZodAny,...b(r)});class $e extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return W(e.data)}}$e.create=r=>new $e({typeName:w.ZodUnknown,...b(r)});class be extends S{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:c.invalid_type,expected:g.never,received:t.parsedType}),y}}be.create=r=>new be({typeName:w.ZodNever,...b(r)});class yr extends S{_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)}}yr.create=r=>new yr({typeName:w.ZodVoid,...b(r)});class le extends S{_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 xe(t,i,t.path,o)))).then(i=>X.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new xe(t,i,t.path,o)));return X.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 Fe(r){if(r instanceof P){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=we.create(Fe(n))}return new P({...r._def,shape:()=>e})}else return r instanceof le?new le({...r._def,type:Fe(r.element)}):r instanceof we?we.create(Fe(r.unwrap())):r instanceof st?st.create(Fe(r.unwrap())):r instanceof fe?fe.create(r.items.map(e=>Fe(e))):r}class P extends S{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=M.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 be&&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 xe(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof be){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 xe(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=>X.mergeObjectSync(n,u)):X.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new P({...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 P({...this._def,unknownKeys:"strip"})}passthrough(){return new P({...this._def,unknownKeys:"passthrough"})}extend(e){return new P({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new P({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 P({...this._def,catchall:e})}pick(e){const t={};for(const n of M.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new P({...this._def,shape:()=>t})}omit(e){const t={};for(const n of M.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new P({...this._def,shape:()=>t})}deepPartial(){return Fe(this)}partial(e){const t={};for(const n of M.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new P({...this._def,shape:()=>t})}required(e){const t={};for(const n of M.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof we;)a=a._def.innerType;t[n]=a}return new P({...this._def,shape:()=>t})}keyof(){return ps(M.objectKeys(this.shape))}}P.create=(r,e)=>new P({shape:()=>r,unknownKeys:"strip",catchall:be.create(),typeName:w.ZodObject,...b(e)});P.strictCreate=(r,e)=>new P({shape:()=>r,unknownKeys:"strict",catchall:be.create(),typeName:w.ZodObject,...b(e)});P.lazycreate=(r,e)=>new P({shape:r,unknownKeys:"strip",catchall:be.create(),typeName:w.ZodObject,...b(e)});class qt extends S{_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 te(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 te(l));return m(t,{code:c.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}qt.create=(r,e)=>new qt({options:r,typeName:w.ZodUnion,...b(e)});function wr(r,e){const t=he(r),n=he(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&n===g.object){const s=M.objectKeys(e),a=M.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const l=wr(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=wr(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 S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(mn(a)||mn(i))return y;const o=wr(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 fe extends S{_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 xe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>X.mergeArray(t,i)):X.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new fe({...this._def,rest:e})}}fe.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fe({items:r,typeName:w.ZodTuple,rest:null,...b(e)})};class kn extends S{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 xe(n,o,n.path,[u,"key"])),value:a._parse(new xe(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 kt extends S{_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 xe(n,l,n.path,u)));return n.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,t){return new kt({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new kt({...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)}}kt.create=(r,e)=>new kt({valueType:r,minSize:null,maxSize:null,typeName:w.ZodSet,...b(e)});class mt extends S{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 vr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mr(),yt].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:l}})}function s(o,l){return vr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mr(),yt].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 xt){const o=this;return W(async function(...l){const u=new te([]),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 te([n(l,u.error)]);const d=Reflect.apply(i,this,u.data),h=o._def.returns.safeParse(d,a);if(!h.success)throw new te([s(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new mt({...this._def,args:fe.create(e).rest($e.create())})}returns(e){return new mt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new mt({args:e||fe.create([]).rest($e.create()),returns:t||$e.create(),typeName:w.ZodFunction,...b(n)})}}class xn extends S{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 S{_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 ps(r,e){return new rt({values:r,typeName:w.ZodEnum,...b(e)})}class rt extends S{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:M.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=ps;class En extends S{_parse(e){const t=M.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==g.string&&n.parsedType!==g.number){const s=M.objectValues(t);return m(n,{expected:M.joinValues(s),received:n.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(M.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=M.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 xt extends S{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})))}}xt.create=(r,e)=>new xt({type:r,typeName:w.ZodPromise,...b(e)});class nt extends S{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);M.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 we extends S{_parse(e){return this._getType(e)===g.undefined?W(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}we.create=(r,e)=>new we({innerType:r,typeName:w.ZodOptional,...b(e)});class st extends S{_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 kr extends S{_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}}kr.create=(r,e)=>new kr({innerType:r,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class xr extends S{_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 Ut(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new te(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}xr.create=(r,e)=>new xr({innerType:r,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class Sn extends S{_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 pi extends S{_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 S{_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 br extends S{_parse(e){const t=this._def.innerType._parse(e),n=s=>(et(s)&&(s.value=Object.freeze(s.value)),s);return Ut(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}br.create=(r,e)=>new br({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 qr=ye.create,A=tt.create,Er=gr.create,ms=_r.create;$e.create;be.create;const Lt=yr.create,mi=le.create,L=P.create;qt.create;$t.create;fe.create;const re=mt.create;rt.create;const vi=xt.create;we.create;st.create;L({pin:L({fade:Er().optional(),maxCount:A().optional(),maxZoom:A().optional()}).optional(),animation:L({queue:L({limit:A().optional()}).optional()}).optional(),api:L({states:L({url:qr(),singleRequest:Er().optional()}).optional()}).optional()});const Sr=A().min(-90).max(90),Cr=A().min(-180).max(180),gi=L({sw:L({lat:Sr,lng:Cr}),ne:L({lat:Sr,lng:Cr})}),Mr=ms().refine(r=>r instanceof HTMLElement,"Must be an HTMLElement"),_i=L({mapSize:A().min(1),zoomMin:A().min(0),zoomMax:A().min(0),zoomScale:A().min(1).max(10)}),yi=L({instance:ms(),inserted:re().returns(Er()),insert:re().returns(Lt()),remove:re().returns(Lt()),update:re().args(A()).returns(Lt())}),wi=L({getParameters:re().args().returns(_i),getContainer:re().args().returns(Mr),getZoom:re().args().returns(A()),getBounds:re().args().returns(gi),panBy:re().args(A(),A()).returns(Lt()),createMarker:re().args(Mr,Sr,Cr,A()).returns(yi)}),ar=re().args(qr()).returns(vi(Mr)),ki=L({id:qr().min(1),rank:A(),lat:A().min(-90).max(90),lng:A().min(-180).max(180),tooltip:L({style:L({width:A(),height:A(),margin:A(),radius:A()}).refine(r=>Math.min(r.width,r.height)/r.margin>=5,"Tooltip width and height must be at least 5 times the margin"),body:ar}),pin:L({style:L({width:A(),height:A(),radius:A()}),body:ar}).optional(),popup:L({style:L({width:A(),height:A(),radius:A(),margin:A()}),body:ar}).optional()}),xi=mi(ki);var Ie;(r=>{r.COUNT=12,r.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],r.DEGREES_DEFAULT=270})(Ie||(Ie={}));const Cn="1.0.199",vs="https://maps.api.arenarium.dev",bi=`${vs}/log`,Ei=`${vs}/tooltip/states`;class Si{constructor(e,t,n){f(this,"apiKey");f(this,"apiStatesUrl");f(this,"apiStatesSingleRequest",!1);f(this,"mapProvider");f(this,"markerDataArray",new Array);f(this,"markerDataMap",new Map);f(this,"markerDataUpdating",!1);f(this,"markerPinProcessor");f(this,"markerTooltipProcessor");f(this,"markerPopupProcessor");wi.parse(t),this.apiKey=e,this.mapProvider=t,this.markerPinProcessor=new Ar(t),this.markerTooltipProcessor=new Mi(t),this.markerPopupProcessor=new Ti(t),this.configuration=n,this.log("info","Loaded")}set configuration(e){var t,n,s,a,i,o;this.markerPinProcessor.setConfiguration(e),this.apiStatesUrl=((n=(t=e==null?void 0:e.api)==null?void 0:t.states)==null?void 0:n.url)??void 0,this.apiStatesSingleRequest=((a=(s=e==null?void 0:e.api)==null?void 0:s.states)==null?void 0:a.singleRequest)??!1,pe.setLimit(((o=(i=e==null?void 0:e.animation)==null?void 0:i.queue)==null?void 0:o.limit)??8*navigator.hardwareConcurrency)}async updateMarkers(e){xi.parse(e);try{await this.updateMarkerData(e),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}}async updateMarkerData(e){try{let t=this.markerDataArray.map(s=>s.marker);for(let s=0;s<e.length;s++){const a=e[s];this.markerDataMap.get(a.id)||t.push(a)}let n;if(e.length>1){const s=this.mapProvider.getParameters(),a=t.map(u=>({id:u.id,rank:u.rank,lat:u.lat,lng:u.lng,width:u.tooltip.style.width,height:u.tooltip.style.height,margin:u.tooltip.style.margin})),i={key:this.apiKey,parameters:s,input:a},o=this.apiStatesUrl??Ei,l=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok||!l.body)throw new Error("Failed to get marker states: "+l.statusText);n=await l.json()}else n=[[0,[[0,Ie.DEGREES.indexOf(Ie.DEGREES_DEFAULT)]]]];try{this.markerDataUpdating=!0;for(let s=0;s<t.length;s++){const a=t[s],i=n[s],o=this.markerDataMap.get(a.id);if(o)o.update(i);else{const l=new Ci(this.mapProvider,a,i);l.create(),this.markerDataMap.set(a.id,l),this.markerDataArray.push(l)}}this.markerDataArray.sort((s,a)=>s.zoom-a.zoom),this.markerPinProcessor.updateElements(this.markerDataArray.map(s=>s.pin)),this.markerTooltipProcessor.updateElements(this.markerDataArray.map(s=>s.tooltip))}finally{this.markerDataUpdating=!1}}catch(t){throw console.error(t),this.markerDataArray.forEach(n=>n.remove()),this.markerDataArray.length=0,this.markerDataMap.clear(),t instanceof Error&&this.log("error","Failed to update marker data",t),t}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.mapProvider.getBounds(),t=this.mapProvider.getZoom();this.markerPopupProcessor.process(),this.markerTooltipProcessor.process(e,t),this.markerPinProcessor.process(e,t)}async log(e,t,n){if(!(window!=null&&window.location.host.startsWith("localhost")||window!=null&&window.location.host.startsWith("127.0.0.1")))try{const s={title:`[CLIENT:${Cn}] ${t}`,level:e,content:{version:Cn,...n}};await fetch(bi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(s){console.error(s)}}}class Ci{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 Or(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 $r{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 Ue=class Ue extends $r{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)??Ue.DEFAULT_SIZE,this.height=((i=n.pin)==null?void 0:i.style.height)??Ue.DEFAULT_SIZE,this.radius=((o=n.pin)==null?void 0:o.style.radius)??Ue.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=Ur(Ba,{target:this.element,props:{id:this.id+"_pin",layer:za,priority:this.zoom*this.provider.getParameters().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(){const t=this.provider.getParameters();return Math.round((t.zoomMax-this.zoom)*t.zoomScale)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isBodyLoaded(){return this.bodyCallback==null||this.bodyLoaded}};f(Ue,"DEFAULT_SIZE",16);let Tr=Ue;const Be=class Be{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(Be.MAP_PINS_MAX_COUNT,8*navigator.hardwareConcurrency),this.pinMaxZoomDelta=((s=e==null?void 0:e.pin)==null?void 0:s.maxZoom)??Be.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.getParameters().mapSize,s=new cs(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(Be,"MAP_PINS_MAX_ZOOM",2),f(Be,"MAP_PINS_MAX_COUNT",128);let Ar=Be;const Ht=class Ht extends $r{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=Ie.DEGREES_DEFAULT,this.states=s[1].map(a=>[a[0],Ie.DEGREES[a[1]]]),this.bodyCallback=n.tooltip.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("tooltip"),this.component=Ur(ds,{target:this.element,props:{id:this.id+"_tooltip",layer:Fa,priority:this.zoom*this.provider.getParameters().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],Ie.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(){const t=this.provider.getParameters();return Math.round((t.zoomMax-this.zoom)*t.zoomScale)+Ht.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(Ht,"Z_INDEX_OFFSET",1e6);let Or=Ht;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.getParameters().mapSize,s=new cs(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 $r{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=Ur(ds,{target:this.element,props:{id:this.id+"_popup",layer:ja,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 Rr=Yt;class Ti{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 Rr(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,R=v.right-h,N=d-v.top,G=v.bottom-p,C=Math.min(n.width,n.height)/4,z=x<0?x-C:R<0?-R+C:0,J=N<0?N-C:G<0?-G+C:0;this.provider.panBy(z,J),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=Si;
|
package/dist/main.es.js
CHANGED
|
@@ -4700,7 +4700,7 @@ var Ie;
|
|
|
4700
4700
|
((r) => {
|
|
4701
4701
|
r.COUNT = 12, r.DEGREES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330], r.DEGREES_DEFAULT = 270;
|
|
4702
4702
|
})(Ie || (Ie = {}));
|
|
4703
|
-
const Cn = "1.0.
|
|
4703
|
+
const Cn = "1.0.199", ms = "https://maps.api.arenarium.dev", ki = `${ms}/log`, xi = `${ms}/tooltip/states`;
|
|
4704
4704
|
class Ai {
|
|
4705
4705
|
constructor(e, t, n) {
|
|
4706
4706
|
f(this, "apiKey");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arenarium/maps",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.200",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "arenarium.dev",
|
|
6
6
|
"description": "Visualize complex map markers clearly.",
|
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
"typescript": "^5.8.3",
|
|
77
77
|
"typescript-eslint": "^8.38.0",
|
|
78
78
|
"vite": "^6.3.5",
|
|
79
|
-
"vite-plugin-dts": "^4.5.4"
|
|
79
|
+
"vite-plugin-dts": "^4.5.4",
|
|
80
|
+
"arenarium-maps-shared": "1.0.0"
|
|
80
81
|
},
|
|
81
82
|
"peerDependencies": {
|
|
82
83
|
"@googlemaps/js-api-loader": "^1.16.10",
|
|
@@ -99,8 +100,7 @@
|
|
|
99
100
|
}
|
|
100
101
|
},
|
|
101
102
|
"dependencies": {
|
|
102
|
-
"zod": "^3.25.76"
|
|
103
|
-
"arenarium-maps-shared": "1.0.0"
|
|
103
|
+
"zod": "^3.25.76"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
106
106
|
"dev": "vite dev --host --port=3000",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"build:vite:browser": "vite build -c ./vite/browser/vite.config.ts",
|
|
112
112
|
"build:types:browser": "dts-bundle-generator --export-referenced-types --umd-module-name=arenarium -o ./dist/index.d.ts ./src/lib/index.ts",
|
|
113
113
|
"build": "pnpm run build:vite:modular && pnpm run build:vite:browser && pnpm run build:types:browser",
|
|
114
|
-
"patch:push": "pnpm version patch
|
|
114
|
+
"patch:push": "pnpm version patch && git push",
|
|
115
115
|
"publish:public": "pnpm publish --access public",
|
|
116
116
|
"build:patch:commit:publish": "pnpm run build && pnpm run patch:push && pnpm run publish:public",
|
|
117
117
|
"preview": "vite preview"
|