@buoy-gg/zustand 7.0.41 → 7.0.42
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.
- package/README.md +11 -76
- package/lib/commonjs/index.js +1 -105
- package/lib/commonjs/preset.js +1 -102
- package/lib/commonjs/zustand/components/ZustandActionButton.js +1 -118
- package/lib/commonjs/zustand/components/ZustandDetailViewToggle.js +1 -48
- package/lib/commonjs/zustand/components/ZustandEventFilterView.js +1 -43
- package/lib/commonjs/zustand/components/ZustandIcon.js +1 -18
- package/lib/commonjs/zustand/components/ZustandModal.js +1 -772
- package/lib/commonjs/zustand/components/ZustandStateChangeItem.js +1 -117
- package/lib/commonjs/zustand/components/ZustandStateDetailContent.js +1 -372
- package/lib/commonjs/zustand/components/ZustandStateInfoView.js +1 -488
- package/lib/commonjs/zustand/components/ZustandStoreBrowser.js +1 -204
- package/lib/commonjs/zustand/components/ZustandStoreDetailContent.js +1 -471
- package/lib/commonjs/zustand/hooks/useZustandStateChanges.js +1 -74
- package/lib/commonjs/zustand/sync/zustandSyncAdapter.js +1 -418
- package/lib/commonjs/zustand/types/index.js +1 -1
- package/lib/commonjs/zustand/utils/buoyZustandMiddleware.js +1 -284
- package/lib/commonjs/zustand/utils/editableState.js +1 -146
- package/lib/commonjs/zustand/utils/snapshotProvider.js +1 -209
- package/lib/commonjs/zustand/utils/testIDs.js +1 -82
- package/lib/commonjs/zustand/utils/zustandStateStore.js +1 -379
- package/lib/module/index.js +1 -90
- package/lib/module/preset.js +1 -98
- package/lib/module/zustand/components/ZustandActionButton.js +1 -114
- package/lib/module/zustand/components/ZustandDetailViewToggle.js +1 -43
- package/lib/module/zustand/components/ZustandEventFilterView.js +1 -39
- package/lib/module/zustand/components/ZustandIcon.js +1 -11
- package/lib/module/zustand/components/ZustandModal.js +1 -767
- package/lib/module/zustand/components/ZustandStateChangeItem.js +1 -113
- package/lib/module/zustand/components/ZustandStateDetailContent.js +1 -368
- package/lib/module/zustand/components/ZustandStateInfoView.js +1 -483
- package/lib/module/zustand/components/ZustandStoreBrowser.js +1 -200
- package/lib/module/zustand/components/ZustandStoreDetailContent.js +1 -469
- package/lib/module/zustand/hooks/useZustandStateChanges.js +1 -70
- package/lib/module/zustand/sync/zustandSyncAdapter.js +1 -415
- package/lib/module/zustand/types/index.js +1 -1
- package/lib/module/zustand/utils/buoyZustandMiddleware.js +1 -278
- package/lib/module/zustand/utils/editableState.js +1 -138
- package/lib/module/zustand/utils/snapshotProvider.js +1 -209
- package/lib/module/zustand/utils/testIDs.js +1 -74
- package/lib/module/zustand/utils/zustandStateStore.js +1 -375
- package/lib/web/index.mjs +2 -3
- package/package.json +3 -3
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandActionButton.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandDetailViewToggle.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandEventFilterView.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandIcon.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandModal.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStateChangeItem.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStateDetailContent.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStateInfoView.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStoreBrowser.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStoreDetailContent.d.ts.map +0 -1
- package/lib/typescript/zustand/hooks/useZustandStateChanges.d.ts.map +0 -1
- package/lib/typescript/zustand/sync/zustandSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/zustand/types/index.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/buoyZustandMiddleware.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/editableState.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/snapshotProvider.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/testIDs.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/zustandStateStore.d.ts.map +0 -1
package/lib/web/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var Bt=Object.defineProperty;var _o=Object.getOwnPropertyDescriptor;var jo=Object.getOwnPropertyNames;var Ko=Object.prototype.hasOwnProperty;var Uo=(e,t)=>{for(var o in t)Bt(e,o,{get:t[o],enumerable:!0})},Et=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jo(t))!Ko.call(e,r)&&r!==o&&Bt(e,r,{get:()=>t[r],enumerable:!(n=_o(t,r))||n.enumerable});return e},R=(e,t,o)=>(Et(e,t,"default"),o&&Et(o,t,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{classifyPreviewItem as tn,createRestoreScope as on,emptyRestoreResult as nn,failedRestore as rn,registerStateSnapshotProvider as an,unionKeys as sn}from"@buoy-gg/shared-ui/web";import{ChangeLog as Go,entityColor as Jo,formatValuePreview as Yo,shallowDiffSummary as Xo}from"@buoy-gg/shared-ui/web";var qo={counter:"#10B981",auth:"#8B5CF6",user:"#3B82F6",cart:"#EC4899",app:"#6366F1",ui:"#F59E0B",settings:"#14B8A6",theme:"#06B6D4",navigation:"#F97316",form:"#EF4444"};function At(e){return Jo(e,qo)}function Qo(e,t=40){return Yo(e,{maxLength:t,undefinedLabel:"",functionLabel:"(updater fn)"})}var et=class extends Go{constructor(){super(...arguments);this.stores=new Map;this.storeListeners=new Set;this.remoteSetStateHandler=null}addStateChange(o){if(!this.canRecord())return;let{storeName:n,partial:r,replace:a,prevState:i,nextState:s,duration:l,category:g,isPersisted:S=!1}=o,T=i!==s,{summary:f,changedKeys:p,changedCount:y}=Xo(i,s),B=Qo(r),V=(l??0)>16,K=g??(a?"replace":"setState"),H={id:this.nextId(),storeName:n,timestamp:Date.now(),prevState:i,nextState:s,partial:r,duration:l,hasStateChange:T,replace:a,category:K,changedKeys:p,changedKeysCount:y,diffSummary:f,partialPreview:B,isSlowUpdate:V,isPersisted:S};this.push(H);let se=this.stores.get(n);se&&se.stateChangeCount++,this.notifyListeners()}getStateChanges(){return this.getAll()}getStateChangeById(o){return this.getById(o)}clearStateChanges(){for(let o of this.stores.values())o.stateChangeCount=0;this.clear(),this.notifyStoreListeners()}replaceStateChanges(o){if(!this.getEnabled())return;for(let r of this.stores.values())r.stateChangeCount=0;let n=o.slice(0,this.max);for(let r of n){let a=this.stores.get(r.storeName);a&&a.stateChangeCount++}this.setItems(n),this.notifyStoreListeners()}getStoreSnapshots(){return Array.from(this.stores.values()).map(o=>{let n;try{n=o.api.getState()}catch{n=void 0}return{name:o.name,stateChangeCount:o.stateChangeCount,isPersisted:o.isPersisted,persistName:o.persistName,canRehydrate:typeof o.rehydrate=="function",color:o.color,currentState:n}})}setRemoteSetStateHandler(o){this.remoteSetStateHandler=o}replaceFromSnapshot(o,n){if(!this.getEnabled())return;let r=new Map;for(let s of this.items){let l=s.prevState;(!l||l.__buoyStateOnDevice!==!0)&&r.set(s.id,s)}let a=o.slice(0,this.max).map(s=>{let l=r.get(s.id),g=s.prevState;return l&&g?.__buoyStateOnDevice===!0?{...s,prevState:l.prevState,nextState:l.nextState,partial:l.partial}:s}),i=new Map;for(let[s,l]of this.stores)try{let g=l.api.getState(),S=g;(!S||S.__buoyStateOnDevice!==!0)&&i.set(s,g)}catch{}this.stores=new Map(n.map(s=>{let l=s.currentState,g=i.get(s.name),S=g!==void 0&&l?.__buoyStateOnDevice===!0?g:s.currentState;return[s.name,{name:s.name,api:{getState:()=>S,setState:(T,f)=>{this.remoteSetStateHandler?.(s.name,T,f)},subscribe:()=>()=>{}},stateChangeCount:s.stateChangeCount,isPersisted:s.isPersisted,persistName:s.persistName,color:s.color}]})),this.setItems(a),this.notifyStoreListeners()}hydrateChange(o,n){this.hydrateById(o,n)}hydrateStoreState(o,n){let r=this.stores.get(o);r&&(this.stores.set(o,{...r,api:{...r.api,getState:()=>n}}),this.notifyStoreListeners())}registerStore(o,n,r){if(this.stores.has(o))return;let a={name:o,api:n,stateChangeCount:0,isPersisted:r?.isPersisted??!1,persistName:r?.persistName,rehydrate:r?.rehydrate,color:At(o)};this.stores.set(o,a),this.notifyStoreListeners()}unregisterStore(o){this.stores.delete(o),this.notifyStoreListeners()}getStores(){return Array.from(this.stores.values())}getStore(o){return this.stores.get(o)}getStoreColor(o){return this.stores.get(o)?.color??At(o)}filterStateChanges(o){let n=this.getAll();if(o.searchText){let r=o.searchText.toLowerCase();n=n.filter(a=>a.storeName.toLowerCase().includes(r)||a.partialPreview.toLowerCase().includes(r)||a.changedKeys.some(i=>i.toLowerCase().includes(r)))}return o.storeNames&&o.storeNames.length>0&&(n=n.filter(r=>o.storeNames.includes(r.storeName))),o.onlyWithChanges&&(n=n.filter(r=>r.hasStateChange)),n}getStats(){let o=this.items.length,n=this.items.filter(s=>s.hasStateChange).length,r=this.stores.size,a=this.items.filter(s=>s.duration!==void 0).map(s=>s.duration),i=a.length>0?a.reduce((s,l)=>s+l,0)/a.length:0;return{totalChanges:o,changesWithStateChange:n,changesWithoutStateChange:o-n,storeCount:r,averageDuration:Math.round(i*100)/100}}getUniqueStoreNames(){return Array.from(this.stores.keys()).sort()}setMaxChanges(o){this.setMax(o)}subscribeToStores(o){return this.storeListeners.add(o),()=>{this.storeListeners.delete(o)}}notifyStoreListeners(){let o=this.getStores();this.storeListeners.forEach(n=>n(o))}},h=new et;function U(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function me(e,t,o,n,r){if(typeof e=="function"){o.push(t);return}if(typeof e!="object"||e===null||r>=8)return e;if(n.has(e))return;if(n.add(e),Array.isArray(e))return e.map((i,s)=>typeof i=="function"?(o.push(`${t}[${s}]`),null):me(i,`${t}[${s}]`,o,n,r+1));if(!U(e))return e;let a={};for(let[i,s]of Object.entries(e)){if(typeof s=="function"){o.push(t?`${t}.${i}`:i);continue}a[i]=me(s,t?`${t}.${i}`:i,o,n,r+1)}return a}function tt(e){if(U(e)&&e.__buoyStateOnDevice===!0)return{data:null,fnPaths:[],blockedReason:"Store state hasn't synced from the device yet."};if(!U(e))return{data:null,fnPaths:[],blockedReason:"Only stores whose state is a plain object can be edited \u2014 a merge write has nothing to address in "+(Array.isArray(e)?"an array":`a ${typeof e}`)+"."};let t=[],o=me(e,"",t,new WeakSet,0),n=t.filter(r=>r.includes(".")||r.includes("["));return n.length>0?{data:null,fnPaths:t,blockedReason:`State keeps a function inside "${n[0]}" \u2014 a merge write of that key would drop it, so this store can't be edited here.`}:{data:o,fnPaths:t,blockedReason:null}}function Nt(e,t){if(!U(t))throw new Error("The store's state must stay an object.");let o=Object.keys(e).filter(r=>!(r in t));if(o.length>0)throw new Error(`Can't remove top-level ${o.length===1?"key":"keys"} ${o.map(r=>`"${r}"`).join(", ")} \u2014 zustand merge writes can't delete. Edit the value instead.`);let n={};for(let r of Object.keys(t))(!(r in e)||JSON.stringify(t[r])!==JSON.stringify(e[r]))&&(n[r]=t[r]);return n}var $t=8;function Lt(e,t,o,n){if(!(!U(t)||!U(e))&&!(n>=$t||o.has(t))){o.add(t);for(let[r,a]of Object.entries(t))if(typeof a=="function")e[r]=a;else if(U(a)){if(!U(e[r])){if(!Ot(a,new WeakSet,n+1))continue;e[r]={}}Lt(e[r],a,o,n+1)}}}function Ot(e,t,o){if(o>=$t||t.has(e))return!1;t.add(e);for(let n of Object.values(e))if(typeof n=="function"||U(n)&&Ot(n,t,o+1))return!0;return!1}function ln(){return h.getStores().length===0?{canCapture:!1,canRestore:!1,detail:"No Zustand stores registered \u2014 pass `zustandStores` to FloatingDevTools or add the buoyDevTools middleware"}:{canCapture:!0,canRestore:!0}}async function dn(){let e=[],t={};for(let o of h.getStores()){let n=[],r;try{r=me(o.api.getState(),"",n,new WeakSet,0)}catch(a){e.push(`store "${o.name}": capture failed (${String(a)})`);continue}t[o.name]={state:r,fnPaths:n}}return{data:{stores:t},warnings:e}}async function cn(e,t){let o=e,n=on(t),r=nn();if(!o?.stores)return rn("empty zustand snapshot");for(let[i,s]of Object.entries(o.stores)){if(!n.allows(i))continue;let l=h.getStore(i);if(!l){r.skipped.push({id:i,reason:"store not registered (renamed, or created after snapshot?)"});continue}try{let g=s.state;Lt(g,l.api.getState(),new WeakSet,0),l.api.setState(g,!0),l.api.getState()===g?r.applied+=1:(r.warnings.push(`store "${i}": setState did not take effect`),r.ok=!1)}catch(g){r.skipped.push({id:i,reason:String(g)}),r.ok=!1}}let a=n.excludedWarning("store(s)");return a&&r.warnings.push(a),r}async function un(e,t){let o=e?.stores??{},n=t===void 0,r={};if(n)for(let l of h.getStores()){let g=[];try{r[l.name]={state:me(l.api.getState(),"",g,new WeakSet,0),fnPaths:g}}catch{}}else Object.assign(r,t?.stores??{});let a=[],i=[],s=0;for(let l of sn(r,o)){let g=l in o,S=l in r;if(!g){n?i.push(`store "${l}" not in snapshot \u2014 untouched`):a.push({key:l,label:l,verdict:"removed",oldValue:r[l].state});continue}if(s+=o[l].fnPaths?.length??0,n&&!h.getStore(l)){a.push({key:l,label:l,verdict:"wont-apply",reason:"store not registered (renamed, or created after snapshot?)"});continue}a.push(tn({key:l,label:l,oldValue:r[l]?.state,newValue:o[l].state,inOld:S,inNew:!0},{tooLargeReason:"store too large to render a diff \u2014 restore still applies it"}))}return s>0&&i.push(`${s} store action function${s===1?"":"s"} preserved on restore (not diffed)`),{items:a,notes:i}}an({id:"zustand",label:"Zustand",status:ln,capture:dn,restore:cn,previewItems:un});import{useState as ae,useMemo as de,useRef as _e,useCallback as L,useEffect as ao}from"react";var v={};Uo(v,{AccessibilityInfo:()=>In,ActivityIndicator:()=>wn,Alert:()=>xn,Animated:()=>Dn,AppRegistry:()=>Vn,AppState:()=>Zn,Appearance:()=>Pn,BackHandler:()=>Rn,Button:()=>Cn,CheckBox:()=>Un,Clipboard:()=>En,DeviceEventEmitter:()=>lr,Dimensions:()=>Bn,Easing:()=>An,FlatList:()=>Be,I18nManager:()=>Nn,Image:()=>Gn,ImageBackground:()=>Jn,InteractionManager:()=>Ln,Keyboard:()=>$n,KeyboardAvoidingView:()=>Yn,LayoutAnimation:()=>On,Linking:()=>zn,LogBox:()=>ir,Modal:()=>yn,NativeEventEmitter:()=>Wn,NativeModules:()=>kn,PanResponder:()=>Mn,Picker:()=>Xn,PixelRatio:()=>Hn,Platform:()=>Fn,Pressable:()=>mn,ProgressBar:()=>qn,RefreshControl:()=>Qn,SafeAreaView:()=>er,ScrollView:()=>ne,SectionList:()=>tr,Share:()=>_n,StatusBar:()=>or,StyleSheet:()=>G,Switch:()=>bn,Text:()=>b,TextInput:()=>pn,Touchable:()=>nr,TouchableHighlight:()=>hn,TouchableNativeFeedback:()=>rr,TouchableOpacity:()=>q,TouchableWithoutFeedback:()=>Sn,UIManager:()=>jn,Vibration:()=>Kn,View:()=>c,VirtualizedList:()=>ar,YellowBox:()=>sr,findNodeHandle:()=>Tn,unstable_createElement:()=>vn,useColorScheme:()=>dr,useLocaleContext:()=>cr,useWindowDimensions:()=>ur});R(v,Es);import*as Es from"react-native-web";import{unstable_createElement as vn,NativeModules as kn,AccessibilityInfo as In,Animated as Dn,Appearance as Pn,AppRegistry as Vn,AppState as Zn,BackHandler as Rn,Clipboard as En,Dimensions as Bn,Easing as An,I18nManager as Nn,Keyboard as $n,InteractionManager as Ln,LayoutAnimation as On,Linking as zn,NativeEventEmitter as Wn,PanResponder as Mn,PixelRatio as Hn,Platform as Fn,Share as _n,StyleSheet as G,UIManager as jn,Vibration as Kn,CheckBox as Un,FlatList as Be,Image as Gn,ImageBackground as Jn,KeyboardAvoidingView as Yn,Picker as Xn,ProgressBar as qn,RefreshControl as Qn,SafeAreaView as er,SectionList as tr,StatusBar as or,Touchable as nr,TouchableNativeFeedback as rr,VirtualizedList as ar,YellowBox as sr,LogBox as ir,DeviceEventEmitter as lr,useColorScheme as dr,useLocaleContext as cr,useWindowDimensions as ur}from"react-native-web";import*as I from"react-native-web";import{createElement as gn,forwardRef as fn}from"react";function J(e){let t=fn((n,r)=>{let{accessibilityState:a,accessibilityValue:i,...s}=n;for(let l of["busy","checked","disabled","expanded","selected"])a?.[l]!==void 0&&s[`aria-${l}`]===void 0&&(s[`aria-${l}`]=a[l]);for(let[l,g]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[l]!==void 0&&s[`aria-${g}`]===void 0&&(s[`aria-${g}`]=i[l]);return gn(e,{...s,ref:r})}),o=e.State;return o&&Object.assign(t,{State:o}),t.displayName=e.displayName??e.name??"NativeWebView",t}var c=J(I.View),b=J(I.Text),pn=J(I.TextInput),q=J(I.TouchableOpacity),hn=J(I.TouchableHighlight),Sn=J(I.TouchableWithoutFeedback),mn=J(I.Pressable),ne=J(I.ScrollView),yn=J(I.Modal),bn=J(I.Switch),wn=J(I.ActivityIndicator),Cn=J(I.Button),Tn=I.findNodeHandle,xn={alert(e,t,o,n){if(typeof document>"u")return;let r=document.createElement("dialog");r.dataset.buoyRoot="",r.setAttribute("aria-label",e),r.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 a=document.createElement("h2");if(a.textContent=e,a.style.cssText="font-size:18px;margin:0 0 12px",r.appendChild(a),t){let g=document.createElement("p");g.textContent=t,g.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",r.appendChild(g)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let s=o?.length?o:[{text:"OK"}],l=()=>{r.close?.(),r.remove()};for(let g of s){let S=document.createElement("button");S.type="button",S.textContent=g.text??"OK",S.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${g.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,S.onclick=()=>{l(),g.onPress?.()},i.appendChild(S)}r.addEventListener("cancel",g=>{g.preventDefault(),n?.cancelable!==!1&&(l(),n?.onDismiss?.())}),r.appendChild(i),document.body.appendChild(r),r.showModal?r.showModal():r.setAttribute("open","")}};import{JsModal as Za,ModalHeader as O,TabSelector as Ra,macOSColors as Ea,night as M,ToolEmptyState as St,resolveListEmptyState as co,Search as Ba,Filter as Aa,Power as Na,Lock as $a,devToolsStorageKeys as La,ProUpgradeModal as Oa,PowerToggleButton as za,ToolbarCopyButton as ht,ToolbarClearButton as Wa,truncatePayload as we,TickProvider as so,useLimit as Ma,windowDragProps as Ha,EVENT_LIST_PRESET as io}from"@buoy-gg/shared-ui/web";import{useIsPro as Fa}from"@buoy-gg/license/web";import{useCallback as gr,useMemo as zt}from"react";import{useChangeLog as fr,useSubscribedValue as pr}from"@buoy-gg/shared-ui/web";function hr(e,t){let o=e;if(t.searchText){let n=t.searchText.toLowerCase();o=o.filter(r=>r.storeName.toLowerCase().includes(n)||r.partialPreview.toLowerCase().includes(n)||r.changedKeys.some(a=>a.toLowerCase().includes(n)))}return t.storeNames&&t.storeNames.length>0&&(o=o.filter(n=>t.storeNames.includes(n.storeName))),t.onlyWithChanges&&(o=o.filter(n=>n.hasStateChange)),o}var Sr=()=>h.getStores(),mr=e=>h.subscribeToStores(e);function ot(){let e=fr(h,{filterItems:hr}),t=pr(Sr,mr),o=zt(()=>{let a=e.items.length,i=e.items.filter(s=>s.hasStateChange).length;return{totalChanges:a,changesWithStateChange:i,changesWithoutStateChange:a-i,storeCount:t.length,averageDuration:0}},[e.items,t]),n=zt(()=>h.getUniqueStoreNames(),[t]),r=gr(a=>h.getStateChangeById(a),[]);return{stateChanges:e.items,filteredChanges:e.filteredItems,filter:e.filter,setFilter:e.setFilter,stats:o,stores:t,clearChanges:h.clearStateChanges.bind(h),isEnabled:e.isEnabled,toggleCapture:e.toggleCapture,storeNames:n,getChangeById:r}}import{memo as yr}from"react";import{ChangeRow as br,buoyColors as Wt,night as wr}from"@buoy-gg/shared-ui/web";import{jsx as Ir}from"react/jsx-runtime";function Cr(e,t){switch(e){case"replace":return"Replace";case"persist":return"Hydrate";case"initial":return"Initial";default:return t.charAt(0).toUpperCase()+t.slice(1)}}function Tr(e,t){switch(e){case"replace":return Wt.warning;case"persist":return Wt.info;case"initial":return wr.color.textTertiary;default:return h.getStoreColor(t)}}function xr(e){let t=[];return e.duration!==void 0&&e.duration>=.1&&t.push(`${e.duration.toFixed(1)}ms`),e.hasStateChange?e.changedKeysCount>0?t.push(`${e.changedKeysCount} key${e.changedKeysCount>1?"s":""} changed`):t.push(e.diffSummary||"state changed"):t.push("no state change"),t.join(" \xB7 ")}function vr(e){return e.category==="replace"?"REPLACE":e.category==="persist"?"HYDRATE":e.category==="initial"?"INIT":"SET"}function kr(e){return 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.partialPreview||"setState()"}var nt=yr(function({change:t,onPress:o,testID:n}){let r=Tr(t.category,t.storeName),a=Cr(t.category,t.storeName),i=xr(t),s=kr(t),l=vr(t);return Ir(br,{statusColor:r,statusLabel:a,sublabel:i,primaryText:s,timestamp:t.timestamp,badgeText:l,changed:t.hasStateChange,slow:t.isSlowUpdate,onPress:()=>o(t),testID:n})});import{useState as Gt,useCallback as Oe,useMemo as Jt}from"react";import{night as le,EventStepperFooter as qt,formatRelativeTime as We,parseValue as ze,monoFont as Pe}from"@buoy-gg/shared-ui/web";import{DataViewer as ea,SplitDiffViewer as ta,TreeDiffViewer as oa,diffThemes as na}from"@buoy-gg/shared-ui/web/dataViewer";import{memo as Dr}from"react";import{DetailViewToggle as Pr,FileText as Vr,Database as Zr,GitBranch as Rr}from"@buoy-gg/shared-ui/web";import{jsx as Ar}from"react/jsx-runtime";var Er=[{key:"change",label:"CHANGE",description:"View change details",icon:Vr},{key:"state",label:"STATE",description:"View current state",icon:Zr},{key:"diff",label:"DIFF",description:"Compare changes",icon:Rr}],Br=["diff"],Mt=Dr(function({activeView:t,onViewChange:o,diffDisabled:n=!1}){return Ar(Pr,{views:Er,activeView:t,onViewChange:o,disabledKeys:n?Br:void 0,testIDPrefix:"buoy-zustand"})});import{memo as zr,useCallback as at,useState as Wr,useEffect as Mr}from"react";import{buoyColors as F,night as P,Clock as Hr,AlertTriangle as Fr,Zap as _t,Info as _r,Box as jt,Database as jr,parseValue as Kr,ProUpgradeModal as Ur,copyToClipboard as Gr,InfoRow as Kt,monoFont as ye}from"@buoy-gg/shared-ui/web";import{useIsPro as Jr}from"@buoy-gg/license/web";import{DataViewer as Yr}from"@buoy-gg/shared-ui/web/dataViewer";import{night as E,monoFont as Nr}from"@buoy-gg/shared-ui/web";import{jsx as Ht,jsxs as Lr}from"react/jsx-runtime";var $r={copy:{color:E.color.accent,backgroundColor:E.color.accentSoft,borderColor:E.color.accentBorder,textColor:E.color.accent},reset:{color:E.color.warning,backgroundColor:E.color.warningSoft,borderColor:E.color.warning+"40",textColor:E.color.warning},clear:{color:E.color.danger,backgroundColor:E.color.dangerSoft,borderColor:E.color.danger+"40",textColor:E.color.danger},jump:{color:E.color.warning,backgroundColor:E.color.warningSoft,borderColor:E.color.warning+"40",textColor:E.color.warning}};function Ae({onPress:e,text:t,type:o,disabled:n=!1,testID:r}){let a=$r[o];return Lr(q,{disabled:n,onPress:e,style:[rt.button,{backgroundColor:n?E.color.textTertiary+"1A":a.backgroundColor,borderColor:n?E.color.textTertiary+"33":a.borderColor,opacity:n?.5:1}],activeOpacity:.7,testID:r,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:n},children:[Ht(c,{style:[rt.dot,{backgroundColor:n?E.color.textTertiary:a.color}]}),Ht(b,{style:[rt.text,{color:n?E.color.textTertiary:a.textColor}],children:t})]})}var rt=G.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:6,borderWidth:1,paddingHorizontal:12,paddingVertical:6,height:25,minWidth:80,shadowOffset:{width:0,height:1},shadowOpacity:.2,shadowRadius:2,elevation:2},dot:{width:5,height:5,borderRadius:3,marginRight:6,shadowColor:E.color.text,shadowOffset:{width:0,height:0},shadowOpacity:.6,shadowRadius:2},text:{fontSize:10,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:Nr,height:12}});var u="buoy-zustand";function Ne(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function Or(e,t){return`${u}-row-${Ne(e)}-${t}`}function $e(e){return`${u}-store-${Ne(e)}`}function Ft(e){let t=new Map,o=new Map;for(let n of e){let r=(t.get(n.storeName)??0)+1;t.set(n.storeName,r),o.set(n.id,Or(n.storeName,r))}return o}import{jsx as C,jsxs as _}from"react/jsx-runtime";function Xr(e){switch(e){case"replace":return{label:"REPLACE",color:F.warning,bgColor:F.warning+"26"};case"persist":return{label:"PERSIST",color:F.info,bgColor:F.info+"26"};case"initial":return{label:"INITIAL",color:P.color.textTertiary,bgColor:P.color.textTertiary+"26"};default:return{label:"SET STATE",color:F.success,bgColor:F.success+"26"}}}function qr(e){return e===void 0?"N/A":e<1?"<1ms":`${e.toFixed(1)}ms`}function Le({icon:e,title:t,badge:o,testID:n}){return _(c,{style:w.sectionHeader,testID:n,children:[_(c,{style:w.sectionHeaderLeft,children:[C(e,{size:14,color:P.color.accent}),C(b,{style:w.sectionTitle,children:t})]}),o]})}function Qr(e){let t=new Date(e),o=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),r=t.getSeconds().toString().padStart(2,"0"),a=t.getMilliseconds().toString().padStart(3,"0");return`${o}:${n}:${r}.${a}`}var Ut=zr(function({change:t}){let o=Jr(),[n,r]=Wr(!1);Mr(()=>{n&&o&&r(!1)},[n,o]);let a=Xr(t.category),i=t.partial!==void 0&&t.partial!=="(updater fn)",s=t.changedKeys.length>0,l=h.getStoreColor(t.storeName),g=at(async()=>{if(!o){r(!0);return}await Gr(t.nextState)},[t.nextState,o]),S=at(()=>{let f=h.getStore(t.storeName);if(f?.api.getInitialState){let p=f.api.getInitialState();f.api.setState(p,!0)}},[t.storeName]),T=at(()=>{let f=h.getStore(t.storeName);f&&f.api.setState(t.nextState,!0)},[t.storeName,t.nextState]);return _(ne,{style:w.container,contentContainerStyle:w.contentContainer,showsVerticalScrollIndicator:!1,testID:`${u}-detail-scroll`,children:[_(c,{style:w.card,testID:`${u}-info-card`,children:[C(Le,{icon:_r,title:"CHANGE INFO"}),_(c,{style:w.cardContent,children:[C(Kt,{label:"Store",value:t.storeName,mono:!0,valueColor:l,testID:`${u}-info-store`}),C(Kt,{label:"Time",value:Qr(t.timestamp),mono:!0,testID:`${u}-info-time`}),_(c,{style:w.badgeRow,children:[C(c,{style:[w.categoryBadge,{backgroundColor:a.bgColor}],children:C(b,{style:[w.categoryText,{color:a.color}],testID:`${u}-info-category`,children:a.label})}),_(c,{style:[w.durationBadge,t.isSlowUpdate&&w.durationBadgeSlow],children:[C(Hr,{size:10,color:t.isSlowUpdate?F.error:P.color.textSecondary}),C(b,{style:[w.durationText,t.isSlowUpdate&&w.durationTextSlow],testID:`${u}-info-duration`,children:qr(t.duration)}),t.isSlowUpdate&&C(Fr,{size:10,color:F.error})]}),t.hasStateChange?_(c,{style:w.changesBadge,children:[C(_t,{size:10,color:F.success}),C(b,{style:w.changesText,testID:`${u}-info-changes`,children:t.diffSummary||"changed"})]}):C(c,{style:w.noChangesBadge,children:C(b,{style:w.noChangesText,testID:`${u}-info-no-changes`,children:"no change"})}),t.isPersisted&&_(c,{style:w.persistBadge,children:[C(jr,{size:10,color:F.info}),C(b,{style:w.persistText,testID:`${u}-info-persisted`,children:"PERSISTED"})]})]})]})]}),s&&_(c,{style:w.card,testID:`${u}-keys-card`,children:[C(Le,{icon:_t,title:"CHANGED KEYS",badge:C(c,{style:w.countBadge,children:C(b,{style:w.countText,testID:`${u}-keys-count`,children:t.changedKeys.length})})}),C(c,{style:w.cardContent,children:C(c,{style:w.keysContainer,children:t.changedKeys.map(f=>C(c,{style:w.keyBadge,children:C(b,{style:w.keyText,testID:`${u}-key-${f}`,children:f})},f))})})]}),i&&_(c,{style:w.card,testID:`${u}-partial-card`,children:[C(Le,{icon:jt,title:"PARTIAL (setState argument)",badge:C(c,{style:w.typeBadge,children:C(b,{style:w.typeText,testID:`${u}-partial-type`,children:Array.isArray(t.partial)?"ARRAY":typeof t.partial=="object"?"OBJECT":(typeof t.partial).toUpperCase()})})}),C(c,{style:w.dataViewerContainer,children:C(Yr,{title:"",data:Kr(t.partial),showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]}),t.partial==="(updater fn)"&&_(c,{style:w.card,testID:`${u}-updater-card`,children:[C(Le,{icon:jt,title:"SET STATE CALL"}),_(c,{style:w.cardContent,children:[C(b,{style:w.updaterText,children:"Called with an updater function: set((state) => ...)"}),C(b,{style:w.updaterSubtext,children:"The partial value is computed at runtime from the previous state. See the DIFF tab to view the resulting changes."})]})]}),_(c,{style:w.actionsGrid,children:[C(Ae,{type:"jump",text:"JUMP",onPress:T,testID:`${u}-jump`}),C(Ae,{type:"reset",text:"RESET STORE",onPress:S,testID:`${u}-reset`}),C(Ae,{type:"copy",text:"COPY STATE",onPress:g,testID:`${u}-copy-state`})]}),C(Ur,{visible:n,onClose:()=>r(!1),featureName:"Copy"})]})}),w=G.create({container:{flex:1},contentContainer:{padding:8,paddingBottom:100,gap:16},card:{backgroundColor:P.color.surface,borderRadius:6,borderWidth:1,borderColor:P.color.accentBorderStrong,overflow:"hidden",shadowColor:P.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:P.color.accentBorder,backgroundColor:P.color.accentSoft},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:6},sectionTitle:{fontSize:12,fontWeight:"600",letterSpacing:.5,color:P.color.accent,fontFamily:ye},cardContent:{padding:14,gap:10},badgeRow:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},categoryBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4},categoryText:{fontSize:9,fontWeight:"700",letterSpacing:.3},durationBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:P.color.surfaceElevated},durationBadgeSlow:{backgroundColor:F.error+"26"},durationText:{fontSize:9,fontWeight:"600",color:P.color.textSecondary,fontFamily:ye},durationTextSlow:{color:F.error},changesBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:F.success+"26"},changesText:{fontSize:9,fontWeight:"600",color:F.success},noChangesBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:P.color.surfaceElevated},noChangesText:{fontSize:9,fontWeight:"600",color:P.color.textTertiary},persistBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:F.info+"26"},persistText:{fontSize:9,fontWeight:"700",color:F.info,letterSpacing:.3},keysContainer:{flexDirection:"row",flexWrap:"wrap",gap:6},keyBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4,backgroundColor:P.color.accentSoft,borderWidth:1,borderColor:P.color.accentBorder},keyText:{fontSize:11,fontWeight:"600",color:P.color.accent,fontFamily:ye},countBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:P.color.accentFill},countText:{fontSize:9,fontWeight:"700",color:P.color.accent,fontFamily:ye},typeBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:3,backgroundColor:P.color.surfaceElevated},typeText:{fontSize:8,fontWeight:"600",color:P.color.textTertiary,fontFamily:ye},dataViewerContainer:{backgroundColor:P.color.bg,minHeight:60},updaterText:{fontSize:12,color:P.color.text,fontFamily:ye},updaterSubtext:{fontSize:11,color:P.color.textTertiary,lineHeight:16,marginTop:4},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:12,justifyContent:"flex-start"}});import{DiffModeTabs as ra,CompareBar as aa}from"@buoy-gg/shared-ui/web";import{jsx as Z,jsxs as be}from"react/jsx-runtime";function st(e){return h.getStoreColor(e.storeName)}function Yt(e){switch(e.category){case"replace":return"REPLACE";case"persist":return"HYDRATE";case"initial":return"INIT";default:return"SET"}}function sa(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}function Xt(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}var ia=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}];function it({change:e,changes:t,selectedIndex:o,onIndexChange:n,disableInternalFooter:r=!1,initialView:a="change"}){let[i,s]=Gt(a),[l,g]=Gt("tree"),S=t.length,T=st(e),f=Yt(e),p=sa(ze(e.nextState)),y=S-o,B=y-1,V=o<S-1?o+1:null,K=V!==null?t[V]:null,H=Jt(()=>({index:V??0,label:B>0?`#${B}`:"Initial",timestamp:K?Xt(K.timestamp):"",relativeTime:K?We(new Date(K.timestamp)):"state",badge:K?Z(c,{style:[N.changeBadgeSmall,{backgroundColor:`${st(K)}20`}],children:Z(b,{style:[N.changeTextSmall,{color:st(K)}],children:Yt(K)})}):void 0}),[V,K,B]),se=Jt(()=>({index:o,label:`#${y}`,timestamp:Xt(e.timestamp),relativeTime:We(new Date(e.timestamp)),badge:Z(c,{style:[N.changeBadgeSmall,{backgroundColor:`${T}20`}],children:Z(b,{style:[N.changeTextSmall,{color:T}],children:f})})}),[o,e.timestamp,T,f,y]),ce=Oe(()=>{let ue=ze(e.nextState);return be(c,{style:N.contentCard,testID:`${u}-state-card`,children:[be(c,{style:N.valueHeader,children:[Z(b,{style:N.valueLabel,children:"STATE AFTER CHANGE"}),be(c,{style:N.valueHeaderBadges,children:[Z(c,{style:[N.changeBadge,{backgroundColor:`${T}20`}],children:Z(b,{style:[N.changeText,{color:T}],children:f})}),Z(c,{style:N.typeBadge,children:Z(b,{style:N.typeText,testID:`${u}-state-type`,children:p.toUpperCase()})})]})]}),Z(c,{style:N.dataViewerContainer,children:Z(ea,{title:"",data:ue,showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})},[e.nextState,T,f,p]),Te=Oe(()=>{let ue=ze(e.prevState),he=ze(e.nextState);return l==="split"?Z(ne,{style:{flex:1},showsVerticalScrollIndicator:!0,children:Z(ta,{oldValue:ue,newValue:he,theme:na.devToolsDefault,options:{hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3},showThemeName:!1})}):Z(oa,{oldValue:ue,newValue:he})},[e.prevState,e.nextState,l]),xe=Oe(()=>{n(Math.min(S-1,o+1))},[o,S,n]),ve=Oe(()=>{n(Math.max(0,o-1))},[o,n]),ee=e.prevState===void 0,ke=!r&&S>1;return be(c,{style:N.container,children:[Z(Mt,{activeView:i,onViewChange:s,diffDisabled:ee}),be(c,{style:[N.contentArea,ke&&N.contentAreaFooterPad],children:[i==="change"&&Z(Ut,{change:e}),i==="state"&&Z(c,{style:N.stateContainer,children:ce()}),i==="diff"&&be(c,{style:N.diffContainer,testID:`${u}-diff`,children:[Z(ra,{tabs:ia,activeTab:l,onTabChange:g,testIDPrefix:`${u}-diff-tab`}),Z(aa,{leftEvent:H,rightEvent:se}),Z(c,{style:N.diffContent,testID:`${u}-diff-content`,children:Te()})]})]}),ke&&Z(qt,{currentIndex:y-1,totalItems:S,onPrevious:xe,onNext:ve,itemLabel:"Change",subtitle:We(new Date(e.timestamp)),absolute:!0})]})}function lt({change:e,changes:t,selectedIndex:o,onIndexChange:n}){let r=t.length;if(r<=1)return null;let a=r-o;return Z(qt,{currentIndex:a-1,totalItems:r,onPrevious:()=>n(Math.min(r-1,o+1)),onNext:()=>n(Math.max(0,o-1)),itemLabel:"Change",subtitle:We(new Date(e.timestamp))})}var N=G.create({container:{flex:1,backgroundColor:"transparent"},contentArea:{flex:1},contentAreaFooterPad:{paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:le.color.surface,borderRadius:14,padding:14,borderWidth:1,borderColor:le.color.border},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:le.color.textSecondary,fontFamily:Pe,letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},changeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},changeText:{fontSize:9,fontWeight:"700",fontFamily:Pe,letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:le.color.surfaceElevated},typeText:{fontSize:9,fontWeight:"600",color:le.color.textTertiary,fontFamily:Pe},valueBox:{backgroundColor:le.color.bg,borderRadius:6,borderWidth:1,borderColor:le.color.border,padding:8},valueText:{fontSize:12,color:le.color.text,fontFamily:Pe,lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},changeBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},changeTextSmall:{fontSize:8,fontWeight:"700",fontFamily:Pe},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12}});import{useMemo as la}from"react";import{CompactRow as da,night as dt,ToolEmptyState as ut,resolveListEmptyState as ca,monoFont as Qt}from"@buoy-gg/shared-ui/web";import{jsx as Q,jsxs as ct}from"react/jsx-runtime";function ua(e){try{let t=e.api.getState();if(t&&typeof t=="object"&&t.__buoyStateOnDevice===!0)return"on device";if(t&&typeof t=="object"){let n=Object.keys(t).filter(r=>typeof t[r]!="function");return n.length===0?"no data keys":n.length<=3?n.join(", "):`${n.slice(0,2).join(", ")} +${n.length-2}`}return""}catch{return""}}function ga(){return Q(ut,{testID:`${u}-stores-loading`,otto:"loading",title:"Loading stores\u2026",message:"Waiting for the device to send its registered stores."})}function fa(){return Q(ut,{testID:`${u}-stores-empty`,otto:"scanning",title:"No stores registered",message:`Use watchStores() to register your Zustand stores.
|
|
3
|
-
They will appear here with their current state.`})}function eo({stores:e,searchQuery:t,isLoading:o=!1,onOpenStore:n}){let r=la(()=>{if(!t)return e;let a=t.toLowerCase();return e.filter(i=>i.name.toLowerCase().includes(a)||i.persistName&&i.persistName.toLowerCase().includes(a))},[e,t]);return r.length===0&&!t?o?Q(ga,{}):Q(fa,{}):r.length===0&&t?Q(ut,{testID:`${u}-stores-no-match`,...ca({subject:"stores",verb:"registered",search:t,total:e.length,waiting:{otto:"scanning",title:"No stores registered",message:"Use watchStores() to register your Zustand stores."}})}):ct(ne,{style:re.container,contentContainerStyle:re.scrollContent,showsVerticalScrollIndicator:!0,testID:`${u}-stores-scroll`,children:[ct(c,{style:re.sectionHeader,children:[Q(b,{style:re.sectionTitle,children:"STORES"}),Q(c,{style:re.sectionCountBadge,children:Q(b,{style:re.sectionCountText,testID:`${u}-stores-count`,children:r.length})})]}),r.map(a=>{let i=ua(a),s=h.getStoreColor(a.name),l=$e(a.name);return ct(c,{style:re.storeRowWrapper,children:[Q(da,{statusDotColor:s,statusLabel:a.isPersisted?"persisted":"in-memory",primaryText:a.name,secondaryText:i||void 0,showChevron:!0,onPress:()=>n(a.name),testID:l,statusTestID:`${l}-backing`,primaryTestID:`${l}-name`,secondaryTestID:`${l}-keys`}),a.stateChangeCount>0&&Q(c,{style:[re.absCountBadge,{backgroundColor:s+"22",borderColor:s+"55"}],pointerEvents:"none",children:Q(b,{style:[re.absCountText,{color:s}],testID:`${l}-count`,children:String(a.stateChangeCount)})})]},a.name)})]})}var re=G.create({container:{flex:1},storeRowWrapper:{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:Qt},scrollContent:{paddingTop:8,paddingBottom:20},sectionHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:8,gap:8},sectionTitle:{fontSize:11,fontWeight:"700",letterSpacing:.5,color:dt.color.textTertiary},sectionCountBadge:{backgroundColor:dt.color.accentFill,paddingHorizontal:8,paddingVertical:2,borderRadius:4},sectionCountText:{fontSize:10,fontWeight:"700",color:dt.color.accent,fontFamily:Qt}});import{useCallback as pa,useEffect as ha,useMemo as gt,useState as Fe}from"react";import{buoyColors as ft,Database as Sa,ExpandedInfoRow as Me,FileJson as ma,night as $,PillBadge as pt,parseValue as to,monoFont as He}from"@buoy-gg/shared-ui/web";import{DataViewer as ya,LiveExplorer as ba,ValueEditModal as wa,updateNestedDataByPath as Ca,deleteNestedDataByPath as Ta}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as no,jsx as x,jsxs as Y}from"react/jsx-runtime";var xa=300,pe=`${u}-detail`;function va(e){let t=o=>o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e.length===0?`${pe}-explorer-root`:`${pe}-explorer-${e.map(t).filter(Boolean).join("-")}`}function oo({store:e,onViewHistory:t}){let o=$e(e.name),[n,r]=Fe(0);ha(()=>e.api.subscribe(()=>r(f=>f+1)),[e.api]);let a=e.api.getState(),i=gt(()=>tt(a),[a,n]),[s,l]=Fe(!1),g=gt(()=>{if(i.data!==null)return{update:(f,p)=>{let y=e.api.getState();if(!U(y)||f.length===0)return;let B=f[0],V=f.length===1?p:Ca(y[B],f.slice(1),p);e.api.setState({[B]:V},!1)},remove:f=>{let p=e.api.getState();if(!U(p)||f.length<=1)return;let y=f[0],B=Ta(p[y],f.slice(1));e.api.setState({[y]:B},!1)},canRemove:f=>f.length>1}},[e.api,i.data===null]),S=pa(f=>{let p=tt(e.api.getState());if(p.data===null)return;let y=Nt(p.data,f);Object.keys(y).length>0&&e.api.setState(y,!1),l(!1)},[e.api]),T=gt(()=>{if(a&&typeof a=="object"){let f={};for(let[p,y]of Object.entries(a))typeof y!="function"&&(f[p]=y);return to(f)}return to(a)},[a,n]);return Y(c,{style:k.root,children:[Y(ne,{testID:`${pe}-scroll`,style:k.scroll,contentContainerStyle:k.scrollContent,keyboardShouldPersistTaps:"handled",children:[x(c,{style:k.section,children:Y(c,{style:k.editorContainer,children:[Y(c,{style:k.sectionHeaderRow,children:[x(b,{testID:`${pe}-editor-header`,style:k.sectionHeaderText,children:"State Editor"}),i.data!==null?Y(q,{onPress:()=>l(!0),testID:`${pe}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:k.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[x(ma,{size:13,color:$.color.accent}),x(b,{style:k.rawButtonText,children:"Raw"})]}):null]}),x(c,{style:k.sectionBody,children:i.data!==null?Y(no,{children:[x(ba,{editable:!0,label:"State",value:i.data,defaultExpanded:["State"],writer:g,dataVersion:n,testIDForPath:va,debounceMs:xa}),x(b,{style:k.editorHint,children:"Edits write into the live store as you make them \u2014 merged, so the store's actions and untouched keys survive."})]}):x(b,{style:k.blockedText,testID:`${pe}-edit-blocked`,children:i.blockedReason})})]})}),x(c,{style:k.section,children:Y(c,{style:k.infoContainer,children:[x(b,{style:k.sectionHeaderTextPlain,children:"Store Details"}),Y(c,{style:k.infoBody,children:[x(Me,{label:"Type",children:x(pt,{color:e.color,testID:`${o}-type`,children:"ZUSTAND"})}),Y(Me,{label:"Backing",children:[x(pt,{color:ft.info,icon:e.isPersisted?x(Sa,{size:9,color:ft.info}):void 0,testID:`${o}-persist`,children:e.isPersisted?e.persistName||"persisted":"in-memory"}),e.isPersisted?x(ka,{store:e,rowID:o}):null]}),e.stateChangeCount>0&&Y(Me,{label:"Changes",children:[x(pt,{color:ft.warning,testID:`${o}-changes`,children:String(e.stateChangeCount)}),x(q,{onPress:()=>t(e.name),style:k.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},testID:`${o}-history`,accessibilityRole:"button",accessibilityLabel:`View ${e.name} history`,children:x(b,{style:[k.inlineLinkText,{color:e.color}],children:"view history \u2192"})})]}),i.fnPaths.length>0&&x(Me,{label:"Actions",children:x(b,{style:k.actionsText,testID:`${pe}-actions`,numberOfLines:2,children:i.fnPaths.join(" \xB7 ")})})]})]})}),x(c,{style:k.section,children:Y(c,{style:k.infoContainer,children:[x(b,{style:k.sectionHeaderTextPlain,children:"State Explorer"}),x(c,{style:k.viewerBody,testID:`${o}-state`,children:T&&typeof T=="object"?x(ya,{title:"",data:T,showTypeFilter:!0,rawMode:!0,initialExpanded:!1}):x(b,{style:k.blockedText,children:"Empty state"})})]})})]}),s&&i.data!==null?x(wa,{path:[],value:i.data,onSave:f=>{try{S(f)}catch{}},onCancel:()=>l(!1),saveLabel:"Apply",testIDPrefix:`${u}-value`}):null]})}function ka({store:e,rowID:t}){let[o,n]=Fe(!1),[r,a]=Fe(null);return e.rehydrate?Y(no,{children:[x(q,{onPress:()=>{n(!0),a(null),(async()=>{try{await e.rehydrate?.()}catch(s){a(s instanceof Error?s.message:String(s))}finally{n(!1)}})()},disabled:o,style:k.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},testID:`${t}-reread`,accessibilityRole:"button",accessibilityLabel:`Re-read ${e.name} from storage`,children:x(b,{style:[k.inlineLinkText,{color:e.color}],children:o?"re-reading\u2026":"re-read saved value \u2192"})}),r?x(b,{style:[k.inlineLinkText,{color:$.color.danger}],children:r}):null]}):null}var k=G.create({root:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8,paddingBottom:24},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:$.color.surface,borderRadius:6,borderWidth:1,borderColor:$.color.accent+"4D",overflow:"hidden",shadowColor:$.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:$.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:$.color.accent+"33"},sectionHeaderText:{fontWeight:"600",fontSize:12,color:$.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:He},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:$.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:$.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:$.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:$.color.surface,borderRadius:6,borderWidth:1,borderColor:$.color.border,overflow:"hidden"},sectionHeaderTextPlain:{backgroundColor:$.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:$.color.textSecondary,borderBottomWidth:1,borderBottomColor:$.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:He},infoBody:{padding:12,gap:10},viewerBody:{backgroundColor:$.color.bg,minHeight:60},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:He},actionsText:{flex:1,color:$.color.textSecondary,fontSize:10,fontFamily:He,lineHeight:15}});import{useMemo as Ia}from"react";import{EntityFilterView as Da}from"@buoy-gg/shared-ui/web";import{jsx as Va}from"react/jsx-runtime";var Pa=["\u2022 auth \u2192 hides authStore from stores & events","\u2022 temp \u2192 hides tempStore, tempUserStore","\u2022 cart \u2192 hides cartStore from both tabs"];function ro({ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,stores:n}){let r=Ia(()=>n.map(a=>({name:a.name,color:h.getStoreColor(a.name)})),[n]);return Va(Da,{entities:r,ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,entityNoun:"STORES",entitySingular:"store",entityKey:"store",testIDPrefix:u,slug:Ne,howItWorks:"Patterns hide matching stores from both the Stores tab and the Events tab. Tap a store above to quickly add it as a filter.",examples:Pa})}import{Fragment as lo,jsx as m,jsxs as j}from"react/jsx-runtime";function _a({isEnabled:e,searchText:t,totalChanges:o}){let n=co({subject:"changes",search:t,total:o,capturing:e,waiting:{otto:"waiting",title:"No state changes",message:"State changes will appear here as stores update."},paused:{title:"No state changes",message:"Enable capture to start recording state changes"}});return m(St,{...n,testID:`${u}-empty`})}function Ve({visible:e,onClose:t,onBack:o,onMinimize:n,enableSharedModalDimensions:r=!1,inline:a=!1,storesLoading:i=!1,initialTab:s="stores",initialSelectedChangeId:l,initialDetailView:g,onChangeSelect:S,onStoreExpand:T}){let f=Fa(),p=Ma("zustand.changes"),[y,B]=ae(!1),[V,K]=ae(s),[H,se]=ae(null),[ce,Te]=ae(null),[xe,ve]=ae(!1),[ee,ke]=ae(new Set),{stateChanges:ue,filteredChanges:he,filter:ms,setFilter:Ie,stats:mo,stores:De,clearChanges:yo,isEnabled:Ze,toggleCapture:bo}=ot(),te=de(()=>ee.size===0?he:he.filter(d=>!Array.from(ee).some(D=>d.storeName.toLowerCase().includes(D.toLowerCase()))),[he,ee]),Se=de(()=>ee.size===0?De:De.filter(d=>!Array.from(ee).some(D=>d.name.toLowerCase().includes(D.toLowerCase()))),[De,ee]),wo=de(()=>H?ue.filter(d=>d.storeName===H).length:0,[ue,H]),Re=de(()=>H?te.filter(d=>d.storeName===H):te,[te,H]),Ye=de(()=>Re.slice(0,p),[Re,p]),Xe=de(()=>Math.max(0,Re.length-p),[Re.length,p]),Co=Xe>0,W=Ye,[qe,ge]=ae(null),fe=de(()=>{if(qe===null)return null;let d=W.findIndex(D=>D.id===qe);return d>=0?d:null},[qe,W]),X=fe!==null?W[fe]:null,yt=_e(null);ao(()=>{if(!S)return;let d=X?.id??null;d===null||d===yt.current||(yt.current=d,S(X))},[X,S]);let bt=_e(null);ao(()=>{!l||bt.current===l||!W.some(D=>D.id===l)||(bt.current=l,ge(l))},[l,W]);let[ie,Qe]=ae(""),[To,Ee]=ae(!1),ys=_e(null),xo=_e(null),vo=L(d=>{},[]),ko=d=>{Qe(d),V==="events"&&Ie(D=>({...D,searchText:d}))},Io=L(()=>{Qe(""),Ie(d=>({...d,searchText:""})),Ee(!1)},[Ie]),wt=L(d=>{ge(d.id)},[]),Do=L(()=>{B(!0)},[]),Po=L(()=>{ge(null)},[]),Ct=L(d=>{let D=W[d];D&&ge(D.id)},[W]),Vo=L(d=>{se(d),ge(null)},[]),Zo=L(()=>{se(null),ge(null)},[]),Ro=L(d=>{Te(d),T?.(d)},[T]),Eo=L(()=>{Te(null)},[]),Bo=L(()=>Se.reduce((d,D)=>{try{let oe=D.api.getState();if(oe&&typeof oe=="object"){let Zt={};for(let[Fo,Rt]of Object.entries(oe))typeof Rt!="function"&&(Zt[Fo]=we(Rt));d[D.name]=Zt}else d[D.name]=we(oe)}catch{d[D.name]=null}return d},{}),[Se]),Ao=L(()=>te.map(d=>({id:d.id,storeName:d.storeName,timestamp:d.timestamp,prevState:we(d.prevState),nextState:we(d.nextState),hasStateChange:d.hasStateChange,changedKeys:d.changedKeys})),[te]),No=L(()=>W.map(d=>({id:d.id,storeName:d.storeName,timestamp:d.timestamp,prevState:we(d.prevState),nextState:we(d.nextState),hasStateChange:d.hasStateChange,changedKeys:d.changedKeys})),[W]),$o=L(d=>{ke(D=>{let oe=new Set(D);return oe.has(d)?oe.delete(d):oe.add(d),oe})},[]),Lo=L(d=>{ke(D=>new Set([...D,d]))},[]),Oo=L(d=>{K(d),se(null),Te(null),ge(null),ve(!1),ie&&(Qe(""),Ie(D=>({...D,searchText:""}))),Ee(!1)},[ie,Ie]),Tt=L(d=>d.id,[]),xt=de(()=>Ft(W),[W]),vt=L(({item:d})=>m(nt,{change:d,onPress:wt,testID:xt.get(d.id)}),[wt,xt]),kt=ee.size>0,It=()=>xe?j(O,{children:[m(O.Navigation,{onBack:()=>ve(!1)}),m(O.Content,{title:"Filters",centered:!0,testID:`${u}-filters-title`})]}):X?j(O,{children:[m(O.Navigation,{onBack:Po}),m(O.Content,{title:`${X.storeName}/setState`,centered:!0,testID:`${u}-detail-title`})]}):H?j(O,{children:[m(O.Navigation,{onBack:Zo}),m(O.Content,{title:`${H} History`,centered:!0,testID:`${u}-history-title`}),m(O.Actions,{children:m(ht,{value:No,disabled:W.length===0,buttonStyle:z.headerActionButton,testID:`${u}-copy`})})]}):ce?j(O,{children:[m(O.Navigation,{onBack:Eo}),m(O.Content,{title:ce,centered:!0,testID:`${u}-store-detail-title`})]}):j(O,{children:[o&&m(O.Navigation,{onBack:o}),m(O.Content,{title:"",children:To?m(O.Search,{value:ie,onChangeText:ko,onCancel:Io,placeholder:V==="stores"?"Search stores...":"Search events...",accessibilityLabel:"Search Zustand stores and events",iconSize:14,testID:`${u}-search-field`,containerTestID:`${u}-search`,clearTestID:`${u}-search-clear`,onBlur:()=>{ie.length===0&&Ee(!1)}}):m(Ra,{tabs:[{key:"stores",label:`Stores${Se.length>0?` (${Se.length})`:""}`},{key:"events",label:`Events${te.length>0?` (${te.length})`:""}`}],activeTab:V,onTabChange:Oo,testIDPrefix:`${u}-tab`})}),j(O.Actions,{children:[m(q,{onPress:()=>Ee(!0),style:z.headerActionButton,testID:`${u}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search",children:m(Ba,{size:14,color:M.color.textSecondary})}),m(q,{onPress:()=>ve(!0),style:[z.headerActionButton,kt&&z.headerActionButtonActive],testID:`${u}-filters-open`,accessibilityRole:"button",accessibilityLabel:"Filters",children:m(Aa,{size:14,color:kt?M.color.accent:M.color.textSecondary})}),V==="stores"&&m(ht,{value:Bo,disabled:Se.length===0,buttonStyle:z.headerActionButton,testID:`${u}-copy`}),V==="events"&&j(lo,{children:[m(ht,{value:Ao,disabled:te.length===0,buttonStyle:z.headerActionButton,testID:`${u}-copy`}),m(za,{isEnabled:Ze,onToggle:bo,accessibilityLabel:"Toggle Zustand state capture",testID:`${u}-power`}),m(Wa,{onPress:yo,disabled:te.length===0,buttonStyle:z.headerActionButton,testID:`${u}-clear`})]})]})]}),zo=()=>{if(xe)return m(ro,{ignoredPatterns:ee,onTogglePattern:$o,onAddPattern:Lo,stores:De});if(X&&fe!==null)return m(it,{change:X,changes:W,selectedIndex:fe,onIndexChange:Ct,disableInternalFooter:!0,initialView:g});if(H)return W.length>0?m(Be,{testID:`${u}-history-list`,data:W,renderItem:vt,keyExtractor:Tt,contentContainerStyle:z.listContent,showsVerticalScrollIndicator:!0,...io}):m(St,{testID:`${u}-history-empty`,...co({subject:"changes",search:ie,total:ie.trim()?wo:0,capturing:Ze,waiting:{otto:"waiting",title:"No history yet",message:`State changes for ${H} will appear here.`},paused:{title:"No history yet",message:`Capture is off, so nothing is being recorded for ${H}.`}})});if(ce){let d=De.find(D=>D.name===ce)??null;return d?m(oo,{store:d,onViewHistory:Vo}):m(St,{testID:`${u}-store-detail-gone`,otto:"ghost",title:"Store no longer registered",message:`${ce} is not in the registry any more.`})}return V==="stores"?m(eo,{stores:Se,searchQuery:ie,isLoading:i,onOpenStore:Ro}):j(lo,{children:[!Ze&&j(c,{style:z.disabledBanner,testID:`${u}-banner-disabled`,children:[m(Na,{size:14,color:M.color.warning}),m(b,{style:z.disabledText,children:"State capture is disabled"})]}),Co&&j(q,{style:z.lockedBanner,onPress:Do,activeOpacity:.8,testID:`${u}-locked`,accessibilityRole:"button",children:[m($a,{size:14,color:M.color.accent}),j(b,{style:z.lockedText,testID:`${u}-locked-text`,children:[Xe," older"," ",Xe===1?"change":"changes"," locked"]}),m(c,{style:z.upgradeBadge,children:m(b,{style:z.upgradeBadgeText,children:"UPGRADE"})})]}),Ye.length>0?m(Be,{ref:xo,testID:`${u}-list`,data:Ye,renderItem:vt,keyExtractor:Tt,contentContainerStyle:z.listContent,showsVerticalScrollIndicator:!0,...io}):m(_a,{isEnabled:Ze,searchText:ie,totalChanges:mo.totalChanges})]})},Wo=r?La.modal.root():"buoy-zustand-modal";if(!e)return null;let Dt=X&&fe!==null?m(lt,{change:X,changes:W,selectedIndex:fe,onIndexChange:Ct}):null,Mo=X&&W.length>1?68:0,Ho=!xe&&!(X&&fe!==null)&&(H!=null||V==="events"||V==="stores"),Pt=m(c,{style:z.container,children:zo()}),Vt=m(Oa,{visible:y,onClose:()=>B(!1),featureName:"Full State History"});return a?j(so,{children:[j(c,{style:z.inlineRoot,children:[m(c,{style:z.inlineHeader,...Ha,children:It()}),Pt,Dt]}),Vt]}):j(so,{children:[m(Za,{visible:e,onClose:t,onMinimize:n,persistenceKey:Wo,header:{showToggleButton:!0,customContent:It()},onModeChange:vo,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,disableScrollWrapper:Ho,styles:{},footer:Dt,footerHeight:Mo,children:Pt}),Vt]})}function ja(e={}){return m(Ve,{...e,inline:!0,visible:!0,onClose:()=>{}})}var z=G.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:Ea.border.default,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:M.color.buttonSurface,borderWidth:1,borderColor:M.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:M.color.accentSoft,borderColor:M.color.accentBorderStrong},disabledBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:M.color.warningSoft,borderRadius:8,borderWidth:1,borderColor:M.color.warning+"20"},disabledText:{color:M.color.warning,fontSize:11,flex:1},listContent:{paddingTop:8,paddingBottom:20},lockedBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:M.color.accentSoft,borderRadius:8,borderWidth:1,borderColor:M.color.accentBorder},lockedText:{color:M.color.accent,fontSize:11,fontWeight:"500",flex:1},upgradeBadge:{backgroundColor:M.color.accent,paddingHorizontal:8,paddingVertical:3,borderRadius:4},upgradeBadgeText:{color:M.color.onAccent,fontSize:9,fontWeight:"700",letterSpacing:.5}});import{ZustandIcon as je,ZUSTAND_ICON_COLOR as Ka}from"@buoy-gg/shared-ui/web";import{jsx as uo}from"react/jsx-runtime";var Ua={id:"zustand",name:"ZUSTAND",description:"Zustand store & state inspector",slot:"both",icon:({size:e})=>uo(je,{size:e}),component:Ve,props:{enableSharedModalDimensions:!1}};function Ga(e){return{id:e?.id||"zustand",name:e?.name||"ZUSTAND",description:e?.description||"Zustand store & state inspector",slot:"both",icon:({size:t})=>uo(je,{size:t,color:e?.iconColor}),component:Ve,props:{enableSharedModalDimensions:e?.enableSharedModalDimensions!==void 0?e.enableSharedModalDimensions:!1}}}var Ce=Symbol.for("@@buoy-zustand/watched");function go(e){let t=e.persist;return t&&typeof t.getOptions=="function"?{isPersisted:!0,persistName:t.getOptions()?.name,persistApi:t}:{isPersisted:!1}}function Ja(e){let t=[];for(let[o,n]of Object.entries(e)){let r=n;if(r[Ce])continue;r[Ce]=!0;let{isPersisted:a,persistName:i,persistApi:s}=go(n);h.registerStore(o,{getState:n.getState,getInitialState:n.getInitialState,setState:n.setState,subscribe:n.subscribe},{isPersisted:a,persistName:i,rehydrate:typeof s?.rehydrate=="function"?()=>s.rehydrate():void 0});let l=!1,g=n.subscribe((S,T)=>{try{let f;if(!l&&a){let p=!1;try{p=s?.hasHydrated?.()===!1}catch{}p&&(l=!0,f="persist")}h.addStateChange({storeName:o,partial:void 0,replace:!1,prevState:T,nextState:S,duration:void 0,category:f,isPersisted:a})}catch{}});t.push(()=>{g(),delete n[Ce],h.unregisterStore(o)})}return()=>{t.forEach(o=>o())}}var Ya=0;function Xa(e,t){return(o,n,r)=>{let a=t?.name??`store-${++Ya}`,i=t?.enabled!==!1,s=o,l=(S,T)=>{if(!i)return s(S,T);let f=performance.now(),p=n();s(S,T);let y=n(),B=performance.now()-f,V=typeof S=="function"?"(updater fn)":S;h.addStateChange({storeName:a,partial:V,replace:T??!1,prevState:p,nextState:y,duration:B,isPersisted:h.getStore(a)?.isPersisted??!1})},g=e(l,n,r);return setTimeout(()=>{if(r[Ce])return;r[Ce]=!0;let{isPersisted:S,persistName:T}=go(r);h.registerStore(a,{getState:n,getInitialState:r.getInitialState,setState:l,subscribe:r.subscribe},{isPersisted:S,persistName:T})},0),g}}function qa(e){return e[Ce]===!0}import{expandKeyedArrays as Qa,patchFromPath as es,readPath as ts,refusalText as os,shapeSummary as Ke,suggestedPatch as mt,typedEditViolations as ns,unshapedLists as rs}from"@buoy-gg/shared-ui/web";import{WIRE_DETAIL_LIMIT_BYTES as fo,createSyncAdapter as as,detailByIdAction as ss,isJsonSerializable as is,isOverWireBudget as ls,memoByIdentity as ds,onDeviceMarker as po,readParams as Ue,toWire as ho,truncatedNote as cs}from"@buoy-gg/shared-ui/web";var Ge=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype;function So(e,t){if(!Ge(e)||!Ge(t))return t;let o={...e};for(let[n,r]of Object.entries(t))o[n]=n in e?So(e[n],r):r;return o}var Je=po("State","State trees stay on the device \u2014 fetched on demand via getChangeDetail / getStoreState."),us=po("Payload","Partial stays on the device \u2014 fetched on demand via getChangeDetail.");function gs(e,t){let o=e;for(let n of t.split(".")){if(!o||typeof o!="object"||Array.isArray(o)||!(n in o))return!1;o=o[n]}return Array.isArray(o)?o.length>0:!!o&&typeof o=="object"}function fs(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.keys(e):void 0}var ps=ds(e=>({...e,prevState:Je,nextState:Je,partial:ho(e.partial,us)})),hs=e=>ho(e,Je),Ss=as({version:2,getSnapshot:()=>({changes:h.getStateChanges().map(ps),stores:h.getStoreSnapshots().map(e=>({...e,currentState:hs(e.currentState)}))}),subscribe:[e=>h.subscribe(e),e=>h.subscribeToStores(e)],actions:{clearEvents:()=>{h.clearStateChanges()},getChangeDetail:ss(e=>h.getStateChangeById(e),(e,t)=>({prevState:t(e.prevState),nextState:t(e.nextState),partial:t(e.partial)})),getStoreState:e=>{let{storeName:t,path:o}=Ue(e);if(!t)return{found:!1,reason:"missing storeName"};let n=h.getStore(t);if(!n)return{found:!1,reason:"unknown storeName"};let r;try{r=n.api.getState()}catch{r=void 0}if(o){let i=ts(r,o);return i.ok?{found:!0,storeName:t,path:o,shape:Ke(i.value),currentState:i.value}:{found:!1,reason:i.error}}let a=Ke(r);return ls(r,fo)?{found:!0,storeName:t,...a?{shape:a}:{},currentState:is(r)?cs(fo):Je}:{found:!0,storeName:t,...a?{shape:a}:{},currentState:r}},listStores:e=>{let{includeValues:t=!1,limit:o}=Ue(e),n=h.getStoreSnapshots(),a=(typeof o=="number"&&o>0?n.slice(0,o):n).map(i=>({name:i.name,changes:i.stateChangeCount,isPersisted:i.isPersisted,persistName:i.persistName,canRehydrate:i.canRehydrate,...t?{currentState:i.currentState}:{keys:fs(i.currentState)},...Ke(i.currentState)?{shape:Ke(i.currentState)}:{}}));return{stores:a,total:n.length,returned:a.length,includedValues:t}},setState:e=>{let{storeName:t,state:o,replace:n,force:r,path:a,value:i}=Ue(e),s=o,l=[],g=[];if(!t)return{ok:!1,error:"Missing storeName."};let S=h.getStore(t);if(!S)return{ok:!1,error:`No store named "${t}".`};if(o===void 0&&a===void 0)return{ok:!1,error:"Refused: no change was described. Send `state` with the fields to merge, or `path` and `value` to set one value."};let T=!1;if(a!==void 0){if(i===void 0)return{ok:!1,error:`Refused: sent \`path\` without \`value\`. Say what to set "${a}" to; if you mean to clear it, send value:null and the field must already be nullable.`};let p;try{p=S.api.getState()}catch{p=void 0}let y=es(p,a,i);if(!y.ok)return{ok:!1,error:`Refused: ${y.error}`};s=y.patch,T=!0}if(!r&&(n===!1||T)){let p;try{p=S.api.getState()}catch{p=void 0}if(p!==void 0){let y=Qa(p,s);if(y.error)return{ok:!1,error:`Refused: ${y.error}`};s=y.patch,l=y.notes}if(p!==void 0&&(g=rs(p).filter(y=>gs(s,y))),p!==void 0){let y=ns(p,s,{noun:"store"});if(y.length>0)return{ok:!1,error:os(y,"store",mt(s,y)),...mt(s,y)?{suggestedState:mt(s,y)}:{},violations:y}}}let f=T||n===!1;if(f){let p;try{p=S.api.getState()}catch{p=void 0}if(Ge(p)&&Ge(s)){let y={};for(let[B,V]of Object.entries(s))y[B]=B in p?So(p[B],V):V;s=y}}return S.api.setState(s,f?!1:n??!0),{ok:!0,...a!==void 0?{path:a}:{},...l.length?{keyed:l}:{},...g.length?{unchecked:g.map(p=>`\`${p}\` was empty, so nothing in the app knows what its items look like and the shape of what you added was NOT checked. If the app renders a field you left out, it will render undefined \u2014 read the store back and compare against how the screen uses it.`)}:{}}},rehydrate:async e=>{let{storeName:t}=Ue(e);if(!t)return{ok:!1,error:"Missing storeName."};let o=h.getStore(t);return o?o.isPersisted?o.rehydrate?(await o.rehydrate(),{ok:!0,storeName:t,persistName:o.persistName}):{ok:!1,error:`"${t}" is persisted but Buoy has no rehydrate handle for it. It was probably registered before the app's persist middleware attached.`}:{ok:!1,error:`"${t}" is not a persisted store \u2014 it has no saved copy to re-read.`}:{ok:!1,error:`No store named "${t}".`}}}});export{Ka as ZUSTAND_ICON_COLOR,je as ZustandIcon,Ve as ZustandModal,nt as ZustandStateChangeItem,it as ZustandStateDetailContent,lt as ZustandStateDetailFooter,ja as ZustandToolView,Xa as buoyDevTools,Ga as createZustandTool,qa as isStoreInstrumented,ot as useZustandStateChanges,Ja as watchStores,h as zustandStateStore,Ss as zustandSyncAdapter,Ua as zustandToolPreset};
|
|
1
|
+
"use client";var wt=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames;var Lr=Object.prototype.hasOwnProperty;var zr=(e,t)=>{for(var r in t)wt(e,r,{get:t[r],enumerable:true})},vt=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Rr(t))!Lr.call(e,n)&&n!==r&&wt(e,n,{get:()=>t[n],enumerable:!(a=Ar(t,n))||a.enumerable});return e},Vr=(e,t,r)=>(vt(e,t,"default"),r&&vt(r,t,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{classifyPreviewItem as Hr,createRestoreScope as jr,emptyRestoreResult as Or,failedRestore as Wr,registerStateSnapshotProvider as Fr,unionKeys as Mr}from"@buoy-gg/shared-ui/web";import{ChangeLog as Kr,entityColor as Ur,formatValuePreview as Zr,shallowDiffSummary as _r}from"@buoy-gg/shared-ui/web";var Gr={counter:"#10B981",auth:"#8B5CF6",user:"#3B82F6",cart:"#EC4899",app:"#6366F1",ui:"#F59E0B",settings:"#14B8A6",theme:"#06B6D4",navigation:"#F97316",form:"#EF4444"};function Tt(e){return Ur(e,Gr)}function Jr(e,t=40){return Zr(e,{maxLength:t,undefinedLabel:"",functionLabel:"(updater fn)"})}var Yr=class extends Kr{constructor(){super(...arguments);this.stores=new Map;this.storeListeners=new Set;this.remoteSetStateHandler=null}addStateChange(e){if(!this.canRecord())return;let{storeName:t,partial:r,replace:a,prevState:n,nextState:o,duration:i,category:c,isPersisted:s=false}=e,p=n!==o,{summary:m,changedKeys:y,changedCount:b}=_r(n,o),h=Jr(r),f=(i??0)>16,P=c??(a?"replace":"setState"),D={id:this.nextId(),storeName:t,timestamp:Date.now(),prevState:n,nextState:o,partial:r,duration:i,hasStateChange:p,replace:a,category:P,changedKeys:y,changedKeysCount:b,diffSummary:m,partialPreview:h,isSlowUpdate:f,isPersisted:s};this.push(D);let j=this.stores.get(t);j&&j.stateChangeCount++,this.notifyListeners()}getStateChanges(){return this.getAll()}getStateChangeById(e){return this.getById(e)}clearStateChanges(){for(let e of this.stores.values())e.stateChangeCount=0;this.clear(),this.notifyStoreListeners()}replaceStateChanges(e){if(!this.getEnabled())return;for(let r of this.stores.values())r.stateChangeCount=0;let t=e.slice(0,this.max);for(let r of t){let a=this.stores.get(r.storeName);a&&a.stateChangeCount++}this.setItems(t),this.notifyStoreListeners()}getStoreSnapshots(){return Array.from(this.stores.values()).map(e=>{let t;try{t=e.api.getState()}catch{t=void 0}return{name:e.name,stateChangeCount:e.stateChangeCount,isPersisted:e.isPersisted,persistName:e.persistName,canRehydrate:typeof e.rehydrate=="function",color:e.color,currentState:t}})}setRemoteSetStateHandler(e){this.remoteSetStateHandler=e}replaceFromSnapshot(e,t){if(!this.getEnabled())return;let r=new Map;for(let o of this.items){let i=o.prevState;(!i||i.__buoyStateOnDevice!==true)&&r.set(o.id,o)}let a=e.slice(0,this.max).map(o=>{let i=r.get(o.id),c=o.prevState;return i&&c?.__buoyStateOnDevice===true?{...o,prevState:i.prevState,nextState:i.nextState,partial:i.partial}:o}),n=new Map;for(let[o,i]of this.stores)try{let c=i.api.getState(),s=c;(!s||s.__buoyStateOnDevice!==true)&&n.set(o,c)}catch{}this.stores=new Map(t.map(o=>{let i=o.currentState,c=n.get(o.name),s=c!==void 0&&i?.__buoyStateOnDevice===true?c:o.currentState;return[o.name,{name:o.name,api:{getState:()=>s,setState:(p,m)=>{this.remoteSetStateHandler?.(o.name,p,m)},subscribe:()=>()=>{}},stateChangeCount:o.stateChangeCount,isPersisted:o.isPersisted,persistName:o.persistName,color:o.color}]})),this.setItems(a),this.notifyStoreListeners()}hydrateChange(e,t){this.hydrateById(e,t)}hydrateStoreState(e,t){let r=this.stores.get(e);r&&(this.stores.set(e,{...r,api:{...r.api,getState:()=>t}}),this.notifyStoreListeners())}registerStore(e,t,r){if(this.stores.has(e))return;let a={name:e,api:t,stateChangeCount:0,isPersisted:r?.isPersisted??false,persistName:r?.persistName,rehydrate:r?.rehydrate,color:Tt(e)};this.stores.set(e,a),this.notifyStoreListeners()}unregisterStore(e){this.stores.delete(e),this.notifyStoreListeners()}getStores(){return Array.from(this.stores.values())}getStore(e){return this.stores.get(e)}getStoreColor(e){return this.stores.get(e)?.color??Tt(e)}filterStateChanges(e){let t=this.getAll();if(e.searchText){let r=e.searchText.toLowerCase();t=t.filter(a=>a.storeName.toLowerCase().includes(r)||a.partialPreview.toLowerCase().includes(r)||a.changedKeys.some(n=>n.toLowerCase().includes(r)))}return e.storeNames&&e.storeNames.length>0&&(t=t.filter(r=>e.storeNames.includes(r.storeName))),e.onlyWithChanges&&(t=t.filter(r=>r.hasStateChange)),t}getStats(){let e=this.items.length,t=this.items.filter(o=>o.hasStateChange).length,r=this.stores.size,a=this.items.filter(o=>o.duration!==void 0).map(o=>o.duration),n=a.length>0?a.reduce((o,i)=>o+i,0)/a.length:0;return{totalChanges:e,changesWithStateChange:t,changesWithoutStateChange:e-t,storeCount:r,averageDuration:Math.round(n*100)/100}}getUniqueStoreNames(){return Array.from(this.stores.keys()).sort()}setMaxChanges(e){this.setMax(e)}subscribeToStores(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}notifyStoreListeners(){let e=this.getStores();this.storeListeners.forEach(t=>t(e))}},S=new Yr;function _(e){if(typeof e!="object"||e===null||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ve(e,t,r,a,n){if(typeof e=="function"){r.push(t);return}if(typeof e!="object"||e===null||n>=8)return e;if(a.has(e))return;if(a.add(e),Array.isArray(e))return e.map((i,c)=>typeof i=="function"?(r.push(`${t}[${c}]`),null):ve(i,`${t}[${c}]`,r,a,n+1));if(!_(e))return e;let o={};for(let[i,c]of Object.entries(e)){if(typeof c=="function"){r.push(t?`${t}.${i}`:i);continue}o[i]=ve(c,t?`${t}.${i}`:i,r,a,n+1)}return o}function It(e){if(_(e)&&e.__buoyStateOnDevice===true)return{data:null,fnPaths:[],blockedReason:"Store state hasn't synced from the device yet."};if(!_(e))return{data:null,fnPaths:[],blockedReason:"Only stores whose state is a plain object can be edited \u2014 a merge write has nothing to address in "+(Array.isArray(e)?"an array":`a ${typeof e}`)+"."};let t=[],r=ve(e,"",t,new WeakSet,0),a=t.filter(n=>n.includes(".")||n.includes("["));return a.length>0?{data:null,fnPaths:t,blockedReason:`State keeps a function inside "${a[0]}" \u2014 a merge write of that key would drop it, so this store can't be edited here.`}:{data:r,fnPaths:t,blockedReason:null}}function qr(e,t){if(!_(t))throw new Error("The store's state must stay an object.");let r=Object.keys(e).filter(n=>!(n in t));if(r.length>0)throw new Error(`Can't remove top-level ${r.length===1?"key":"keys"} ${r.map(n=>`"${n}"`).join(", ")} \u2014 zustand merge writes can't delete. Edit the value instead.`);let a={};for(let n of Object.keys(t))(!(n in e)||JSON.stringify(t[n])!==JSON.stringify(e[n]))&&(a[n]=t[n]);return a}var kt=8;function Dt(e,t,r,a){if(!(!_(t)||!_(e))&&!(a>=kt||r.has(t))){r.add(t);for(let[n,o]of Object.entries(t))if(typeof o=="function")e[n]=o;else if(_(o)){if(!_(e[n])){if(!Bt(o,new WeakSet,a+1))continue;e[n]={}}Dt(e[n],o,r,a+1)}}}function Bt(e,t,r){if(r>=kt||t.has(e))return false;t.add(e);for(let a of Object.values(e))if(typeof a=="function"||_(a)&&Bt(a,t,r+1))return true;return false}function Qr(){return S.getStores().length===0?{canCapture:false,canRestore:false,detail:"No Zustand stores registered \u2014 pass `zustandStores` to FloatingDevTools or add the buoyDevTools middleware"}:{canCapture:true,canRestore:true}}async function Xr(){let e=[],t={};for(let r of S.getStores()){let a=[],n;try{n=ve(r.api.getState(),"",a,new WeakSet,0)}catch(o){e.push(`store "${r.name}": capture failed (${String(o)})`);continue}t[r.name]={state:n,fnPaths:a}}return{data:{stores:t},warnings:e}}async function ea(e,t){let r=e,a=jr(t),n=Or();if(!r?.stores)return Wr("empty zustand snapshot");for(let[i,c]of Object.entries(r.stores)){if(!a.allows(i))continue;let s=S.getStore(i);if(!s){n.skipped.push({id:i,reason:"store not registered (renamed, or created after snapshot?)"});continue}try{let p=c.state;Dt(p,s.api.getState(),new WeakSet,0),s.api.setState(p,true),s.api.getState()===p?n.applied+=1:(n.warnings.push(`store "${i}": setState did not take effect`),n.ok=false)}catch(p){n.skipped.push({id:i,reason:String(p)}),n.ok=false}}let o=a.excludedWarning("store(s)");return o&&n.warnings.push(o),n}async function ta(e,t){let r=e?.stores??{},a=t===void 0,n={};if(a)for(let s of S.getStores()){let p=[];try{n[s.name]={state:ve(s.api.getState(),"",p,new WeakSet,0),fnPaths:p}}catch{}}else Object.assign(n,t?.stores??{});let o=[],i=[],c=0;for(let s of Mr(n,r)){let p=s in r,m=s in n;if(!p){a?i.push(`store "${s}" not in snapshot \u2014 untouched`):o.push({key:s,label:s,verdict:"removed",oldValue:n[s].state});continue}if(c+=r[s].fnPaths?.length??0,a&&!S.getStore(s)){o.push({key:s,label:s,verdict:"wont-apply",reason:"store not registered (renamed, or created after snapshot?)"});continue}o.push(Hr({key:s,label:s,oldValue:n[s]?.state,newValue:r[s].state,inOld:m,inNew:true},{tooLargeReason:"store too large to render a diff \u2014 restore still applies it"}))}return c>0&&i.push(`${c} store action function${c===1?"":"s"} preserved on restore (not diffed)`),{items:o,notes:i}}Fr({id:"zustand",label:"Zustand",status:Qr,capture:Xr,restore:ea,previewItems:ta});import{useState as Q,useMemo as te,useRef as $e,useCallback as E,useEffect as $t}from"react";var Pt={};zr(Pt,{AccessibilityInfo:()=>na,ActivityIndicator:()=>Xa,Alert:()=>ro,Animated:()=>ia,AppRegistry:()=>la,AppState:()=>ca,Appearance:()=>sa,BackHandler:()=>da,Button:()=>eo,CheckBox:()=>ka,Clipboard:()=>ua,DeviceEventEmitter:()=>Wa,Dimensions:()=>ha,Easing:()=>ga,FlatList:()=>Ze,I18nManager:()=>pa,Image:()=>Da,ImageBackground:()=>Ba,InteractionManager:()=>ma,Keyboard:()=>fa,KeyboardAvoidingView:()=>$a,LayoutAnimation:()=>ya,Linking:()=>ba,LogBox:()=>Oa,Modal:()=>qa,NativeEventEmitter:()=>Sa,NativeModules:()=>oa,PanResponder:()=>Ca,Picker:()=>Pa,PixelRatio:()=>xa,Platform:()=>wa,Pressable:()=>Ya,ProgressBar:()=>Na,RefreshControl:()=>Ea,SafeAreaView:()=>Aa,ScrollView:()=>Te,SectionList:()=>Ra,Share:()=>va,StatusBar:()=>La,StyleSheet:()=>le,Switch:()=>Qa,Text:()=>x,TextInput:()=>_a,Touchable:()=>za,TouchableHighlight:()=>Ga,TouchableNativeFeedback:()=>Va,TouchableOpacity:()=>re,TouchableWithoutFeedback:()=>Ja,UIManager:()=>Ta,Vibration:()=>Ia,View:()=>d,VirtualizedList:()=>Ha,YellowBox:()=>ja,findNodeHandle:()=>to,unstable_createElement:()=>aa,useColorScheme:()=>Fa,useLocaleContext:()=>Ma,useWindowDimensions:()=>Ka});Vr(Pt,ra);import*as ra from"react-native-web";import{unstable_createElement as aa,NativeModules as oa,AccessibilityInfo as na,Animated as ia,Appearance as sa,AppRegistry as la,AppState as ca,BackHandler as da,Clipboard as ua,Dimensions as ha,Easing as ga,I18nManager as pa,Keyboard as fa,InteractionManager as ma,LayoutAnimation as ya,Linking as ba,NativeEventEmitter as Sa,PanResponder as Ca,PixelRatio as xa,Platform as wa,Share as va,StyleSheet as le,UIManager as Ta,Vibration as Ia,CheckBox as ka,FlatList as Ze,Image as Da,ImageBackground as Ba,KeyboardAvoidingView as $a,Picker as Pa,ProgressBar as Na,RefreshControl as Ea,SafeAreaView as Aa,SectionList as Ra,StatusBar as La,Touchable as za,TouchableNativeFeedback as Va,VirtualizedList as Ha,YellowBox as ja,LogBox as Oa,DeviceEventEmitter as Wa,useColorScheme as Fa,useLocaleContext as Ma,useWindowDimensions as Ka}from"react-native-web";import*as M from"react-native-web";import{createElement as Ua,forwardRef as Za}from"react";function K(e){let t=Za((a,n)=>{let{accessibilityState:o,accessibilityValue:i,...c}=a;for(let s of["busy","checked","disabled","expanded","selected"])o?.[s]!==void 0&&c[`aria-${s}`]===void 0&&(c[`aria-${s}`]=o[s]);for(let[s,p]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[s]!==void 0&&c[`aria-${p}`]===void 0&&(c[`aria-${p}`]=i[s]);return Ua(e,{...c,ref:n})}),r=e.State;return r&&Object.assign(t,{State:r}),t.displayName=e.displayName??e.name??"NativeWebView",t}var d=K(M.View),x=K(M.Text),_a=K(M.TextInput),re=K(M.TouchableOpacity),Ga=K(M.TouchableHighlight),Ja=K(M.TouchableWithoutFeedback),Ya=K(M.Pressable),Te=K(M.ScrollView),qa=K(M.Modal),Qa=K(M.Switch),Xa=K(M.ActivityIndicator),eo=K(M.Button),to=M.findNodeHandle,ro={alert(e,t,r,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 o=document.createElement("h2");if(o.textContent=e,o.style.cssText="font-size:18px;margin:0 0 12px",n.appendChild(o),t){let p=document.createElement("p");p.textContent=t,p.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",n.appendChild(p)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let c=r?.length?r:[{text:"OK"}],s=()=>{n.close?.(),n.remove()};for(let p of c){let m=document.createElement("button");m.type="button",m.textContent=p.text??"OK",m.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${p.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,m.onclick=()=>{s(),p.onPress?.()},i.appendChild(m)}n.addEventListener("cancel",p=>{p.preventDefault(),a?.cancelable!==false&&(s(),a?.onDismiss?.())}),n.appendChild(i),document.body.appendChild(n),n.showModal?n.showModal():n.setAttribute("open","")}};import{JsModal as ao,ModalHeader as A,TabSelector as oo,macOSColors as no,night as V,ToolEmptyState as _e,resolveListEmptyState as Nt,Search as io,Filter as so,Power as lo,Lock as co,devToolsStorageKeys as uo,ProUpgradeModal as ho,PowerToggleButton as go,ToolbarCopyButton as Ge,ToolbarClearButton as po,truncatePayload as he,TickProvider as Et,useLimit as fo,windowDragProps as mo,EVENT_LIST_PRESET as At}from"@buoy-gg/shared-ui/web";import{useIsPro as yo}from"@buoy-gg/license/web";import{useCallback as bo,useMemo as Rt}from"react";import{useChangeLog as So,useSubscribedValue as Co}from"@buoy-gg/shared-ui/web";function xo(e,t){let r=e;if(t.searchText){let a=t.searchText.toLowerCase();r=r.filter(n=>n.storeName.toLowerCase().includes(a)||n.partialPreview.toLowerCase().includes(a)||n.changedKeys.some(o=>o.toLowerCase().includes(a)))}return t.storeNames&&t.storeNames.length>0&&(r=r.filter(a=>t.storeNames.includes(a.storeName))),t.onlyWithChanges&&(r=r.filter(a=>a.hasStateChange)),r}var wo=()=>S.getStores(),vo=e=>S.subscribeToStores(e);function Lt(){let e=So(S,{filterItems:xo}),t=Co(wo,vo),r=Rt(()=>{let o=e.items.length,i=e.items.filter(c=>c.hasStateChange).length;return{totalChanges:o,changesWithStateChange:i,changesWithoutStateChange:o-i,storeCount:t.length,averageDuration:0}},[e.items,t]),a=Rt(()=>S.getUniqueStoreNames(),[t]),n=bo(o=>S.getStateChangeById(o),[]);return{stateChanges:e.items,filteredChanges:e.filteredItems,filter:e.filter,setFilter:e.setFilter,stats:r,stores:t,clearChanges:S.clearStateChanges.bind(S),isEnabled:e.isEnabled,toggleCapture:e.toggleCapture,storeNames:a,getChangeById:n}}import{memo as To}from"react";import{ChangeRow as Io,buoyColors as zt,night as ko}from"@buoy-gg/shared-ui/web";import{jsx as Do}from"react/jsx-runtime";function Bo(e,t){switch(e){case"replace":return"Replace";case"persist":return"Hydrate";case"initial":return"Initial";default:return t.charAt(0).toUpperCase()+t.slice(1)}}function $o(e,t){switch(e){case"replace":return zt.warning;case"persist":return zt.info;case"initial":return ko.color.textTertiary;default:return S.getStoreColor(t)}}function Po(e){let t=[];return e.duration!==void 0&&e.duration>=.1&&t.push(`${e.duration.toFixed(1)}ms`),e.hasStateChange?e.changedKeysCount>0?t.push(`${e.changedKeysCount} key${e.changedKeysCount>1?"s":""} changed`):t.push(e.diffSummary||"state changed"):t.push("no state change"),t.join(" \xB7 ")}function No(e){return e.category==="replace"?"REPLACE":e.category==="persist"?"HYDRATE":e.category==="initial"?"INIT":"SET"}function Eo(e){return 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.partialPreview||"setState()"}var Vt=To(function({change:e,onPress:t,testID:r}){let a=$o(e.category,e.storeName),n=Bo(e.category,e.storeName),o=Po(e),i=Eo(e),c=No(e);return Do(Io,{statusColor:a,statusLabel:n,sublabel:o,primaryText:i,timestamp:e.timestamp,badgeText:c,changed:e.hasStateChange,slow:e.isSlowUpdate,onPress:()=>t(e),testID:r})});import{useState as Ht,useCallback as Pe,useMemo as jt}from"react";import{night as ae,EventStepperFooter as Ot,formatRelativeTime as Ne,parseValue as Ee,monoFont as Ie}from"@buoy-gg/shared-ui/web";import{DataViewer as Ao,SplitDiffViewer as Ro,TreeDiffViewer as Lo,diffThemes as zo}from"@buoy-gg/shared-ui/web/dataViewer";import{memo as Vo}from"react";import{DetailViewToggle as Ho,FileText as jo,Database as Oo,GitBranch as Wo}from"@buoy-gg/shared-ui/web";import{jsx as Fo}from"react/jsx-runtime";var Mo=[{key:"change",label:"CHANGE",description:"View change details",icon:jo},{key:"state",label:"STATE",description:"View current state",icon:Oo},{key:"diff",label:"DIFF",description:"Compare changes",icon:Wo}],Ko=["diff"],Uo=Vo(function({activeView:e,onViewChange:t,diffDisabled:r=false}){return Fo(Ho,{views:Mo,activeView:e,onViewChange:t,disabledKeys:r?Ko:void 0,testIDPrefix:"buoy-zustand"})});import{memo as Zo,useCallback as Je,useState as _o,useEffect as Go}from"react";import{buoyColors as H,night as I,Clock as Jo,AlertTriangle as Yo,Zap as Wt,Info as qo,Box as Ft,Database as Qo,parseValue as Xo,ProUpgradeModal as en,copyToClipboard as tn,InfoRow as Mt,monoFont as ge}from"@buoy-gg/shared-ui/web";import{useIsPro as rn}from"@buoy-gg/license/web";import{DataViewer as an}from"@buoy-gg/shared-ui/web/dataViewer";import{night as $,monoFont as on}from"@buoy-gg/shared-ui/web";import{jsx as Kt,jsxs as nn}from"react/jsx-runtime";var sn={copy:{color:$.color.accent,backgroundColor:$.color.accentSoft,borderColor:$.color.accentBorder,textColor:$.color.accent},reset:{color:$.color.warning,backgroundColor:$.color.warningSoft,borderColor:$.color.warning+"40",textColor:$.color.warning},clear:{color:$.color.danger,backgroundColor:$.color.dangerSoft,borderColor:$.color.danger+"40",textColor:$.color.danger},jump:{color:$.color.warning,backgroundColor:$.color.warningSoft,borderColor:$.color.warning+"40",textColor:$.color.warning}};function Ye({onPress:e,text:t,type:r,disabled:a=false,testID:n}){let o=sn[r];return nn(re,{disabled:a,onPress:e,style:[qe.button,{backgroundColor:a?$.color.textTertiary+"1A":o.backgroundColor,borderColor:a?$.color.textTertiary+"33":o.borderColor,opacity:a?.5:1}],activeOpacity:.7,testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:a},children:[Kt(d,{style:[qe.dot,{backgroundColor:a?$.color.textTertiary:o.color}]}),Kt(x,{style:[qe.text,{color:a?$.color.textTertiary:o.textColor}],children:t})]})}var qe=le.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:6,borderWidth:1,paddingHorizontal:12,paddingVertical:6,height:25,minWidth:80,shadowOffset:{width:0,height:1},shadowOpacity:.2,shadowRadius:2,elevation:2},dot:{width:5,height:5,borderRadius:3,marginRight:6,shadowColor:$.color.text,shadowOffset:{width:0,height:0},shadowOpacity:.6,shadowRadius:2},text:{fontSize:10,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:on,height:12}});var u="buoy-zustand";function Qe(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function ln(e,t){return`${u}-row-${Qe(e)}-${t}`}function Ut(e){return`${u}-store-${Qe(e)}`}function cn(e){let t=new Map,r=new Map;for(let a of e){let n=(t.get(a.storeName)??0)+1;t.set(a.storeName,n),r.set(a.id,ln(a.storeName,n))}return r}import{jsx as w,jsxs as W}from"react/jsx-runtime";function dn(e){switch(e){case"replace":return{label:"REPLACE",color:H.warning,bgColor:H.warning+"26"};case"persist":return{label:"PERSIST",color:H.info,bgColor:H.info+"26"};case"initial":return{label:"INITIAL",color:I.color.textTertiary,bgColor:I.color.textTertiary+"26"};default:return{label:"SET STATE",color:H.success,bgColor:H.success+"26"}}}function un(e){return e===void 0?"N/A":e<1?"<1ms":`${e.toFixed(1)}ms`}function Ae({icon:e,title:t,badge:r,testID:a}){return W(d,{style:C.sectionHeader,testID:a,children:[W(d,{style:C.sectionHeaderLeft,children:[w(e,{size:14,color:I.color.accent}),w(x,{style:C.sectionTitle,children:t})]}),r]})}function hn(e){let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0"),n=t.getSeconds().toString().padStart(2,"0"),o=t.getMilliseconds().toString().padStart(3,"0");return`${r}:${a}:${n}.${o}`}var gn=Zo(function({change:e}){let t=rn(),[r,a]=_o(false);Go(()=>{r&&t&&a(false)},[r,t]);let n=dn(e.category),o=e.partial!==void 0&&e.partial!=="(updater fn)",i=e.changedKeys.length>0,c=S.getStoreColor(e.storeName),s=Je(async()=>{if(!t){a(true);return}await tn(e.nextState)},[e.nextState,t]),p=Je(()=>{let y=S.getStore(e.storeName);if(y?.api.getInitialState){let b=y.api.getInitialState();y.api.setState(b,true)}},[e.storeName]),m=Je(()=>{let y=S.getStore(e.storeName);y&&y.api.setState(e.nextState,true)},[e.storeName,e.nextState]);return W(Te,{style:C.container,contentContainerStyle:C.contentContainer,showsVerticalScrollIndicator:false,testID:`${u}-detail-scroll`,children:[W(d,{style:C.card,testID:`${u}-info-card`,children:[w(Ae,{icon:qo,title:"CHANGE INFO"}),W(d,{style:C.cardContent,children:[w(Mt,{label:"Store",value:e.storeName,mono:true,valueColor:c,testID:`${u}-info-store`}),w(Mt,{label:"Time",value:hn(e.timestamp),mono:true,testID:`${u}-info-time`}),W(d,{style:C.badgeRow,children:[w(d,{style:[C.categoryBadge,{backgroundColor:n.bgColor}],children:w(x,{style:[C.categoryText,{color:n.color}],testID:`${u}-info-category`,children:n.label})}),W(d,{style:[C.durationBadge,e.isSlowUpdate&&C.durationBadgeSlow],children:[w(Jo,{size:10,color:e.isSlowUpdate?H.error:I.color.textSecondary}),w(x,{style:[C.durationText,e.isSlowUpdate&&C.durationTextSlow],testID:`${u}-info-duration`,children:un(e.duration)}),e.isSlowUpdate&&w(Yo,{size:10,color:H.error})]}),e.hasStateChange?W(d,{style:C.changesBadge,children:[w(Wt,{size:10,color:H.success}),w(x,{style:C.changesText,testID:`${u}-info-changes`,children:e.diffSummary||"changed"})]}):w(d,{style:C.noChangesBadge,children:w(x,{style:C.noChangesText,testID:`${u}-info-no-changes`,children:"no change"})}),e.isPersisted&&W(d,{style:C.persistBadge,children:[w(Qo,{size:10,color:H.info}),w(x,{style:C.persistText,testID:`${u}-info-persisted`,children:"PERSISTED"})]})]})]})]}),i&&W(d,{style:C.card,testID:`${u}-keys-card`,children:[w(Ae,{icon:Wt,title:"CHANGED KEYS",badge:w(d,{style:C.countBadge,children:w(x,{style:C.countText,testID:`${u}-keys-count`,children:e.changedKeys.length})})}),w(d,{style:C.cardContent,children:w(d,{style:C.keysContainer,children:e.changedKeys.map(y=>w(d,{style:C.keyBadge,children:w(x,{style:C.keyText,testID:`${u}-key-${y}`,children:y})},y))})})]}),o&&W(d,{style:C.card,testID:`${u}-partial-card`,children:[w(Ae,{icon:Ft,title:"PARTIAL (setState argument)",badge:w(d,{style:C.typeBadge,children:w(x,{style:C.typeText,testID:`${u}-partial-type`,children:Array.isArray(e.partial)?"ARRAY":typeof e.partial=="object"?"OBJECT":(typeof e.partial).toUpperCase()})})}),w(d,{style:C.dataViewerContainer,children:w(an,{title:"",data:Xo(e.partial),showTypeFilter:true,rawMode:true,initialExpanded:true})})]}),e.partial==="(updater fn)"&&W(d,{style:C.card,testID:`${u}-updater-card`,children:[w(Ae,{icon:Ft,title:"SET STATE CALL"}),W(d,{style:C.cardContent,children:[w(x,{style:C.updaterText,children:"Called with an updater function: set((state) => ...)"}),w(x,{style:C.updaterSubtext,children:"The partial value is computed at runtime from the previous state. See the DIFF tab to view the resulting changes."})]})]}),W(d,{style:C.actionsGrid,children:[w(Ye,{type:"jump",text:"JUMP",onPress:m,testID:`${u}-jump`}),w(Ye,{type:"reset",text:"RESET STORE",onPress:p,testID:`${u}-reset`}),w(Ye,{type:"copy",text:"COPY STATE",onPress:s,testID:`${u}-copy-state`})]}),w(en,{visible:r,onClose:()=>a(false),featureName:"Copy"})]})}),C=le.create({container:{flex:1},contentContainer:{padding:8,paddingBottom:100,gap:16},card:{backgroundColor:I.color.surface,borderRadius:6,borderWidth:1,borderColor:I.color.accentBorderStrong,overflow:"hidden",shadowColor:I.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:I.color.accentBorder,backgroundColor:I.color.accentSoft},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:6},sectionTitle:{fontSize:12,fontWeight:"600",letterSpacing:.5,color:I.color.accent,fontFamily:ge},cardContent:{padding:14,gap:10},badgeRow:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},categoryBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4},categoryText:{fontSize:9,fontWeight:"700",letterSpacing:.3},durationBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:I.color.surfaceElevated},durationBadgeSlow:{backgroundColor:H.error+"26"},durationText:{fontSize:9,fontWeight:"600",color:I.color.textSecondary,fontFamily:ge},durationTextSlow:{color:H.error},changesBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:H.success+"26"},changesText:{fontSize:9,fontWeight:"600",color:H.success},noChangesBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:I.color.surfaceElevated},noChangesText:{fontSize:9,fontWeight:"600",color:I.color.textTertiary},persistBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:H.info+"26"},persistText:{fontSize:9,fontWeight:"700",color:H.info,letterSpacing:.3},keysContainer:{flexDirection:"row",flexWrap:"wrap",gap:6},keyBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4,backgroundColor:I.color.accentSoft,borderWidth:1,borderColor:I.color.accentBorder},keyText:{fontSize:11,fontWeight:"600",color:I.color.accent,fontFamily:ge},countBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:I.color.accentFill},countText:{fontSize:9,fontWeight:"700",color:I.color.accent,fontFamily:ge},typeBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:3,backgroundColor:I.color.surfaceElevated},typeText:{fontSize:8,fontWeight:"600",color:I.color.textTertiary,fontFamily:ge},dataViewerContainer:{backgroundColor:I.color.bg,minHeight:60},updaterText:{fontSize:12,color:I.color.text,fontFamily:ge},updaterSubtext:{fontSize:11,color:I.color.textTertiary,lineHeight:16,marginTop:4},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:12,justifyContent:"flex-start"}});import{DiffModeTabs as pn,CompareBar as fn}from"@buoy-gg/shared-ui/web";import{jsx as B,jsxs as pe}from"react/jsx-runtime";function Xe(e){return S.getStoreColor(e.storeName)}function Zt(e){switch(e.category){case"replace":return"REPLACE";case"persist":return"HYDRATE";case"initial":return"INIT";default:return"SET"}}function mn(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}function _t(e){return new Date(e).toLocaleTimeString("en-US",{hour12:false,hour:"2-digit",minute:"2-digit",second:"2-digit"})}var yn=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}];function Gt({change:e,changes:t,selectedIndex:r,onIndexChange:a,disableInternalFooter:n=false,initialView:o="change"}){let[i,c]=Ht(o),[s,p]=Ht("tree"),m=t.length,y=Xe(e),b=Zt(e),h=mn(Ee(e.nextState)),f=m-r,P=f-1,D=r<m-1?r+1:null,j=D!==null?t[D]:null,O=jt(()=>({index:D??0,label:P>0?`#${P}`:"Initial",timestamp:j?_t(j.timestamp):"",relativeTime:j?Ne(new Date(j.timestamp)):"state",badge:j?B(d,{style:[N.changeBadgeSmall,{backgroundColor:`${Xe(j)}20`}],children:B(x,{style:[N.changeTextSmall,{color:Xe(j)}],children:Zt(j)})}):void 0}),[D,j,P]),me=jt(()=>({index:r,label:`#${f}`,timestamp:_t(e.timestamp),relativeTime:Ne(new Date(e.timestamp)),badge:B(d,{style:[N.changeBadgeSmall,{backgroundColor:`${y}20`}],children:B(x,{style:[N.changeTextSmall,{color:y}],children:b})})}),[r,e.timestamp,y,b,f]),oe=Pe(()=>{let ne=Ee(e.nextState);return pe(d,{style:N.contentCard,testID:`${u}-state-card`,children:[pe(d,{style:N.valueHeader,children:[B(x,{style:N.valueLabel,children:"STATE AFTER CHANGE"}),pe(d,{style:N.valueHeaderBadges,children:[B(d,{style:[N.changeBadge,{backgroundColor:`${y}20`}],children:B(x,{style:[N.changeText,{color:y}],children:b})}),B(d,{style:N.typeBadge,children:B(x,{style:N.typeText,testID:`${u}-state-type`,children:h.toUpperCase()})})]})]}),B(d,{style:N.dataViewerContainer,children:B(Ao,{title:"",data:ne,showTypeFilter:true,rawMode:true,initialExpanded:true})})]})},[e.nextState,y,b,h]),ye=Pe(()=>{let ne=Ee(e.prevState),de=Ee(e.nextState);return s==="split"?B(Te,{style:{flex:1},showsVerticalScrollIndicator:true,children:B(Ro,{oldValue:ne,newValue:de,theme:zo.devToolsDefault,options:{hideLineNumbers:false,disableWordDiff:false,showDiffOnly:false,compareMethod:"words",contextLines:3},showThemeName:false})}):B(Lo,{oldValue:ne,newValue:de})},[e.prevState,e.nextState,s]),be=Pe(()=>{a(Math.min(m-1,r+1))},[r,m,a]),Se=Pe(()=>{a(Math.max(0,r-1))},[r,a]),J=e.prevState===void 0,Ce=!n&&m>1;return pe(d,{style:N.container,children:[B(Uo,{activeView:i,onViewChange:c,diffDisabled:J}),pe(d,{style:[N.contentArea,Ce&&N.contentAreaFooterPad],children:[i==="change"&&B(gn,{change:e}),i==="state"&&B(d,{style:N.stateContainer,children:oe()}),i==="diff"&&pe(d,{style:N.diffContainer,testID:`${u}-diff`,children:[B(pn,{tabs:yn,activeTab:s,onTabChange:p,testIDPrefix:`${u}-diff-tab`}),B(fn,{leftEvent:O,rightEvent:me}),B(d,{style:N.diffContent,testID:`${u}-diff-content`,children:ye()})]})]}),Ce&&B(Ot,{currentIndex:f-1,totalItems:m,onPrevious:be,onNext:Se,itemLabel:"Change",subtitle:Ne(new Date(e.timestamp)),absolute:true})]})}function Jt({change:e,changes:t,selectedIndex:r,onIndexChange:a}){let n=t.length;if(n<=1)return null;let o=n-r;return B(Ot,{currentIndex:o-1,totalItems:n,onPrevious:()=>a(Math.min(n-1,r+1)),onNext:()=>a(Math.max(0,r-1)),itemLabel:"Change",subtitle:Ne(new Date(e.timestamp))})}var N=le.create({container:{flex:1,backgroundColor:"transparent"},contentArea:{flex:1},contentAreaFooterPad:{paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:ae.color.surface,borderRadius:14,padding:14,borderWidth:1,borderColor:ae.color.border},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:ae.color.textSecondary,fontFamily:Ie,letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},changeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},changeText:{fontSize:9,fontWeight:"700",fontFamily:Ie,letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:ae.color.surfaceElevated},typeText:{fontSize:9,fontWeight:"600",color:ae.color.textTertiary,fontFamily:Ie},valueBox:{backgroundColor:ae.color.bg,borderRadius:6,borderWidth:1,borderColor:ae.color.border,padding:8},valueText:{fontSize:12,color:ae.color.text,fontFamily:Ie,lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},changeBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},changeTextSmall:{fontSize:8,fontWeight:"700",fontFamily:Ie},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12}});import{useMemo as bn}from"react";import{CompactRow as Sn,night as et,ToolEmptyState as tt,resolveListEmptyState as Cn,monoFont as Yt}from"@buoy-gg/shared-ui/web";import{jsx as G,jsxs as rt}from"react/jsx-runtime";function xn(e){try{let t=e.api.getState();if(t&&typeof t=="object"&&t.__buoyStateOnDevice===true)return"on device";if(t&&typeof t=="object"){let r=Object.keys(t).filter(a=>typeof t[a]!="function");return r.length===0?"no data keys":r.length<=3?r.join(", "):`${r.slice(0,2).join(", ")} +${r.length-2}`}return""}catch{return""}}function wn(){return G(tt,{testID:`${u}-stores-loading`,otto:"loading",title:"Loading stores\u2026",message:"Waiting for the device to send its registered stores."})}function vn(){return G(tt,{testID:`${u}-stores-empty`,otto:"scanning",title:"No stores registered",message:`Use watchStores() to register your Zustand stores.
|
|
2
|
+
They will appear here with their current state.`})}function Tn({stores:e,searchQuery:t,isLoading:r=false,onOpenStore:a}){let n=bn(()=>{if(!t)return e;let o=t.toLowerCase();return e.filter(i=>i.name.toLowerCase().includes(o)||i.persistName&&i.persistName.toLowerCase().includes(o))},[e,t]);return n.length===0&&!t?r?G(wn,{}):G(vn,{}):n.length===0&&t?G(tt,{testID:`${u}-stores-no-match`,...Cn({subject:"stores",verb:"registered",search:t,total:e.length,waiting:{otto:"scanning",title:"No stores registered",message:"Use watchStores() to register your Zustand stores."}})}):rt(Te,{style:X.container,contentContainerStyle:X.scrollContent,showsVerticalScrollIndicator:true,testID:`${u}-stores-scroll`,children:[rt(d,{style:X.sectionHeader,children:[G(x,{style:X.sectionTitle,children:"STORES"}),G(d,{style:X.sectionCountBadge,children:G(x,{style:X.sectionCountText,testID:`${u}-stores-count`,children:n.length})})]}),n.map(o=>{let i=xn(o),c=S.getStoreColor(o.name),s=Ut(o.name);return rt(d,{style:X.storeRowWrapper,children:[G(Sn,{statusDotColor:c,statusLabel:o.isPersisted?"persisted":"in-memory",primaryText:o.name,secondaryText:i||void 0,showChevron:true,onPress:()=>a(o.name),testID:s,statusTestID:`${s}-backing`,primaryTestID:`${s}-name`,secondaryTestID:`${s}-keys`}),o.stateChangeCount>0&&G(d,{style:[X.absCountBadge,{backgroundColor:c+"22",borderColor:c+"55"}],pointerEvents:"none",children:G(x,{style:[X.absCountText,{color:c}],testID:`${s}-count`,children:String(o.stateChangeCount)})})]},o.name)})]})}var X=le.create({container:{flex:1},storeRowWrapper:{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:Yt},scrollContent:{paddingTop:8,paddingBottom:20},sectionHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:8,gap:8},sectionTitle:{fontSize:11,fontWeight:"700",letterSpacing:.5,color:et.color.textTertiary},sectionCountBadge:{backgroundColor:et.color.accentFill,paddingHorizontal:8,paddingVertical:2,borderRadius:4},sectionCountText:{fontSize:10,fontWeight:"700",color:et.color.accent,fontFamily:Yt}});import{useCallback as In,useEffect as kn,useMemo as at,useState as Re}from"react";import{buoyColors as ot,Database as Dn,ExpandedInfoRow as Le,FileJson as Bn,night as R,PillBadge as nt,parseValue as qt,monoFont as ze}from"@buoy-gg/shared-ui/web";import{DataViewer as $n,LiveExplorer as Pn,ValueEditModal as Nn,updateNestedDataByPath as En,deleteNestedDataByPath as An}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as Qt,jsx as v,jsxs as U}from"react/jsx-runtime";var Rn=300,ce=`${u}-detail`;function Ln(e){let t=r=>r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e.length===0?`${ce}-explorer-root`:`${ce}-explorer-${e.map(t).filter(Boolean).join("-")}`}function zn({store:e,onViewHistory:t}){let r=Ut(e.name),[a,n]=Re(0);kn(()=>e.api.subscribe(()=>n(b=>b+1)),[e.api]);let o=e.api.getState(),i=at(()=>It(o),[o,a]),[c,s]=Re(false),p=at(()=>{if(i.data!==null)return{update:(b,h)=>{let f=e.api.getState();if(!_(f)||b.length===0)return;let P=b[0],D=b.length===1?h:En(f[P],b.slice(1),h);e.api.setState({[P]:D},false)},remove:b=>{let h=e.api.getState();if(!_(h)||b.length<=1)return;let f=b[0],P=An(h[f],b.slice(1));e.api.setState({[f]:P},false)},canRemove:b=>b.length>1}},[e.api,i.data===null]),m=In(b=>{let h=It(e.api.getState());if(h.data===null)return;let f=qr(h.data,b);Object.keys(f).length>0&&e.api.setState(f,false),s(false)},[e.api]),y=at(()=>{if(o&&typeof o=="object"){let b={};for(let[h,f]of Object.entries(o))typeof f!="function"&&(b[h]=f);return qt(b)}return qt(o)},[o,a]);return U(d,{style:T.root,children:[U(Te,{testID:`${ce}-scroll`,style:T.scroll,contentContainerStyle:T.scrollContent,keyboardShouldPersistTaps:"handled",children:[v(d,{style:T.section,children:U(d,{style:T.editorContainer,children:[U(d,{style:T.sectionHeaderRow,children:[v(x,{testID:`${ce}-editor-header`,style:T.sectionHeaderText,children:"State Editor"}),i.data!==null?U(re,{onPress:()=>s(true),testID:`${ce}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:T.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[v(Bn,{size:13,color:R.color.accent}),v(x,{style:T.rawButtonText,children:"Raw"})]}):null]}),v(d,{style:T.sectionBody,children:i.data!==null?U(Qt,{children:[v(Pn,{editable:true,label:"State",value:i.data,defaultExpanded:["State"],writer:p,dataVersion:a,testIDForPath:Ln,debounceMs:Rn}),v(x,{style:T.editorHint,children:"Edits write into the live store as you make them \u2014 merged, so the store's actions and untouched keys survive."})]}):v(x,{style:T.blockedText,testID:`${ce}-edit-blocked`,children:i.blockedReason})})]})}),v(d,{style:T.section,children:U(d,{style:T.infoContainer,children:[v(x,{style:T.sectionHeaderTextPlain,children:"Store Details"}),U(d,{style:T.infoBody,children:[v(Le,{label:"Type",children:v(nt,{color:e.color,testID:`${r}-type`,children:"ZUSTAND"})}),U(Le,{label:"Backing",children:[v(nt,{color:ot.info,icon:e.isPersisted?v(Dn,{size:9,color:ot.info}):void 0,testID:`${r}-persist`,children:e.isPersisted?e.persistName||"persisted":"in-memory"}),e.isPersisted?v(Vn,{store:e,rowID:r}):null]}),e.stateChangeCount>0&&U(Le,{label:"Changes",children:[v(nt,{color:ot.warning,testID:`${r}-changes`,children:String(e.stateChangeCount)}),v(re,{onPress:()=>t(e.name),style:T.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},testID:`${r}-history`,accessibilityRole:"button",accessibilityLabel:`View ${e.name} history`,children:v(x,{style:[T.inlineLinkText,{color:e.color}],children:"view history \u2192"})})]}),i.fnPaths.length>0&&v(Le,{label:"Actions",children:v(x,{style:T.actionsText,testID:`${ce}-actions`,numberOfLines:2,children:i.fnPaths.join(" \xB7 ")})})]})]})}),v(d,{style:T.section,children:U(d,{style:T.infoContainer,children:[v(x,{style:T.sectionHeaderTextPlain,children:"State Explorer"}),v(d,{style:T.viewerBody,testID:`${r}-state`,children:y&&typeof y=="object"?v($n,{title:"",data:y,showTypeFilter:true,rawMode:true,initialExpanded:false}):v(x,{style:T.blockedText,children:"Empty state"})})]})})]}),c&&i.data!==null?v(Nn,{path:[],value:i.data,onSave:b=>{try{m(b)}catch{}},onCancel:()=>s(false),saveLabel:"Apply",testIDPrefix:`${u}-value`}):null]})}function Vn({store:e,rowID:t}){let[r,a]=Re(false),[n,o]=Re(null);return e.rehydrate?U(Qt,{children:[v(re,{onPress:()=>{a(true),o(null),(async()=>{try{await e.rehydrate?.()}catch(i){o(i instanceof Error?i.message:String(i))}finally{a(false)}})()},disabled:r,style:T.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},testID:`${t}-reread`,accessibilityRole:"button",accessibilityLabel:`Re-read ${e.name} from storage`,children:v(x,{style:[T.inlineLinkText,{color:e.color}],children:r?"re-reading\u2026":"re-read saved value \u2192"})}),n?v(x,{style:[T.inlineLinkText,{color:R.color.danger}],children:n}):null]}):null}var T=le.create({root:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8,paddingBottom:24},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:R.color.surface,borderRadius:6,borderWidth:1,borderColor:R.color.accent+"4D",overflow:"hidden",shadowColor:R.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:R.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:R.color.accent+"33"},sectionHeaderText:{fontWeight:"600",fontSize:12,color:R.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:ze},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:R.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:R.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:R.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:R.color.surface,borderRadius:6,borderWidth:1,borderColor:R.color.border,overflow:"hidden"},sectionHeaderTextPlain:{backgroundColor:R.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:R.color.textSecondary,borderBottomWidth:1,borderBottomColor:R.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:ze},infoBody:{padding:12,gap:10},viewerBody:{backgroundColor:R.color.bg,minHeight:60},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:ze},actionsText:{flex:1,color:R.color.textSecondary,fontSize:10,fontFamily:ze,lineHeight:15}});import{useMemo as Hn}from"react";import{EntityFilterView as jn}from"@buoy-gg/shared-ui/web";import{jsx as On}from"react/jsx-runtime";var Wn=["\u2022 auth \u2192 hides authStore from stores & events","\u2022 temp \u2192 hides tempStore, tempUserStore","\u2022 cart \u2192 hides cartStore from both tabs"];function Fn({ignoredPatterns:e,onTogglePattern:t,onAddPattern:r,stores:a}){let n=Hn(()=>a.map(o=>({name:o.name,color:S.getStoreColor(o.name)})),[a]);return On(jn,{entities:n,ignoredPatterns:e,onTogglePattern:t,onAddPattern:r,entityNoun:"STORES",entitySingular:"store",entityKey:"store",testIDPrefix:u,slug:Qe,howItWorks:"Patterns hide matching stores from both the Stores tab and the Events tab. Tap a store above to quickly add it as a filter.",examples:Wn})}import{Fragment as Xt,jsx as g,jsxs as F}from"react/jsx-runtime";function Mn({isEnabled:e,searchText:t,totalChanges:r}){let a=Nt({subject:"changes",search:t,total:r,capturing:e,waiting:{otto:"waiting",title:"No state changes",message:"State changes will appear here as stores update."},paused:{title:"No state changes",message:"Enable capture to start recording state changes"}});return g(_e,{...a,testID:`${u}-empty`})}function Ve({visible:e,onClose:t,onBack:r,onMinimize:a,enableSharedModalDimensions:n=false,inline:o=false,storesLoading:i=false,initialTab:c="stores",initialSelectedChangeId:s,initialDetailView:p,onChangeSelect:m,onStoreExpand:y}){let b=yo(),h=fo("zustand.changes"),[f,P]=Q(false),[D,j]=Q(c),[O,me]=Q(null),[oe,ye]=Q(null),[be,Se]=Q(false),[J,Ce]=Q(new Set),{stateChanges:ne,filteredChanges:de,filter:mi,setFilter:xe,stats:ir,stores:we,clearChanges:sr,isEnabled:ke,toggleCapture:lr}=Lt(),Y=te(()=>J.size===0?de:de.filter(l=>!Array.from(J).some(k=>l.storeName.toLowerCase().includes(k.toLowerCase()))),[de,J]),ue=te(()=>J.size===0?we:we.filter(l=>!Array.from(J).some(k=>l.name.toLowerCase().includes(k.toLowerCase()))),[we,J]),cr=te(()=>O?ne.filter(l=>l.storeName===O).length:0,[ne,O]),De=te(()=>O?Y.filter(l=>l.storeName===O):Y,[Y,O]),Fe=te(()=>De.slice(0,h),[De,h]),Me=te(()=>Math.max(0,De.length-h),[De.length,h]),dr=Me>0,z=Fe,[Ke,ie]=Q(null),se=te(()=>{if(Ke===null)return null;let l=z.findIndex(k=>k.id===Ke);return l>=0?l:null},[Ke,z]),Z=se!==null?z[se]:null,lt=$e(null);$t(()=>{if(!m)return;let l=Z?.id??null;l===null||l===lt.current||(lt.current=l,m(Z))},[Z,m]);let ct=$e(null);$t(()=>{!s||ct.current===s||!z.some(l=>l.id===s)||(ct.current=s,ie(s))},[s,z]);let[ee,Ue]=Q(""),[ur,Be]=Q(false),yi=$e(null),hr=$e(null),gr=E(l=>{},[]),pr=l=>{Ue(l),D==="events"&&xe(k=>({...k,searchText:l}))},fr=E(()=>{Ue(""),xe(l=>({...l,searchText:""})),Be(false)},[xe]),dt=E(l=>{ie(l.id)},[]),mr=E(()=>{P(true)},[]),yr=E(()=>{ie(null)},[]),ut=E(l=>{let k=z[l];k&&ie(k.id)},[z]),br=E(l=>{me(l),ie(null)},[]),Sr=E(()=>{me(null),ie(null)},[]),Cr=E(l=>{ye(l),y?.(l)},[y]),xr=E(()=>{ye(null)},[]),wr=E(()=>ue.reduce((l,k)=>{try{let q=k.api.getState();if(q&&typeof q=="object"){let Ct={};for(let[Er,xt]of Object.entries(q))typeof xt!="function"&&(Ct[Er]=he(xt));l[k.name]=Ct}else l[k.name]=he(q)}catch{l[k.name]=null}return l},{}),[ue]),vr=E(()=>Y.map(l=>({id:l.id,storeName:l.storeName,timestamp:l.timestamp,prevState:he(l.prevState),nextState:he(l.nextState),hasStateChange:l.hasStateChange,changedKeys:l.changedKeys})),[Y]),Tr=E(()=>z.map(l=>({id:l.id,storeName:l.storeName,timestamp:l.timestamp,prevState:he(l.prevState),nextState:he(l.nextState),hasStateChange:l.hasStateChange,changedKeys:l.changedKeys})),[z]),Ir=E(l=>{Ce(k=>{let q=new Set(k);return q.has(l)?q.delete(l):q.add(l),q})},[]),kr=E(l=>{Ce(k=>new Set([...k,l]))},[]),Dr=E(l=>{j(l),me(null),ye(null),ie(null),Se(false),ee&&(Ue(""),xe(k=>({...k,searchText:""}))),Be(false)},[ee,xe]),ht=E(l=>l.id,[]),gt=te(()=>cn(z),[z]),pt=E(({item:l})=>g(Vt,{change:l,onPress:dt,testID:gt.get(l.id)}),[dt,gt]),ft=J.size>0,mt=()=>be?F(A,{children:[g(A.Navigation,{onBack:()=>Se(false)}),g(A.Content,{title:"Filters",centered:true,testID:`${u}-filters-title`})]}):Z?F(A,{children:[g(A.Navigation,{onBack:yr}),g(A.Content,{title:`${Z.storeName}/setState`,centered:true,testID:`${u}-detail-title`})]}):O?F(A,{children:[g(A.Navigation,{onBack:Sr}),g(A.Content,{title:`${O} History`,centered:true,testID:`${u}-history-title`}),g(A.Actions,{children:g(Ge,{value:Tr,disabled:z.length===0,buttonStyle:L.headerActionButton,testID:`${u}-copy`})})]}):oe?F(A,{children:[g(A.Navigation,{onBack:xr}),g(A.Content,{title:oe,centered:true,testID:`${u}-store-detail-title`})]}):F(A,{children:[r&&g(A.Navigation,{onBack:r}),g(A.Content,{title:"",children:ur?g(A.Search,{value:ee,onChangeText:pr,onCancel:fr,placeholder:D==="stores"?"Search stores...":"Search events...",accessibilityLabel:"Search Zustand stores and events",iconSize:14,testID:`${u}-search-field`,containerTestID:`${u}-search`,clearTestID:`${u}-search-clear`,onBlur:()=>{ee.length===0&&Be(false)}}):g(oo,{tabs:[{key:"stores",label:`Stores${ue.length>0?` (${ue.length})`:""}`},{key:"events",label:`Events${Y.length>0?` (${Y.length})`:""}`}],activeTab:D,onTabChange:Dr,testIDPrefix:`${u}-tab`})}),F(A.Actions,{children:[g(re,{onPress:()=>Be(true),style:L.headerActionButton,testID:`${u}-search-open`,accessibilityRole:"button",accessibilityLabel:"Search",children:g(io,{size:14,color:V.color.textSecondary})}),g(re,{onPress:()=>Se(true),style:[L.headerActionButton,ft&&L.headerActionButtonActive],testID:`${u}-filters-open`,accessibilityRole:"button",accessibilityLabel:"Filters",children:g(so,{size:14,color:ft?V.color.accent:V.color.textSecondary})}),D==="stores"&&g(Ge,{value:wr,disabled:ue.length===0,buttonStyle:L.headerActionButton,testID:`${u}-copy`}),D==="events"&&F(Xt,{children:[g(Ge,{value:vr,disabled:Y.length===0,buttonStyle:L.headerActionButton,testID:`${u}-copy`}),g(go,{isEnabled:ke,onToggle:lr,accessibilityLabel:"Toggle Zustand state capture",testID:`${u}-power`}),g(po,{onPress:sr,disabled:Y.length===0,buttonStyle:L.headerActionButton,testID:`${u}-clear`})]})]})]}),Br=()=>{if(be)return g(Fn,{ignoredPatterns:J,onTogglePattern:Ir,onAddPattern:kr,stores:we});if(Z&&se!==null)return g(Gt,{change:Z,changes:z,selectedIndex:se,onIndexChange:ut,disableInternalFooter:true,initialView:p});if(O)return z.length>0?g(Ze,{testID:`${u}-history-list`,data:z,renderItem:pt,keyExtractor:ht,contentContainerStyle:L.listContent,showsVerticalScrollIndicator:true,...At}):g(_e,{testID:`${u}-history-empty`,...Nt({subject:"changes",search:ee,total:ee.trim()?cr:0,capturing:ke,waiting:{otto:"waiting",title:"No history yet",message:`State changes for ${O} will appear here.`},paused:{title:"No history yet",message:`Capture is off, so nothing is being recorded for ${O}.`}})});if(oe){let l=we.find(k=>k.name===oe)??null;return l?g(zn,{store:l,onViewHistory:br}):g(_e,{testID:`${u}-store-detail-gone`,otto:"ghost",title:"Store no longer registered",message:`${oe} is not in the registry any more.`})}return D==="stores"?g(Tn,{stores:ue,searchQuery:ee,isLoading:i,onOpenStore:Cr}):F(Xt,{children:[!ke&&F(d,{style:L.disabledBanner,testID:`${u}-banner-disabled`,children:[g(lo,{size:14,color:V.color.warning}),g(x,{style:L.disabledText,children:"State capture is disabled"})]}),dr&&F(re,{style:L.lockedBanner,onPress:mr,activeOpacity:.8,testID:`${u}-locked`,accessibilityRole:"button",children:[g(co,{size:14,color:V.color.accent}),F(x,{style:L.lockedText,testID:`${u}-locked-text`,children:[Me," older"," ",Me===1?"change":"changes"," locked"]}),g(d,{style:L.upgradeBadge,children:g(x,{style:L.upgradeBadgeText,children:"UPGRADE"})})]}),Fe.length>0?g(Ze,{ref:hr,testID:`${u}-list`,data:Fe,renderItem:pt,keyExtractor:ht,contentContainerStyle:L.listContent,showsVerticalScrollIndicator:true,...At}):g(Mn,{isEnabled:ke,searchText:ee,totalChanges:ir.totalChanges})]})},$r=n?uo.modal.root():"buoy-zustand-modal";if(!e)return null;let yt=Z&&se!==null?g(Jt,{change:Z,changes:z,selectedIndex:se,onIndexChange:ut}):null,Pr=Z&&z.length>1?68:0,Nr=!be&&!(Z&&se!==null)&&(O!=null||D==="events"||D==="stores"),bt=g(d,{style:L.container,children:Br()}),St=g(ho,{visible:f,onClose:()=>P(false),featureName:"Full State History"});return o?F(Et,{children:[F(d,{style:L.inlineRoot,children:[g(d,{style:L.inlineHeader,...mo,children:mt()}),bt,yt]}),St]}):F(Et,{children:[g(ao,{visible:e,onClose:t,onMinimize:a,persistenceKey:$r,header:{showToggleButton:true,customContent:mt()},onModeChange:gr,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:Nr,styles:{},footer:yt,footerHeight:Pr,children:bt}),St]})}function Kn(e={}){return g(Ve,{...e,inline:true,visible:true,onClose:()=>{}})}var L=le.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:no.border.default,backgroundColor:"transparent"},container:{flex:1,backgroundColor:"transparent"},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:V.color.buttonSurface,borderWidth:1,borderColor:V.color.border,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:V.color.accentSoft,borderColor:V.color.accentBorderStrong},disabledBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:V.color.warningSoft,borderRadius:8,borderWidth:1,borderColor:V.color.warning+"20"},disabledText:{color:V.color.warning,fontSize:11,flex:1},listContent:{paddingTop:8,paddingBottom:20},lockedBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:V.color.accentSoft,borderRadius:8,borderWidth:1,borderColor:V.color.accentBorder},lockedText:{color:V.color.accent,fontSize:11,fontWeight:"500",flex:1},upgradeBadge:{backgroundColor:V.color.accent,paddingHorizontal:8,paddingVertical:3,borderRadius:4},upgradeBadgeText:{color:V.color.onAccent,fontSize:9,fontWeight:"700",letterSpacing:.5}});import{ZustandIcon as it,ZUSTAND_ICON_COLOR as Un}from"@buoy-gg/shared-ui/web";import{jsx as er}from"react/jsx-runtime";var Zn={id:"zustand",name:"ZUSTAND",description:"Zustand store & state inspector",slot:"both",icon:({size:e})=>er(it,{size:e}),component:Ve,props:{enableSharedModalDimensions:false}};function _n(e){return{id:e?.id||"zustand",name:e?.name||"ZUSTAND",description:e?.description||"Zustand store & state inspector",slot:"both",icon:({size:t})=>er(it,{size:t,color:e?.iconColor}),component:Ve,props:{enableSharedModalDimensions:e?.enableSharedModalDimensions!==void 0?e.enableSharedModalDimensions:false}}}var fe=Symbol.for("@@buoy-zustand/watched");function tr(e){let t=e.persist;return t&&typeof t.getOptions=="function"?{isPersisted:true,persistName:t.getOptions()?.name,persistApi:t}:{isPersisted:false}}function Gn(e){let t=[];for(let[r,a]of Object.entries(e)){let n=a;if(n[fe])continue;n[fe]=true;let{isPersisted:o,persistName:i,persistApi:c}=tr(a);S.registerStore(r,{getState:a.getState,getInitialState:a.getInitialState,setState:a.setState,subscribe:a.subscribe},{isPersisted:o,persistName:i,rehydrate:typeof c?.rehydrate=="function"?()=>c.rehydrate():void 0});let s=false,p=a.subscribe((m,y)=>{try{let b;if(!s&&o){let h=false;try{h=c?.hasHydrated?.()===false}catch{}h&&(s=true,b="persist")}S.addStateChange({storeName:r,partial:void 0,replace:false,prevState:y,nextState:m,duration:void 0,category:b,isPersisted:o})}catch{}});t.push(()=>{p(),delete a[fe],S.unregisterStore(r)})}return()=>{t.forEach(r=>r())}}var Jn=0;function Yn(e,t){return(r,a,n)=>{let o=t?.name??`store-${++Jn}`,i=t?.enabled!==false,c=r,s=(m,y)=>{if(!i)return c(m,y);let b=performance.now(),h=a();c(m,y);let f=a(),P=performance.now()-b,D=typeof m=="function"?"(updater fn)":m;S.addStateChange({storeName:o,partial:D,replace:y??false,prevState:h,nextState:f,duration:P,isPersisted:S.getStore(o)?.isPersisted??false})},p=e(s,a,n);return setTimeout(()=>{if(n[fe])return;n[fe]=true;let{isPersisted:m,persistName:y}=tr(n);S.registerStore(o,{getState:a,getInitialState:n.getInitialState,setState:s,subscribe:n.subscribe},{isPersisted:m,persistName:y})},0),p}}function qn(e){return e[fe]===true}import{expandKeyedArrays as Qn,patchFromPath as Xn,readPath as ei,refusalText as ti,shapeSummary as He,suggestedPatch as st,typedEditViolations as ri,unshapedLists as ai}from"@buoy-gg/shared-ui/web";import{WIRE_DETAIL_LIMIT_BYTES as rr,createSyncAdapter as oi,detailByIdAction as ni,isJsonSerializable as ii,isOverWireBudget as si,memoByIdentity as li,onDeviceMarker as ar,readParams as je,toWire as or,truncatedNote as ci}from"@buoy-gg/shared-ui/web";var Oe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype;function nr(e,t){if(!Oe(e)||!Oe(t))return t;let r={...e};for(let[a,n]of Object.entries(t))r[a]=a in e?nr(e[a],n):n;return r}var We=ar("State","State trees stay on the device \u2014 fetched on demand via getChangeDetail / getStoreState."),di=ar("Payload","Partial stays on the device \u2014 fetched on demand via getChangeDetail.");function ui(e,t){let r=e;for(let a of t.split(".")){if(!r||typeof r!="object"||Array.isArray(r)||!(a in r))return false;r=r[a]}return Array.isArray(r)?r.length>0:!!r&&typeof r=="object"}function hi(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.keys(e):void 0}var gi=li(e=>({...e,prevState:We,nextState:We,partial:or(e.partial,di)})),pi=e=>or(e,We),fi=oi({version:2,getSnapshot:()=>({changes:S.getStateChanges().map(gi),stores:S.getStoreSnapshots().map(e=>({...e,currentState:pi(e.currentState)}))}),subscribe:[e=>S.subscribe(e),e=>S.subscribeToStores(e)],actions:{clearEvents:()=>{S.clearStateChanges()},getChangeDetail:ni(e=>S.getStateChangeById(e),(e,t)=>({prevState:t(e.prevState),nextState:t(e.nextState),partial:t(e.partial)})),getStoreState:e=>{let{storeName:t,path:r}=je(e);if(!t)return{found:false,reason:"missing storeName"};let a=S.getStore(t);if(!a)return{found:false,reason:"unknown storeName"};let n;try{n=a.api.getState()}catch{n=void 0}if(r){let i=ei(n,r);return i.ok?{found:true,storeName:t,path:r,shape:He(i.value),currentState:i.value}:{found:false,reason:i.error}}let o=He(n);return si(n,rr)?{found:true,storeName:t,...o?{shape:o}:{},currentState:ii(n)?ci(rr):We}:{found:true,storeName:t,...o?{shape:o}:{},currentState:n}},listStores:e=>{let{includeValues:t=false,limit:r}=je(e),a=S.getStoreSnapshots(),n=(typeof r=="number"&&r>0?a.slice(0,r):a).map(o=>({name:o.name,changes:o.stateChangeCount,isPersisted:o.isPersisted,persistName:o.persistName,canRehydrate:o.canRehydrate,...t?{currentState:o.currentState}:{keys:hi(o.currentState)},...He(o.currentState)?{shape:He(o.currentState)}:{}}));return{stores:n,total:a.length,returned:n.length,includedValues:t}},setState:e=>{let{storeName:t,state:r,replace:a,force:n,path:o,value:i}=je(e),c=r,s=[],p=[];if(!t)return{ok:false,error:"Missing storeName."};let m=S.getStore(t);if(!m)return{ok:false,error:`No store named "${t}".`};if(r===void 0&&o===void 0)return{ok:false,error:"Refused: no change was described. Send `state` with the fields to merge, or `path` and `value` to set one value."};let y=false;if(o!==void 0){if(i===void 0)return{ok:false,error:`Refused: sent \`path\` without \`value\`. Say what to set "${o}" to; if you mean to clear it, send value:null and the field must already be nullable.`};let h;try{h=m.api.getState()}catch{h=void 0}let f=Xn(h,o,i);if(!f.ok)return{ok:false,error:`Refused: ${f.error}`};c=f.patch,y=true}if(!n&&(a===false||y)){let h;try{h=m.api.getState()}catch{h=void 0}if(h!==void 0){let f=Qn(h,c);if(f.error)return{ok:false,error:`Refused: ${f.error}`};c=f.patch,s=f.notes}if(h!==void 0&&(p=ai(h).filter(f=>ui(c,f))),h!==void 0){let f=ri(h,c,{noun:"store"});if(f.length>0)return{ok:false,error:ti(f,"store",st(c,f)),...st(c,f)?{suggestedState:st(c,f)}:{},violations:f}}}let b=y||a===false;if(b){let h;try{h=m.api.getState()}catch{h=void 0}if(Oe(h)&&Oe(c)){let f={};for(let[P,D]of Object.entries(c))f[P]=P in h?nr(h[P],D):D;c=f}}return m.api.setState(c,b?false:a??true),{ok:true,...o!==void 0?{path:o}:{},...s.length?{keyed:s}:{},...p.length?{unchecked:p.map(h=>`\`${h}\` was empty, so nothing in the app knows what its items look like and the shape of what you added was NOT checked. If the app renders a field you left out, it will render undefined \u2014 read the store back and compare against how the screen uses it.`)}:{}}},rehydrate:async e=>{let{storeName:t}=je(e);if(!t)return{ok:false,error:"Missing storeName."};let r=S.getStore(t);return r?r.isPersisted?r.rehydrate?(await r.rehydrate(),{ok:true,storeName:t,persistName:r.persistName}):{ok:false,error:`"${t}" is persisted but Buoy has no rehydrate handle for it. It was probably registered before the app's persist middleware attached.`}:{ok:false,error:`"${t}" is not a persisted store \u2014 it has no saved copy to re-read.`}:{ok:false,error:`No store named "${t}".`}}}});export{Un as ZUSTAND_ICON_COLOR,it as ZustandIcon,Ve as ZustandModal,Vt as ZustandStateChangeItem,Gt as ZustandStateDetailContent,Jt as ZustandStateDetailFooter,Kn as ZustandToolView,Yn as buoyDevTools,_n as createZustandTool,qn as isStoreInstrumented,Lt as useZustandStateChanges,Gn as watchStores,S as zustandStateStore,fi as zustandSyncAdapter,Zn as zustandToolPreset};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/zustand",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.42",
|
|
4
4
|
"description": "Inspect registered Zustand stores, compare captured state changes and use supported reset or state-update actions.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"./lib/web/**/*.mjs"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@buoy-gg/license": "^7.0.
|
|
42
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
41
|
+
"@buoy-gg/license": "^7.0.42",
|
|
42
|
+
"@buoy-gg/shared-ui": "^7.0.42"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "*",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,kCAAkC,CAAC;AAK1C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKhE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAKpE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAKrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAK5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,YAAY,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAO3F,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAKvE,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC;AAKzB,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/preset.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB;;;;;qBAKX;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;;;;;CAKlC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE;IAC1C,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;;;;;qBAMoB;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;;;;;EAWpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandActionButton.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandActionButton.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,aAAa,CAAC;AAEpD,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAgB,EAChB,MAAM,GACP,EAAE,wBAAwB,+BA2C1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandDetailViewToggle.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandDetailViewToggle.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAe,MAAM,OAAO,CAAC;AASpC,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhE,UAAU,4BAA4B;IACpC,UAAU,EAAE,qBAAqB,CAAC;IAClC,YAAY,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACpD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAUD,eAAO,MAAM,uBAAuB,0DAclC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandEventFilterView.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandEventFilterView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIjD,UAAU,2BAA2B;IACnC,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,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAQD,wBAAgB,sBAAsB,CAAC,EACrC,eAAe,EACf,eAAe,EACf,YAAY,EACZ,MAAM,GACP,EAAE,2BAA2B,+BAwB7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandIcon.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandIcon.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandModal.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandModal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkDH,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,UAAU,CAAC;AAsCtE,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,2BAAmC,EACnC,MAAc,EACd,aAAqB,EACrB,UAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,EAAE,iBAAiB,sCA8tBnB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,GAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAM,+BAGtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandStateChangeItem.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandStateChangeItem.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,UAAU,CAAC;AAGxE,UAAU,2BAA2B;IACnC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC9C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2FD,eAAO,MAAM,sBAAsB,mEAyBjC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandStateDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandStateDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkBH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAC;AAMnC,UAAU,8BAA8B;IACtC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAyCD,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,qBAA6B,EAC7B,WAAsB,GACvB,EAAE,8BAA8B,+BAmNhC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,GACd,EAAE;IACD,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,sCAmBA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandStateInfoView.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandStateInfoView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAiD,MAAM,OAAO,CAAC;AAmBtE,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,UAAU,CAAC;AAKxE,UAAU,yBAAyB;IACjC,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAwED,eAAO,MAAM,oBAAoB,uDAuQ/B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandStoreBrowser.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandStoreBrowser.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIjD,UAAU,wBAAwB;IAChC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AA4DD,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,WAAW,EACX,SAAiB,EACjB,WAAW,GACZ,EAAE,wBAAwB,+BAgG1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZustandStoreDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandStoreDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA4BH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAyBjD,UAAU,8BAA8B;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,mEAAmE;IACnE,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,aAAa,GACd,EAAE,8BAA8B,+BAsQhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useZustandStateChanges.d.ts","sourceRoot":"","sources":["../../../../src/zustand/hooks/useZustandStateChanges.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,4BAA4B;IAC3C,iCAAiC;IACjC,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,qDAAqD;IACrD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,8BAA8B;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,6BAA6B;IAC7B,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,wCAAwC;IACxC,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,yBAAyB,EAAE,MAAM,CAAC;QAClC,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,4BAA4B;IAC5B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,uCAAuC;IACvC,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,6BAA6B;IAC7B,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;CAC/D;AAiCD,wBAAgB,sBAAsB,IAAI,4BAA4B,CA4CrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zustandSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/zustand/sync/zustandSyncAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA8BnD;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;EAG3B,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,iBAAiB;;;;EAG7B,CAAC;AAuEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;IAiB3B;;;;OAIG;;;;;;IASH;;;OAGG;6BACsB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsChC;;;;;OAKG;0BACmB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BT,OAAO;;;;;;;;;;;;;;;IA4H3B;;;;;;;;;;;;;;;;;;;;OAoBG;yBACwB,OAAO;;;;;;;;;;;EAqBV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zustand/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,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,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IAGjB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE;QACH,QAAQ,EAAE,MAAM,OAAO,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC;QAChC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;QACxD,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;KACnF,CAAC;IACF,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;OAEG;IACH,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAChD;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,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;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buoyZustandMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/buoyZustandMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,4BAA4B,EAAuB,MAAM,UAAU,CAAC;AA4ClF,4DAA4D;AAC5D,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACpD,SAAS,EAAE,CACT,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,KACnD,MAAM,IAAI,CAAC;CAKjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GACvC,MAAM,IAAI,CAmFZ;AASD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;;GAMG;AACH,KAAK,UAAU,CAAC,CAAC,IAAI;IACnB,CACE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,EACxD,OAAO,CAAC,EAAE,KAAK,GACd,IAAI,CAAC;IACR,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,UAAU,mBAAmB,CAAC,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1B,QAAQ,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CACvE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,EAC5E,OAAO,CAAC,EAAE,4BAA4B,GACrC,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,CA8FtE;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GACtC,OAAO,CAET"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editableState.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/editableState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAS1E;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EACrB,KAAK,EAAE,MAAM,GACZ,OAAO,CA2BT;AAED,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,iFAAiF;IACjF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,0DAA0D;IAC1D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAsClE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotProvider.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/snapshotProvider.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testIDs.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/testIDs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,+CAA+C;AAC/C,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,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,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,kBAAkB,EAAE,GAC5B,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CASrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zustandStateStore.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/zustandStateStore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAyClB,cAAM,iBAAkB,SAAQ,SAAS,CAAC,kBAAkB,CAAC;IAC3D,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,cAAc,CACV;IACZ,OAAO,CAAC,qBAAqB,CAEb;IAIhB,cAAc,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;QAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,GAAG,IAAI;IA2DR,eAAe,IAAI,kBAAkB,EAAE;IAIvC,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI9D,iBAAiB,IAAI,IAAI;IAczB;;;;;;OAMG;IACH,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,IAAI;IAgBxD;;;;OAIG;IACH,iBAAiB,IAAI,oBAAoB,EAAE;IAwB3C;;;OAGG;IACH,wBAAwB,CACtB,OAAO,EACH,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAClE,IAAI,GACP,IAAI;IAIP;;;;;OAKG;IACH,mBAAmB,CACjB,OAAO,EAAE,kBAAkB,EAAE,EAC7B,cAAc,EAAE,oBAAoB,EAAE,GACrC,IAAI;IA0EP;;;OAGG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAInE;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI;IAejE,aAAa,CACX,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAC5B,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;KACxC,GACA,IAAI;IAiBP,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKnC,SAAS,IAAI,gBAAgB,EAAE;IAI/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAIpD,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMnC,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,kBAAkB,EAAE;IA4B/D,QAAQ;;;;;;;IAsBR,mBAAmB,IAAI,MAAM,EAAE;IAM/B,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMhC,iBAAiB,CACf,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,IAAI,GAC7C,MAAM,IAAI;IAOb,OAAO,CAAC,oBAAoB;CAI7B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|