Socket
Socket
Sign inDemoInstall

jotai

Package Overview
Dependencies
Maintainers
2
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jotai - npm Package Compare versions

Comparing version 2.7.1 to 2.7.2

5

package.json
{
"name": "jotai",
"private": false,
"version": "2.7.1",
"version": "2.7.2",
"description": "👻 Primitive and flexible state management for React",

@@ -84,3 +84,4 @@ "main": "./index.js",

"resolutions": {
"@types/react": "18.2.56"
"@types/react": "18.2.56",
"@typescript-eslint/utils": "7.2.0"
},

@@ -87,0 +88,0 @@ "peerDependencies": {

4

react/useAtom.d.ts

@@ -8,7 +8,7 @@ import type { Atom, ExtractAtomArgs, ExtractAtomResult, ExtractAtomValue, PrimitiveAtom, SetStateAction, WritableAtom } from 'jotai/vanilla';

export declare function useAtom<Value>(atom: Atom<Value>, options?: Options): [Awaited<Value>, never];
export declare function useAtom<AtomType extends WritableAtom<any, any[], any>>(atom: AtomType, options?: Options): [
export declare function useAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,
SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>
];
export declare function useAtom<AtomType extends Atom<any>>(atom: AtomType, options?: Options): [Awaited<ExtractAtomValue<AtomType>>, never];
export declare function useAtom<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): [Awaited<ExtractAtomValue<AtomType>>, never];
export {};

@@ -7,3 +7,3 @@ import type { Atom, ExtractAtomValue } from 'jotai/vanilla';

export declare function useAtomValue<Value>(atom: Atom<Value>, options?: Options): Awaited<Value>;
export declare function useAtomValue<AtomType extends Atom<any>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export declare function useAtomValue<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export {};

@@ -6,3 +6,3 @@ import type { ExtractAtomArgs, ExtractAtomResult, WritableAtom } from 'jotai/vanilla';

export declare function useSetAtom<Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, options?: Options): SetAtom<Args, Result>;
export declare function useSetAtom<AtomType extends WritableAtom<any, any[], any>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export declare function useSetAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export {};

@@ -6,5 +6,5 @@ import { useStore } from 'jotai/react';

};
type AnyWritableAtom = WritableAtom<unknown, any[], any>;
type AnyWritableAtom = WritableAtom<unknown, never[], unknown>;
type InferAtomTuples<T> = {
[K in keyof T]: T[K] extends readonly [infer A, unknown] ? A extends WritableAtom<unknown, infer Args, any> ? readonly [A, Args[0]] : T[K] : never;
[K in keyof T]: T[K] extends readonly [infer A, unknown] ? A extends WritableAtom<unknown, infer Args, infer _Result> ? readonly [A, Args[0]] : T[K] : never;
};

@@ -11,0 +11,0 @@ export type INTERNAL_InferAtomTuples<T> = InferAtomTuples<T>;

@@ -5,3 +5,3 @@ import { useSetAtom } from 'jotai/react';

type Options = Parameters<typeof useSetAtom>[1];
export declare function useResetAtom(anAtom: WritableAtom<unknown, [typeof RESET], unknown>, options?: Options): () => unknown;
export declare function useResetAtom<T>(anAtom: WritableAtom<unknown, [typeof RESET], T>, options?: Options): () => T;
export {};

@@ -28,3 +28,5 @@ 'use client';

const StoreContext = createContext(void 0);
const StoreContext = createContext(
void 0
);
const useStore = exports("useStore", (options) => {

@@ -31,0 +33,0 @@ const store = useContext(StoreContext);

'use client';
System.register(["react","jotai/react","jotai/vanilla/utils","jotai/vanilla"],function(d){"use strict";var r,i,c,l,m,f,A;return{setters:[function(e){r=e.useCallback,i=e.useMemo},function(e){c=e.useSetAtom,l=e.useAtom,m=e.useStore},function(e){f=e.RESET},function(e){A=e.atom}],execute:function(){d({useAtomCallback:R,useHydrateAtoms:y,useReducerAtom:k,useResetAtom:e});function e(n,t){const o=c(n,t);return r(()=>o(f),[o])}function k(n,t,o){const[u,s]=l(n,o),a=r(C=>{s(E=>t(E,C))},[s,t]);return[u,a]}function R(n,t){const o=i(()=>A(null,(u,s,...a)=>n(u,s,...a)),[n]);return c(o,t)}const S=new WeakMap;function y(n,t){const o=m(t),u=b(o);for(const[s,a]of n)(!u.has(s)||t!=null&&t.dangerouslyForceHydrate)&&(u.add(s),o.set(s,a))}const b=n=>{let t=S.get(n);return t||(t=new WeakSet,S.set(n,t)),t}}}});
System.register(["react","jotai/react","jotai/vanilla/utils","jotai/vanilla"],function(k){"use strict";var r,i,c,l,m,f,A;return{setters:[function(e){r=e.useCallback,i=e.useMemo},function(e){c=e.useSetAtom,l=e.useAtom,m=e.useStore},function(e){f=e.RESET},function(e){A=e.atom}],execute:function(){k({useAtomCallback:R,useHydrateAtoms:d,useReducerAtom:y,useResetAtom:e});function e(n,t){const o=c(n,t);return r(()=>o(f),[o])}function y(n,t,o){const[u,s]=l(n,o),a=r(C=>{s(E=>t(E,C))},[s,t]);return[u,a]}function R(n,t){const o=i(()=>A(null,(u,s,...a)=>n(u,s,...a)),[n]);return c(o,t)}const S=new WeakMap;function d(n,t){const o=m(t),u=b(o);for(const[s,a]of n)(!u.has(s)||t!=null&&t.dangerouslyForceHydrate)&&(u.add(s),o.set(s,a))}const b=n=>{let t=S.get(n);return t||(t=new WeakSet,S.set(n,t)),t}}}});

@@ -316,16 +316,2 @@ System.register([], (function (exports) {

const readAtom = (atom) => returnAtomValue(readAtomState(atom));
const addAtom = (atom) => {
let mounted = mountedMap.get(atom);
if (!mounted) {
mounted = mountAtom(atom);
}
return mounted;
};
const canUnmountAtom = (atom, mounted) => !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom));
const delAtom = (atom) => {
const mounted = mountedMap.get(atom);
if (mounted && canUnmountAtom(atom, mounted)) {
unmountAtom(atom);
}
};
const recomputeDependents = (atom) => {

@@ -421,11 +407,13 @@ const getDependents = (a) => {

var _a;
const existingMount = mountedMap.get(atom);
if (existingMount) {
if (initialDependent) {
existingMount.t.add(initialDependent);
}
return existingMount;
}
const queue = onMountQueue || [];
(_a = getAtomState(atom)) == null ? void 0 : _a.d.forEach((_, a) => {
const aMounted = mountedMap.get(a);
if (aMounted) {
aMounted.t.add(atom);
} else {
if (a !== atom) {
mountAtom(a, atom, queue);
}
if (a !== atom) {
mountAtom(a, atom, queue);
}

@@ -456,5 +444,8 @@ });

};
const unmountAtom = (atom) => {
var _a;
const onUnmount = (_a = mountedMap.get(atom)) == null ? void 0 : _a.u;
const canUnmountAtom = (atom, mounted) => !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom));
const tryUnmountAtom = (atom, mounted) => {
if (!canUnmountAtom(atom, mounted)) {
return;
}
const onUnmount = mounted.u;
if (onUnmount) {

@@ -474,8 +465,6 @@ onUnmount();

if (a !== atom) {
const mounted = mountedMap.get(a);
if (mounted) {
mounted.t.delete(atom);
if (canUnmountAtom(a, mounted)) {
unmountAtom(a);
}
const mountedDep = mountedMap.get(a);
if (mountedDep) {
mountedDep.t.delete(atom);
tryUnmountAtom(a, mountedDep);
}

@@ -503,13 +492,8 @@ }

depSet.forEach((a) => {
const mounted = mountedMap.get(a);
if (mounted) {
mounted.t.add(atom);
} else if (mountedMap.has(atom)) {
mountAtom(a, atom);
}
mountAtom(a, atom);
});
maybeUnmountAtomSet.forEach((a) => {
const mounted = mountedMap.get(a);
if (mounted && canUnmountAtom(a, mounted)) {
unmountAtom(a);
if (mounted) {
tryUnmountAtom(a, mounted);
}

@@ -564,3 +548,3 @@ });

const subscribeAtom = (atom, listener) => {
const mounted = addAtom(atom);
const mounted = mountAtom(atom);
const flushed = flushPending([atom]);

@@ -576,3 +560,3 @@ const listeners = mounted.l;

listeners.delete(listener);
delAtom(atom);
tryUnmountAtom(atom, mounted);
{

@@ -618,17 +602,13 @@ storeListenersRev2.forEach((l) => l({ type: "unsub" }));

let defaultStore;
{
if (typeof globalThis.__NUMBER_OF_JOTAI_INSTANCES__ === "number") {
++globalThis.__NUMBER_OF_JOTAI_INSTANCES__;
} else {
globalThis.__NUMBER_OF_JOTAI_INSTANCES__ = 1;
}
}
const getDefaultStore = exports("getDefaultStore", () => {
if (!defaultStore) {
if (globalThis.__NUMBER_OF_JOTAI_INSTANCES__ !== 1) {
console.warn(
"Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
);
defaultStore = createStore();
{
globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = defaultStore);
if (globalThis.__JOTAI_DEFAULT_STORE__ !== defaultStore) {
console.warn(
"Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
);
}
}
defaultStore = createStore();
}

@@ -635,0 +615,0 @@ return defaultStore;

@@ -1,1 +0,1 @@

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

@@ -1,1 +0,1 @@

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

@@ -19,7 +19,7 @@ import type { Atom, ExtractAtomArgs, ExtractAtomResult, ExtractAtomValue, PrimitiveAtom, SetStateAction, WritableAtom } from 'jotai/vanilla';

];
export declare function useAtom<AtomType extends WritableAtom<any, any[], any>>(atom: AtomType, options?: Options): [
export declare function useAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,
SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>
];
export declare function useAtom<AtomType extends Atom<any>>(atom: AtomType, options?: Options): [
export declare function useAtom<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,

@@ -26,0 +26,0 @@ never

@@ -7,4 +7,4 @@ import type { Atom, ExtractAtomValue } from 'jotai/vanilla';

export declare function useAtomValue<Value>(atom: Atom<Value>, options?: Options): Awaited<Value>;
export declare function useAtomValue<AtomType extends Atom<any>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export declare function useAtomValue<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -6,4 +6,4 @@ import type { ExtractAtomArgs, ExtractAtomResult, WritableAtom } from 'jotai/vanilla';

export declare function useSetAtom<Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, options?: Options): SetAtom<Args, Result>;
export declare function useSetAtom<AtomType extends WritableAtom<any, any[], any>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export declare function useSetAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -6,3 +6,3 @@ import { useStore } from 'jotai/react';

};
type AnyWritableAtom = WritableAtom<unknown, any[], any>;
type AnyWritableAtom = WritableAtom<unknown, never[], unknown>;
type InferAtomTuples<T> = {

@@ -12,3 +12,3 @@ [K in keyof T]: T[K] extends readonly [

unknown
] ? A extends WritableAtom<unknown, infer Args, any> ? readonly [
] ? A extends WritableAtom<unknown, infer Args, infer _Result> ? readonly [
A,

@@ -15,0 +15,0 @@ Args[0]

@@ -5,6 +5,6 @@ import { useSetAtom } from 'jotai/react';

type Options = Parameters<typeof useSetAtom>[1];
export declare function useResetAtom(anAtom: WritableAtom<unknown, [
export declare function useResetAtom<T>(anAtom: WritableAtom<unknown, [
typeof RESET
], unknown>, options?: Options): () => unknown;
], T>, options?: Options): () => T;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -56,2 +56,15 @@ import type { Atom, WritableAtom } from './atom';

}) => void;
type Store = {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms?: () => IterableIterator<AnyAtom>;
dev_get_atom_state?: (a: AnyAtom) => AtomState | undefined;
dev_get_mounted?: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms?: (values: Iterable<readonly [
AnyAtom,
AnyValue
]>) => void;
};
/**

@@ -73,47 +86,5 @@ * Create a new store. Each store is an independent, isolated universe of atom

*/
export declare const createStore: () => {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms: () => IterableIterator<AnyAtom>;
dev_get_atom_state: (a: AnyAtom) => AtomState<unknown> | undefined;
dev_get_mounted: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms: (values: Iterable<readonly [
AnyAtom,
AnyValue
]>) => void;
} | {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: never;
dev_get_mounted_atoms?: never;
dev_get_atom_state?: never;
dev_get_mounted?: never;
dev_restore_atoms?: never;
};
export declare const getDefaultStore: () => {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms: () => IterableIterator<AnyAtom>;
dev_get_atom_state: (a: AnyAtom) => AtomState<unknown> | undefined;
dev_get_mounted: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms: (values: Iterable<readonly [
AnyAtom,
AnyValue
]>) => void;
} | {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: never;
dev_get_mounted_atoms?: never;
dev_get_atom_state?: never;
dev_get_mounted?: never;
dev_restore_atoms?: never;
};
export declare const createStore: () => Store;
export declare const getDefaultStore: () => Store;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -5,5 +5,5 @@ import type { Atom, PrimitiveAtom, WritableAtom } from './atom';

export type ExtractAtomValue<AtomType> = AtomType extends Atom<infer Value> ? Value : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<any, infer Args, any> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<any, any[], infer Result> ? Result : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<unknown, infer Args, infer _Result> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<unknown, infer _Args, infer Result> ? Result : never;
export type SetStateAction<Value> = ExtractAtomArgs<PrimitiveAtom<Value>>[0];
declare type Awaited<T> = T extends Promise<infer V> ? V : T;
import type { Atom, Getter, WritableAtom } from 'jotai/vanilla';
type AnyError = unknown;
declare global {
interface SymbolConstructor {
readonly observable: symbol;
}
}
type Subscription = {

@@ -9,0 +4,0 @@ unsubscribe: () => void;

import type { Atom } from 'jotai/vanilla';
export declare function freezeAtom<AtomType extends Atom<any>>(anAtom: AtomType): AtomType;
export declare function freezeAtomCreator<CreateAtom extends (...params: any[]) => Atom<any>>(createAtom: CreateAtom): CreateAtom;
export declare function freezeAtom<AtomType extends Atom<unknown>>(anAtom: AtomType): AtomType;
export declare function freezeAtomCreator<CreateAtom extends (...params: never[]) => Atom<unknown>>(createAtom: CreateAtom): CreateAtom;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -19,7 +19,7 @@ import type { Atom, ExtractAtomArgs, ExtractAtomResult, ExtractAtomValue, PrimitiveAtom, SetStateAction, WritableAtom } from 'jotai/vanilla';

];
export declare function useAtom<AtomType extends WritableAtom<any, any[], any>>(atom: AtomType, options?: Options): [
export declare function useAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,
SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>
];
export declare function useAtom<AtomType extends Atom<any>>(atom: AtomType, options?: Options): [
export declare function useAtom<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): [
Awaited<ExtractAtomValue<AtomType>>,

@@ -26,0 +26,0 @@ never

@@ -7,4 +7,4 @@ import type { Atom, ExtractAtomValue } from 'jotai/vanilla';

export declare function useAtomValue<Value>(atom: Atom<Value>, options?: Options): Awaited<Value>;
export declare function useAtomValue<AtomType extends Atom<any>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export declare function useAtomValue<AtomType extends Atom<unknown>>(atom: AtomType, options?: Options): Awaited<ExtractAtomValue<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -6,4 +6,4 @@ import type { ExtractAtomArgs, ExtractAtomResult, WritableAtom } from 'jotai/vanilla';

export declare function useSetAtom<Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, options?: Options): SetAtom<Args, Result>;
export declare function useSetAtom<AtomType extends WritableAtom<any, any[], any>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export declare function useSetAtom<AtomType extends WritableAtom<unknown, never[], unknown>>(atom: AtomType, options?: Options): SetAtom<ExtractAtomArgs<AtomType>, ExtractAtomResult<AtomType>>;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -6,3 +6,3 @@ import { useStore } from 'jotai/react';

};
type AnyWritableAtom = WritableAtom<unknown, any[], any>;
type AnyWritableAtom = WritableAtom<unknown, never[], unknown>;
type InferAtomTuples<T> = {

@@ -12,3 +12,3 @@ [K in keyof T]: T[K] extends readonly [

unknown
] ? A extends WritableAtom<unknown, infer Args, any> ? readonly [
] ? A extends WritableAtom<unknown, infer Args, infer _Result> ? readonly [
A,

@@ -15,0 +15,0 @@ Args[0]

@@ -5,6 +5,6 @@ import { useSetAtom } from 'jotai/react';

type Options = Parameters<typeof useSetAtom>[1];
export declare function useResetAtom(anAtom: WritableAtom<unknown, [
export declare function useResetAtom<T>(anAtom: WritableAtom<unknown, [
typeof RESET
], unknown>, options?: Options): () => unknown;
], T>, options?: Options): () => T;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -56,2 +56,15 @@ import type { Atom, WritableAtom } from './atom';

}) => void;
type Store = {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms?: () => IterableIterator<AnyAtom>;
dev_get_atom_state?: (a: AnyAtom) => AtomState | undefined;
dev_get_mounted?: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms?: (values: Iterable<readonly [
AnyAtom,
AnyValue
]>) => void;
};
/**

@@ -73,47 +86,5 @@ * Create a new store. Each store is an independent, isolated universe of atom

*/
export declare const createStore: () => {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms: () => IterableIterator<AnyAtom>;
dev_get_atom_state: (a: AnyAtom) => AtomState<unknown> | undefined;
dev_get_mounted: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms: (values: Iterable<readonly [
AnyAtom,
AnyValue
]>) => void;
} | {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: never;
dev_get_mounted_atoms?: never;
dev_get_atom_state?: never;
dev_get_mounted?: never;
dev_restore_atoms?: never;
};
export declare const getDefaultStore: () => {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms: () => IterableIterator<AnyAtom>;
dev_get_atom_state: (a: AnyAtom) => AtomState<unknown> | undefined;
dev_get_mounted: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms: (values: Iterable<readonly [
AnyAtom,
AnyValue
]>) => void;
} | {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: never;
dev_get_mounted_atoms?: never;
dev_get_atom_state?: never;
dev_get_mounted?: never;
dev_restore_atoms?: never;
};
export declare const createStore: () => Store;
export declare const getDefaultStore: () => Store;
export {};
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -5,5 +5,5 @@ import type { Atom, PrimitiveAtom, WritableAtom } from './atom';

export type ExtractAtomValue<AtomType> = AtomType extends Atom<infer Value> ? Value : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<any, infer Args, any> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<any, any[], infer Result> ? Result : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<unknown, infer Args, infer _Result> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<unknown, infer _Args, infer Result> ? Result : never;
export type SetStateAction<Value> = ExtractAtomArgs<PrimitiveAtom<Value>>[0];
declare type Awaited<T> = T extends Promise<infer V> ? V : T;
import type { Atom, Getter, WritableAtom } from 'jotai/vanilla';
type AnyError = unknown;
declare global {
interface SymbolConstructor {
readonly observable: symbol;
}
}
type Subscription = {

@@ -9,0 +4,0 @@ unsubscribe: () => void;

import type { Atom } from 'jotai/vanilla';
export declare function freezeAtom<AtomType extends Atom<any>>(anAtom: AtomType): AtomType;
export declare function freezeAtomCreator<CreateAtom extends (...params: any[]) => Atom<any>>(createAtom: CreateAtom): CreateAtom;
export declare function freezeAtom<AtomType extends Atom<unknown>>(anAtom: AtomType): AtomType;
export declare function freezeAtomCreator<CreateAtom extends (...params: never[]) => Atom<unknown>>(createAtom: CreateAtom): CreateAtom;
declare type Awaited<T> = T extends Promise<infer V> ? V : T;

@@ -357,18 +357,2 @@ (function (global, factory) {

};
var addAtom = function addAtom(atom) {
var mounted = mountedMap.get(atom);
if (!mounted) {
mounted = mountAtom(atom);
}
return mounted;
};
var canUnmountAtom = function canUnmountAtom(atom, mounted) {
return !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom));
};
var delAtom = function delAtom(atom) {
var mounted = mountedMap.get(atom);
if (mounted && canUnmountAtom(atom, mounted)) {
unmountAtom(atom);
}
};
var recomputeDependents = function recomputeDependents(atom) {

@@ -401,4 +385,4 @@ var getDependents = function getDependents(a) {

for (var i = topsortedAtoms.length - 1; i >= 0; --i) {
var a = topsortedAtoms[i];
var _prevAtomState = getAtomState(a);
var _a = topsortedAtoms[i];
var _prevAtomState = getAtomState(_a);
if (!_prevAtomState) {

@@ -410,3 +394,3 @@ continue;

var dep = _step2.value;
if (dep !== a && changedAtoms.has(dep)) {
if (dep !== _a && changedAtoms.has(dep)) {
hasChangedDeps = true;

@@ -417,5 +401,5 @@ break;

if (hasChangedDeps) {
var nextAtomState = readAtomState(a, true);
var nextAtomState = readAtomState(_a, true);
if (!isEqualAtomValue(_prevAtomState, nextAtomState)) {
changedAtoms.add(a);
changedAtoms.add(_a);
}

@@ -488,11 +472,13 @@ }

var _getAtomState;
var existingMount = mountedMap.get(atom);
if (existingMount) {
if (initialDependent) {
existingMount.t.add(initialDependent);
}
return existingMount;
}
var queue = onMountQueue || [];
(_getAtomState = getAtomState(atom)) == null || _getAtomState.d.forEach(function (_, a) {
var aMounted = mountedMap.get(a);
if (aMounted) {
aMounted.t.add(atom);
} else {
if (a !== atom) {
mountAtom(a, atom, queue);
}
if (a !== atom) {
mountAtom(a, atom, queue);
}

@@ -530,5 +516,10 @@ });

};
var unmountAtom = function unmountAtom(atom) {
var _mountedMap$get2;
var onUnmount = (_mountedMap$get2 = mountedMap.get(atom)) == null ? void 0 : _mountedMap$get2.u;
var canUnmountAtom = function canUnmountAtom(atom, mounted) {
return !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom));
};
var tryUnmountAtom = function tryUnmountAtom(atom, mounted) {
if (!canUnmountAtom(atom, mounted)) {
return;
}
var onUnmount = mounted.u;
if (onUnmount) {

@@ -548,8 +539,6 @@ onUnmount();

if (a !== atom) {
var mounted = mountedMap.get(a);
if (mounted) {
mounted.t.delete(atom);
if (canUnmountAtom(a, mounted)) {
unmountAtom(a);
}
var mountedDep = mountedMap.get(a);
if (mountedDep) {
mountedDep.t.delete(atom);
tryUnmountAtom(a, mountedDep);
}

@@ -577,13 +566,8 @@ }

depSet.forEach(function (a) {
var mounted = mountedMap.get(a);
if (mounted) {
mounted.t.add(atom);
} else if (mountedMap.has(atom)) {
mountAtom(a, atom);
}
mountAtom(a, atom);
});
maybeUnmountAtomSet.forEach(function (a) {
var mounted = mountedMap.get(a);
if (mounted && canUnmountAtom(a, mounted)) {
unmountAtom(a);
if (mounted) {
tryUnmountAtom(a, mounted);
}

@@ -644,3 +628,3 @@ });

var subscribeAtom = function subscribeAtom(atom, listener) {
var mounted = addAtom(atom);
var mounted = mountAtom(atom);
var flushed = flushPending([atom]);

@@ -659,3 +643,3 @@ var listeners = mounted.l;

listeners.delete(listener);
delAtom(atom);
tryUnmountAtom(atom, mounted);
{

@@ -697,7 +681,7 @@ storeListenersRev2.forEach(function (l) {

var _step3$value = _step3.value,
atom = _step3$value[0],
_atom = _step3$value[0],
valueOrPromise = _step3$value[1];
if (hasInitialValue(atom)) {
setAtomValueOrPromise(atom, valueOrPromise);
recomputeDependents(atom);
if (hasInitialValue(_atom)) {
setAtomValueOrPromise(_atom, valueOrPromise);
recomputeDependents(_atom);
}

@@ -717,15 +701,12 @@ }

var defaultStore;
{
if (typeof globalThis.__NUMBER_OF_JOTAI_INSTANCES__ === 'number') {
++globalThis.__NUMBER_OF_JOTAI_INSTANCES__;
} else {
globalThis.__NUMBER_OF_JOTAI_INSTANCES__ = 1;
}
}
var getDefaultStore = function getDefaultStore() {
if (!defaultStore) {
if (globalThis.__NUMBER_OF_JOTAI_INSTANCES__ !== 1) {
console.warn('Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044');
defaultStore = createStore();
{
var _ref4;
(_ref4 = globalThis).__JOTAI_DEFAULT_STORE__ || (_ref4.__JOTAI_DEFAULT_STORE__ = defaultStore);
if (globalThis.__JOTAI_DEFAULT_STORE__ !== defaultStore) {
console.warn('Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044');
}
}
defaultStore = createStore();
}

@@ -732,0 +713,0 @@ return defaultStore;

@@ -1,1 +0,1 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).jotaiVanilla={})}(this,(function(n){"use strict";var t=0;function r(n){return n(this)}function e(n,t,r){return t(this,"function"==typeof r?r(n(this)):r)}function o(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}function i(n,t){var r="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(r)return(r=r.call(n)).next.bind(r);if(Array.isArray(n)||(r=function(n,t){if(n){if("string"==typeof n)return o(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){r&&(n=r);var e=0;return function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=function(n,t){return n.unstable_is?n.unstable_is(t):t===n},f=function(n){return"init"in n},c=function(n){return!!n.write},v=new WeakMap,l=function(n,t){var r=v.get(n);r&&(v.delete(n),r(t))},d=function(n,t){n.status="fulfilled",n.value=t},s=function(n,t){n.status="rejected",n.reason=t},h=function(n,t){return!!n&&"v"in n&&"v"in t&&Object.is(n.v,t.v)},p=function(n,t){return!!n&&"e"in n&&"e"in t&&Object.is(n.e,t.e)},g=function(n){return!!n&&"v"in n&&n.v instanceof Promise},w=function(n){if("e"in n)throw n.e;return n.v},y=function(){var n=new WeakMap,t=new WeakMap,r=[],e=new WeakMap,o=function(t){return n.get(t)},a=function n(t,i){i.d.forEach((function(i,a){if(!e.has(a)){var u,f=o(a);null==(u=r[r.length-1])||u.add(a),e.set(a,[f,new Set]),f&&n(a,f)}e.get(a)[1].add(t)}))},y=function(t,i){var u,f=o(t);(n.set(t,i),e.has(t))||(null==(u=r[r.length-1])||u.add(t),e.set(t,[f,new Set]),a(t,i));if(g(f)){var c="v"in i?i.v instanceof Promise?i.v:Promise.resolve(i.v):Promise.reject(i.e);f.v!==c&&l(f.v,c)}},b=function(n,t,r,e){var o=new Map(e?t.d:null),i=!1;r.forEach((function(r,e){!r&&u(n,e)&&(r=t),r&&(o.set(e,r),t.d.get(e)!==r&&(i=!0))})),(i||t.d.size!==o.size)&&(t.d=o)},m=function(n,t,r,e){var i,a,u=o(n),f={d:(null==u?void 0:u.d)||new Map,v:t};if(r&&b(n,f,r,e),h(u,f)&&u.d===f.d)return u;if(g(u)&&g(f)&&(a=f,"v"in(i=u)&&"v"in a&&i.v.orig&&i.v.orig===a.v.orig)){if(u.d===f.d)return u;f.v=u.v}return y(n,f),f},S=function(n,r,e,i){if("function"==typeof(null==(c=r)?void 0:c.then)){var a,u=function(){var r=o(n);if(g(r)&&r.v===f){var i=m(n,f,e);t.has(n)&&r.d!==i.d&&x(n,i,r.d)}},f=new Promise((function(n,t){var e=!1;r.then((function(t){e||(e=!0,d(f,t),n(t),u())}),(function(n){e||(e=!0,s(f,n),t(n),u())})),a=function(t){e||(e=!0,t.then((function(n){return d(f,n)}),(function(n){return s(f,n)})),n(t))}}));return f.orig=r,f.status="pending",function(n,t){v.set(n,t),n.catch((function(){})).finally((function(){return v.delete(n)}))}(f,(function(n){n&&a(n),null==i||i()})),m(n,f,e,!0)}var c;return m(n,r,e)},E=function n(r,e){var i=o(r);if(!e&&i){if(t.has(r))return i;if(Array.from(i.d).every((function(t){var e=t[0],o=t[1];if(e===r)return!0;var i=n(e);return i===o||h(i,o)})))return i}var a,v,l=new Map,d=!0,s={get signal(){return a||(a=new AbortController),a.signal},get setSelf(){return!v&&c(r)&&(v=function(){if(!d){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return k.apply(void 0,[r].concat(t))}}),v}};try{var g=r.read((function(t){if(u(r,t)){var e=o(t);if(e)return l.set(t,e),w(e);if(f(t))return l.set(t,void 0),t.init;throw new Error("no atom init")}var i=n(t);return l.set(t,i),w(i)}),s);return S(r,g,l,(function(){var n;return null==(n=a)?void 0:n.abort()}))}catch(n){return function(n,t,r){var e=o(n),i={d:(null==e?void 0:e.d)||new Map,e:t};return r&&b(n,i,r),p(e,i)&&e.d===i.d?e:(y(n,i),i)}(r,n,l)}finally{d=!1}},A=function(n,t){return!t.l.size&&(!t.t.size||1===t.t.size&&t.t.has(n))},M=function(n){var r=new Array,a=new Set;!function n(o){if(!a.has(o)){a.add(o);for(var u,f=i(function(n){var r,o,i=new Set(null==(r=t.get(n))?void 0:r.t);return null==(o=e.get(n))||o[1].forEach((function(n){i.add(n)})),i}(o));!(u=f()).done;){var c=u.value;o!==c&&n(c)}r.push(o)}}(n);for(var u=new Set([n]),f=r.length-1;f>=0;--f){var c=r[f],v=o(c);if(v){for(var l,d=!1,s=i(v.d.keys());!(l=s()).done;){var p=l.value;if(p!==c&&u.has(p)){d=!0;break}}if(d){var g=E(c,!0);h(v,g)||u.add(c)}}}},j=function n(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];var c=t.write.apply(t,[function(n){return w(E(n))},function(e){var i,a=r.length>0;a||r.push(new Set([e]));for(var c=arguments.length,v=new Array(c>1?c-1:0),l=1;l<c;l++)v[l-1]=arguments[l];if(u(t,e)){if(!f(e))throw new Error("atom not writable");var d=o(e),s=S(e,v[0]);h(d,s)||M(e)}else i=n.apply(void 0,[e].concat(v));return a||O(r.pop()),i}].concat(i));return c},k=function(n){r.push(new Set([n]));for(var t=arguments.length,e=new Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];var i=j.apply(void 0,[n].concat(e));return O(r.pop()),i},z=function n(r,e,i){var a,u=i||[];null==(a=o(r))||a.d.forEach((function(e,o){var i=t.get(o);i?i.t.add(r):o!==r&&n(o,r,u)})),E(r);var f={t:new Set(e&&[e]),l:new Set};if(t.set(r,f),c(r)&&r.onMount){var v=r.onMount;u.push((function(){var n=v((function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return k.apply(void 0,[r].concat(t))}));n&&(f.u=n)}))}return i||u.forEach((function(n){return n()})),f},P=function n(r){var e,i=null==(e=t.get(r))?void 0:e.u;i&&i(),t.delete(r);var a=o(r);a&&(g(a)&&l(a.v),a.d.forEach((function(e,o){if(o!==r){var i=t.get(o);i&&(i.t.delete(r),A(o,i)&&n(o))}})))},x=function(n,r,e){var o=new Set(r.d.keys()),i=new Set;null==e||e.forEach((function(r,e){if(o.has(e))o.delete(e);else{i.add(e);var a=t.get(e);a&&a.t.delete(n)}})),o.forEach((function(r){var e=t.get(r);e?e.t.add(n):t.has(n)&&z(r,n)})),i.forEach((function(n){var r=t.get(n);r&&A(n,r)&&P(n)}))},O=function(n){var r=[];n.forEach((function n(t){var i;if(e.has(t)){var a=e.get(t),u=a[0],f=a[1];e.delete(t),r.push([t,u]),f.forEach(n),null==(i=o(t))||i.d.forEach((function(t,r){return n(r)}))}})),r.forEach((function(n){var r=n[0],e=n[1],i=o(r);if(i&&i!==e){var a=t.get(r);a&&i.d!==(null==e?void 0:e.d)&&x(r,i,null==e?void 0:e.d),a&&(g(e)||!h(e,i)&&!p(e,i))&&a.l.forEach((function(n){return n()}))}}))};return{get:function(n){return w(E(n))},set:k,sub:function(n,r){var e=function(n){var r=t.get(n);return r||(r=z(n)),r}(n);O([n]);var o=e.l;return o.add(r),function(){o.delete(r),function(n){var r=t.get(n);r&&A(n,r)&&P(n)}(n)}}}};n.atom=function(n,o){var i="atom"+ ++t,a={toString:function(){return i}};return"function"==typeof n?a.read=n:(a.init=n,a.read=r,a.write=e),o&&(a.write=o),a},n.createStore=y,n.getDefaultStore=function(){return a||(a=y()),a}}));
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).jotaiVanilla={})}(this,(function(n){"use strict";var t=0;function r(n){return n(this)}function e(n,t,r){return t(this,"function"==typeof r?r(n(this)):r)}function i(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}function o(n,t){var r="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(r)return(r=r.call(n)).next.bind(r);if(Array.isArray(n)||(r=function(n,t){if(n){if("string"==typeof n)return i(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){r&&(n=r);var e=0;return function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=function(n,t){return n.unstable_is?n.unstable_is(t):t===n},f=function(n){return"init"in n},c=function(n){return!!n.write},v=new WeakMap,l=function(n,t){var r=v.get(n);r&&(v.delete(n),r(t))},d=function(n,t){n.status="fulfilled",n.value=t},s=function(n,t){n.status="rejected",n.reason=t},h=function(n,t){return!!n&&"v"in n&&"v"in t&&Object.is(n.v,t.v)},p=function(n,t){return!!n&&"e"in n&&"e"in t&&Object.is(n.e,t.e)},g=function(n){return!!n&&"v"in n&&n.v instanceof Promise},w=function(n){if("e"in n)throw n.e;return n.v},y=function(){var n=new WeakMap,t=new WeakMap,r=[],e=new WeakMap,i=function(t){return n.get(t)},a=function n(t,o){o.d.forEach((function(o,a){if(!e.has(a)){var u,f=i(a);null==(u=r[r.length-1])||u.add(a),e.set(a,[f,new Set]),f&&n(a,f)}e.get(a)[1].add(t)}))},y=function(t,o){var u,f=i(t);(n.set(t,o),e.has(t))||(null==(u=r[r.length-1])||u.add(t),e.set(t,[f,new Set]),a(t,o));if(g(f)){var c="v"in o?o.v instanceof Promise?o.v:Promise.resolve(o.v):Promise.reject(o.e);f.v!==c&&l(f.v,c)}},b=function(n,t,r,e){var i=new Map(e?t.d:null),o=!1;r.forEach((function(r,e){!r&&u(n,e)&&(r=t),r&&(i.set(e,r),t.d.get(e)!==r&&(o=!0))})),(o||t.d.size!==i.size)&&(t.d=i)},m=function(n,t,r,e){var o,a,u=i(n),f={d:(null==u?void 0:u.d)||new Map,v:t};if(r&&b(n,f,r,e),h(u,f)&&u.d===f.d)return u;if(g(u)&&g(f)&&(a=f,"v"in(o=u)&&"v"in a&&o.v.orig&&o.v.orig===a.v.orig)){if(u.d===f.d)return u;f.v=u.v}return y(n,f),f},S=function(n,r,e,o){if("function"==typeof(null==(c=r)?void 0:c.then)){var a,u=function(){var r=i(n);if(g(r)&&r.v===f){var o=m(n,f,e);t.has(n)&&r.d!==o.d&&P(n,o,r.d)}},f=new Promise((function(n,t){var e=!1;r.then((function(t){e||(e=!0,d(f,t),n(t),u())}),(function(n){e||(e=!0,s(f,n),t(n),u())})),a=function(t){e||(e=!0,t.then((function(n){return d(f,n)}),(function(n){return s(f,n)})),n(t))}}));return f.orig=r,f.status="pending",function(n,t){v.set(n,t),n.catch((function(){})).finally((function(){return v.delete(n)}))}(f,(function(n){n&&a(n),null==o||o()})),m(n,f,e,!0)}var c;return m(n,r,e)},E=function n(r,e){var o=i(r);if(!e&&o){if(t.has(r))return o;if(Array.from(o.d).every((function(t){var e=t[0],i=t[1];if(e===r)return!0;var o=n(e);return o===i||h(o,i)})))return o}var a,v,l=new Map,d=!0,s={get signal(){return a||(a=new AbortController),a.signal},get setSelf(){return!v&&c(r)&&(v=function(){if(!d){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return j.apply(void 0,[r].concat(t))}}),v}};try{var g=r.read((function(t){if(u(r,t)){var e=i(t);if(e)return l.set(t,e),w(e);if(f(t))return l.set(t,void 0),t.init;throw new Error("no atom init")}var o=n(t);return l.set(t,o),w(o)}),s);return S(r,g,l,(function(){var n;return null==(n=a)?void 0:n.abort()}))}catch(n){return function(n,t,r){var e=i(n),o={d:(null==e?void 0:e.d)||new Map,e:t};return r&&b(n,o,r),p(e,o)&&e.d===o.d?e:(y(n,o),o)}(r,n,l)}finally{d=!1}},A=function(n){var r=new Array,a=new Set;!function n(i){if(!a.has(i)){a.add(i);for(var u,f=o(function(n){var r,i,o=new Set(null==(r=t.get(n))?void 0:r.t);return null==(i=e.get(n))||i[1].forEach((function(n){o.add(n)})),o}(i));!(u=f()).done;){var c=u.value;i!==c&&n(c)}r.push(i)}}(n);for(var u=new Set([n]),f=r.length-1;f>=0;--f){var c=r[f],v=i(c);if(v){for(var l,d=!1,s=o(v.d.keys());!(l=s()).done;){var p=l.value;if(p!==c&&u.has(p)){d=!0;break}}if(d){var g=E(c,!0);h(v,g)||u.add(c)}}}},M=function n(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),a=1;a<e;a++)o[a-1]=arguments[a];var c=t.write.apply(t,[function(n){return w(E(n))},function(e){var o,a=r.length>0;a||r.push(new Set([e]));for(var c=arguments.length,v=new Array(c>1?c-1:0),l=1;l<c;l++)v[l-1]=arguments[l];if(u(t,e)){if(!f(e))throw new Error("atom not writable");var d=i(e),s=S(e,v[0]);h(d,s)||A(e)}else o=n.apply(void 0,[e].concat(v));return a||x(r.pop()),o}].concat(o));return c},j=function(n){r.push(new Set([n]));for(var t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];var o=M.apply(void 0,[n].concat(e));return x(r.pop()),o},k=function n(r,e,o){var a,u=t.get(r);if(u)return e&&u.t.add(e),u;var f=o||[];null==(a=i(r))||a.d.forEach((function(t,e){e!==r&&n(e,r,f)})),E(r);var v={t:new Set(e&&[e]),l:new Set};if(t.set(r,v),c(r)&&r.onMount){var l=r.onMount;f.push((function(){var n=l((function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return j.apply(void 0,[r].concat(t))}));n&&(v.u=n)}))}return o||f.forEach((function(n){return n()})),v},z=function n(r,e){if(function(n,t){return!t.l.size&&(!t.t.size||1===t.t.size&&t.t.has(n))}(r,e)){var o=e.u;o&&o(),t.delete(r);var a=i(r);a&&(g(a)&&l(a.v),a.d.forEach((function(e,i){if(i!==r){var o=t.get(i);o&&(o.t.delete(r),n(i,o))}})))}},P=function(n,r,e){var i=new Set(r.d.keys()),o=new Set;null==e||e.forEach((function(r,e){if(i.has(e))i.delete(e);else{o.add(e);var a=t.get(e);a&&a.t.delete(n)}})),i.forEach((function(t){k(t,n)})),o.forEach((function(n){var r=t.get(n);r&&z(n,r)}))},x=function(n){var r=[];n.forEach((function n(t){var o;if(e.has(t)){var a=e.get(t),u=a[0],f=a[1];e.delete(t),r.push([t,u]),f.forEach(n),null==(o=i(t))||o.d.forEach((function(t,r){return n(r)}))}})),r.forEach((function(n){var r=n[0],e=n[1],o=i(r);if(o&&o!==e){var a=t.get(r);a&&o.d!==(null==e?void 0:e.d)&&P(r,o,null==e?void 0:e.d),a&&(g(e)||!h(e,o)&&!p(e,o))&&a.l.forEach((function(n){return n()}))}}))};return{get:function(n){return w(E(n))},set:j,sub:function(n,t){var r=k(n);x([n]);var e=r.l;return e.add(t),function(){e.delete(t),z(n,r)}}}};n.atom=function(n,i){var o="atom"+ ++t,a={toString:function(){return o}};return"function"==typeof n?a.read=n:(a.init=n,a.read=r,a.write=e),i&&(a.write=i),a},n.createStore=y,n.getDefaultStore=function(){return a||(a=y()),a}}));

@@ -353,18 +353,2 @@ 'use strict';

};
var addAtom = function addAtom(atom) {
var mounted = mountedMap.get(atom);
if (!mounted) {
mounted = mountAtom(atom);
}
return mounted;
};
var canUnmountAtom = function canUnmountAtom(atom, mounted) {
return !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom));
};
var delAtom = function delAtom(atom) {
var mounted = mountedMap.get(atom);
if (mounted && canUnmountAtom(atom, mounted)) {
unmountAtom(atom);
}
};
var recomputeDependents = function recomputeDependents(atom) {

@@ -397,4 +381,4 @@ var getDependents = function getDependents(a) {

for (var i = topsortedAtoms.length - 1; i >= 0; --i) {
var a = topsortedAtoms[i];
var _prevAtomState = getAtomState(a);
var _a = topsortedAtoms[i];
var _prevAtomState = getAtomState(_a);
if (!_prevAtomState) {

@@ -406,3 +390,3 @@ continue;

var dep = _step2.value;
if (dep !== a && changedAtoms.has(dep)) {
if (dep !== _a && changedAtoms.has(dep)) {
hasChangedDeps = true;

@@ -413,5 +397,5 @@ break;

if (hasChangedDeps) {
var nextAtomState = readAtomState(a, true);
var nextAtomState = readAtomState(_a, true);
if (!isEqualAtomValue(_prevAtomState, nextAtomState)) {
changedAtoms.add(a);
changedAtoms.add(_a);
}

@@ -484,11 +468,13 @@ }

var _getAtomState;
var existingMount = mountedMap.get(atom);
if (existingMount) {
if (initialDependent) {
existingMount.t.add(initialDependent);
}
return existingMount;
}
var queue = onMountQueue || [];
(_getAtomState = getAtomState(atom)) == null || _getAtomState.d.forEach(function (_, a) {
var aMounted = mountedMap.get(a);
if (aMounted) {
aMounted.t.add(atom);
} else {
if (a !== atom) {
mountAtom(a, atom, queue);
}
if (a !== atom) {
mountAtom(a, atom, queue);
}

@@ -526,5 +512,10 @@ });

};
var unmountAtom = function unmountAtom(atom) {
var _mountedMap$get2;
var onUnmount = (_mountedMap$get2 = mountedMap.get(atom)) == null ? void 0 : _mountedMap$get2.u;
var canUnmountAtom = function canUnmountAtom(atom, mounted) {
return !mounted.l.size && (!mounted.t.size || mounted.t.size === 1 && mounted.t.has(atom));
};
var tryUnmountAtom = function tryUnmountAtom(atom, mounted) {
if (!canUnmountAtom(atom, mounted)) {
return;
}
var onUnmount = mounted.u;
if (onUnmount) {

@@ -544,8 +535,6 @@ onUnmount();

if (a !== atom) {
var mounted = mountedMap.get(a);
if (mounted) {
mounted.t.delete(atom);
if (canUnmountAtom(a, mounted)) {
unmountAtom(a);
}
var mountedDep = mountedMap.get(a);
if (mountedDep) {
mountedDep.t.delete(atom);
tryUnmountAtom(a, mountedDep);
}

@@ -573,13 +562,8 @@ }

depSet.forEach(function (a) {
var mounted = mountedMap.get(a);
if (mounted) {
mounted.t.add(atom);
} else if (mountedMap.has(atom)) {
mountAtom(a, atom);
}
mountAtom(a, atom);
});
maybeUnmountAtomSet.forEach(function (a) {
var mounted = mountedMap.get(a);
if (mounted && canUnmountAtom(a, mounted)) {
unmountAtom(a);
if (mounted) {
tryUnmountAtom(a, mounted);
}

@@ -640,3 +624,3 @@ });

var subscribeAtom = function subscribeAtom(atom, listener) {
var mounted = addAtom(atom);
var mounted = mountAtom(atom);
var flushed = flushPending([atom]);

@@ -655,3 +639,3 @@ var listeners = mounted.l;

listeners.delete(listener);
delAtom(atom);
tryUnmountAtom(atom, mounted);
if (process.env.NODE_ENV !== 'production') {

@@ -693,7 +677,7 @@ storeListenersRev2.forEach(function (l) {

var _step3$value = _step3.value,
atom = _step3$value[0],
_atom = _step3$value[0],
valueOrPromise = _step3$value[1];
if (hasInitialValue(atom)) {
setAtomValueOrPromise(atom, valueOrPromise);
recomputeDependents(atom);
if (hasInitialValue(_atom)) {
setAtomValueOrPromise(_atom, valueOrPromise);
recomputeDependents(_atom);
}

@@ -718,15 +702,12 @@ }

var defaultStore;
if (process.env.NODE_ENV !== 'production') {
if (typeof globalThis.__NUMBER_OF_JOTAI_INSTANCES__ === 'number') {
++globalThis.__NUMBER_OF_JOTAI_INSTANCES__;
} else {
globalThis.__NUMBER_OF_JOTAI_INSTANCES__ = 1;
}
}
var getDefaultStore = function getDefaultStore() {
if (!defaultStore) {
if (process.env.NODE_ENV !== 'production' && globalThis.__NUMBER_OF_JOTAI_INSTANCES__ !== 1) {
console.warn('Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044');
defaultStore = createStore();
if (process.env.NODE_ENV !== 'production') {
var _ref4;
(_ref4 = globalThis).__JOTAI_DEFAULT_STORE__ || (_ref4.__JOTAI_DEFAULT_STORE__ = defaultStore);
if (globalThis.__JOTAI_DEFAULT_STORE__ !== defaultStore) {
console.warn('Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044');
}
}
defaultStore = createStore();
}

@@ -733,0 +714,0 @@ return defaultStore;

@@ -56,2 +56,12 @@ import type { Atom, WritableAtom } from './atom';

}) => void;
type Store = {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms?: () => IterableIterator<AnyAtom>;
dev_get_atom_state?: (a: AnyAtom) => AtomState | undefined;
dev_get_mounted?: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms?: (values: Iterable<readonly [AnyAtom, AnyValue]>) => void;
};
/**

@@ -73,40 +83,4 @@ * Create a new store. Each store is an independent, isolated universe of atom

*/
export declare const createStore: () => {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms: () => IterableIterator<AnyAtom>;
dev_get_atom_state: (a: AnyAtom) => AtomState<unknown> | undefined;
dev_get_mounted: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms: (values: Iterable<readonly [AnyAtom, AnyValue]>) => void;
} | {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: never;
dev_get_mounted_atoms?: never;
dev_get_atom_state?: never;
dev_get_mounted?: never;
dev_restore_atoms?: never;
};
export declare const getDefaultStore: () => {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store: (l: StoreListenerRev2, rev: 2) => () => void;
dev_get_mounted_atoms: () => IterableIterator<AnyAtom>;
dev_get_atom_state: (a: AnyAtom) => AtomState<unknown> | undefined;
dev_get_mounted: (a: AnyAtom) => Mounted | undefined;
dev_restore_atoms: (values: Iterable<readonly [AnyAtom, AnyValue]>) => void;
} | {
get: <Value>(atom: Atom<Value>) => Value;
set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
sub: (atom: AnyAtom, listener: () => void) => () => void;
dev_subscribe_store?: never;
dev_get_mounted_atoms?: never;
dev_get_atom_state?: never;
dev_get_mounted?: never;
dev_restore_atoms?: never;
};
export declare const createStore: () => Store;
export declare const getDefaultStore: () => Store;
export {};

@@ -5,4 +5,4 @@ import type { Atom, PrimitiveAtom, WritableAtom } from './atom';

export type ExtractAtomValue<AtomType> = AtomType extends Atom<infer Value> ? Value : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<any, infer Args, any> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<any, any[], infer Result> ? Result : never;
export type ExtractAtomArgs<AtomType> = AtomType extends WritableAtom<unknown, infer Args, infer _Result> ? Args : never;
export type ExtractAtomResult<AtomType> = AtomType extends WritableAtom<unknown, infer _Args, infer Result> ? Result : never;
export type SetStateAction<Value> = ExtractAtomArgs<PrimitiveAtom<Value>>[0];
import type { Atom, Getter, WritableAtom } from 'jotai/vanilla';
type AnyError = unknown;
declare global {
interface SymbolConstructor {
readonly observable: symbol;
}
}
type Subscription = {

@@ -9,0 +4,0 @@ unsubscribe: () => void;

import type { Atom } from 'jotai/vanilla';
export declare function freezeAtom<AtomType extends Atom<any>>(anAtom: AtomType): AtomType;
export declare function freezeAtomCreator<CreateAtom extends (...params: any[]) => Atom<any>>(createAtom: CreateAtom): CreateAtom;
export declare function freezeAtom<AtomType extends Atom<unknown>>(anAtom: AtomType): AtomType;
export declare function freezeAtomCreator<CreateAtom extends (...params: never[]) => Atom<unknown>>(createAtom: CreateAtom): CreateAtom;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc