atomirx 0.0.7 → 0.0.8

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.
@@ -1,30 +1 @@
1
- "use strict";var br=Object.defineProperty;var Rr=(n,o,f)=>o in n?br(n,o,{enumerable:!0,configurable:!0,writable:!0,value:f}):n[o]=f;var Pe=(n,o,f)=>Rr(n,typeof o!="symbol"?o+"":o,f);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),u=require("../index-Cxk9v0um.cjs");function oe(n,o){const f=u.isAtom(n)?({read:v})=>v(n):n,E=u.resolveEquality(o??"shallow"),S=R.useRef(f),j=R.useRef(E);S.current=f,j.current=E;const h=R.useRef(new Map),p=R.useRef(new Set),i=R.useRef({value:void 0,initialized:!1}),T=R.useCallback(()=>{const v=u.select(S.current);if(p.current=v.dependencies,v.promise!==void 0)throw v.promise;if(v.error!==void 0)throw v.error;const m=v.value;return(!i.current.initialized||!j.current(m,i.current.value))&&(i.current={value:m,initialized:!0}),i.current.value},[]),d=R.useCallback(v=>{const m=h.current,k=()=>{const F=p.current;for(const[D,y]of m)F.has(D)||(y(),m.delete(D));for(const D of F)if(!m.has(D)){const y=D.on(()=>{const w=u.select(S.current);p.current=w.dependencies,k(),v()});m.set(D,y)}};return k(),()=>{for(const F of m.values())F();m.clear()}},[]);return R.useSyncExternalStore(d,T,T)}function Er(n){return n==null?"strict":Array.isArray(n)?"shallow":n instanceof Date?"deep":typeof n=="object"?"shallow":"strict"}function hr(n,o){const f=R.useRef({}),E=R.useRef(null);E.current===null&&(E.current={});const S=f.current,j=E.current;for(const h of Object.keys(n)){const p=n[h],i=S[h];if(typeof p=="function"){const[m]=u.tryStabilize(i,p,()=>!1);S[h]={value:m},j[h]=m;continue}const T=o==null?void 0:o[h],d=T?u.resolveEquality(T):u.resolveEquality(Er(p)),[v]=u.tryStabilize(i,p,d);S[h]={value:v},j[h]=v}for(const h of Object.keys(S))h in n||(delete S[h],delete j[h]);return j}const Fe={status:"idle",result:void 0,error:void 0},Ie={status:"loading",result:void 0,error:void 0};function mr(n,o){switch(o.type){case"START":return Ie;case"SUCCESS":return{status:"success",result:o.result,error:void 0};case"ERROR":return{status:"error",result:void 0,error:o.error};case"RESET":return Fe;default:return n}}function yr(n,o={}){const{lazy:f=!0,exclusive:E=!0,deps:S=[]}=o,j=f?Fe:Ie,[h,p]=R.useReducer(mr,j),i=R.useRef(null),T=R.useRef(n);T.current=n;const d=R.useCallback(()=>{const y=i.current;return y?(y.abort(),i.current=null,!0):!1},[]),v=(f?[]:S??[]).filter(u.isAtom),m=oe(({read:y})=>v.map(w=>y(w))),k=R.useCallback(()=>{E&&d();const y=new AbortController;i.current=y,p({type:"START"});let w;try{w=T.current(u.withUse({signal:y.signal}))}catch(g){return p({type:"ERROR",error:g}),Object.assign(Promise.reject(g),{abort:()=>y.abort()})}if(u.isPromiseLike(w)){const g=w;return g.then(I=>{i.current===y&&p({type:"SUCCESS",result:I})},I=>{if(I instanceof DOMException&&I.name==="AbortError"){(i.current===null||i.current===y)&&p({type:"ERROR",error:I});return}i.current===y&&p({type:"ERROR",error:I})}),Object.assign(g,{abort:()=>{y.abort(),i.current===y&&(i.current=null)}})}return p({type:"SUCCESS",result:w}),Object.assign(Promise.resolve(w),{abort:()=>y.abort()})},[E,d]),F=(S??[]).filter(y=>!u.isAtom(y));R.useEffect(()=>{f||k()},[f,...m,...F]),R.useEffect(()=>()=>{E&&d()},[E,d]);const D=R.useCallback(()=>{E&&d(),p({type:"RESET"})},[E,d]);return Object.assign(k,{...h,abort:d,reset:D})}var ne={exports:{}},M={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var ke;function gr(){if(ke)return M;ke=1;var n=R,o=Symbol.for("react.element"),f=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,S=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,j={key:!0,ref:!0,__self:!0,__source:!0};function h(p,i,T){var d,v={},m=null,k=null;T!==void 0&&(m=""+T),i.key!==void 0&&(m=""+i.key),i.ref!==void 0&&(k=i.ref);for(d in i)E.call(i,d)&&!j.hasOwnProperty(d)&&(v[d]=i[d]);if(p&&p.defaultProps)for(d in i=p.defaultProps,i)v[d]===void 0&&(v[d]=i[d]);return{$$typeof:o,type:p,key:m,ref:k,props:v,_owner:S.current}}return M.Fragment=f,M.jsx=h,M.jsxs=h,M}var z={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var De;function _r(){return De||(De=1,process.env.NODE_ENV!=="production"&&function(){var n=R,o=Symbol.for("react.element"),f=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),p=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),F=Symbol.iterator,D="@@iterator";function y(e){if(e===null||typeof e!="object")return null;var r=F&&e[F]||e[D];return typeof r=="function"?r:null}var w=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];I("error",e,t)}}function I(e,r,t){{var a=w.ReactDebugCurrentFrame,l=a.getStackAddendum();l!==""&&(r+="%s",t=t.concat([l]));var b=t.map(function(c){return String(c)});b.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,b)}}var ae=!1,We=!1,$e=!1,qe=!1,Ye=!1,ie;ie=Symbol.for("react.module.reference");function Le(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===j||Ye||e===S||e===T||e===d||qe||e===k||ae||We||$e||typeof e=="object"&&e!==null&&(e.$$typeof===m||e.$$typeof===v||e.$$typeof===h||e.$$typeof===p||e.$$typeof===i||e.$$typeof===ie||e.getModuleId!==void 0))}function Ue(e,r,t){var a=e.displayName;if(a)return a;var l=r.displayName||r.name||"";return l!==""?t+"("+l+")":t}function se(e){return e.displayName||"Context"}function W(e){if(e==null)return null;if(typeof e.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case f:return"Portal";case j:return"Profiler";case S:return"StrictMode";case T:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var r=e;return se(r)+".Consumer";case h:var t=e;return se(t._context)+".Provider";case i:return Ue(e,e.render,"ForwardRef");case v:var a=e.displayName||null;return a!==null?a:W(e.type)||"Memo";case m:{var l=e,b=l._payload,c=l._init;try{return W(c(b))}catch{return null}}}return null}var $=Object.assign,U=0,ue,ce,le,fe,de,ve,pe;function be(){}be.__reactDisabledLog=!0;function Ve(){{if(U===0){ue=console.log,ce=console.info,le=console.warn,fe=console.error,de=console.group,ve=console.groupCollapsed,pe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:be,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function Me(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},e,{value:ue}),info:$({},e,{value:ce}),warn:$({},e,{value:le}),error:$({},e,{value:fe}),group:$({},e,{value:de}),groupCollapsed:$({},e,{value:ve}),groupEnd:$({},e,{value:pe})})}U<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var G=w.ReactCurrentDispatcher,H;function N(e,r,t){{if(H===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);H=a&&a[1]||""}return`
18
- `+H+e}}var X=!1,B;{var ze=typeof WeakMap=="function"?WeakMap:Map;B=new ze}function Re(e,r){if(!e||X)return"";{var t=B.get(e);if(t!==void 0)return t}var a;X=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var b;b=G.current,G.current=null,Ve();try{if(r){var c=function(){throw Error()};if(Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(A){a=A}Reflect.construct(e,[],c)}else{try{c.call()}catch(A){a=A}e.call(c.prototype)}}else{try{throw Error()}catch(A){a=A}e()}}catch(A){if(A&&a&&typeof A.stack=="string"){for(var s=A.stack.split(`
19
- `),x=a.stack.split(`
20
- `),_=s.length-1,O=x.length-1;_>=1&&O>=0&&s[_]!==x[O];)O--;for(;_>=1&&O>=0;_--,O--)if(s[_]!==x[O]){if(_!==1||O!==1)do if(_--,O--,O<0||s[_]!==x[O]){var P=`
21
- `+s[_].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&B.set(e,P),P}while(_>=1&&O>=0);break}}}finally{X=!1,G.current=b,Me(),Error.prepareStackTrace=l}var L=e?e.displayName||e.name:"",q=L?N(L):"";return typeof e=="function"&&B.set(e,q),q}function Ne(e,r,t){return Re(e,!1)}function Be(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function J(e,r,t){if(e==null)return"";if(typeof e=="function")return Re(e,Be(e));if(typeof e=="string")return N(e);switch(e){case T:return N("Suspense");case d:return N("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case i:return Ne(e.render);case v:return J(e.type,r,t);case m:{var a=e,l=a._payload,b=a._init;try{return J(b(l),r,t)}catch{}}}return""}var V=Object.prototype.hasOwnProperty,Ee={},he=w.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);he.setExtraStackFrame(t)}else he.setExtraStackFrame(null)}function Je(e,r,t,a,l){{var b=Function.call.bind(V);for(var c in e)if(b(e,c)){var s=void 0;try{if(typeof e[c]!="function"){var x=Error((a||"React class")+": "+t+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw x.name="Invariant Violation",x}s=e[c](r,c,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(_){s=_}s&&!(s instanceof Error)&&(K(l),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",a||"React class",t,c,typeof s),K(null)),s instanceof Error&&!(s.message in Ee)&&(Ee[s.message]=!0,K(l),g("Failed %s type: %s",t,s.message),K(null))}}}var Ke=Array.isArray;function Z(e){return Ke(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function He(e){try{return me(e),!1}catch{return!0}}function me(e){return""+e}function ye(e){if(He(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),me(e)}var ge=w.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},_e,Se;function Ze(e){if(V.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Qe(e){if(V.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function er(e,r){typeof e.ref=="string"&&ge.current}function rr(e,r){{var t=function(){_e||(_e=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function tr(e,r){{var t=function(){Se||(Se=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var nr=function(e,r,t,a,l,b,c){var s={$$typeof:o,type:e,key:r,ref:t,props:c,_owner:b};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function or(e,r,t,a,l){{var b,c={},s=null,x=null;t!==void 0&&(ye(t),s=""+t),Qe(r)&&(ye(r.key),s=""+r.key),Ze(r)&&(x=r.ref,er(r,l));for(b in r)V.call(r,b)&&!Xe.hasOwnProperty(b)&&(c[b]=r[b]);if(e&&e.defaultProps){var _=e.defaultProps;for(b in _)c[b]===void 0&&(c[b]=_[b])}if(s||x){var O=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&rr(c,O),x&&tr(c,O)}return nr(e,s,x,l,a,ge.current,c)}}var Q=w.ReactCurrentOwner,Oe=w.ReactDebugCurrentFrame;function Y(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}var ee;ee=!1;function re(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function Te(){{if(Q.current){var e=W(Q.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function ar(e){return""}var Ce={};function ir(e){{var r=Te();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
24
-
25
- Check the top-level render call using <`+t+">.")}return r}}function je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ir(r);if(Ce[t])return;Ce[t]=!0;var a="";e&&e._owner&&e._owner!==Q.current&&(a=" It was passed a child from "+W(e._owner.type)+"."),Y(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,a),Y(null)}}function we(e,r){{if(typeof e!="object")return;if(Z(e))for(var t=0;t<e.length;t++){var a=e[t];re(a)&&je(a,r)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var l=y(e);if(typeof l=="function"&&l!==e.entries)for(var b=l.call(e),c;!(c=b.next()).done;)re(c.value)&&je(c.value,r)}}}function sr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===i||r.$$typeof===v))t=r.propTypes;else return;if(t){var a=W(r);Je(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!ee){ee=!0;var l=W(r);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",l||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){Y(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),Y(null);break}}e.ref!==null&&(Y(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),Y(null))}}var xe={};function Ae(e,r,t,a,l,b){{var c=Le(e);if(!c){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var x=ar();x?s+=x:s+=Te();var _;e===null?_="null":Z(e)?_="array":e!==void 0&&e.$$typeof===o?(_="<"+(W(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):_=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",_,s)}var O=or(e,r,t,l,b);if(O==null)return O;if(c){var P=r.children;if(P!==void 0)if(a)if(Z(P)){for(var L=0;L<P.length;L++)we(P[L],e);Object.freeze&&Object.freeze(P)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else we(P,e)}if(V.call(r,"key")){var q=W(e),A=Object.keys(r).filter(function(pr){return pr!=="key"}),te=A.length>0?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}";if(!xe[q+te]){var vr=A.length>0?"{"+A.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
29
- let props = %s;
30
- <%s key={someKey} {...props} />`,te,q,vr,q),xe[q+te]=!0}}return e===E?ur(O):sr(O),O}}function cr(e,r,t){return Ae(e,r,t,!0)}function lr(e,r,t){return Ae(e,r,t,!1)}var fr=lr,dr=cr;z.Fragment=E,z.jsx=fr,z.jsxs=dr}()),z}process.env.NODE_ENV==="production"?ne.exports=gr():ne.exports=_r();var C=ne.exports;function Sr(n,o){const f=o===void 0?void 0:typeof o=="object"&&o!==null&&!Array.isArray(o)&&("equals"in o||"loading"in o||"error"in o)?o:{equals:o};return C.jsx(xr,{selectorOrAtom:n,options:f})}class Or extends R.Component{constructor(){super(...arguments);Pe(this,"state",{error:null})}static getDerivedStateFromError(f){return{error:f}}componentDidCatch(f,E){}render(){if(this.state.error!==null&&this.props.onError)return C.jsx(C.Fragment,{children:this.props.onError({error:this.state.error})});if(this.state.error!==null)throw this.state.error;return this.props.children}}function Tr(n){const o=oe(n.selector,n.equals);return C.jsx(C.Fragment,{children:o??null})}function Cr(n){return C.jsx(C.Fragment,{children:n.render()})}function jr(n){return n.fallback?C.jsx(R.Suspense,{fallback:C.jsx(Cr,{render:n.fallback}),children:n.children}):C.jsx(C.Fragment,{children:n.children})}function wr(n){return n.onError?C.jsx(Or,{onError:n.onError,children:n.children}):C.jsx(C.Fragment,{children:n.children})}const xr=R.memo(function(o){var p,i,T,d;const f=R.useRef(o.selectorOrAtom);f.current=o.selectorOrAtom;const E=u.isAtom(o.selectorOrAtom),S=(p=o.options)==null?void 0:p.deps,j=E?[o.selectorOrAtom,...S??[]]:S??[{}],h=R.useCallback(v=>u.isAtom(f.current)?v.read(f.current):f.current(v),j);return C.jsx(wr,{onError:(i=o.options)==null?void 0:i.error,children:C.jsx(jr,{fallback:(T=o.options)==null?void 0:T.loading,children:C.jsx(Tr,{selector:h,equals:(d=o.options)==null?void 0:d.equals})})})},(n,o)=>u.shallowEqual(n.selectorOrAtom,o.selectorOrAtom)&&u.shallowEqual(n.options,o.options));exports.AllAtomsRejectedError=u.AllAtomsRejectedError;exports.atom=u.atom;exports.batch=u.batch;exports.define=u.define;exports.derived=u.derived;exports.effect=u.effect;exports.emitter=u.emitter;exports.getAtomState=u.getAtomState;exports.isAtom=u.isAtom;exports.isDerived=u.isDerived;exports.isFulfilled=u.isFulfilled;exports.isPending=u.isPending;exports.isRejected=u.isRejected;exports.onCreateHook=u.onCreateHook;exports.onErrorHook=u.onErrorHook;exports.promisesEqual=u.promisesEqual;exports.readonly=u.readonly;exports.select=u.select;exports.trackPromise=u.trackPromise;exports.unwrap=u.unwrap;exports.rx=Sr;exports.useAction=yr;exports.useSelector=oe;exports.useStable=hr;
1
+ "use strict";var C=Object.defineProperty;var O=(e,r,n)=>r in e?C(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var p=(e,r,n)=>O(e,typeof r!="symbol"?r+"":r,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),t=require("../index-Cxk9v0um.cjs"),a=require("react/jsx-runtime");function v(e,r){const n=t.isAtom(e)?({read:u})=>u(e):e,f=t.resolveEquality(r??"shallow"),d=s.useRef(n),R=s.useRef(f);d.current=n,R.current=f;const l=s.useRef(new Map),i=s.useRef(new Set),o=s.useRef({value:void 0,initialized:!1}),E=s.useCallback(()=>{const u=t.select(d.current);if(i.current=u.dependencies,u.promise!==void 0)throw u.promise;if(u.error!==void 0)throw u.error;const m=u.value;return(!o.current.initialized||!R.current(m,o.current.value))&&(o.current={value:m,initialized:!0}),o.current.value},[]),b=s.useCallback(u=>{const m=l.current,g=()=>{const S=i.current;for(const[A,c]of m)S.has(A)||(c(),m.delete(A));for(const A of S)if(!m.has(A)){const c=A.on(()=>{const h=t.select(d.current);i.current=h.dependencies,g(),u()});m.set(A,c)}};return g(),()=>{for(const S of m.values())S();m.clear()}},[]);return s.useSyncExternalStore(b,E,E)}function q(e){return e==null?"strict":Array.isArray(e)?"shallow":e instanceof Date?"deep":typeof e=="object"?"shallow":"strict"}function w(e,r){const n=s.useRef({}),f=s.useRef(null);f.current===null&&(f.current={});const d=n.current,R=f.current;for(const l of Object.keys(e)){const i=e[l],o=d[l];if(typeof i=="function"){const[m]=t.tryStabilize(o,i,()=>!1);d[l]={value:m},R[l]=m;continue}const E=r==null?void 0:r[l],b=E?t.resolveEquality(E):t.resolveEquality(q(i)),[u]=t.tryStabilize(o,i,b);d[l]={value:u},R[l]=u}for(const l of Object.keys(d))l in e||(delete d[l],delete R[l]);return R}const x={status:"idle",result:void 0,error:void 0},k={status:"loading",result:void 0,error:void 0};function D(e,r){switch(r.type){case"START":return k;case"SUCCESS":return{status:"success",result:r.result,error:void 0};case"ERROR":return{status:"error",result:void 0,error:r.error};case"RESET":return x;default:return e}}function T(e,r={}){const{lazy:n=!0,exclusive:f=!0,deps:d=[]}=r,R=n?x:k,[l,i]=s.useReducer(D,R),o=s.useRef(null),E=s.useRef(e);E.current=e;const b=s.useCallback(()=>{const c=o.current;return c?(c.abort(),o.current=null,!0):!1},[]),u=(n?[]:d??[]).filter(t.isAtom),m=v(({read:c})=>u.map(h=>c(h))),g=s.useCallback(()=>{f&&b();const c=new AbortController;o.current=c,i({type:"START"});let h;try{h=E.current(t.withUse({signal:c.signal}))}catch(j){return i({type:"ERROR",error:j}),Object.assign(Promise.reject(j),{abort:()=>c.abort()})}if(t.isPromiseLike(h)){const j=h;return j.then(y=>{o.current===c&&i({type:"SUCCESS",result:y})},y=>{if(y instanceof DOMException&&y.name==="AbortError"){(o.current===null||o.current===c)&&i({type:"ERROR",error:y});return}o.current===c&&i({type:"ERROR",error:y})}),Object.assign(j,{abort:()=>{c.abort(),o.current===c&&(o.current=null)}})}return i({type:"SUCCESS",result:h}),Object.assign(Promise.resolve(h),{abort:()=>c.abort()})},[f,b]),S=(d??[]).filter(c=>!t.isAtom(c));s.useEffect(()=>{n||g()},[n,...m,...S]),s.useEffect(()=>()=>{f&&b()},[f,b]);const A=s.useCallback(()=>{f&&b(),i({type:"RESET"})},[f,b]);return Object.assign(g,{...l,abort:b,reset:A})}function F(e,r){const n=r===void 0?void 0:typeof r=="object"&&r!==null&&!Array.isArray(r)&&("equals"in r||"loading"in r||"error"in r)?r:{equals:r};return a.jsx(U,{selectorOrAtom:e,options:n})}class z extends s.Component{constructor(){super(...arguments);p(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,f){}render(){if(this.state.error!==null&&this.props.onError)return a.jsx(a.Fragment,{children:this.props.onError({error:this.state.error})});if(this.state.error!==null)throw this.state.error;return this.props.children}}function P(e){const r=v(e.selector,e.equals);return a.jsx(a.Fragment,{children:r??null})}function I(e){return a.jsx(a.Fragment,{children:e.render()})}function H(e){return e.fallback?a.jsx(s.Suspense,{fallback:a.jsx(I,{render:e.fallback}),children:e.children}):a.jsx(a.Fragment,{children:e.children})}function L(e){return e.onError?a.jsx(z,{onError:e.onError,children:e.children}):a.jsx(a.Fragment,{children:e.children})}const U=s.memo(function(r){var i,o,E,b;const n=s.useRef(r.selectorOrAtom);n.current=r.selectorOrAtom;const f=t.isAtom(r.selectorOrAtom),d=(i=r.options)==null?void 0:i.deps,R=f?[r.selectorOrAtom,...d??[]]:d??[{}],l=s.useCallback(u=>t.isAtom(n.current)?u.read(n.current):n.current(u),R);return a.jsx(L,{onError:(o=r.options)==null?void 0:o.error,children:a.jsx(H,{fallback:(E=r.options)==null?void 0:E.loading,children:a.jsx(P,{selector:l,equals:(b=r.options)==null?void 0:b.equals})})})},(e,r)=>t.shallowEqual(e.selectorOrAtom,r.selectorOrAtom)&&t.shallowEqual(e.options,r.options));exports.AllAtomsRejectedError=t.AllAtomsRejectedError;exports.atom=t.atom;exports.batch=t.batch;exports.define=t.define;exports.derived=t.derived;exports.effect=t.effect;exports.emitter=t.emitter;exports.getAtomState=t.getAtomState;exports.isAtom=t.isAtom;exports.isDerived=t.isDerived;exports.isFulfilled=t.isFulfilled;exports.isPending=t.isPending;exports.isRejected=t.isRejected;exports.onCreateHook=t.onCreateHook;exports.onErrorHook=t.onErrorHook;exports.promisesEqual=t.promisesEqual;exports.readonly=t.readonly;exports.select=t.select;exports.trackPromise=t.trackPromise;exports.unwrap=t.unwrap;exports.rx=F;exports.useAction=T;exports.useSelector=v;exports.useStable=w;
@@ -1,868 +1,243 @@
1
- var _r = Object.defineProperty;
2
- var Sr = (n, a, l) => a in n ? _r(n, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : n[a] = l;
3
- var Ae = (n, a, l) => Sr(n, typeof a != "symbol" ? a + "" : a, l);
4
- import Le, { useRef as A, useCallback as U, useSyncExternalStore as Or, useReducer as Tr, useEffect as De, memo as jr, Suspense as xr, Component as wr } from "react";
5
- import { i as z, r as ae, s as Fe, t as Ie, w as Cr, a as Pr, b as We } from "../index-CBVj1kSj.js";
6
- import { A as Gr, c as Hr, e as Xr, f as Zr, g as Qr, h as et, j as rt, l as tt, k as nt, n as at, m as ot, o as it, q as st, v as ut, x as ct, d as lt, p as ft, u as dt } from "../index-CBVj1kSj.js";
7
- function Ue(n, a) {
8
- const l = z(n) ? ({ read: d }) => d(n) : n, b = ae(a ?? "shallow"), g = A(l), T = A(b);
9
- g.current = l, T.current = b;
10
- const h = A(/* @__PURE__ */ new Map()), v = A(/* @__PURE__ */ new Set()), i = A({
1
+ var F = Object.defineProperty;
2
+ var I = (r, e, t) => e in r ? F(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var w = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { useRef as m, useCallback as y, useSyncExternalStore as P, useReducer as L, useEffect as x, memo as U, Suspense as _, Component as V } from "react";
5
+ import { i as g, r as k, s as C, t as j, w as H, a as M, b as D } from "../index-CBVj1kSj.js";
6
+ import { A as ir, c as ur, e as ar, f as lr, g as fr, h as dr, j as br, l as hr, k as mr, n as Rr, m as Er, o as pr, q as Sr, v as yr, x as Ar, d as vr, p as gr, u as Or } from "../index-CBVj1kSj.js";
7
+ import { jsx as d, Fragment as O } from "react/jsx-runtime";
8
+ function q(r, e) {
9
+ const t = g(r) ? ({ read: c }) => c(r) : r, u = k(e ?? "shallow"), a = m(t), b = m(u);
10
+ a.current = t, b.current = u;
11
+ const i = m(/* @__PURE__ */ new Map()), o = m(/* @__PURE__ */ new Set()), n = m({
11
12
  value: void 0,
12
13
  initialized: !1
13
- }), S = U(() => {
14
- const d = Fe(g.current);
15
- if (v.current = d.dependencies, d.promise !== void 0)
16
- throw d.promise;
17
- if (d.error !== void 0)
18
- throw d.error;
19
- const E = d.value;
20
- return (!i.current.initialized || !T.current(E, i.current.value)) && (i.current = { value: E, initialized: !0 }), i.current.value;
21
- }, []), f = U((d) => {
22
- const E = h.current, P = () => {
23
- const D = v.current;
24
- for (const [k, R] of E)
25
- D.has(k) || (R(), E.delete(k));
26
- for (const k of D)
27
- if (!E.has(k)) {
28
- const R = k.on(() => {
29
- const j = Fe(g.current);
30
- v.current = j.dependencies, P(), d();
14
+ }), h = y(() => {
15
+ const c = C(a.current);
16
+ if (o.current = c.dependencies, c.promise !== void 0)
17
+ throw c.promise;
18
+ if (c.error !== void 0)
19
+ throw c.error;
20
+ const f = c.value;
21
+ return (!n.current.initialized || !b.current(f, n.current.value)) && (n.current = { value: f, initialized: !0 }), n.current.value;
22
+ }, []), l = y((c) => {
23
+ const f = i.current, A = () => {
24
+ const p = o.current;
25
+ for (const [E, s] of f)
26
+ p.has(E) || (s(), f.delete(E));
27
+ for (const E of p)
28
+ if (!f.has(E)) {
29
+ const s = E.on(() => {
30
+ const R = C(a.current);
31
+ o.current = R.dependencies, A(), c();
31
32
  });
32
- E.set(k, R);
33
+ f.set(E, s);
33
34
  }
34
35
  };
35
- return P(), () => {
36
- for (const D of E.values())
37
- D();
38
- E.clear();
36
+ return A(), () => {
37
+ for (const p of f.values())
38
+ p();
39
+ f.clear();
39
40
  };
40
41
  }, []);
41
- return Or(f, S, S);
42
+ return P(l, h, h);
42
43
  }
43
- function kr(n) {
44
- return n == null ? "strict" : Array.isArray(n) ? "shallow" : n instanceof Date ? "deep" : typeof n == "object" ? "shallow" : "strict";
44
+ function W(r) {
45
+ return r == null ? "strict" : Array.isArray(r) ? "shallow" : r instanceof Date ? "deep" : typeof r == "object" ? "shallow" : "strict";
45
46
  }
46
- function Nr(n, a) {
47
- const l = A({}), b = A(null);
48
- b.current === null && (b.current = {});
49
- const g = l.current, T = b.current;
50
- for (const h of Object.keys(n)) {
51
- const v = n[h], i = g[h];
52
- if (typeof v == "function") {
53
- const [E] = Ie(
54
- i,
55
- v,
47
+ function tr(r, e) {
48
+ const t = m({}), u = m(null);
49
+ u.current === null && (u.current = {});
50
+ const a = t.current, b = u.current;
51
+ for (const i of Object.keys(r)) {
52
+ const o = r[i], n = a[i];
53
+ if (typeof o == "function") {
54
+ const [f] = j(
55
+ n,
56
+ o,
56
57
  () => !1
57
58
  // Equality doesn't matter for functions
58
59
  );
59
- g[h] = { value: E }, T[h] = E;
60
+ a[i] = { value: f }, b[i] = f;
60
61
  continue;
61
62
  }
62
- const S = a == null ? void 0 : a[h], f = S ? ae(S) : ae(kr(v)), [d] = Ie(
63
- i,
64
- v,
65
- f
63
+ const h = e == null ? void 0 : e[i], l = h ? k(h) : k(W(o)), [c] = j(
64
+ n,
65
+ o,
66
+ l
66
67
  );
67
- g[h] = { value: d }, T[h] = d;
68
+ a[i] = { value: c }, b[i] = c;
68
69
  }
69
- for (const h of Object.keys(g))
70
- h in n || (delete g[h], delete T[h]);
71
- return T;
70
+ for (const i of Object.keys(a))
71
+ i in r || (delete a[i], delete b[i]);
72
+ return b;
72
73
  }
73
- const Ve = {
74
+ const T = {
74
75
  status: "idle",
75
76
  result: void 0,
76
77
  error: void 0
77
- }, qe = {
78
+ }, z = {
78
79
  status: "loading",
79
80
  result: void 0,
80
81
  error: void 0
81
82
  };
82
- function Ar(n, a) {
83
- switch (a.type) {
83
+ function B(r, e) {
84
+ switch (e.type) {
84
85
  case "START":
85
- return qe;
86
+ return z;
86
87
  case "SUCCESS":
87
88
  return {
88
89
  status: "success",
89
- result: a.result,
90
+ result: e.result,
90
91
  error: void 0
91
92
  };
92
93
  case "ERROR":
93
94
  return {
94
95
  status: "error",
95
96
  result: void 0,
96
- error: a.error
97
+ error: e.error
97
98
  };
98
99
  case "RESET":
99
- return Ve;
100
+ return T;
100
101
  default:
101
- return n;
102
+ return r;
102
103
  }
103
104
  }
104
- function zr(n, a = {}) {
105
- const { lazy: l = !0, exclusive: b = !0, deps: g = [] } = a, T = l ? Ve : qe, [h, v] = Tr(
106
- Ar,
107
- T
108
- ), i = A(null), S = A(n);
109
- S.current = n;
110
- const f = U(() => {
111
- const R = i.current;
112
- return R ? (R.abort(), i.current = null, !0) : !1;
113
- }, []), d = (l ? [] : g ?? []).filter(z), E = Ue(({ read: R }) => d.map((j) => R(j))), P = U(() => {
114
- b && f();
115
- const R = new AbortController();
116
- i.current = R, v({ type: "START" });
117
- let j;
105
+ function nr(r, e = {}) {
106
+ const { lazy: t = !0, exclusive: u = !0, deps: a = [] } = e, b = t ? T : z, [i, o] = L(
107
+ B,
108
+ b
109
+ ), n = m(null), h = m(r);
110
+ h.current = r;
111
+ const l = y(() => {
112
+ const s = n.current;
113
+ return s ? (s.abort(), n.current = null, !0) : !1;
114
+ }, []), c = (t ? [] : a ?? []).filter(g), f = q(({ read: s }) => c.map((R) => s(R))), A = y(() => {
115
+ u && l();
116
+ const s = new AbortController();
117
+ n.current = s, o({ type: "START" });
118
+ let R;
118
119
  try {
119
- j = S.current(Cr({ signal: R.signal }));
120
- } catch (m) {
121
- return v({ type: "ERROR", error: m }), Object.assign(Promise.reject(m), {
122
- abort: () => R.abort()
120
+ R = h.current(H({ signal: s.signal }));
121
+ } catch (v) {
122
+ return o({ type: "ERROR", error: v }), Object.assign(Promise.reject(v), {
123
+ abort: () => s.abort()
123
124
  });
124
125
  }
125
- if (Pr(j)) {
126
- const m = j;
127
- return m.then(
128
- (F) => {
129
- i.current === R && v({ type: "SUCCESS", result: F });
126
+ if (M(R)) {
127
+ const v = R;
128
+ return v.then(
129
+ (S) => {
130
+ n.current === s && o({ type: "SUCCESS", result: S });
130
131
  },
131
- (F) => {
132
- if (F instanceof DOMException && F.name === "AbortError") {
133
- (i.current === null || i.current === R) && v({ type: "ERROR", error: F });
132
+ (S) => {
133
+ if (S instanceof DOMException && S.name === "AbortError") {
134
+ (n.current === null || n.current === s) && o({ type: "ERROR", error: S });
134
135
  return;
135
136
  }
136
- i.current === R && v({ type: "ERROR", error: F });
137
+ n.current === s && o({ type: "ERROR", error: S });
137
138
  }
138
- ), Object.assign(m, {
139
+ ), Object.assign(v, {
139
140
  abort: () => {
140
- R.abort(), i.current === R && (i.current = null);
141
+ s.abort(), n.current === s && (n.current = null);
141
142
  }
142
143
  });
143
144
  }
144
- return v({ type: "SUCCESS", result: j }), Object.assign(Promise.resolve(j), {
145
- abort: () => R.abort()
145
+ return o({ type: "SUCCESS", result: R }), Object.assign(Promise.resolve(R), {
146
+ abort: () => s.abort()
146
147
  });
147
- }, [b, f]), D = (g ?? []).filter((R) => !z(R));
148
- De(() => {
149
- l || P();
150
- }, [l, ...E, ...D]), De(() => () => {
151
- b && f();
152
- }, [b, f]);
153
- const k = U(() => {
154
- b && f(), v({ type: "RESET" });
155
- }, [b, f]);
156
- return Object.assign(P, {
157
- ...h,
158
- abort: f,
159
- reset: k
148
+ }, [u, l]), p = (a ?? []).filter((s) => !g(s));
149
+ x(() => {
150
+ t || A();
151
+ }, [t, ...f, ...p]), x(() => () => {
152
+ u && l();
153
+ }, [u, l]);
154
+ const E = y(() => {
155
+ u && l(), o({ type: "RESET" });
156
+ }, [u, l]);
157
+ return Object.assign(A, {
158
+ ...i,
159
+ abort: l,
160
+ reset: E
160
161
  });
161
162
  }
162
- var oe = { exports: {} }, M = {};
163
- /**
164
- * @license React
165
- * react-jsx-runtime.production.min.js
166
- *
167
- * Copyright (c) Facebook, Inc. and its affiliates.
168
- *
169
- * This source code is licensed under the MIT license found in the
170
- * LICENSE file in the root directory of this source tree.
171
- */
172
- var $e;
173
- function Dr() {
174
- if ($e) return M;
175
- $e = 1;
176
- var n = Le, a = Symbol.for("react.element"), l = Symbol.for("react.fragment"), b = Object.prototype.hasOwnProperty, g = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, T = { key: !0, ref: !0, __self: !0, __source: !0 };
177
- function h(v, i, S) {
178
- var f, d = {}, E = null, P = null;
179
- S !== void 0 && (E = "" + S), i.key !== void 0 && (E = "" + i.key), i.ref !== void 0 && (P = i.ref);
180
- for (f in i) b.call(i, f) && !T.hasOwnProperty(f) && (d[f] = i[f]);
181
- if (v && v.defaultProps) for (f in i = v.defaultProps, i) d[f] === void 0 && (d[f] = i[f]);
182
- return { $$typeof: a, type: v, key: E, ref: P, props: d, _owner: g.current };
183
- }
184
- return M.Fragment = l, M.jsx = h, M.jsxs = h, M;
185
- }
186
- var N = {};
187
- /**
188
- * @license React
189
- * react-jsx-runtime.development.js
190
- *
191
- * Copyright (c) Facebook, Inc. and its affiliates.
192
- *
193
- * This source code is licensed under the MIT license found in the
194
- * LICENSE file in the root directory of this source tree.
195
- */
196
- var Ye;
197
- function Fr() {
198
- return Ye || (Ye = 1, process.env.NODE_ENV !== "production" && function() {
199
- var n = Le, a = Symbol.for("react.element"), l = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), v = Symbol.for("react.context"), i = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), D = Symbol.iterator, k = "@@iterator";
200
- function R(e) {
201
- if (e === null || typeof e != "object")
202
- return null;
203
- var r = D && e[D] || e[k];
204
- return typeof r == "function" ? r : null;
205
- }
206
- var j = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
207
- function m(e) {
208
- {
209
- for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++)
210
- t[o - 1] = arguments[o];
211
- F("error", e, t);
212
- }
213
- }
214
- function F(e, r, t) {
215
- {
216
- var o = j.ReactDebugCurrentFrame, c = o.getStackAddendum();
217
- c !== "" && (r += "%s", t = t.concat([c]));
218
- var p = t.map(function(u) {
219
- return String(u);
220
- });
221
- p.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, p);
222
- }
223
- }
224
- var ie = !1, Me = !1, Ne = !1, ze = !1, Be = !1, se;
225
- se = Symbol.for("react.module.reference");
226
- function Je(e) {
227
- return !!(typeof e == "string" || typeof e == "function" || e === b || e === T || Be || e === g || e === S || e === f || ze || e === P || ie || Me || Ne || typeof e == "object" && e !== null && (e.$$typeof === E || e.$$typeof === d || e.$$typeof === h || e.$$typeof === v || e.$$typeof === i || // This needs to include all possible module reference object
228
- // types supported by any Flight configuration anywhere since
229
- // we don't know which Flight build this will end up being used
230
- // with.
231
- e.$$typeof === se || e.getModuleId !== void 0));
232
- }
233
- function Ke(e, r, t) {
234
- var o = e.displayName;
235
- if (o)
236
- return o;
237
- var c = r.displayName || r.name || "";
238
- return c !== "" ? t + "(" + c + ")" : t;
239
- }
240
- function ue(e) {
241
- return e.displayName || "Context";
242
- }
243
- function I(e) {
244
- if (e == null)
245
- return null;
246
- if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
247
- return e.displayName || e.name || null;
248
- if (typeof e == "string")
249
- return e;
250
- switch (e) {
251
- case b:
252
- return "Fragment";
253
- case l:
254
- return "Portal";
255
- case T:
256
- return "Profiler";
257
- case g:
258
- return "StrictMode";
259
- case S:
260
- return "Suspense";
261
- case f:
262
- return "SuspenseList";
263
- }
264
- if (typeof e == "object")
265
- switch (e.$$typeof) {
266
- case v:
267
- var r = e;
268
- return ue(r) + ".Consumer";
269
- case h:
270
- var t = e;
271
- return ue(t._context) + ".Provider";
272
- case i:
273
- return Ke(e, e.render, "ForwardRef");
274
- case d:
275
- var o = e.displayName || null;
276
- return o !== null ? o : I(e.type) || "Memo";
277
- case E: {
278
- var c = e, p = c._payload, u = c._init;
279
- try {
280
- return I(u(p));
281
- } catch {
282
- return null;
283
- }
284
- }
285
- }
286
- return null;
287
- }
288
- var W = Object.assign, V = 0, ce, le, fe, de, ve, pe, be;
289
- function he() {
290
- }
291
- he.__reactDisabledLog = !0;
292
- function Ge() {
293
- {
294
- if (V === 0) {
295
- ce = console.log, le = console.info, fe = console.warn, de = console.error, ve = console.group, pe = console.groupCollapsed, be = console.groupEnd;
296
- var e = {
297
- configurable: !0,
298
- enumerable: !0,
299
- value: he,
300
- writable: !0
301
- };
302
- Object.defineProperties(console, {
303
- info: e,
304
- log: e,
305
- warn: e,
306
- error: e,
307
- group: e,
308
- groupCollapsed: e,
309
- groupEnd: e
310
- });
311
- }
312
- V++;
313
- }
314
- }
315
- function He() {
316
- {
317
- if (V--, V === 0) {
318
- var e = {
319
- configurable: !0,
320
- enumerable: !0,
321
- writable: !0
322
- };
323
- Object.defineProperties(console, {
324
- log: W({}, e, {
325
- value: ce
326
- }),
327
- info: W({}, e, {
328
- value: le
329
- }),
330
- warn: W({}, e, {
331
- value: fe
332
- }),
333
- error: W({}, e, {
334
- value: de
335
- }),
336
- group: W({}, e, {
337
- value: ve
338
- }),
339
- groupCollapsed: W({}, e, {
340
- value: pe
341
- }),
342
- groupEnd: W({}, e, {
343
- value: be
344
- })
345
- });
346
- }
347
- V < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
348
- }
349
- }
350
- var H = j.ReactCurrentDispatcher, X;
351
- function B(e, r, t) {
352
- {
353
- if (X === void 0)
354
- try {
355
- throw Error();
356
- } catch (c) {
357
- var o = c.stack.trim().match(/\n( *(at )?)/);
358
- X = o && o[1] || "";
359
- }
360
- return `
361
- ` + X + e;
362
- }
363
- }
364
- var Z = !1, J;
365
- {
366
- var Xe = typeof WeakMap == "function" ? WeakMap : Map;
367
- J = new Xe();
368
- }
369
- function Ee(e, r) {
370
- if (!e || Z)
371
- return "";
372
- {
373
- var t = J.get(e);
374
- if (t !== void 0)
375
- return t;
376
- }
377
- var o;
378
- Z = !0;
379
- var c = Error.prepareStackTrace;
380
- Error.prepareStackTrace = void 0;
381
- var p;
382
- p = H.current, H.current = null, Ge();
383
- try {
384
- if (r) {
385
- var u = function() {
386
- throw Error();
387
- };
388
- if (Object.defineProperty(u.prototype, "props", {
389
- set: function() {
390
- throw Error();
391
- }
392
- }), typeof Reflect == "object" && Reflect.construct) {
393
- try {
394
- Reflect.construct(u, []);
395
- } catch (w) {
396
- o = w;
397
- }
398
- Reflect.construct(e, [], u);
399
- } else {
400
- try {
401
- u.call();
402
- } catch (w) {
403
- o = w;
404
- }
405
- e.call(u.prototype);
406
- }
407
- } else {
408
- try {
409
- throw Error();
410
- } catch (w) {
411
- o = w;
412
- }
413
- e();
414
- }
415
- } catch (w) {
416
- if (w && o && typeof w.stack == "string") {
417
- for (var s = w.stack.split(`
418
- `), x = o.stack.split(`
419
- `), y = s.length - 1, _ = x.length - 1; y >= 1 && _ >= 0 && s[y] !== x[_]; )
420
- _--;
421
- for (; y >= 1 && _ >= 0; y--, _--)
422
- if (s[y] !== x[_]) {
423
- if (y !== 1 || _ !== 1)
424
- do
425
- if (y--, _--, _ < 0 || s[y] !== x[_]) {
426
- var C = `
427
- ` + s[y].replace(" at new ", " at ");
428
- return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && J.set(e, C), C;
429
- }
430
- while (y >= 1 && _ >= 0);
431
- break;
432
- }
433
- }
434
- } finally {
435
- Z = !1, H.current = p, He(), Error.prepareStackTrace = c;
436
- }
437
- var L = e ? e.displayName || e.name : "", $ = L ? B(L) : "";
438
- return typeof e == "function" && J.set(e, $), $;
439
- }
440
- function Ze(e, r, t) {
441
- return Ee(e, !1);
442
- }
443
- function Qe(e) {
444
- var r = e.prototype;
445
- return !!(r && r.isReactComponent);
446
- }
447
- function K(e, r, t) {
448
- if (e == null)
449
- return "";
450
- if (typeof e == "function")
451
- return Ee(e, Qe(e));
452
- if (typeof e == "string")
453
- return B(e);
454
- switch (e) {
455
- case S:
456
- return B("Suspense");
457
- case f:
458
- return B("SuspenseList");
459
- }
460
- if (typeof e == "object")
461
- switch (e.$$typeof) {
462
- case i:
463
- return Ze(e.render);
464
- case d:
465
- return K(e.type, r, t);
466
- case E: {
467
- var o = e, c = o._payload, p = o._init;
468
- try {
469
- return K(p(c), r, t);
470
- } catch {
471
- }
472
- }
473
- }
474
- return "";
475
- }
476
- var q = Object.prototype.hasOwnProperty, Re = {}, me = j.ReactDebugCurrentFrame;
477
- function G(e) {
478
- if (e) {
479
- var r = e._owner, t = K(e.type, e._source, r ? r.type : null);
480
- me.setExtraStackFrame(t);
481
- } else
482
- me.setExtraStackFrame(null);
483
- }
484
- function er(e, r, t, o, c) {
485
- {
486
- var p = Function.call.bind(q);
487
- for (var u in e)
488
- if (p(e, u)) {
489
- var s = void 0;
490
- try {
491
- if (typeof e[u] != "function") {
492
- var x = Error((o || "React class") + ": " + t + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
493
- throw x.name = "Invariant Violation", x;
494
- }
495
- s = e[u](r, u, o, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
496
- } catch (y) {
497
- s = y;
498
- }
499
- s && !(s instanceof Error) && (G(c), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", o || "React class", t, u, typeof s), G(null)), s instanceof Error && !(s.message in Re) && (Re[s.message] = !0, G(c), m("Failed %s type: %s", t, s.message), G(null));
500
- }
501
- }
502
- }
503
- var rr = Array.isArray;
504
- function Q(e) {
505
- return rr(e);
506
- }
507
- function tr(e) {
508
- {
509
- var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
510
- return t;
511
- }
512
- }
513
- function nr(e) {
514
- try {
515
- return ye(e), !1;
516
- } catch {
517
- return !0;
518
- }
519
- }
520
- function ye(e) {
521
- return "" + e;
522
- }
523
- function ge(e) {
524
- if (nr(e))
525
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tr(e)), ye(e);
526
- }
527
- var _e = j.ReactCurrentOwner, ar = {
528
- key: !0,
529
- ref: !0,
530
- __self: !0,
531
- __source: !0
532
- }, Se, Oe;
533
- function or(e) {
534
- if (q.call(e, "ref")) {
535
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
536
- if (r && r.isReactWarning)
537
- return !1;
538
- }
539
- return e.ref !== void 0;
540
- }
541
- function ir(e) {
542
- if (q.call(e, "key")) {
543
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
544
- if (r && r.isReactWarning)
545
- return !1;
546
- }
547
- return e.key !== void 0;
548
- }
549
- function sr(e, r) {
550
- typeof e.ref == "string" && _e.current;
551
- }
552
- function ur(e, r) {
553
- {
554
- var t = function() {
555
- Se || (Se = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
556
- };
557
- t.isReactWarning = !0, Object.defineProperty(e, "key", {
558
- get: t,
559
- configurable: !0
560
- });
561
- }
562
- }
563
- function cr(e, r) {
564
- {
565
- var t = function() {
566
- Oe || (Oe = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
567
- };
568
- t.isReactWarning = !0, Object.defineProperty(e, "ref", {
569
- get: t,
570
- configurable: !0
571
- });
572
- }
573
- }
574
- var lr = function(e, r, t, o, c, p, u) {
575
- var s = {
576
- // This tag allows us to uniquely identify this as a React Element
577
- $$typeof: a,
578
- // Built-in properties that belong on the element
579
- type: e,
580
- key: r,
581
- ref: t,
582
- props: u,
583
- // Record the component responsible for creating this element.
584
- _owner: p
585
- };
586
- return s._store = {}, Object.defineProperty(s._store, "validated", {
587
- configurable: !1,
588
- enumerable: !1,
589
- writable: !0,
590
- value: !1
591
- }), Object.defineProperty(s, "_self", {
592
- configurable: !1,
593
- enumerable: !1,
594
- writable: !1,
595
- value: o
596
- }), Object.defineProperty(s, "_source", {
597
- configurable: !1,
598
- enumerable: !1,
599
- writable: !1,
600
- value: c
601
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
602
- };
603
- function fr(e, r, t, o, c) {
604
- {
605
- var p, u = {}, s = null, x = null;
606
- t !== void 0 && (ge(t), s = "" + t), ir(r) && (ge(r.key), s = "" + r.key), or(r) && (x = r.ref, sr(r, c));
607
- for (p in r)
608
- q.call(r, p) && !ar.hasOwnProperty(p) && (u[p] = r[p]);
609
- if (e && e.defaultProps) {
610
- var y = e.defaultProps;
611
- for (p in y)
612
- u[p] === void 0 && (u[p] = y[p]);
613
- }
614
- if (s || x) {
615
- var _ = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
616
- s && ur(u, _), x && cr(u, _);
617
- }
618
- return lr(e, s, x, c, o, _e.current, u);
619
- }
620
- }
621
- var ee = j.ReactCurrentOwner, Te = j.ReactDebugCurrentFrame;
622
- function Y(e) {
623
- if (e) {
624
- var r = e._owner, t = K(e.type, e._source, r ? r.type : null);
625
- Te.setExtraStackFrame(t);
626
- } else
627
- Te.setExtraStackFrame(null);
628
- }
629
- var re;
630
- re = !1;
631
- function te(e) {
632
- return typeof e == "object" && e !== null && e.$$typeof === a;
633
- }
634
- function je() {
635
- {
636
- if (ee.current) {
637
- var e = I(ee.current.type);
638
- if (e)
639
- return `
640
-
641
- Check the render method of \`` + e + "`.";
642
- }
643
- return "";
644
- }
645
- }
646
- function dr(e) {
647
- return "";
648
- }
649
- var xe = {};
650
- function vr(e) {
651
- {
652
- var r = je();
653
- if (!r) {
654
- var t = typeof e == "string" ? e : e.displayName || e.name;
655
- t && (r = `
656
-
657
- Check the top-level render call using <` + t + ">.");
658
- }
659
- return r;
660
- }
661
- }
662
- function we(e, r) {
663
- {
664
- if (!e._store || e._store.validated || e.key != null)
665
- return;
666
- e._store.validated = !0;
667
- var t = vr(r);
668
- if (xe[t])
669
- return;
670
- xe[t] = !0;
671
- var o = "";
672
- e && e._owner && e._owner !== ee.current && (o = " It was passed a child from " + I(e._owner.type) + "."), Y(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, o), Y(null);
673
- }
674
- }
675
- function Ce(e, r) {
676
- {
677
- if (typeof e != "object")
678
- return;
679
- if (Q(e))
680
- for (var t = 0; t < e.length; t++) {
681
- var o = e[t];
682
- te(o) && we(o, r);
683
- }
684
- else if (te(e))
685
- e._store && (e._store.validated = !0);
686
- else if (e) {
687
- var c = R(e);
688
- if (typeof c == "function" && c !== e.entries)
689
- for (var p = c.call(e), u; !(u = p.next()).done; )
690
- te(u.value) && we(u.value, r);
691
- }
692
- }
693
- }
694
- function pr(e) {
695
- {
696
- var r = e.type;
697
- if (r == null || typeof r == "string")
698
- return;
699
- var t;
700
- if (typeof r == "function")
701
- t = r.propTypes;
702
- else if (typeof r == "object" && (r.$$typeof === i || // Note: Memo only checks outer props here.
703
- // Inner props are checked in the reconciler.
704
- r.$$typeof === d))
705
- t = r.propTypes;
706
- else
707
- return;
708
- if (t) {
709
- var o = I(r);
710
- er(t, e.props, "prop", o, e);
711
- } else if (r.PropTypes !== void 0 && !re) {
712
- re = !0;
713
- var c = I(r);
714
- m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", c || "Unknown");
715
- }
716
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
717
- }
718
- }
719
- function br(e) {
720
- {
721
- for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
722
- var o = r[t];
723
- if (o !== "children" && o !== "key") {
724
- Y(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), Y(null);
725
- break;
726
- }
727
- }
728
- e.ref !== null && (Y(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), Y(null));
729
- }
730
- }
731
- var Pe = {};
732
- function ke(e, r, t, o, c, p) {
733
- {
734
- var u = Je(e);
735
- if (!u) {
736
- var s = "";
737
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (s += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
738
- var x = dr();
739
- x ? s += x : s += je();
740
- var y;
741
- e === null ? y = "null" : Q(e) ? y = "array" : e !== void 0 && e.$$typeof === a ? (y = "<" + (I(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : y = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", y, s);
742
- }
743
- var _ = fr(e, r, t, c, p);
744
- if (_ == null)
745
- return _;
746
- if (u) {
747
- var C = r.children;
748
- if (C !== void 0)
749
- if (o)
750
- if (Q(C)) {
751
- for (var L = 0; L < C.length; L++)
752
- Ce(C[L], e);
753
- Object.freeze && Object.freeze(C);
754
- } else
755
- m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
756
- else
757
- Ce(C, e);
758
- }
759
- if (q.call(r, "key")) {
760
- var $ = I(e), w = Object.keys(r).filter(function(gr) {
761
- return gr !== "key";
762
- }), ne = w.length > 0 ? "{key: someKey, " + w.join(": ..., ") + ": ...}" : "{key: someKey}";
763
- if (!Pe[$ + ne]) {
764
- var yr = w.length > 0 ? "{" + w.join(": ..., ") + ": ...}" : "{}";
765
- m(`A props object containing a "key" prop is being spread into JSX:
766
- let props = %s;
767
- <%s {...props} />
768
- React keys must be passed directly to JSX without using spread:
769
- let props = %s;
770
- <%s key={someKey} {...props} />`, ne, $, yr, $), Pe[$ + ne] = !0;
771
- }
772
- }
773
- return e === b ? br(_) : pr(_), _;
774
- }
775
- }
776
- function hr(e, r, t) {
777
- return ke(e, r, t, !0);
778
- }
779
- function Er(e, r, t) {
780
- return ke(e, r, t, !1);
781
- }
782
- var Rr = Er, mr = hr;
783
- N.Fragment = b, N.jsx = Rr, N.jsxs = mr;
784
- }()), N;
785
- }
786
- process.env.NODE_ENV === "production" ? oe.exports = Dr() : oe.exports = Fr();
787
- var O = oe.exports;
788
- function Br(n, a) {
789
- const l = a === void 0 ? void 0 : typeof a == "object" && a !== null && !Array.isArray(a) && ("equals" in a || "loading" in a || "error" in a) ? a : { equals: a };
790
- return /* @__PURE__ */ O.jsx(
791
- Ur,
163
+ function sr(r, e) {
164
+ const t = e === void 0 ? void 0 : typeof e == "object" && e !== null && !Array.isArray(e) && ("equals" in e || "loading" in e || "error" in e) ? e : { equals: e };
165
+ return /* @__PURE__ */ d(
166
+ X,
792
167
  {
793
- selectorOrAtom: n,
794
- options: l
168
+ selectorOrAtom: r,
169
+ options: t
795
170
  }
796
171
  );
797
172
  }
798
- class Ir extends wr {
173
+ class G extends V {
799
174
  constructor() {
800
175
  super(...arguments);
801
- Ae(this, "state", { error: null });
176
+ w(this, "state", { error: null });
802
177
  }
803
- static getDerivedStateFromError(l) {
804
- return { error: l };
178
+ static getDerivedStateFromError(t) {
179
+ return { error: t };
805
180
  }
806
181
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
807
- componentDidCatch(l, b) {
182
+ componentDidCatch(t, u) {
808
183
  }
809
184
  render() {
810
185
  if (this.state.error !== null && this.props.onError)
811
- return /* @__PURE__ */ O.jsx(O.Fragment, { children: this.props.onError({ error: this.state.error }) });
186
+ return /* @__PURE__ */ d(O, { children: this.props.onError({ error: this.state.error }) });
812
187
  if (this.state.error !== null)
813
188
  throw this.state.error;
814
189
  return this.props.children;
815
190
  }
816
191
  }
817
- function Wr(n) {
818
- const a = Ue(n.selector, n.equals);
819
- return /* @__PURE__ */ O.jsx(O.Fragment, { children: a ?? null });
192
+ function N(r) {
193
+ const e = q(r.selector, r.equals);
194
+ return /* @__PURE__ */ d(O, { children: e ?? null });
820
195
  }
821
- function $r(n) {
822
- return /* @__PURE__ */ O.jsx(O.Fragment, { children: n.render() });
196
+ function J(r) {
197
+ return /* @__PURE__ */ d(O, { children: r.render() });
823
198
  }
824
- function Yr(n) {
825
- return n.fallback ? /* @__PURE__ */ O.jsx(xr, { fallback: /* @__PURE__ */ O.jsx($r, { render: n.fallback }), children: n.children }) : /* @__PURE__ */ O.jsx(O.Fragment, { children: n.children });
199
+ function K(r) {
200
+ return r.fallback ? /* @__PURE__ */ d(_, { fallback: /* @__PURE__ */ d(J, { render: r.fallback }), children: r.children }) : /* @__PURE__ */ d(O, { children: r.children });
826
201
  }
827
- function Lr(n) {
828
- return n.onError ? /* @__PURE__ */ O.jsx(Ir, { onError: n.onError, children: n.children }) : /* @__PURE__ */ O.jsx(O.Fragment, { children: n.children });
202
+ function Q(r) {
203
+ return r.onError ? /* @__PURE__ */ d(G, { onError: r.onError, children: r.children }) : /* @__PURE__ */ d(O, { children: r.children });
829
204
  }
830
- const Ur = jr(
831
- function(a) {
832
- var v, i, S, f;
833
- const l = A(a.selectorOrAtom);
834
- l.current = a.selectorOrAtom;
835
- const b = z(a.selectorOrAtom), g = (v = a.options) == null ? void 0 : v.deps, T = b ? [a.selectorOrAtom, ...g ?? []] : g ?? [{}], h = U(
836
- (d) => z(l.current) ? d.read(l.current) : l.current(d),
837
- T
205
+ const X = U(
206
+ function(e) {
207
+ var o, n, h, l;
208
+ const t = m(e.selectorOrAtom);
209
+ t.current = e.selectorOrAtom;
210
+ const u = g(e.selectorOrAtom), a = (o = e.options) == null ? void 0 : o.deps, b = u ? [e.selectorOrAtom, ...a ?? []] : a ?? [{}], i = y(
211
+ (c) => g(t.current) ? c.read(t.current) : t.current(c),
212
+ b
838
213
  );
839
- return /* @__PURE__ */ O.jsx(Lr, { onError: (i = a.options) == null ? void 0 : i.error, children: /* @__PURE__ */ O.jsx(Yr, { fallback: (S = a.options) == null ? void 0 : S.loading, children: /* @__PURE__ */ O.jsx(Wr, { selector: h, equals: (f = a.options) == null ? void 0 : f.equals }) }) });
214
+ return /* @__PURE__ */ d(Q, { onError: (n = e.options) == null ? void 0 : n.error, children: /* @__PURE__ */ d(K, { fallback: (h = e.options) == null ? void 0 : h.loading, children: /* @__PURE__ */ d(N, { selector: i, equals: (l = e.options) == null ? void 0 : l.equals }) }) });
840
215
  },
841
- (n, a) => We(n.selectorOrAtom, a.selectorOrAtom) && We(n.options, a.options)
216
+ (r, e) => D(r.selectorOrAtom, e.selectorOrAtom) && D(r.options, e.options)
842
217
  );
843
218
  export {
844
- Gr as AllAtomsRejectedError,
845
- Hr as atom,
846
- Xr as batch,
847
- Zr as define,
848
- Qr as derived,
849
- et as effect,
850
- rt as emitter,
851
- tt as getAtomState,
852
- z as isAtom,
853
- nt as isDerived,
854
- at as isFulfilled,
855
- ot as isPending,
856
- it as isRejected,
857
- st as onCreateHook,
858
- ut as onErrorHook,
859
- ct as promisesEqual,
860
- lt as readonly,
861
- Br as rx,
862
- Fe as select,
863
- ft as trackPromise,
864
- dt as unwrap,
865
- zr as useAction,
866
- Ue as useSelector,
867
- Nr as useStable
219
+ ir as AllAtomsRejectedError,
220
+ ur as atom,
221
+ ar as batch,
222
+ lr as define,
223
+ fr as derived,
224
+ dr as effect,
225
+ br as emitter,
226
+ hr as getAtomState,
227
+ g as isAtom,
228
+ mr as isDerived,
229
+ Rr as isFulfilled,
230
+ Er as isPending,
231
+ pr as isRejected,
232
+ Sr as onCreateHook,
233
+ yr as onErrorHook,
234
+ Ar as promisesEqual,
235
+ vr as readonly,
236
+ sr as rx,
237
+ C as select,
238
+ gr as trackPromise,
239
+ Or as unwrap,
240
+ nr as useAction,
241
+ q as useSelector,
242
+ tr as useStable
868
243
  };
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "url": "https://github.com/linq2js/atomirx"
17
17
  },
18
18
  "homepage": "https://github.com/linq2js/atomirx",
19
- "version": "0.0.7",
19
+ "version": "0.0.8",
20
20
  "type": "module",
21
21
  "main": "./dist/index.cjs",
22
22
  "module": "./dist/index.js",
package/vite.config.ts CHANGED
@@ -23,11 +23,14 @@ export default defineConfig({
23
23
  formats: ["es", "cjs"],
24
24
  },
25
25
  rollupOptions: {
26
- external: ["react", "react-dom"],
26
+ // Use regex to externalize all react-related imports including jsx-runtime
27
+ external: [/^react($|\/)/, /^react-dom($|\/)/],
27
28
  output: {
28
29
  globals: {
29
30
  react: "React",
30
31
  "react-dom": "ReactDOM",
32
+ "react/jsx-runtime": "React",
33
+ "react/jsx-dev-runtime": "React",
31
34
  },
32
35
  },
33
36
  },