1 | System.register(["react","jotai"],function(h){"use strict";var S,O,A,w,v,I,_,C;return{setters:[function(y){S=y.useContext,O=y.useState,A=y.useEffect,w=y.useDebugValue,v=y.useRef,I=y.useCallback},function(y){_=y.SECRET_INTERNAL_getScopeContext,C=y.useAtom}],execute:function(){h({useAtomDevtools:H,useAtomsDevtools:q,useAtomsSnapshot:P,useGotoAtomsSnapshot:L});const y="h",D="n",g="l",M="a",N="m",R=t=>t.debugLabel||t.toString(),j=([t,r])=>Object.fromEntries(r.flatMap(e=>{var s,n;const c=(s=t[N])==null?void 0:s.call(t,e);if(!c)return[];const a=c.t,o=((n=t[M])==null?void 0:n.call(t,e))||{};return[[R(e),{..."e"in o&&{error:o.e},..."p"in o&&{promise:o.p},..."v"in o&&{value:o.v},dependents:Array.from(a).map(R)}]]})),K=h("useAtomsDebugValue",t=>{var r;const e=(r=t==null?void 0:t.enabled)!=null?r:!1,s=_(t==null?void 0:t.scope),{s:n}=S(s),[c,a]=O([]);A(()=>{var o;if(!e)return;const f=()=>{var i;a(Array.from(((i=n[g])==null?void 0:i.call(n))||[]))},p=(o=n[D])==null?void 0:o.call(n,f);return f(),p},[e,n]),w([n,c],j)});function H(t,r,e){(typeof r=="string"||typeof e<"u")&&(console.warn("DEPRECATED [useAtomDevtools] use DevtoolOptions"),r={name:r,scope:e});const{enabled:s,name:n,scope:c}=r||{};let a;try{a=(s!=null?s:!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}const[o,f]=C(t,c),p=v(o),i=v(!1),l=v(),T=n||t.debugLabel||t.toString();A(()=>{if(!a)return;const E=u=>{if(typeof f=="function"){f(u);return}console.warn(`[Warn] you cannot do write operations (Time-travelling, etc) in read-only atoms
|
3 | `,m)}else u.type==="DISPATCH"&&u.state?(((U=u.payload)==null?void 0:U.type)==="JUMP_TO_ACTION"||((z=u.payload)==null?void 0:z.type)==="JUMP_TO_STATE")&&(i.current=!0,E(JSON.parse(u.state))):u.type==="DISPATCH"&&((J=u.payload)==null?void 0:J.type)==="COMMIT"?(k=l.current)==null||k.init(p.current):u.type==="DISPATCH"&&((x=u.payload)==null?void 0:x.type)==="IMPORT_STATE"&&(((G=u.payload.nextLiftedState)==null?void 0:G.computedStates)||[]).forEach(({state:m},F)=>{var $;F===0?($=l.current)==null||$.init(m):E(m)})});return l.current.shouldInit=!0,d},[t,a,T,f]),A(()=>{!l.current||(p.current=o,l.current.shouldInit?(l.current.init(o),l.current.shouldInit=!1):i.current?i.current=!1:l.current.send(`${T} - ${new Date().toLocaleString()}`,o))},[t,a,T,o])}const X=(t,r)=>t.size===r.size&&Array.from(t).every(([e,s])=>Object.is(r.get(e),s)),B=(t,r)=>t.size===r.size&&Array.from(t).every(([e,s])=>{const n=r.get(e);return n&&s.size===n.size&&Array.from(s).every(c=>n.has(c))});function P(t){const r=_(t),e=S(r).s,[s,n]=O(()=>({values:new Map,dependents:new Map}));return A(()=>{if(!e[D])return;let c=new Map,a=new Map;const o=new Set,f=()=>{const i=new Map,l=new Map;let T=!1;for(const E of e[g]()||[]){const d=e[M](E);if(d){if(!d.y){if("p"in d)return;o.has(E)||(o.add(E),T=!0)}"v"in d&&i.set(E,d.v)}const u=e[N](E);u&&l.set(E,u.t)}T||X(c,i)&&B(a,l)||(c=i,a=l,o.clear(),n({values:i,dependents:l}))},p=e[D](f);return f(),p},[e]),s}function L(t){const r=_(t),{s:e,w:s}=S(r);return I(n=>{if(!e[D])return;const c=a=>{s?s(o=>{e[y](a,o)}):e[y](a)};if(W(n)){c(n);return}c(n.values)},[e,s])}const W=t=>typeof t[Symbol.iterator]=="function",b=t=>t.debugLabel?`${t}:${t.debugLabel}`:`${t}`,V=t=>{const r={};t.values.forEach((s,n)=>{r[b(n)]=s});const e={};return t.dependents.forEach((s,n)=>{e[b(n)]=Array.from(s).map(b)}),{values:r,dependents:e}};function q(t,r){typeof r<"u"&&typeof r!="object"&&(console.warn("DEPRECATED [useAtomsDevtools] use DevtoolsOptions"),r={scope:r});const{enabled:e,scope:s}=r||{};let n;try{n=(e!=null?e:!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}const c=P(s),a=L(s),o=v(!1),f=v(!0),p=v(),i=v([]);A(()=>{if(!n)return;const l=(d=i.current.length-1)=>{const u=i.current[d>=0?d:0];if(!u)throw new Error("snaphost index out of bounds");return u},T=n.connect({name:t}),E=T.subscribe(d=>{var u;switch(d.type){case"DISPATCH":switch((u=d.payload)==null?void 0:u.type){case"RESET":break;case"COMMIT":T.init(V(l())),i.current=[];break;case"JUMP_TO_ACTION":case"JUMP_TO_STATE":o.current=!0,a(l(d.payload.actionId-1));break;case"PAUSE_RECORDING":f.current=!f.current;break}}});return p.current=T,p.current.shouldInit=!0,()=>{n.disconnect(),E==null||E()}},[n,a,t]),A(()=>{if(p.current){if(p.current.shouldInit){p.current.init(void 0),p.current.shouldInit=!1;return}o.current?o.current=!1:f.current&&(i.current.push(c),p.current.send({type:`${i.current.length}`,updatedAt:new Date().toLocaleString()},V(c)))}},[c])}}}});
|