1 | System.register([],function(b){"use strict";return{execute:function(){b("atom",R);let N=0;function R(s,l){const g=`atom${++N}`,v={toString:()=>g};return typeof s=="function"?v.read=s:(v.init=s,v.read=E=>E(v),v.write=(E,z,h)=>z(v,typeof h=="function"?h(E(v)):h)),l&&(v.write=l),v}const q=s=>"init"in s,B=s=>!!s.write,y=new WeakMap,T=(s,l)=>{y.set(s,l),s.catch(()=>{}).finally(()=>y.delete(s))},F=(s,l)=>{const g=y.get(s);g&&(y.delete(s),g(l))},G=(s,l)=>{s.status="fulfilled",s.value=l},H=(s,l)=>{s.status="rejected",s.reason=l},U=s=>typeof(s==null?void 0:s.then)=="function",M=(s,l)=>"v"in s&&"v"in l&&Object.is(s.v,l.v),I=(s,l)=>"e"in s&&"e"in l&&Object.is(s.e,l.e),p=s=>"v"in s&&s.v instanceof Promise,V=(s,l)=>"v"in s&&"v"in l&&s.v.orig&&s.v.orig===l.v.orig,S=s=>{if("e"in s)throw s.e;return s.v},_=b("createStore",()=>{const s=new WeakMap,l=new WeakMap,g=new Map,v=t=>s.get(t),E=(t,e)=>{const r=s.get(t);if(s.set(t,e),g.has(t)||g.set(t,r),r&&p(r)){const n="v"in e?e.v instanceof Promise?e.v:Promise.resolve(e.v):Promise.reject(e.e);F(r.v,n)}},z=(t,e,r)=>{const n=new Map;let c=!1;r.forEach((o,i)=>{!o&&i===t&&(o=e),o&&(n.set(i,o),e.d.get(i)!==o&&(c=!0))}),(c||e.d.size!==n.size)&&(e.d=n)},h=(t,e,r)=>{const n=v(t),c={d:(n==null?void 0:n.d)||new Map,v:e};if(r&&z(t,c,r),n&&M(n,c)&&n.d===c.d)return n;if(n&&p(n)&&p(c)&&V(n,c)){if(n.d===c.d)return n;c.v=n.v}return E(t,c),c},J=(t,e,r,n)=>{if(U(e)){let c;const o=new Promise((i,f)=>{let a=!1;e.then(d=>{if(!a){a=!0;const u=v(t),w=h(t,o,r);G(o,d),i(d),(u==null?void 0:u.d)!==w.d&&O(t,w,u==null?void 0:u.d)}},d=>{if(!a){a=!0;const u=v(t),w=h(t,o,r);H(o,d),f(d),(u==null?void 0:u.d)!==w.d&&O(t,w,u==null?void 0:u.d)}}),c=d=>{a||(a=!0,d.then(u=>G(o,u),u=>H(o,u)),i(d))}});return o.orig=e,o.status="pending",T(o,i=>{i&&c(i),n==null||n()}),h(t,o,r)}return h(t,e,r)},$=(t,e,r)=>{const n=v(t),c={d:(n==null?void 0:n.d)||new Map,e};return r&&z(t,c,r),n&&I(n,c)&&n.d===c.d?n:(E(t,c),c)},m=t=>{const e=v(t);if(e&&(e.d.forEach((a,d)=>{d!==t&&!l.has(d)&&m(d)}),Array.from(e.d).every(([a,d])=>a===t||v(a)===d)))return e;const r=new Map;let n=!0;const c=a=>{if(a===t){const u=v(a);if(u)return r.set(a,u),S(u);if(q(a))return r.set(a,void 0),a.init;throw new Error("no atom init")}const d=m(a);return r.set(a,d),S(d)};let o,i;const f={get signal(){return o||(o=new AbortController),o.signal},get setSelf(){return!i&&B(t)&&(i=(...a)=>{if(!n)return j(t,...a)}),i}};try{const a=t.read(c,f);return J(t,a,r,()=>o==null?void 0:o.abort())}catch(a){return $(t,a,r)}finally{n=!1}},x=t=>S(m(t)),K=t=>{let e=l.get(t);return e||(e=W(t)),e},P=(t,e)=>!e.l.size&&(!e.t.size||e.t.size===1&&e.t.has(t)),Q=t=>{const e=l.get(t);e&&P(t,e)&&D(t)},X=t=>{const e=new Map,r=new WeakMap,n=o=>{const i=l.get(o);i==null||i.t.forEach(f=>{f!==o&&(e.set(f,(e.get(f)||new Set).add(o)),r.set(f,(r.get(f)||0)+1),n(f))})};n(t);const c=o=>{const i=l.get(o);i==null||i.t.forEach(f=>{var a;if(f!==o){let d=r.get(f);if(d&&r.set(f,--d),!d){let u=!!((a=e.get(f))!=null&&a.size);if(u){const w=v(f),Y=m(f);u=!w||!M(w,Y)}u||e.forEach(w=>w.delete(f))}c(f)}})};c(t)},L=(t,...e)=>{let r=!0;const n=i=>S(m(i)),c=(i,...f)=>{let a;if(i===t){if(!q(i))throw new Error("atom not writable");const d=v(i),u=J(i,f[0]);(!d||!M(d,u))&&X(i)}else a=L(i,...f);return r||C(),a},o=t.write(n,c,...e);return r=!1,o},j=(t,...e)=>{const r=L(t,...e);return C(),r},W=(t,e)=>{const r={t:new Set(e&&[e]),l:new Set};if(l.set(t,r),m(t).d.forEach((n,c)=>{const o=l.get(c);o?o.t.add(t):c!==t&&W(c,t)}),m(t),B(t)&&t.onMount){const n=t.onMount((...c)=>j(t,...c));n&&(r.u=n)}return r},D=t=>{var e;const r=(e=l.get(t))==null?void 0:e.u;r&&r(),l.delete(t);const n=v(t);n&&(p(n)&&F(n.v),n.d.forEach((c,o)=>{if(o!==t){const i=l.get(o);i&&(i.t.delete(t),P(o,i)&&D(o))}}))},O=(t,e,r)=>{const n=new Set(e.d.keys());r==null||r.forEach((c,o)=>{if(n.has(o)){n.delete(o);return}const i=l.get(o);i&&(i.t.delete(t),P(o,i)&&D(o))}),n.forEach(c=>{const o=l.get(c);o?o.t.add(t):l.has(t)&&W(c,t)})},C=()=>{for(;g.size;){const t=Array.from(g);g.clear(),t.forEach(([e,r])=>{const n=v(e);if(n){n.d!==(r==null?void 0:r.d)&&O(e,n,r==null?void 0:r.d);const c=l.get(e);c&&!(r&&!p(r)&&(M(r,n)||I(r,n)))&&c.l.forEach(o=>o())}})}};return{get:x,set:j,sub:(t,e)=>{const r=K(t);C();const n=r.l;return n.add(e),()=>{n.delete(e),Q(t)}}}});let k;const Z=b("getDefaultStore",()=>(k||(k=_()),k))}}});
|