UNPKG

react-native-react-query-devtools

Version:
2 lines (1 loc) 43.8 kB
import{useState as or}from"react";import{View as Bt,TouchableOpacity as rr,Platform as nr,StyleSheet as ir}from"react-native";import{useState as Xo}from"react";import{View as J,TouchableOpacity as Je,Text as ge,StyleSheet as Yo}from"react-native";import{useState as wt,useRef as wo}from"react";import{ScrollView as So,View as St,StyleSheet as To,SafeAreaView as Lo}from"react-native";function j(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}var Vt={fresh:{backgroundColor:"#A6F4C5"},stale:{backgroundColor:"#FEDF89"},fetching:{backgroundColor:"#B2DDFF"},paused:{backgroundColor:"#D9D6FE"},noObserver:{backgroundColor:"#EAECF0"},inactive:{backgroundColor:"#FEDF89"}};function Ye(e){let r={backgroundColor:"#EAECF0"};return Vt[e]||r}import{TouchableOpacity as Qt,Text as xe,StyleSheet as Rt}from"react-native";var M=(e,r=!1)=>JSON.stringify(e,(()=>{let n=new WeakSet;return(i,d)=>{if(typeof d=="object"&&d!==null){if(n.has(d))return"[Circular]";n.add(d)}return d}})(),r?2:void 0);import{jsx as be,jsxs as Wt}from"react/jsx-runtime";function ke({query:e,setSelected:r,selected:o}){return Wt(Qt,{onPress:()=>{r(e===o?void 0:e)},style:[te.touchableOpacityBase,o?.queryKey===e.queryKey&&te.touchableOpacitySelected],children:[be(xe,{style:[te.textBase,Ye(j(e))],children:`${e.getObserversCount()}`}),be(xe,{style:te.queryKeyText,children:`${M(e.queryKey,!1)}`}),e.isDisabled()&&be(xe,{style:te.disabledText,children:"disabled"})]})}var te=Rt.create({touchableOpacityBase:{flexDirection:"row",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderBottomWidth:1,borderBottomColor:"#d0d5dd"},touchableOpacitySelected:{backgroundColor:"#eaecf0"},textBase:{textAlign:"center",minWidth:30,maxWidth:30,paddingVertical:6,fontSize:12},queryKeyText:{flex:1,flexDirection:"row",paddingVertical:1,paddingHorizontal:2,fontSize:12,paddingLeft:5},disabledText:{fontSize:12,paddingVertical:6,paddingHorizontal:2,color:"#1d2939",backgroundColor:"#d0d5dd",borderBottomWidth:1,borderBottomColor:"#d0d5dd"}});import{useEffect as Ot,useState as Pt}from"react";import{useQueryClient as It}from"@tanstack/react-query";function Ut(){let e=It(),[r,o]=Pt([]);return Ot(()=>{let n=()=>{let d=e.getQueryCache().findAll();setTimeout(()=>{o(d)},1)};n();let i=e.getQueryCache().subscribe(n);return()=>i()},[e]),r}var et=Ut;import{Text as zt,View as Gt,StyleSheet as jt}from"react-native";import{jsx as ot}from"react/jsx-runtime";var Kt={fresh:"#D1FADF",stale:"#FEF0C7",fetching:"#D1E9FF",paused:"#EBE9FE",noObserver:"#F2F4F7"},Ht={fresh:"#32D583",stale:"#FDB022",fetching:"#53B1FD",paused:"#9B8AFB",noObserver:"#344054"},Nt={fresh:"#027A48",stale:"#B54708",fetching:"#175CD3",paused:"#5925DC",noObserver:"#344054"};function we({query:e}){let r=j(e),o=Kt[r],n=Ht[r],i=Nt[r];return ot(Gt,{style:[tt.container,{backgroundColor:o,borderColor:n}],children:ot(zt,{style:[tt.text,{color:i}],children:r})})}var tt=jt.create({container:{padding:8,borderWidth:1,borderRadius:4,margin:4},text:{fontSize:12}});import{View as ae,Text as q,ScrollView as qt,StyleSheet as Zt}from"react-native";import{jsx as P,jsxs as le}from"react/jsx-runtime";function Se({query:e}){if(e===void 0)return null;let r=new Date(e.state.dataUpdatedAt).toLocaleTimeString();return le(ae,{style:K.minWidth,children:[P(q,{style:K.headerText,children:"Query Details"}),le(ae,{style:K.row,children:[P(qt,{horizontal:!0,style:K.flexOne,children:P(q,{style:K.queryKeyText,children:M(e.queryKey,!0)})}),P(we,{query:e})]}),le(ae,{style:K.row,children:[P(q,{children:" Observers:"}),P(q,{children:`${e.getObserversCount()}`})]}),le(ae,{style:K.row,children:[P(q,{children:" Last Updated:"}),P(q,{children:`${r}`})]})]})}var K=Zt.create({minWidth:{minWidth:200,fontSize:12},headerText:{textAlign:"left",backgroundColor:"#EAECF0",padding:4},row:{flexDirection:"row",justifyContent:"space-between",padding:4},flexOne:{flex:1},queryKeyText:{flexWrap:"wrap",alignItems:"center"}});import{useQueryClient as oo}from"@tanstack/react-query";import{TouchableOpacity as $t,Text as _t,View as Jt,StyleSheet as Xt}from"react-native";import{jsx as rt,jsxs as to}from"react/jsx-runtime";var Yt={btnRefetch:"#1570EF",btnInvalidate:"#DC6803",btnReset:"#475467",btnRemove:"#db2777",btnTriggerLoading:"#0891b2",btnTriggerLoadiError:"#ef4444"},eo={btnRefetch:"#1570EF",btnInvalidate:"#DC6803",btnReset:"#475467",btnRemove:"#db2777",btnTriggerLoading:"#0891b2",btnTriggerLoadiError:"#ef4444"};function I({onClick:e,text:r,textColorClass:o,bgColorClass:n,disabled:i}){let d=Yt[n],m=eo[o]||"#FFFFFF";return to($t,{disabled:i,onPress:e,style:[Te.button,{opacity:i?.6:1}],children:[rt(Jt,{style:[Te.dot,{backgroundColor:m}]}),rt(_t,{style:[Te.text,{color:m,opacity:i?.6:1}],children:r})]})}var Te=Xt.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:4,borderWidth:1,borderColor:"#d0d5dd",backgroundColor:"#f2f4f7",height:30,margin:4,paddingHorizontal:8,paddingVertical:4},dot:{width:6,height:6,borderRadius:999,marginRight:4},text:{fontSize:12,fontWeight:"400"}});function Le({query:e}){if(e.state.data===void 0){let r=e.state.fetchMeta.__previousQueryOptions;r&&e.fetch(r,{cancelRefetch:!0})}else{let r=e.options;e.fetch({...r,queryFn:()=>new Promise(()=>{}),gcTime:-1}),e.setState({data:void 0,status:"pending",fetchMeta:{...e.state.fetchMeta,__previousQueryOptions:r}})}}function ve({query:e}){e.fetch()}function Me({query:e,queryClient:r}){r.resetQueries({queryKey:e.queryKey,exact:!0})}function Fe({query:e,queryClient:r}){r.removeQueries(e)}function De({query:e}){e.invalidate()}function Be({query:e,queryClient:r}){let o=()=>{if(!e)return;let i=[{name:"Network Error",initializer:()=>new Error("Network error occurred")}][0]?.initializer(e)??new Error("Unknown error from devtools"),d=e.options;e.setState({...e.state,status:"error",error:i,fetchMeta:{...e.state.fetchMeta,__previousQueryOptions:d}})};e.state.status!=="error"?o():r.resetQueries(e)}import{View as ro,Text as no,StyleSheet as io}from"react-native";import{jsx as H,jsxs as so}from"react/jsx-runtime";function Ee({query:e,setSelectedQuery:r}){let o=oo();if(e===void 0)return null;let n=e.state.status;return so(ro,{style:nt.container,children:[H(no,{style:nt.headerText,children:"Actions"}),H(I,{disabled:j(e)==="fetching",onClick:()=>{ve({query:e})},bgColorClass:"btnRefetch",text:"Refetch",textColorClass:"btnRefetch"}),H(I,{disabled:n==="pending",onClick:()=>{De({query:e})},bgColorClass:"btnInvalidate",text:"Invalidate",textColorClass:"btnInvalidate"}),H(I,{disabled:n==="pending",onClick:()=>{Me({queryClient:o,query:e})},bgColorClass:"btnReset",text:"Reset",textColorClass:"btnReset"}),H(I,{disabled:j(e)==="fetching",onClick:()=>{Fe({queryClient:o,query:e}),r(void 0)},bgColorClass:"btnRemove",text:"Remove",textColorClass:"btnRemove"}),H(I,{disabled:!1,onClick:()=>{Le({query:e})},bgColorClass:"btnTriggerLoading",text:e.state.data===void 0?"Restore Loading":"Trigger Loading",textColorClass:"btnTriggerLoading"}),H(I,{disabled:n==="pending",onClick:()=>{Be({query:e,queryClient:o})},bgColorClass:"btnTriggerLoadiError",text:n==="error"?"Restore":"Trigger Error",textColorClass:"btnTriggerLoadiError"})]})}var nt=io.create({container:{minWidth:50,fontSize:12,flexDirection:"row",flexWrap:"wrap"},headerText:{textAlign:"left",backgroundColor:"#EAECF0",padding:4,width:"100%"}});import{useState as Oe,useMemo as Re}from"react";import{useQueryClient as de}from"@tanstack/react-query";import T,{Path as l,Line as Ae,Rect as ao,LinearGradient as h,Stop as s,Circle as S,Defs as E,Mask as A,G as y,Ellipse as N}from"react-native-svg";import{Fragment as lo,jsx as t,jsxs as f}from"react/jsx-runtime";function it(){return t(T,{width:16,height:16,viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M9 3h6M3 6h18m-2 0l-.701 10.52c-.105 1.578-.158 2.367-.499 2.965a3 3 0 01-1.298 1.215c-.62.3-1.41.3-2.993.3h-3.018c-1.582 0-2.373 0-2.993-.3A3 3 0 016.2 19.485c-.34-.598-.394-1.387-.499-2.966L5 6m5 4.5v5m4-5v5",stroke:"#667085"})})}function st(){return t(T,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M8 8V5.2C8 4.0799 8 3.51984 8.21799 3.09202C8.40973 2.71569 8.71569 2.40973 9.09202 2.21799C9.51984 2 10.0799 2 11.2 2H18.8C19.9201 2 20.4802 2 20.908 2.21799C21.2843 2.40973 21.5903 2.71569 21.782 3.09202C22 3.51984 22 4.0799 22 5.2V12.8C22 13.9201 22 14.4802 21.782 14.908C21.5903 15.2843 21.2843 15.5903 20.908 15.782C20.4802 16 19.9201 16 18.8 16H16M5.2 22H12.8C13.9201 22 14.4802 22 14.908 21.782C15.2843 21.5903 15.5903 21.2843 15.782 20.908C16 20.4802 16 19.9201 16 18.8V11.2C16 10.0799 16 9.51984 15.782 9.09202C15.5903 8.71569 15.2843 8.40973 14.908 8.21799C14.4802 8 13.9201 8 12.8 8H5.2C4.0799 8 3.51984 8 3.09202 8.21799C2.71569 8.40973 2.40973 8.71569 2.21799 9.09202C2 9.51984 2 10.0799 2 11.2V18.8C2 19.9201 2 20.4802 2.21799 20.908C2.40973 21.2843 2.71569 21.5903 3.09202 21.782C3.51984 22 4.07989 22 5.2 22Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#667085"})})}function at(e){return t(T,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z",stroke:e.theme==="dark"?"#12B76A":"#027A48",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function lt(){return t(T,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M9 9L15 15M15 9L9 15M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z",stroke:"#F04438",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function dt(){return f(T,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#667085",strokeWidth:"2",children:[t(ao,{width:"20",height:"20",y:"2",x:"2",rx:"2"}),t(Ae,{y1:"7",y2:"7",x1:"6",x2:"18"}),t(Ae,{y2:"12",y1:"12",x1:"6",x2:"18"}),t(Ae,{y1:"17",y2:"17",x1:"6",x2:"18"})]})}function ut(e){return t(lo,{children:e.checked?t(T,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z",stroke:e.theme==="dark"?"#9B8AFB":"#6938EF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):t(T,{viewBox:"0 0 24 24",height:"20",width:"20",fill:"none",children:t(l,{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z",stroke:e.theme==="dark"?"#9B8AFB":"#6938EF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}function ct(){return t(T,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",stroke:"#027A48",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ft(){return t(T,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837",stroke:"#B54708",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function pt(){return t(T,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",stroke:"#b91c1c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function yt(){return t(T,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(l,{d:"M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",stroke:"#5925DC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function gt(){return f(T,{height:"100%",width:"100%",style:{position:"absolute"},viewBox:"0 0 633 633",children:[f(h,{x1:-666.45,x2:-666.45,y1:163.28,y2:163.99,gradientTransform:"matrix(633 0 0 633 422177 -103358)",gradientUnits:"userSpaceOnUse",id:"a",children:[t(s,{stopColor:"#6BDAFF",offset:0}),t(s,{stopColor:"#F9FFB5",offset:.32}),t(s,{stopColor:"#FFA770",offset:.71}),t(s,{stopColor:"#FF7373",offset:1})]}),t(S,{cx:316.5,cy:316.5,r:316.5,fill:"url(#a)"}),t(E,{}),t(A,{x:-137.5,y:412,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"c",children:t(y,{filter:"url(#b)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(y,{mask:"url(#c)",children:t(N,{cx:89.5,cy:610.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00CFE2",strokeWidth:25})}),t(E,{}),t(A,{x:316.5,y:412,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"e",children:t(y,{filter:"url(#d)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(y,{mask:"url(#e)",children:t(N,{cx:543.5,cy:610.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00CFE2",strokeWidth:25})}),t(E,{}),t(A,{x:-137.5,y:450,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"g",children:t(y,{filter:"url(#f)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(y,{mask:"url(#g)",children:t(N,{cx:89.5,cy:648.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00A8B8",strokeWidth:25})}),t(E,{}),t(A,{x:316.5,y:450,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"i",children:t(y,{filter:"url(#h)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(y,{mask:"url(#i)",children:t(N,{cx:543.5,cy:648.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00A8B8",strokeWidth:25})}),t(E,{}),t(A,{x:-137.5,y:486,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"k",children:t(y,{filter:"url(#j)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(y,{mask:"url(#k)",children:t(N,{cx:89.5,cy:684.5,rx:214.5,ry:186,fill:"#015064",stroke:"#007782",strokeWidth:25})}),t(E,{}),t(A,{x:316.5,y:486,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"m",children:t(y,{filter:"url(#l)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(y,{mask:"url(#m)",children:t(N,{cx:543.5,cy:684.5,rx:214.5,ry:186,fill:"#015064",stroke:"#007782",strokeWidth:25})}),t(E,{}),t(A,{x:272.2,y:308,width:176.9,height:129.3,maskUnits:"userSpaceOnUse",id:"o",children:t(y,{filter:"url(#n)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),f(y,{mask:"url(#o)",children:[t(l,{fill:"none",stroke:"#000",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:11,d:"M436 403.2L431 431.8"}),t(l,{fill:"none",stroke:"#000",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:11,d:"M291 341.5L280 403.5"}),t(l,{fill:"none",stroke:"#000",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:11,d:"M332.9 384.1L328.6 411.2"}),f(h,{x1:-670.75,x2:-671.59,y1:164.4,y2:164.49,gradientTransform:"matrix(-184.16 -32.472 -11.461 64.997 -121359 -32126)",gradientUnits:"userSpaceOnUse",id:"p",children:[t(s,{stopColor:"#EE2700",offset:0}),t(s,{stopColor:"#FF008E",offset:1})]}),t(l,{d:"M344.1 363l97.7 17.2c5.8 2.1 8.2 6.1 7.1 12.1s-4.7 9.2-11 9.9l-106-18.7-57.5-59.2c-3.2-4.8-2.9-9.1.8-12.8s8.3-4.4 13.7-2.1l55.2 53.6z",clipRule:"evenodd",fillRule:"evenodd",fill:"url(#p)"}),t(l,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M428.2 384.5L429.1 378"}),t(l,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M395.2 379.5L396.1 373"}),t(l,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M362.2 373.5L363.1 367.4"}),t(l,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M324.2 351.3L328.4 347.4"}),t(l,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M303.2 331.3L307.4 327.4"})]}),t(E,{}),t(A,{x:73.2,y:113.8,width:280.6,height:317.4,maskUnits:"userSpaceOnUse",id:"r",children:t(y,{filter:"url(#q)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),f(y,{mask:"url(#r)",children:[f(h,{x1:-672.16,x2:-672.16,y1:165.03,y2:166.03,gradientTransform:"matrix(-100.18 48.861 97.976 200.88 -83342 -93.059)",gradientUnits:"userSpaceOnUse",id:"s",children:[t(s,{stopColor:"#A17500",offset:0}),t(s,{stopColor:"#5D2100",offset:1})]}),t(l,{d:"M192.3 203c8.1 37.3 14 73.6 17.8 109.1 3.8 35.4 2.8 75.1-3 119.2l61.2-16.7c-15.6-59-25.2-97.9-28.6-116.6s-10.8-51.9-22.1-99.6l-25.3 4.6",clipRule:"evenodd",fillRule:"evenodd",fill:"url(#s)"}),f(y,{stroke:"#2F8A00",children:[f(h,{x1:-660.23,x2:-660.23,y1:166.72,y2:167.72,gradientTransform:"matrix(92.683 4.8573 -2.0259 38.657 61680 -3088.6)",gradientUnits:"userSpaceOnUse",id:"t",children:[t(s,{stopColor:"#2F8A00",offset:0}),t(s,{stopColor:"#90FF57",offset:1})]}),t(l,{d:"M195 183.9s-12.6-22.1-36.5-29.9c-15.9-5.2-34.4-1.5-55.5 11.1 15.9 14.3 29.5 22.6 40.7 24.9 16.8 3.6 51.3-6.1 51.3-6.1z",clipRule:"evenodd",fillRule:"evenodd",strokeWidth:13,fill:"url(#t)"}),f(h,{x1:-661.36,x2:-661.36,y1:164.18,y2:165.18,gradientTransform:"matrix(110 5.7648 -6.3599 121.35 73933 -15933)",gradientUnits:"userSpaceOnUse",id:"u",children:[t(s,{stopColor:"#2F8A00",offset:0}),t(s,{stopColor:"#90FF57",offset:1})]}),t(l,{d:"M194.9 184.5s-47.5-8.5-83.2 15.7c-23.8 16.2-34.3 49.3-31.6 99.4 30.3-27.8 52.1-48.5 65.2-61.9 19.8-20.2 49.6-53.2 49.6-53.2z",clipRule:"evenodd",fillRule:"evenodd",strokeWidth:13,fill:"url(#u)"}),f(h,{x1:-656.79,x2:-656.79,y1:165.15,y2:166.15,gradientTransform:"matrix(62.954 3.2993 -3.5023 66.828 42156 -8754.1)",gradientUnits:"userSpaceOnUse",id:"v",children:[t(s,{stopColor:"#2F8A00",offset:0}),t(s,{stopColor:"#90FF57",offset:1})]}),t(l,{d:"M195 183.9c-.8-21.9 6-38 20.6-48.2s29.8-15.4 45.5-15.3c-6.1 21.4-14.5 35.8-25.2 43.4S211.5 178 195 183.9z",clipRule:"evenodd",fillRule:"evenodd",strokeWidth:13,fill:"url(#v)"}),f(h,{x1:-663.07,x2:-663.07,y1:165.44,y2:166.44,gradientTransform:"matrix(152.47 7.9907 -3.0936 59.029 101884 -4318.7)",gradientUnits:"userSpaceOnUse",id:"w",children:[t(s,{stopColor:"#2F8A00",offset:0}),t(s,{stopColor:"#90FF57",offset:1})]}),t(l,{d:"M194.9 184.5c31.9-30 64.1-39.7 96.7-29s50.8 30.4 54.6 59.1c-35.2-5.5-60.4-9.6-75.8-12.1-15.3-2.6-40.5-8.6-75.5-18z",clipRule:"evenodd",fillRule:"evenodd",strokeWidth:13,fill:"url(#w)"}),f(h,{x1:-662.57,x2:-662.57,y1:164.44,y2:165.44,gradientTransform:"matrix(136.46 7.1517 -5.2163 99.533 91536 -11442)",gradientUnits:"userSpaceOnUse",id:"x",children:[t(s,{stopColor:"#2F8A00",offset:0}),t(s,{stopColor:"#90FF57",offset:1})]}),t(l,{d:"M194.9 184.5c35.8-7.6 65.6-.2 89.2 22s37.7 49 42.3 80.3c-39.8-9.7-68.3-23.8-85.5-42.4s-32.5-38.5-46-59.9z",clipRule:"evenodd",fillRule:"evenodd",strokeWidth:13,fill:"url(#x)"}),f(h,{x1:-656.43,x2:-656.43,y1:163.86,y2:164.86,gradientTransform:"matrix(60.866 3.1899 -8.7773 167.48 41560 -25168)",gradientUnits:"userSpaceOnUse",id:"y",children:[t(s,{stopColor:"#2F8A00",offset:0}),t(s,{stopColor:"#90FF57",offset:1})]}),t(l,{d:"M194.9 184.5c-33.6 13.8-53.6 35.7-60.1 65.6s-3.6 63.1 8.7 99.6c27.4-40.3 43.2-69.6 47.4-88s5.6-44.1 4-77.2z",clipRule:"evenodd",fillRule:"evenodd",strokeWidth:13,fill:"url(#y)"}),t(l,{d:"M196.5 182.3c-14.8 21.6-25.1 41.4-30.8 59.4s-9.5 33-11.1 45.1",fill:"none",strokeLinecap:"round",strokeWidth:8}),t(l,{d:"M194.9 185.7c-24.4 1.7-43.8 9-58.1 21.8s-24.7 25.4-31.3 37.8M204.5 176.4c29.7-6.7 52-8.4 67-5.1s26.9 8.6 35.8 15.9M196.5 181.4c20.3 9.9 38.2 20.5 53.9 31.9s27.4 22.1 35.1 32",fill:"none",strokeLinecap:"round",strokeWidth:8})]})]}),t(E,{}),t(A,{x:50.5,y:399,width:532,height:633,maskUnits:"userSpaceOnUse",id:"A",children:t(y,{filter:"url(#z)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),f(y,{mask:"url(#A)",children:[f(h,{x1:-666.06,x2:-666.23,y1:163.36,y2:163.75,gradientTransform:"matrix(532 0 0 633 354760 -102959)",gradientUnits:"userSpaceOnUse",id:"B",children:[t(s,{stopColor:"#FFF400",offset:0}),t(s,{stopColor:"#3C8700",offset:1})]}),t(N,{cx:316.5,cy:715.5,rx:266,ry:316.5,fill:"url(#B)"})]}),t(E,{}),t(A,{x:391,y:-24,width:288,height:283,maskUnits:"userSpaceOnUse",id:"D",children:t(y,{filter:"url(#C)",children:t(S,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),f(y,{mask:"url(#D)",children:[f(h,{x1:-664.56,x2:-664.56,y1:163.79,y2:164.79,gradientTransform:"matrix(227 0 0 227 151421 -37204)",gradientUnits:"userSpaceOnUse",id:"E",children:[t(s,{stopColor:"#FFDF00",offset:0}),t(s,{stopColor:"#FF9D00",offset:1})]}),t(S,{cx:565.5,cy:89.5,r:113.5,fill:"url(#E)"}),f(h,{x1:-644.5,x2:-645.77,y1:342,y2:342,gradientTransform:"matrix(30 0 0 1 19770 -253)",gradientUnits:"userSpaceOnUse",id:"F",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#F)",d:"M427 89L397 89"}),f(h,{x1:-641.56,x2:-642.83,y1:196.02,y2:196.07,gradientTransform:"matrix(26.5 0 0 5.5 17439 -1025.5)",gradientUnits:"userSpaceOnUse",id:"G",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#G)",d:"M430.5 55.5L404 50"}),f(h,{x1:-643.73,x2:-645,y1:185.83,y2:185.9,gradientTransform:"matrix(29 0 0 8 19107 -1361)",gradientUnits:"userSpaceOnUse",id:"H",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#H)",d:"M431 122L402 130"}),f(h,{x1:-638.94,x2:-640.22,y1:177.09,y2:177.39,gradientTransform:"matrix(24 0 0 13 15783 -2145)",gradientUnits:"userSpaceOnUse",id:"I",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#I)",d:"M442 153L418 166"}),f(h,{x1:-633.42,x2:-634.7,y1:172.41,y2:173.31,gradientTransform:"matrix(20 0 0 19 13137 -3096)",gradientUnits:"userSpaceOnUse",id:"J",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#J)",d:"M464 180L444 199"}),f(h,{x1:-619.05,x2:-619.52,y1:170.82,y2:171.82,gradientTransform:"matrix(13.83 0 0 22.85 9050 -3703.4)",gradientUnits:"userSpaceOnUse",id:"K",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#K)",d:"M491.4 203L477.5 225.9"}),f(h,{x1:-578.5,x2:-578.63,y1:170.31,y2:171.31,gradientTransform:"matrix(7.5 0 0 24.5 4860 -3953)",gradientUnits:"userSpaceOnUse",id:"L",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#L)",d:"M524.5 219.5L517 244"}),f(h,{x1:666.5,x2:666.5,y1:170.31,y2:171.31,gradientTransform:"matrix(.5 0 0 24.5 231.5 -3944)",gradientUnits:"userSpaceOnUse",id:"M",children:[t(s,{stopColor:"#FFA400",offset:0}),t(s,{stopColor:"#FF5E00",offset:1})]}),t(l,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#M)",d:"M564.5 228.5L565 253"})]})]})}var V=(e,r,o)=>{if(r.length===0)return o;if(e instanceof Map){let n=new Map(e);if(r.length===1)return n.set(r[0],o),n;let[i,...d]=r;return n.set(i,V(n.get(i),d,o)),n}if(e instanceof Set){let n=V(Array.from(e),r,o);return new Set(n)}if(Array.isArray(e)){let n=[...e];if(r.length===1)return n[r[0]]=o,n;let[i,...d]=r;return n[i]=V(n[i],d,o),n}if(e instanceof Object){let n={...e};if(r.length===1)return n[r[0]]=o,n;let[i,...d]=r;return n[i]=V(n[i],d,o),n}return e};var Z=(e,r)=>{if(e instanceof Map){let o=new Map(e);if(r.length===1)return o.delete(r[0]),o;let[n,...i]=r;return o.set(n,Z(o.get(n),i)),o}if(e instanceof Set){let o=Z(Array.from(e),r);return new Set(o)}if(Array.isArray(e)){let o=[...e];if(r.length===1)return o.filter((d,m)=>m.toString()!==r[0]);let[n,...i]=r;return o[n]=Z(o[n],i),o}if(e instanceof Object){let o={...e};if(r.length===1)return delete o[r[0]],o;let[n,...i]=r;return o[n]=Z(o[n],i),o}return e};function Ve({activeQuery:e,dataPath:r,queryClient:o}){if(!r){console.error("delete item data path is missing!");return}let n=e.state.data,i=Z(n,r);o.setQueryData(e.queryKey,i)}import Pe,{Path as Ie}from"react-native-svg";import{Text as $,TextInput as fo,TouchableOpacity as U,View as b,StyleSheet as po,Alert as yo}from"react-native";import{createContext as uo,useContext as co}from"react";var Qe=uo({}),ht=()=>co(Qe);import{Fragment as We,jsx as a,jsxs as x}from"react/jsx-runtime";function mt(e){return Symbol.iterator in e}function go(e,r){if(r<1)return[];let o=0,n=[];for(;o<e.length;)n.push(e.slice(o,o+r)),o=o+r;return n}var Ct=({expanded:e})=>a(b,{style:[e?u.expanded:u.collapsed],children:a(Pe,{width:16,height:16,viewBox:"0 0 16 16",fill:"#98A2B3",children:a(Ie,{d:"M6 12l4-4-4-4"})})}),ho=({value:e})=>{let[r,o]=Oe("NoCopy"),{onCopy:n}=ht(),i=async()=>{if(!n){yo.alert("Warning","Copy functionality is not configured. Please add a copy function to DevToolsBubble. See documentation for setup instructions.");return}try{await n(JSON.stringify(e))?(o("SuccessCopy"),setTimeout(()=>o("NoCopy"),1500)):(o("ErrorCopy"),setTimeout(()=>o("NoCopy"),1500))}catch(d){console.error("Copy failed:",d),o("ErrorCopy"),setTimeout(()=>o("NoCopy"),1500)}};return x(U,{style:u.buttonStyle,"aria-label":r==="NoCopy"?"Copy object to clipboard":r==="SuccessCopy"?"Object copied to clipboard":"Error copying object to clipboard",onPress:r==="NoCopy"?i:void 0,children:[r==="NoCopy"&&a(st,{}),r==="SuccessCopy"&&a(at,{theme:"light"}),r==="ErrorCopy"&&a(lt,{})]})},xt=({dataPath:e,activeQuery:r})=>{let o=de();return r?a(U,{onPress:()=>{Ve({queryClient:o,activeQuery:r,dataPath:e})},style:u.buttonStyle1,accessibilityLabel:"Delete item",children:a(it,{})}):null},mo=({dataPath:e,activeQuery:r})=>{let o=de();if(!r)return null;let n=()=>{let i=r.state.data,d=V(i,e,[]);o.setQueryData(r.queryKey,d)};return a(U,{style:u.buttonStyle2,"aria-label":"Remove all items",onPress:n,children:a(dt,{})})},Co=({dataPath:e,activeQuery:r,value:o})=>{let n=de();if(!r)return null;let i=()=>{let d=r.state.data,m=V(d,e,!o);n.setQueryData(r.queryKey,m)};return a(U,{style:u.buttonStyle3,"aria-label":"Toggle value",onPress:i,children:a(ut,{checked:o,theme:"light"})})};function F({editable:e,label:r,value:o,defaultExpanded:n,activeQuery:i,dataPath:d,itemsDeletable:m}){let R=de(),[w,D]=Oe((n||[]).includes(r)),G=()=>D(p=>!p),[se,me]=Oe([]),Y=Re(()=>Array.isArray(o)?o.map((p,c)=>({label:c.toString(),value:p})):o!==null&&typeof o=="object"&&mt(o)?o instanceof Map?Array.from(o,([p,c])=>({label:p.toString(),value:c})):Array.from(o,(p,c)=>({label:c.toString(),value:p})):typeof o=="object"&&o!==null?Object.entries(o).map(([p,c])=>({label:p,value:c})):[],[o]),C=Re(()=>Array.isArray(o)?"array":o!==null&&typeof o=="object"&&mt(o)&&typeof o[Symbol.iterator]=="function"?"Iterable":typeof o=="object"&&o!==null?"object":typeof o,[o]),ee=Re(()=>go(Y,100),[Y]),W=d??[],Et=(p,c)=>{if(!i)return null;let B=i.state.data;if(p&&isNaN(Number(c)))return;let Ce=C==="number"?Number(c):c,At=V(B,W,Ce);R.setQueryData(i.queryKey,At)};return a(b,{style:u.minWidthWrapper,children:x(b,{style:u.fullWidthMarginRight,children:[ee.length>0&&x(We,{children:[x(b,{style:u.flexRowItemsCenterGap,children:[x(U,{style:u.expanderButton,onPress:()=>G(),children:[a(Ct,{expanded:w}),a($,{children:r}),a($,{style:u.textGray500,children:`${String(C).toLowerCase()==="iterable"?"(Iterable) ":""}${Y.length} ${Y.length>1?"items":"item"}`})]}),e&&x(b,{style:u.flexRowGapItemsCenter,children:[a(ho,{value:o}),m&&i!==void 0&&a(xt,{activeQuery:i,dataPath:W}),C==="array"&&i!==void 0&&a(mo,{activeQuery:i,dataPath:W})]})]}),w&&x(We,{children:[ee.length===1&&a(b,{style:u.singleEntryContainer,children:Y.map((p,c)=>a(F,{defaultExpanded:n,label:p.label,value:p.value,editable:e,dataPath:[...W,p.label],activeQuery:i,itemsDeletable:C==="array"||C==="Iterable"||C==="object"},p.label+c))}),ee.length>1&&a(b,{style:u.multiEntryContainer,children:ee.map((p,c)=>a(b,{children:x(b,{style:u.relativeOutlineNone,children:[x(U,{onPress:()=>me(B=>B.includes(c)?B.filter(Ce=>Ce!==c):[...B,c]),style:u.pageExpanderButton,children:[a(Ct,{expanded:se.includes(c)}),x($,{children:["[",c*100,"...",c*100+99,"]"]})]}),se.includes(c)&&a(b,{style:u.entriesContainer,children:p.map(B=>a(F,{defaultExpanded:n,label:B.label,value:B.value,editable:e,dataPath:[...W,B.label],activeQuery:i},B.label))})]})},c))})]})]}),ee.length===0&&x(b,{style:u.flexRowGapFullWidth,children:[x($,{style:u.text344054,children:[r,":"]}),e&&i!==void 0&&(C==="string"||C==="number"||C==="boolean")?x(We,{children:[e&&i&&(C==="string"||C==="number")&&x(b,{style:u.inputContainer,children:[a(fo,{style:[u.textInput,C==="number"?u.textNumber:u.textString],keyboardType:C==="number"?"numeric":"default",value:o.toString(),onChangeText:p=>Et(C==="number",p)}),C==="number"&&x(b,{style:u.numberInputButtons,children:[a(U,{style:u.touchableButton,onPressIn:()=>{let p=i.state.data,c=V(p,W,o+1);R.setQueryData(i.queryKey,c)},children:a(Pe,{fill:"none",viewBox:"0 0 24 24",stroke:"#6938EF",children:a(Ie,{d:"M4.5 15.75l7.5-7.5 7.5 7.5"})})}),a(U,{style:u.touchableButton,onPressIn:()=>{let p=i.state.data,c=V(p,W,o-1);R.setQueryData(i.queryKey,c)},children:a(Pe,{fill:"none",viewBox:"0 0 24 24",stroke:"#6938EF",children:a(Ie,{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})})]})]}),C==="boolean"&&x(b,{style:u.booleanContainer,children:[a(Co,{activeQuery:i,dataPath:W,value:o}),a($,{style:u.booleanText,children:M(o)})]})]}):a($,{style:u.displayValueText,children:M(o)}),e&&m&&i!==void 0&&a(xt,{activeQuery:i,dataPath:W})]})]})})}var u=po.create({buttonStyle3:{backgroundColor:"transparent",flexDirection:"row",alignItems:"center",justifyContent:"center",width:16,height:16,position:"relative",zIndex:10},buttonStyle2:{backgroundColor:"transparent",flexDirection:"row",padding:0,alignItems:"center",justifyContent:"center",width:12,height:12,position:"relative",zIndex:10},buttonStyle1:{backgroundColor:"transparent",borderColor:"none",borderWidth:0,padding:0,alignItems:"center",justifyContent:"center",width:24,height:24,position:"relative"},buttonStyle:{backgroundColor:"transparent",color:"#6B7280",borderWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"center",width:12,height:12,position:"relative"},expanded:{transform:[{rotate:"90deg"}]},collapsed:{transform:[{rotate:"0deg"}]},minWidthWrapper:{minWidth:200,fontSize:12,flexDirection:"row",flexWrap:"wrap",width:"100%"},fullWidthMarginRight:{position:"relative",width:"100%",marginRight:1},flexRowItemsCenterGap:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:1},expanderButton:{flexDirection:"row",alignItems:"center",height:20,backgroundColor:"transparent",borderWidth:0,padding:0},textGray500:{color:"#6B7280",fontSize:12,marginLeft:1},flexRowGapItemsCenter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:1},singleEntryContainer:{marginLeft:8,paddingLeft:12,borderLeftWidth:2,borderColor:"#D1D5DB"},multiEntryContainer:{marginLeft:8,paddingLeft:12,borderLeftWidth:2,borderColor:"#D1D5DB"},relativeOutlineNone:{position:"relative"},pageExpanderButton:{flexDirection:"row",alignItems:"center",backgroundColor:"transparent",borderWidth:0,padding:0},entriesContainer:{marginLeft:8,paddingLeft:12,borderLeftWidth:2,borderColor:"#D1D5DB"},flexRowGapFullWidth:{flexDirection:"row",width:"100%",alignItems:"center",marginVertical:4,lineHeight:44},text344054:{color:"#344054",height:"100%",marginRight:1},inputContainer:{flexDirection:"row",justifyContent:"space-between",borderWidth:0,height:22,margin:1,paddingVertical:2,paddingLeft:6,paddingRight:4,borderRadius:4,backgroundColor:"#EAECF0",flex:1},textNumber:{color:"#6938EF"},textInput:{flex:1,marginRight:8,paddingBottom:2,paddingTop:2},textString:{},numberInputButtons:{flexDirection:"row"},touchableButton:{width:24},booleanContainer:{flexDirection:"row",alignItems:"center",padding:4,borderRadius:4,backgroundColor:"#F3F4F6",flex:1},booleanText:{marginLeft:8,color:"#6938EF"},displayValueText:{flex:1,color:"#6938EF",height:"100%"}});import{View as bt,Text as kt,ScrollView as xo,StyleSheet as bo}from"react-native";import{jsx as z,jsxs as ko}from"react/jsx-runtime";function Ue({selectedQuery:e,setSelectedQuery:r}){return ko(xo,{style:oe.flexOne,children:[z(Se,{query:e}),z(Ee,{query:e,setSelectedQuery:r}),z(kt,{style:oe.headerText,children:"Data Explorer"}),z(bt,{style:oe.contentView,children:z(F,{editable:!0,label:"Data",value:e?.state.data,defaultExpanded:["Data"],activeQuery:e})}),z(kt,{style:oe.headerText,children:"Query Explorer"}),z(bt,{style:oe.contentView,children:z(F,{label:"Query",value:e,defaultExpanded:["Query","queryKey"],activeQuery:e})})]})}var oe=bo.create({flexOne:{flex:1},headerText:{textAlign:"left",backgroundColor:"#EAECF0",padding:6,width:"100%",fontSize:12},contentView:{padding:2}});import{jsx as re,jsxs as vo}from"react/jsx-runtime";function Ge(){let[e,r]=wt(void 0),[o,n]=wt({}),i=et(),d=wo(null),m=(w,D)=>{let{y:G,height:se}=w.nativeEvent.layout;n(me=>({...me,[D]:{y:G,height:se}}))},R=(w,D)=>{if(w===e){r(void 0);return}if(r(w),d.current&&o[D]){let G=o[D].y;d.current.scrollTo({y:G,animated:!0})}};return vo(Lo,{style:ze.container,children:[re(So,{style:ze.scrollView,ref:d,children:i.map((w,D)=>re(St,{onLayout:G=>m(G,D),children:re(ke,{selected:e,setSelected:()=>R(w,D),query:w})},D))}),e&&re(St,{style:ze.queryInformation,children:re(Ue,{selectedQuery:e,setSelectedQuery:r})})]})}var ze=To.create({container:{flex:1,width:"100%"},scrollView:{flex:1,flexDirection:"column",width:"100%",height:"25%"},queryInformation:{height:"75%"}});import er,{Path as tr}from"react-native-svg";import{useState as Zo}from"react";import{ScrollView as $o,View as Dt,StyleSheet as _o}from"react-native";import{TouchableOpacity as Mo,Text as Fo,View as Do,StyleSheet as Bo}from"react-native";var Q={purpleMutation:"#D9D6FE",purpleMutationText:"#5925DC",redMutation:"#fecaca",redMutationText:"#b91c1c",yellowMutation:"#FEDF89",yellowMutationText:"#B54708",greenMutation:"#A6F4C5",greenMutationText:"#027A48",grayMutation:"#eaecf0",grayMutationText:"#344054"},Tt=({status:e,isPaused:r})=>{let o,n;return r?(o=Q.purpleMutation,n=Q.purpleMutationText):e==="error"?(o=Q.redMutation,n=Q.redMutationText):e==="pending"?(o=Q.yellowMutation,n=Q.yellowMutationText):e==="success"?(o=Q.greenMutation,n=Q.greenMutationText):(o=Q.grayMutation,n=Q.grayMutationText),{backgroundColor:o,textColor:n}};import{jsx as ne,jsxs as Lt}from"react/jsx-runtime";function je({mutation:e,setSelected:r,selected:o}){let n=e.options.mutationKey?JSON.stringify(M(e.options.mutationKey,!1))+" - ":"",i=new Date(e.state.submittedAt).toLocaleString(),d=`${n}${i}`,{backgroundColor:m,textColor:R}=Tt({isPaused:e.state.isPaused,status:e.state.status});return Lt(Mo,{onPress:()=>r(e===o?void 0:e),style:[ue.button,o?.mutationId===e.mutationId&&ue.selected],children:[Lt(Do,{style:[ue.iconContainer,{backgroundColor:m}],children:[e.state.isPaused&&ne(yt,{}),e.state.status==="success"&&ne(ct,{}),e.state.status==="error"&&ne(pt,{}),e.state.status==="pending"&&ne(ft,{})]}),ne(Fo,{style:[ue.text],children:d})]})}var ue=Bo.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"flex-start",borderBottomWidth:1,borderBottomColor:"#d0d5dd",backgroundColor:"white"},selected:{backgroundColor:"#eaecf0"},iconContainer:{padding:8,paddingVertical:6},text:{marginLeft:8,fontSize:12,minWidth:18}});import{ScrollView as Io,Text as fe,View as pe,StyleSheet as Uo}from"react-native";import{View as He,Text as ce,ScrollView as Oo,StyleSheet as Po}from"react-native";import{Text as Eo,View as Ao,StyleSheet as Vo}from"react-native";import{jsx as Mt}from"react/jsx-runtime";var Qo={fresh:"#D1FADF",stale:"#FEF0C7",fetching:"#D1E9FF",paused:"#EBE9FE",inactive:"#F2F4F7"},Ro={fresh:"#32D583",stale:"#FDB022",fetching:"#53B1FD",paused:"#9B8AFB",inactive:"#344054"},Wo={fresh:"#027A48",stale:"#B54708",fetching:"#175CD3",paused:"#5925DC",inactive:"#344054"};function Ke({status:e}){let r=e==="pending"?"fetching":e==="idle"?"inactive":e==="error"?"stale":"fresh",o=Qo[r],n=Ro[r],i=Wo[r];return Mt(Ao,{style:[vt.container,{backgroundColor:o,borderColor:n}],children:Mt(Eo,{style:[vt.text,{color:i}],children:e})})}var vt=Vo.create({container:{padding:8,borderWidth:1,borderRadius:4,margin:4},text:{fontSize:12}});import{jsx as _,jsxs as Ne}from"react/jsx-runtime";function qe({selectedMutation:e}){if(e===void 0)return null;let r=new Date(e.state.submittedAt).toLocaleTimeString();return Ne(He,{style:L.container,children:[_(ce,{style:[L.mutationDetailsText,L.bgEAECF0,L.p1],children:"Mutation Details"}),Ne(He,{style:[L.flexRow,L.justifyBetween,L.p1],children:[_(Oo,{horizontal:!0,style:L.flex1,children:_(ce,{style:L.flexWrap,children:`${e.options.mutationKey?M(e.options.mutationKey,!0):"No mutationKey found"}`})}),_(Ke,{status:e.state.status})]}),Ne(He,{style:[L.flexRow,L.justifyBetween,L.p1],children:[_(ce,{children:"Submitted At:"}),_(ce,{children:r})]})]})}var L=Po.create({container:{minWidth:200,fontSize:12},mutationDetailsText:{textAlign:"left",backgroundColor:"#EAECF0",padding:4},flexRow:{flexDirection:"row",justifyContent:"space-between",padding:4},justifyBetween:{justifyContent:"space-between"},p1:{padding:4},flex1:{flex:1},flexWrap:{flexWrap:"wrap",alignItems:"center"},bgEAECF0:{backgroundColor:"#EAECF0"}});import{jsx as k,jsxs as zo}from"react/jsx-runtime";function Ze({selectedMutation:e}){return zo(Io,{style:O.flex1,children:[k(qe,{selectedMutation:e}),k(fe,{style:O.textHeader,children:"Variables Details"}),k(pe,{style:O.padding,children:k(F,{label:"Variables",value:e?.state.variables,defaultExpanded:["Variables"]})}),k(fe,{style:O.textHeader,children:"Context Details"}),k(pe,{style:O.padding,children:k(F,{label:"Context",value:e?.state.context,defaultExpanded:["Context"]})}),k(fe,{style:O.textHeader,children:"Data Explorer"}),k(pe,{style:O.padding,children:k(F,{label:"Data",defaultExpanded:["Data"],value:e?.state.data})}),k(fe,{style:O.textHeader,children:"Mutations Explorer"}),k(pe,{style:O.padding,children:k(F,{label:"Mutation",defaultExpanded:["Mutation"],value:e})})]})}var O=Uo.create({flex1:{flex:1},textHeader:{textAlign:"left",backgroundColor:"#EAECF0",padding:4,width:"100%",fontSize:12},padding:{padding:8}});import{useEffect as Go,useRef as jo,useState as Ko}from"react";import{useQueryClient as Ho}from"@tanstack/react-query";import No from"fast-deep-equal";function qo(){let e=Ho(),[r,o]=Ko([]),n=jo([]);return Go(()=>{let i=()=>{setTimeout(()=>{let m=[...e.getMutationCache().getAll()],R=m.map(w=>w.state);No(n.current,R)||(n.current=R,o(m))},1)};i();let d=e.getMutationCache().subscribe(i);return()=>d()},[e]),{mutations:r}}var Ft=qo;import{jsx as ye,jsxs as Jo}from"react/jsx-runtime";function _e(){let[e,r]=Zo(),{mutations:o}=Ft();return Jo(Dt,{style:$e.container,children:[ye($o,{style:$e.scrollView,children:o.map((n,i)=>ye(je,{selected:e,setSelected:r,mutation:n},i))}),e&&ye(Dt,{style:$e.mutationInfo,children:ye(Ze,{selectedMutation:e})})]})}var $e=_o.create({container:{flex:1,flexDirection:"column",width:"100%"},scrollView:{flex:1,flexDirection:"column",height:"25%"},mutationInfo:{height:"75%"}});import{jsx as v,jsxs as ie}from"react/jsx-runtime";function Xe({setShowDevTools:e}){let[r,o]=Xo(!0);return ie(J,{style:g.container,children:[v(Je,{onPress:()=>{e(!1)},style:g.closeButton,children:v(er,{width:8,height:8,viewBox:"0 0 10 6",fill:"none",children:v(tr,{d:"M1 1l4 4 4-4",stroke:"#475467",strokeWidth:1.66667,strokeLinecap:"round",strokeLinejoin:"round"})})}),ie(J,{style:g.devToolsPanel,children:[ie(J,{style:g.devToolsHeader,children:[ie(J,{style:g.tanstackHeader,children:[v(ge,{style:g.tanstackText,children:"TANSTACK"}),v(J,{style:g.reactQueryVersion,children:v(ge,{style:g.reactQueryVersionText,children:"React Query v5"})})]}),ie(J,{style:g.toggleButtonsContainer,children:[v(Je,{onPress:()=>{o(!0)},style:[g.toggleButton,r===!0?g.toggleButtonActive:g.toggleButtonInactive,{borderTopRightRadius:0,borderBottomRightRadius:0}],children:v(ge,{style:[g.toggleButtonText,r===!0?g.toggleButtonTextActive:g.toggleButtonTextInactive],children:"Queries"})}),v(Je,{onPress:()=>{o(!1)},style:[g.toggleButton,r===!1?g.toggleButtonActive:g.toggleButtonInactive,{borderTopLeftRadius:0,borderBottomLeftRadius:0}],children:v(ge,{style:[g.toggleButtonText,r===!1?g.toggleButtonTextActive:g.toggleButtonTextInactive],children:"Mutations"})})]})]}),r?v(Ge,{}):v(_e,{})]})]})}var g=Yo.create({container:{flex:1,flexDirection:"column"},closeButton:{position:"absolute",right:-2,top:-17,zIndex:50,width:22,height:15,borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:"white",padding:3,margin:3,borderColor:"#98a2b3",borderWidth:1,borderBottomWidth:0,alignItems:"center",justifyContent:"center"},devToolsPanel:{backgroundColor:"white",minWidth:300,flex:1,borderTopColor:"#98a2b3",borderTopWidth:1},devToolsHeader:{padding:8,paddingBottom:6,paddingTop:6,borderColor:"#d0d5dd",borderBottomWidth:2,paddingVertical:1,flexDirection:"row"},tanstackHeader:{marginHorizontal:2,paddingRight:8},tanstackText:{color:"#475467",fontWeight:"bold"},reactQueryVersion:{},reactQueryVersionText:{marginTop:-4,color:"#F97F1E"},toggleButtonsContainer:{flexDirection:"row",marginLeft:1,alignItems:"center"},toggleButton:{borderTopLeftRadius:4,borderBottomLeftRadius:4,padding:4,borderWidth:1,borderColor:"#d0d5dd",paddingHorizontal:2,maxWidth:100,borderRadius:4},toggleButtonActive:{backgroundColor:"#F2F4F7"},toggleButtonInactive:{backgroundColor:"#EAECF0"},toggleButtonText:{paddingRight:4,paddingLeft:4,fontSize:12},toggleButtonTextActive:{color:"#344054"},toggleButtonTextInactive:{color:"#909193"},comingSoonText:{margin:3}});import{jsx as X}from"react/jsx-runtime";function sr({bubbleStyle:e,onCopy:r}){let[o,n]=or(!1);return X(Qe.Provider,{value:{onCopy:r},children:X(Bt,{children:o?X(Bt,{style:he.devTools,children:X(Xe,{setShowDevTools:n})}):X(rr,{onPress:()=>{n(!0)},style:[he.touchableOpacityBase,nr.OS==="ios"?he.touchableOpacityIOS:he.touchableOpacityAndroid,e],children:X(gt,{})})})})}var he=ir.create({devTools:{position:"absolute",right:0,bottom:0,zIndex:50,width:"100%",height:350},touchableOpacityBase:{position:"absolute",right:1,zIndex:50,width:48,height:48,borderRadius:24,borderWidth:4,borderColor:"#A4C200"},touchableOpacityIOS:{bottom:96},touchableOpacityAndroid:{bottom:64},text:{zIndex:10,color:"white",fontSize:40,padding:24}});export{sr as DevToolsBubble};