@buoy-gg/jotai 7.0.41 → 7.0.43

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.
Files changed (54) hide show
  1. package/README.md +11 -80
  2. package/lib/commonjs/index.js +1 -112
  3. package/lib/commonjs/jotai/components/JotaiAtomBrowser.js +1 -199
  4. package/lib/commonjs/jotai/components/JotaiAtomChangeItem.js +1 -95
  5. package/lib/commonjs/jotai/components/JotaiAtomDetailContent.js +1 -715
  6. package/lib/commonjs/jotai/components/JotaiAtomValueDetailContent.js +1 -444
  7. package/lib/commonjs/jotai/components/JotaiEventFilterView.js +1 -43
  8. package/lib/commonjs/jotai/components/JotaiIcon.js +1 -18
  9. package/lib/commonjs/jotai/components/JotaiModal.js +1 -743
  10. package/lib/commonjs/jotai/hooks/useJotaiAtomChanges.js +1 -69
  11. package/lib/commonjs/jotai/sync/jotaiSyncAdapter.js +1 -306
  12. package/lib/commonjs/jotai/types/index.js +1 -1
  13. package/lib/commonjs/jotai/utils/jotaiStateStore.js +1 -321
  14. package/lib/commonjs/jotai/utils/snapshotProvider.js +1 -215
  15. package/lib/commonjs/jotai/utils/testIDs.js +1 -90
  16. package/lib/commonjs/jotai/utils/watchAtoms.js +1 -143
  17. package/lib/commonjs/jotai/utils/writeSemantics.js +1 -47
  18. package/lib/commonjs/preset.js +1 -90
  19. package/lib/module/index.js +1 -85
  20. package/lib/module/jotai/components/JotaiAtomBrowser.js +1 -195
  21. package/lib/module/jotai/components/JotaiAtomChangeItem.js +1 -91
  22. package/lib/module/jotai/components/JotaiAtomDetailContent.js +1 -710
  23. package/lib/module/jotai/components/JotaiAtomValueDetailContent.js +1 -442
  24. package/lib/module/jotai/components/JotaiEventFilterView.js +1 -39
  25. package/lib/module/jotai/components/JotaiIcon.js +1 -11
  26. package/lib/module/jotai/components/JotaiModal.js +1 -738
  27. package/lib/module/jotai/hooks/useJotaiAtomChanges.js +1 -65
  28. package/lib/module/jotai/sync/jotaiSyncAdapter.js +1 -303
  29. package/lib/module/jotai/types/index.js +1 -1
  30. package/lib/module/jotai/utils/jotaiStateStore.js +1 -317
  31. package/lib/module/jotai/utils/snapshotProvider.js +1 -214
  32. package/lib/module/jotai/utils/testIDs.js +1 -82
  33. package/lib/module/jotai/utils/watchAtoms.js +1 -138
  34. package/lib/module/jotai/utils/writeSemantics.js +1 -43
  35. package/lib/module/preset.js +1 -87
  36. package/lib/web/index.mjs +2 -3
  37. package/package.json +4 -7
  38. package/lib/typescript/index.d.ts.map +0 -1
  39. package/lib/typescript/jotai/components/JotaiAtomBrowser.d.ts.map +0 -1
  40. package/lib/typescript/jotai/components/JotaiAtomChangeItem.d.ts.map +0 -1
  41. package/lib/typescript/jotai/components/JotaiAtomDetailContent.d.ts.map +0 -1
  42. package/lib/typescript/jotai/components/JotaiAtomValueDetailContent.d.ts.map +0 -1
  43. package/lib/typescript/jotai/components/JotaiEventFilterView.d.ts.map +0 -1
  44. package/lib/typescript/jotai/components/JotaiIcon.d.ts.map +0 -1
  45. package/lib/typescript/jotai/components/JotaiModal.d.ts.map +0 -1
  46. package/lib/typescript/jotai/hooks/useJotaiAtomChanges.d.ts.map +0 -1
  47. package/lib/typescript/jotai/sync/jotaiSyncAdapter.d.ts.map +0 -1
  48. package/lib/typescript/jotai/types/index.d.ts.map +0 -1
  49. package/lib/typescript/jotai/utils/jotaiStateStore.d.ts.map +0 -1
  50. package/lib/typescript/jotai/utils/snapshotProvider.d.ts.map +0 -1
  51. package/lib/typescript/jotai/utils/testIDs.d.ts.map +0 -1
  52. package/lib/typescript/jotai/utils/watchAtoms.d.ts.map +0 -1
  53. package/lib/typescript/jotai/utils/writeSemantics.d.ts.map +0 -1
  54. package/lib/typescript/preset.d.ts.map +0 -1
@@ -1,138 +1 @@
1
- "use strict";
2
-
3
- import { getDefaultStore } from 'jotai/vanilla';
4
- /**
5
- * Buoy Jotai DevTools — Atom instrumentation
6
- *
7
- * watchAtoms() — RECOMMENDED. Pass a Jotai store and a named atom map.
8
- * Uses store.sub() to observe each atom externally. Never touches atom internals.
9
- *
10
- * watchDefaultStoreAtoms() — Convenience wrapper that uses getDefaultStore().
11
- */
12
-
13
- import { jotaiStateStore } from "./jotaiStateStore";
14
- import { classifyAtomWrite } from "./writeSemantics";
15
-
16
- /** Any Jotai atom — alias for Atom<unknown> for readability */
17
-
18
- /** Minimal store shape — what Jotai's createStore() / getDefaultStore() returns */
19
-
20
- /**
21
- * Watch a set of Jotai atoms for value changes.
22
- *
23
- * Pass a Jotai store and an object mapping display names to atoms.
24
- * Uses store.sub() to observe each atom — never modifies atom internals.
25
- *
26
- * @example
27
- * ```tsx
28
- * import { getDefaultStore } from 'jotai';
29
- * import { watchAtoms } from '@buoy-gg/jotai';
30
- * import { countAtom } from './atoms/count';
31
- * import { authAtom } from './atoms/auth';
32
- *
33
- * watchAtoms(getDefaultStore(), {
34
- * countAtom,
35
- * authAtom,
36
- * });
37
- * ```
38
- *
39
- * @param store - Jotai store (from createStore() or getDefaultStore())
40
- * @param atoms - Object mapping display labels to Jotai atoms
41
- * @param options - Optional configuration
42
- * @returns Cleanup function that removes all subscriptions
43
- */
44
- export function watchAtoms(store, atoms, options) {
45
- const enabled = options?.enabled !== false;
46
- const cleanups = [];
47
- for (const [label, atom] of Object.entries(atoms)) {
48
- // Skip if already watched under this label
49
- const atomAny = atom;
50
- const watchedKey = Symbol.for(`@@buoy-jotai/watched/${label}`);
51
- if (atomAny[watchedKey]) continue;
52
- atomAny[watchedKey] = true;
53
- let prevValue;
54
- try {
55
- prevValue = store.get(atom);
56
- } catch {
57
- prevValue = undefined;
58
- }
59
-
60
- // Register the atom for the browser view. A setter is captured only when
61
- // the store supports `set` AND the atom itself is writable (has a `write`
62
- // function — primitive atoms get a default one, read-only derived atoms
63
- // have none). Deriveds used to get a setter that threw inside jotai at
64
- // set time; now they're correctly reported as read-only up front.
65
- const isWritable = typeof atom.write === "function";
66
- const setter = store.set && isWritable ? value => {
67
- store.set(atom, value);
68
- } : undefined;
69
- jotaiStateStore.registerAtom(label, () => {
70
- try {
71
- return store.get(atom);
72
- } catch {
73
- return undefined;
74
- }
75
- }, setter,
76
- // "value" = jotai's shared defaultWrite (a primitive atom: store.set
77
- // stores the value). "action" = a custom write receiving the value as
78
- // its argument — still writable, but the editor says so.
79
- isWritable ? classifyAtomWrite(atom) : undefined);
80
-
81
- // Record initial value
82
- if (enabled) {
83
- jotaiStateStore.addAtomChange({
84
- atomLabel: label,
85
- prevValue: undefined,
86
- nextValue: prevValue,
87
- category: "initial"
88
- });
89
- }
90
-
91
- // Subscribe to future changes
92
- const unsubscribe = store.sub(atom, () => {
93
- try {
94
- const nextValue = store.get(atom);
95
- jotaiStateStore.addAtomChange({
96
- atomLabel: label,
97
- prevValue,
98
- nextValue,
99
- category: "write"
100
- });
101
- prevValue = nextValue;
102
- } catch {
103
- // Silently catch — our bug must never propagate into the store
104
- }
105
- });
106
- cleanups.push(() => {
107
- unsubscribe();
108
- delete atomAny[watchedKey];
109
- jotaiStateStore.unregisterAtom(label);
110
- });
111
- }
112
- return () => cleanups.forEach(fn => fn());
113
- }
114
-
115
- /**
116
- * Watch atoms using Jotai's default store (no Provider setup required).
117
- *
118
- * Convenience wrapper around watchAtoms() — auto-imports getDefaultStore.
119
- *
120
- * @example
121
- * ```tsx
122
- * import { watchDefaultStoreAtoms } from '@buoy-gg/jotai';
123
- * import { countAtom, authAtom } from './atoms';
124
- *
125
- * watchDefaultStoreAtoms({ countAtom, authAtom });
126
- * ```
127
- */
128
- export function watchDefaultStoreAtoms(atoms, options) {
129
- const store = getDefaultStore();
130
- return watchAtoms(store, atoms, options);
131
- }
132
-
133
- /**
134
- * Check if an atom label is currently being watched
135
- */
136
- export function isAtomWatched(label) {
137
- return jotaiStateStore.getAtom(label) !== undefined;
138
- }
1
+ "use strict";import{getDefaultStore as h}from"jotai/vanilla";import{jotaiStateStore as r}from"./jotaiStateStore";import{classifyAtomWrite as g}from"./writeSemantics";export function watchAtoms(t,c,i){const l=i?.enabled!==false;const f=[];for(const[n,e]of Object.entries(c)){const u=e;const s=Symbol.for(`@@buoy-jotai/watched/${n}`);if(u[s])continue;u[s]=true;let o;try{o=t.get(e)}catch{o=void 0}const d=typeof e.write==="function";const m=t.set&&d?a=>{t.set(e,a)}:void 0;r.registerAtom(n,()=>{try{return t.get(e)}catch{return void 0}},m,d?g(e):void 0);if(l){r.addAtomChange({atomLabel:n,prevValue:void 0,nextValue:o,category:"initial"})}const b=t.sub(e,()=>{try{const a=t.get(e);r.addAtomChange({atomLabel:n,prevValue:o,nextValue:a,category:"write"});o=a}catch{}});f.push(()=>{b();delete u[s];r.unregisterAtom(n)})}return()=>f.forEach(n=>n())}export function watchDefaultStoreAtoms(t,c){const i=h();return watchAtoms(i,t,c)}export function isAtomWatched(t){return r.getAtom(t)!==void 0}
@@ -1,43 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * What does `store.set(atom, x)` DO with x?
5
- *
6
- * jotai's `atom(initialValue)` gives every primitive atom the SAME shared
7
- * `defaultWrite` function (see jotai/src/vanilla/atom.ts): it stores x as the
8
- * atom's new value (or calls it with the previous value when x is a
9
- * function). Any other `write` is app code — `atomWithReducer` receives
10
- * ACTIONS, `atomWithStorage` persists as a side effect, a custom write can do
11
- * anything — so a raw value handed to `store.set` may not mean "set to this".
12
- *
13
- * The tool's editor needs that distinction to be honest: a "value" atom edits
14
- * like plain data; an "action" atom is still writable (the MCP `setAtom` and
15
- * Time Machine restore already write to them) but the editor says what the
16
- * write actually does.
17
- *
18
- * Detection: a probe primitive atom exposes this jotai instance's
19
- * `defaultWrite`; identity match is exact. The `toString` fallback covers an
20
- * app that somehow bundles a second jotai copy (its atoms carry a different —
21
- * but textually identical — defaultWrite instance). An unrecognized write
22
- * classifies as "action", which only makes the editor more cautious.
23
- */
24
-
25
- import { atom as probeAtom } from "jotai/vanilla";
26
- const probe = probeAtom(null);
27
- const DEFAULT_WRITE = probe.write;
28
- const DEFAULT_WRITE_SOURCE = typeof DEFAULT_WRITE === "function" ? String(DEFAULT_WRITE) : null;
29
-
30
- /** Classify a writable atom's write. Call only when `atom.write` exists. */
31
- export function classifyAtomWrite(candidate) {
32
- const atomLike = candidate;
33
- const write = atomLike?.write;
34
- if (typeof write !== "function") return "action";
35
- if (write === DEFAULT_WRITE) return "value";
36
- // Dual-copy fallback: a primitive atom from another jotai instance holds
37
- // its own value (`init` present) and its write's source is the library's
38
- // defaultWrite verbatim.
39
- if (atomLike !== null && "init" in atomLike && DEFAULT_WRITE_SOURCE !== null && String(write) === DEFAULT_WRITE_SOURCE) {
40
- return "value";
41
- }
42
- return "action";
43
- }
1
+ "use strict";import{atom as e}from"jotai/vanilla";const u=e(null);const i=u.write;const o=typeof i==="function"?String(i):null;export function classifyAtomWrite(r){const t=r;const n=t?.write;if(typeof n!=="function")return"action";if(n===i)return"value";if(t!==null&&"init"in t&&o!==null&&String(n)===o){return"value"}return"action"}
@@ -1,87 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Pre-configured Jotai DevTools preset for FloatingDevTools
5
- *
6
- * ZERO-CONFIG: This preset is auto-discovered by FloatingDevTools!
7
- * Just install @buoy-gg/jotai and call watchAtoms() with your atoms.
8
- *
9
- * @example Automatic (recommended)
10
- * ```tsx
11
- * import { getDefaultStore } from 'jotai';
12
- * import { watchAtoms } from '@buoy-gg/jotai';
13
- * import { countAtom, authAtom } from './atoms';
14
- *
15
- * watchAtoms(getDefaultStore(), { countAtom, authAtom });
16
- *
17
- * // The Jotai tool appears automatically in FloatingDevTools!
18
- * <FloatingDevTools />
19
- * ```
20
- *
21
- * @example Manual (only for custom configuration)
22
- * ```tsx
23
- * import { createJotaiTool } from '@buoy-gg/jotai';
24
- *
25
- * const customJotaiTool = createJotaiTool({
26
- * name: "ATOMS",
27
- * iconColor: "#6C47FF",
28
- * });
29
- *
30
- * <FloatingDevTools apps={[customJotaiTool]} />
31
- * ```
32
- */
33
-
34
- import { JotaiModal } from "./jotai/components/JotaiModal";
35
- import { JotaiIcon } from "./jotai/components/JotaiIcon";
36
- import { createToolFactory, defineToolPreset } from "@buoy-gg/shared-ui";
37
-
38
- /**
39
- * Pre-configured Jotai DevTools preset for FloatingDevTools.
40
- * Includes:
41
- * - Live atom change monitoring
42
- * - Atom value inspection (JSON viewer)
43
- * - Value diff visualization (tree + split)
44
- * - Filter by atom label
45
- * - Changed keys tracking for object atoms
46
- */
47
- import { jsx as _jsx } from "react/jsx-runtime";
48
- export const jotaiToolPreset = defineToolPreset({
49
- id: "jotai",
50
- name: "JOTAI",
51
- description: "Jotai atom & state inspector",
52
- slot: "both",
53
- icon: ({
54
- size
55
- }) => /*#__PURE__*/_jsx(JotaiIcon, {
56
- size: size
57
- }),
58
- component: JotaiModal,
59
- props: {
60
- enableSharedModalDimensions: false
61
- }
62
- });
63
-
64
- /**
65
- * Create a custom Jotai DevTools configuration.
66
- * Use this if you want to override default settings.
67
- *
68
- * @example
69
- * ```tsx
70
- * import { createJotaiTool } from '@buoy-gg/jotai';
71
- *
72
- * const myJotaiTool = createJotaiTool({
73
- * name: "ATOMS",
74
- * iconColor: "#6C47FF",
75
- * });
76
- * ```
77
- */
78
- export const createJotaiTool = createToolFactory(jotaiToolPreset, options => ({
79
- enableSharedModalDimensions: options.enableSharedModalDimensions ?? false
80
- }), options => ({
81
- icon: ({
82
- size
83
- }) => /*#__PURE__*/_jsx(JotaiIcon, {
84
- size: size,
85
- color: options.iconColor
86
- })
87
- }));
1
+ "use strict";import{JotaiModal as a}from"./jotai/components/JotaiModal";import{JotaiIcon as e}from"./jotai/components/JotaiIcon";import{createToolFactory as r,defineToolPreset as s}from"@buoy-gg/shared-ui";import{jsx as t}from"react/jsx-runtime";export const jotaiToolPreset=s({id:"jotai",name:"JOTAI",description:"Jotai atom & state inspector",slot:"both",icon:({size:o})=>t(e,{size:o}),component:a,props:{enableSharedModalDimensions:false}});export const createJotaiTool=r(jotaiToolPreset,o=>({enableSharedModalDimensions:o.enableSharedModalDimensions??false}),o=>({icon:({size:i})=>t(e,{size:i,color:o.iconColor})}));
package/lib/web/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- "use client";
2
- var yt=Object.defineProperty;var po=Object.getOwnPropertyDescriptor;var ho=Object.getOwnPropertyNames;var yo=Object.prototype.hasOwnProperty;var bo=(e,o)=>{for(var t in o)yt(e,t,{get:o[t],enumerable:!0})},ht=(e,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of ho(o))!yo.call(e,n)&&n!==t&&yt(e,n,{get:()=>o[n],enumerable:!(a=po(o,n))||a.enumerable});return e},D=(e,o,t)=>(ht(e,o,"default"),t&&ht(t,o,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{createRestoreScope as So,emptyRestoreResult as Io,failedRestore as Do,registerStateSnapshotProvider as ko,unionKeys as Jo}from"@buoy-gg/shared-ui/web";import{boundedDeepEqual as Lo}from"@buoy-gg/shared-ui/web/dataViewer";import{ChangeLog as wo,entityColor as Co,formatValuePreview as Ao,shallowDiffSummary as xo}from"@buoy-gg/shared-ui/web";var To={count:"#10B981",auth:"#8B5CF6",user:"#3B82F6",cart:"#EC4899",app:"#6366F1",ui:"#F59E0B",settings:"#14B8A6",theme:"#06B6D4",nav:"#F97316",form:"#EF4444",modal:"#A855F7",filter:"#84CC16"};function bt(e){return Co(e,To)}function Vo(e,o=40){return Ao(e,{maxLength:o,functionLabel:"(fn)"})}var vo=xo,Oe=class extends wo{constructor(){super(...arguments);this.atoms=new Map;this.atomListeners=new Set}addAtomChange(t){if(!this.canRecord())return;let{atomLabel:a,prevValue:n,nextValue:i,category:l="write"}=t,r=n!==i,{summary:c,changedKeys:m,changedCount:h}=vo(n,i),J=Vo(i),A={id:this.nextId(),atomLabel:a,timestamp:Date.now(),prevValue:n,nextValue:i,hasValueChange:r,category:l,changedKeys:m,changedKeysCount:h,diffSummary:c,valuePreview:J,isSlowUpdate:!1};this.push(A);let w=this.atoms.get(a);w&&w.changeCount++,this.notifyListeners(),this.notifyAtomListeners()}getAtomChanges(){return this.getAll()}getAtomChangeById(t){return this.getById(t)}clearAtomChanges(){for(let t of this.atoms.values())t.changeCount=0;this.clear(),this.notifyAtomListeners()}getAtomSnapshots(){return Array.from(this.atoms.values()).map(t=>{let a;try{a=t.getValue()}catch{a=void 0}return{label:t.label,changeCount:t.changeCount,color:t.color,currentValue:a,writeKind:t.writeKind}})}replaceFromSnapshot(t,a){if(!this.getEnabled())return;let n=new Map;for(let r of this.items){let c=r.prevValue;(!c||c.__buoyValueOnDevice!==!0)&&n.set(r.id,r)}let i=t.slice(0,this.max).map(r=>{let c=n.get(r.id),m=r.prevValue;return c&&m?.__buoyValueOnDevice===!0?{...r,prevValue:c.prevValue,nextValue:c.nextValue}:r}),l=new Map;for(let[r,c]of this.atoms)try{let m=c.getValue(),h=m;(!h||h.__buoyValueOnDevice!==!0)&&l.set(r,m)}catch{}this.atoms=new Map(a.map(r=>{let c=r.currentValue,m=l.get(r.label),h=m!==void 0&&c?.__buoyValueOnDevice===!0?m:r.currentValue;return[r.label,{label:r.label,changeCount:r.changeCount,color:r.color,getValue:()=>h,writeKind:r.writeKind}]})),this.setItems(i),this.notifyAtomListeners()}hydrateChange(t,a){this.hydrateById(t,a)}hydrateAtomValue(t,a){let n=this.atoms.get(t);n&&(this.atoms.set(t,{...n,getValue:()=>a}),this.notifyAtomListeners())}registerAtom(t,a,n,i){if(this.atoms.has(t))return;let l={label:t,changeCount:0,color:bt(t),getValue:a,setValue:n,writeKind:i};this.atoms.set(t,l),this.notifyAtomListeners()}setAtomValue(t,a){let n=this.atoms.get(t);if(!n)throw new Error(`Atom "${t}" is not registered`);if(!n.setValue)throw new Error(`Atom "${t}" is read-only (derived) \u2014 cannot set`);n.setValue(a)}unregisterAtom(t){this.atoms.delete(t),this.notifyAtomListeners()}getAtoms(){return Array.from(this.atoms.values())}getAtom(t){return this.atoms.get(t)}getAtomColor(t){return this.atoms.get(t)?.color??bt(t)}filterAtomChanges(t){let a=this.getAll();if(t.searchText){let n=t.searchText.toLowerCase();a=a.filter(i=>i.atomLabel.toLowerCase().includes(n)||i.valuePreview.toLowerCase().includes(n)||i.changedKeys.some(l=>l.toLowerCase().includes(n)))}return t.atomLabels&&t.atomLabels.length>0&&(a=a.filter(n=>t.atomLabels.includes(n.atomLabel))),t.onlyWithChanges&&(a=a.filter(n=>n.hasValueChange)),a}getStats(){let t=this.items.length,a=this.items.filter(n=>n.hasValueChange).length;return{totalChanges:t,changesWithValueChange:a,changesWithoutValueChange:t-a,atomCount:this.atoms.size}}getUniqueAtomLabels(){return Array.from(this.atoms.keys()).sort()}setMaxChanges(t){this.setMax(t)}subscribeToAtoms(t){return this.atomListeners.add(t),()=>this.atomListeners.delete(t)}notifyAtomListeners(){let t=this.getAtoms();this.atomListeners.forEach(a=>a(t))}},f=new Oe;function Bo(){let e=f.getAtoms();if(e.length===0)return{canCapture:!1,canRestore:!1,detail:"No Jotai atoms registered \u2014 pass your atoms to watchAtoms() / watchDefaultStoreAtoms()"};let o=e.filter(t=>t.setValue).length;return{canCapture:!0,canRestore:o>0,detail:o<e.length?`${e.length-o} derived atom(s) recompute automatically and are not restored`:void 0}}async function Po(){let e=[],o={},t=0;for(let a of f.getAtoms())try{let n=a.getValue();if(typeof n=="function"){e.push(`atom "${a.label}": function value not capturable`);continue}a.setValue||(t+=1),o[a.label]={value:n,writable:!!a.setValue}}catch(n){e.push(`atom "${a.label}": capture failed (${String(n)})`)}return t>0&&e.push(`${t} derived atom(s) captured for inspection only (recompute on restore)`),{data:{atoms:o},warnings:e}}async function Eo(e,o){let t=e,a=So(o),n=Io();if(!t?.atoms)return Do("empty jotai snapshot");let i=0;for(let[r,c]of Object.entries(t.atoms)){if(!a.allows(r))continue;if(!c.writable){i+=1;continue}let m=f.getAtom(r);if(!m){n.skipped.push({id:r,reason:"atom not registered (renamed, or unwatched since snapshot?)"});continue}if(!m.setValue){n.skipped.push({id:r,reason:"atom is now read-only (derived)"});continue}try{m.setValue(c.value),n.applied+=1}catch(h){n.skipped.push({id:r,reason:String(h)}),n.ok=!1}}i>0&&n.warnings.push(`${i} derived atom(s) left to recompute`);let l=a.excludedWarning("atom(s)");return l&&n.warnings.push(l),n}async function Ro(e,o){let t=e?.atoms??{},a=o===void 0,n={};if(a)for(let r of f.getAtoms())try{n[r.label]={value:r.getValue(),writable:!!r.setValue}}catch{}else Object.assign(n,o?.atoms??{});let i=[],l=[];for(let r of Jo(n,t)){if(!(r in t)){a?l.push(`atom "${r}" not in snapshot \u2014 untouched`):i.push({key:r,label:r,verdict:"removed",oldValue:n[r]?.value});continue}let m=t[r],h=r in n&&Lo(n[r].value,m.value);if(!m.writable){i.push({key:r,label:r,verdict:h?"unchanged":"recomputes",reason:h?void 0:"derived atom \u2014 recomputes from its sources",oldValue:n[r]?.value,newValue:m.value});continue}if(a){let J=f.getAtom(r);if(!J){i.push({key:r,label:r,verdict:"wont-apply",reason:"atom not registered (renamed, or unwatched since snapshot?)"});continue}if(!J.setValue){i.push({key:r,label:r,verdict:"wont-apply",reason:"atom is now read-only (derived)"});continue}}r in n?h?i.push({key:r,label:r,verdict:"unchanged"}):i.push({key:r,label:r,verdict:"changed",oldValue:n[r].value,newValue:m.value}):i.push({key:r,label:r,verdict:"added",newValue:m.value})}return{items:i,notes:l}}ko({id:"jotai",label:"Jotai",status:Bo,capture:Po,restore:Eo,previewItems:Ro});import{useState as Z,useMemo as ne,useRef as Le,useCallback as P,useEffect as Bt}from"react";var T={};bo(T,{AccessibilityInfo:()=>Yo,ActivityIndicator:()=>No,Alert:()=>Uo,Animated:()=>Xo,AppRegistry:()=>Qo,AppState:()=>en,Appearance:()=>Zo,BackHandler:()=>tn,Button:()=>jo,CheckBox:()=>bn,Clipboard:()=>on,DeviceEventEmitter:()=>Pn,Dimensions:()=>nn,Easing:()=>an,FlatList:()=>Ie,I18nManager:()=>rn,Image:()=>wn,ImageBackground:()=>Cn,InteractionManager:()=>ln,Keyboard:()=>sn,KeyboardAvoidingView:()=>An,LayoutAnimation:()=>cn,Linking:()=>dn,LogBox:()=>Bn,Modal:()=>zo,NativeEventEmitter:()=>un,NativeModules:()=>qo,PanResponder:()=>mn,Picker:()=>xn,PixelRatio:()=>gn,Platform:()=>fn,Pressable:()=>Ho,ProgressBar:()=>Tn,RefreshControl:()=>Vn,SafeAreaView:()=>vn,ScrollView:()=>oe,SectionList:()=>Sn,Share:()=>pn,StatusBar:()=>In,StyleSheet:()=>G,Switch:()=>_o,Text:()=>y,TextInput:()=>Mo,Touchable:()=>Dn,TouchableHighlight:()=>Oo,TouchableNativeFeedback:()=>kn,TouchableOpacity:()=>te,TouchableWithoutFeedback:()=>Fo,UIManager:()=>hn,Vibration:()=>yn,View:()=>d,VirtualizedList:()=>Jn,YellowBox:()=>Ln,findNodeHandle:()=>Ko,unstable_createElement:()=>Go,useColorScheme:()=>En,useLocaleContext:()=>Rn,useWindowDimensions:()=>$n});D(T,jr);import*as jr from"react-native-web";import{unstable_createElement as Go,NativeModules as qo,AccessibilityInfo as Yo,Animated as Xo,Appearance as Zo,AppRegistry as Qo,AppState as en,BackHandler as tn,Clipboard as on,Dimensions as nn,Easing as an,I18nManager as rn,Keyboard as sn,InteractionManager as ln,LayoutAnimation as cn,Linking as dn,NativeEventEmitter as un,PanResponder as mn,PixelRatio as gn,Platform as fn,Share as pn,StyleSheet as G,UIManager as hn,Vibration as yn,CheckBox as bn,FlatList as Ie,Image as wn,ImageBackground as Cn,KeyboardAvoidingView as An,Picker as xn,ProgressBar as Tn,RefreshControl as Vn,SafeAreaView as vn,SectionList as Sn,StatusBar as In,Touchable as Dn,TouchableNativeFeedback as kn,VirtualizedList as Jn,YellowBox as Ln,LogBox as Bn,DeviceEventEmitter as Pn,useColorScheme as En,useLocaleContext as Rn,useWindowDimensions as $n}from"react-native-web";import*as x from"react-native-web";import{createElement as $o,forwardRef as Wo}from"react";function N(e){let o=Wo((a,n)=>{let{accessibilityState:i,accessibilityValue:l,...r}=a;for(let c of["busy","checked","disabled","expanded","selected"])i?.[c]!==void 0&&r[`aria-${c}`]===void 0&&(r[`aria-${c}`]=i[c]);for(let[c,m]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))l?.[c]!==void 0&&r[`aria-${m}`]===void 0&&(r[`aria-${m}`]=l[c]);return $o(e,{...r,ref:n})}),t=e.State;return t&&Object.assign(o,{State:t}),o.displayName=e.displayName??e.name??"NativeWebView",o}var d=N(x.View),y=N(x.Text),Mo=N(x.TextInput),te=N(x.TouchableOpacity),Oo=N(x.TouchableHighlight),Fo=N(x.TouchableWithoutFeedback),Ho=N(x.Pressable),oe=N(x.ScrollView),zo=N(x.Modal),_o=N(x.Switch),No=N(x.ActivityIndicator),jo=N(x.Button),Ko=x.findNodeHandle,Uo={alert(e,o,t,a){if(typeof document>"u")return;let n=document.createElement("dialog");n.dataset.buoyRoot="",n.setAttribute("aria-label",e),n.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let i=document.createElement("h2");if(i.textContent=e,i.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(i),o){let m=document.createElement("p");m.textContent=o,m.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(m)}let l=document.createElement("div");l.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let r=t?.length?t:[{text:"OK"}],c=()=>{n.close?.(),n.remove()};for(let m of r){let h=document.createElement("button");h.type="button",h.textContent=m.text??"OK",h.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${m.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,h.onclick=()=>{c(),m.onPress?.()},l.appendChild(h)}n.addEventListener("cancel",m=>{m.preventDefault(),a?.cancelable!==!1&&(c(),a?.onDismiss?.())}),n.appendChild(l),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}};import{JsModal as Na,ModalHeader as E,TabSelector as ja,macOSColors as Ka,night as $,Search as Ua,Filter as Ga,Power as qa,ToolEmptyState as et,resolveListEmptyState as $t,devToolsStorageKeys as Ya,ProUpgradeModal as Xa,PowerToggleButton as Za,ToolbarCopyButton as Qe,ToolbarClearButton as Qa,truncatePayload as Ae,TickProvider as Pt,useLimit as er,windowDragProps as tr,EVENT_LIST_PRESET as Et}from"@buoy-gg/shared-ui/web";import{useIsPro as or}from"@buoy-gg/license/web";import{useCallback as Wn,useMemo as wt}from"react";import{useChangeLog as Mn,useSubscribedValue as On}from"@buoy-gg/shared-ui/web";function Fn(e,o){let t=e;if(o.searchText){let a=o.searchText.toLowerCase();t=t.filter(n=>n.atomLabel.toLowerCase().includes(a)||n.valuePreview.toLowerCase().includes(a)||n.changedKeys.some(i=>i.toLowerCase().includes(a)))}return o.atomLabels&&o.atomLabels.length>0&&(t=t.filter(a=>o.atomLabels.includes(a.atomLabel))),o.onlyWithChanges&&(t=t.filter(a=>a.hasValueChange)),t}var Hn=()=>f.getAtoms(),zn=e=>f.subscribeToAtoms(e);function Fe(){let e=Mn(f,{filterItems:Fn}),o=On(Hn,zn),t=wt(()=>{let i=e.items.length,l=e.items.filter(r=>r.hasValueChange).length;return{totalChanges:i,changesWithValueChange:l,changesWithoutValueChange:i-l,atomCount:o.length}},[e.items,o]),a=wt(()=>f.getUniqueAtomLabels(),[o]),n=Wn(i=>f.getAtomChangeById(i),[]);return{atomChanges:e.items,filteredChanges:e.filteredItems,filter:e.filter,setFilter:e.setFilter,stats:t,atoms:o,clearChanges:f.clearAtomChanges.bind(f),isEnabled:e.isEnabled,toggleCapture:e.toggleCapture,atomLabels:a,getChangeById:n}}import{memo as _n}from"react";import{ChangeRow as Nn,night as jn}from"@buoy-gg/shared-ui/web";import{jsx as Xn}from"react/jsx-runtime";function Kn(e,o){return o}function Un(e,o){return e==="initial"?jn.color.textTertiary:f.getAtomColor(o)}function He(e,o=20){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="boolean"||typeof e=="number")return String(e);if(typeof e=="string")return`"${e.length>o?e.slice(0,o-1)+"\u2026":e}"`;if(Array.isArray(e))return e.length===0?"[]":`[${e.length} item${e.length===1?"":"s"}]`;if(typeof e=="object"){let t=Object.keys(e);return t.length===0?"{}":`{${t.slice(0,2).join(", ")}${t.length>2?"\u2026":""}}`}return String(e).slice(0,o)}function Gn(e){return e.hasValueChange?`${He(e.prevValue)} \u2192 ${He(e.nextValue)}`:"no change"}function qn(e){return e.category==="initial"?"INIT":"WRITE"}function Yn(e){let o=e.nextValue;return typeof o=="object"&&o!==null&&!Array.isArray(o)?e.changedKeys.length>0&&e.changedKeys.length<=3?e.changedKeys.join(", "):e.changedKeys.length>3?`${e.changedKeys.slice(0,2).join(", ")} +${e.changedKeys.length-2}`:e.valuePreview||"atom()":He(o)}var ze=_n(function({change:o,onPress:t,testID:a}){let n=Un(o.category,o.atomLabel),i=Kn(o.category,o.atomLabel),l=Gn(o),r=Yn(o),c=qn(o);return Xn(Nn,{statusColor:n,statusLabel:i,sublabel:l,primaryText:r,timestamp:o.timestamp,badgeText:c,changed:o.hasValueChange,onPress:()=>t(o),testID:a})});import{memo as Qn,useState as _e,useCallback as be,useMemo as At}from"react";import{buoyColors as we,night as C,EventStepperFooter as vt,formatRelativeTime as Je,parseValue as ke,Info as ea,Zap as xt,FileText as ta,Database as oa,GitBranch as na,copyToClipboard as aa,ProUpgradeModal as ra,DiffModeTabs as ia,CompareBar as sa,DetailViewToggle as la,monoFont as q}from"@buoy-gg/shared-ui/web";import{DataViewer as ca,SplitDiffViewer as da,TreeDiffViewer as ua,diffThemes as ma}from"@buoy-gg/shared-ui/web/dataViewer";import{useIsPro as ga}from"@buoy-gg/license/web";var u="buoy-jotai";function de(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function Zn(e,o){return`${u}-row-${de(e)}-${o}`}function De(e){return`${u}-atom-${de(e)}`}function Ct(e){let o=new Map,t=new Map;for(let a of e){let n=(o.get(a.atomLabel)??0)+1;o.set(a.atomLabel,n),t.set(a.id,Zn(a.atomLabel,n))}return t}import{jsx as g,jsxs as M}from"react/jsx-runtime";var fa=[{key:"change",label:"CHANGE",icon:ta},{key:"value",label:"VALUE",icon:oa},{key:"diff",label:"DIFF",icon:na}],pa=["diff"];function ha(e){switch(e){case"initial":return{label:"INITIAL",color:C.color.textTertiary,bgColor:C.color.textTertiary+"26"};default:return{label:"WRITE",color:we.success,bgColor:we.success+"26"}}}function ya(e){let o=new Date(e),t=o.getHours().toString().padStart(2,"0"),a=o.getMinutes().toString().padStart(2,"0"),n=o.getSeconds().toString().padStart(2,"0"),i=o.getMilliseconds().toString().padStart(3,"0");return`${t}:${a}:${n}.${i}`}function Tt(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function ba(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}function Vt(e){return e==="initial"?"INIT":"WRITE"}var wa=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}],Ca=Qn(function({change:o}){let t=ga(),[a,n]=_e(!1),i=ha(o.category),l=f.getAtomColor(o.atomLabel),r=be(async()=>{if(!t){n(!0);return}await aa(o.nextValue)},[o.nextValue,t]);return M(oe,{style:b.container,contentContainerStyle:b.content,showsVerticalScrollIndicator:!1,testID:`${u}-detail-scroll`,children:[M(d,{style:b.card,testID:`${u}-info-card`,children:[g(d,{style:b.sectionHeader,children:M(d,{style:b.sectionHeaderLeft,children:[g(ea,{size:14,color:C.color.accent}),g(y,{style:b.sectionTitle,children:"CHANGE INFO"})]})}),M(d,{style:b.cardContent,children:[M(d,{style:b.infoRow,children:[g(y,{style:b.infoLabel,children:"Atom"}),g(y,{style:[b.infoValue,b.infoValueMono,{color:l}],numberOfLines:1,ellipsizeMode:"middle",testID:`${u}-info-atom`,children:o.atomLabel})]}),M(d,{style:b.infoRow,children:[g(y,{style:b.infoLabel,children:"Time"}),g(y,{style:[b.infoValue,b.infoValueMono],testID:`${u}-info-time`,children:ya(o.timestamp)})]}),M(d,{style:b.badgeRow,children:[g(d,{style:[b.categoryBadge,{backgroundColor:i.bgColor}],children:g(y,{style:[b.categoryText,{color:i.color}],testID:`${u}-info-category`,children:i.label})}),o.hasValueChange?M(d,{style:b.changesBadge,children:[g(xt,{size:10,color:we.success}),g(y,{style:b.changesText,testID:`${u}-info-changes`,children:o.diffSummary||"changed"})]}):g(d,{style:b.noChangesBadge,children:g(y,{style:b.noChangesText,testID:`${u}-info-no-changes`,children:"no change"})})]})]})]}),o.changedKeys.length>0&&M(d,{style:b.card,testID:`${u}-keys-card`,children:[M(d,{style:b.sectionHeader,children:[M(d,{style:b.sectionHeaderLeft,children:[g(xt,{size:14,color:C.color.accent}),g(y,{style:b.sectionTitle,children:"CHANGED KEYS"})]}),g(d,{style:b.countBadge,children:g(y,{style:b.countText,testID:`${u}-keys-count`,children:o.changedKeys.length})})]}),g(d,{style:b.cardContent,children:g(d,{style:b.keysContainer,children:o.changedKeys.map(c=>g(d,{style:b.keyBadge,children:g(y,{style:b.keyText,testID:`${u}-key-${de(c)}`,children:c})},c))})})]}),g(d,{style:b.actionsRow,children:g(d,{style:[b.actionButton,b.actionButtonCopy],onTouchEnd:r,testID:`${u}-copy-value`,accessibilityRole:"button",accessibilityLabel:"Copy value",children:g(y,{style:[b.actionButtonText,{color:C.color.accent}],children:"COPY VALUE"})})}),g(ra,{visible:a,onClose:()=>n(!1),featureName:"Copy"})]})});function Ne({change:e,changes:o,selectedIndex:t,onIndexChange:a,disableInternalFooter:n=!1,initialView:i="change"}){let[l,r]=_e(i),[c,m]=_e("tree"),h=o.length,J=f.getAtomColor(e.atomLabel),A=Vt(e.category),w=ba(ke(e.nextValue)),I=h-t,k=t<h-1?t+1:null,z=k!==null?o[k]:null,O=I-1,ue=At(()=>({index:k??0,label:O>0?`#${O}`:"Initial",timestamp:z?Tt(z.timestamp):"",relativeTime:z?Je(new Date(z.timestamp)):"value",badge:z?g(d,{style:[B.changeBadgeSmall,{backgroundColor:`${f.getAtomColor(z.atomLabel)}20`}],children:g(y,{style:[B.changeTextSmall,{color:f.getAtomColor(z.atomLabel)}],children:Vt(z.category)})}):void 0}),[k,z,O]),ae=At(()=>({index:t,label:`#${I}`,timestamp:Tt(e.timestamp),relativeTime:Je(new Date(e.timestamp)),badge:g(d,{style:[B.changeBadgeSmall,{backgroundColor:`${J}20`}],children:g(y,{style:[B.changeTextSmall,{color:J}],children:A})})}),[t,e.timestamp,J,A,I]),xe=be(()=>{let Q=ke(e.nextValue);return M(d,{style:B.contentCard,testID:`${u}-value-card`,children:[M(d,{style:B.valueHeader,children:[g(y,{style:B.valueLabel,children:"VALUE AFTER CHANGE"}),M(d,{style:B.valueHeaderBadges,children:[g(d,{style:[B.changeBadge,{backgroundColor:`${J}20`}],children:g(y,{style:[B.changeText,{color:J}],children:A})}),g(d,{style:B.typeBadge,children:g(y,{style:B.typeText,testID:`${u}-value-type`,children:w.toUpperCase()})})]})]}),g(d,{style:b.dataViewerContainer,children:g(ca,{title:"",data:Q,showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})},[e.nextValue,J,A,w]),me=be(()=>{let Q=ke(e.prevValue),Ve=ke(e.nextValue);return c==="split"?g(oe,{style:{flex:1},showsVerticalScrollIndicator:!0,children:g(da,{oldValue:Q,newValue:Ve,theme:ma.devToolsDefault,options:{hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3},showThemeName:!1})}):g(ua,{oldValue:Q,newValue:Ve})},[e.prevValue,e.nextValue,c]),ge=be(()=>{a(Math.min(h-1,t+1))},[t,h,a]),K=be(()=>{a(Math.max(0,t-1))},[t,a]),Te=e.prevValue===void 0,fe=!n&&h>1;return M(d,{style:B.container,children:[g(la,{views:fa,activeView:l,onViewChange:r,disabledKeys:Te?pa:void 0,testIDPrefix:u}),M(d,{style:[B.contentArea,fe&&B.contentAreaFooterPad],children:[l==="change"&&g(Ca,{change:e}),l==="value"&&g(d,{style:B.stateContainer,children:xe()}),l==="diff"&&M(d,{style:B.diffContainer,testID:`${u}-diff`,children:[g(ia,{tabs:wa,activeTab:c,onTabChange:m,testIDPrefix:`${u}-diff-tab`}),g(sa,{leftEvent:ue,rightEvent:ae}),g(d,{style:B.diffContent,testID:`${u}-diff-content`,children:me()})]})]}),fe&&g(vt,{currentIndex:I-1,totalItems:h,onPrevious:ge,onNext:K,itemLabel:"Change",subtitle:Je(new Date(e.timestamp)),absolute:!0})]})}function je({change:e,changes:o,selectedIndex:t,onIndexChange:a}){let n=o.length;if(n<=1)return null;let i=n-t;return g(vt,{currentIndex:i-1,totalItems:n,onPrevious:()=>a(Math.min(n-1,t+1)),onNext:()=>a(Math.max(0,t-1)),itemLabel:"Change",subtitle:Je(new Date(e.timestamp))})}var B=G.create({container:{flex:1,backgroundColor:"transparent"},contentArea:{flex:1},contentAreaFooterPad:{paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:C.color.surface,borderRadius:14,padding:14,borderWidth:1,borderColor:C.color.border},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:C.color.textSecondary,fontFamily:q,letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},changeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},changeText:{fontSize:9,fontWeight:"700",fontFamily:q,letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:C.color.surfaceElevated},typeText:{fontSize:9,fontWeight:"600",color:C.color.textTertiary,fontFamily:q},valueBox:{backgroundColor:C.color.bg,borderRadius:6,borderWidth:1,borderColor:C.color.border,padding:8},valueText:{fontSize:12,color:C.color.text,fontFamily:q,lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},changeBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},changeTextSmall:{fontSize:8,fontWeight:"700",fontFamily:q}}),b=G.create({container:{flex:1},content:{padding:8,paddingBottom:100,gap:16},card:{backgroundColor:C.color.surface,borderRadius:6,borderWidth:1,borderColor:C.color.accentBorderStrong,overflow:"hidden",shadowColor:C.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:C.color.accentBorder,backgroundColor:C.color.accentSoft},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:6},sectionTitle:{fontSize:12,fontWeight:"600",letterSpacing:.5,color:C.color.accent,fontFamily:q},cardContent:{padding:14,gap:10},infoRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},infoLabel:{fontSize:11,color:C.color.textTertiary,fontWeight:"500"},infoValue:{fontSize:11,color:C.color.text,fontWeight:"500",flex:1,textAlign:"right",marginLeft:12},infoValueMono:{fontFamily:q},badgeRow:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},categoryBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4},categoryText:{fontSize:9,fontWeight:"700",letterSpacing:.3},changesBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:we.success+"26"},changesText:{fontSize:9,fontWeight:"600",color:we.success},noChangesBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:C.color.surfaceElevated},noChangesText:{fontSize:9,fontWeight:"600",color:C.color.textTertiary},keysContainer:{flexDirection:"row",flexWrap:"wrap",gap:6},keyBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4,backgroundColor:C.color.accentSoft,borderWidth:1,borderColor:C.color.accentBorder},keyText:{fontSize:11,fontWeight:"600",color:C.color.accent,fontFamily:q},countBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:C.color.accentFill},countText:{fontSize:9,fontWeight:"700",color:C.color.accent,fontFamily:q},actionsRow:{flexDirection:"row",gap:12},actionButton:{paddingHorizontal:14,paddingVertical:8,borderRadius:8,borderWidth:1},actionButtonCopy:{borderColor:C.color.accentBorder,backgroundColor:C.color.accentSoft},actionButtonText:{fontSize:10,fontWeight:"700",fontFamily:q,letterSpacing:.3},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12}});import{useMemo as Aa}from"react";import{CompactRow as xa,night as Ke,ToolEmptyState as It,resolveListEmptyState as Ta,monoFont as St}from"@buoy-gg/shared-ui/web";import{jsx as X,jsxs as Ue}from"react/jsx-runtime";function Va(e){try{let o=e.getValue();if(o&&typeof o=="object"&&o.__buoyValueOnDevice===!0)return"on device";if(o===void 0)return"undefined";if(o===null)return"null";if(Array.isArray(o))return o.length===0?"[]":`[${o.length} item${o.length===1?"":"s"}]`;if(typeof o=="object"){let t=Object.keys(o);return t.length===0?"{}":t.length<=3?t.join(", "):`${t.slice(0,2).join(", ")} +${t.length-2}`}return String(o).slice(0,40)}catch{return""}}function va(e){return e.writeKind==="value"?"primitive":e.writeKind==="action"?"custom write":e.setValue?"writable":"derived"}function Sa(){return X(It,{testID:`${u}-atoms-empty`,otto:"scanning",title:"No atoms registered",message:`Use watchAtoms(store, { atomName }) to register your Jotai atoms.
3
- They will appear here with their current value.`})}function Dt({atoms:e,searchQuery:o,onOpenAtom:t}){let a=Aa(()=>{if(!o)return e;let n=o.toLowerCase();return e.filter(i=>i.label.toLowerCase().includes(n))},[e,o]);return a.length===0&&!o?X(Sa,{}):a.length===0&&o?X(It,{testID:`${u}-atoms-no-match`,...Ta({subject:"atoms",verb:"registered",search:o,total:e.length,waiting:{otto:"scanning",title:"No atoms registered",message:"Use watchAtoms() to register your Jotai atoms."}})}):Ue(oe,{style:Y.container,contentContainerStyle:Y.scrollContent,showsVerticalScrollIndicator:!0,testID:`${u}-atoms-scroll`,children:[Ue(d,{style:Y.sectionHeader,children:[X(y,{style:Y.sectionTitle,children:"ATOMS"}),X(d,{style:Y.sectionCountBadge,children:X(y,{style:Y.sectionCountText,testID:`${u}-atoms-count`,children:a.length})})]}),a.map(n=>{let i=Va(n),l=f.getAtomColor(n.label),r=De(n.label);return Ue(d,{style:Y.atomRowWrapper,children:[X(xa,{statusDotColor:l,statusLabel:va(n),primaryText:n.label,secondaryText:i||void 0,showChevron:!0,onPress:()=>t(n.label),testID:r,statusTestID:`${r}-kind`,primaryTestID:`${r}-name`,secondaryTestID:`${r}-preview`}),n.changeCount>0&&X(d,{style:[Y.absCountBadge,{backgroundColor:l+"22",borderColor:l+"55"}],pointerEvents:"none",children:X(y,{style:[Y.absCountText,{color:l}],testID:`${r}-count`,children:String(n.changeCount)})})]},n.label)})]})}var Y=G.create({container:{flex:1},atomRowWrapper:{position:"relative"},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountText:{fontSize:9,fontWeight:"700",fontFamily:St},scrollContent:{paddingTop:8,paddingBottom:20},sectionHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:8,gap:8},sectionTitle:{fontSize:11,fontWeight:"700",letterSpacing:.5,color:Ke.color.textTertiary},sectionCountBadge:{backgroundColor:Ke.color.accentFill,paddingHorizontal:8,paddingVertical:2,borderRadius:4},sectionCountText:{fontSize:10,fontWeight:"700",color:Ke.color.accent,fontFamily:St}});import{useCallback as Ia,useEffect as Da,useMemo as Ge,useState as kt}from"react";import{buoyColors as qe,ExpandedInfoRow as Ye,FileJson as ka,night as L,PillBadge as Xe,parseValue as Jt,monoFont as Ce}from"@buoy-gg/shared-ui/web";import{DataViewer as Ja,LiveExplorer as La,ValueEditModal as Ba,updateNestedDataByPath as Pa,deleteNestedDataByPath as Ea}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as Oa,jsx as S,jsxs as j}from"react/jsx-runtime";var Ra=300,se=`${u}-atom-detail`;function $a(e){let o=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e.length===0?`${se}-explorer-root`:`${se}-explorer-${e.map(o).filter(Boolean).join("-")}`}function Wa(e,o){if(!e.setValue)return"Derived atom \u2014 its value recomputes from other atoms and has no setter. Edit the atoms it reads from instead.";if(typeof o=="function")return"This atom holds a function \u2014 nothing here to edit as data.";if(o&&typeof o=="object"&&o.__buoyValueOnDevice===!0)return"The value stayed on the device (too large for the wire) \u2014 open the tool on-device to edit it.";if(o&&typeof o=="object"){let t=Object.getPrototypeOf(o);if(!(t===Object.prototype||t===null||Array.isArray(o)||o instanceof Map||o instanceof Set))return`This atom holds a ${o.constructor?.name??"class"} instance \u2014 rebuilding it from edited fields would drop its prototype. Edit via app code.`}return null}function Ma(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`array \xB7 ${e.length}`:typeof e}function Ze({atom:e,onViewHistory:o}){let t=De(e.label),[a,n]=kt(0);Da(()=>{let w=()=>n(z=>z+1),I=f.subscribe(w),k=f.subscribeToAtoms(w);return()=>{I(),k()}},[]);let i=Ge(()=>{try{return e.getValue()}catch{return}},[e,a]),l=Wa(e,i),[r,c]=kt(!1),m=Ge(()=>{if(l===null)return{update:(w,I)=>{let k=e.getValue();e.setValue?.(w.length===0?I:Pa(k,w,I))},remove:w=>{if(w.length===0)return;let I=e.getValue();e.setValue?.(Ea(I,w))},canRemove:w=>w.length>0}},[e,l]),h=Ge(()=>{if(i&&typeof i=="object"){let w={};for(let[I,k]of Object.entries(i))typeof k!="function"&&(w[I]=k);return Jt(w)}return Jt(i)},[i,a]),J=Ia(w=>{e.setValue?.(w),c(!1)},[e]),A=e.setValue===void 0?{color:L.color.textTertiary,label:"READ-ONLY (DERIVED)"}:e.writeKind==="action"?{color:qe.warning,label:"CUSTOM WRITE"}:{color:qe.success,label:"PRIMITIVE"};return j(d,{style:v.root,children:[j(oe,{testID:`${se}-scroll`,style:v.scroll,contentContainerStyle:v.scrollContent,keyboardShouldPersistTaps:"handled",children:[S(d,{style:v.section,children:j(d,{style:v.editorContainer,children:[j(d,{style:v.sectionHeaderRow,children:[S(y,{testID:`${se}-editor-header`,style:v.sectionHeaderText,children:"Value Editor"}),l===null?j(te,{onPress:()=>c(!0),testID:`${se}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:v.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[S(ka,{size:13,color:L.color.accent}),S(y,{style:v.rawButtonText,children:"Raw"})]}):null]}),S(d,{style:v.sectionBody,children:l===null?j(Oa,{children:[S(La,{editable:!0,label:e.label,value:i,defaultExpanded:[e.label],writer:m,dataVersion:a,testIDForPath:$a,debounceMs:Ra}),S(y,{style:v.editorHint,children:e.writeKind==="action"?"This atom has a custom write \u2014 the edited value is handed to it as its argument (a set for atomWithStorage, an ACTION for a reducer atom).":"Edits write into the live atom as you make them \u2014 the whole value is replaced, jotai's own semantics."})]}):S(y,{style:v.blockedText,testID:`${se}-edit-blocked`,children:l})})]})}),S(d,{style:v.section,children:j(d,{style:v.infoContainer,children:[S(y,{style:v.sectionHeaderTextPlain,children:"Atom Details"}),j(d,{style:v.infoBody,children:[j(Ye,{label:"Type",children:[S(Xe,{color:e.color,testID:`${t}-type`,children:"JOTAI"}),S(y,{style:v.valueTypeText,testID:`${t}-valuetype`,children:Ma(i)})]}),S(Ye,{label:"Write",children:S(Xe,{color:A.color,testID:`${se}-write`,children:A.label})}),e.changeCount>0&&j(Ye,{label:"Changes",children:[S(Xe,{color:qe.warning,testID:`${t}-changes`,children:String(e.changeCount)}),S(te,{onPress:()=>o(e.label),style:v.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},testID:`${t}-history`,accessibilityRole:"button",accessibilityLabel:`View ${e.label} history`,children:S(y,{style:[v.inlineLinkText,{color:e.color}],children:"view history \u2192"})})]})]})]})}),S(d,{style:v.section,children:j(d,{style:v.infoContainer,children:[S(y,{style:v.sectionHeaderTextPlain,children:"Value Explorer"}),S(d,{style:v.viewerBody,testID:`${t}-value`,children:h&&typeof h=="object"?S(Ja,{title:"",data:h,showTypeFilter:!0,rawMode:!0,initialExpanded:!1}):S(y,{style:v.primitiveText,testID:`${t}-primitive`,children:String(i??"undefined")})})]})})]}),r&&l===null?S(Ba,{path:[],value:i,onSave:J,onCancel:()=>c(!1),saveLabel:"Apply",testIDPrefix:`${u}-value`}):null]})}var v=G.create({root:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8,paddingBottom:24},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:L.color.surface,borderRadius:6,borderWidth:1,borderColor:L.color.accent+"4D",overflow:"hidden",shadowColor:L.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:L.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:L.color.accent+"33"},sectionHeaderText:{fontWeight:"600",fontSize:12,color:L.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:Ce},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:L.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:L.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:L.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:L.color.surface,borderRadius:6,borderWidth:1,borderColor:L.color.border,overflow:"hidden"},sectionHeaderTextPlain:{backgroundColor:L.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:L.color.textSecondary,borderBottomWidth:1,borderBottomColor:L.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:Ce},infoBody:{padding:12,gap:10},viewerBody:{backgroundColor:L.color.bg,minHeight:60},primitiveText:{color:L.color.text,fontSize:12,fontFamily:Ce,padding:14},valueTypeText:{color:L.color.textTertiary,fontSize:10,fontFamily:Ce,marginLeft:6},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:Ce}});import{useMemo as Fa}from"react";import{EntityFilterView as Ha}from"@buoy-gg/shared-ui/web";import{jsx as _a}from"react/jsx-runtime";var za=["\u2022 count -> hides countAtom from atoms & events","\u2022 auth -> hides authAtom, authStatusAtom","\u2022 user -> hides userAtom from both tabs"];function Lt({ignoredPatterns:e,onTogglePattern:o,onAddPattern:t,atoms:a}){let n=Fa(()=>a.map(i=>({name:i.label,color:i.color})),[a]);return _a(Ha,{entities:n,ignoredPatterns:e,onTogglePattern:o,onAddPattern:t,entityNoun:"ATOMS",entitySingular:"atom",entityKey:"atom",testIDPrefix:u,slug:de,howItWorks:"Patterns hide matching atoms from both the Atoms tab and the Events tab. Tap an atom above to quickly add it as a filter.",examples:za,emptyMessage:"No atoms are being watched yet."})}import{Fragment as Rt,jsx as p,jsxs as H}from"react/jsx-runtime";function nr({isEnabled:e,searchText:o,totalChanges:t}){let a=$t({subject:"changes",search:o,total:t,capturing:e,waiting:{otto:"waiting",title:"No atom changes",message:"Atom changes will appear here as values update."},paused:{title:"No atom changes",message:"Enable capture to start recording atom changes"}});return p(et,{...a,testID:`${u}-empty`})}function Be({visible:e,onClose:o,onBack:t,onMinimize:a,enableSharedModalDimensions:n=!1,inline:i=!1,initialTab:l,initialSelectedChangeId:r,initialDetailView:c,onChangeSelect:m,onAtomExpand:h}){let J=or(),A=er("jotai.changes"),[w,I]=Z(!1),[k,z]=Z(l??"atoms"),[O,ue]=Z(null),[ae,xe]=Z(null),[me,ge]=Z(!1),[K,Te]=Z(new Set),{atomChanges:fe,filteredChanges:Q,stats:Ve,filter:Br,setFilter:pe,atoms:he,clearChanges:_t,isEnabled:ve,toggleCapture:Nt}=Fe(),U=ne(()=>K.size===0?Q:Q.filter(s=>!Array.from(K).some(V=>s.atomLabel.toLowerCase().includes(V.toLowerCase()))),[Q,K]),le=ne(()=>K.size===0?he:he.filter(s=>!Array.from(K).some(V=>s.label.toLowerCase().includes(V.toLowerCase()))),[he,K]),jt=ne(()=>O?fe.filter(s=>s.atomLabel===O).length:0,[fe,O]),ye=ne(()=>U.slice(0,A),[U,A]),$e=ne(()=>Math.max(0,U.length-A),[U.length,A]),Kt=$e>0,W=ne(()=>O?ye.filter(s=>s.atomLabel===O):ye,[ye,O]),[We,re]=Z(null),ie=ne(()=>{if(We===null)return null;let s=W.findIndex(V=>V.id===We);return s>=0?s:null},[We,W]),_=ie!==null?W[ie]:null,at=Le(null);Bt(()=>{if(!m)return;let s=_?.id??null;s===null||s===at.current||(at.current=s,m(_))},[_,m]);let rt=Le(null);Bt(()=>{!r||rt.current===r||!W.some(V=>V.id===r)||(rt.current=r,re(r))},[r,W]);let[ee,Me]=Z(""),[Ut,Se]=Z(!1),Pr=Le(null),Gt=Le(null),qt=P(s=>{},[]),Yt=s=>{Me(s),k==="events"&&pe(V=>({...V,searchText:s}))},Xt=P(()=>{Me(""),pe(s=>({...s,searchText:""})),Se(!1)},[pe]),it=P(s=>{re(s.id)},[]),Zt=P(()=>{I(!0)},[]),Qt=P(()=>{re(null)},[]),st=P(s=>{let V=W[s];V&&re(V.id)},[W]),eo=P(s=>{ue(s),re(null)},[]),to=P(()=>{ue(null),re(null)},[]),oo=P(s=>{xe(s),h?.(s)},[h]),no=P(()=>{xe(null)},[]),ao=P(()=>le.reduce((s,V)=>{try{let ce=V.getValue();s[V.label]=Ae(ce)}catch{s[V.label]=null}return s},{}),[le]),ro=P(()=>U.map(s=>({id:s.id,atomLabel:s.atomLabel,timestamp:s.timestamp,prevValue:Ae(s.prevValue),nextValue:Ae(s.nextValue),hasValueChange:s.hasValueChange,changedKeys:s.changedKeys})),[U]),io=P(()=>W.map(s=>({id:s.id,atomLabel:s.atomLabel,timestamp:s.timestamp,prevValue:Ae(s.prevValue),nextValue:Ae(s.nextValue),hasValueChange:s.hasValueChange,changedKeys:s.changedKeys})),[W]),so=P(s=>{Te(V=>{let ce=new Set(V);return ce.has(s)?ce.delete(s):ce.add(s),ce})},[]),lo=P(s=>{Te(V=>new Set([...V,s]))},[]),co=P(s=>{z(s),ue(null),re(null),ge(!1),ee&&(Me(""),pe(V=>({...V,searchText:""}))),Se(!1)},[ee,pe]),lt=P(s=>s.id,[]),ct=ne(()=>Ct(W),[W]),dt=P(({item:s})=>p(ze,{change:s,onPress:it,testID:ct.get(s.id)}),[it,ct]),ut=K.size>0,mt=()=>me?H(E,{children:[p(E.Navigation,{onBack:()=>ge(!1)}),p(E.Content,{title:"Filters",centered:!0,testID:`${u}-filters-title`})]}):_?H(E,{children:[p(E.Navigation,{onBack:Qt}),p(E.Content,{title:`${_.atomLabel}/${_.category}`,centered:!0,testID:`${u}-detail-title`})]}):O?H(E,{children:[p(E.Navigation,{onBack:to}),p(E.Content,{title:`${O} History`,centered:!0,testID:`${u}-history-title`}),p(E.Actions,{children:p(Qe,{value:io,disabled:W.length===0,buttonStyle:R.headerActionButton,testID:`${u}-copy`})})]}):ae?H(E,{children:[p(E.Navigation,{onBack:no}),p(E.Content,{title:ae,centered:!0,testID:`${u}-atom-detail-title`})]}):H(E,{children:[t&&p(E.Navigation,{onBack:t}),p(E.Content,{title:"",children:Ut?p(E.Search,{value:ee,onChangeText:Yt,onCancel:Xt,placeholder:k==="atoms"?"Search atoms...":"Search events...",accessibilityLabel:"Search Jotai atoms and events",iconSize:14,testID:`${u}-search-field`,containerTestID:`${u}-search`,clearTestID:`${u}-search-clear`,onBlur:()=>{ee.length===0&&Se(!1)}}):p(ja,{tabs:[{key:"atoms",label:`Atoms${le.length>0?` (${le.length})`:""}`},{key:"events",label:`Events${U.length>0?` (${U.length})`:""}`}],activeTab:k,onTabChange:co,testIDPrefix:`${u}-tab`})}),H(E.Actions,{children:[p(te,{onPress:()=>Se(!0),style:R.headerActionButton,testID:`${u}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search",children:p(Ua,{size:14,color:$.color.textSecondary})}),p(te,{onPress:()=>ge(!0),style:[R.headerActionButton,ut&&R.headerActionButtonActive],testID:`${u}-filters-open`,accessibilityRole:"button",accessibilityLabel:"Filters",children:p(Ga,{size:14,color:ut?$.color.accent:$.color.textSecondary})}),k==="atoms"&&p(Qe,{value:ao,disabled:le.length===0,buttonStyle:R.headerActionButton,testID:`${u}-copy`}),k==="events"&&H(Rt,{children:[p(Qe,{value:ro,disabled:U.length===0,buttonStyle:R.headerActionButton,testID:`${u}-copy`}),p(Za,{isEnabled:ve,onToggle:Nt,accessibilityLabel:"Toggle Jotai atom capture",testID:`${u}-power`}),p(Qa,{onPress:_t,disabled:U.length===0,buttonStyle:R.headerActionButton,testID:`${u}-clear`})]})]})]}),uo=()=>{if(me)return p(Lt,{ignoredPatterns:K,onTogglePattern:so,onAddPattern:lo,atoms:he});if(_&&ie!==null)return p(Ne,{change:_,changes:W,selectedIndex:ie,onIndexChange:st,disableInternalFooter:!0,initialView:c});if(O)return W.length>0?p(Ie,{testID:`${u}-history-list`,data:W,renderItem:dt,keyExtractor:lt,contentContainerStyle:R.listContent,showsVerticalScrollIndicator:!0,...Et}):p(et,{testID:`${u}-history-empty`,...$t({subject:"changes",search:ee,total:ee.trim()?jt:0,capturing:ve,waiting:{otto:"waiting",title:"No history yet",message:`Changes for ${O} will appear here.`},paused:{title:"No history yet",message:`Capture is off, so nothing is being recorded for ${O}.`}})});if(ae){let s=he.find(V=>V.label===ae)??null;return s?p(Ze,{atom:s,onViewHistory:eo}):p(et,{testID:`${u}-atom-detail-gone`,otto:"ghost",title:"Atom no longer registered",message:`${ae} is not in the registry any more.`})}return k==="atoms"?p(Dt,{atoms:le,searchQuery:ee,onOpenAtom:oo}):H(Rt,{children:[!ve&&H(d,{style:R.disabledBanner,testID:`${u}-banner-disabled`,children:[p(qa,{size:14,color:$.color.warning}),p(y,{style:R.disabledText,children:"Atom capture is disabled"})]}),Kt&&H(te,{style:R.lockedBanner,onPress:Zt,activeOpacity:.8,testID:`${u}-locked`,accessibilityRole:"button",children:[H(y,{style:R.lockedText,testID:`${u}-locked-text`,children:[$e," older"," ",$e===1?"change":"changes"," locked"]}),p(d,{style:R.upgradeBadge,children:p(y,{style:R.upgradeBadgeText,children:"UPGRADE"})})]}),ye.length>0?p(Ie,{ref:Gt,testID:`${u}-list`,data:ye,renderItem:dt,keyExtractor:lt,contentContainerStyle:R.listContent,showsVerticalScrollIndicator:!0,...Et}):p(nr,{isEnabled:ve,searchText:ee,totalChanges:Ve.totalChanges})]})},mo=n?Ya.modal.root():"buoy-jotai-modal";if(!e)return null;let gt=_&&ie!==null?p(je,{change:_,changes:W,selectedIndex:ie,onIndexChange:st}):null,go=_&&W.length>1?68:0,fo=!me&&!(_&&ie!==null)&&(O!=null||k==="events"||k==="atoms"),ft=p(d,{style:R.container,children:uo()}),pt=p(Xa,{visible:w,onClose:()=>I(!1),featureName:"Full Atom History"});return i?H(Pt,{children:[H(d,{style:R.inlineRoot,children:[p(d,{style:R.inlineHeader,...tr,children:mt()}),ft,gt]}),pt]}):H(Pt,{children:[p(Na,{visible:e,onClose:o,onMinimize:a,persistenceKey:mo,header:{showToggleButton:!0,customContent:mt()},onModeChange:qt,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,disableScrollWrapper:fo,styles:{},footer:gt,footerHeight:go,children:ft}),pt]})}function ar(e={}){return p(Be,{...e,inline:!0,visible:!0,onClose:()=>{}})}var R=G.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Ka.border.default,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:$.color.buttonSurface,borderWidth:1,borderColor:$.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonActive:{backgroundColor:$.color.accentSoft,borderColor:$.color.accentBorderStrong},disabledBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:$.color.warningSoft,borderRadius:8,borderWidth:1,borderColor:$.color.warning+"20"},disabledText:{color:$.color.warning,fontSize:11,flex:1},listContent:{paddingTop:8,paddingBottom:20},emptyState:{alignItems:"center",paddingVertical:40},emptyTitle:{color:$.color.text,fontSize:14,fontWeight:"600",marginTop:12,marginBottom:6},emptyText:{color:$.color.textTertiary,fontSize:12,textAlign:"center",lineHeight:18},lockedBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:$.color.accentSoft,borderRadius:8,borderWidth:1,borderColor:$.color.accentBorder},lockedText:{color:$.color.accent,fontSize:11,fontWeight:"500",flex:1},upgradeBadge:{backgroundColor:$.color.accent,paddingHorizontal:8,paddingVertical:3,borderRadius:4},upgradeBadgeText:{color:$.color.onAccent,fontSize:9,fontWeight:"700",letterSpacing:.5}});import{JotaiIcon as Pe,JOTAI_ICON_COLOR as rr}from"@buoy-gg/shared-ui/web";import{createToolFactory as ir,defineToolPreset as sr}from"@buoy-gg/shared-ui/web";import{jsx as Mt}from"react/jsx-runtime";var Wt=sr({id:"jotai",name:"JOTAI",description:"Jotai atom & state inspector",slot:"both",icon:({size:e})=>Mt(Pe,{size:e}),component:Be,props:{enableSharedModalDimensions:!1}}),lr=ir(Wt,e=>({enableSharedModalDimensions:e.enableSharedModalDimensions??!1}),e=>({icon:({size:o})=>Mt(Pe,{size:o,color:e.iconColor})}));import{getDefaultStore as ur}from"jotai/vanilla";import{atom as cr}from"jotai/vanilla";var dr=cr(null),tt=dr.write,Ot=typeof tt=="function"?String(tt):null;function Ft(e){let o=e,t=o?.write;return typeof t!="function"?"action":t===tt||o!==null&&"init"in o&&Ot!==null&&String(t)===Ot?"value":"action"}function Ht(e,o,t){let a=t?.enabled!==!1,n=[];for(let[i,l]of Object.entries(o)){let r=l,c=Symbol.for(`@@buoy-jotai/watched/${i}`);if(r[c])continue;r[c]=!0;let m;try{m=e.get(l)}catch{m=void 0}let h=typeof l.write=="function",J=e.set&&h?w=>{e.set(l,w)}:void 0;f.registerAtom(i,()=>{try{return e.get(l)}catch{return}},J,h?Ft(l):void 0),a&&f.addAtomChange({atomLabel:i,prevValue:void 0,nextValue:m,category:"initial"});let A=e.sub(l,()=>{try{let w=e.get(l);f.addAtomChange({atomLabel:i,prevValue:m,nextValue:w,category:"write"}),m=w}catch{}});n.push(()=>{A(),delete r[c],f.unregisterAtom(i)})}return()=>n.forEach(i=>i())}function mr(e,o){let t=ur();return Ht(t,e,o)}function gr(e){return f.getAtom(e)!==void 0}import{WIRE_DETAIL_LIMIT_BYTES as fr,createSyncAdapter as pr,capDetail as hr,detailByIdAction as yr,expandKeyedArrays as br,memoByIdentity as wr,onDeviceMarker as Cr,patchFromPath as Ar,readParams as ot,readPath as xr,refusalText as Tr,shapeSummary as Ee,suggestedPatch as Vr,toWire as vr,typedEditViolations as Sr,unshapedLists as Ir}from"@buoy-gg/shared-ui/web";var Re=Cr("Value","Atom values stay on the device \u2014 fetched on demand via getChangeDetail / getAtomValue."),nt=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function zt(e,o){if(!nt(e)||!nt(o))return o;let t={...e};for(let[a,n]of Object.entries(o))t[a]=a in e?zt(e[a],n):n;return t}function Dr(e,o){let t=e;for(let a of o.split(".")){if(!nt(t)||!(a in t))return!1;t=t[a]}return Array.isArray(t)?t.length>0:!!t&&typeof t=="object"}var kr=wr(e=>({...e,prevValue:Re,nextValue:Re})),Jr=e=>vr(e,Re),Lr=pr({version:2,getSnapshot:()=>({changes:f.getAtomChanges().map(kr),atoms:f.getAtomSnapshots().map(e=>({...e,currentValue:Jr(e.currentValue)}))}),subscribe:[e=>f.subscribe(e),e=>f.subscribeToAtoms(e)],actions:{clearEvents:()=>{f.clearAtomChanges()},getChangeDetail:yr(e=>f.getAtomChangeById(e),(e,o)=>({prevValue:o(e.prevValue),nextValue:o(e.nextValue)})),getAtomValue:e=>{let{label:o,path:t}=ot(e);if(!o)return{found:!1,reason:"missing label"};let a=f.getAtom(o);if(!a)return{found:!1,reason:"unknown label"};let n;try{n=a.getValue()}catch{n=void 0}try{JSON.stringify(n)}catch{return{found:!0,label:o,currentValue:Re}}if(t){let i=xr(n,t);return i.ok?{found:!0,label:o,path:t,shape:Ee(i.value),currentValue:i.value}:{found:!1,reason:i.error}}return{found:!0,label:o,...Ee(n)?{shape:Ee(n)}:{},currentValue:hr(n,fr)}},listAtoms:e=>{let{includeValues:o=!1,limit:t}=ot(e),a=f.getAtoms(),i=(typeof t=="number"&&t>0?a.slice(0,t):a).map(l=>{let r;if(o)try{r=l.getValue()}catch{r=void 0}let c;try{c=Ee(l.getValue())}catch{c=void 0}return{label:l.label,changes:l.changeCount,writable:typeof l.setValue=="function",...c?{shape:c}:{},...o?{currentValue:r}:{}}});return{atoms:i,total:a.length,returned:i.length,includedValues:o}},setAtom:e=>{let{label:o,value:t,merge:a,path:n,force:i}=ot(e);if(!o)throw new Error("setAtom requires a `label`");let l=f.getAtom(o),r;try{r=l?.getValue()}catch{r=void 0}let c=t,m=[],h=[],J=a===!0||n!==void 0;if(n!==void 0){if(t===void 0)return{ok:!1,error:`Refused: sent \`path\` without \`value\`. Say what to set "${n}" to.`};let A=Ar(r,n,t);if(!A.ok)return{ok:!1,error:`Refused: ${A.error}`};c=A.patch}if(!i&&J&&r!==void 0){let A=br(r,c);if(A.error)return{ok:!1,error:`Refused: ${A.error}`};c=A.patch,m=A.notes,h=Ir(r).filter(I=>Dr(c,I));let w=Sr(r,c,{noun:"atom"});if(w.length){let I=Vr(c,w);return{ok:!1,error:Tr(w,"atom",I),violations:w,...I?{suggestedValue:I}:{}}}}return f.setAtomValue(o,J?zt(r,c):c),{ok:!0,...n!==void 0?{path:n}:{},...m.length?{keyed:m}:{},...h.length?{unchecked:h.map(A=>`\`${A}\` was empty, so nothing knows what its items look like and the shape of what you added was NOT checked.`)}:{}}}}});export{rr as JOTAI_ICON_COLOR,ze as JotaiAtomChangeItem,Ne as JotaiAtomDetailContent,je as JotaiAtomDetailFooter,Ze as JotaiAtomValueDetailContent,Pe as JotaiIcon,Be as JotaiModal,ar as JotaiToolView,lr as createJotaiTool,gr as isAtomWatched,f as jotaiStateStore,Lr as jotaiSyncAdapter,Wt as jotaiToolPreset,Fe as useJotaiAtomChanges,Ht as watchAtoms,mr as watchDefaultStoreAtoms};
1
+ "use client";var it=Object.defineProperty;var la=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var ca=Object.prototype.hasOwnProperty;var da=(e,t)=>{for(var a in t)it(e,a,{get:t[a],enumerable:true})},lt=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of sa(t))!ca.call(e,o)&&o!==a&&it(e,o,{get:()=>t[o],enumerable:!(r=la(t,o))||r.enumerable});return e},ua=(e,t,a)=>(lt(e,t,"default"),a&&lt(a,t,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{createRestoreScope as ha,emptyRestoreResult as ga,failedRestore as ma,registerStateSnapshotProvider as fa,unionKeys as pa}from"@buoy-gg/shared-ui/web";import{boundedDeepEqual as ya}from"@buoy-gg/shared-ui/web/dataViewer";import{ChangeLog as ba,entityColor as Ca,formatValuePreview as va,shallowDiffSummary as wa}from"@buoy-gg/shared-ui/web";var xa={count:"#10B981",auth:"#8B5CF6",user:"#3B82F6",cart:"#EC4899",app:"#6366F1",ui:"#F59E0B",settings:"#14B8A6",theme:"#06B6D4",nav:"#F97316",form:"#EF4444",modal:"#A855F7",filter:"#84CC16"};function st(e){return Ca(e,xa)}function Va(e,t=40){return va(e,{maxLength:t,functionLabel:"(fn)"})}var Ta=wa,Sa=class extends ba{constructor(){super(...arguments);this.atoms=new Map;this.atomListeners=new Set}addAtomChange(e){if(!this.canRecord())return;let{atomLabel:t,prevValue:a,nextValue:r,category:o="write"}=e,n=a!==r,{summary:s,changedKeys:i,changedCount:d}=Ta(a,r),m=Va(r),y={id:this.nextId(),atomLabel:t,timestamp:Date.now(),prevValue:a,nextValue:r,hasValueChange:n,category:o,changedKeys:i,changedKeysCount:d,diffSummary:s,valuePreview:m,isSlowUpdate:false};this.push(y);let E=this.atoms.get(t);E&&E.changeCount++,this.notifyListeners(),this.notifyAtomListeners()}getAtomChanges(){return this.getAll()}getAtomChangeById(e){return this.getById(e)}clearAtomChanges(){for(let e of this.atoms.values())e.changeCount=0;this.clear(),this.notifyAtomListeners()}getAtomSnapshots(){return Array.from(this.atoms.values()).map(e=>{let t;try{t=e.getValue()}catch{t=void 0}return{label:e.label,changeCount:e.changeCount,color:e.color,currentValue:t,writeKind:e.writeKind}})}replaceFromSnapshot(e,t){if(!this.getEnabled())return;let a=new Map;for(let n of this.items){let s=n.prevValue;(!s||s.__buoyValueOnDevice!==true)&&a.set(n.id,n)}let r=e.slice(0,this.max).map(n=>{let s=a.get(n.id),i=n.prevValue;return s&&i?.__buoyValueOnDevice===true?{...n,prevValue:s.prevValue,nextValue:s.nextValue}:n}),o=new Map;for(let[n,s]of this.atoms)try{let i=s.getValue(),d=i;(!d||d.__buoyValueOnDevice!==true)&&o.set(n,i)}catch{}this.atoms=new Map(t.map(n=>{let s=n.currentValue,i=o.get(n.label),d=i!==void 0&&s?.__buoyValueOnDevice===true?i:n.currentValue;return[n.label,{label:n.label,changeCount:n.changeCount,color:n.color,getValue:()=>d,writeKind:n.writeKind}]})),this.setItems(r),this.notifyAtomListeners()}hydrateChange(e,t){this.hydrateById(e,t)}hydrateAtomValue(e,t){let a=this.atoms.get(e);a&&(this.atoms.set(e,{...a,getValue:()=>t}),this.notifyAtomListeners())}registerAtom(e,t,a,r){if(this.atoms.has(e))return;let o={label:e,changeCount:0,color:st(e),getValue:t,setValue:a,writeKind:r};this.atoms.set(e,o),this.notifyAtomListeners()}setAtomValue(e,t){let a=this.atoms.get(e);if(!a)throw new Error(`Atom "${e}" is not registered`);if(!a.setValue)throw new Error(`Atom "${e}" is read-only (derived) \u2014 cannot set`);a.setValue(t)}unregisterAtom(e){this.atoms.delete(e),this.notifyAtomListeners()}getAtoms(){return Array.from(this.atoms.values())}getAtom(e){return this.atoms.get(e)}getAtomColor(e){return this.atoms.get(e)?.color??st(e)}filterAtomChanges(e){let t=this.getAll();if(e.searchText){let a=e.searchText.toLowerCase();t=t.filter(r=>r.atomLabel.toLowerCase().includes(a)||r.valuePreview.toLowerCase().includes(a)||r.changedKeys.some(o=>o.toLowerCase().includes(a)))}return e.atomLabels&&e.atomLabels.length>0&&(t=t.filter(a=>e.atomLabels.includes(a.atomLabel))),e.onlyWithChanges&&(t=t.filter(a=>a.hasValueChange)),t}getStats(){let e=this.items.length,t=this.items.filter(a=>a.hasValueChange).length;return{totalChanges:e,changesWithValueChange:t,changesWithoutValueChange:e-t,atomCount:this.atoms.size}}getUniqueAtomLabels(){return Array.from(this.atoms.keys()).sort()}setMaxChanges(e){this.setMax(e)}subscribeToAtoms(e){return this.atomListeners.add(e),()=>this.atomListeners.delete(e)}notifyAtomListeners(){let e=this.getAtoms();this.atomListeners.forEach(t=>t(e))}},p=new Sa;function Aa(){let e=p.getAtoms();if(e.length===0)return{canCapture:false,canRestore:false,detail:"No Jotai atoms registered \u2014 pass your atoms to watchAtoms() / watchDefaultStoreAtoms()"};let t=e.filter(a=>a.setValue).length;return{canCapture:true,canRestore:t>0,detail:t<e.length?`${e.length-t} derived atom(s) recompute automatically and are not restored`:void 0}}async function Ia(){let e=[],t={},a=0;for(let r of p.getAtoms())try{let o=r.getValue();if(typeof o=="function"){e.push(`atom "${r.label}": function value not capturable`);continue}r.setValue||(a+=1),t[r.label]={value:o,writable:!!r.setValue}}catch(o){e.push(`atom "${r.label}": capture failed (${String(o)})`)}return a>0&&e.push(`${a} derived atom(s) captured for inspection only (recompute on restore)`),{data:{atoms:t},warnings:e}}async function Da(e,t){let a=e,r=ha(t),o=ga();if(!a?.atoms)return ma("empty jotai snapshot");let n=0;for(let[i,d]of Object.entries(a.atoms)){if(!r.allows(i))continue;if(!d.writable){n+=1;continue}let m=p.getAtom(i);if(!m){o.skipped.push({id:i,reason:"atom not registered (renamed, or unwatched since snapshot?)"});continue}if(!m.setValue){o.skipped.push({id:i,reason:"atom is now read-only (derived)"});continue}try{m.setValue(d.value),o.applied+=1}catch(y){o.skipped.push({id:i,reason:String(y)}),o.ok=false}}n>0&&o.warnings.push(`${n} derived atom(s) left to recompute`);let s=r.excludedWarning("atom(s)");return s&&o.warnings.push(s),o}async function Ba(e,t){let a=e?.atoms??{},r=t===void 0,o={};if(r)for(let i of p.getAtoms())try{o[i.label]={value:i.getValue(),writable:!!i.setValue}}catch{}else Object.assign(o,t?.atoms??{});let n=[],s=[];for(let i of pa(o,a)){if(!(i in a)){r?s.push(`atom "${i}" not in snapshot \u2014 untouched`):n.push({key:i,label:i,verdict:"removed",oldValue:o[i]?.value});continue}let d=a[i],m=i in o&&ya(o[i].value,d.value);if(!d.writable){n.push({key:i,label:i,verdict:m?"unchanged":"recomputes",reason:m?void 0:"derived atom \u2014 recomputes from its sources",oldValue:o[i]?.value,newValue:d.value});continue}if(r){let y=p.getAtom(i);if(!y){n.push({key:i,label:i,verdict:"wont-apply",reason:"atom not registered (renamed, or unwatched since snapshot?)"});continue}if(!y.setValue){n.push({key:i,label:i,verdict:"wont-apply",reason:"atom is now read-only (derived)"});continue}}i in o?m?n.push({key:i,label:i,verdict:"unchanged"}):n.push({key:i,label:i,verdict:"changed",oldValue:o[i].value,newValue:d.value}):n.push({key:i,label:i,verdict:"added",newValue:d.value})}return{items:n,notes:s}}fa({id:"jotai",label:"Jotai",status:Aa,capture:Ia,restore:Da,previewItems:Ba});import{useState as _,useMemo as Q,useRef as Ve,useCallback as D,useEffect as ct}from"react";var dt={};da(dt,{AccessibilityInfo:()=>Ea,ActivityIndicator:()=>Do,Alert:()=>Lo,Animated:()=>Pa,AppRegistry:()=>za,AppState:()=>Ha,Appearance:()=>Ra,BackHandler:()=>Wa,Button:()=>Bo,CheckBox:()=>eo,Clipboard:()=>ja,DeviceEventEmitter:()=>po,Dimensions:()=>Ma,Easing:()=>Fa,FlatList:()=>$e,I18nManager:()=>Oa,Image:()=>to,ImageBackground:()=>ao,InteractionManager:()=>Ka,Keyboard:()=>Na,KeyboardAvoidingView:()=>oo,LayoutAnimation:()=>Ja,Linking:()=>_a,LogBox:()=>fo,Modal:()=>Ao,NativeEventEmitter:()=>Ua,NativeModules:()=>$a,PanResponder:()=>Ga,Picker:()=>no,PixelRatio:()=>Ya,Platform:()=>qa,Pressable:()=>So,ProgressBar:()=>ro,RefreshControl:()=>io,SafeAreaView:()=>lo,ScrollView:()=>ge,SectionList:()=>so,Share:()=>Qa,StatusBar:()=>co,StyleSheet:()=>ne,Switch:()=>Io,Text:()=>b,TextInput:()=>xo,Touchable:()=>uo,TouchableHighlight:()=>Vo,TouchableNativeFeedback:()=>ho,TouchableOpacity:()=>re,TouchableWithoutFeedback:()=>To,UIManager:()=>Za,Vibration:()=>Xa,View:()=>c,VirtualizedList:()=>go,YellowBox:()=>mo,findNodeHandle:()=>ko,unstable_createElement:()=>La,useColorScheme:()=>yo,useLocaleContext:()=>bo,useWindowDimensions:()=>Co});ua(dt,ka);import*as ka from"react-native-web";import{unstable_createElement as La,NativeModules as $a,AccessibilityInfo as Ea,Animated as Pa,Appearance as Ra,AppRegistry as za,AppState as Ha,BackHandler as Wa,Clipboard as ja,Dimensions as Ma,Easing as Fa,I18nManager as Oa,Keyboard as Na,InteractionManager as Ka,LayoutAnimation as Ja,Linking as _a,NativeEventEmitter as Ua,PanResponder as Ga,PixelRatio as Ya,Platform as qa,Share as Qa,StyleSheet as ne,UIManager as Za,Vibration as Xa,CheckBox as eo,FlatList as $e,Image as to,ImageBackground as ao,KeyboardAvoidingView as oo,Picker as no,ProgressBar as ro,RefreshControl as io,SafeAreaView as lo,SectionList as so,StatusBar as co,Touchable as uo,TouchableNativeFeedback as ho,VirtualizedList as go,YellowBox as mo,LogBox as fo,DeviceEventEmitter as po,useColorScheme as yo,useLocaleContext as bo,useWindowDimensions as Co}from"react-native-web";import*as j from"react-native-web";import{createElement as vo,forwardRef as wo}from"react";function F(e){let t=wo((r,o)=>{let{accessibilityState:n,accessibilityValue:s,...i}=r;for(let d of["busy","checked","disabled","expanded","selected"])n?.[d]!==void 0&&i[`aria-${d}`]===void 0&&(i[`aria-${d}`]=n[d]);for(let[d,m]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))s?.[d]!==void 0&&i[`aria-${m}`]===void 0&&(i[`aria-${m}`]=s[d]);return vo(e,{...i,ref:o})}),a=e.State;return a&&Object.assign(t,{State:a}),t.displayName=e.displayName??e.name??"NativeWebView",t}var c=F(j.View),b=F(j.Text),xo=F(j.TextInput),re=F(j.TouchableOpacity),Vo=F(j.TouchableHighlight),To=F(j.TouchableWithoutFeedback),So=F(j.Pressable),ge=F(j.ScrollView),Ao=F(j.Modal),Io=F(j.Switch),Do=F(j.ActivityIndicator),Bo=F(j.Button),ko=j.findNodeHandle,Lo={alert(e,t,a,r){if(typeof document>"u")return;let o=document.createElement("dialog");o.dataset.buoyRoot="",o.setAttribute("aria-label",e),o.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let n=document.createElement("h2");if(n.textContent=e,n.style.cssText="font-size:18px;margin:0 0 12px",o.appendChild(n),t){let m=document.createElement("p");m.textContent=t,m.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",o.appendChild(m)}let s=document.createElement("div");s.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let i=a?.length?a:[{text:"OK"}],d=()=>{o.close?.(),o.remove()};for(let m of i){let y=document.createElement("button");y.type="button",y.textContent=m.text??"OK",y.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${m.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,y.onclick=()=>{d(),m.onPress?.()},s.appendChild(y)}o.addEventListener("cancel",m=>{m.preventDefault(),r?.cancelable!==false&&(d(),r?.onDismiss?.())}),o.appendChild(s),document.body.appendChild(o),o.showModal?o.showModal():o.setAttribute("open","")}};import{JsModal as $o,ModalHeader as B,TabSelector as Eo,macOSColors as Po,night as k,Search as Ro,Filter as zo,Power as Ho,ToolEmptyState as Ee,resolveListEmptyState as ut,devToolsStorageKeys as Wo,ProUpgradeModal as jo,PowerToggleButton as Mo,ToolbarCopyButton as Pe,ToolbarClearButton as Fo,truncatePayload as me,TickProvider as ht,useLimit as Oo,windowDragProps as No,EVENT_LIST_PRESET as gt}from"@buoy-gg/shared-ui/web";import{useIsPro as Ko}from"@buoy-gg/license/web";import{useCallback as Jo,useMemo as mt}from"react";import{useChangeLog as _o,useSubscribedValue as Uo}from"@buoy-gg/shared-ui/web";function Go(e,t){let a=e;if(t.searchText){let r=t.searchText.toLowerCase();a=a.filter(o=>o.atomLabel.toLowerCase().includes(r)||o.valuePreview.toLowerCase().includes(r)||o.changedKeys.some(n=>n.toLowerCase().includes(r)))}return t.atomLabels&&t.atomLabels.length>0&&(a=a.filter(r=>t.atomLabels.includes(r.atomLabel))),t.onlyWithChanges&&(a=a.filter(r=>r.hasValueChange)),a}var Yo=()=>p.getAtoms(),qo=e=>p.subscribeToAtoms(e);function ft(){let e=_o(p,{filterItems:Go}),t=Uo(Yo,qo),a=mt(()=>{let n=e.items.length,s=e.items.filter(i=>i.hasValueChange).length;return{totalChanges:n,changesWithValueChange:s,changesWithoutValueChange:n-s,atomCount:t.length}},[e.items,t]),r=mt(()=>p.getUniqueAtomLabels(),[t]),o=Jo(n=>p.getAtomChangeById(n),[]);return{atomChanges:e.items,filteredChanges:e.filteredItems,filter:e.filter,setFilter:e.setFilter,stats:a,atoms:t,clearChanges:p.clearAtomChanges.bind(p),isEnabled:e.isEnabled,toggleCapture:e.toggleCapture,atomLabels:r,getChangeById:o}}import{memo as Qo}from"react";import{ChangeRow as Zo,night as Xo}from"@buoy-gg/shared-ui/web";import{jsx as en}from"react/jsx-runtime";function tn(e,t){return t}function an(e,t){return e==="initial"?Xo.color.textTertiary:p.getAtomColor(t)}function Re(e,t=20){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="boolean"||typeof e=="number")return String(e);if(typeof e=="string")return`"${e.length>t?e.slice(0,t-1)+"\u2026":e}"`;if(Array.isArray(e))return e.length===0?"[]":`[${e.length} item${e.length===1?"":"s"}]`;if(typeof e=="object"){let a=Object.keys(e);return a.length===0?"{}":`{${a.slice(0,2).join(", ")}${a.length>2?"\u2026":""}}`}return String(e).slice(0,t)}function on(e){return e.hasValueChange?`${Re(e.prevValue)} \u2192 ${Re(e.nextValue)}`:"no change"}function nn(e){return e.category==="initial"?"INIT":"WRITE"}function rn(e){let t=e.nextValue;return typeof t=="object"&&t!==null&&!Array.isArray(t)?e.changedKeys.length>0&&e.changedKeys.length<=3?e.changedKeys.join(", "):e.changedKeys.length>3?`${e.changedKeys.slice(0,2).join(", ")} +${e.changedKeys.length-2}`:e.valuePreview||"atom()":Re(t)}var pt=Qo(function({change:e,onPress:t,testID:a}){let r=an(e.category,e.atomLabel),o=tn(e.category,e.atomLabel),n=on(e),s=rn(e),i=nn(e);return en(Zo,{statusColor:r,statusLabel:o,sublabel:n,primaryText:s,timestamp:e.timestamp,badgeText:i,changed:e.hasValueChange,onPress:()=>t(e),testID:a})});import{memo as ln,useState as ze,useCallback as fe,useMemo as yt}from"react";import{buoyColors as pe,night as v,EventStepperFooter as bt,formatRelativeTime as Te,parseValue as Se,Info as sn,Zap as Ct,FileText as cn,Database as dn,GitBranch as un,copyToClipboard as hn,ProUpgradeModal as gn,DiffModeTabs as mn,CompareBar as fn,DetailViewToggle as pn,monoFont as J}from"@buoy-gg/shared-ui/web";import{DataViewer as yn,SplitDiffViewer as bn,TreeDiffViewer as Cn,diffThemes as vn}from"@buoy-gg/shared-ui/web/dataViewer";import{useIsPro as wn}from"@buoy-gg/license/web";var u="buoy-jotai";function Ae(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function xn(e,t){return`${u}-row-${Ae(e)}-${t}`}function vt(e){return`${u}-atom-${Ae(e)}`}function Vn(e){let t=new Map,a=new Map;for(let r of e){let o=(t.get(r.atomLabel)??0)+1;t.set(r.atomLabel,o),a.set(r.id,xn(r.atomLabel,o))}return a}import{jsx as h,jsxs as R}from"react/jsx-runtime";var Tn=[{key:"change",label:"CHANGE",icon:cn},{key:"value",label:"VALUE",icon:dn},{key:"diff",label:"DIFF",icon:un}],Sn=["diff"];function An(e){switch(e){case"initial":return{label:"INITIAL",color:v.color.textTertiary,bgColor:v.color.textTertiary+"26"};default:return{label:"WRITE",color:pe.success,bgColor:pe.success+"26"}}}function In(e){let t=new Date(e),a=t.getHours().toString().padStart(2,"0"),r=t.getMinutes().toString().padStart(2,"0"),o=t.getSeconds().toString().padStart(2,"0"),n=t.getMilliseconds().toString().padStart(3,"0");return`${a}:${r}:${o}.${n}`}function wt(e){return new Date(e).toLocaleTimeString("en-US",{hour12:false,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Dn(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}function xt(e){return e==="initial"?"INIT":"WRITE"}var Bn=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}],kn=ln(function({change:e}){let t=wn(),[a,r]=ze(false),o=An(e.category),n=p.getAtomColor(e.atomLabel),s=fe(async()=>{if(!t){r(true);return}await hn(e.nextValue)},[e.nextValue,t]);return R(ge,{style:f.container,contentContainerStyle:f.content,showsVerticalScrollIndicator:false,testID:`${u}-detail-scroll`,children:[R(c,{style:f.card,testID:`${u}-info-card`,children:[h(c,{style:f.sectionHeader,children:R(c,{style:f.sectionHeaderLeft,children:[h(sn,{size:14,color:v.color.accent}),h(b,{style:f.sectionTitle,children:"CHANGE INFO"})]})}),R(c,{style:f.cardContent,children:[R(c,{style:f.infoRow,children:[h(b,{style:f.infoLabel,children:"Atom"}),h(b,{style:[f.infoValue,f.infoValueMono,{color:n}],numberOfLines:1,ellipsizeMode:"middle",testID:`${u}-info-atom`,children:e.atomLabel})]}),R(c,{style:f.infoRow,children:[h(b,{style:f.infoLabel,children:"Time"}),h(b,{style:[f.infoValue,f.infoValueMono],testID:`${u}-info-time`,children:In(e.timestamp)})]}),R(c,{style:f.badgeRow,children:[h(c,{style:[f.categoryBadge,{backgroundColor:o.bgColor}],children:h(b,{style:[f.categoryText,{color:o.color}],testID:`${u}-info-category`,children:o.label})}),e.hasValueChange?R(c,{style:f.changesBadge,children:[h(Ct,{size:10,color:pe.success}),h(b,{style:f.changesText,testID:`${u}-info-changes`,children:e.diffSummary||"changed"})]}):h(c,{style:f.noChangesBadge,children:h(b,{style:f.noChangesText,testID:`${u}-info-no-changes`,children:"no change"})})]})]})]}),e.changedKeys.length>0&&R(c,{style:f.card,testID:`${u}-keys-card`,children:[R(c,{style:f.sectionHeader,children:[R(c,{style:f.sectionHeaderLeft,children:[h(Ct,{size:14,color:v.color.accent}),h(b,{style:f.sectionTitle,children:"CHANGED KEYS"})]}),h(c,{style:f.countBadge,children:h(b,{style:f.countText,testID:`${u}-keys-count`,children:e.changedKeys.length})})]}),h(c,{style:f.cardContent,children:h(c,{style:f.keysContainer,children:e.changedKeys.map(i=>h(c,{style:f.keyBadge,children:h(b,{style:f.keyText,testID:`${u}-key-${Ae(i)}`,children:i})},i))})})]}),h(c,{style:f.actionsRow,children:h(c,{style:[f.actionButton,f.actionButtonCopy],onTouchEnd:s,testID:`${u}-copy-value`,accessibilityRole:"button",accessibilityLabel:"Copy value",children:h(b,{style:[f.actionButtonText,{color:v.color.accent}],children:"COPY VALUE"})})}),h(gn,{visible:a,onClose:()=>r(false),featureName:"Copy"})]})});function Vt({change:e,changes:t,selectedIndex:a,onIndexChange:r,disableInternalFooter:o=false,initialView:n="change"}){let[s,i]=ze(n),[d,m]=ze("tree"),y=t.length,E=p.getAtomColor(e.atomLabel),w=xt(e.category),C=Dn(Se(e.nextValue)),T=y-a,A=a<y-1?a+1:null,W=A!==null?t[A]:null,z=T-1,ie=yt(()=>({index:A??0,label:z>0?`#${z}`:"Initial",timestamp:W?wt(W.timestamp):"",relativeTime:W?Te(new Date(W.timestamp)):"value",badge:W?h(c,{style:[L.changeBadgeSmall,{backgroundColor:`${p.getAtomColor(W.atomLabel)}20`}],children:h(b,{style:[L.changeTextSmall,{color:p.getAtomColor(W.atomLabel)}],children:xt(W.category)})}):void 0}),[A,W,z]),Z=yt(()=>({index:a,label:`#${T}`,timestamp:wt(e.timestamp),relativeTime:Te(new Date(e.timestamp)),badge:h(c,{style:[L.changeBadgeSmall,{backgroundColor:`${E}20`}],children:h(b,{style:[L.changeTextSmall,{color:E}],children:w})})}),[a,e.timestamp,E,w,T]),be=fe(()=>{let Y=Se(e.nextValue);return R(c,{style:L.contentCard,testID:`${u}-value-card`,children:[R(c,{style:L.valueHeader,children:[h(b,{style:L.valueLabel,children:"VALUE AFTER CHANGE"}),R(c,{style:L.valueHeaderBadges,children:[h(c,{style:[L.changeBadge,{backgroundColor:`${E}20`}],children:h(b,{style:[L.changeText,{color:E}],children:w})}),h(c,{style:L.typeBadge,children:h(b,{style:L.typeText,testID:`${u}-value-type`,children:C.toUpperCase()})})]})]}),h(c,{style:f.dataViewerContainer,children:h(yn,{title:"",data:Y,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})},[e.nextValue,E,w,C]),le=fe(()=>{let Y=Se(e.prevValue),ve=Se(e.nextValue);return d==="split"?h(ge,{style:{flex:1},showsVerticalScrollIndicator:true,children:h(bn,{oldValue:Y,newValue:ve,theme:vn.devToolsDefault,options:{hideLineNumbers:false,disableWordDiff:false,showDiffOnly:false,compareMethod:"words",contextLines:3},showThemeName:false})}):h(Cn,{oldValue:Y,newValue:ve})},[e.prevValue,e.nextValue,d]),se=fe(()=>{r(Math.min(y-1,a+1))},[a,y,r]),N=fe(()=>{r(Math.max(0,a-1))},[a,r]),Ce=e.prevValue===void 0,ce=!o&&y>1;return R(c,{style:L.container,children:[h(pn,{views:Tn,activeView:s,onViewChange:i,disabledKeys:Ce?Sn:void 0,testIDPrefix:u}),R(c,{style:[L.contentArea,ce&&L.contentAreaFooterPad],children:[s==="change"&&h(kn,{change:e}),s==="value"&&h(c,{style:L.stateContainer,children:be()}),s==="diff"&&R(c,{style:L.diffContainer,testID:`${u}-diff`,children:[h(mn,{tabs:Bn,activeTab:d,onTabChange:m,testIDPrefix:`${u}-diff-tab`}),h(fn,{leftEvent:ie,rightEvent:Z}),h(c,{style:L.diffContent,testID:`${u}-diff-content`,children:le()})]})]}),ce&&h(bt,{currentIndex:T-1,totalItems:y,onPrevious:se,onNext:N,itemLabel:"Change",subtitle:Te(new Date(e.timestamp)),absolute:true})]})}function Tt({change:e,changes:t,selectedIndex:a,onIndexChange:r}){let o=t.length;if(o<=1)return null;let n=o-a;return h(bt,{currentIndex:n-1,totalItems:o,onPrevious:()=>r(Math.min(o-1,a+1)),onNext:()=>r(Math.max(0,a-1)),itemLabel:"Change",subtitle:Te(new Date(e.timestamp))})}var L=ne.create({container:{flex:1,backgroundColor:"transparent"},contentArea:{flex:1},contentAreaFooterPad:{paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:v.color.surface,borderRadius:14,padding:14,borderWidth:1,borderColor:v.color.border},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:v.color.textSecondary,fontFamily:J,letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},changeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},changeText:{fontSize:9,fontWeight:"700",fontFamily:J,letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:v.color.surfaceElevated},typeText:{fontSize:9,fontWeight:"600",color:v.color.textTertiary,fontFamily:J},valueBox:{backgroundColor:v.color.bg,borderRadius:6,borderWidth:1,borderColor:v.color.border,padding:8},valueText:{fontSize:12,color:v.color.text,fontFamily:J,lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},changeBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},changeTextSmall:{fontSize:8,fontWeight:"700",fontFamily:J}}),f=ne.create({container:{flex:1},content:{padding:8,paddingBottom:100,gap:16},card:{backgroundColor:v.color.surface,borderRadius:6,borderWidth:1,borderColor:v.color.accentBorderStrong,overflow:"hidden",shadowColor:v.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:v.color.accentBorder,backgroundColor:v.color.accentSoft},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:6},sectionTitle:{fontSize:12,fontWeight:"600",letterSpacing:.5,color:v.color.accent,fontFamily:J},cardContent:{padding:14,gap:10},infoRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},infoLabel:{fontSize:11,color:v.color.textTertiary,fontWeight:"500"},infoValue:{fontSize:11,color:v.color.text,fontWeight:"500",flex:1,textAlign:"right",marginLeft:12},infoValueMono:{fontFamily:J},badgeRow:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},categoryBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4},categoryText:{fontSize:9,fontWeight:"700",letterSpacing:.3},changesBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:pe.success+"26"},changesText:{fontSize:9,fontWeight:"600",color:pe.success},noChangesBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:v.color.surfaceElevated},noChangesText:{fontSize:9,fontWeight:"600",color:v.color.textTertiary},keysContainer:{flexDirection:"row",flexWrap:"wrap",gap:6},keyBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4,backgroundColor:v.color.accentSoft,borderWidth:1,borderColor:v.color.accentBorder},keyText:{fontSize:11,fontWeight:"600",color:v.color.accent,fontFamily:J},countBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:v.color.accentFill},countText:{fontSize:9,fontWeight:"700",color:v.color.accent,fontFamily:J},actionsRow:{flexDirection:"row",gap:12},actionButton:{paddingHorizontal:14,paddingVertical:8,borderRadius:8,borderWidth:1},actionButtonCopy:{borderColor:v.color.accentBorder,backgroundColor:v.color.accentSoft},actionButtonText:{fontSize:10,fontWeight:"700",fontFamily:J,letterSpacing:.3},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12}});import{useMemo as Ln}from"react";import{CompactRow as $n,night as He,ToolEmptyState as St,resolveListEmptyState as En,monoFont as At}from"@buoy-gg/shared-ui/web";import{jsx as U,jsxs as We}from"react/jsx-runtime";function Pn(e){try{let t=e.getValue();if(t&&typeof t=="object"&&t.__buoyValueOnDevice===true)return"on device";if(t===void 0)return"undefined";if(t===null)return"null";if(Array.isArray(t))return t.length===0?"[]":`[${t.length} item${t.length===1?"":"s"}]`;if(typeof t=="object"){let a=Object.keys(t);return a.length===0?"{}":a.length<=3?a.join(", "):`${a.slice(0,2).join(", ")} +${a.length-2}`}return String(t).slice(0,40)}catch{return""}}function Rn(e){return e.writeKind==="value"?"primitive":e.writeKind==="action"?"custom write":e.setValue?"writable":"derived"}function zn(){return U(St,{testID:`${u}-atoms-empty`,otto:"scanning",title:"No atoms registered",message:`Use watchAtoms(store, { atomName }) to register your Jotai atoms.
2
+ They will appear here with their current value.`})}function Hn({atoms:e,searchQuery:t,onOpenAtom:a}){let r=Ln(()=>{if(!t)return e;let o=t.toLowerCase();return e.filter(n=>n.label.toLowerCase().includes(o))},[e,t]);return r.length===0&&!t?U(zn,{}):r.length===0&&t?U(St,{testID:`${u}-atoms-no-match`,...En({subject:"atoms",verb:"registered",search:t,total:e.length,waiting:{otto:"scanning",title:"No atoms registered",message:"Use watchAtoms() to register your Jotai atoms."}})}):We(ge,{style:G.container,contentContainerStyle:G.scrollContent,showsVerticalScrollIndicator:true,testID:`${u}-atoms-scroll`,children:[We(c,{style:G.sectionHeader,children:[U(b,{style:G.sectionTitle,children:"ATOMS"}),U(c,{style:G.sectionCountBadge,children:U(b,{style:G.sectionCountText,testID:`${u}-atoms-count`,children:r.length})})]}),r.map(o=>{let n=Pn(o),s=p.getAtomColor(o.label),i=vt(o.label);return We(c,{style:G.atomRowWrapper,children:[U($n,{statusDotColor:s,statusLabel:Rn(o),primaryText:o.label,secondaryText:n||void 0,showChevron:true,onPress:()=>a(o.label),testID:i,statusTestID:`${i}-kind`,primaryTestID:`${i}-name`,secondaryTestID:`${i}-preview`}),o.changeCount>0&&U(c,{style:[G.absCountBadge,{backgroundColor:s+"22",borderColor:s+"55"}],pointerEvents:"none",children:U(b,{style:[G.absCountText,{color:s}],testID:`${i}-count`,children:String(o.changeCount)})})]},o.label)})]})}var G=ne.create({container:{flex:1},atomRowWrapper:{position:"relative"},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountText:{fontSize:9,fontWeight:"700",fontFamily:At},scrollContent:{paddingTop:8,paddingBottom:20},sectionHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:8,gap:8},sectionTitle:{fontSize:11,fontWeight:"700",letterSpacing:.5,color:He.color.textTertiary},sectionCountBadge:{backgroundColor:He.color.accentFill,paddingHorizontal:8,paddingVertical:2,borderRadius:4},sectionCountText:{fontSize:10,fontWeight:"700",color:He.color.accent,fontFamily:At}});import{useCallback as Wn,useEffect as jn,useMemo as je,useState as It}from"react";import{buoyColors as Me,ExpandedInfoRow as Fe,FileJson as Mn,night as I,PillBadge as Oe,parseValue as Dt,monoFont as ye}from"@buoy-gg/shared-ui/web";import{DataViewer as Fn,LiveExplorer as On,ValueEditModal as Nn,updateNestedDataByPath as Kn,deleteNestedDataByPath as Jn}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as _n,jsx as V,jsxs as O}from"react/jsx-runtime";var Un=300,te=`${u}-atom-detail`;function Gn(e){let t=a=>a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e.length===0?`${te}-explorer-root`:`${te}-explorer-${e.map(t).filter(Boolean).join("-")}`}function Yn(e,t){if(!e.setValue)return"Derived atom \u2014 its value recomputes from other atoms and has no setter. Edit the atoms it reads from instead.";if(typeof t=="function")return"This atom holds a function \u2014 nothing here to edit as data.";if(t&&typeof t=="object"&&t.__buoyValueOnDevice===true)return"The value stayed on the device (too large for the wire) \u2014 open the tool on-device to edit it.";if(t&&typeof t=="object"){let a=Object.getPrototypeOf(t);if(!(a===Object.prototype||a===null||Array.isArray(t)||t instanceof Map||t instanceof Set))return`This atom holds a ${t.constructor?.name??"class"} instance \u2014 rebuilding it from edited fields would drop its prototype. Edit via app code.`}return null}function qn(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`array \xB7 ${e.length}`:typeof e}function Bt({atom:e,onViewHistory:t}){let a=vt(e.label),[r,o]=It(0);jn(()=>{let C=()=>o(W=>W+1),T=p.subscribe(C),A=p.subscribeToAtoms(C);return()=>{T(),A()}},[]);let n=je(()=>{try{return e.getValue()}catch{return}},[e,r]),s=Yn(e,n),[i,d]=It(false),m=je(()=>{if(s===null)return{update:(C,T)=>{let A=e.getValue();e.setValue?.(C.length===0?T:Kn(A,C,T))},remove:C=>{if(C.length===0)return;let T=e.getValue();e.setValue?.(Jn(T,C))},canRemove:C=>C.length>0}},[e,s]),y=je(()=>{if(n&&typeof n=="object"){let C={};for(let[T,A]of Object.entries(n))typeof A!="function"&&(C[T]=A);return Dt(C)}return Dt(n)},[n,r]),E=Wn(C=>{e.setValue?.(C),d(false)},[e]),w=e.setValue===void 0?{color:I.color.textTertiary,label:"READ-ONLY (DERIVED)"}:e.writeKind==="action"?{color:Me.warning,label:"CUSTOM WRITE"}:{color:Me.success,label:"PRIMITIVE"};return O(c,{style:x.root,children:[O(ge,{testID:`${te}-scroll`,style:x.scroll,contentContainerStyle:x.scrollContent,keyboardShouldPersistTaps:"handled",children:[V(c,{style:x.section,children:O(c,{style:x.editorContainer,children:[O(c,{style:x.sectionHeaderRow,children:[V(b,{testID:`${te}-editor-header`,style:x.sectionHeaderText,children:"Value Editor"}),s===null?O(re,{onPress:()=>d(true),testID:`${te}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:x.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[V(Mn,{size:13,color:I.color.accent}),V(b,{style:x.rawButtonText,children:"Raw"})]}):null]}),V(c,{style:x.sectionBody,children:s===null?O(_n,{children:[V(On,{editable:true,label:e.label,value:n,defaultExpanded:[e.label],writer:m,dataVersion:r,testIDForPath:Gn,debounceMs:Un}),V(b,{style:x.editorHint,children:e.writeKind==="action"?"This atom has a custom write \u2014 the edited value is handed to it as its argument (a set for atomWithStorage, an ACTION for a reducer atom).":"Edits write into the live atom as you make them \u2014 the whole value is replaced, jotai's own semantics."})]}):V(b,{style:x.blockedText,testID:`${te}-edit-blocked`,children:s})})]})}),V(c,{style:x.section,children:O(c,{style:x.infoContainer,children:[V(b,{style:x.sectionHeaderTextPlain,children:"Atom Details"}),O(c,{style:x.infoBody,children:[O(Fe,{label:"Type",children:[V(Oe,{color:e.color,testID:`${a}-type`,children:"JOTAI"}),V(b,{style:x.valueTypeText,testID:`${a}-valuetype`,children:qn(n)})]}),V(Fe,{label:"Write",children:V(Oe,{color:w.color,testID:`${te}-write`,children:w.label})}),e.changeCount>0&&O(Fe,{label:"Changes",children:[V(Oe,{color:Me.warning,testID:`${a}-changes`,children:String(e.changeCount)}),V(re,{onPress:()=>t(e.label),style:x.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},testID:`${a}-history`,accessibilityRole:"button",accessibilityLabel:`View ${e.label} history`,children:V(b,{style:[x.inlineLinkText,{color:e.color}],children:"view history \u2192"})})]})]})]})}),V(c,{style:x.section,children:O(c,{style:x.infoContainer,children:[V(b,{style:x.sectionHeaderTextPlain,children:"Value Explorer"}),V(c,{style:x.viewerBody,testID:`${a}-value`,children:y&&typeof y=="object"?V(Fn,{title:"",data:y,showTypeFilter:true,rawMode:true,initialExpanded:false}):V(b,{style:x.primitiveText,testID:`${a}-primitive`,children:String(n??"undefined")})})]})})]}),i&&s===null?V(Nn,{path:[],value:n,onSave:E,onCancel:()=>d(false),saveLabel:"Apply",testIDPrefix:`${u}-value`}):null]})}var x=ne.create({root:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8,paddingBottom:24},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:I.color.surface,borderRadius:6,borderWidth:1,borderColor:I.color.accent+"4D",overflow:"hidden",shadowColor:I.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:I.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:I.color.accent+"33"},sectionHeaderText:{fontWeight:"600",fontSize:12,color:I.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:ye},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:I.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:I.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:I.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:I.color.surface,borderRadius:6,borderWidth:1,borderColor:I.color.border,overflow:"hidden"},sectionHeaderTextPlain:{backgroundColor:I.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:I.color.textSecondary,borderBottomWidth:1,borderBottomColor:I.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:ye},infoBody:{padding:12,gap:10},viewerBody:{backgroundColor:I.color.bg,minHeight:60},primitiveText:{color:I.color.text,fontSize:12,fontFamily:ye,padding:14},valueTypeText:{color:I.color.textTertiary,fontSize:10,fontFamily:ye,marginLeft:6},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:ye}});import{useMemo as Qn}from"react";import{EntityFilterView as Zn}from"@buoy-gg/shared-ui/web";import{jsx as Xn}from"react/jsx-runtime";var er=["\u2022 count -> hides countAtom from atoms & events","\u2022 auth -> hides authAtom, authStatusAtom","\u2022 user -> hides userAtom from both tabs"];function tr({ignoredPatterns:e,onTogglePattern:t,onAddPattern:a,atoms:r}){let o=Qn(()=>r.map(n=>({name:n.label,color:n.color})),[r]);return Xn(Zn,{entities:o,ignoredPatterns:e,onTogglePattern:t,onAddPattern:a,entityNoun:"ATOMS",entitySingular:"atom",entityKey:"atom",testIDPrefix:u,slug:Ae,howItWorks:"Patterns hide matching atoms from both the Atoms tab and the Events tab. Tap an atom above to quickly add it as a filter.",examples:er,emptyMessage:"No atoms are being watched yet."})}import{Fragment as kt,jsx as g,jsxs as H}from"react/jsx-runtime";function ar({isEnabled:e,searchText:t,totalChanges:a}){let r=ut({subject:"changes",search:t,total:a,capturing:e,waiting:{otto:"waiting",title:"No atom changes",message:"Atom changes will appear here as values update."},paused:{title:"No atom changes",message:"Enable capture to start recording atom changes"}});return g(Ee,{...r,testID:`${u}-empty`})}function Ne({visible:e,onClose:t,onBack:a,onMinimize:r,enableSharedModalDimensions:o=false,inline:n=false,initialTab:s,initialSelectedChangeId:i,initialDetailView:d,onChangeSelect:m,onAtomExpand:y}){let E=Ko(),w=Oo("jotai.changes"),[C,T]=_(false),[A,W]=_(s??"atoms"),[z,ie]=_(null),[Z,be]=_(null),[le,se]=_(false),[N,Ce]=_(new Set),{atomChanges:ce,filteredChanges:Y,stats:ve,filter:$r,setFilter:de,atoms:ue,clearChanges:zt,isEnabled:we,toggleCapture:Ht}=ft(),K=Q(()=>N.size===0?Y:Y.filter(l=>!Array.from(N).some(S=>l.atomLabel.toLowerCase().includes(S.toLowerCase()))),[Y,N]),ae=Q(()=>N.size===0?ue:ue.filter(l=>!Array.from(N).some(S=>l.label.toLowerCase().includes(S.toLowerCase()))),[ue,N]),Wt=Q(()=>z?ce.filter(l=>l.atomLabel===z).length:0,[ce,z]),he=Q(()=>K.slice(0,w),[K,w]),Be=Q(()=>Math.max(0,K.length-w),[K.length,w]),jt=Be>0,P=Q(()=>z?he.filter(l=>l.atomLabel===z):he,[he,z]),[ke,X]=_(null),ee=Q(()=>{if(ke===null)return null;let l=P.findIndex(S=>S.id===ke);return l>=0?l:null},[ke,P]),M=ee!==null?P[ee]:null,Ge=Ve(null);ct(()=>{if(!m)return;let l=M?.id??null;l===null||l===Ge.current||(Ge.current=l,m(M))},[M,m]);let Ye=Ve(null);ct(()=>{!i||Ye.current===i||!P.some(l=>l.id===i)||(Ye.current=i,X(i))},[i,P]);let[q,Le]=_(""),[Mt,xe]=_(false),Er=Ve(null),Ft=Ve(null),Ot=D(l=>{},[]),Nt=l=>{Le(l),A==="events"&&de(S=>({...S,searchText:l}))},Kt=D(()=>{Le(""),de(l=>({...l,searchText:""})),xe(false)},[de]),qe=D(l=>{X(l.id)},[]),Jt=D(()=>{T(true)},[]),_t=D(()=>{X(null)},[]),Qe=D(l=>{let S=P[l];S&&X(S.id)},[P]),Ut=D(l=>{ie(l),X(null)},[]),Gt=D(()=>{ie(null),X(null)},[]),Yt=D(l=>{be(l),y?.(l)},[y]),qt=D(()=>{be(null)},[]),Qt=D(()=>ae.reduce((l,S)=>{try{let oe=S.getValue();l[S.label]=me(oe)}catch{l[S.label]=null}return l},{}),[ae]),Zt=D(()=>K.map(l=>({id:l.id,atomLabel:l.atomLabel,timestamp:l.timestamp,prevValue:me(l.prevValue),nextValue:me(l.nextValue),hasValueChange:l.hasValueChange,changedKeys:l.changedKeys})),[K]),Xt=D(()=>P.map(l=>({id:l.id,atomLabel:l.atomLabel,timestamp:l.timestamp,prevValue:me(l.prevValue),nextValue:me(l.nextValue),hasValueChange:l.hasValueChange,changedKeys:l.changedKeys})),[P]),ea=D(l=>{Ce(S=>{let oe=new Set(S);return oe.has(l)?oe.delete(l):oe.add(l),oe})},[]),ta=D(l=>{Ce(S=>new Set([...S,l]))},[]),aa=D(l=>{W(l),ie(null),X(null),se(false),q&&(Le(""),de(S=>({...S,searchText:""}))),xe(false)},[q,de]),Ze=D(l=>l.id,[]),Xe=Q(()=>Vn(P),[P]),et=D(({item:l})=>g(pt,{change:l,onPress:qe,testID:Xe.get(l.id)}),[qe,Xe]),tt=N.size>0,at=()=>le?H(B,{children:[g(B.Navigation,{onBack:()=>se(false)}),g(B.Content,{title:"Filters",centered:true,testID:`${u}-filters-title`})]}):M?H(B,{children:[g(B.Navigation,{onBack:_t}),g(B.Content,{title:`${M.atomLabel}/${M.category}`,centered:true,testID:`${u}-detail-title`})]}):z?H(B,{children:[g(B.Navigation,{onBack:Gt}),g(B.Content,{title:`${z} History`,centered:true,testID:`${u}-history-title`}),g(B.Actions,{children:g(Pe,{value:Xt,disabled:P.length===0,buttonStyle:$.headerActionButton,testID:`${u}-copy`})})]}):Z?H(B,{children:[g(B.Navigation,{onBack:qt}),g(B.Content,{title:Z,centered:true,testID:`${u}-atom-detail-title`})]}):H(B,{children:[a&&g(B.Navigation,{onBack:a}),g(B.Content,{title:"",children:Mt?g(B.Search,{value:q,onChangeText:Nt,onCancel:Kt,placeholder:A==="atoms"?"Search atoms...":"Search events...",accessibilityLabel:"Search Jotai atoms and events",iconSize:14,testID:`${u}-search-field`,containerTestID:`${u}-search`,clearTestID:`${u}-search-clear`,onBlur:()=>{q.length===0&&xe(false)}}):g(Eo,{tabs:[{key:"atoms",label:`Atoms${ae.length>0?` (${ae.length})`:""}`},{key:"events",label:`Events${K.length>0?` (${K.length})`:""}`}],activeTab:A,onTabChange:aa,testIDPrefix:`${u}-tab`})}),H(B.Actions,{children:[g(re,{onPress:()=>xe(true),style:$.headerActionButton,testID:`${u}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search",children:g(Ro,{size:14,color:k.color.textSecondary})}),g(re,{onPress:()=>se(true),style:[$.headerActionButton,tt&&$.headerActionButtonActive],testID:`${u}-filters-open`,accessibilityRole:"button",accessibilityLabel:"Filters",children:g(zo,{size:14,color:tt?k.color.accent:k.color.textSecondary})}),A==="atoms"&&g(Pe,{value:Qt,disabled:ae.length===0,buttonStyle:$.headerActionButton,testID:`${u}-copy`}),A==="events"&&H(kt,{children:[g(Pe,{value:Zt,disabled:K.length===0,buttonStyle:$.headerActionButton,testID:`${u}-copy`}),g(Mo,{isEnabled:we,onToggle:Ht,accessibilityLabel:"Toggle Jotai atom capture",testID:`${u}-power`}),g(Fo,{onPress:zt,disabled:K.length===0,buttonStyle:$.headerActionButton,testID:`${u}-clear`})]})]})]}),oa=()=>{if(le)return g(tr,{ignoredPatterns:N,onTogglePattern:ea,onAddPattern:ta,atoms:ue});if(M&&ee!==null)return g(Vt,{change:M,changes:P,selectedIndex:ee,onIndexChange:Qe,disableInternalFooter:true,initialView:d});if(z)return P.length>0?g($e,{testID:`${u}-history-list`,data:P,renderItem:et,keyExtractor:Ze,contentContainerStyle:$.listContent,showsVerticalScrollIndicator:true,...gt}):g(Ee,{testID:`${u}-history-empty`,...ut({subject:"changes",search:q,total:q.trim()?Wt:0,capturing:we,waiting:{otto:"waiting",title:"No history yet",message:`Changes for ${z} will appear here.`},paused:{title:"No history yet",message:`Capture is off, so nothing is being recorded for ${z}.`}})});if(Z){let l=ue.find(S=>S.label===Z)??null;return l?g(Bt,{atom:l,onViewHistory:Ut}):g(Ee,{testID:`${u}-atom-detail-gone`,otto:"ghost",title:"Atom no longer registered",message:`${Z} is not in the registry any more.`})}return A==="atoms"?g(Hn,{atoms:ae,searchQuery:q,onOpenAtom:Yt}):H(kt,{children:[!we&&H(c,{style:$.disabledBanner,testID:`${u}-banner-disabled`,children:[g(Ho,{size:14,color:k.color.warning}),g(b,{style:$.disabledText,children:"Atom capture is disabled"})]}),jt&&H(re,{style:$.lockedBanner,onPress:Jt,activeOpacity:.8,testID:`${u}-locked`,accessibilityRole:"button",children:[H(b,{style:$.lockedText,testID:`${u}-locked-text`,children:[Be," older"," ",Be===1?"change":"changes"," locked"]}),g(c,{style:$.upgradeBadge,children:g(b,{style:$.upgradeBadgeText,children:"UPGRADE"})})]}),he.length>0?g($e,{ref:Ft,testID:`${u}-list`,data:he,renderItem:et,keyExtractor:Ze,contentContainerStyle:$.listContent,showsVerticalScrollIndicator:true,...gt}):g(ar,{isEnabled:we,searchText:q,totalChanges:ve.totalChanges})]})},na=o?Wo.modal.root():"buoy-jotai-modal";if(!e)return null;let ot=M&&ee!==null?g(Tt,{change:M,changes:P,selectedIndex:ee,onIndexChange:Qe}):null,ra=M&&P.length>1?68:0,ia=!le&&!(M&&ee!==null)&&(z!=null||A==="events"||A==="atoms"),nt=g(c,{style:$.container,children:oa()}),rt=g(jo,{visible:C,onClose:()=>T(false),featureName:"Full Atom History"});return n?H(ht,{children:[H(c,{style:$.inlineRoot,children:[g(c,{style:$.inlineHeader,...No,children:at()}),nt,ot]}),rt]}):H(ht,{children:[g($o,{visible:e,onClose:t,onMinimize:r,persistenceKey:na,header:{showToggleButton:true,customContent:at()},onModeChange:Ot,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:ia,styles:{},footer:ot,footerHeight:ra,children:nt}),rt]})}function or(e={}){return g(Ne,{...e,inline:true,visible:true,onClose:()=>{}})}var $=ne.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Po.border.default,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:k.color.buttonSurface,borderWidth:1,borderColor:k.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonActive:{backgroundColor:k.color.accentSoft,borderColor:k.color.accentBorderStrong},disabledBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:k.color.warningSoft,borderRadius:8,borderWidth:1,borderColor:k.color.warning+"20"},disabledText:{color:k.color.warning,fontSize:11,flex:1},listContent:{paddingTop:8,paddingBottom:20},emptyState:{alignItems:"center",paddingVertical:40},emptyTitle:{color:k.color.text,fontSize:14,fontWeight:"600",marginTop:12,marginBottom:6},emptyText:{color:k.color.textTertiary,fontSize:12,textAlign:"center",lineHeight:18},lockedBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:k.color.accentSoft,borderRadius:8,borderWidth:1,borderColor:k.color.accentBorder},lockedText:{color:k.color.accent,fontSize:11,fontWeight:"500",flex:1},upgradeBadge:{backgroundColor:k.color.accent,paddingHorizontal:8,paddingVertical:3,borderRadius:4},upgradeBadgeText:{color:k.color.onAccent,fontSize:9,fontWeight:"700",letterSpacing:.5}});import{JotaiIcon as Ke,JOTAI_ICON_COLOR as nr}from"@buoy-gg/shared-ui/web";import{createToolFactory as rr,defineToolPreset as ir}from"@buoy-gg/shared-ui/web";import{jsx as Lt}from"react/jsx-runtime";var $t=ir({id:"jotai",name:"JOTAI",description:"Jotai atom & state inspector",slot:"both",icon:({size:e})=>Lt(Ke,{size:e}),component:Ne,props:{enableSharedModalDimensions:false}}),lr=rr($t,e=>({enableSharedModalDimensions:e.enableSharedModalDimensions??false}),e=>({icon:({size:t})=>Lt(Ke,{size:t,color:e.iconColor})}));import{getDefaultStore as sr}from"jotai/vanilla";import{atom as cr}from"jotai/vanilla";var dr=cr(null),Je=dr.write,Et=typeof Je=="function"?String(Je):null;function ur(e){let t=e,a=t?.write;return typeof a!="function"?"action":a===Je||t!==null&&"init"in t&&Et!==null&&String(a)===Et?"value":"action"}function Pt(e,t,a){let r=a?.enabled!==false,o=[];for(let[n,s]of Object.entries(t)){let i=s,d=Symbol.for(`@@buoy-jotai/watched/${n}`);if(i[d])continue;i[d]=true;let m;try{m=e.get(s)}catch{m=void 0}let y=typeof s.write=="function",E=e.set&&y?C=>{e.set(s,C)}:void 0;p.registerAtom(n,()=>{try{return e.get(s)}catch{return}},E,y?ur(s):void 0),r&&p.addAtomChange({atomLabel:n,prevValue:void 0,nextValue:m,category:"initial"});let w=e.sub(s,()=>{try{let C=e.get(s);p.addAtomChange({atomLabel:n,prevValue:m,nextValue:C,category:"write"}),m=C}catch{}});o.push(()=>{w(),delete i[d],p.unregisterAtom(n)})}return()=>o.forEach(n=>n())}function hr(e,t){let a=sr();return Pt(a,e,t)}function gr(e){return p.getAtom(e)!==void 0}import{WIRE_DETAIL_LIMIT_BYTES as mr,createSyncAdapter as fr,capDetail as pr,detailByIdAction as yr,expandKeyedArrays as br,memoByIdentity as Cr,onDeviceMarker as vr,patchFromPath as wr,readParams as _e,readPath as xr,refusalText as Vr,shapeSummary as Ie,suggestedPatch as Tr,toWire as Sr,typedEditViolations as Ar,unshapedLists as Ir}from"@buoy-gg/shared-ui/web";var De=vr("Value","Atom values stay on the device \u2014 fetched on demand via getChangeDetail / getAtomValue."),Ue=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function Rt(e,t){if(!Ue(e)||!Ue(t))return t;let a={...e};for(let[r,o]of Object.entries(t))a[r]=r in e?Rt(e[r],o):o;return a}function Dr(e,t){let a=e;for(let r of t.split(".")){if(!Ue(a)||!(r in a))return false;a=a[r]}return Array.isArray(a)?a.length>0:!!a&&typeof a=="object"}var Br=Cr(e=>({...e,prevValue:De,nextValue:De})),kr=e=>Sr(e,De),Lr=fr({version:2,getSnapshot:()=>({changes:p.getAtomChanges().map(Br),atoms:p.getAtomSnapshots().map(e=>({...e,currentValue:kr(e.currentValue)}))}),subscribe:[e=>p.subscribe(e),e=>p.subscribeToAtoms(e)],actions:{clearEvents:()=>{p.clearAtomChanges()},getChangeDetail:yr(e=>p.getAtomChangeById(e),(e,t)=>({prevValue:t(e.prevValue),nextValue:t(e.nextValue)})),getAtomValue:e=>{let{label:t,path:a}=_e(e);if(!t)return{found:false,reason:"missing label"};let r=p.getAtom(t);if(!r)return{found:false,reason:"unknown label"};let o;try{o=r.getValue()}catch{o=void 0}try{JSON.stringify(o)}catch{return{found:true,label:t,currentValue:De}}if(a){let n=xr(o,a);return n.ok?{found:true,label:t,path:a,shape:Ie(n.value),currentValue:n.value}:{found:false,reason:n.error}}return{found:true,label:t,...Ie(o)?{shape:Ie(o)}:{},currentValue:pr(o,mr)}},listAtoms:e=>{let{includeValues:t=false,limit:a}=_e(e),r=p.getAtoms(),o=(typeof a=="number"&&a>0?r.slice(0,a):r).map(n=>{let s;if(t)try{s=n.getValue()}catch{s=void 0}let i;try{i=Ie(n.getValue())}catch{i=void 0}return{label:n.label,changes:n.changeCount,writable:typeof n.setValue=="function",...i?{shape:i}:{},...t?{currentValue:s}:{}}});return{atoms:o,total:r.length,returned:o.length,includedValues:t}},setAtom:e=>{let{label:t,value:a,merge:r,path:o,force:n}=_e(e);if(!t)throw new Error("setAtom requires a `label`");let s=p.getAtom(t),i;try{i=s?.getValue()}catch{i=void 0}let d=a,m=[],y=[],E=r===true||o!==void 0;if(o!==void 0){if(a===void 0)return{ok:false,error:`Refused: sent \`path\` without \`value\`. Say what to set "${o}" to.`};let w=wr(i,o,a);if(!w.ok)return{ok:false,error:`Refused: ${w.error}`};d=w.patch}if(!n&&E&&i!==void 0){let w=br(i,d);if(w.error)return{ok:false,error:`Refused: ${w.error}`};d=w.patch,m=w.notes,y=Ir(i).filter(T=>Dr(d,T));let C=Ar(i,d,{noun:"atom"});if(C.length){let T=Tr(d,C);return{ok:false,error:Vr(C,"atom",T),violations:C,...T?{suggestedValue:T}:{}}}}return p.setAtomValue(t,E?Rt(i,d):d),{ok:true,...o!==void 0?{path:o}:{},...m.length?{keyed:m}:{},...y.length?{unchecked:y.map(w=>`\`${w}\` was empty, so nothing knows what its items look like and the shape of what you added was NOT checked.`)}:{}}}}});export{nr as JOTAI_ICON_COLOR,pt as JotaiAtomChangeItem,Vt as JotaiAtomDetailContent,Tt as JotaiAtomDetailFooter,Bt as JotaiAtomValueDetailContent,Ke as JotaiIcon,Ne as JotaiModal,or as JotaiToolView,lr as createJotaiTool,gr as isAtomWatched,p as jotaiStateStore,Lr as jotaiSyncAdapter,$t as jotaiToolPreset,ft as useJotaiAtomChanges,Pt as watchAtoms,hr as watchDefaultStoreAtoms};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/jotai",
3
- "version": "7.0.41",
3
+ "version": "7.0.43",
4
4
  "description": "Inspect registered Jotai atoms, observed writes, retained history and current values in a React Native app.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -38,15 +38,12 @@
38
38
  "./lib/web/**/*.mjs"
39
39
  ],
40
40
  "dependencies": {
41
- "@buoy-gg/shared-ui": "^7.0.41",
42
- "@buoy-gg/license": "^7.0.41"
41
+ "@buoy-gg/shared-ui": "^7.0.43",
42
+ "@buoy-gg/license": "^7.0.43"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "jotai": ">=2.0.0",
46
- "react": "*",
47
- "react-native": "*",
48
- "react-native-web": "^0.21.0",
49
- "react-dom": ">=18"
46
+ "react": "*"
50
47
  },
51
48
  "devDependencies": {
52
49
  "@types/react": "^19.1.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,gCAAgC,CAAC;AAKxC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAK5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAKtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAKlE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAOnF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAK3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAKvB,gBAAgB;AAChB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"JotaiAtomBrowser.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomBrowser.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,UAAU,qBAAqB;IAC7B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAuDD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,WAAW,EACX,UAAU,GACX,EAAE,qBAAqB,+BA4FvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"JotaiAtomChangeItem.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomChangeItem.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,UAAU,CAAC;AAGpE,UAAU,wBAAwB;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAgED,eAAO,MAAM,mBAAmB,gEAwB9B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"JotaiAtomDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAA+C,MAAM,OAAO,CAAC;AA6BpE,OAAO,KAAK,EACV,eAAe,EAEf,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAwOlB,UAAU,2BAA2B;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,qBAA6B,EAC7B,WAAsB,GACvB,EAAE,2BAA2B,qBAkL7B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,GACd,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,4BAcA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"JotaiAtomValueDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiAtomValueDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA2BH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAoE9C,UAAU,gCAAgC;IACxC,IAAI,EAAE,aAAa,CAAC;IACpB,kEAAkE;IAClE,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,IAAI,EACJ,aAAa,GACd,EAAE,gCAAgC,+BA6OlC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"JotaiEventFilterView.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiEventFilterView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,UAAU,yBAAyB;IACjC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAQD,wBAAgB,oBAAoB,CAAC,EACnC,eAAe,EACf,eAAe,EACf,YAAY,EACZ,KAAK,GACN,EAAE,yBAAyB,+BAqB3B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"JotaiIcon.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiIcon.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"JotaiModal.d.ts","sourceRoot":"","sources":["../../../../src/jotai/components/JotaiModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8CH,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAsCjE,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,2BAAmC,EACnC,MAAc,EACd,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,YAAY,GACb,EAAE,eAAe,sCAuqBjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,GAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAM,+BAGpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useJotaiAtomChanges.d.ts","sourceRoot":"","sources":["../../../../src/jotai/hooks/useJotaiAtomChanges.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5E,MAAM,WAAW,yBAAyB;IACxC,gCAAgC;IAChC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,+CAA+C;IAC/C,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,8BAA8B;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,6BAA6B;IAC7B,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7D,wCAAwC;IACxC,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,yBAAyB,EAAE,MAAM,CAAC;QAClC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,2BAA2B;IAC3B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,iCAAiC;IACjC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,uBAAuB;IACvB,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;CAC5D;AA8BD,wBAAgB,mBAAmB,IAAI,yBAAyB,CAwC/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jotaiSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/jotai/sync/jotaiSyncAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAqBhD;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;EAG3B,CAAC;AAmFF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;IAiBzB;;;;OAIG;;;;;IAQH;;;OAGG;4BACqB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsC/B;;;;;OAKG;yBACkB,OAAO;;;;;;;;;;;;;;;IAsC5B;;;;;;;;;;;;;;;OAeG;uBACgB,OAAO;;;;;;;;;;;;;;;EAiEF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/jotai/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IAGxB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAChC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,6EAA6E;IAC7E,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;IACxC;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACnD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jotaiStateStore.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/jotaiStateStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAuClB,cAAM,eAAgB,SAAQ,SAAS,CAAC,eAAe,CAAC;IACtD,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,aAAa,CAAoD;IAIzE,aAAa,CAAC,MAAM,EAAE;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;KAC/B,GAAG,IAAI;IAsCR,cAAc,IAAI,eAAe,EAAE;IAInC,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI1D,gBAAgB,IAAI,IAAI;IAUxB;;;;OAIG;IACH,gBAAgB,IAAI,iBAAiB,EAAE;IAkBvC;;;;;OAKG;IACH,mBAAmB,CACjB,OAAO,EAAE,eAAe,EAAE,EAC1B,aAAa,EAAE,iBAAiB,EAAE,GACjC,IAAI;IAoEP;;;OAGG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAIhE;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI;IAY5D,YAAY,CACV,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,OAAO,EACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EACnC,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAC7B,IAAI;IAgBP;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAWjD,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKnC,QAAQ,IAAI,aAAa,EAAE;IAI3B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIjD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAMnC,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,EAAE;IA4BzD,QAAQ;;;;;;IAYR,mBAAmB,IAAI,MAAM,EAAE;IAM/B,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMhC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI;IAKxE,OAAO,CAAC,mBAAmB;CAI5B;AAED,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshotProvider.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/snapshotProvider.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"testIDs.d.ts","sourceRoot":"","sources":["../../../../src/jotai/utils/testIDs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,+CAA+C;AAC/C,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOpD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,EAAE,GACzB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CASrB"}