System.register(["jotai/vanilla"],(function(R){"use strict";var m;return{setters:[function(W){m=W.atom}],execute:(function(){R({atomFamily:$,atomWithDefault:X,atomWithLazy:mt,atomWithObservable:nt,atomWithReducer:P,atomWithRefresh:ft,atomWithReset:J,atomWithStorage:tt,createJSONStorage:z,freezeAtom:T,freezeAtomCreator:q,loadable:it,selectAtom:K,splitAtom:U,unstable_withStorageValidator:Y,unwrap:lt});const W=R("RESET",Symbol(""));function J(t){const e=m(t,(s,c,u)=>{const a=typeof u=="function"?u(s(e)):u;c(e,a===W?t:a)});return e}function P(t,e){return m(t,function(s,c,u){c(this,e(s(this),u))})}function $(t,e){let s=null;const c=new Map,u=new Set,a=r=>{let o;if(e===void 0)o=c.get(r);else for(const[l,f]of c)if(e(l,r)){o=f;break}if(o!==void 0)if(s!=null&&s(o[1],r))a.remove(r);else return o[0];const i=t(r);return c.set(r,[i,Date.now()]),n("CREATE",r,i),i},n=(r,o,i)=>{for(const l of u)l({type:r,param:o,atom:i})};return a.unstable_listen=r=>(u.add(r),()=>{u.delete(r)}),a.getParams=()=>c.keys(),a.remove=r=>{if(e===void 0){if(!c.has(r))return;const[o]=c.get(r);c.delete(r),n("REMOVE",r,o)}else for(const[o,[i]]of c)if(e(o,r)){c.delete(o),n("REMOVE",o,i);break}},a.setShouldRemove=r=>{if(s=r,!!s)for(const[o,[i,l]]of c)s(l,o)&&(c.delete(o),n("REMOVE",o,i))},a}const M=(t,e,s)=>(e.has(s)?e:e.set(s,t())).get(s),C=new WeakMap,F=(t,e,s,c)=>{const u=M(()=>new WeakMap,C,e),a=M(()=>new WeakMap,u,s);return M(t,a,c)};function K(t,e,s=Object.is){return F(()=>{const c=Symbol(),u=([n,r])=>{if(r===c)return e(n);const o=e(n,r);return s(r,o)?r:o},a=m(n=>{const r=n(a),o=n(t);return u([o,r])});return a.init=c,a},t,e,s)}const A=new WeakSet,L=t=>{if(typeof t!="object"||t===null)return t;Object.freeze(t);const e=Object.getOwnPropertyNames(t);for(const s of e)L(t[s]);return t};function T(t){if(A.has(t))return t;A.add(t);const e=t.read;if(t.read=function(s,c){return L(e.call(this,s,c))},"write"in t){const s=t.write;t.write=function(c,u,...a){return s.call(this,c,(...n)=>(n[0]===t&&(n[1]=L(n[1])),u(...n)),...a)}}return t}function q(t){return((...e)=>T(t(...e)))}const V=(t,e,s)=>(e.has(s)?e:e.set(s,t())).get(s),B=new WeakMap,G=(t,e,s)=>{const c=V(()=>new WeakMap,B,e);return V(t,c,s)},H={},j=t=>!!t.write,Q=t=>typeof t=="function";function U(t,e){return G(()=>{const s=new WeakMap,c=(n,r)=>{let o=s.get(n);if(o)return o;const i=r&&s.get(r),l=[],f=[];return n.forEach((b,v)=>{const d=e?e(b):v;f[v]=d;const g=i&&i.atomList[i.keyList.indexOf(d)];if(g){l[v]=g;return}const O=w=>{const y=w(u),h=w(t),S=c(h,y==null?void 0:y.arr).keyList.indexOf(d);if(S<0||S>=h.length){const p=n[c(n).keyList.indexOf(d)];if(p)return p;throw new Error("splitAtom: index out of bounds for read")}return h[S]},E=(w,y,h)=>{const S=w(u),p=w(t),k=c(p,S==null?void 0:S.arr).keyList.indexOf(d);if(k<0||k>=p.length)throw new Error("splitAtom: index out of bounds for write");const D=Q(h)?h(p[k]):h;Object.is(p[k],D)||y(t,[...p.slice(0,k),D,...p.slice(k+1)])};l[v]=j(t)?m(O,E):m(O)}),i&&i.keyList.length===f.length&&i.keyList.every((b,v)=>b===f[v])?o=i:o={arr:n,atomList:l,keyList:f},s.set(n,o),o},u=m(n=>{const r=n(u),o=n(t);return c(o,r==null?void 0:r.arr)});u.init=void 0;const a=j(t)?m(n=>n(u).atomList,(n,r,o)=>{switch(o.type){case"remove":{const i=n(a).indexOf(o.atom);if(i>=0){const l=n(t);r(t,[...l.slice(0,i),...l.slice(i+1)])}break}case"insert":{const i=o.before?n(a).indexOf(o.before):n(a).length;if(i>=0){const l=n(t);r(t,[...l.slice(0,i),o.value,...l.slice(i)])}break}case"move":{const i=n(a).indexOf(o.atom),l=o.before?n(a).indexOf(o.before):n(a).length;if(i>=0&&l>=0){const f=n(t);in(u).atomList);return a},t,e||H)}function X(t){const e=Symbol(),s=m(e),c=m((u,a)=>{const n=u(s);return n!==e?n:t(u,a)},(u,a,n)=>{const r=typeof n=="function"?n(u(c)):n;a(s,r===W?e:r)});return c}const I=t=>typeof(t==null?void 0:t.then)=="function";function Y(t){return e=>({...e,getItem:(s,c)=>{const u=n=>t(n)?n:c,a=e.getItem(s,c);return I(a)?a.then(u):u(a)}})}function z(t=()=>{try{return window.localStorage}catch(s){return}},e){var s;let c,u;const a={getItem:(o,i)=>{var l,f;const b=d=>{if(d=d||"",c!==d){try{u=JSON.parse(d,e==null?void 0:e.reviver)}catch(g){return i}c=d}return u},v=(f=(l=t())==null?void 0:l.getItem(o))!=null?f:null;return I(v)?v.then(b):b(v)},setItem:(o,i)=>{var l;return(l=t())==null?void 0:l.setItem(o,JSON.stringify(i,e==null?void 0:e.replacer))},removeItem:o=>{var i;return(i=t())==null?void 0:i.removeItem(o)}},n=o=>(i,l,f)=>o(i,b=>{let v;try{v=JSON.parse(b||"")}catch(d){v=f}l(v)});let r;try{r=(s=t())==null?void 0:s.subscribe}catch(o){}return!r&&typeof window!="undefined"&&typeof window.addEventListener=="function"&&window.Storage&&(r=(o,i)=>{if(!(t()instanceof window.Storage))return()=>{};const l=f=>{f.storageArea===t()&&f.key===o&&i(f.newValue)};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}}),r&&(a.subscribe=n(r)),a}const Z=z();function tt(t,e,s=Z,c){const u=c==null?void 0:c.getOnInit,a=m(u?s.getItem(t,e):e);return a.onMount=n=>{n(s.getItem(t,e));let r;return s.subscribe&&(r=s.subscribe(t,n,e)),r},m(n=>n(a),(n,r,o)=>{const i=typeof o=="function"?o(n(a)):o;return i===W?(r(a,e),s.removeItem(t)):I(i)?i.then(l=>(r(a,l),s.setItem(t,l))):(r(a,i),s.setItem(t,i))})}const et=t=>typeof(t==null?void 0:t.then)=="function";function nt(t,e){const s=u=>{if("e"in u)throw u.e;return u.d},c=m(u=>{var a;let n=t(u);const r=(a=n[Symbol.observable])==null?void 0:a.call(n);r&&(n=r);let o;const i=()=>new Promise(h=>{o=h}),l=e&&"initialValue"in e?{d:typeof e.initialValue=="function"?e.initialValue():e.initialValue}:i();let f,b;const v=h=>{b=h,o==null||o(h),f==null||f(h)};let d,g;const O=()=>!f,E=()=>{d&&(d.unsubscribe(),d=void 0)},w=()=>{d&&(clearTimeout(g),d.unsubscribe()),d=n.subscribe({next:h=>v({d:h}),error:h=>v({e:h}),complete:()=>{}}),O()&&e!=null&&e.unstable_timeout&&(g=setTimeout(E,e.unstable_timeout))};w();const y=m(b||l);return y.onMount=h=>(f=h,b&&h(b),d?clearTimeout(g):w(),()=>{f=void 0,e!=null&&e.unstable_timeout?g=setTimeout(E,e.unstable_timeout):E()}),[y,n,i,w,O]});return m(u=>{const[a]=u(c),n=u(a);return et(n)?n.then(s):s(n)},(u,a,n)=>{const[r,o,i,l,f]=u(c);if("next"in o)f()&&(a(r,i()),l()),o.next(n);else throw new Error("observable is not subject")})}const x=new WeakMap,rt=(t,e)=>(x.has(e)?x:x.set(e,t())).get(e),ot=t=>typeof(t==null?void 0:t.then)=="function",N={state:"loading"};function it(t){return rt(()=>{const e=new WeakMap,s=m(0),c=m((u,{setSelf:a})=>{u(s);let n;try{n=u(t)}catch(l){return{state:"hasError",error:l}}if(!ot(n))return{state:"hasData",data:n};const r=n,o=e.get(r);return o||(r.then(l=>{e.set(r,{state:"hasData",data:l}),a()},l=>{e.set(r,{state:"hasError",error:l}),a()}),e.get(r)||(e.set(r,N),N))},(u,a)=>{a(s,n=>n+1)});return m(u=>u(c))},t)}const _=(t,e,s)=>(e.has(s)?e:e.set(s,t())).get(s),st=new WeakMap,at=(t,e,s)=>{const c=_(()=>new WeakMap,st,e);return _(t,c,s)},ut=t=>typeof(t==null?void 0:t.then)=="function",ct=()=>{};function lt(t,e=ct){return at(()=>{const s=new WeakMap,c=new WeakMap,u=m(0),a=m((n,{setSelf:r})=>{n(u);const o=n(a),i=n(t);if(!ut(i))return{v:i};if(i!==(o==null?void 0:o.p)&&i.then(l=>{c.set(i,l),r()},l=>{s.set(i,l),r()}),s.has(i))throw s.get(i);return c.has(i)?{p:i,v:c.get(i)}:o&&"v"in o?{p:i,f:e(o.v),v:o.v}:{p:i,f:e()}},(n,r)=>{r(u,o=>o+1)});return a.init=void 0,m(n=>{const r=n(a);return"f"in r?r.f:r.v},(n,r,...o)=>r(t,...o))},t,e)}function ft(t,e){const s=m(0);return m((c,u)=>(c(s),t(c,u)),(c,u,...a)=>{if(a.length===0)u(s,n=>n+1);else if(e)return e(c,u,...a)})}function mt(t){const e=m(void 0);return delete e.init,Object.defineProperty(e,"init",{get(){return t()}}),e}})}}));