react-native-react-query-devtools
Version:
React Query Dev Tools for React Native
1 lines • 56 kB
JavaScript
import un,{useState as kt,useRef as St}from"react";import{View as cn,TouchableOpacity as fn,Platform as pn,StyleSheet as yn,Dimensions as gn,PanResponder as hn,Animated as De}from"react-native";import{QueryClientProvider as mn}from"@tanstack/react-query";import nn,{useState as Ae}from"react";import{View as so,TouchableOpacity as an,StyleSheet as sn}from"react-native";import{onlineManager as lo}from"@tanstack/react-query";import{useState as Yo,useRef as rt}from"react";import{FlatList as er,View as me,StyleSheet as tr,SafeAreaView as or,Text as rr,PanResponder as nr,Animated as nt,Dimensions as ir}from"react-native";import{View as Tt,Text as Ie,TouchableOpacity as fo,StyleSheet as po}from"react-native";function K(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}var W=(e,r=!1)=>JSON.stringify(e,(()=>{let n=new WeakSet;return(i,a)=>{if(typeof a=="object"&&a!==null){if(n.has(a))return"[Circular]";n.add(a)}return a}})(),r?2:void 0);import{jsx as he,jsxs as go}from"react/jsx-runtime";var yo=({query:e,isSelected:r,onSelect:o})=>{let n=R=>{switch(R){case"fresh":return"green";case"stale":case"inactive":return"yellow";case"fetching":return"blue";case"paused":return"purple";default:return"gray"}},i=(R,x)=>({green:{200:"#bbf7d0",300:"#86efac",700:"#15803d",800:"#166534",900:"#14532d"},yellow:{200:"#fef08a",300:"#fde047",700:"#a16207",800:"#854d0e",900:"#713f12"},gray:{200:"#e5e7eb",300:"#d1d5db",700:"#374151",800:"#1f2937",900:"#111827"},blue:{200:"#bfdbfe",300:"#93c5fd",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a"},purple:{200:"#e9d5ff",300:"#d8b4fe",700:"#7e22ce",800:"#6b21a8",900:"#581c87"},red:{200:"#fecaca",300:"#fca5a5",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"}})[R][x],a=K(e),l=n(a),u=e.getObserversCount(),b=e.isDisabled(),h=W(e.queryKey,!1),w=()=>l==="gray"?{backgroundColor:i(l,"200"),color:i(l,"700")}:{backgroundColor:i(l,"200"),color:i(l,"800")};return go(fo,{style:[ee.queryRow,r&&ee.selectedQueryRow],onPress:()=>o(e),activeOpacity:.7,accessibilityLabel:`Query key ${h}`,children:[he(Tt,{style:[ee.observerCount,w()],children:he(Ie,{style:[ee.observerCountText,{color:w().color}],children:u})}),he(Ie,{style:ee.queryHash,numberOfLines:1,ellipsizeMode:"middle",children:h}),b&&he(Tt,{style:ee.disabledIndicator,children:he(Ie,{style:ee.disabledText,children:"disabled"})})]})},ee=po.create({queryRow:{flexDirection:"row",alignItems:"stretch",borderBottomWidth:1,borderBottomColor:"#e5e7eb",backgroundColor:"#ffffff"},selectedQueryRow:{backgroundColor:"#f3f4f6"},observerCount:{width:32,justifyContent:"center",alignItems:"center",marginRight:0},observerCountText:{fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},queryHash:{flex:1,fontFamily:"monospace",fontSize:14,color:"#1f2937",paddingVertical:8,paddingHorizontal:12,textAlignVertical:"center"},disabledIndicator:{backgroundColor:"#f3f4f6",borderRadius:4,paddingHorizontal:6,paddingVertical:2,marginLeft:8,alignSelf:"center"},disabledText:{fontSize:12,color:"#6b7280"}}),vt=yo;import{useEffect as ho,useState as mo}from"react";import{useQueryClient as Co}from"@tanstack/react-query";function bo(){let e=Co(),[r,o]=mo([]);return ho(()=>{let n=()=>{let a=e.getQueryCache().findAll();setTimeout(()=>{o(a)},1)};n();let i=e.getQueryCache().subscribe(n);return()=>i()},[e]),r}var Mt=bo;import{Text as xo,View as wo,StyleSheet as ko}from"react-native";import{jsx as Rt}from"react/jsx-runtime";var So={fresh:"#D1FADF",stale:"#FEF0C7",fetching:"#D1E9FF",paused:"#EBE9FE",noObserver:"#F2F4F7"},To={fresh:"#32D583",stale:"#FDB022",fetching:"#53B1FD",paused:"#9B8AFB",noObserver:"#344054"},vo={fresh:"#027A48",stale:"#B54708",fetching:"#175CD3",paused:"#5925DC",noObserver:"#344054"};function We({query:e}){let r=K(e),o=So[r],n=To[r],i=vo[r];return Rt(wo,{style:[Lt.container,{backgroundColor:o,borderColor:n}],children:Rt(xo,{style:[Lt.text,{color:i}],children:r})})}var Lt=ko.create({container:{padding:8,borderWidth:1,borderRadius:4,margin:4},text:{fontSize:12}});import{View as we,Text as ae,ScrollView as Mo,StyleSheet as Lo}from"react-native";import{jsx as _,jsxs as ke}from"react/jsx-runtime";function Ee({query:e}){if(e===void 0)return null;let r=new Date(e.state.dataUpdatedAt).toLocaleTimeString();return ke(we,{style:te.minWidth,children:[_(ae,{style:te.headerText,children:"Query Details"}),ke(we,{style:te.row,children:[_(Mo,{horizontal:!0,style:te.flexOne,children:_(ae,{style:te.queryKeyText,children:W(e.queryKey,!0)})}),_(We,{query:e})]}),ke(we,{style:te.row,children:[_(ae,{children:" Observers:"}),_(ae,{children:`${e.getObserversCount()}`})]}),ke(we,{style:te.row,children:[_(ae,{children:" Last Updated:"}),_(ae,{children:`${r}`})]})]})}var te=Lo.create({minWidth:{minWidth:200,fontSize:12,backgroundColor:"#FFFFFF",borderRadius:4},headerText:{textAlign:"left",backgroundColor:"#EAECF0",padding:8,fontWeight:"500"},row:{flexDirection:"row",justifyContent:"space-between",padding:8,borderBottomWidth:1,borderBottomColor:"#F3F4F6"},flexOne:{flex:1},queryKeyText:{flexWrap:"wrap",alignItems:"center",marginRight:8}});import{useQueryClient as Po}from"@tanstack/react-query";import{TouchableOpacity as Ro,Text as Fo,View as Vo,StyleSheet as Bo}from"react-native";import{jsx as Ft,jsxs as Qo}from"react/jsx-runtime";var Ao={btnRefetch:"#1570EF",btnInvalidate:"#DC6803",btnReset:"#475467",btnRemove:"#db2777",btnTriggerLoading:"#0891b2",btnTriggerLoadiError:"#ef4444"},Do={btnRefetch:"#1570EF",btnInvalidate:"#DC6803",btnReset:"#475467",btnRemove:"#db2777",btnTriggerLoading:"#0891b2",btnTriggerLoadiError:"#ef4444"};function J({onClick:e,text:r,textColorClass:o,bgColorClass:n,disabled:i}){let a=Ao[n],l=Do[o]||"#FFFFFF";return Qo(Ro,{disabled:i,onPress:e,style:[Oe.button,{opacity:i?.6:1}],children:[Ft(Vo,{style:[Oe.dot,{backgroundColor:l}]}),Ft(Fo,{style:[Oe.text,{color:l,opacity:i?.6:1}],children:r})]})}var Oe=Bo.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:4,borderWidth:1,borderColor:"#d0d5dd",backgroundColor:"#f2f4f7",height:32,paddingHorizontal:10,paddingVertical:6},dot:{width:6,height:6,borderRadius:999,marginRight:6},text:{fontSize:12,fontWeight:"400"}});function He({query:e}){if(e.state.data===void 0){let r=e.state,o=e.state.fetchMeta?e.state.fetchMeta.__previousQueryOptions:null;e.cancel({silent:!0}),e.setState({...r,fetchStatus:"idle",fetchMeta:null}),o&&e.fetch(o)}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 ze({query:e}){e.fetch().catch(o=>{console.error("Refetch error for query:",o)})}function Ue({query:e,queryClient:r}){r.resetQueries({queryKey:e.queryKey,exact:!0})}function Ge({query:e,queryClient:r}){r.removeQueries(e)}function je({query:e,queryClient:r}){r.invalidateQueries(e)}function Ne({query:e,queryClient:r}){if(e.state.status!=="error"){let o=new Error("Unknown error from devtools"),n=e.options;e.setState({status:"error",error:o,fetchMeta:{...e.state.fetchMeta,__previousQueryOptions:n}})}else r.resetQueries(e)}import{View as Io,Text as Wo,StyleSheet as Eo}from"react-native";import{jsx as oe,jsxs as Oo}from"react/jsx-runtime";function Ke({query:e,setSelectedQuery:r}){let o=Po();if(e===void 0)return null;let n=e.state.status;return Oo(Io,{style:Vt.container,children:[oe(Wo,{style:Vt.headerText,children:"Actions"}),oe(J,{disabled:K(e)==="fetching",onClick:()=>{ze({query:e})},bgColorClass:"btnRefetch",text:"Refetch",textColorClass:"btnRefetch"}),oe(J,{disabled:n==="pending",onClick:()=>{je({query:e,queryClient:o})},bgColorClass:"btnInvalidate",text:"Invalidate",textColorClass:"btnInvalidate"}),oe(J,{disabled:n==="pending",onClick:()=>{Ue({queryClient:o,query:e})},bgColorClass:"btnReset",text:"Reset",textColorClass:"btnReset"}),oe(J,{disabled:K(e)==="fetching",onClick:()=>{Ge({queryClient:o,query:e}),r(void 0)},bgColorClass:"btnRemove",text:"Remove",textColorClass:"btnRemove"}),oe(J,{disabled:!1,onClick:()=>{He({query:e})},bgColorClass:"btnTriggerLoading",text:e.state.data===void 0?"Restore Loading":"Trigger Loading",textColorClass:"btnTriggerLoading"}),oe(J,{disabled:n==="pending",onClick:()=>{Ne({query:e,queryClient:o})},bgColorClass:"btnTriggerLoadiError",text:n==="error"?"Restore":"Trigger Error",textColorClass:"btnTriggerLoadiError"})]})}var Vt=Eo.create({container:{minWidth:50,fontSize:12,flexDirection:"row",flexWrap:"wrap",backgroundColor:"#FFFFFF",borderRadius:4,gap:8,padding:8},headerText:{textAlign:"left",backgroundColor:"#EAECF0",padding:8,width:"100%",fontWeight:"500",marginBottom:8}});import{useState as Xe,useMemo as _e}from"react";import{useQueryClient as Se}from"@tanstack/react-query";import P,{Path as f,Line as qe,Rect as Ho,LinearGradient as v,Stop as d,Circle as Q,Defs as O,Mask as H,G as S,Ellipse as re}from"react-native-svg";import{Fragment as zo,jsx as t,jsxs as C}from"react/jsx-runtime";function Bt(){return t(P,{width:16,height:16,viewBox:"0 0 24 24",fill:"none",children:t(f,{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 At(){return t(P,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:t(f,{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 Dt(e){return t(P,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:t(f,{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 Qt(){return t(P,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:t(f,{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 Pt(){return C(P,{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#667085",strokeWidth:"2",children:[t(Ho,{width:"20",height:"20",y:"2",x:"2",rx:"2"}),t(qe,{y1:"7",y2:"7",x1:"6",x2:"18"}),t(qe,{y2:"12",y1:"12",x1:"6",x2:"18"}),t(qe,{y1:"17",y2:"17",x1:"6",x2:"18"})]})}function It(e){return t(zo,{children:e.checked?t(P,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t(f,{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(P,{viewBox:"0 0 24 24",height:"20",width:"20",fill:"none",children:t(f,{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 Wt(){return t(P,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(f,{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 Et(){return t(P,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(f,{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 Ot(){return t(P,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(f,{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 Ht(){return t(P,{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:t(f,{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 zt(){return C(P,{height:"100%",width:"100%",style:{position:"absolute"},viewBox:"0 0 633 633",children:[C(v,{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(d,{stopColor:"#6BDAFF",offset:0}),t(d,{stopColor:"#F9FFB5",offset:.32}),t(d,{stopColor:"#FFA770",offset:.71}),t(d,{stopColor:"#FF7373",offset:1})]}),t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"url(#a)"}),t(O,{}),t(H,{x:-137.5,y:412,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"c",children:t(S,{filter:"url(#b)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(S,{mask:"url(#c)",children:t(re,{cx:89.5,cy:610.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00CFE2",strokeWidth:25})}),t(O,{}),t(H,{x:316.5,y:412,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"e",children:t(S,{filter:"url(#d)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(S,{mask:"url(#e)",children:t(re,{cx:543.5,cy:610.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00CFE2",strokeWidth:25})}),t(O,{}),t(H,{x:-137.5,y:450,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"g",children:t(S,{filter:"url(#f)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(S,{mask:"url(#g)",children:t(re,{cx:89.5,cy:648.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00A8B8",strokeWidth:25})}),t(O,{}),t(H,{x:316.5,y:450,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"i",children:t(S,{filter:"url(#h)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(S,{mask:"url(#i)",children:t(re,{cx:543.5,cy:648.5,rx:214.5,ry:186,fill:"#015064",stroke:"#00A8B8",strokeWidth:25})}),t(O,{}),t(H,{x:-137.5,y:486,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"k",children:t(S,{filter:"url(#j)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(S,{mask:"url(#k)",children:t(re,{cx:89.5,cy:684.5,rx:214.5,ry:186,fill:"#015064",stroke:"#007782",strokeWidth:25})}),t(O,{}),t(H,{x:316.5,y:486,width:454,height:396.9,maskUnits:"userSpaceOnUse",id:"m",children:t(S,{filter:"url(#l)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),t(S,{mask:"url(#m)",children:t(re,{cx:543.5,cy:684.5,rx:214.5,ry:186,fill:"#015064",stroke:"#007782",strokeWidth:25})}),t(O,{}),t(H,{x:272.2,y:308,width:176.9,height:129.3,maskUnits:"userSpaceOnUse",id:"o",children:t(S,{filter:"url(#n)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),C(S,{mask:"url(#o)",children:[t(f,{fill:"none",stroke:"#000",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:11,d:"M436 403.2L431 431.8"}),t(f,{fill:"none",stroke:"#000",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:11,d:"M291 341.5L280 403.5"}),t(f,{fill:"none",stroke:"#000",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:11,d:"M332.9 384.1L328.6 411.2"}),C(v,{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(d,{stopColor:"#EE2700",offset:0}),t(d,{stopColor:"#FF008E",offset:1})]}),t(f,{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(f,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M428.2 384.5L429.1 378"}),t(f,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M395.2 379.5L396.1 373"}),t(f,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M362.2 373.5L363.1 367.4"}),t(f,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M324.2 351.3L328.4 347.4"}),t(f,{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:7,d:"M303.2 331.3L307.4 327.4"})]}),t(O,{}),t(H,{x:73.2,y:113.8,width:280.6,height:317.4,maskUnits:"userSpaceOnUse",id:"r",children:t(S,{filter:"url(#q)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),C(S,{mask:"url(#r)",children:[C(v,{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(d,{stopColor:"#A17500",offset:0}),t(d,{stopColor:"#5D2100",offset:1})]}),t(f,{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)"}),C(S,{stroke:"#2F8A00",children:[C(v,{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(d,{stopColor:"#2F8A00",offset:0}),t(d,{stopColor:"#90FF57",offset:1})]}),t(f,{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)"}),C(v,{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(d,{stopColor:"#2F8A00",offset:0}),t(d,{stopColor:"#90FF57",offset:1})]}),t(f,{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)"}),C(v,{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(d,{stopColor:"#2F8A00",offset:0}),t(d,{stopColor:"#90FF57",offset:1})]}),t(f,{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)"}),C(v,{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(d,{stopColor:"#2F8A00",offset:0}),t(d,{stopColor:"#90FF57",offset:1})]}),t(f,{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)"}),C(v,{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(d,{stopColor:"#2F8A00",offset:0}),t(d,{stopColor:"#90FF57",offset:1})]}),t(f,{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)"}),C(v,{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(d,{stopColor:"#2F8A00",offset:0}),t(d,{stopColor:"#90FF57",offset:1})]}),t(f,{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(f,{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(f,{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(O,{}),t(H,{x:50.5,y:399,width:532,height:633,maskUnits:"userSpaceOnUse",id:"A",children:t(S,{filter:"url(#z)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),C(S,{mask:"url(#A)",children:[C(v,{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(d,{stopColor:"#FFF400",offset:0}),t(d,{stopColor:"#3C8700",offset:1})]}),t(re,{cx:316.5,cy:715.5,rx:266,ry:316.5,fill:"url(#B)"})]}),t(O,{}),t(H,{x:391,y:-24,width:288,height:283,maskUnits:"userSpaceOnUse",id:"D",children:t(S,{filter:"url(#C)",children:t(Q,{cx:316.5,cy:316.5,r:316.5,fill:"#fff"})})}),C(S,{mask:"url(#D)",children:[C(v,{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(d,{stopColor:"#FFDF00",offset:0}),t(d,{stopColor:"#FF9D00",offset:1})]}),t(Q,{cx:565.5,cy:89.5,r:113.5,fill:"url(#E)"}),C(v,{x1:-644.5,x2:-645.77,y1:342,y2:342,gradientTransform:"matrix(30 0 0 1 19770 -253)",gradientUnits:"userSpaceOnUse",id:"F",children:[t(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#F)",d:"M427 89L397 89"}),C(v,{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(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#G)",d:"M430.5 55.5L404 50"}),C(v,{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(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#H)",d:"M431 122L402 130"}),C(v,{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(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#I)",d:"M442 153L418 166"}),C(v,{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(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#J)",d:"M464 180L444 199"}),C(v,{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(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#K)",d:"M491.4 203L477.5 225.9"}),C(v,{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(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#L)",d:"M524.5 219.5L517 244"}),C(v,{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(d,{stopColor:"#FFA400",offset:0}),t(d,{stopColor:"#FF5E00",offset:1})]}),t(f,{fill:"none",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:12,stroke:"url(#M)",d:"M564.5 228.5L565 253"})]})]})}var z=(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,...a]=r;return n.set(i,z(n.get(i),a,o)),n}if(e instanceof Set){let n=z(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,...a]=r;return n[i]=z(n[i],a,o),n}if(e instanceof Object){let n={...e};if(r.length===1)return n[r[0]]=o,n;let[i,...a]=r;return n[i]=z(n[i],a,o),n}return e};var se=(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,se(o.get(n),i)),o}if(e instanceof Set){let o=se(Array.from(e),r);return new Set(o)}if(Array.isArray(e)){let o=[...e];if(r.length===1)return o.filter((a,l)=>l.toString()!==r[0]);let[n,...i]=r;return o[n]=se(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]=se(o[n],i),o}return e};function $e({activeQuery:e,dataPath:r,queryClient:o}){if(!r){console.error("delete item data path is missing!");return}let n=e.state.data,i=se(n,r);o.setQueryData(e.queryKey,i)}import Ye,{Path as et}from"react-native-svg";import{Text as le,TextInput as jo,TouchableOpacity as X,View as B,StyleSheet as No,Alert as Ko}from"react-native";import{createContext as Uo,useContext as Go}from"react";var Ze=Uo({}),Ut=()=>Go(Ze);import{Fragment as Je,jsx as c,jsxs as L}from"react/jsx-runtime";function Gt(e){return Symbol.iterator in e}function qo(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 jt=({expanded:e})=>c(B,{style:[e?m.expanded:m.collapsed],children:c(Ye,{width:16,height:16,viewBox:"0 0 16 16",fill:"#98A2B3",children:c(et,{d:"M6 12l4-4-4-4"})})}),$o=({value:e})=>{let[r,o]=Xe("NoCopy"),{onCopy:n}=Ut(),i=async()=>{if(!n){Ko.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(a){console.error("Copy failed:",a),o("ErrorCopy"),setTimeout(()=>o("NoCopy"),1500)}};return L(X,{style:m.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"&&c(At,{}),r==="SuccessCopy"&&c(Dt,{theme:"light"}),r==="ErrorCopy"&&c(Qt,{})]})},Nt=({dataPath:e,activeQuery:r})=>{let o=Se();return r?c(X,{onPress:()=>{$e({queryClient:o,activeQuery:r,dataPath:e})},style:m.buttonStyle1,accessibilityLabel:"Delete item",children:c(Bt,{})}):null},Zo=({dataPath:e,activeQuery:r})=>{let o=Se();if(!r)return null;let n=()=>{let i=r.state.data,a=z(i,e,[]);o.setQueryData(r.queryKey,a)};return c(X,{style:m.buttonStyle2,"aria-label":"Remove all items",onPress:n,children:c(Pt,{})})},_o=({dataPath:e,activeQuery:r,value:o})=>{let n=Se();if(!r)return null;let i=()=>{let a=r.state.data,l=z(a,e,!o);n.setQueryData(r.queryKey,l)};return c(X,{style:m.buttonStyle3,"aria-label":"Toggle value",onPress:i,children:c(It,{checked:o,theme:"light"})})};function E({editable:e,label:r,value:o,defaultExpanded:n,activeQuery:i,dataPath:a,itemsDeletable:l}){let u=Se(),[b,h]=Xe((n||[]).includes(r)),w=()=>h(y=>!y),[R,x]=Xe([]),k=_e(()=>Array.isArray(o)?o.map((y,p)=>({label:p.toString(),value:y})):o!==null&&typeof o=="object"&&Gt(o)?o instanceof Map?Array.from(o,([y,p])=>({label:y.toString(),value:p})):Array.from(o,(y,p)=>({label:p.toString(),value:y})):typeof o=="object"&&o!==null?Object.entries(o).map(([y,p])=>({label:y,value:p})):[],[o]),s=_e(()=>Array.isArray(o)?"array":o!==null&&typeof o=="object"&&Gt(o)&&typeof o[Symbol.iterator]=="function"?"Iterable":typeof o=="object"&&o!==null?"object":typeof o,[o]),g=_e(()=>qo(k,100),[k]),T=a??[],V=(y,p)=>{if(!i)return null;let D=i.state.data;if(y&&isNaN(Number(p)))return;let Pe=s==="number"?Number(p):p,co=z(D,T,Pe);u.setQueryData(i.queryKey,co)};return c(B,{style:m.minWidthWrapper,children:L(B,{style:m.fullWidthMarginRight,children:[g.length>0&&L(Je,{children:[L(B,{style:m.flexRowItemsCenterGap,children:[L(X,{style:m.expanderButton,onPress:()=>w(),children:[c(jt,{expanded:b}),c(le,{children:r}),c(le,{style:m.textGray500,children:`${String(s).toLowerCase()==="iterable"?"(Iterable) ":""}${k.length} ${k.length>1?"items":"item"}`})]}),e&&L(B,{style:m.flexRowGapItemsCenter,children:[c($o,{value:o}),l&&i!==void 0&&c(Nt,{activeQuery:i,dataPath:T}),s==="array"&&i!==void 0&&c(Zo,{activeQuery:i,dataPath:T})]})]}),b&&L(Je,{children:[g.length===1&&c(B,{style:m.singleEntryContainer,children:k.map((y,p)=>c(E,{defaultExpanded:n,label:y.label,value:y.value,editable:e,dataPath:[...T,y.label],activeQuery:i,itemsDeletable:s==="array"||s==="Iterable"||s==="object"},y.label+p))}),g.length>1&&c(B,{style:m.multiEntryContainer,children:g.map((y,p)=>c(B,{children:L(B,{style:m.relativeOutlineNone,children:[L(X,{onPress:()=>x(D=>D.includes(p)?D.filter(Pe=>Pe!==p):[...D,p]),style:m.pageExpanderButton,children:[c(jt,{expanded:R.includes(p)}),L(le,{children:["[",p*100,"...",p*100+99,"]"]})]}),R.includes(p)&&c(B,{style:m.entriesContainer,children:y.map(D=>c(E,{defaultExpanded:n,label:D.label,value:D.value,editable:e,dataPath:[...T,D.label],activeQuery:i},D.label))})]})},p))})]})]}),g.length===0&&L(B,{style:m.flexRowGapFullWidth,children:[L(le,{style:m.text344054,children:[r,":"]}),e&&i!==void 0&&(s==="string"||s==="number"||s==="boolean")?L(Je,{children:[e&&i&&(s==="string"||s==="number")&&L(B,{style:m.inputContainer,children:[c(jo,{style:[m.textInput,s==="number"?m.textNumber:m.textString],keyboardType:s==="number"?"numeric":"default",value:o.toString(),onChangeText:y=>V(s==="number",y)}),s==="number"&&L(B,{style:m.numberInputButtons,children:[c(X,{style:m.touchableButton,onPressIn:()=>{let y=i.state.data,p=z(y,T,o+1);u.setQueryData(i.queryKey,p)},children:c(Ye,{fill:"none",viewBox:"0 0 24 24",stroke:"#6938EF",children:c(et,{d:"M4.5 15.75l7.5-7.5 7.5 7.5"})})}),c(X,{style:m.touchableButton,onPressIn:()=>{let y=i.state.data,p=z(y,T,o-1);u.setQueryData(i.queryKey,p)},children:c(Ye,{fill:"none",viewBox:"0 0 24 24",stroke:"#6938EF",children:c(et,{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})})]})]}),s==="boolean"&&L(B,{style:m.booleanContainer,children:[c(_o,{activeQuery:i,dataPath:T,value:o}),c(le,{style:m.booleanText,children:W(o)})]})]}):c(le,{style:m.displayValueText,children:W(o)}),e&&l&&i!==void 0&&c(Nt,{activeQuery:i,dataPath:T})]})]})})}var m=No.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:4},expanderButton:{flexDirection:"row",alignItems:"center",height:24,backgroundColor:"transparent",borderWidth:0,padding:2},textGray500:{color:"#6B7280",fontSize:12,marginLeft:4},flexRowGapItemsCenter:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:4},singleEntryContainer:{marginLeft:12,paddingLeft:16,borderLeftWidth:2,borderColor:"#D1D5DB"},multiEntryContainer:{marginLeft:12,paddingLeft:16,borderLeftWidth:2,borderColor:"#D1D5DB"},relativeOutlineNone:{position:"relative"},pageExpanderButton:{flexDirection:"row",alignItems:"center",backgroundColor:"transparent",borderWidth:0,padding:0},entriesContainer:{marginLeft:12,paddingLeft:16,borderLeftWidth:2,borderColor:"#D1D5DB"},flexRowGapFullWidth:{flexDirection:"row",width:"100%",alignItems:"center",marginVertical:6,lineHeight:44},text344054:{color:"#344054",height:"100%",marginRight:4},inputContainer:{flexDirection:"row",justifyContent:"space-between",borderWidth:0,height:28,margin:2,paddingVertical:4,paddingLeft:8,paddingRight:6,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:6,borderRadius:4,backgroundColor:"#F3F4F6",flex:1},booleanText:{marginLeft:8,color:"#6938EF"},displayValueText:{flex:1,color:"#6938EF",height:"100%"}});import{View as de,Text as Kt,ScrollView as Jo,StyleSheet as Xo}from"react-native";import{jsx as G,jsxs as tt}from"react/jsx-runtime";function ot({selectedQuery:e,setSelectedQuery:r}){return tt(Jo,{style:U.flexOne,contentContainerStyle:U.scrollContent,children:[G(de,{style:U.section,children:G(Ee,{query:e})}),G(de,{style:U.section,children:G(Ke,{query:e,setSelectedQuery:r})}),tt(de,{style:U.section,children:[G(Kt,{style:U.headerText,children:"Data Explorer"}),G(de,{style:U.contentView,children:G(E,{editable:!0,label:"Data",value:e?.state.data,defaultExpanded:["Data"],activeQuery:e})})]}),tt(de,{style:U.section,children:[G(Kt,{style:U.headerText,children:"Query Explorer"}),G(de,{style:U.contentView,children:G(E,{label:"Query",value:e,defaultExpanded:["Query","queryKey"],activeQuery:e})})]})]})}var U=Xo.create({flexOne:{flex:1},scrollContent:{paddingBottom:16},section:{marginBottom:12},headerText:{textAlign:"left",backgroundColor:"#EAECF0",padding:8,width:"100%",fontSize:12,fontWeight:"500"},contentView:{padding:8,backgroundColor:"#FAFAFA"}});import{jsx as $,jsxs as qt}from"react/jsx-runtime";function it({selectedQuery:e,setSelectedQuery:r}){let o=Mt(),n=ir.get("window").height,i=n*.4,a=150,l=n*.7,u=rt(new nt.Value(i)).current,[b,h]=Yo(i),w=rt(i),R=rt(nr.create({onMoveShouldSetPanResponder:(s,g)=>Math.abs(g.dy)>Math.abs(g.dx)&&Math.abs(g.dy)>10,onPanResponderGrant:()=>{u.stopAnimation(s=>{h(s),w.current=s,u.setValue(s)})},onPanResponderMove:(s,g)=>{let T=w.current-g.dy,V=Math.max(a,Math.min(l,T));u.setValue(V)},onPanResponderRelease:(s,g)=>{let T=Math.max(a,Math.min(l,w.current-g.dy));h(T),w.current=T,nt.timing(u,{toValue:T,duration:200,useNativeDriver:!1}).start(()=>{u.setValue(T),h(T),w.current=T})}})).current,x=s=>{if(s===e){r(void 0);return}r(s)},k=({item:s})=>$(vt,{query:s,isSelected:e===s,onSelect:x});return qt(or,{style:q.container,children:[$(me,{style:q.listContainer,children:o.length>0?$(er,{data:o,renderItem:k,keyExtractor:(s,g)=>`${JSON.stringify(s.queryKey)}-${g}`,contentContainerStyle:q.listContent}):$(me,{style:q.emptyContainer,children:$(rr,{style:q.emptyText,children:"No queries found"})})}),e&&qt(nt.View,{style:[q.queryInformation,{height:u}],children:[$(me,{style:q.dragHandle,...R.panHandlers,children:$(me,{style:q.dragIndicator})}),$(me,{style:q.queryInfoContent,children:$(ot,{selectedQuery:e,setSelectedQuery:r})})]})]})}var q=tr.create({container:{flex:1,width:"100%"},listContainer:{flex:1,width:"100%",backgroundColor:"#ffffff"},listContent:{flexGrow:1},emptyContainer:{flex:1,justifyContent:"center",alignItems:"center",padding:20},emptyText:{color:"#6b7280",fontSize:16},queryInformation:{borderTopWidth:2,borderTopColor:"#d0d5dd",backgroundColor:"#ffffff"},dragHandle:{height:20,justifyContent:"center",alignItems:"center",backgroundColor:"#f8f9fa",borderBottomWidth:1,borderBottomColor:"#e5e7eb"},dragIndicator:{width:50,height:4,backgroundColor:"#98a2b3",borderRadius:2,opacity:.8},queryInfoContent:{flex:1}});import ln,{Path as dn}from"react-native-svg";import{useState as Mr,useRef as ft}from"react";import{ScrollView as Lr,View as Le,StyleSheet as Rr,PanResponder as Fr,Animated as pt,Dimensions as Vr}from"react-native";import{TouchableOpacity as ar,Text as sr,View as lr,StyleSheet as dr}from"react-native";var j={purpleMutation:"#D9D6FE",purpleMutationText:"#5925DC",redMutation:"#fecaca",redMutationText:"#b91c1c",yellowMutation:"#FEDF89",yellowMutationText:"#B54708",greenMutation:"#A6F4C5",greenMutationText:"#027A48",grayMutation:"#eaecf0",grayMutationText:"#344054"},$t=({status:e,isPaused:r})=>{let o,n;return r?(o=j.purpleMutation,n=j.purpleMutationText):e==="error"?(o=j.redMutation,n=j.redMutationText):e==="pending"?(o=j.yellowMutation,n=j.yellowMutationText):e==="success"?(o=j.greenMutation,n=j.greenMutationText):(o=j.grayMutation,n=j.grayMutationText),{backgroundColor:o,textColor:n}};import{jsx as Ce,jsxs as Zt}from"react/jsx-runtime";function at({mutation:e,setSelectedMutation:r,selected:o}){let n=e.options.mutationKey?JSON.stringify(W(e.options.mutationKey,!1))+" - ":"",i=new Date(e.state.submittedAt).toLocaleString(),a=`${n}${i}`,{backgroundColor:l,textColor:u}=$t({isPaused:e.state.isPaused,status:e.state.status});return Zt(ar,{onPress:()=>r(e===o?void 0:e),style:[Te.button,o?.mutationId===e.mutationId&&Te.selected],children:[Zt(lr,{style:[Te.iconContainer,{backgroundColor:l}],children:[e.state.isPaused&&Ce(Ht,{}),e.state.status==="success"&&Ce(Wt,{}),e.state.status==="error"&&Ce(Ot,{}),e.state.status==="pending"&&Ce(Et,{})]}),Ce(sr,{style:[Te.text],children:a})]})}var Te=dr.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 Cr,Text as Me,View as Z,StyleSheet as br}from"react-native";import{View as lt,Text as ve,ScrollView as hr,StyleSheet as mr}from"react-native";import{Text as ur,View as cr,StyleSheet as fr}from"react-native";import{jsx as Jt}from"react/jsx-runtime";var pr={fresh:"#D1FADF",stale:"#FEF0C7",fetching:"#D1E9FF",paused:"#EBE9FE",inactive:"#F2F4F7"},yr={fresh:"#32D583",stale:"#FDB022",fetching:"#53B1FD",paused:"#9B8AFB",inactive:"#344054"},gr={fresh:"#027A48",stale:"#B54708",fetching:"#175CD3",paused:"#5925DC",inactive:"#344054"};function st({status:e}){let r=e==="pending"?"fetching":e==="idle"?"inactive":e==="error"?"stale":"fresh",o=pr[r],n=yr[r],i=gr[r];return Jt(cr,{style:[_t.container,{backgroundColor:o,borderColor:n}],children:Jt(ur,{style:[_t.text,{color:i}],children:e})})}var _t=fr.create({container:{padding:8,borderWidth:1,borderRadius:4,margin:4},text:{fontSize:12}});import{jsx as ue,jsxs as dt}from"react/jsx-runtime";function ut({selectedMutation:e}){if(e===void 0)return null;let r=new Date(e.state.submittedAt).toLocaleTimeString();return dt(lt,{style:I.container,children:[ue(ve,{style:[I.mutationDetailsText,I.bgEAECF0,I.p1],children:"Mutation Details"}),dt(lt,{style:[I.flexRow,I.justifyBetween,I.p1],children:[ue(hr,{horizontal:!0,style:I.flex1,children:ue(ve,{style:I.flexWrap,children:`${e.options.mutationKey?W(e.options.mutationKey,!0):"No mutationKey found"}`})}),ue(st,{status:e.state.status})]}),dt(lt,{style:[I.flexRow,I.justifyBetween,I.p1],children:[ue(ve,{children:"Submitted At:"}),ue(ve,{children:r})]})]})}var I=mr.create({container:{minWidth:200,fontSize:12,backgroundColor:"#FFFFFF",borderRadius:4},mutationDetailsText:{textAlign:"left",backgroundColor:"#EAECF0",padding:8,fontWeight:"500"},flexRow:{flexDirection:"row",justifyContent:"space-between",padding:8,borderBottomWidth:1,borderBottomColor:"#F3F4F6"},justifyBetween:{justifyContent:"space-between"},p1:{padding:8},flex1:{flex:1},flexWrap:{flexWrap:"wrap",alignItems:"center",marginRight:8},bgEAECF0:{backgroundColor:"#EAECF0"}});import{jsx as A,jsxs as be}from"react/jsx-runtime";function ct({selectedMutation:e}){return be(Cr,{style:F.flex1,contentContainerStyle:F.scrollContent,children:[A(Z,{style:F.section,children:A(ut,{selectedMutation:e})}),be(Z,{style:F.section,children:[A(Me,{style:F.textHeader,children:"Variables Details"}),A(Z,{style:F.padding,children:A(E,{label:"Variables",value:e?.state.variables,defaultExpanded:["Variables"]})})]}),be(Z,{style:F.section,children:[A(Me,{style:F.textHeader,children:"Context Details"}),A(Z,{style:F.padding,children:A(E,{label:"Context",value:e?.state.context,defaultExpanded:["Context"]})})]}),be(Z,{style:F.section,children:[A(Me,{style:F.textHeader,children:"Data Explorer"}),A(Z,{style:F.padding,children:A(E,{label:"Data",defaultExpanded:["Data"],value:e?.state.data})})]}),be(Z,{style:F.section,children:[A(Me,{style:F.textHeader,children:"Mutations Explorer"}),A(Z,{style:F.padding,children:A(E,{label:"Mutation",defaultExpanded:["Mutation"],value:e})})]})]})}var F=br.create({flex1:{flex:1},scrollContent:{paddingBottom:16},section:{marginBottom:12},textHeader:{textAlign:"left",backgroundColor:"#EAECF0",padding:8,width:"100%",fontSize:12,fontWeight:"500"},padding:{padding:8,backgroundColor:"#FAFAFA"}});import{useEffect as xr,useRef as wr,useState as kr}from"react";import{useQueryClient as Sr}from"@tanstack/react-query";import Tr from"fast-deep-equal";function vr(){let e=Sr(),[r,o]=kr([]),n=wr([]);return xr(()=>{let i=()=>{setTimeout(()=>{let l=[...e.getMutationCache().getAll()],u=l.map(b=>b.state);Tr(n.current,u)||(n.current=u,o(l))},1)};i();let a=e.getMutationCache().subscribe(i);return()=>a()},[e]),{mutations:r}}var Xt=vr;import{jsx as fe,jsxs as Yt}from"react/jsx-runtime";function yt({selectedMutation:e,setSelectedMutation:r}){let{mutations:o}=Xt(),n=Vr.get("window").height,i=n*.4,a=150,l=n*.7,u=ft(new pt.Value(i)).current,[b,h]=Mr(i),w=ft(i),R=ft(Fr.create({onMoveShouldSetPanResponder:(x,k)=>Math.abs(k.dy)>Math.abs(k.dx)&&Math.abs(k.dy)>10,onPanResponderGrant:()=>{u.stopAnimation(x=>{h(x),w.current=x,u.setValue(x)})},onPanResponderMove:(x,k)=>{let s=w.current-k.dy,g=Math.max(a,Math.min(l,s));u.setValue(g)},onPanResponderRelease:(x,k)=>{let s=Math.max(a,Math.min(l,w.current-k.dy));h(s),w.current=s,pt.timing(u,{toValue:s,duration:200,useNativeDriver:!1}).start(()=>{u.setValue(s),h(s),w.current=s})}})).current;return Yt(Le,{style:ce.container,children:[fe(Lr,{style:ce.scrollView,children:o.map((x,k)=>fe(at,{selected:e,setSelectedMutation:r,mutation:x},k))}),e&&Yt(pt.View,{style:[ce.mutationInfo,{height:u}],children:[fe(Le,{style:ce.dragHandle,...R.panHandlers,children:fe(Le,{style:ce.dragIndicator})}),fe(Le,{style:ce.mutationInfoContent,children:fe(ct,{selectedMutation:e})})]})]})}var ce=Rr.create({container:{flex:1,flexDirection:"column",width:"100%"},scrollView:{flex:1,flexDirection:"column"},mutationInfo:{borderTopWidth:2,borderTopColor:"#d0d5dd",backgroundColor:"#ffffff"},dragHandle:{height:20,justifyContent:"center",alignItems:"center",backgroundColor:"#f8f9fa",borderBottomWidth:1,borderBottomColor:"#e5e7eb"},dragIndicator:{width:50,height:4,backgroundColor:"#98a2b3",borderRadius:2,opacity:.8},mutationInfoContent:{flex:1}});import{View as Fe,TouchableOpacity as Ct,Text as Ve,StyleSheet as rn}from"react-native";import{View as Hr,StyleSheet as zr}from"react-native";import{useState as Br}from"react";import{View as gt,Text as ht,TouchableOpacity as Ar,StyleSheet as Dr}from"react-native";import{jsx as pe,jsxs as Pr}from"react/jsx-runtime";var Qr=({label:e,color:r,count:o,showLabel:n=!0})=>{let[i,a]=Br(!1),l=(u,b)=>({green:{100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",700:"#15803d",900:"#14532d"},yellow:{100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",700:"#a16207",900:"#713f12"},gray:{100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",700:"#374151",900:"#111827"},blue:{100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",700:"#1d4ed8",900:"#1e3a8a"},purple:{100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",700:"#7e22ce",900:"#581c87"},red:{100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",700:"#b91c1c",900:"#7f1d1d"}})[u]?.[b]||"#000000";return Pr(Ar,{style:[Y.queryStatusTag,!n&&Y.clickable],disabled:n,onPressIn:()=>a(!0),onPressOut:()=>a(!1),activeOpacity:.7,children:[!n&&i&&pe(gt,{style:Y.tooltip,children:pe(ht,{style:Y.tooltipText,children:e})}),pe(gt,{style:[Y.dot,{backgroundColor:l(r,"500")}]}),n&&pe(ht,{style:Y.label,children:e}),pe(gt,{style:[Y.countContainer,o>0&&r!=="gray"&&{backgroundColor:l(r,"100")}],children:pe(ht,{style:[Y.count,o>0&&r!=="gray"&&{color:l(r,"700")}],children:o})})]})},Y=Dr.create({queryStatusTag:{flexDirection:"row",gap:6,height:26,backgroundColor:"#f9fafb",borderRadius:4,padding:4,paddingLeft:6,alignItems:"center",fontWeight:"500",borderWidth:1,borderColor:"#e5e7eb",position:"relative"},clickable:{},dot:{width:6,height:6,borderRadius:3},label:{fontSize:12},countContainer:{fontSize:12,paddingHorizontal:5,alignItems:"center",justifyContent:"center",backgroundColor:"#e5e7eb",borderRadius:2,height:18},count:{fontSize:12,color:"#6b7280",fontVariant:["tabular-nums"]},tooltip:{position:"absolute",zIndex:1,backgroundColor:"#f9fafb",top:"100%",left:"50%",transform:[{translateX:-50},{translateY:8}],padding:2,paddingHorizontal:8,borderRadius:4,borderWidth:1,borderColor:"#9ca3af"},tooltipText:{fontSize:12}}),ye=Qr;import{useEffect as Ir,useState as Wr}from"react";import{useQueryClient as Er}from"@tanstack/react-query";function Or(){let e=Er(),[r,o]=Wr({fresh:0,stale:0,fetching:0,paused:0,inactive:0});return Ir(()=>{let n=()=>{let l=e.getQueryCache().getAll().reduce((u,b)=>{let h=K(b);return u[h]=(u[h]||0)+1,u},{fresh:0,stale:0,fetching:0,paused:0,inactive:0});o(l)};n();let i=e.getQueryCache().subscribe(n);return()=>i()},[e]),r}var eo=Or;import{jsx as xe,jsxs as jr}from"react/jsx-runtime";var Ur=()=>{let{fresh:e,stale:r,fetching:o,paused:n,inactive:i}=eo();return jr(Hr,{style:Gr.queryStatusContainer,children:[xe(ye,{label:"Fresh",color:"green",count:e}),xe(ye,{label:"Loading",color:"blue",count:o}),xe(ye,{label:"Paused",color:"purple",count:n}),xe(ye,{label:"Stale",color:"yellow",count:r}),xe(ye,{label:"Idle",color:"gray",count:i})]})},Gr=zr.create({queryStatusContainer:{flexDirection:"row",flexWrap:"wrap",gap:4,alignItems:"center",justifyContent:"center",paddingVertical:2,paddingHorizontal:4}}),to=Ur;import{TouchableOpacity as Nr,StyleSheet as Kr}from"react-native";import{Svg as ro,Path as mt}from"react-native-svg";import{jsx as ne,jsxs as _r}from"react/jsx-runtime";var qr=({isOffline:e,onToggle:r})=>ne(Nr,{style:[oo.button,e&&oo.offlineButton],onPress:r,activeOpacity:.7,accessibilityLabel:e?"Unset offline mocking behavior":"Mock offline behavior",accessibilityRole:"button",accessibilityState:{selected:e},children:e?ne(Zr,{}):ne($r,{})}),$r=()=>_r(ro,{width:16,height:16,viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:0,children:[ne(mt,{fill:"none",d:"M0 0h24v24H0z"}),ne(mt,{fill:"#4b5563",d:"M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3a4.237 4.237 0 00-6 0zm-4-4l2 2a7.074 7.074 0 0110 0l2-2C15.14 9.14 8.87 9.14 5 13z"})]}),Zr=()=>ne(ro,{width:16,height:16,viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:0,children:ne(mt,{fill:"#ef4444",d:"M24 8.98A16.88 16.88 0 0 0 12 4C7.31 4 3.07 5.9 0 8.98L12 21v-9h8.99L24 8.98zM19.59 14l-2.09 2.09L15.41 14 14 15.41l2.09 2.09L14 19.59 15.41 21l2.09-2.08L19.59 21 21 19.59l-2.08-2.09L21 15.41 19.59 14z"})}),oo=Kr.create({button:{width:24,height:24,borderRadius:4,backgroundColor:"#f9fafb",justifyContent:"center",alignItems:"center",borderWidth:1,borderColor:"#e5e7eb"},offlineButton:{backgroundColor:"#fee2e2",borderColor:"#fca5a5"}}),no=qr;import{TouchableOpacity as Jr,StyleSheet as Xr}from"react-native";import{Svg as Yr,Path as en}from"react-native-svg";import{jsx as Re}from"react/jsx-runtime";var tn=({type:e,onClear:r,disabled:o=!1})=>Re(Jr,{style:[io.button,o&&io.disabledButton],onPress:r,disabled:o,activeOpacity:.7,accessibilityLabel:`Clear ${e} cache`,accessibilityRole:"button",accessibilityState:{disabled:o},children:Re(on,{})}),on=()=>Re(Yr,{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:Re(en,{stroke:"#4b5563",d: