@buoy-gg/react-query 7.0.44 → 7.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createReactQuerySyncAdapter=createReactQuerySyncAdapter;var _sharedUi=require("@buoy-gg/shared-ui");var _reactQuery=require("@tanstack/react-query");var _dehydrate=require("./dehydrate");var _getQueryStatusLabel=require("../utils/getQueryStatusLabel");function touchesList(r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createReactQuerySyncAdapter=createReactQuerySyncAdapter;var _sharedUi=require("@buoy-gg/shared-ui");var _reactQuery=require("@tanstack/react-query");var _dehydrate=require("./dehydrate");var _getQueryStatusLabel=require("../utils/getQueryStatusLabel");function touchesList(r,s){let t=r;for(const e of s.split(".")){if(!t||typeof t!=="object"||Array.isArray(t))return false;if(!(e in t))return false;t=t[e]}return Array.isArray(t)?t.length>0:!!t&&typeof t==="object"}const isPlainObject=r=>!!r&&typeof r==="object"&&!Array.isArray(r);function shapeKind(r){if(Array.isArray(r))return"array";if(r===null)return"null";if(typeof r==="object")return"object";return typeof r}function deepMerge(r,s,t="",e={shrunk:[],breaks:[]}){if(Array.isArray(r)&&Array.isArray(s)){if(s.length>0&&s.length<r.length){e.shrunk.push({path:t||"(root)",have:r.length,sent:s.length})}return s}if(!isPlainObject(r)||!isPlainObject(s))return s;const a={...r};for(const[n,u]of Object.entries(s)){const c=t?`${t}.${n}`:n;if(n in r){const d=shapeKind(r[n]);const h=shapeKind(u);if((d==="array"||d==="object")&&d!==h){e.breaks.push({path:c,from:d,to:h})}a[n]=deepMerge(r[n],u,c,e)}else{a[n]=u}}return a}function looseKeyParts(r){const s=r.trim();try{const t=JSON.parse(s);if(Array.isArray(t)){return t.map(e=>typeof e==="object"&&e!==null?JSON.stringify(e):String(e))}}catch{}if(s.includes(",")&&!s.startsWith("[")){return s.split(",").map(t=>t.trim().replace(/^["']|["']$/g,""))}return null}function refetchIntervalOf(r){let s;for(const t of r.observers??[]){const e=t.options?.refetchInterval;let a=e;if(typeof e==="function"){try{a=e(r)}catch{a=void 0}}if(typeof a==="number"&&a>0)s=s===void 0?a:Math.min(s,a)}return s}function createReactQuerySyncAdapter(r){const s=t=>{const{queryHash:e}=t;const a=r.getQueryCache();let n=e?a.get(e):void 0;if(!n&&typeof e==="string"){const u=looseKeyParts(e);if(u){n=a.getAll().find(c=>{const d=c.queryKey.map(h=>typeof h==="object"?JSON.stringify(h):String(h));return d.length===u.length&&d.every((h,f)=>h===u[f])})}}if(!n){throw new Error(`Query with hash "${e}" not found`)}return n};return{version:2,getSnapshot:()=>({dehydratedState:(0,_dehydrate.dehydrateQueryClient)(r),isOnlineManagerOnline:_reactQuery.onlineManager.isOnline()}),subscribe:t=>{const e=r.getQueryCache().subscribe(t);const a=r.getMutationCache().subscribe(t);const n=_reactQuery.onlineManager.subscribe(t);return()=>{e();a();n()}},actions:{getQueryData:t=>{const{queryHash:e,path:a}=t??{};if(!e)return{found:false,reason:"missing queryHash"};const n=r.getQueryCache().get(e);if(!n)return{found:false,reason:"unknown queryHash"};if(a){const c=(0,_sharedUi.readPath)(n.state.data,a);if(!c.ok)return{found:false,reason:c.error};return{found:true,queryHash:e,path:a,shape:(0,_sharedUi.shapeSummary)(c.value),data:c.value}}if(n.state.data===void 0){const c=n.state.status;const d=n.state.error;return{found:true,queryHash:e,hasData:false,status:c,fetchStatus:n.state.fetchStatus,...d?{error:d instanceof Error?d.message:String(d)}:{},reason:c==="error"?"This query has no data because it FAILED. Report the error, not an empty result.":n.state.fetchStatus==="fetching"?"No data yet \u2014 this query is still fetching.":"This query has never resolved (it may be disabled, or never enabled). It is not empty \u2014 it has nothing."}}const u=(0,_sharedUi.shapeSummary)(n.state.data);return{found:true,queryHash:e,hasData:true,...u?{shape:u}:{},data:(0,_dehydrate.capQueryDetail)(n.state.data)}},listQueries:t=>{const{includeData:e=false,staleOnly:a=false,limit:n}=t??{};const u=r.getQueryCache().getAll();const c=a?u.filter(o=>o.isStale()):u;const d=[...c].sort((o,y)=>{const g=Number(y.getObserversCount()>0)-Number(o.getObserversCount()>0);return g!==0?g:(y.state.dataUpdatedAt??0)-(o.state.dataUpdatedAt??0)});const h=typeof n==="number"&&n>0?d.slice(0,n):d;const f=h.map(o=>{const y=o.state.error;const g=refetchIntervalOf(o);return{queryHash:o.queryHash,queryKey:o.queryKey,status:(0,_getQueryStatusLabel.getQueryStatusLabel)(o),fetchStatus:o.state.fetchStatus,isStale:o.isStale(),observers:o.getObserversCount(),updatedAt:o.state.dataUpdatedAt,...g?{refetchEveryMs:g}:{},error:y?y.message??String(y):void 0,...e?{data:o.state.data}:{},...(0,_sharedUi.shapeSummary)(o.state.data)?{shape:(0,_sharedUi.shapeSummary)(o.state.data)}:{}}});return{queries:f,total:u.length,returned:f.length,includedData:e}},refetch:t=>{const e=s(t);return e.fetch().catch(()=>void 0)},invalidate:t=>r.invalidateQueries(s(t)),reset:t=>r.resetQueries(s(t)),remove:t=>{const e=s(t);const a=r.getQueryCache().findAll(e).some(n=>n.getObserversCount()>0);r.removeQueries(e);return{ok:true,...a?{note:"Removed \u2014 but a screen is still watching this query, and React Query leaves that screen rendering its LAST value (including anything written into the cache before this) until something refetches. Nothing on screen will change on its own. Use `reset` instead when you want the screen to go back to loading and fetch again."}:{}}},setQueryData:t=>{const{data:e,merge:a,force:n,path:u,value:c}=t;const{queryKey:d,queryHash:h}=t;let f=d;if(f===void 0&&typeof h==="string"){const i=r.getQueryCache().get(h);if(!i){return{ok:false,error:`Refused: no query with hash ${h} is in the cache. Read listQueries for the current hashes \u2014 a query that has been removed or whose key includes changing params (a search term, a cart payload) will not match an older hash.`}}f=i.queryKey}if(f===void 0){return{ok:false,error:`Refused: no query was named. Send \`queryKey\` (the array from listQueries) or \`queryHash\` (its string form).`}}const o=r.getQueryData(f);const y=r.getQueryCache().find({queryKey:f,exact:true});if(o===void 0&&y&&(e!==void 0||u!==void 0)){const i=y;const l=i?.state.status;const m=l==="error"?`it FAILED${i?.state.error?` (${i.state.error instanceof Error?i.state.error.message:String(i.state.error)})`:""}`:l==="pending"?"it has never resolved (it may be disabled, or still loading)":"it holds no data";return{ok:false,error:`Refused: this query has no data to edit \u2014 ${m}. There is nothing to merge into. Fix the cause first (restoreError, or let it fetch), or send force:true with the COMPLETE value if you mean to seed the cache from nothing.`,status:l}}if(e===void 0&&u===void 0){return{ok:false,error:`Refused: no change was described. Send \`data\` (with merge:true for a partial edit), or \`path\` and \`value\` to set one value.`}}let g=e;if(u!==void 0){if(c===void 0){return{ok:false,error:`Refused: sent \`path\` without \`value\`. Say what to set "${u}" to; if you mean to clear it, send value:null and the field must already be nullable.`}}const i=(0,_sharedUi.patchFromPath)(o,u,c);if(!i.ok)return{ok:false,error:`Refused: ${i.error}`};g=i.patch}if(a||u!==void 0){const i=n?{patch:g,notes:[],error:void 0}:(0,_sharedUi.expandKeyedArrays)(o,g);if(i.error){return{ok:false,error:`Refused: ${i.error}`}}const l=i.patch;if(!n){const p=(0,_sharedUi.typedEditViolations)(o,l,{noun:"data"});if(p.length>0){const b=(0,_sharedUi.suggestedPatch)(l,p);return{ok:false,error:(0,_sharedUi.refusalText)(p,"data",b),violations:p,...b?{suggestedData:b}:{}}}}const m=deepMerge(o,l);const v=(0,_sharedUi.unshapedLists)(o).filter(p=>touchesList(l,p));r.setQueryData(f,m,{updatedAt:Date.now()});return{ok:true,mode:"merge",...u!==void 0?{path:u}:{},changedKeys:isPlainObject(l)?Object.keys(l):void 0,...i.notes.length?{keyed:i.notes}:{},...v.length?{unchecked:v.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 screen renders a field you left out, it will render undefined \u2014 read the query back and compare against how the screen uses it.`)}:{}}}if(!n&&isPlainObject(o)&&isPlainObject(e)){const i=Object.keys(o).filter(l=>!(l in e));if(i.length>0){return{ok:false,error:`Refused: the new value drops ${i.length} top-level field(s) the cached value has (${i.slice(0,8).join(", ")}${i.length>8?", \u2026":""}). A screen rendering those fields would crash. To change some fields, send merge:true with ONLY the fields that change. To really replace the whole value, send force:true.`,missingKeys:i}}}r.setQueryData(f,e,{updatedAt:Date.now()});return{ok:true,mode:"replace"}},triggerError:t=>{const e=s(t);const a=e.options;e.setState({status:"error",error:new Error("Unknown error from devtools"),fetchMeta:{...e.state.fetchMeta,__previousQueryOptions:a}})},restoreError:t=>r.resetQueries(s(t)),triggerLoading:t=>{const e=s(t);const a=e.options;e.fetch({...a,queryFn:()=>new Promise(()=>{}),gcTime:-1}).catch(()=>void 0);e.setState({data:void 0,status:"pending",fetchMeta:{...e.state.fetchMeta,__previousQueryOptions:a}})},restoreLoading:t=>{const e=s(t);const a=e.state;const n=e.state.fetchMeta?e.state.fetchMeta.__previousQueryOptions:null;e.cancel({silent:true});e.setState({...a,fetchStatus:"idle",fetchMeta:null});if(n){e.fetch(n).catch(()=>void 0)}},clearQueryCache:()=>{const t=r.getQueryCache().getAll().filter(e=>e.getObserversCount()>0).length;r.getQueryCache().clear();return{ok:true,cleared:true,...t?{note:`Cleared \u2014 but ${t} quer${t===1?"y is":"ies are"} still being watched by a screen, and React Query leaves those screens rendering their LAST value until something refetches. The cache is empty; the app on screen is not. Use \`reset\` on a query when you want its screen to reload.`}:{}}},clearMutationCache:()=>{r.getMutationCache().clear()},setOnline:t=>{const{online:e}=t;_reactQuery.onlineManager.setOnline(e)}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{expandKeyedArrays as O,patchFromPath as
|
|
1
|
+
"use strict";import{expandKeyedArrays as O,patchFromPath as M,readPath as $,refusalText as D,shapeSummary as b,suggestedPatch as K,typedEditViolations as R,unshapedLists as j}from"@buoy-gg/shared-ui";import{onlineManager as Q}from"@tanstack/react-query";import{capQueryDetail as E,dehydrateQueryClient as T}from"./dehydrate";import{getQueryStatusLabel as L}from"../utils/getQueryStatusLabel";function N(r,a){let t=r;for(const e of a.split(".")){if(!t||typeof t!=="object"||Array.isArray(t))return false;if(!(e in t))return false;t=t[e]}return Array.isArray(t)?t.length>0:!!t&&typeof t==="object"}const m=r=>!!r&&typeof r==="object"&&!Array.isArray(r);function S(r){if(Array.isArray(r))return"array";if(r===null)return"null";if(typeof r==="object")return"object";return typeof r}function k(r,a,t="",e={shrunk:[],breaks:[]}){if(Array.isArray(r)&&Array.isArray(a)){if(a.length>0&&a.length<r.length){e.shrunk.push({path:t||"(root)",have:r.length,sent:a.length})}return a}if(!m(r)||!m(a))return a;const s={...r};for(const[n,u]of Object.entries(a)){const c=t?`${t}.${n}`:n;if(n in r){const d=S(r[n]);const f=S(u);if((d==="array"||d==="object")&&d!==f){e.breaks.push({path:c,from:d,to:f})}s[n]=k(r[n],u,c,e)}else{s[n]=u}}return s}function x(r){const a=r.trim();try{const t=JSON.parse(a);if(Array.isArray(t)){return t.map(e=>typeof e==="object"&&e!==null?JSON.stringify(e):String(e))}}catch{}if(a.includes(",")&&!a.startsWith("[")){return a.split(",").map(t=>t.trim().replace(/^["']|["']$/g,""))}return null}function H(r){let a;for(const t of r.observers??[]){const e=t.options?.refetchInterval;let s=e;if(typeof e==="function"){try{s=e(r)}catch{s=void 0}}if(typeof s==="number"&&s>0)a=a===void 0?s:Math.min(a,s)}return a}export function createReactQuerySyncAdapter(r){const a=t=>{const{queryHash:e}=t;const s=r.getQueryCache();let n=e?s.get(e):void 0;if(!n&&typeof e==="string"){const u=x(e);if(u){n=s.getAll().find(c=>{const d=c.queryKey.map(f=>typeof f==="object"?JSON.stringify(f):String(f));return d.length===u.length&&d.every((f,h)=>f===u[h])})}}if(!n){throw new Error(`Query with hash "${e}" not found`)}return n};return{version:2,getSnapshot:()=>({dehydratedState:T(r),isOnlineManagerOnline:Q.isOnline()}),subscribe:t=>{const e=r.getQueryCache().subscribe(t);const s=r.getMutationCache().subscribe(t);const n=Q.subscribe(t);return()=>{e();s();n()}},actions:{getQueryData:t=>{const{queryHash:e,path:s}=t??{};if(!e)return{found:false,reason:"missing queryHash"};const n=r.getQueryCache().get(e);if(!n)return{found:false,reason:"unknown queryHash"};if(s){const c=$(n.state.data,s);if(!c.ok)return{found:false,reason:c.error};return{found:true,queryHash:e,path:s,shape:b(c.value),data:c.value}}if(n.state.data===void 0){const c=n.state.status;const d=n.state.error;return{found:true,queryHash:e,hasData:false,status:c,fetchStatus:n.state.fetchStatus,...d?{error:d instanceof Error?d.message:String(d)}:{},reason:c==="error"?"This query has no data because it FAILED. Report the error, not an empty result.":n.state.fetchStatus==="fetching"?"No data yet \u2014 this query is still fetching.":"This query has never resolved (it may be disabled, or never enabled). It is not empty \u2014 it has nothing."}}const u=b(n.state.data);return{found:true,queryHash:e,hasData:true,...u?{shape:u}:{},data:E(n.state.data)}},listQueries:t=>{const{includeData:e=false,staleOnly:s=false,limit:n}=t??{};const u=r.getQueryCache().getAll();const c=s?u.filter(o=>o.isStale()):u;const d=[...c].sort((o,y)=>{const g=Number(y.getObserversCount()>0)-Number(o.getObserversCount()>0);return g!==0?g:(y.state.dataUpdatedAt??0)-(o.state.dataUpdatedAt??0)});const f=typeof n==="number"&&n>0?d.slice(0,n):d;const h=f.map(o=>{const y=o.state.error;const g=H(o);return{queryHash:o.queryHash,queryKey:o.queryKey,status:L(o),fetchStatus:o.state.fetchStatus,isStale:o.isStale(),observers:o.getObserversCount(),updatedAt:o.state.dataUpdatedAt,...g?{refetchEveryMs:g}:{},error:y?y.message??String(y):void 0,...e?{data:o.state.data}:{},...b(o.state.data)?{shape:b(o.state.data)}:{}}});return{queries:h,total:u.length,returned:h.length,includedData:e}},refetch:t=>{const e=a(t);return e.fetch().catch(()=>void 0)},invalidate:t=>r.invalidateQueries(a(t)),reset:t=>r.resetQueries(a(t)),remove:t=>{const e=a(t);const s=r.getQueryCache().findAll(e).some(n=>n.getObserversCount()>0);r.removeQueries(e);return{ok:true,...s?{note:"Removed \u2014 but a screen is still watching this query, and React Query leaves that screen rendering its LAST value (including anything written into the cache before this) until something refetches. Nothing on screen will change on its own. Use `reset` instead when you want the screen to go back to loading and fetch again."}:{}}},setQueryData:t=>{const{data:e,merge:s,force:n,path:u,value:c}=t;const{queryKey:d,queryHash:f}=t;let h=d;if(h===void 0&&typeof f==="string"){const i=r.getQueryCache().get(f);if(!i){return{ok:false,error:`Refused: no query with hash ${f} is in the cache. Read listQueries for the current hashes \u2014 a query that has been removed or whose key includes changing params (a search term, a cart payload) will not match an older hash.`}}h=i.queryKey}if(h===void 0){return{ok:false,error:`Refused: no query was named. Send \`queryKey\` (the array from listQueries) or \`queryHash\` (its string form).`}}const o=r.getQueryData(h);const y=r.getQueryCache().find({queryKey:h,exact:true});if(o===void 0&&y&&(e!==void 0||u!==void 0)){const i=y;const l=i?.state.status;const v=l==="error"?`it FAILED${i?.state.error?` (${i.state.error instanceof Error?i.state.error.message:String(i.state.error)})`:""}`:l==="pending"?"it has never resolved (it may be disabled, or still loading)":"it holds no data";return{ok:false,error:`Refused: this query has no data to edit \u2014 ${v}. There is nothing to merge into. Fix the cause first (restoreError, or let it fetch), or send force:true with the COMPLETE value if you mean to seed the cache from nothing.`,status:l}}if(e===void 0&&u===void 0){return{ok:false,error:`Refused: no change was described. Send \`data\` (with merge:true for a partial edit), or \`path\` and \`value\` to set one value.`}}let g=e;if(u!==void 0){if(c===void 0){return{ok:false,error:`Refused: sent \`path\` without \`value\`. Say what to set "${u}" to; if you mean to clear it, send value:null and the field must already be nullable.`}}const i=M(o,u,c);if(!i.ok)return{ok:false,error:`Refused: ${i.error}`};g=i.patch}if(s||u!==void 0){const i=n?{patch:g,notes:[],error:void 0}:O(o,g);if(i.error){return{ok:false,error:`Refused: ${i.error}`}}const l=i.patch;if(!n){const p=R(o,l,{noun:"data"});if(p.length>0){const w=K(l,p);return{ok:false,error:D(p,"data",w),violations:p,...w?{suggestedData:w}:{}}}}const v=k(o,l);const A=j(o).filter(p=>N(l,p));r.setQueryData(h,v,{updatedAt:Date.now()});return{ok:true,mode:"merge",...u!==void 0?{path:u}:{},changedKeys:m(l)?Object.keys(l):void 0,...i.notes.length?{keyed:i.notes}:{},...A.length?{unchecked:A.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 screen renders a field you left out, it will render undefined \u2014 read the query back and compare against how the screen uses it.`)}:{}}}if(!n&&m(o)&&m(e)){const i=Object.keys(o).filter(l=>!(l in e));if(i.length>0){return{ok:false,error:`Refused: the new value drops ${i.length} top-level field(s) the cached value has (${i.slice(0,8).join(", ")}${i.length>8?", \u2026":""}). A screen rendering those fields would crash. To change some fields, send merge:true with ONLY the fields that change. To really replace the whole value, send force:true.`,missingKeys:i}}}r.setQueryData(h,e,{updatedAt:Date.now()});return{ok:true,mode:"replace"}},triggerError:t=>{const e=a(t);const s=e.options;e.setState({status:"error",error:new Error("Unknown error from devtools"),fetchMeta:{...e.state.fetchMeta,__previousQueryOptions:s}})},restoreError:t=>r.resetQueries(a(t)),triggerLoading:t=>{const e=a(t);const s=e.options;e.fetch({...s,queryFn:()=>new Promise(()=>{}),gcTime:-1}).catch(()=>void 0);e.setState({data:void 0,status:"pending",fetchMeta:{...e.state.fetchMeta,__previousQueryOptions:s}})},restoreLoading:t=>{const e=a(t);const s=e.state;const n=e.state.fetchMeta?e.state.fetchMeta.__previousQueryOptions:null;e.cancel({silent:true});e.setState({...s,fetchStatus:"idle",fetchMeta:null});if(n){e.fetch(n).catch(()=>void 0)}},clearQueryCache:()=>{const t=r.getQueryCache().getAll().filter(e=>e.getObserversCount()>0).length;r.getQueryCache().clear();return{ok:true,cleared:true,...t?{note:`Cleared \u2014 but ${t} quer${t===1?"y is":"ies are"} still being watched by a screen, and React Query leaves those screens rendering their LAST value until something refetches. The cache is empty; the app on screen is not. Use \`reset\` on a query when you want its screen to reload.`}:{}}},clearMutationCache:()=>{r.getMutationCache().clear()},setOnline:t=>{const{online:e}=t;Q.setOnline(e)}}}}
|
|
@@ -66,6 +66,8 @@ export declare function createReactQuerySyncAdapter(queryClient: QueryClient): {
|
|
|
66
66
|
lists?: import("@buoy-gg/shared-ui").ListShape[];
|
|
67
67
|
} | undefined;
|
|
68
68
|
data?: unknown;
|
|
69
|
+
error: string | undefined;
|
|
70
|
+
refetchEveryMs?: number | undefined;
|
|
69
71
|
queryHash: string;
|
|
70
72
|
queryKey: readonly unknown[];
|
|
71
73
|
status: "error" | "fetching" | "paused" | "disabled" | "inactive" | "stale" | "fresh";
|
|
@@ -73,7 +75,6 @@ export declare function createReactQuerySyncAdapter(queryClient: QueryClient): {
|
|
|
73
75
|
isStale: boolean;
|
|
74
76
|
observers: number;
|
|
75
77
|
updatedAt: number;
|
|
76
|
-
error: string | undefined;
|
|
77
78
|
}[];
|
|
78
79
|
total: number;
|
|
79
80
|
returned: number;
|
package/lib/web/index.mjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
To see queries here:
|
|
4
4
|
\u2022 Make API calls using useQuery
|
|
5
5
|
\u2022 Ensure queries are within QueryClientProvider
|
|
6
|
-
\u2022 Check console for debugging info`}}),contentContainerStyle:Ro.queryListContent})]})}var Ro=M.create({queryListContainer:{flex:1,backgroundColor:"transparent"},queryListContent:{padding:8,backgroundColor:"transparent",flexGrow:1}});import{ToolFooter as Bs,useSafeAreaInsets as Hs}from"@buoy-gg/shared-ui/web";import{jsx as ar}from"react/jsx-runtime";function Io({activeFilter:e,onFilterChange:t,isFloatingMode:r=true,size:o="default"}){let a=Hs({minBottom:16});return ar(Bs,{floating:r,safeArea:false,paddingBottom:r?0:a.bottom,style:ko.filterFooter,children:ar(f,{style:ko.filterContainer,children:ar(no,{activeFilter:e,onFilterChange:t,size:o})})})}var ko=M.create({filterFooter:{paddingTop:8,paddingHorizontal:0},filterContainer:{minHeight:32,justifyContent:"center"}});import{useMemo as nt}from"react";import{DynamicFilterView as Ws,buoyColors as qe}from"@buoy-gg/shared-ui/web";import{XCircle as Eo,Clock as nr,RefreshCw as js,Globe as Vs,Zap as $s,Filter as Ns,Eye as Us}from"@buoy-gg/shared-ui/web";import{jsx as _s}from"react/jsx-runtime";function Js({queries:e,activeFilter:t,onFilterChange:r,ignoredPatterns:o,onPatternToggle:a,includedPatterns:n,onIncludedPatternToggle:s}){let i=nt(()=>{let h={all:e.length,disabled:0,fresh:0,stale:0,fetching:0,paused:0,inactive:0,error:0};return e.forEach(g=>{let y=oe(g);y==="disabled"?h.disabled++:y==="error"?h.error++:y==="fresh"?h.fresh++:y==="stale"?h.stale++:y==="fetching"?h.fetching++:y==="paused"?h.paused++:y==="inactive"&&h.inactive++}),h},[e]),l=nt(()=>{let h=new Set;return e.forEach(g=>{if(!g?.queryKey)return;(Array.isArray(g.queryKey)?g.queryKey:[g.queryKey]).forEach(y=>{if(y!=null){let m=String(y);/^\d+$/.test(m)||h.add(m)}})}),Array.from(h).sort().slice(0,50)},[e]),u=nt(()=>l,[l]),c=nt(()=>{let h=e;return n.size>0&&(h=h.filter(g=>{if(!g?.queryKey)return false;let y=(Array.isArray(g.queryKey)?g.queryKey:[g.queryKey]).filter(m=>m!=null).map(m=>String(m)).join(" ").toLowerCase();return Array.from(n).some(m=>y.includes(m.toLowerCase()))})),o.size>0&&(h=h.filter(g=>{if(!g?.queryKey)return true;let y=(Array.isArray(g.queryKey)?g.queryKey:[g.queryKey]).filter(m=>m!=null).map(m=>String(m)).join(" ").toLowerCase();return!Array.from(o).some(m=>y.includes(m.toLowerCase()))})),h.length},[e,n,o]),d=nt(()=>({filterSummarySection:{enabled:true,totalCount:e.length,filteredCount:c,includePatterns:n,excludePatterns:o},sections:[{id:"status",title:"Status",type:"status",data:[{id:"status::all",label:"All",count:i.all,icon:Vs,color:qe.primary,isActive:!t||t==="all"},{id:"status::disabled",label:"Disabled",count:i.disabled,icon:Eo,color:qe.textMuted,isActive:t==="disabled"},{id:"status::fresh",label:"Fresh",count:i.fresh,icon:$s,color:qe.success,isActive:t==="fresh"},{id:"status::stale",label:"Stale",count:i.stale,icon:nr,color:qe.warning,isActive:t==="stale"},{id:"status::fetching",label:"Fetching",count:i.fetching,icon:js,color:qe.primary,isActive:t==="fetching"},{id:"status::paused",label:"Paused",count:i.paused,icon:nr,color:qe.textMuted,isActive:t==="paused"},{id:"status::inactive",label:"Inactive",count:i.inactive,icon:nr,color:qe.textSecondary,isActive:t==="inactive"},{id:"status::error",label:"Error",count:i.error,icon:Eo,color:qe.error,isActive:t==="error"}]}],addFilterSection:{enabled:true,placeholder:"Enter pattern to exclude...",title:"EXCLUDE FILTERS",icon:Ns},includeOnlySection:{enabled:true,title:"INCLUDE ONLY FILTERS",description:"Show ONLY queries matching these patterns. All non-matching queries will be hidden.",placeholder:"Enter pattern to include...",icon:Us,patterns:n,onPatternToggle:s,onPatternAdd:s},availableItemsSection:{enabled:true,title:"AVAILABLE QUERY KEYS",emptyMessage:"No queries found. Query keys will appear here once queries are active.",items:u},howItWorksSection:{enabled:true,title:"HOW QUERY FILTERS WORK",description:"There are two types of query key filters:",examples:["","INCLUDE ONLY (green):","\u2022 Shows ONLY queries matching the pattern","\u2022 Example: 'rewards' \u2192 shows only reward queries","\u2022 When active, non-matching queries are hidden","","EXCLUDE (blue):","\u2022 Hides queries matching the pattern","\u2022 Example: 'analytics' \u2192 hides analytics queries","","Filters are case-insensitive and match partial keys."]},activePatterns:o}),[i,t,o,n,u,s,e.length,c]);return _s(Ws,{...d,onFilterChange:h=>{let[g,y]=h.split("::");g==="status"?r(y==="all"||t===y?null:y):g==="suggestion"&&a(y)},onPatternToggle:a,onPatternAdd:a})}import{useState as it,useCallback as wt,useEffect as qt}from"react";import{devToolsStorageKeys as Ve,persistentStorage as Tt}from"@buoy-gg/shared-ui/web";import{jsx as de,jsxs as Gs}from"react/jsx-runtime";function Fo({visible:e,selectedQueryKey:t,onQuerySelect:r,onClose:o,onMinimize:a,activeFilter:n,onFilterChange:s,enableSharedModalDimensions:i=false,onTabChange:l,searchText:u="",onSearchChange:c}){let d=ja(),h=Cr(t),g=gt(),y=wt(()=>{d.getQueryCache().clear()},[d]),[m,C]=it(null),v=n??m,b=s??C,[x,S]=it(false),[w,A]=it(new Set),[Y,Qe]=it(new Set);qt(()=>{(async()=>{try{let q=await Tt.getItem(Ve.reactQuery.ignoredPatterns());if(q){let le=JSON.parse(q);Array.isArray(le)&&A(new Set(le))}}catch(q){console.error("Failed to load ignored patterns:",q)}})()},[]),qt(()=>{(async()=>{try{let q=await Tt.getItem(Ve.reactQuery.includedPatterns());if(q){let le=JSON.parse(q);Array.isArray(le)&&Qe(new Set(le))}}catch(q){console.error("Failed to load included patterns:",q)}})()},[]),qt(()=>{(async()=>{try{let q=Array.from(w);await Tt.setItem(Ve.reactQuery.ignoredPatterns(),JSON.stringify(q))}catch(q){console.error("Failed to save ignored patterns:",q)}})()},[w]),qt(()=>{(async()=>{try{let q=Array.from(Y);await Tt.setItem(Ve.reactQuery.includedPatterns(),JSON.stringify(q))}catch(q){console.error("Failed to save included patterns:",q)}})()},[Y]);let T=wt(q=>{A(le=>{let ue=new Set(le);return ue.has(q)?ue.delete(q):ue.add(q),ue})},[]),Ge=wt(q=>{Qe(le=>{let ue=new Set(le);return ue.has(q)?ue.delete(q):ue.add(q),ue})},[]),[ut,Ot]=it("bottomSheet"),he=i?Ve.reactQuery.modal():Ve.reactQuery.browserModal(),fe=wt(q=>{Ot(q)},[]),ct=$a({minBottom:16}),dt=ut==="floating"?56:48+ct.bottom;if(!e)return null;let zt=()=>{if(x){let q=[{key:"filters",label:"Filters"}];return Gs(Lt,{children:[de(Lt.Navigation,{onBack:()=>S(false)}),de(Lt.Content,{title:"",noMargin:true,children:de(Na,{tabs:q,activeTab:"filters",testIDPrefix:"buoy-rq-filterview-tab",onTabChange:()=>{}})})]})}return de(Xe,{selectedQuery:h,activeTab:"queries",onTabChange:l,onBack:()=>r(void 0),searchText:u,onSearchChange:c,onFilterPress:()=>S(true),hasActiveFilters:v!==null||w.size>0||Y.size>0,onClearCache:y})},Kt=de(Io,{activeFilter:v,onFilterChange:b,isFloatingMode:ut==="floating"});return de(Va,{visible:e,onClose:o,onMinimize:a,persistenceKey:he,header:{customContent:zt(),showToggleButton:true},onModeChange:fe,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:!x,styles:{},footer:x?void 0:Kt,footerHeight:x?void 0:dt,children:de(f,{style:Ys.container,children:x?de(Js,{queries:g,activeFilter:v,onFilterChange:b,ignoredPatterns:w,onPatternToggle:T,includedPatterns:Y,onIncludedPatternToggle:Ge}):de(Qo,{selectedQuery:h,onQuerySelect:r,activeFilter:v,searchText:u,ignoredPatterns:w,includedPatterns:Y,onFilterPress:()=>S(true)})})})}var Ys=M.create({container:{flex:1,backgroundColor:"transparent"}});import{JsModal as Xs,devToolsStorageKeys as Po,useSafeAreaInsets as Zs}from"@buoy-gg/shared-ui/web";import{useQueryClient as Oo}from"@tanstack/react-query";import{useSafeAreaInsets as zo,night as O,monoFont as Ko}from"@buoy-gg/shared-ui/web";import{useMemo as el}from"react";function ir(e,t,r){return el(()=>{let o=e.state.status;return[{label:"Refetch",variant:"refetch",disabled:oe(e)==="fetching",onPress:()=>Jt({query:e})},{label:e.state.fetchStatus==="fetching"?"Restore Loading":"Trigger Loading",variant:"triggerLoading",disabled:false,onPress:()=>_t({query:e})},{label:o==="error"?"Restore Error":"Trigger Error",variant:"triggerError",disabled:o==="pending",onPress:()=>Gt({query:e,queryClient:t})}]},[e,t,r])}import{DataViewer as tl}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as rl,jsx as R,jsxs as $e}from"react/jsx-runtime";function Lo({selectedQuery:e,isFloatingMode:t,disableInternalFooter:r=false,queryVersion:o}){let a=zo({minBottom:16}),n=Oo(),s=ir(e,n,o);return $e(rl,{children:[$e(me,{testID:"buoy-rq-detail-scroll",accessibilityLabel:"Data editor mode",accessibilityHint:"View data editor mode","sentry-label":"ignore data editor mode",style:I.explorerScrollContainer,contentContainerStyle:[I.explorerScrollContent,!r&&{paddingBottom:72}],children:[$e(f,{style:I.section,children:[R(al,{visible:!!e.state.data,selectedQuery:e,queryVersion:o}),R(nl,{visible:!e.state.data,selectedQuery:e})]}),R(f,{style:I.section,children:R(Nt,{query:e})}),R(f,{style:I.section,children:$e(f,{style:I.queryExplorerContainer,children:[R(p,{testID:"buoy-rq-query-explorer-header",style:I.queryExplorerHeader,children:"Query Explorer"}),R(f,{style:I.queryExplorerContent,children:R(tl,{title:"",data:e,maxDepth:10,rawMode:true,showTypeFilter:true,initialExpanded:false})})]})})]}),!r&&R(f,{style:[I.actionFooter,{paddingBottom:t?0:a.bottom+8}],children:R(f,{style:I.actionsRow,children:s.map((i,l)=>R(ne,{testID:`buoy-rq-action-${i.variant}`,onClick:i.onPress,text:i.label,variant:i.variant,disabled:i.disabled},l))})})]})}function ol({selectedQuery:e,isFloatingMode:t,queryVersion:r}){let o=zo({minBottom:16}),a=Oo(),n=ir(e,a,r);return R(f,{style:[I.actionFooter,{paddingBottom:t?0:o.bottom+8}],children:R(f,{style:I.actionsRow,children:n.map((s,i)=>R(ne,{testID:`buoy-rq-action-${s.variant}`,onClick:s.onPress,text:s.label,variant:s.variant,disabled:s.disabled},i))})})}function al({visible:e,selectedQuery:t,queryVersion:r=0}){return e?$e(f,{style:I.dataContainer,children:[R(p,{testID:"buoy-rq-data-header",style:I.dataHeader,children:"Data Editor"}),R(f,{style:I.dataContent,children:R(ce,{editable:true,label:"Data",value:t.state.data,defaultExpanded:["Data"],activeQuery:t,dataVersion:r})})]}):null}function nl({visible:e,selectedQuery:t}){if(!e)return null;let r=()=>t.isDisabled()?{title:"Query Disabled",description:"This query is disabled and won't automatically fetch. Enable the query or manually trigger a fetch to load data."}:t.state.status==="pending"||oe(t)==="fetching"?{title:t.state.status==="pending"?"Loading...":"Refetching...",description:"Please wait while the query is being executed."}:t.state.status==="error"?{title:"Query Error",description:t.state.error?.message||"An error occurred while fetching data."}:{title:"No Data Available",description:"This query has no data to edit. Try refetching the query first."},{title:o,description:a}=r();return $e(f,{style:I.emptyState,children:[R(p,{testID:"buoy-rq-detail-empty-title",style:I.emptyTitle,children:o}),R(p,{testID:"buoy-rq-detail-empty-description",style:I.emptyDescription,children:a})]})}var I=M.create({explorerScrollContainer:{flex:1},explorerScrollContent:{paddingBottom:16,paddingHorizontal:8,flexGrow:1},section:{marginBottom:16},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:O.color.text,fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},emptyDescription:{color:O.color.textSecondary,fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280},actionFooter:{borderTopWidth:1,borderTopColor:O.color.border,paddingTop:8,paddingHorizontal:12,backgroundColor:"transparent",borderBottomLeftRadius:14,borderBottomRightRadius:14},actionsRow:{flexDirection:"row",alignItems:"center",gap:8},queryExplorerContainer:{minWidth:200,backgroundColor:O.color.surface,borderRadius:6,borderWidth:1,borderColor:O.color.accent+"4D",overflow:"hidden",shadowColor:O.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},queryExplorerHeader:{backgroundColor:O.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:O.color.accent,borderBottomWidth:1,borderBottomColor:O.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:Ko},queryExplorerContent:{padding:8},dataContainer:{minWidth:200,backgroundColor:O.color.surface,borderRadius:6,borderWidth:1,borderColor:O.color.accent+"4D",overflow:"hidden",shadowColor:O.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6,marginTop:8},dataHeader:{backgroundColor:O.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:O.color.accent,borderBottomWidth:1,borderBottomColor:O.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:Ko},dataContent:{padding:8}});import{useState as il,useCallback as sl,useEffect as ll,useRef as ul}from"react";import{jsx as Mt}from"react/jsx-runtime";function Bo({visible:e,selectedQueryKey:t,onQuerySelect:r,onClose:o,onMinimize:a,enableSharedModalDimensions:n=false,onTabChange:s}){let{query:i,version:l}=Bt(t),[u,c]=il("bottomSheet"),d=t?JSON.stringify(t):void 0,h=ul(void 0);ll(()=>{if(i){h.current=d;return}e&&h.current!==void 0&&h.current===d&&(h.current=void 0,r(void 0))},[e,i,d,r]);let g=sl(x=>{c(x)},[]),y=Zs({minBottom:16}),m=u==="floating"?72:80+y.bottom,C=()=>Mt(Xe,{selectedQuery:i,activeTab:"queries",onTabChange:s,onBack:()=>r(void 0)}),v=n?Po.reactQuery.modal():`${Po.reactQuery.modal()}_data_editor`;if(!e||!i)return null;let b=Mt(ol,{selectedQuery:i,isFloatingMode:u==="floating",queryVersion:l},`footer-${l}`);return Mt(Xs,{visible:e,onClose:o,onMinimize:a,persistenceKey:v,header:{customContent:C(),showToggleButton:true},onModeChange:g,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},footer:b,footerHeight:m,children:Mt(Lo,{selectedQuery:i,isFloatingMode:u==="floating",disableInternalFooter:true,queryVersion:l})})}import{useQueryClient as cl}from"@tanstack/react-query";import{useCallback as sr,useState as Ho,useRef as Wo}from"react";import{useEffect as dl,useState as yl}from"react";import{useQueryClient as hl}from"@tanstack/react-query";function lr(e){let t=hl(),[r,o]=yl(void 0);return dl(()=>{let a=()=>{if(e!==void 0){let s=t.getMutationCache().getAll().find(i=>i.mutationId===e);o(s)}else o(void 0)};setTimeout(a,0);let n=t.getMutationCache().subscribe(a);return()=>n()},[t,e]),r}import{jsx as jo}from"react/jsx-runtime";function Vo({selectedMutation:e,onMutationSelect:t,activeFilter:r,searchText:o=""}){let a=n=>{t(typeof n=="function"?n(e):n)};return jo(f,{style:$o.mutationListContainer,children:jo(po,{selectedMutation:e,setSelectedMutation:a,activeFilter:r,searchText:o,hideInfoPanel:true,contentContainerStyle:$o.mutationListContent})})}var $o=M.create({mutationListContainer:{flex:1,backgroundColor:"transparent"},mutationListContent:{padding:8,backgroundColor:"transparent"}});import{ToolFooter as fl,useSafeAreaInsets as ml}from"@buoy-gg/shared-ui/web";import{useMemo as gl}from"react";import{jsx as ur}from"react/jsx-runtime";function No({activeFilter:e,onFilterChange:t,modalMode:r,size:o="default"}){let a=r==="floating",n=ml({minBottom:16}),s=gl(()=>a?0:n.bottom,[a,n.bottom]);return ur(fl,{floating:a,safeArea:false,paddingBottom:s,style:Uo.filterFooter,children:ur(f,{style:Uo.filterContainer,children:ur(bo,{activeFilter:e,onFilterChange:t,size:o})})},`footer-${a?"floating":"docked"}`)}var Uo=M.create({filterFooter:{paddingTop:8,paddingHorizontal:0},filterContainer:{minHeight:32,justifyContent:"center"}});import{JsModal as pl,useSafeAreaInsets as bl}from"@buoy-gg/shared-ui/web";import{absoluteFill as vl}from"@buoy-gg/shared-ui/web";import{useMemo as H}from"react";import{ChevronLeft as Sl,ChevronRight as Cl,night as At}from"@buoy-gg/shared-ui/web";import{jsx as Ne,jsxs as xl}from"react/jsx-runtime";var ze=32,_o=6,Jo=ze,wl=120,Dt=.95,Go=1.15;function Yo({translationX:e,maxTranslation:t=wl,canSwipeLeft:r=true,canSwipeRight:o=true}){let a=H(()=>e.interpolate({inputRange:[0,t],outputRange:[0,1],extrapolate:"clamp"}),[e,t]),n=H(()=>a.interpolate({inputRange:[0,1],outputRange:[_o,Jo]}),[a]),s=H(()=>a.interpolate({inputRange:[0,Dt,1],outputRange:[1,1,Go]}),[a]),i=H(()=>a.interpolate({inputRange:[0,.99,1],outputRange:[0,0,16]}),[a]),l=H(()=>a.interpolate({inputRange:[0,.01],outputRange:[0,1],extrapolate:"clamp"}),[a]),u=H(()=>a.interpolate({inputRange:[0,.5,1],outputRange:[0,0,1],extrapolate:"clamp"}),[a]),c=H(()=>a.interpolate({inputRange:[0,.5,Dt,1],outputRange:[.8,.8,1,1.2]}),[a]),d=H(()=>e.interpolate({inputRange:[-t,0],outputRange:[1,0],extrapolate:"clamp"}),[e,t]),h=H(()=>d.interpolate({inputRange:[0,1],outputRange:[_o,Jo]}),[d]),g=H(()=>d.interpolate({inputRange:[0,Dt,1],outputRange:[1,1,Go]}),[d]),y=H(()=>d.interpolate({inputRange:[0,.99,1],outputRange:[0,0,-16]}),[d]),m=H(()=>d.interpolate({inputRange:[0,.01],outputRange:[0,1],extrapolate:"clamp"}),[d]),C=H(()=>d.interpolate({inputRange:[0,.5,1],outputRange:[0,0,1],extrapolate:"clamp"}),[d]),v=H(()=>d.interpolate({inputRange:[0,.5,Dt,1],outputRange:[.8,.8,1,1.2]}),[d]);return xl(f,{style:cr.container,pointerEvents:"none",children:[o&&Ne(X.View,{style:[cr.leftWrapper,{width:n,height:ze,borderRadius:ze/2,backgroundColor:At.color.text+"E6",justifyContent:"center",alignItems:"center",opacity:l,transform:[{scale:s},{translateX:i}]}],children:Ne(X.View,{style:{opacity:u,transform:[{scale:c}]},children:Ne(Sl,{size:ze*.6,color:At.color.accent,strokeWidth:3})})}),r&&Ne(X.View,{style:[cr.rightWrapper,{width:h,height:ze,borderRadius:ze/2,backgroundColor:At.color.text+"E6",justifyContent:"center",alignItems:"center",opacity:m,transform:[{scale:g},{translateX:y}]}],children:Ne(X.View,{style:{opacity:C,transform:[{scale:v}]},children:Ne(Cl,{size:ze*.6,color:At.color.accent,strokeWidth:3})})})]})}var cr=M.create({container:{...vl,zIndex:1e3,justifyContent:"center",alignItems:"center"},leftWrapper:{position:"absolute",left:16},rightWrapper:{position:"absolute",right:16}});import{devToolsStorageKeys as Xo}from"@buoy-gg/shared-ui/web";import{jsx as Ue,jsxs as ql}from"react/jsx-runtime";function Zo({visible:e,selectedMutationId:t,onMutationSelect:r,onClose:o,onMinimize:a,activeFilter:n,onFilterChange:s,onTabChange:i,enableSharedModalDimensions:l=false,searchText:u="",onSearchChange:c}){let d=cl(),h=lr(t),[g,y]=Ho(null),m=n??g,C=s??y,v=sr(()=>{d.getMutationCache().clear(),r(void 0)},[d,r]),[b,x]=Ho("bottomSheet"),S=l?Xo.reactQuery.modal():Xo.reactQuery.mutationModal(),w=Wo(new X.Value(0)).current,A=sr(he=>{he==="right"&&i("queries")},[i]),Y=sr(he=>{x(he)},[]),Qe=bl({minBottom:16}),T=b==="floating"?56:48+Qe.bottom,Ge=Wo(Ht.create({onStartShouldSetPanResponder:()=>false,onMoveShouldSetPanResponder:(he,fe)=>Math.abs(fe.dx)>5&&Math.abs(fe.dy)<10,onPanResponderMove:(he,fe)=>{w.setValue(fe.dx)},onPanResponderRelease:(he,fe)=>{let{dx:ct,vx:dt}=fe,zt=80,Kt=.5;X.spring(w,{toValue:0,useNativeDriver:true}).start(),(Math.abs(ct)>zt||Math.abs(dt)>Kt)&&(ct>0||dt>0?A("right"):A("left"))},onPanResponderTerminate:()=>{X.spring(w,{toValue:0,useNativeDriver:true}).start()}})).current;if(!e)return null;let ut=()=>Ue(Xe,{selectedMutation:h,activeTab:"mutations",onTabChange:i,onBack:()=>r(void 0),searchText:u,onSearchChange:c,onClearCache:v}),Ot=Ue(No,{activeFilter:m,onFilterChange:C,modalMode:b});return Ue(pl,{visible:e,onClose:o,onMinimize:a,persistenceKey:S,header:{customContent:ut(),showToggleButton:true},onModeChange:Y,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},footer:Ot,footerHeight:T,children:Ue(f,{style:{flex:1},children:ql(f,{...Ge.panHandlers,style:{flex:1},children:[Ue(Yo,{translationX:w,canSwipeLeft:false,canSwipeRight:true}),Ue(Vo,{selectedMutation:h,onMutationSelect:r,activeFilter:m,searchText:u})]})})})}import{JsModal as Tl,useSafeAreaInsets as Ml,devToolsStorageKeys as ea}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as Al,night as z,monoFont as ta}from"@buoy-gg/shared-ui/web";import{useMemo as Dl}from"react";import{useQueryClient as Ql}from"@tanstack/react-query";function ra(e){let t=Ql();return Dl(()=>[{label:"Remove",variant:"remove",disabled:false,onPress:()=>t.getMutationCache().remove(e)}],[e,t])}import{DataViewer as Rl}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as Il,jsx as k,jsxs as _e}from"react/jsx-runtime";function oa({selectedMutation:e,isFloatingMode:t,disableInternalFooter:r=false}){return _e(Il,{children:[_e(me,{testID:"buoy-rq-mutation-detail-scroll",accessibilityLabel:"Mutation editor mode",accessibilityHint:"View mutation editor mode","sentry-label":"ignore mutation editor mode",style:F.explorerScrollContainer,contentContainerStyle:F.explorerScrollContent,children:[_e(f,{style:F.section,children:[k(kl,{visible:!!e.state.data,selectedMutation:e}),k(El,{visible:!e.state.data,selectedMutation:e})]}),k(f,{style:F.section,children:k(rr,{selectedMutation:e})}),k(f,{style:F.section,children:_e(f,{style:F.mutationExplorerContainer,children:[k(p,{style:F.mutationExplorerHeader,children:"Mutation Explorer"}),k(f,{style:F.mutationExplorerContent,children:k(Rl,{title:"",data:e,maxDepth:10,rawMode:true,showTypeFilter:true,initialExpanded:false})})]})})]}),!r&&k(aa,{selectedMutation:e,isFloatingMode:t})]})}function aa({selectedMutation:e,isFloatingMode:t}){let r=Al({minBottom:16}),o=ra(e);return k(f,{style:[F.actionFooter,{paddingBottom:t?0:r.bottom+8}],children:k(f,{style:F.actionsGrid,children:o.map((a,n)=>k(ne,{testID:`buoy-rq-action-${a.variant}`,onClick:a.onPress,text:a.label,variant:a.variant,disabled:a.disabled},n))})})}function kl({visible:e,selectedMutation:t}){return e?_e(f,{style:F.dataContainer,children:[k(p,{style:F.dataHeader,children:"Data Editor"}),k(f,{style:F.dataContent,children:k(ce,{editable:true,label:"Data",value:t.state.data,defaultExpanded:["Data"]},t.mutationId)})]}):null}function El({visible:e,selectedMutation:t}){if(!e)return null;let r=()=>t.state.status==="pending"?{title:"Pending...",description:"The mutation is in progress."}:t.state.status==="error"?{title:"Mutation Error",description:t.state.error?.message||"An error occurred."}:{title:"No Data Available",description:"This mutation has no data."},{title:o,description:a}=r();return _e(f,{style:F.emptyState,children:[k(p,{testID:"buoy-rq-mutation-detail-empty-title",style:F.emptyTitle,children:o}),k(p,{testID:"buoy-rq-mutation-detail-empty-description",style:F.emptyDescription,children:a})]})}var F=M.create({explorerScrollContainer:{flex:1},explorerScrollContent:{paddingBottom:16,paddingHorizontal:8,flexGrow:1},section:{marginBottom:16},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:z.color.text,fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},emptyDescription:{color:z.color.textSecondary,fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280},actionFooter:{borderTopWidth:1,borderTopColor:z.color.border,paddingVertical:8,paddingHorizontal:12,backgroundColor:"transparent",borderBottomLeftRadius:14,borderBottomRightRadius:14},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,justifyContent:"space-between"},mutationExplorerContainer:{minWidth:200,backgroundColor:z.color.surface,borderRadius:6,borderWidth:1,borderColor:z.color.accent+"4D",overflow:"hidden",shadowColor:z.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},mutationExplorerHeader:{backgroundColor:z.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:z.color.accent,borderBottomWidth:1,borderBottomColor:z.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:ta},mutationExplorerContent:{padding:8},dataContainer:{minWidth:200,backgroundColor:z.color.surface,borderRadius:6,borderWidth:1,borderColor:z.color.accent+"4D",overflow:"hidden",shadowColor:z.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},dataHeader:{backgroundColor:z.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:z.color.accent,borderBottomWidth:1,borderBottomColor:z.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:ta},dataContent:{padding:8}});import{useState as Fl,useCallback as Pl,useEffect as Ol,useRef as zl}from"react";import{jsx as Qt}from"react/jsx-runtime";function na({visible:e,selectedMutationId:t,onMutationSelect:r,onClose:o,onMinimize:a,onTabChange:n,enableSharedModalDimensions:s=false}){let i=lr(t),[l,u]=Fl("bottomSheet"),c=zl(void 0);Ol(()=>{if(i){c.current=i.mutationId;return}e&&c.current!==void 0&&c.current===t&&(c.current=void 0,r(void 0))},[e,i,t,r]);let d=Pl(v=>{u(v)},[]),h=Ml({minBottom:16}),g=l==="floating"?72:80+h.bottom,y=()=>Qt(Xe,{selectedMutation:i,activeTab:"mutations",onTabChange:n,onBack:()=>r(void 0)}),m=s?ea.reactQuery.modal():ea.reactQuery.mutationModal();if(!e||!i)return null;let C=Qt(aa,{selectedMutation:i,isFloatingMode:l==="floating"});return Qt(Tl,{visible:e,onClose:o,onMinimize:a,persistenceKey:m,header:{customContent:y(),showToggleButton:true},onModeChange:d,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},footer:C,footerHeight:g,children:Qt(oa,{selectedMutation:i,isFloatingMode:l==="floating",disableInternalFooter:true})})}import{Fragment as Kl,jsx as Rt,jsxs as Ll}from"react/jsx-runtime";function ia({visible:e,selectedQueryKey:t,selectedMutationId:r,onQuerySelect:o,onMutationSelect:a,onClose:n,onMinimize:s,activeFilter:i,onFilterChange:l,activeTab:u,onTabChange:c,enableSharedModalDimensions:d=false,searchText:h="",onSearchChange:g}){let y=!!t||!!r,m=u==="queries",C=u==="mutations",v={onClose:n,onMinimize:s,activeFilter:i,onFilterChange:l,enableSharedModalDimensions:d},b=e&&!y&&m,x=e&&!y&&C,S=e&&y&&m&&!!t,w=e&&y&&C&&!!r;return Ll(Kl,{children:[Rt(Fo,{visible:b,selectedQueryKey:t,onQuerySelect:o,onTabChange:c,searchText:h,onSearchChange:g,...v}),Rt(Zo,{visible:x,selectedMutationId:r,onMutationSelect:a,onTabChange:c,searchText:h,onSearchChange:g,...v}),Rt(Bo,{visible:S,selectedQueryKey:t,onQuerySelect:o,onTabChange:c,...v}),Rt(na,{visible:w,selectedMutationId:r,onMutationSelect:a,onTabChange:c,...v})]})}import{ChangeLog as Bl}from"@buoy-gg/shared-ui/web";var Hl=0;function Te(){return`rq-${Date.now()}-${++Hl}`}var Wl=class extends Bl{constructor(){super({max:200});this.queryClient=null;this.queryUnsubscribe=null;this.mutationUnsubscribe=null;this.fetchStartTimes=new Map;this.mutationStartTimes=new Map;this.lastQueryStates=new Map;this.lastMutationStates=new Map}setQueryClient(e){this.disconnect(),this.queryClient=e,this.queryUnsubscribe=e.getQueryCache().subscribe(t=>{t.type==="updated"&&t.query&&this.handleQueryUpdate(t.query)}),this.mutationUnsubscribe=e.getMutationCache().subscribe(t=>{t.type==="updated"&&t.mutation&&this.handleMutationUpdate(t.mutation)})}disconnect(){this.queryUnsubscribe&&(this.queryUnsubscribe(),this.queryUnsubscribe=null),this.mutationUnsubscribe&&(this.mutationUnsubscribe(),this.mutationUnsubscribe=null),this.queryClient=null,this.lastQueryStates.clear(),this.lastMutationStates.clear(),this.fetchStartTimes.clear(),this.mutationStartTimes.clear()}handleQueryUpdate(e){if(pe(e.queryKey))return;let t=e.queryHash,r={fetchStatus:e.state.fetchStatus,status:e.state.status},o=this.lastQueryStates.get(t);if(!o)r.fetchStatus==="fetching"&&(this.fetchStartTimes.set(t,Date.now()),this.addEvent({id:Te(),type:"query-fetch-start",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,query:e}));else{let a=o.fetchStatus==="fetching",n=r.fetchStatus==="fetching";if(!a&&n&&(this.fetchStartTimes.set(t,Date.now()),this.addEvent({id:Te(),type:"query-fetch-start",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,query:e})),a&&!n){let s=this.fetchStartTimes.get(t),i=s?Date.now()-s:void 0;this.fetchStartTimes.delete(t),r.status==="error"?this.addEvent({id:Te(),type:"query-fetch-error",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,queryError:e.state.error,duration:i,query:e}):this.addEvent({id:Te(),type:"query-fetch-success",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,queryData:e.state.data,duration:i,query:e})}!o.status&&e.state.isInvalidated&&this.addEvent({id:Te(),type:"query-invalidated",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,query:e})}this.lastQueryStates.set(t,r)}handleMutationUpdate(e){let t=e.mutationId,r=e.state.status,o=this.lastMutationStates.get(t);if(o!==r){if(r==="pending"&&o!=="pending")this.mutationStartTimes.set(t,Date.now()),this.addEvent({id:Te(),type:"mutation-start",timestamp:Date.now(),mutationId:t,mutationKey:e.options.mutationKey,mutationVariables:e.state.variables,mutation:e});else if(r==="success"&&o==="pending"){let a=this.mutationStartTimes.get(t),n=a?Date.now()-a:void 0;this.mutationStartTimes.delete(t),this.addEvent({id:Te(),type:"mutation-success",timestamp:Date.now(),mutationId:t,mutationKey:e.options.mutationKey,mutationVariables:e.state.variables,mutationData:e.state.data,duration:n,mutation:e})}else if(r==="error"&&o==="pending"){let a=this.mutationStartTimes.get(t),n=a?Date.now()-a:void 0;this.mutationStartTimes.delete(t),this.addEvent({id:Te(),type:"mutation-error",timestamp:Date.now(),mutationId:t,mutationKey:e.options.mutationKey,mutationVariables:e.state.variables,mutationError:e.state.error,duration:n,mutation:e})}}this.lastMutationStates.set(t,r)}addEvent(e){this.record(e)}getEvents(){return this.items}subscribe(e){let t=super.subscribe(e);return e(this.items),t}clearEvents(){this.clear()}isConnected(){return this.queryClient!==null}},Ke=new Wl,jl=e=>Ke.setQueryClient(e),Vl=()=>Ke.disconnect();import{jsx as sa}from"react/jsx-runtime";function dr({visible:e,onClose:t,onMinimize:r,enableSharedModalDimensions:o=true}){let a=Ha();Ba(()=>{Ke.isConnected()||Ke.setQueryClient(a)},[a]);let[n,s]=Ye(void 0),[i,l]=Ye(void 0),[u,c]=Ye(null),[d,h]=Ye("queries"),[g,y]=Ye(""),m=Re(()=>{s(void 0),l(void 0),c(null),h("queries"),y("")},[]),C=Re(()=>{m(),t()},[t,m]),v=Re(A=>{s(A?.queryKey)},[]),b=Re(A=>{l(A?.mutationId)},[]),x=Re(A=>{c(A)},[]),S=Re(A=>{h(A),c(null),s(void 0),l(void 0),y("")},[]),w=Re(A=>{y(A)},[]);return e?sa(Wa,{children:sa(ia,{visible:e,selectedQueryKey:n,selectedMutationId:i,onQuerySelect:v,onMutationSelect:b,onClose:C,onMinimize:r,activeFilter:u,onFilterChange:x,activeTab:d,onTabChange:S,searchText:g,onSearchChange:w,enableSharedModalDimensions:o})}):null}import{onlineManager as ye}from"@tanstack/react-query";import{devToolsStorageKeys as la,persistentStorage as ua}from"@buoy-gg/shared-ui/web";import{useState as ca,useEffect as da}from"react";import{jsx as It}from"react/jsx-runtime";var ya=()=>null,ha=async e=>{try{await ua.setItem(la.settings.wifiEnabled(),e.toString())}catch{}},$l=async()=>{try{let e=await ua.getItem(la.settings.wifiEnabled());e!==null&&ye.setOnline(e==="true")}catch{}};$l();function Nl({size:e}){let[t,r]=ca(()=>ye.isOnline());return da(()=>ye.subscribe(o=>{r(o)}),[]),It(Sr,{size:e,color:t?"#10B981":"#DC2626"})}var Ul={id:"query",name:"QUERY",description:"React Query inspector",slot:"both",icon:({size:e})=>It(vr,{size:e}),component:dr,props:{enableSharedModalDimensions:false}};function _l(e){return{id:e?.id||"query",name:e?.name||"QUERY",description:e?.description||"React Query inspector",slot:"both",icon:({size:t})=>It(vr,{size:t}),component:dr,props:{enableSharedModalDimensions:e?.enableSharedModalDimensions!==void 0?e.enableSharedModalDimensions:false}}}var Jl={id:"query-wifi-toggle",name:"WIFI",description:"Toggle React Query online/offline state",slot:"row",icon:Nl,component:ya,props:{},launchMode:"toggle-only",onPress:()=>{let e=!ye.isOnline();ye.setOnline(e),ha(e)}};function Gl(e){let t=e?.onColor||"#10B981",r=e?.offColor||"#DC2626",o=({size:a})=>{let[n,s]=ca(()=>ye.isOnline());return da(()=>ye.subscribe(i=>{s(i)}),[]),It(Sr,{size:a,color:n?t:r})};return{id:e?.id||"query-wifi-toggle",name:e?.name||"WIFI",description:e?.description||"Toggle React Query online/offline state",slot:"row",icon:o,component:ya,props:{},launchMode:"toggle-only",onPress:()=>{let a=!ye.isOnline();ye.setOnline(a),ha(a)}}}import{expandKeyedArrays as Yl,patchFromPath as Xl,readPath as Zl,refusalText as eu,shapeSummary as kt,suggestedPatch as tu,typedEditViolations as ru,unshapedLists as ou}from"@buoy-gg/shared-ui/web";import{onlineManager as yr}from"@tanstack/react-query";import{isJsonSerializable as fa,isOverWireBudget as ma}from"@buoy-gg/shared-ui/web";var au=Object.freeze({__buoyDataOnDevice:true,note:"Query data stays on the device \u2014 fetched on demand via getQueryData."}),ga=Object.freeze({__buoyUnserializable:true,note:"Query data is not JSON-serializable (circular or bigint) and stayed on the device."}),nu=16*1024,pa=8*1024*1024;function iu(e){return!!e&&typeof e=="object"&&e.__buoyDataOnDevice===true}function su(e){return!!e&&typeof e=="object"&&e.__buoyUnserializable===true}function ba(e){return iu(e)||su(e)}function Me(e){if(e!==void 0)return ma(e,nu)?fa(e)?au:ga:e}function Et(e){if(e==null)return e;if(typeof e=="object"){let t=e,r=typeof t.name=="string"?t.name:void 0,o=typeof t.message=="string"?t.message:void 0;if(r!==void 0||o!==void 0)return Me({...r!==void 0?{name:r}:{},...o!==void 0?{message:o}:{}})}return Me(e)}function lu(e){return ma(e,pa)?fa(e)?{__buoyTruncated:true,note:`Exceeds the ${pa/(1024*1024)}MB detail limit \u2014 inspect it on-device.`}:ga:e}function uu(e){let t=e.getMutationCache().getAll().map(o=>cu(o)),r=e.getQueryCache().getAll().map(o=>yu(o));return{mutations:t,queries:r}}function cu(e){let t=e.state;return{mutationId:e.mutationId,mutationKey:e.options.mutationKey,state:{...t,data:Me(t.data),variables:Me(t.variables),error:Et(t.error),failureReason:Et(t.failureReason)},...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:Me(e.meta)}}}function du(e){let{queryFn:t,select:r,persister:o,initialData:a,placeholderData:n,...s}=e;return{...s,queryFn:void 0,...e.meta?{meta:Me(e.meta)}:{}}}function yu(e){let t=e.observers.map(r=>({queryHash:e.queryHash,options:du(r.options)}));return{state:{...e.state,...e.state.data!==void 0&&{data:Me(e.state.data)},error:Et(e.state.error),fetchFailureReason:Et(e.state.fetchFailureReason)},queryKey:e.queryKey,queryHash:e.queryHash,...e.meta&&{meta:Me(e.meta)},observers:t}}function hu(e,t){let r=e;for(let o of t.split(".")){if(!r||typeof r!="object"||Array.isArray(r)||!(o in r))return false;r=r[o]}return Array.isArray(r)?r.length>0:!!r&&typeof r=="object"}var st=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function va(e){return Array.isArray(e)?"array":e===null?"null":typeof e=="object"?"object":typeof e}function Sa(e,t,r="",o={shrunk:[],breaks:[]}){if(Array.isArray(e)&&Array.isArray(t))return t.length>0&&t.length<e.length&&o.shrunk.push({path:r||"(root)",have:e.length,sent:t.length}),t;if(!st(e)||!st(t))return t;let a={...e};for(let[n,s]of Object.entries(t)){let i=r?`${r}.${n}`:n;if(n in e){let l=va(e[n]),u=va(s);(l==="array"||l==="object")&&l!==u&&o.breaks.push({path:i,from:l,to:u}),a[n]=Sa(e[n],s,i,o)}else a[n]=s}return a}function fu(e){let t=e.trim();try{let r=JSON.parse(t);if(Array.isArray(r))return r.map(o=>typeof o=="object"&&o!==null?JSON.stringify(o):String(o))}catch{}return t.includes(",")&&!t.startsWith("[")?t.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")):null}function Ca(e){let t=r=>{let{queryHash:o}=r,a=e.getQueryCache(),n=o?a.get(o):void 0;if(!n&&typeof o=="string"){let s=fu(o);s&&(n=a.getAll().find(i=>{let l=i.queryKey.map(u=>typeof u=="object"?JSON.stringify(u):String(u));return l.length===s.length&&l.every((u,c)=>u===s[c])}))}if(!n)throw new Error(`Query with hash "${o}" not found`);return n};return{version:2,getSnapshot:()=>({dehydratedState:uu(e),isOnlineManagerOnline:yr.isOnline()}),subscribe:r=>{let o=e.getQueryCache().subscribe(r),a=e.getMutationCache().subscribe(r),n=yr.subscribe(r);return()=>{o(),a(),n()}},actions:{getQueryData:r=>{let{queryHash:o,path:a}=r??{};if(!o)return{found:false,reason:"missing queryHash"};let n=e.getQueryCache().get(o);if(!n)return{found:false,reason:"unknown queryHash"};if(a){let i=Zl(n.state.data,a);return i.ok?{found:true,queryHash:o,path:a,shape:kt(i.value),data:i.value}:{found:false,reason:i.error}}if(n.state.data===void 0){let i=n.state.status,l=n.state.error;return{found:true,queryHash:o,hasData:false,status:i,fetchStatus:n.state.fetchStatus,...l?{error:l instanceof Error?l.message:String(l)}:{},reason:i==="error"?"This query has no data because it FAILED. Report the error, not an empty result.":n.state.fetchStatus==="fetching"?"No data yet \u2014 this query is still fetching.":"This query has never resolved (it may be disabled, or never enabled). It is not empty \u2014 it has nothing."}}let s=kt(n.state.data);return{found:true,queryHash:o,hasData:true,...s?{shape:s}:{},data:lu(n.state.data)}},listQueries:r=>{let{includeData:o=false,staleOnly:a=false,limit:n}=r??{},s=e.getQueryCache().getAll(),i=[...a?s.filter(u=>u.isStale()):s].sort((u,c)=>{let d=+(c.getObserversCount()>0)-+(u.getObserversCount()>0);return d!==0?d:(c.state.dataUpdatedAt??0)-(u.state.dataUpdatedAt??0)}),l=(typeof n=="number"&&n>0?i.slice(0,n):i).map(u=>{let c=u.state.error;return{queryHash:u.queryHash,queryKey:u.queryKey,status:oe(u),fetchStatus:u.state.fetchStatus,isStale:u.isStale(),observers:u.getObserversCount(),updatedAt:u.state.dataUpdatedAt,error:c?c.message??String(c):void 0,...o?{data:u.state.data}:{},...kt(u.state.data)?{shape:kt(u.state.data)}:{}}});return{queries:l,total:s.length,returned:l.length,includedData:o}},refetch:r=>t(r).fetch().catch(()=>{}),invalidate:r=>e.invalidateQueries(t(r)),reset:r=>e.resetQueries(t(r)),remove:r=>{let o=t(r),a=e.getQueryCache().findAll(o).some(n=>n.getObserversCount()>0);return e.removeQueries(o),{ok:true,...a?{note:"Removed \u2014 but a screen is still watching this query, and React Query leaves that screen rendering its LAST value (including anything written into the cache before this) until something refetches. Nothing on screen will change on its own. Use `reset` instead when you want the screen to go back to loading and fetch again."}:{}}},setQueryData:r=>{let{data:o,merge:a,force:n,path:s,value:i}=r,{queryKey:l,queryHash:u}=r,c=l;if(c===void 0&&typeof u=="string"){let y=e.getQueryCache().get(u);if(!y)return{ok:false,error:`Refused: no query with hash ${u} is in the cache. Read listQueries for the current hashes \u2014 a query that has been removed or whose key includes changing params (a search term, a cart payload) will not match an older hash.`};c=y.queryKey}if(c===void 0)return{ok:false,error:"Refused: no query was named. Send `queryKey` (the array from listQueries) or `queryHash` (its string form)."};let d=e.getQueryData(c),h=e.getQueryCache().find({queryKey:c,exact:true});if(d===void 0&&h&&(o!==void 0||s!==void 0)){let y=h,m=y?.state.status;return{ok:false,error:`Refused: this query has no data to edit \u2014 ${m==="error"?`it FAILED${y?.state.error?` (${y.state.error instanceof Error?y.state.error.message:String(y.state.error)})`:""}`:m==="pending"?"it has never resolved (it may be disabled, or still loading)":"it holds no data"}. There is nothing to merge into. Fix the cause first (restoreError, or let it fetch), or send force:true with the COMPLETE value if you mean to seed the cache from nothing.`,status:m}}if(o===void 0&&s===void 0)return{ok:false,error:"Refused: no change was described. Send `data` (with merge:true for a partial edit), or `path` and `value` to set one value."};let g=o;if(s!==void 0){if(i===void 0)return{ok:false,error:`Refused: sent \`path\` without \`value\`. Say what to set "${s}" to; if you mean to clear it, send value:null and the field must already be nullable.`};let y=Xl(d,s,i);if(!y.ok)return{ok:false,error:`Refused: ${y.error}`};g=y.patch}if(a||s!==void 0){let y=n?{patch:g,notes:[],error:void 0}:Yl(d,g);if(y.error)return{ok:false,error:`Refused: ${y.error}`};let m=y.patch;if(!n){let b=ru(d,m,{noun:"data"});if(b.length>0){let x=tu(m,b);return{ok:false,error:eu(b,"data",x),violations:b,...x?{suggestedData:x}:{}}}}let C=Sa(d,m),v=ou(d).filter(b=>hu(m,b));return e.setQueryData(c,C,{updatedAt:Date.now()}),{ok:true,mode:"merge",...s!==void 0?{path:s}:{},changedKeys:st(m)?Object.keys(m):void 0,...y.notes.length?{keyed:y.notes}:{},...v.length?{unchecked:v.map(b=>`\`${b}\` 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 screen renders a field you left out, it will render undefined \u2014 read the query back and compare against how the screen uses it.`)}:{}}}if(!n&&st(d)&&st(o)){let y=Object.keys(d).filter(m=>!(m in o));if(y.length>0)return{ok:false,error:`Refused: the new value drops ${y.length} top-level field(s) the cached value has (${y.slice(0,8).join(", ")}${y.length>8?", \u2026":""}). A screen rendering those fields would crash. To change some fields, send merge:true with ONLY the fields that change. To really replace the whole value, send force:true.`,missingKeys:y}}return e.setQueryData(c,o,{updatedAt:Date.now()}),{ok:true,mode:"replace"}},triggerError:r=>{let o=t(r),a=o.options;o.setState({status:"error",error:new Error("Unknown error from devtools"),fetchMeta:{...o.state.fetchMeta,__previousQueryOptions:a}})},restoreError:r=>e.resetQueries(t(r)),triggerLoading:r=>{let o=t(r),a=o.options;o.fetch({...a,queryFn:()=>new Promise(()=>{}),gcTime:-1}).catch(()=>{}),o.setState({data:void 0,status:"pending",fetchMeta:{...o.state.fetchMeta,__previousQueryOptions:a}})},restoreLoading:r=>{let o=t(r),a=o.state,n=o.state.fetchMeta?o.state.fetchMeta.__previousQueryOptions:null;o.cancel({silent:true}),o.setState({...a,fetchStatus:"idle",fetchMeta:null}),n&&o.fetch(n).catch(()=>{})},clearQueryCache:()=>{let r=e.getQueryCache().getAll().filter(o=>o.getObserversCount()>0).length;return e.getQueryCache().clear(),{ok:true,cleared:true,...r?{note:`Cleared \u2014 but ${r} quer${r===1?"y is":"ies are"} still being watched by a screen, and React Query leaves those screens rendering their LAST value until something refetches. The cache is empty; the app on screen is not. Use \`reset\` on a query when you want its screen to reload.`}:{}}},clearMutationCache:()=>{e.getMutationCache().clear()},setOnline:r=>{let{online:o}=r;yr.setOnline(o)}}}}import{useEffect as mu,useMemo as gu}from"react";import{useQueryClient as pu}from"@tanstack/react-query";import{classifyPreviewItem as bu,createRestoreScope as vu,emptyRestoreResult as Su,failedRestore as Cu,registerStateSnapshotProvider as xu,superJsonSerialize as wu}from"@buoy-gg/shared-ui/web";function xa(e){return{...e,fetchStatus:"idle",fetchMeta:null}}function hr(e){return{status:e.state.status,error:e.state.error??null,data:e.state.data}}function fr(e,t){try{let r=JSON.stringify(e);return r.length>60?`${r.slice(0,57)}\u2026`:r}catch{return t}}function wa(e){if(e==null)return e??null;if(typeof e=="object"){let t=e,r=typeof t.name=="string"?t.name:void 0,o=typeof t.message=="string"?t.message:void 0;if(r!==void 0||o!==void 0)return{...r!==void 0?{name:r}:{},...o!==void 0?{message:o}:{}}}return e}function qa(e){if(e===void 0)return true;try{return wu(e),true}catch{return false}}function Ta(e){let t=[],r=[];for(let o of e.getQueryCache().getAll()){let a=fr(o.queryKey,o.queryHash);if(!qa(o.state.data)){t.push(`query ${a}: data can't be serialized (circular reference?) \u2014 not captured`);continue}r.push({queryKey:o.queryKey,queryHash:o.queryHash,...o.meta&&qa(o.meta)?{meta:o.meta}:{},state:xa({...o.state,error:wa(o.state.error),fetchFailureReason:wa(o.state.fetchFailureReason)})})}return{queries:r,warnings:t}}function qu(e){return{id:"query",label:"React Query",status:()=>({canCapture:true,canRestore:true}),async capture(){let{queries:t,warnings:r}=Ta(e),o=e.getMutationCache().getAll().length;return o>0&&r.push(`${o} mutation(s) not captured (mutation functions cannot be restored)`),{data:{queries:t},warnings:r}},async restore(t,r){let o=t,a=vu(r),n=Su();if(!o?.queries)return Cu("empty query snapshot");let s=e.getQueryCache(),i=new Set(o.queries.map(c=>c.queryHash));for(let c of o.queries)if(a.allows(c.queryHash)){if(ba(c.state.data)){n.skipped.push({id:c.queryHash,reason:"captured as an on-device placeholder by an older Buoy \u2014 re-capture this restore point"});continue}try{let d=xa(c.state),h=s.get(c.queryHash);h?h.setState(d):s.build(e,{queryKey:c.queryKey,queryHash:c.queryHash,...c.meta&&{meta:c.meta}},d),n.applied+=1}catch(d){n.skipped.push({id:c.queryHash,reason:String(d)}),n.ok=false}}for(let c of s.getAll().slice())if(a.allows(c.queryHash)&&!i.has(c.queryHash))try{s.remove(c),n.applied+=1}catch(d){n.skipped.push({id:c.queryHash,reason:String(d)})}let l=e.getMutationCache().getAll().length;l>0&&(e.getMutationCache().clear(),n.warnings.push(`mutation cache cleared (${l} mutation(s))`));let u=a.excludedWarning("quer(y/ies)");return u&&n.warnings.push(u),n},async previewItems(t,r){let o=t?.queries??[],a=r===void 0,n=a?Ta(e).queries:r?.queries??[],s=new Map(n.map(c=>[c.queryHash,c])),i=new Map(o.map(c=>[c.queryHash,c])),l=[],u=[];for(let c of o){let d=fr(c.queryKey,c.queryHash);if(ba(c.state.data)){l.push({key:c.queryHash,label:d,verdict:"wont-apply",reason:"data stayed on the device when this was captured (older Buoy) \u2014 re-capture this restore point"});continue}let h=s.get(c.queryHash);l.push(bu({key:c.queryHash,label:d,oldValue:h?hr(h):void 0,newValue:hr(c),inOld:h!==void 0,inNew:true},{tooLargeReason:"query data too large to render a diff \u2014 restore still applies it"}))}for(let c of n)i.has(c.queryHash)||l.push({key:c.queryHash,label:fr(c.queryKey,c.queryHash),verdict:"removed",oldValue:hr(c)});if(a){let c=e.getMutationCache().getAll().length;c>0&&u.push(`${c} in-memory mutation record(s) will be cleared`)}return{items:l,notes:u}}}}function Tu(e){return xu(qu(e))}function Mu(){let e;try{e=pu()}catch{e=null}return mu(()=>{if(e)return Tu(e)},[e]),gu(()=>e?Ca(e):null,[e])}function Ma({queryState:e,observerCount:t,isStale:r}){return e.fetchStatus==="fetching"?"blue":e.status==="error"?"red":t?e.fetchStatus==="paused"?"purple":r?"yellow":"green":"gray"}import{useQueryClient as Au}from"@tanstack/react-query";import{jsx as Ft,jsxs as Ae}from"react/jsx-runtime";function Aa(){try{let e=Au(),t=e.getQueryCache().getAll(),r=e.getMutationCache().getAll();return Ae(f,{style:J.container,children:[Ft(p,{style:J.title,children:"Debug Info"}),Ft(p,{style:J.info,children:"QueryClient: \u2705 Available"}),Ae(p,{style:J.info,children:["Queries: ",t.length]}),Ae(p,{style:J.info,children:["Mutations: ",r.length]}),t.length>0&&Ae(f,{style:J.queriesList,children:[Ft(p,{style:J.subtitle,children:"Query Keys:"}),t.slice(0,3).map((o,a)=>Ae(p,{style:J.queryKey,children:["\u2022"," ",Array.isArray(o.queryKey)?o.queryKey.join(" - "):String(o.queryKey)]},a)),t.length>3&&Ae(p,{style:J.more,children:["... and ",t.length-3," more"]})]})]})}catch(e){return Ae(f,{style:J.container,children:[Ft(p,{style:J.title,children:"Debug Info"}),Ae(p,{style:J.error,children:["\u274C QueryClient Error: ",String(e)]})]})}}var J=M.create({container:{padding:16,backgroundColor:"rgba(0, 0, 0, 0.3)",borderRadius:8,margin:16,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.1)"},title:{color:"#FFFFFF",fontSize:14,fontWeight:"600",marginBottom:8},subtitle:{color:"#E5E7EB",fontSize:12,fontWeight:"500",marginTop:8,marginBottom:4},info:{color:"#9CA3AF",fontSize:12,marginBottom:4},error:{color:"#EF4444",fontSize:12,marginBottom:4},queriesList:{marginTop:4},queryKey:{color:"#60A5FA",fontSize:11,marginLeft:8,marginBottom:2},more:{color:"#9CA3AF",fontSize:11,fontStyle:"italic",marginLeft:8}});import{jsx as De,jsxs as Je}from"react/jsx-runtime";function Du({queries:e,selectedQuery:t,isOpen:r,onClose:o,onSelect:a}){let n=s=>Array.isArray(s.queryKey)?s.queryKey.join(" - "):String(s.queryKey);return De(Ar,{accessibilityLabel:"Query selector",accessibilityHint:"View query selector","sentry-label":"ignore query selector",visible:r,transparent:true,animationType:"fade",onRequestClose:o,children:De(Mr,{accessibilityLabel:"Query selector overlay",accessibilityHint:"View query selector overlay","sentry-label":"ignore query selector overlay",style:K.modalOverlay,onPress:o,children:Je(f,{accessibilityLabel:"Query selector content",accessibilityHint:"View query selector content","sentry-label":"ignore query selector content",style:K.modalContent,children:[Je(f,{style:K.modalHeader,children:[De(p,{style:K.modalTitle,children:"Select Query"}),Je(p,{style:K.modalSubtitle,children:[e.length," ",e.length===1?"query":"queries"," ","available"]})]}),De(me,{accessibilityLabel:"Query selector scroll view",accessibilityHint:"View query selector scroll view","sentry-label":"ignore query selector scroll view",style:K.scrollView,contentContainerStyle:K.scrollViewContent,showsVerticalScrollIndicator:true,children:e.length===0?Je(f,{style:K.emptyState,children:[De(p,{style:K.emptyTitle,children:"No Queries Found"}),Je(p,{style:K.emptyDescription,children:["No React Query queries are currently active.",`
|
|
6
|
+
\u2022 Check console for debugging info`}}),contentContainerStyle:Ro.queryListContent})]})}var Ro=M.create({queryListContainer:{flex:1,backgroundColor:"transparent"},queryListContent:{padding:8,backgroundColor:"transparent",flexGrow:1}});import{ToolFooter as Bs,useSafeAreaInsets as Hs}from"@buoy-gg/shared-ui/web";import{jsx as ar}from"react/jsx-runtime";function Io({activeFilter:e,onFilterChange:t,isFloatingMode:r=true,size:o="default"}){let a=Hs({minBottom:16});return ar(Bs,{floating:r,safeArea:false,paddingBottom:r?0:a.bottom,style:ko.filterFooter,children:ar(f,{style:ko.filterContainer,children:ar(no,{activeFilter:e,onFilterChange:t,size:o})})})}var ko=M.create({filterFooter:{paddingTop:8,paddingHorizontal:0},filterContainer:{minHeight:32,justifyContent:"center"}});import{useMemo as nt}from"react";import{DynamicFilterView as Ws,buoyColors as qe}from"@buoy-gg/shared-ui/web";import{XCircle as Eo,Clock as nr,RefreshCw as js,Globe as Vs,Zap as $s,Filter as Ns,Eye as Us}from"@buoy-gg/shared-ui/web";import{jsx as _s}from"react/jsx-runtime";function Js({queries:e,activeFilter:t,onFilterChange:r,ignoredPatterns:o,onPatternToggle:a,includedPatterns:n,onIncludedPatternToggle:s}){let i=nt(()=>{let h={all:e.length,disabled:0,fresh:0,stale:0,fetching:0,paused:0,inactive:0,error:0};return e.forEach(g=>{let y=oe(g);y==="disabled"?h.disabled++:y==="error"?h.error++:y==="fresh"?h.fresh++:y==="stale"?h.stale++:y==="fetching"?h.fetching++:y==="paused"?h.paused++:y==="inactive"&&h.inactive++}),h},[e]),l=nt(()=>{let h=new Set;return e.forEach(g=>{if(!g?.queryKey)return;(Array.isArray(g.queryKey)?g.queryKey:[g.queryKey]).forEach(y=>{if(y!=null){let m=String(y);/^\d+$/.test(m)||h.add(m)}})}),Array.from(h).sort().slice(0,50)},[e]),u=nt(()=>l,[l]),c=nt(()=>{let h=e;return n.size>0&&(h=h.filter(g=>{if(!g?.queryKey)return false;let y=(Array.isArray(g.queryKey)?g.queryKey:[g.queryKey]).filter(m=>m!=null).map(m=>String(m)).join(" ").toLowerCase();return Array.from(n).some(m=>y.includes(m.toLowerCase()))})),o.size>0&&(h=h.filter(g=>{if(!g?.queryKey)return true;let y=(Array.isArray(g.queryKey)?g.queryKey:[g.queryKey]).filter(m=>m!=null).map(m=>String(m)).join(" ").toLowerCase();return!Array.from(o).some(m=>y.includes(m.toLowerCase()))})),h.length},[e,n,o]),d=nt(()=>({filterSummarySection:{enabled:true,totalCount:e.length,filteredCount:c,includePatterns:n,excludePatterns:o},sections:[{id:"status",title:"Status",type:"status",data:[{id:"status::all",label:"All",count:i.all,icon:Vs,color:qe.primary,isActive:!t||t==="all"},{id:"status::disabled",label:"Disabled",count:i.disabled,icon:Eo,color:qe.textMuted,isActive:t==="disabled"},{id:"status::fresh",label:"Fresh",count:i.fresh,icon:$s,color:qe.success,isActive:t==="fresh"},{id:"status::stale",label:"Stale",count:i.stale,icon:nr,color:qe.warning,isActive:t==="stale"},{id:"status::fetching",label:"Fetching",count:i.fetching,icon:js,color:qe.primary,isActive:t==="fetching"},{id:"status::paused",label:"Paused",count:i.paused,icon:nr,color:qe.textMuted,isActive:t==="paused"},{id:"status::inactive",label:"Inactive",count:i.inactive,icon:nr,color:qe.textSecondary,isActive:t==="inactive"},{id:"status::error",label:"Error",count:i.error,icon:Eo,color:qe.error,isActive:t==="error"}]}],addFilterSection:{enabled:true,placeholder:"Enter pattern to exclude...",title:"EXCLUDE FILTERS",icon:Ns},includeOnlySection:{enabled:true,title:"INCLUDE ONLY FILTERS",description:"Show ONLY queries matching these patterns. All non-matching queries will be hidden.",placeholder:"Enter pattern to include...",icon:Us,patterns:n,onPatternToggle:s,onPatternAdd:s},availableItemsSection:{enabled:true,title:"AVAILABLE QUERY KEYS",emptyMessage:"No queries found. Query keys will appear here once queries are active.",items:u},howItWorksSection:{enabled:true,title:"HOW QUERY FILTERS WORK",description:"There are two types of query key filters:",examples:["","INCLUDE ONLY (green):","\u2022 Shows ONLY queries matching the pattern","\u2022 Example: 'rewards' \u2192 shows only reward queries","\u2022 When active, non-matching queries are hidden","","EXCLUDE (blue):","\u2022 Hides queries matching the pattern","\u2022 Example: 'analytics' \u2192 hides analytics queries","","Filters are case-insensitive and match partial keys."]},activePatterns:o}),[i,t,o,n,u,s,e.length,c]);return _s(Ws,{...d,onFilterChange:h=>{let[g,y]=h.split("::");g==="status"?r(y==="all"||t===y?null:y):g==="suggestion"&&a(y)},onPatternToggle:a,onPatternAdd:a})}import{useState as it,useCallback as wt,useEffect as qt}from"react";import{devToolsStorageKeys as Ve,persistentStorage as Tt}from"@buoy-gg/shared-ui/web";import{jsx as de,jsxs as Gs}from"react/jsx-runtime";function Fo({visible:e,selectedQueryKey:t,onQuerySelect:r,onClose:o,onMinimize:a,activeFilter:n,onFilterChange:s,enableSharedModalDimensions:i=false,onTabChange:l,searchText:u="",onSearchChange:c}){let d=ja(),h=Cr(t),g=gt(),y=wt(()=>{d.getQueryCache().clear()},[d]),[m,C]=it(null),v=n??m,b=s??C,[x,S]=it(false),[w,A]=it(new Set),[Y,Qe]=it(new Set);qt(()=>{(async()=>{try{let q=await Tt.getItem(Ve.reactQuery.ignoredPatterns());if(q){let le=JSON.parse(q);Array.isArray(le)&&A(new Set(le))}}catch(q){console.error("Failed to load ignored patterns:",q)}})()},[]),qt(()=>{(async()=>{try{let q=await Tt.getItem(Ve.reactQuery.includedPatterns());if(q){let le=JSON.parse(q);Array.isArray(le)&&Qe(new Set(le))}}catch(q){console.error("Failed to load included patterns:",q)}})()},[]),qt(()=>{(async()=>{try{let q=Array.from(w);await Tt.setItem(Ve.reactQuery.ignoredPatterns(),JSON.stringify(q))}catch(q){console.error("Failed to save ignored patterns:",q)}})()},[w]),qt(()=>{(async()=>{try{let q=Array.from(Y);await Tt.setItem(Ve.reactQuery.includedPatterns(),JSON.stringify(q))}catch(q){console.error("Failed to save included patterns:",q)}})()},[Y]);let T=wt(q=>{A(le=>{let ue=new Set(le);return ue.has(q)?ue.delete(q):ue.add(q),ue})},[]),Ge=wt(q=>{Qe(le=>{let ue=new Set(le);return ue.has(q)?ue.delete(q):ue.add(q),ue})},[]),[ut,Ot]=it("bottomSheet"),he=i?Ve.reactQuery.modal():Ve.reactQuery.browserModal(),fe=wt(q=>{Ot(q)},[]),ct=$a({minBottom:16}),dt=ut==="floating"?56:48+ct.bottom;if(!e)return null;let zt=()=>{if(x){let q=[{key:"filters",label:"Filters"}];return Gs(Lt,{children:[de(Lt.Navigation,{onBack:()=>S(false)}),de(Lt.Content,{title:"",noMargin:true,children:de(Na,{tabs:q,activeTab:"filters",testIDPrefix:"buoy-rq-filterview-tab",onTabChange:()=>{}})})]})}return de(Xe,{selectedQuery:h,activeTab:"queries",onTabChange:l,onBack:()=>r(void 0),searchText:u,onSearchChange:c,onFilterPress:()=>S(true),hasActiveFilters:v!==null||w.size>0||Y.size>0,onClearCache:y})},Kt=de(Io,{activeFilter:v,onFilterChange:b,isFloatingMode:ut==="floating"});return de(Va,{visible:e,onClose:o,onMinimize:a,persistenceKey:he,header:{customContent:zt(),showToggleButton:true},onModeChange:fe,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,disableScrollWrapper:!x,styles:{},footer:x?void 0:Kt,footerHeight:x?void 0:dt,children:de(f,{style:Ys.container,children:x?de(Js,{queries:g,activeFilter:v,onFilterChange:b,ignoredPatterns:w,onPatternToggle:T,includedPatterns:Y,onIncludedPatternToggle:Ge}):de(Qo,{selectedQuery:h,onQuerySelect:r,activeFilter:v,searchText:u,ignoredPatterns:w,includedPatterns:Y,onFilterPress:()=>S(true)})})})}var Ys=M.create({container:{flex:1,backgroundColor:"transparent"}});import{JsModal as Xs,devToolsStorageKeys as Po,useSafeAreaInsets as Zs}from"@buoy-gg/shared-ui/web";import{useQueryClient as Oo}from"@tanstack/react-query";import{useSafeAreaInsets as zo,night as O,monoFont as Ko}from"@buoy-gg/shared-ui/web";import{useMemo as el}from"react";function ir(e,t,r){return el(()=>{let o=e.state.status;return[{label:"Refetch",variant:"refetch",disabled:oe(e)==="fetching",onPress:()=>Jt({query:e})},{label:e.state.fetchStatus==="fetching"?"Restore Loading":"Trigger Loading",variant:"triggerLoading",disabled:false,onPress:()=>_t({query:e})},{label:o==="error"?"Restore Error":"Trigger Error",variant:"triggerError",disabled:o==="pending",onPress:()=>Gt({query:e,queryClient:t})}]},[e,t,r])}import{DataViewer as tl}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as rl,jsx as R,jsxs as $e}from"react/jsx-runtime";function Lo({selectedQuery:e,isFloatingMode:t,disableInternalFooter:r=false,queryVersion:o}){let a=zo({minBottom:16}),n=Oo(),s=ir(e,n,o);return $e(rl,{children:[$e(me,{testID:"buoy-rq-detail-scroll",accessibilityLabel:"Data editor mode",accessibilityHint:"View data editor mode","sentry-label":"ignore data editor mode",style:I.explorerScrollContainer,contentContainerStyle:[I.explorerScrollContent,!r&&{paddingBottom:72}],children:[$e(f,{style:I.section,children:[R(al,{visible:!!e.state.data,selectedQuery:e,queryVersion:o}),R(nl,{visible:!e.state.data,selectedQuery:e})]}),R(f,{style:I.section,children:R(Nt,{query:e})}),R(f,{style:I.section,children:$e(f,{style:I.queryExplorerContainer,children:[R(p,{testID:"buoy-rq-query-explorer-header",style:I.queryExplorerHeader,children:"Query Explorer"}),R(f,{style:I.queryExplorerContent,children:R(tl,{title:"",data:e,maxDepth:10,rawMode:true,showTypeFilter:true,initialExpanded:false})})]})})]}),!r&&R(f,{style:[I.actionFooter,{paddingBottom:t?0:a.bottom+8}],children:R(f,{style:I.actionsRow,children:s.map((i,l)=>R(ne,{testID:`buoy-rq-action-${i.variant}`,onClick:i.onPress,text:i.label,variant:i.variant,disabled:i.disabled},l))})})]})}function ol({selectedQuery:e,isFloatingMode:t,queryVersion:r}){let o=zo({minBottom:16}),a=Oo(),n=ir(e,a,r);return R(f,{style:[I.actionFooter,{paddingBottom:t?0:o.bottom+8}],children:R(f,{style:I.actionsRow,children:n.map((s,i)=>R(ne,{testID:`buoy-rq-action-${s.variant}`,onClick:s.onPress,text:s.label,variant:s.variant,disabled:s.disabled},i))})})}function al({visible:e,selectedQuery:t,queryVersion:r=0}){return e?$e(f,{style:I.dataContainer,children:[R(p,{testID:"buoy-rq-data-header",style:I.dataHeader,children:"Data Editor"}),R(f,{style:I.dataContent,children:R(ce,{editable:true,label:"Data",value:t.state.data,defaultExpanded:["Data"],activeQuery:t,dataVersion:r})})]}):null}function nl({visible:e,selectedQuery:t}){if(!e)return null;let r=()=>t.isDisabled()?{title:"Query Disabled",description:"This query is disabled and won't automatically fetch. Enable the query or manually trigger a fetch to load data."}:t.state.status==="pending"||oe(t)==="fetching"?{title:t.state.status==="pending"?"Loading...":"Refetching...",description:"Please wait while the query is being executed."}:t.state.status==="error"?{title:"Query Error",description:t.state.error?.message||"An error occurred while fetching data."}:{title:"No Data Available",description:"This query has no data to edit. Try refetching the query first."},{title:o,description:a}=r();return $e(f,{style:I.emptyState,children:[R(p,{testID:"buoy-rq-detail-empty-title",style:I.emptyTitle,children:o}),R(p,{testID:"buoy-rq-detail-empty-description",style:I.emptyDescription,children:a})]})}var I=M.create({explorerScrollContainer:{flex:1},explorerScrollContent:{paddingBottom:16,paddingHorizontal:8,flexGrow:1},section:{marginBottom:16},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:O.color.text,fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},emptyDescription:{color:O.color.textSecondary,fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280},actionFooter:{borderTopWidth:1,borderTopColor:O.color.border,paddingTop:8,paddingHorizontal:12,backgroundColor:"transparent",borderBottomLeftRadius:14,borderBottomRightRadius:14},actionsRow:{flexDirection:"row",alignItems:"center",gap:8},queryExplorerContainer:{minWidth:200,backgroundColor:O.color.surface,borderRadius:6,borderWidth:1,borderColor:O.color.accent+"4D",overflow:"hidden",shadowColor:O.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},queryExplorerHeader:{backgroundColor:O.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:O.color.accent,borderBottomWidth:1,borderBottomColor:O.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:Ko},queryExplorerContent:{padding:8},dataContainer:{minWidth:200,backgroundColor:O.color.surface,borderRadius:6,borderWidth:1,borderColor:O.color.accent+"4D",overflow:"hidden",shadowColor:O.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6,marginTop:8},dataHeader:{backgroundColor:O.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:O.color.accent,borderBottomWidth:1,borderBottomColor:O.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:Ko},dataContent:{padding:8}});import{useState as il,useCallback as sl,useEffect as ll,useRef as ul}from"react";import{jsx as Mt}from"react/jsx-runtime";function Bo({visible:e,selectedQueryKey:t,onQuerySelect:r,onClose:o,onMinimize:a,enableSharedModalDimensions:n=false,onTabChange:s}){let{query:i,version:l}=Bt(t),[u,c]=il("bottomSheet"),d=t?JSON.stringify(t):void 0,h=ul(void 0);ll(()=>{if(i){h.current=d;return}e&&h.current!==void 0&&h.current===d&&(h.current=void 0,r(void 0))},[e,i,d,r]);let g=sl(x=>{c(x)},[]),y=Zs({minBottom:16}),m=u==="floating"?72:80+y.bottom,C=()=>Mt(Xe,{selectedQuery:i,activeTab:"queries",onTabChange:s,onBack:()=>r(void 0)}),v=n?Po.reactQuery.modal():`${Po.reactQuery.modal()}_data_editor`;if(!e||!i)return null;let b=Mt(ol,{selectedQuery:i,isFloatingMode:u==="floating",queryVersion:l},`footer-${l}`);return Mt(Xs,{visible:e,onClose:o,onMinimize:a,persistenceKey:v,header:{customContent:C(),showToggleButton:true},onModeChange:g,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},footer:b,footerHeight:m,children:Mt(Lo,{selectedQuery:i,isFloatingMode:u==="floating",disableInternalFooter:true,queryVersion:l})})}import{useQueryClient as cl}from"@tanstack/react-query";import{useCallback as sr,useState as Ho,useRef as Wo}from"react";import{useEffect as dl,useState as yl}from"react";import{useQueryClient as hl}from"@tanstack/react-query";function lr(e){let t=hl(),[r,o]=yl(void 0);return dl(()=>{let a=()=>{if(e!==void 0){let s=t.getMutationCache().getAll().find(i=>i.mutationId===e);o(s)}else o(void 0)};setTimeout(a,0);let n=t.getMutationCache().subscribe(a);return()=>n()},[t,e]),r}import{jsx as jo}from"react/jsx-runtime";function Vo({selectedMutation:e,onMutationSelect:t,activeFilter:r,searchText:o=""}){let a=n=>{t(typeof n=="function"?n(e):n)};return jo(f,{style:$o.mutationListContainer,children:jo(po,{selectedMutation:e,setSelectedMutation:a,activeFilter:r,searchText:o,hideInfoPanel:true,contentContainerStyle:$o.mutationListContent})})}var $o=M.create({mutationListContainer:{flex:1,backgroundColor:"transparent"},mutationListContent:{padding:8,backgroundColor:"transparent"}});import{ToolFooter as fl,useSafeAreaInsets as ml}from"@buoy-gg/shared-ui/web";import{useMemo as gl}from"react";import{jsx as ur}from"react/jsx-runtime";function No({activeFilter:e,onFilterChange:t,modalMode:r,size:o="default"}){let a=r==="floating",n=ml({minBottom:16}),s=gl(()=>a?0:n.bottom,[a,n.bottom]);return ur(fl,{floating:a,safeArea:false,paddingBottom:s,style:Uo.filterFooter,children:ur(f,{style:Uo.filterContainer,children:ur(bo,{activeFilter:e,onFilterChange:t,size:o})})},`footer-${a?"floating":"docked"}`)}var Uo=M.create({filterFooter:{paddingTop:8,paddingHorizontal:0},filterContainer:{minHeight:32,justifyContent:"center"}});import{JsModal as pl,useSafeAreaInsets as bl}from"@buoy-gg/shared-ui/web";import{absoluteFill as vl}from"@buoy-gg/shared-ui/web";import{useMemo as H}from"react";import{ChevronLeft as Sl,ChevronRight as Cl,night as At}from"@buoy-gg/shared-ui/web";import{jsx as Ne,jsxs as xl}from"react/jsx-runtime";var ze=32,_o=6,Jo=ze,wl=120,Dt=.95,Go=1.15;function Yo({translationX:e,maxTranslation:t=wl,canSwipeLeft:r=true,canSwipeRight:o=true}){let a=H(()=>e.interpolate({inputRange:[0,t],outputRange:[0,1],extrapolate:"clamp"}),[e,t]),n=H(()=>a.interpolate({inputRange:[0,1],outputRange:[_o,Jo]}),[a]),s=H(()=>a.interpolate({inputRange:[0,Dt,1],outputRange:[1,1,Go]}),[a]),i=H(()=>a.interpolate({inputRange:[0,.99,1],outputRange:[0,0,16]}),[a]),l=H(()=>a.interpolate({inputRange:[0,.01],outputRange:[0,1],extrapolate:"clamp"}),[a]),u=H(()=>a.interpolate({inputRange:[0,.5,1],outputRange:[0,0,1],extrapolate:"clamp"}),[a]),c=H(()=>a.interpolate({inputRange:[0,.5,Dt,1],outputRange:[.8,.8,1,1.2]}),[a]),d=H(()=>e.interpolate({inputRange:[-t,0],outputRange:[1,0],extrapolate:"clamp"}),[e,t]),h=H(()=>d.interpolate({inputRange:[0,1],outputRange:[_o,Jo]}),[d]),g=H(()=>d.interpolate({inputRange:[0,Dt,1],outputRange:[1,1,Go]}),[d]),y=H(()=>d.interpolate({inputRange:[0,.99,1],outputRange:[0,0,-16]}),[d]),m=H(()=>d.interpolate({inputRange:[0,.01],outputRange:[0,1],extrapolate:"clamp"}),[d]),C=H(()=>d.interpolate({inputRange:[0,.5,1],outputRange:[0,0,1],extrapolate:"clamp"}),[d]),v=H(()=>d.interpolate({inputRange:[0,.5,Dt,1],outputRange:[.8,.8,1,1.2]}),[d]);return xl(f,{style:cr.container,pointerEvents:"none",children:[o&&Ne(X.View,{style:[cr.leftWrapper,{width:n,height:ze,borderRadius:ze/2,backgroundColor:At.color.text+"E6",justifyContent:"center",alignItems:"center",opacity:l,transform:[{scale:s},{translateX:i}]}],children:Ne(X.View,{style:{opacity:u,transform:[{scale:c}]},children:Ne(Sl,{size:ze*.6,color:At.color.accent,strokeWidth:3})})}),r&&Ne(X.View,{style:[cr.rightWrapper,{width:h,height:ze,borderRadius:ze/2,backgroundColor:At.color.text+"E6",justifyContent:"center",alignItems:"center",opacity:m,transform:[{scale:g},{translateX:y}]}],children:Ne(X.View,{style:{opacity:C,transform:[{scale:v}]},children:Ne(Cl,{size:ze*.6,color:At.color.accent,strokeWidth:3})})})]})}var cr=M.create({container:{...vl,zIndex:1e3,justifyContent:"center",alignItems:"center"},leftWrapper:{position:"absolute",left:16},rightWrapper:{position:"absolute",right:16}});import{devToolsStorageKeys as Xo}from"@buoy-gg/shared-ui/web";import{jsx as Ue,jsxs as ql}from"react/jsx-runtime";function Zo({visible:e,selectedMutationId:t,onMutationSelect:r,onClose:o,onMinimize:a,activeFilter:n,onFilterChange:s,onTabChange:i,enableSharedModalDimensions:l=false,searchText:u="",onSearchChange:c}){let d=cl(),h=lr(t),[g,y]=Ho(null),m=n??g,C=s??y,v=sr(()=>{d.getMutationCache().clear(),r(void 0)},[d,r]),[b,x]=Ho("bottomSheet"),S=l?Xo.reactQuery.modal():Xo.reactQuery.mutationModal(),w=Wo(new X.Value(0)).current,A=sr(he=>{he==="right"&&i("queries")},[i]),Y=sr(he=>{x(he)},[]),Qe=bl({minBottom:16}),T=b==="floating"?56:48+Qe.bottom,Ge=Wo(Ht.create({onStartShouldSetPanResponder:()=>false,onMoveShouldSetPanResponder:(he,fe)=>Math.abs(fe.dx)>5&&Math.abs(fe.dy)<10,onPanResponderMove:(he,fe)=>{w.setValue(fe.dx)},onPanResponderRelease:(he,fe)=>{let{dx:ct,vx:dt}=fe,zt=80,Kt=.5;X.spring(w,{toValue:0,useNativeDriver:true}).start(),(Math.abs(ct)>zt||Math.abs(dt)>Kt)&&(ct>0||dt>0?A("right"):A("left"))},onPanResponderTerminate:()=>{X.spring(w,{toValue:0,useNativeDriver:true}).start()}})).current;if(!e)return null;let ut=()=>Ue(Xe,{selectedMutation:h,activeTab:"mutations",onTabChange:i,onBack:()=>r(void 0),searchText:u,onSearchChange:c,onClearCache:v}),Ot=Ue(No,{activeFilter:m,onFilterChange:C,modalMode:b});return Ue(pl,{visible:e,onClose:o,onMinimize:a,persistenceKey:S,header:{customContent:ut(),showToggleButton:true},onModeChange:Y,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},footer:Ot,footerHeight:T,children:Ue(f,{style:{flex:1},children:ql(f,{...Ge.panHandlers,style:{flex:1},children:[Ue(Yo,{translationX:w,canSwipeLeft:false,canSwipeRight:true}),Ue(Vo,{selectedMutation:h,onMutationSelect:r,activeFilter:m,searchText:u})]})})})}import{JsModal as Tl,useSafeAreaInsets as Ml,devToolsStorageKeys as ea}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as Al,night as z,monoFont as ta}from"@buoy-gg/shared-ui/web";import{useMemo as Dl}from"react";import{useQueryClient as Ql}from"@tanstack/react-query";function ra(e){let t=Ql();return Dl(()=>[{label:"Remove",variant:"remove",disabled:false,onPress:()=>t.getMutationCache().remove(e)}],[e,t])}import{DataViewer as Rl}from"@buoy-gg/shared-ui/web/dataViewer";import{Fragment as Il,jsx as k,jsxs as _e}from"react/jsx-runtime";function oa({selectedMutation:e,isFloatingMode:t,disableInternalFooter:r=false}){return _e(Il,{children:[_e(me,{testID:"buoy-rq-mutation-detail-scroll",accessibilityLabel:"Mutation editor mode",accessibilityHint:"View mutation editor mode","sentry-label":"ignore mutation editor mode",style:F.explorerScrollContainer,contentContainerStyle:F.explorerScrollContent,children:[_e(f,{style:F.section,children:[k(kl,{visible:!!e.state.data,selectedMutation:e}),k(El,{visible:!e.state.data,selectedMutation:e})]}),k(f,{style:F.section,children:k(rr,{selectedMutation:e})}),k(f,{style:F.section,children:_e(f,{style:F.mutationExplorerContainer,children:[k(p,{style:F.mutationExplorerHeader,children:"Mutation Explorer"}),k(f,{style:F.mutationExplorerContent,children:k(Rl,{title:"",data:e,maxDepth:10,rawMode:true,showTypeFilter:true,initialExpanded:false})})]})})]}),!r&&k(aa,{selectedMutation:e,isFloatingMode:t})]})}function aa({selectedMutation:e,isFloatingMode:t}){let r=Al({minBottom:16}),o=ra(e);return k(f,{style:[F.actionFooter,{paddingBottom:t?0:r.bottom+8}],children:k(f,{style:F.actionsGrid,children:o.map((a,n)=>k(ne,{testID:`buoy-rq-action-${a.variant}`,onClick:a.onPress,text:a.label,variant:a.variant,disabled:a.disabled},n))})})}function kl({visible:e,selectedMutation:t}){return e?_e(f,{style:F.dataContainer,children:[k(p,{style:F.dataHeader,children:"Data Editor"}),k(f,{style:F.dataContent,children:k(ce,{editable:true,label:"Data",value:t.state.data,defaultExpanded:["Data"]},t.mutationId)})]}):null}function El({visible:e,selectedMutation:t}){if(!e)return null;let r=()=>t.state.status==="pending"?{title:"Pending...",description:"The mutation is in progress."}:t.state.status==="error"?{title:"Mutation Error",description:t.state.error?.message||"An error occurred."}:{title:"No Data Available",description:"This mutation has no data."},{title:o,description:a}=r();return _e(f,{style:F.emptyState,children:[k(p,{testID:"buoy-rq-mutation-detail-empty-title",style:F.emptyTitle,children:o}),k(p,{testID:"buoy-rq-mutation-detail-empty-description",style:F.emptyDescription,children:a})]})}var F=M.create({explorerScrollContainer:{flex:1},explorerScrollContent:{paddingBottom:16,paddingHorizontal:8,flexGrow:1},section:{marginBottom:16},emptyState:{flex:1,justifyContent:"center",alignItems:"center",padding:32},emptyTitle:{color:z.color.text,fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},emptyDescription:{color:z.color.textSecondary,fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280},actionFooter:{borderTopWidth:1,borderTopColor:z.color.border,paddingVertical:8,paddingHorizontal:12,backgroundColor:"transparent",borderBottomLeftRadius:14,borderBottomRightRadius:14},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,justifyContent:"space-between"},mutationExplorerContainer:{minWidth:200,backgroundColor:z.color.surface,borderRadius:6,borderWidth:1,borderColor:z.color.accent+"4D",overflow:"hidden",shadowColor:z.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},mutationExplorerHeader:{backgroundColor:z.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:z.color.accent,borderBottomWidth:1,borderBottomColor:z.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:ta},mutationExplorerContent:{padding:8},dataContainer:{minWidth:200,backgroundColor:z.color.surface,borderRadius:6,borderWidth:1,borderColor:z.color.accent+"4D",overflow:"hidden",shadowColor:z.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},dataHeader:{backgroundColor:z.color.accent+"1A",paddingHorizontal:12,paddingVertical:10,fontWeight:"600",fontSize:12,color:z.color.accent,borderBottomWidth:1,borderBottomColor:z.color.accent+"33",letterSpacing:.5,textTransform:"uppercase",fontFamily:ta},dataContent:{padding:8}});import{useState as Fl,useCallback as Pl,useEffect as Ol,useRef as zl}from"react";import{jsx as Qt}from"react/jsx-runtime";function na({visible:e,selectedMutationId:t,onMutationSelect:r,onClose:o,onMinimize:a,onTabChange:n,enableSharedModalDimensions:s=false}){let i=lr(t),[l,u]=Fl("bottomSheet"),c=zl(void 0);Ol(()=>{if(i){c.current=i.mutationId;return}e&&c.current!==void 0&&c.current===t&&(c.current=void 0,r(void 0))},[e,i,t,r]);let d=Pl(v=>{u(v)},[]),h=Ml({minBottom:16}),g=l==="floating"?72:80+h.bottom,y=()=>Qt(Xe,{selectedMutation:i,activeTab:"mutations",onTabChange:n,onBack:()=>r(void 0)}),m=s?ea.reactQuery.modal():ea.reactQuery.mutationModal();if(!e||!i)return null;let C=Qt(aa,{selectedMutation:i,isFloatingMode:l==="floating"});return Qt(Tl,{visible:e,onClose:o,onMinimize:a,persistenceKey:m,header:{customContent:y(),showToggleButton:true},onModeChange:d,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},footer:C,footerHeight:g,children:Qt(oa,{selectedMutation:i,isFloatingMode:l==="floating",disableInternalFooter:true})})}import{Fragment as Kl,jsx as Rt,jsxs as Ll}from"react/jsx-runtime";function ia({visible:e,selectedQueryKey:t,selectedMutationId:r,onQuerySelect:o,onMutationSelect:a,onClose:n,onMinimize:s,activeFilter:i,onFilterChange:l,activeTab:u,onTabChange:c,enableSharedModalDimensions:d=false,searchText:h="",onSearchChange:g}){let y=!!t||!!r,m=u==="queries",C=u==="mutations",v={onClose:n,onMinimize:s,activeFilter:i,onFilterChange:l,enableSharedModalDimensions:d},b=e&&!y&&m,x=e&&!y&&C,S=e&&y&&m&&!!t,w=e&&y&&C&&!!r;return Ll(Kl,{children:[Rt(Fo,{visible:b,selectedQueryKey:t,onQuerySelect:o,onTabChange:c,searchText:h,onSearchChange:g,...v}),Rt(Zo,{visible:x,selectedMutationId:r,onMutationSelect:a,onTabChange:c,searchText:h,onSearchChange:g,...v}),Rt(Bo,{visible:S,selectedQueryKey:t,onQuerySelect:o,onTabChange:c,...v}),Rt(na,{visible:w,selectedMutationId:r,onMutationSelect:a,onTabChange:c,...v})]})}import{ChangeLog as Bl}from"@buoy-gg/shared-ui/web";var Hl=0;function Te(){return`rq-${Date.now()}-${++Hl}`}var Wl=class extends Bl{constructor(){super({max:200});this.queryClient=null;this.queryUnsubscribe=null;this.mutationUnsubscribe=null;this.fetchStartTimes=new Map;this.mutationStartTimes=new Map;this.lastQueryStates=new Map;this.lastMutationStates=new Map}setQueryClient(e){this.disconnect(),this.queryClient=e,this.queryUnsubscribe=e.getQueryCache().subscribe(t=>{t.type==="updated"&&t.query&&this.handleQueryUpdate(t.query)}),this.mutationUnsubscribe=e.getMutationCache().subscribe(t=>{t.type==="updated"&&t.mutation&&this.handleMutationUpdate(t.mutation)})}disconnect(){this.queryUnsubscribe&&(this.queryUnsubscribe(),this.queryUnsubscribe=null),this.mutationUnsubscribe&&(this.mutationUnsubscribe(),this.mutationUnsubscribe=null),this.queryClient=null,this.lastQueryStates.clear(),this.lastMutationStates.clear(),this.fetchStartTimes.clear(),this.mutationStartTimes.clear()}handleQueryUpdate(e){if(pe(e.queryKey))return;let t=e.queryHash,r={fetchStatus:e.state.fetchStatus,status:e.state.status},o=this.lastQueryStates.get(t);if(!o)r.fetchStatus==="fetching"&&(this.fetchStartTimes.set(t,Date.now()),this.addEvent({id:Te(),type:"query-fetch-start",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,query:e}));else{let a=o.fetchStatus==="fetching",n=r.fetchStatus==="fetching";if(!a&&n&&(this.fetchStartTimes.set(t,Date.now()),this.addEvent({id:Te(),type:"query-fetch-start",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,query:e})),a&&!n){let s=this.fetchStartTimes.get(t),i=s?Date.now()-s:void 0;this.fetchStartTimes.delete(t),r.status==="error"?this.addEvent({id:Te(),type:"query-fetch-error",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,queryError:e.state.error,duration:i,query:e}):this.addEvent({id:Te(),type:"query-fetch-success",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,queryData:e.state.data,duration:i,query:e})}!o.status&&e.state.isInvalidated&&this.addEvent({id:Te(),type:"query-invalidated",timestamp:Date.now(),queryKey:e.queryKey,queryHash:t,query:e})}this.lastQueryStates.set(t,r)}handleMutationUpdate(e){let t=e.mutationId,r=e.state.status,o=this.lastMutationStates.get(t);if(o!==r){if(r==="pending"&&o!=="pending")this.mutationStartTimes.set(t,Date.now()),this.addEvent({id:Te(),type:"mutation-start",timestamp:Date.now(),mutationId:t,mutationKey:e.options.mutationKey,mutationVariables:e.state.variables,mutation:e});else if(r==="success"&&o==="pending"){let a=this.mutationStartTimes.get(t),n=a?Date.now()-a:void 0;this.mutationStartTimes.delete(t),this.addEvent({id:Te(),type:"mutation-success",timestamp:Date.now(),mutationId:t,mutationKey:e.options.mutationKey,mutationVariables:e.state.variables,mutationData:e.state.data,duration:n,mutation:e})}else if(r==="error"&&o==="pending"){let a=this.mutationStartTimes.get(t),n=a?Date.now()-a:void 0;this.mutationStartTimes.delete(t),this.addEvent({id:Te(),type:"mutation-error",timestamp:Date.now(),mutationId:t,mutationKey:e.options.mutationKey,mutationVariables:e.state.variables,mutationError:e.state.error,duration:n,mutation:e})}}this.lastMutationStates.set(t,r)}addEvent(e){this.record(e)}getEvents(){return this.items}subscribe(e){let t=super.subscribe(e);return e(this.items),t}clearEvents(){this.clear()}isConnected(){return this.queryClient!==null}},Ke=new Wl,jl=e=>Ke.setQueryClient(e),Vl=()=>Ke.disconnect();import{jsx as sa}from"react/jsx-runtime";function dr({visible:e,onClose:t,onMinimize:r,enableSharedModalDimensions:o=true}){let a=Ha();Ba(()=>{Ke.isConnected()||Ke.setQueryClient(a)},[a]);let[n,s]=Ye(void 0),[i,l]=Ye(void 0),[u,c]=Ye(null),[d,h]=Ye("queries"),[g,y]=Ye(""),m=Re(()=>{s(void 0),l(void 0),c(null),h("queries"),y("")},[]),C=Re(()=>{m(),t()},[t,m]),v=Re(A=>{s(A?.queryKey)},[]),b=Re(A=>{l(A?.mutationId)},[]),x=Re(A=>{c(A)},[]),S=Re(A=>{h(A),c(null),s(void 0),l(void 0),y("")},[]),w=Re(A=>{y(A)},[]);return e?sa(Wa,{children:sa(ia,{visible:e,selectedQueryKey:n,selectedMutationId:i,onQuerySelect:v,onMutationSelect:b,onClose:C,onMinimize:r,activeFilter:u,onFilterChange:x,activeTab:d,onTabChange:S,searchText:g,onSearchChange:w,enableSharedModalDimensions:o})}):null}import{onlineManager as ye}from"@tanstack/react-query";import{devToolsStorageKeys as la,persistentStorage as ua}from"@buoy-gg/shared-ui/web";import{useState as ca,useEffect as da}from"react";import{jsx as It}from"react/jsx-runtime";var ya=()=>null,ha=async e=>{try{await ua.setItem(la.settings.wifiEnabled(),e.toString())}catch{}},$l=async()=>{try{let e=await ua.getItem(la.settings.wifiEnabled());e!==null&&ye.setOnline(e==="true")}catch{}};$l();function Nl({size:e}){let[t,r]=ca(()=>ye.isOnline());return da(()=>ye.subscribe(o=>{r(o)}),[]),It(Sr,{size:e,color:t?"#10B981":"#DC2626"})}var Ul={id:"query",name:"QUERY",description:"React Query inspector",slot:"both",icon:({size:e})=>It(vr,{size:e}),component:dr,props:{enableSharedModalDimensions:false}};function _l(e){return{id:e?.id||"query",name:e?.name||"QUERY",description:e?.description||"React Query inspector",slot:"both",icon:({size:t})=>It(vr,{size:t}),component:dr,props:{enableSharedModalDimensions:e?.enableSharedModalDimensions!==void 0?e.enableSharedModalDimensions:false}}}var Jl={id:"query-wifi-toggle",name:"WIFI",description:"Toggle React Query online/offline state",slot:"row",icon:Nl,component:ya,props:{},launchMode:"toggle-only",onPress:()=>{let e=!ye.isOnline();ye.setOnline(e),ha(e)}};function Gl(e){let t=e?.onColor||"#10B981",r=e?.offColor||"#DC2626",o=({size:a})=>{let[n,s]=ca(()=>ye.isOnline());return da(()=>ye.subscribe(i=>{s(i)}),[]),It(Sr,{size:a,color:n?t:r})};return{id:e?.id||"query-wifi-toggle",name:e?.name||"WIFI",description:e?.description||"Toggle React Query online/offline state",slot:"row",icon:o,component:ya,props:{},launchMode:"toggle-only",onPress:()=>{let a=!ye.isOnline();ye.setOnline(a),ha(a)}}}import{expandKeyedArrays as Yl,patchFromPath as Xl,readPath as Zl,refusalText as eu,shapeSummary as kt,suggestedPatch as tu,typedEditViolations as ru,unshapedLists as ou}from"@buoy-gg/shared-ui/web";import{onlineManager as yr}from"@tanstack/react-query";import{isJsonSerializable as fa,isOverWireBudget as ma}from"@buoy-gg/shared-ui/web";var au=Object.freeze({__buoyDataOnDevice:true,note:"Query data stays on the device \u2014 fetched on demand via getQueryData."}),ga=Object.freeze({__buoyUnserializable:true,note:"Query data is not JSON-serializable (circular or bigint) and stayed on the device."}),nu=16*1024,pa=8*1024*1024;function iu(e){return!!e&&typeof e=="object"&&e.__buoyDataOnDevice===true}function su(e){return!!e&&typeof e=="object"&&e.__buoyUnserializable===true}function ba(e){return iu(e)||su(e)}function Me(e){if(e!==void 0)return ma(e,nu)?fa(e)?au:ga:e}function Et(e){if(e==null)return e;if(typeof e=="object"){let t=e,r=typeof t.name=="string"?t.name:void 0,o=typeof t.message=="string"?t.message:void 0;if(r!==void 0||o!==void 0)return Me({...r!==void 0?{name:r}:{},...o!==void 0?{message:o}:{}})}return Me(e)}function lu(e){return ma(e,pa)?fa(e)?{__buoyTruncated:true,note:`Exceeds the ${pa/(1024*1024)}MB detail limit \u2014 inspect it on-device.`}:ga:e}function uu(e){let t=e.getMutationCache().getAll().map(o=>cu(o)),r=e.getQueryCache().getAll().map(o=>yu(o));return{mutations:t,queries:r}}function cu(e){let t=e.state;return{mutationId:e.mutationId,mutationKey:e.options.mutationKey,state:{...t,data:Me(t.data),variables:Me(t.variables),error:Et(t.error),failureReason:Et(t.failureReason)},...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:Me(e.meta)}}}function du(e){let{queryFn:t,select:r,persister:o,initialData:a,placeholderData:n,...s}=e;return{...s,queryFn:void 0,...e.meta?{meta:Me(e.meta)}:{}}}function yu(e){let t=e.observers.map(r=>({queryHash:e.queryHash,options:du(r.options)}));return{state:{...e.state,...e.state.data!==void 0&&{data:Me(e.state.data)},error:Et(e.state.error),fetchFailureReason:Et(e.state.fetchFailureReason)},queryKey:e.queryKey,queryHash:e.queryHash,...e.meta&&{meta:Me(e.meta)},observers:t}}function hu(e,t){let r=e;for(let o of t.split(".")){if(!r||typeof r!="object"||Array.isArray(r)||!(o in r))return false;r=r[o]}return Array.isArray(r)?r.length>0:!!r&&typeof r=="object"}var st=e=>!!e&&typeof e=="object"&&!Array.isArray(e);function va(e){return Array.isArray(e)?"array":e===null?"null":typeof e=="object"?"object":typeof e}function Sa(e,t,r="",o={shrunk:[],breaks:[]}){if(Array.isArray(e)&&Array.isArray(t))return t.length>0&&t.length<e.length&&o.shrunk.push({path:r||"(root)",have:e.length,sent:t.length}),t;if(!st(e)||!st(t))return t;let a={...e};for(let[n,s]of Object.entries(t)){let i=r?`${r}.${n}`:n;if(n in e){let l=va(e[n]),u=va(s);(l==="array"||l==="object")&&l!==u&&o.breaks.push({path:i,from:l,to:u}),a[n]=Sa(e[n],s,i,o)}else a[n]=s}return a}function fu(e){let t=e.trim();try{let r=JSON.parse(t);if(Array.isArray(r))return r.map(o=>typeof o=="object"&&o!==null?JSON.stringify(o):String(o))}catch{}return t.includes(",")&&!t.startsWith("[")?t.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")):null}function mu(e){let t;for(let r of e.observers??[]){let o=r.options?.refetchInterval,a=o;if(typeof o=="function")try{a=o(e)}catch{a=void 0}typeof a=="number"&&a>0&&(t=t===void 0?a:Math.min(t,a))}return t}function Ca(e){let t=r=>{let{queryHash:o}=r,a=e.getQueryCache(),n=o?a.get(o):void 0;if(!n&&typeof o=="string"){let s=fu(o);s&&(n=a.getAll().find(i=>{let l=i.queryKey.map(u=>typeof u=="object"?JSON.stringify(u):String(u));return l.length===s.length&&l.every((u,c)=>u===s[c])}))}if(!n)throw new Error(`Query with hash "${o}" not found`);return n};return{version:2,getSnapshot:()=>({dehydratedState:uu(e),isOnlineManagerOnline:yr.isOnline()}),subscribe:r=>{let o=e.getQueryCache().subscribe(r),a=e.getMutationCache().subscribe(r),n=yr.subscribe(r);return()=>{o(),a(),n()}},actions:{getQueryData:r=>{let{queryHash:o,path:a}=r??{};if(!o)return{found:false,reason:"missing queryHash"};let n=e.getQueryCache().get(o);if(!n)return{found:false,reason:"unknown queryHash"};if(a){let i=Zl(n.state.data,a);return i.ok?{found:true,queryHash:o,path:a,shape:kt(i.value),data:i.value}:{found:false,reason:i.error}}if(n.state.data===void 0){let i=n.state.status,l=n.state.error;return{found:true,queryHash:o,hasData:false,status:i,fetchStatus:n.state.fetchStatus,...l?{error:l instanceof Error?l.message:String(l)}:{},reason:i==="error"?"This query has no data because it FAILED. Report the error, not an empty result.":n.state.fetchStatus==="fetching"?"No data yet \u2014 this query is still fetching.":"This query has never resolved (it may be disabled, or never enabled). It is not empty \u2014 it has nothing."}}let s=kt(n.state.data);return{found:true,queryHash:o,hasData:true,...s?{shape:s}:{},data:lu(n.state.data)}},listQueries:r=>{let{includeData:o=false,staleOnly:a=false,limit:n}=r??{},s=e.getQueryCache().getAll(),i=[...a?s.filter(u=>u.isStale()):s].sort((u,c)=>{let d=+(c.getObserversCount()>0)-+(u.getObserversCount()>0);return d!==0?d:(c.state.dataUpdatedAt??0)-(u.state.dataUpdatedAt??0)}),l=(typeof n=="number"&&n>0?i.slice(0,n):i).map(u=>{let c=u.state.error,d=mu(u);return{queryHash:u.queryHash,queryKey:u.queryKey,status:oe(u),fetchStatus:u.state.fetchStatus,isStale:u.isStale(),observers:u.getObserversCount(),updatedAt:u.state.dataUpdatedAt,...d?{refetchEveryMs:d}:{},error:c?c.message??String(c):void 0,...o?{data:u.state.data}:{},...kt(u.state.data)?{shape:kt(u.state.data)}:{}}});return{queries:l,total:s.length,returned:l.length,includedData:o}},refetch:r=>t(r).fetch().catch(()=>{}),invalidate:r=>e.invalidateQueries(t(r)),reset:r=>e.resetQueries(t(r)),remove:r=>{let o=t(r),a=e.getQueryCache().findAll(o).some(n=>n.getObserversCount()>0);return e.removeQueries(o),{ok:true,...a?{note:"Removed \u2014 but a screen is still watching this query, and React Query leaves that screen rendering its LAST value (including anything written into the cache before this) until something refetches. Nothing on screen will change on its own. Use `reset` instead when you want the screen to go back to loading and fetch again."}:{}}},setQueryData:r=>{let{data:o,merge:a,force:n,path:s,value:i}=r,{queryKey:l,queryHash:u}=r,c=l;if(c===void 0&&typeof u=="string"){let y=e.getQueryCache().get(u);if(!y)return{ok:false,error:`Refused: no query with hash ${u} is in the cache. Read listQueries for the current hashes \u2014 a query that has been removed or whose key includes changing params (a search term, a cart payload) will not match an older hash.`};c=y.queryKey}if(c===void 0)return{ok:false,error:"Refused: no query was named. Send `queryKey` (the array from listQueries) or `queryHash` (its string form)."};let d=e.getQueryData(c),h=e.getQueryCache().find({queryKey:c,exact:true});if(d===void 0&&h&&(o!==void 0||s!==void 0)){let y=h,m=y?.state.status;return{ok:false,error:`Refused: this query has no data to edit \u2014 ${m==="error"?`it FAILED${y?.state.error?` (${y.state.error instanceof Error?y.state.error.message:String(y.state.error)})`:""}`:m==="pending"?"it has never resolved (it may be disabled, or still loading)":"it holds no data"}. There is nothing to merge into. Fix the cause first (restoreError, or let it fetch), or send force:true with the COMPLETE value if you mean to seed the cache from nothing.`,status:m}}if(o===void 0&&s===void 0)return{ok:false,error:"Refused: no change was described. Send `data` (with merge:true for a partial edit), or `path` and `value` to set one value."};let g=o;if(s!==void 0){if(i===void 0)return{ok:false,error:`Refused: sent \`path\` without \`value\`. Say what to set "${s}" to; if you mean to clear it, send value:null and the field must already be nullable.`};let y=Xl(d,s,i);if(!y.ok)return{ok:false,error:`Refused: ${y.error}`};g=y.patch}if(a||s!==void 0){let y=n?{patch:g,notes:[],error:void 0}:Yl(d,g);if(y.error)return{ok:false,error:`Refused: ${y.error}`};let m=y.patch;if(!n){let b=ru(d,m,{noun:"data"});if(b.length>0){let x=tu(m,b);return{ok:false,error:eu(b,"data",x),violations:b,...x?{suggestedData:x}:{}}}}let C=Sa(d,m),v=ou(d).filter(b=>hu(m,b));return e.setQueryData(c,C,{updatedAt:Date.now()}),{ok:true,mode:"merge",...s!==void 0?{path:s}:{},changedKeys:st(m)?Object.keys(m):void 0,...y.notes.length?{keyed:y.notes}:{},...v.length?{unchecked:v.map(b=>`\`${b}\` 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 screen renders a field you left out, it will render undefined \u2014 read the query back and compare against how the screen uses it.`)}:{}}}if(!n&&st(d)&&st(o)){let y=Object.keys(d).filter(m=>!(m in o));if(y.length>0)return{ok:false,error:`Refused: the new value drops ${y.length} top-level field(s) the cached value has (${y.slice(0,8).join(", ")}${y.length>8?", \u2026":""}). A screen rendering those fields would crash. To change some fields, send merge:true with ONLY the fields that change. To really replace the whole value, send force:true.`,missingKeys:y}}return e.setQueryData(c,o,{updatedAt:Date.now()}),{ok:true,mode:"replace"}},triggerError:r=>{let o=t(r),a=o.options;o.setState({status:"error",error:new Error("Unknown error from devtools"),fetchMeta:{...o.state.fetchMeta,__previousQueryOptions:a}})},restoreError:r=>e.resetQueries(t(r)),triggerLoading:r=>{let o=t(r),a=o.options;o.fetch({...a,queryFn:()=>new Promise(()=>{}),gcTime:-1}).catch(()=>{}),o.setState({data:void 0,status:"pending",fetchMeta:{...o.state.fetchMeta,__previousQueryOptions:a}})},restoreLoading:r=>{let o=t(r),a=o.state,n=o.state.fetchMeta?o.state.fetchMeta.__previousQueryOptions:null;o.cancel({silent:true}),o.setState({...a,fetchStatus:"idle",fetchMeta:null}),n&&o.fetch(n).catch(()=>{})},clearQueryCache:()=>{let r=e.getQueryCache().getAll().filter(o=>o.getObserversCount()>0).length;return e.getQueryCache().clear(),{ok:true,cleared:true,...r?{note:`Cleared \u2014 but ${r} quer${r===1?"y is":"ies are"} still being watched by a screen, and React Query leaves those screens rendering their LAST value until something refetches. The cache is empty; the app on screen is not. Use \`reset\` on a query when you want its screen to reload.`}:{}}},clearMutationCache:()=>{e.getMutationCache().clear()},setOnline:r=>{let{online:o}=r;yr.setOnline(o)}}}}import{useEffect as gu,useMemo as pu}from"react";import{useQueryClient as bu}from"@tanstack/react-query";import{classifyPreviewItem as vu,createRestoreScope as Su,emptyRestoreResult as Cu,failedRestore as xu,registerStateSnapshotProvider as wu,superJsonSerialize as qu}from"@buoy-gg/shared-ui/web";function xa(e){return{...e,fetchStatus:"idle",fetchMeta:null}}function hr(e){return{status:e.state.status,error:e.state.error??null,data:e.state.data}}function fr(e,t){try{let r=JSON.stringify(e);return r.length>60?`${r.slice(0,57)}\u2026`:r}catch{return t}}function wa(e){if(e==null)return e??null;if(typeof e=="object"){let t=e,r=typeof t.name=="string"?t.name:void 0,o=typeof t.message=="string"?t.message:void 0;if(r!==void 0||o!==void 0)return{...r!==void 0?{name:r}:{},...o!==void 0?{message:o}:{}}}return e}function qa(e){if(e===void 0)return true;try{return qu(e),true}catch{return false}}function Ta(e){let t=[],r=[];for(let o of e.getQueryCache().getAll()){let a=fr(o.queryKey,o.queryHash);if(!qa(o.state.data)){t.push(`query ${a}: data can't be serialized (circular reference?) \u2014 not captured`);continue}r.push({queryKey:o.queryKey,queryHash:o.queryHash,...o.meta&&qa(o.meta)?{meta:o.meta}:{},state:xa({...o.state,error:wa(o.state.error),fetchFailureReason:wa(o.state.fetchFailureReason)})})}return{queries:r,warnings:t}}function Tu(e){return{id:"query",label:"React Query",status:()=>({canCapture:true,canRestore:true}),async capture(){let{queries:t,warnings:r}=Ta(e),o=e.getMutationCache().getAll().length;return o>0&&r.push(`${o} mutation(s) not captured (mutation functions cannot be restored)`),{data:{queries:t},warnings:r}},async restore(t,r){let o=t,a=Su(r),n=Cu();if(!o?.queries)return xu("empty query snapshot");let s=e.getQueryCache(),i=new Set(o.queries.map(c=>c.queryHash));for(let c of o.queries)if(a.allows(c.queryHash)){if(ba(c.state.data)){n.skipped.push({id:c.queryHash,reason:"captured as an on-device placeholder by an older Buoy \u2014 re-capture this restore point"});continue}try{let d=xa(c.state),h=s.get(c.queryHash);h?h.setState(d):s.build(e,{queryKey:c.queryKey,queryHash:c.queryHash,...c.meta&&{meta:c.meta}},d),n.applied+=1}catch(d){n.skipped.push({id:c.queryHash,reason:String(d)}),n.ok=false}}for(let c of s.getAll().slice())if(a.allows(c.queryHash)&&!i.has(c.queryHash))try{s.remove(c),n.applied+=1}catch(d){n.skipped.push({id:c.queryHash,reason:String(d)})}let l=e.getMutationCache().getAll().length;l>0&&(e.getMutationCache().clear(),n.warnings.push(`mutation cache cleared (${l} mutation(s))`));let u=a.excludedWarning("quer(y/ies)");return u&&n.warnings.push(u),n},async previewItems(t,r){let o=t?.queries??[],a=r===void 0,n=a?Ta(e).queries:r?.queries??[],s=new Map(n.map(c=>[c.queryHash,c])),i=new Map(o.map(c=>[c.queryHash,c])),l=[],u=[];for(let c of o){let d=fr(c.queryKey,c.queryHash);if(ba(c.state.data)){l.push({key:c.queryHash,label:d,verdict:"wont-apply",reason:"data stayed on the device when this was captured (older Buoy) \u2014 re-capture this restore point"});continue}let h=s.get(c.queryHash);l.push(vu({key:c.queryHash,label:d,oldValue:h?hr(h):void 0,newValue:hr(c),inOld:h!==void 0,inNew:true},{tooLargeReason:"query data too large to render a diff \u2014 restore still applies it"}))}for(let c of n)i.has(c.queryHash)||l.push({key:c.queryHash,label:fr(c.queryKey,c.queryHash),verdict:"removed",oldValue:hr(c)});if(a){let c=e.getMutationCache().getAll().length;c>0&&u.push(`${c} in-memory mutation record(s) will be cleared`)}return{items:l,notes:u}}}}function Mu(e){return wu(Tu(e))}function Au(){let e;try{e=bu()}catch{e=null}return gu(()=>{if(e)return Mu(e)},[e]),pu(()=>e?Ca(e):null,[e])}function Ma({queryState:e,observerCount:t,isStale:r}){return e.fetchStatus==="fetching"?"blue":e.status==="error"?"red":t?e.fetchStatus==="paused"?"purple":r?"yellow":"green":"gray"}import{useQueryClient as Du}from"@tanstack/react-query";import{jsx as Ft,jsxs as Ae}from"react/jsx-runtime";function Aa(){try{let e=Du(),t=e.getQueryCache().getAll(),r=e.getMutationCache().getAll();return Ae(f,{style:J.container,children:[Ft(p,{style:J.title,children:"Debug Info"}),Ft(p,{style:J.info,children:"QueryClient: \u2705 Available"}),Ae(p,{style:J.info,children:["Queries: ",t.length]}),Ae(p,{style:J.info,children:["Mutations: ",r.length]}),t.length>0&&Ae(f,{style:J.queriesList,children:[Ft(p,{style:J.subtitle,children:"Query Keys:"}),t.slice(0,3).map((o,a)=>Ae(p,{style:J.queryKey,children:["\u2022"," ",Array.isArray(o.queryKey)?o.queryKey.join(" - "):String(o.queryKey)]},a)),t.length>3&&Ae(p,{style:J.more,children:["... and ",t.length-3," more"]})]})]})}catch(e){return Ae(f,{style:J.container,children:[Ft(p,{style:J.title,children:"Debug Info"}),Ae(p,{style:J.error,children:["\u274C QueryClient Error: ",String(e)]})]})}}var J=M.create({container:{padding:16,backgroundColor:"rgba(0, 0, 0, 0.3)",borderRadius:8,margin:16,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.1)"},title:{color:"#FFFFFF",fontSize:14,fontWeight:"600",marginBottom:8},subtitle:{color:"#E5E7EB",fontSize:12,fontWeight:"500",marginTop:8,marginBottom:4},info:{color:"#9CA3AF",fontSize:12,marginBottom:4},error:{color:"#EF4444",fontSize:12,marginBottom:4},queriesList:{marginTop:4},queryKey:{color:"#60A5FA",fontSize:11,marginLeft:8,marginBottom:2},more:{color:"#9CA3AF",fontSize:11,fontStyle:"italic",marginLeft:8}});import{jsx as De,jsxs as Je}from"react/jsx-runtime";function Qu({queries:e,selectedQuery:t,isOpen:r,onClose:o,onSelect:a}){let n=s=>Array.isArray(s.queryKey)?s.queryKey.join(" - "):String(s.queryKey);return De(Ar,{accessibilityLabel:"Query selector",accessibilityHint:"View query selector","sentry-label":"ignore query selector",visible:r,transparent:true,animationType:"fade",onRequestClose:o,children:De(Mr,{accessibilityLabel:"Query selector overlay",accessibilityHint:"View query selector overlay","sentry-label":"ignore query selector overlay",style:K.modalOverlay,onPress:o,children:Je(f,{accessibilityLabel:"Query selector content",accessibilityHint:"View query selector content","sentry-label":"ignore query selector content",style:K.modalContent,children:[Je(f,{style:K.modalHeader,children:[De(p,{style:K.modalTitle,children:"Select Query"}),Je(p,{style:K.modalSubtitle,children:[e.length," ",e.length===1?"query":"queries"," ","available"]})]}),De(me,{accessibilityLabel:"Query selector scroll view",accessibilityHint:"View query selector scroll view","sentry-label":"ignore query selector scroll view",style:K.scrollView,contentContainerStyle:K.scrollViewContent,showsVerticalScrollIndicator:true,children:e.length===0?Je(f,{style:K.emptyState,children:[De(p,{style:K.emptyTitle,children:"No Queries Found"}),Je(p,{style:K.emptyDescription,children:["No React Query queries are currently active.",`
|
|
7
7
|
|
|
8
8
|
`,"To see queries here:",`
|
|
9
9
|
`,"\u2022 Make API calls using useQuery",`
|
|
10
10
|
`,"\u2022 Ensure queries are within QueryClientProvider",`
|
|
11
|
-
`,"\u2022 Check console for debugging info"]}),De(Aa,{})]}):e.map((s,i)=>{let l=n(s),u=Ma({queryState:s.state,observerCount:s.getObserversCount(),isStale:s.isStale()}),c={blue:"#3B82F6",gray:"#6B7280",purple:"#8B5CF6",yellow:"#F59E0B",green:"#10B981",red:"#EF4444"}[u]||"#6B7280",d=s===t;return Je(V,{accessibilityLabel:`Query ${l}`,accessibilityHint:`View query ${l}`,"sentry-label":`ignore query ${l}`,style:[K.queryItem,d&&K.selectedQueryItem],onPress:()=>a(s),children:[De(f,{style:[K.statusDot,{backgroundColor:c}]}),De(p,{style:[K.queryText,d&&K.selectedQueryText],numberOfLines:1,children:l})]},`${s.queryHash}-${i}`)})})]})})})}var K=M.create({modalOverlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center"},modalContent:{backgroundColor:"#1F1F1F",borderRadius:8,width:"80%",maxHeight:"80%",minHeight:"50%",borderWidth:1,borderColor:"rgba(255, 255, 255, 0.1)",flex:0},modalHeader:{padding:16,borderBottomWidth:1,borderBottomColor:"rgba(255, 255, 255, 0.1)"},modalTitle:{color:"#FFFFFF",fontSize:16,fontWeight:"600",marginBottom:4},modalSubtitle:{color:"#9CA3AF",fontSize:12},scrollView:{flex:1},scrollViewContent:{padding:8,flexGrow:1},emptyState:{padding:32,alignItems:"center",justifyContent:"center"},emptyTitle:{color:"#E5E7EB",fontSize:16,fontWeight:"500",marginBottom:8,textAlign:"center"},emptyDescription:{color:"#9CA3AF",fontSize:14,textAlign:"center",lineHeight:20},queryItem:{flexDirection:"row",alignItems:"center",padding:8,borderRadius:4},selectedQueryItem:{backgroundColor:"rgba(255, 255, 255, 0.1)"},statusDot:{width:8,height:8,borderRadius:4,marginRight:8},queryText:{color:"#E5E7EB",fontSize:14,flex:1},selectedQueryText:{color:"#FFFFFF",fontWeight:"500"},trigger:{flexDirection:"row",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.05)",borderRadius:4,paddingHorizontal:8,paddingVertical:6,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.1)",minWidth:120,maxWidth:200},triggerText:{color:"#E5E7EB",fontSize:12,flex:1,marginHorizontal:6}});import{CyberpunkSectionButton as
|
|
11
|
+
`,"\u2022 Check console for debugging info"]}),De(Aa,{})]}):e.map((s,i)=>{let l=n(s),u=Ma({queryState:s.state,observerCount:s.getObserversCount(),isStale:s.isStale()}),c={blue:"#3B82F6",gray:"#6B7280",purple:"#8B5CF6",yellow:"#F59E0B",green:"#10B981",red:"#EF4444"}[u]||"#6B7280",d=s===t;return Je(V,{accessibilityLabel:`Query ${l}`,accessibilityHint:`View query ${l}`,"sentry-label":`ignore query ${l}`,style:[K.queryItem,d&&K.selectedQueryItem],onPress:()=>a(s),children:[De(f,{style:[K.statusDot,{backgroundColor:c}]}),De(p,{style:[K.queryText,d&&K.selectedQueryText],numberOfLines:1,children:l})]},`${s.queryHash}-${i}`)})})]})})})}var K=M.create({modalOverlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center"},modalContent:{backgroundColor:"#1F1F1F",borderRadius:8,width:"80%",maxHeight:"80%",minHeight:"50%",borderWidth:1,borderColor:"rgba(255, 255, 255, 0.1)",flex:0},modalHeader:{padding:16,borderBottomWidth:1,borderBottomColor:"rgba(255, 255, 255, 0.1)"},modalTitle:{color:"#FFFFFF",fontSize:16,fontWeight:"600",marginBottom:4},modalSubtitle:{color:"#9CA3AF",fontSize:12},scrollView:{flex:1},scrollViewContent:{padding:8,flexGrow:1},emptyState:{padding:32,alignItems:"center",justifyContent:"center"},emptyTitle:{color:"#E5E7EB",fontSize:16,fontWeight:"500",marginBottom:8,textAlign:"center"},emptyDescription:{color:"#9CA3AF",fontSize:14,textAlign:"center",lineHeight:20},queryItem:{flexDirection:"row",alignItems:"center",padding:8,borderRadius:4},selectedQueryItem:{backgroundColor:"rgba(255, 255, 255, 0.1)"},statusDot:{width:8,height:8,borderRadius:4,marginRight:8},queryText:{color:"#E5E7EB",fontSize:14,flex:1},selectedQueryText:{color:"#FFFFFF",fontWeight:"500"},trigger:{flexDirection:"row",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.05)",borderRadius:4,paddingHorizontal:8,paddingVertical:6,borderWidth:1,borderColor:"rgba(255, 255, 255, 0.1)",minWidth:120,maxWidth:200},triggerText:{color:"#E5E7EB",fontSize:12,flex:1,marginHorizontal:6}});import{CyberpunkSectionButton as Ru,buoyColors as Da}from"@buoy-gg/shared-ui/web";import{jsx as mr}from"react/jsx-runtime";var Iu=()=>mr(f,{style:{width:24,height:24},children:mr(os,{})});function ku({onPress:e,getReactBuoySubtitle:t}){return mr(Ru,{id:"react-buoy-dev-tools",title:"QUERY",subtitle:(()=>{let r=t().match(/(\d+) queries • (\d+) mutations/);return r?`${r[1]}Q \u2022 ${r[2]}M`:"No data"})(),icon:Iu,iconColor:Da.error,iconBackgroundColor:Da.error+"1A",onPress:e,index:1})}import{useContext as Eu,useEffect as Fu}from"react";import{QueryClientContext as Pu}from"@tanstack/react-query";function Ou(){let e=Eu(Pu);return Fu(()=>{e&&(Ke.isConnected()||Ke.setQueryClient(e))},[e]),null}import{VirtualizedDataExplorer as zu,DataViewer as Ku,TypeLegend as Lu}from"@buoy-gg/shared-ui/web/dataViewer";import{useMemo as Bu}from"react";import{useQueryClient as Hu}from"@tanstack/react-query";import{isDevToolsStorageKey as Wu}from"@buoy-gg/shared-ui/web";function Qa(e){let t={mmkv:0,async:0,secure:0,total:0};return e.filter(r=>pe(r.queryKey)).forEach(r=>{let o=Br(r.queryKey);if(o){let a=jr(r.queryKey);Wu(a)||(t[o]++,t.total++)}}),t}function ju(){let e=Hu();return Bu(()=>{let t=e.getQueryCache().getAll();return Qa(t)},[e])}function Vu(e){return{getReactBuoySubtitle:()=>{try{let t=e.getQueryCache().getAll(),r=e.getMutationCache().getAll();return`${t.length} queries \u2022 ${r.length} mutations`}catch{return"Data management & cache inspector"}}}}import{useState as G,useEffect as $u}from"react";import{useEffect as Nu,useCallback as gr}from"react";import{persistentStorage as Ra}from"@buoy-gg/shared-ui/web";var lt=async(e,t)=>{await Ra.setItem(e,t)},Pt=async e=>Ra.getItem(e),Uu=async(e,t)=>{try{await lt(`${e}_panel_dimensions`,JSON.stringify(t))}catch{}},_u=async(e,t)=>{try{await lt(`${e}_panel_height`,t.toString())}catch{}},Ju=async(e,t)=>{try{await lt(`${e}_is_floating_mode`,t.toString())}catch{}},Gu=async e=>{try{let[t,r,o]=await Promise.all([Pt(`${e}_panel_dimensions`),Pt(`${e}_panel_height`),Pt(`${e}_is_floating_mode`)]),a=t?JSON.parse(t):null,n=r?parseInt(r,10):null;return{dimensions:a,height:n,isFloating:o?o==="true":null}}catch{return{dimensions:null,height:null,isFloating:null}}},Ia=async(e,t)=>{try{let r=JSON.stringify(t);await lt(e,r)}catch{}},ka=async e=>{try{let t=await Pt(e);return t&&t!==""?JSON.parse(t):null}catch{return null}},Ea=async e=>{try{await lt(e,"")}catch{}};function Fa({storagePrefix:e,isModalOpen:t,isDebugModalOpen:r,isEnvModalOpen:o=false,isSentryModalOpen:a=false,isStorageModalOpen:n=false,isNetworkModalOpen:s=false,selectedQueryKey:i,selectedSection:l,activeFilter:u,activeTab:c,selectedMutationId:d,isStateRestored:h}){let g=gr(async()=>{let C={isModalOpen:t,isDebugModalOpen:r,isEnvModalOpen:o,isSentryModalOpen:a,isStorageModalOpen:n,isNetworkModalOpen:s,selectedQueryKey:i?JSON.stringify(i):void 0,selectedSection:l||void 0,activeFilter:u||void 0,activeTab:c||void 0,selectedMutationId:d?.toString()||void 0};await Ia(e,C)},[e,t,r,o,a,n,s,i,l,u,c,d]),y=gr(async()=>await ka(e),[e]),m=gr(async()=>{await Ea(e)},[e]);return Nu(()=>{h&&(t||r||o||a||n||s?g():m())},[t,r,o,a,n,s,i,l,u,c,d,h,g,m]),{saveCurrentState:g,loadSavedState:y,clearSavedState:m}}import{devToolsStorageKeys as Yu}from"@buoy-gg/shared-ui/web";function Xu(){let[e,t]=G(false),[r,o]=G(false),[a,n]=G(false),[s,i]=G(false),[l,u]=G(false),[c,d]=G(false),[h,g]=G(void 0),[y,m]=G(null),[C,v]=G(null),[b,x]=G(false),[S,w]=G("queries"),[A,Y]=G(void 0),{loadSavedState:Qe}=Fa({storagePrefix:Yu.modal.state(),isModalOpen:e,isDebugModalOpen:r,isEnvModalOpen:a,isSentryModalOpen:s,isStorageModalOpen:l,isNetworkModalOpen:c,selectedQueryKey:h,selectedSection:y,activeFilter:C,activeTab:S,selectedMutationId:A,isStateRestored:b});return $u(()=>{(async()=>{if(!b)try{let T=await Qe();if(T){if(t(T.isModalOpen),o(T.isDebugModalOpen),n(T.isEnvModalOpen||false),i(T.isSentryModalOpen||false),u(T.isStorageModalOpen||false),d(T.isNetworkModalOpen||false),T.selectedQueryKey)try{let Ge=JSON.parse(T.selectedQueryKey);g(Ge)}catch{}T.selectedSection&&m(T.selectedSection),T.activeFilter&&v(T.activeFilter),T.activeTab&&w(T.activeTab),T.selectedMutationId&&Y(Number(T.selectedMutationId))}}catch{}finally{x(true)}})()},[b,Qe]),{isModalOpen:e,isDebugModalOpen:r,isEnvModalOpen:a,isSentryModalOpen:s,isStorageModalOpen:l,isNetworkModalOpen:c,selectedQueryKey:h,selectedSection:y,activeFilter:C,isStateRestored:b,activeTab:S,selectedMutationId:A,setSelectedSection:m,setActiveFilter:v,setActiveTab:w,handleModalDismiss:()=>{t(false),g(void 0)},handleDebugModalDismiss:()=>{o(false),m(null)},handleEnvModalDismiss:()=>{n(false)},handleSentryModalDismiss:()=>{i(false)},handleStorageModalDismiss:()=>{u(false)},handleNetworkModalDismiss:()=>{d(false)},handleQuerySelect:T=>{g(T?.queryKey)},handleQueryPress:()=>{t(true)},handleStatusPress:()=>{o(true)},handleEnvPress:()=>{n(true)},handleSentryPress:()=>{i(true)},handleStoragePress:()=>{u(true)},handleNetworkPress:()=>{d(true)},handleTabChange:T=>{T!==S&&(g(void 0),Y(void 0),v(null)),w(T)},handleMutationSelect:T=>{Y(T?.mutationId)}}}import{safeStringify as Zu,displayValue as ec,parseDisplayValue as tc}from"@buoy-gg/shared-ui/web";function rc(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)&&!(e instanceof Error)&&!(e instanceof Map)&&!(e instanceof Set)&&!(e instanceof RegExp)&&typeof e!="function"}export{ne as ActionButton,Ds as ClearCacheButton,Bo as DataEditorModal,Lo as DataEditorMode,Ku as DataViewer,ce as Explorer,No as MutationBrowserFooter,Zo as MutationBrowserModal,Vo as MutationBrowserMode,so as MutationButton,rr as MutationDetails,uo as MutationDetailsChips,na as MutationEditorModal,oa as MutationEditorMode,yo as MutationInformation,bo as MutationStatusCount,po as MutationsList,Rs as NetworkToggleButton,eo as QueryActions,$r as QueryBrowser,Io as QueryBrowserFooter,Fo as QueryBrowserModal,Qo as QueryBrowserMode,Aa as QueryDebugInfo,Nt as QueryDetails,_r as QueryDetailsChip,Bi as QueryInformation,zr as QueryRow,Qu as QuerySelector,te as QueryStatus,no as QueryStatusCount,dr as ReactQueryDevToolsModal,ia as ReactQueryModal,Xe as ReactQueryModalHeader,ku as ReactQuerySection,Ou as ReactQueryTracker,Fs as StorageStatusCount,Yo as SwipeIndicator,Lu as TypeLegend,zu as VirtualizedDataExplorer,Er as WifiToggle,Ea as clearModalVisibilityState,Ca as createReactQuerySyncAdapter,_l as createReactQueryTool,Gl as createWifiToggleTool,Fr as deleteItem,He as deleteNestedDataByPath,Vl as disconnectQueryClient,ec as displayValue,jr as getCleanStorageKey,Ma as getQueryStatusColor,oe as getQueryStatusLabel,Qa as getStorageQueryCounts,Br as getStorageType,Wr as getStorageTypeColor,xi as getStorageTypeHexColor,Hr as getStorageTypeLabel,Zr as invalidate,rc as isPlainObject,pe as isStorageQuery,ka as loadModalVisibilityState,Gu as loadPanelState,tc as parseDisplayValue,Ke as reactQueryEventStore,Ul as reactQueryToolPreset,Jt as refetch,Xr as remove,Yr as reset,Zu as safeStringify,Ju as saveFloatingMode,Ia as saveModalVisibilityState,Uu as savePanelDimensions,_u as savePanelHeight,jl as setQueryClient,ae as storageQueryKeys,Gt as triggerError,_t as triggerLoading,Be as updateNestedDataByPath,ir as useActionButtons,mo as useAllMutations,gt as useAllQueries,lr as useGetMutationById,Cr as useGetQueryByQueryKey,Bt as useGetQueryByQueryKeyWithVersion,Xu as useModalManager,Fa as useModalPersistence,ra as useMutationActionButtons,ao as useQueryStatusCounts,Vu as useReactQueryState,Au as useReactQuerySyncAdapter,ju as useStorageQueryCounts,kr as useWifiState,Jl as wifiTogglePreset};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/react-query",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.46",
|
|
4
4
|
"description": "TanStack Query devtools inside your React Native app — cache inspection, refetch & invalidate, offline toggle. Part of Buoy devtools.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"**/checkPeer.*"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@buoy-gg/floating-tools-core": "^7.0.
|
|
43
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
42
|
+
"@buoy-gg/floating-tools-core": "^7.0.46",
|
|
43
|
+
"@buoy-gg/shared-ui": "^7.0.46"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@tanstack/react-query": ">=5.0.0",
|