react-native-inapp-inspector 2.3.20 → 2.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +14 -14
  2. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +58 -1
  3. package/dist/commonjs/components/AppHeaderLogo.js +2 -2
  4. package/dist/commonjs/components/ConsoleLogCard.js +1 -1
  5. package/dist/commonjs/components/HighlightText.js +13 -13
  6. package/dist/commonjs/components/Inspector/AboutModal.js +143 -251
  7. package/dist/commonjs/components/Inspector/DebuggingTab.js +19 -13
  8. package/dist/commonjs/components/Inspector/InspectorHeader.js +54 -80
  9. package/dist/commonjs/components/Inspector/MainScreen.js +13 -23
  10. package/dist/commonjs/components/Inspector/MediaGalleryTab.js +4 -4
  11. package/dist/commonjs/components/Inspector/MediaPreviewModal.js +1 -1
  12. package/dist/commonjs/components/Inspector/NpmStarPrompt.js +1 -1
  13. package/dist/commonjs/components/Inspector/TabBar.js +7 -7
  14. package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +23 -24
  15. package/dist/commonjs/components/LogCard.js +16 -16
  16. package/dist/commonjs/components/NetworkIcons.d.ts +10 -0
  17. package/dist/commonjs/components/NetworkIcons.js +46 -4
  18. package/dist/commonjs/components/QRCodeView.js +2 -2
  19. package/dist/commonjs/components/TreeNode.js +16 -16
  20. package/dist/commonjs/constants/version.d.ts +1 -1
  21. package/dist/commonjs/constants/version.js +1 -1
  22. package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -1
  23. package/dist/commonjs/helpers/index.d.ts +1 -0
  24. package/dist/commonjs/helpers/index.js +2 -2
  25. package/dist/commonjs/index.js +1 -1
  26. package/dist/commonjs/native/NativeInspector.d.ts +1 -0
  27. package/dist/commonjs/native/NativeInspector.js +1 -1
  28. package/dist/commonjs/types/interfaces.d.ts +0 -2
  29. package/dist/esm/components/AppHeaderLogo.js +6 -6
  30. package/dist/esm/components/ConsoleLogCard.js +6 -6
  31. package/dist/esm/components/HighlightText.js +17 -17
  32. package/dist/esm/components/Inspector/AboutModal.js +205 -313
  33. package/dist/esm/components/Inspector/DebuggingTab.js +32 -26
  34. package/dist/esm/components/Inspector/InspectorHeader.js +96 -122
  35. package/dist/esm/components/Inspector/MainScreen.js +66 -76
  36. package/dist/esm/components/Inspector/MediaGalleryTab.js +19 -19
  37. package/dist/esm/components/Inspector/MediaPreviewModal.js +18 -18
  38. package/dist/esm/components/Inspector/NpmStarPrompt.js +1 -1
  39. package/dist/esm/components/Inspector/TabBar.js +21 -21
  40. package/dist/esm/components/Inspector/UpdateAvailableModal.js +65 -66
  41. package/dist/esm/components/LogCard.js +43 -43
  42. package/dist/esm/components/NetworkIcons.d.ts +10 -0
  43. package/dist/esm/components/NetworkIcons.js +191 -149
  44. package/dist/esm/components/QRCodeView.js +4 -4
  45. package/dist/esm/components/TreeNode.js +53 -53
  46. package/dist/esm/constants/version.d.ts +1 -1
  47. package/dist/esm/constants/version.js +1 -1
  48. package/dist/esm/customHooks/bundleAnalyzer.js +1 -1
  49. package/dist/esm/helpers/index.d.ts +1 -0
  50. package/dist/esm/helpers/index.js +4 -4
  51. package/dist/esm/index.js +7 -7
  52. package/dist/esm/native/NativeInspector.d.ts +1 -0
  53. package/dist/esm/native/NativeInspector.js +1 -1
  54. package/dist/esm/types/interfaces.d.ts +0 -2
  55. package/ios/NetworkInspectorModule.mm +39 -3
  56. package/package.json +1 -1
  57. package/src/native/NativeInspector.ts +18 -0
  58. package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +0 -16
  59. package/dist/commonjs/components/Inspector/FeedbackModal.js +0 -198
  60. package/dist/esm/components/Inspector/FeedbackModal.d.ts +0 -16
  61. package/dist/esm/components/Inspector/FeedbackModal.js +0 -198
@@ -1,8 +1,8 @@
1
- import{useMemo as V}from"react";import{View as G,StyleSheet as M}from"react-native";import O,{Rect as F,G as Q}from"react-native-svg";import{generateQRMatrix as b}from"../helpers/qrGenerator";import{AppColors as j}from"../styles/AppColors";export const QRCodeView=({value:r,size:t=200,color:R="#000000",backgroundColor:i="#FFFFFF"})=>{const n=V(()=>b(r||"http://localhost:8081"),[r]),C=n.length||21,o=4,S=C+o*2,e=t/S;return<G style={[k.container,{width:t+20,height:t+20,backgroundColor:i}]}>
1
+ import{useMemo as b}from"react";import{View as G,StyleSheet as M}from"react-native";import O,{Rect as R,G as Q}from"react-native-svg";import{generateQRMatrix as j}from"../helpers/qrGenerator";import{AppColors as i}from"../styles/AppColors";export const QRCodeView=({value:r,size:t=200,color:C=i.black,backgroundColor:n=i.white})=>{const h=b(()=>j(r||"http://localhost:8081"),[r]),S=h.length||21,o=4,$=S+o*2,e=t/$;return<G style={[A.container,{width:t+20,height:t+20,backgroundColor:n}]}>
2
2
  <O width={t}height={t}viewBox={`0 0 ${t} ${t}`}>
3
- <F width={t}height={t}fill={i}/>
3
+ <R width={t}height={t}fill={n}/>
4
4
  <Q>
5
- {n.map(($,h)=>$.map((v,l)=>v?<F key={`${h}-${l}`}x={(l+o)*e}y={(h+o)*e}width={e+.3}height={e+.3}fill={R}/>:null))}
5
+ {h.map((v,l)=>v.map((V,a)=>V?<R key={`${l}-${a}`}x={(a+o)*e}y={(l+o)*e}width={e+.3}height={e+.3}fill={C}/>:null))}
6
6
  </Q>
7
7
  </O>
8
- </G>};const k=M.create({container:{padding:10,borderRadius:14,alignItems:"center",justifyContent:"center",shadowColor:j.black,shadowOffset:{width:0,height:3},shadowOpacity:.15,shadowRadius:8,elevation:4}});export default QRCodeView;
8
+ </G>};const A=M.create({container:{padding:10,borderRadius:14,alignItems:"center",justifyContent:"center",shadowColor:i.black,shadowOffset:{width:0,height:3},shadowOpacity:.15,shadowRadius:8,elevation:4}});export default QRCodeView;
@@ -1,60 +1,60 @@
1
- import G,{useState as J,useEffect as _}from"react";import{Text as S,View as F,Image as Q,Pressable as U,StyleSheet as X,Platform as Y}from"react-native";import{escapeRegex as Z}from"../helpers";import{ChevronIcon as Fe,DocIcon as Se}from"./NetworkIcons";import{AppColors as Te}from"../styles/AppColors";const T=Y.select({ios:"Menlo",android:"monospace",default:"monospace"}),E=G.memo(({level:P})=>{if(P<=0)return null;const h=[];for(let C=0;C<P;C++)h.push(<F key={C}style={e.indentGuideCell}>
2
- <F style={e.indentGuideLine}/>
3
- </F>);return<F style={e.indentGuidesContainer}>{h}</F>}),Ce=G.memo(function P({data:h,name:C,level:z=0,search:R,forceOpen:N,defaultExpandDepth:D=1}){const[K,v]=J(()=>N!==void 0?N:D!==void 0?z<D:z<1),L=K;_(()=>{N!==void 0&&v(N)},[N]);const I=typeof h=="object"&&h!==null,B=Array.isArray(h);function $(t){return t==null?e.syntaxNull:typeof t=="number"?e.syntaxNumber:typeof t=="boolean"?e.syntaxBoolean:e.syntaxString}function H(t,V){const j=$(V);if(t==="null"||t==="undefined")return[<S key="nil"style={e.syntaxNull}>
1
+ import A,{useState as _,useEffect as q}from"react";import{Text as C,View as S,Image as Q,Pressable as U,StyleSheet as X,Platform as Y}from"react-native";import{escapeRegex as Z}from"../helpers";import{ChevronIcon as Se,DocIcon as Te}from"./NetworkIcons";import{AppColors as r}from"../styles/AppColors";const V=Y.select({ios:"Menlo",android:"monospace",default:"monospace"}),F=A.memo(({level:W})=>{if(W<=0)return null;const T=[];for(let P=0;P<W;P++)T.push(<S key={P}style={e.indentGuideCell}>
2
+ <S style={e.indentGuideLine}/>
3
+ </S>);return<S style={e.indentGuidesContainer}>{T}</S>}),Ce=A.memo(function W({data:T,name:P,level:z=0,search:B,forceOpen:N,defaultExpandDepth:v=1}){const[H,G]=_(()=>N!==void 0?N:v!==void 0?z<v:z<1),L=H;q(()=>{N!==void 0&&G(N)},[N]);const D=typeof T=="object"&&T!==null,R=Array.isArray(T);function M(t){return t==null?e.syntaxNull:typeof t=="number"?e.syntaxNumber:typeof t=="boolean"?e.syntaxBoolean:e.syntaxString}function O(t,k){const K=M(k);if(t==="null"||t==="undefined")return[<C key="nil"style={e.syntaxNull}>
4
4
  {t}
5
- </S>];if(!R)return[<S key="plain"style={j}>
5
+ </C>];if(!B)return[<C key="plain"style={K}>
6
6
  {t}
7
- </S>];const O=new RegExp(`(${Z(R)})`,"gi");return t.split(O).map((k,A)=>k.toLowerCase()===R.toLowerCase()?<S key={A}style={e.highlight}>
8
- {k}
9
- </S>:<S key={A}style={j}>
10
- {k}
11
- </S>)}if(I&&h._isFile){const t=h,V=t.type?.includes("image");return<F style={e.treeNodeWrapper}>
12
- <E level={z}/>
13
- <F style={e.filePreviewNode}>
14
- {C!==void 0&&<S style={[e.codeKey,{marginBottom:4}]}>{`"${String(C)}": `}</S>}
15
- <F style={e.filePreviewCard}>
16
- {V?<Q source={{uri:t.uri}}style={e.filePreviewThumb}resizeMode="cover"/>:<F style={e.filePreviewDoc}>
17
- <Se color={Te.slate400}size={18}/>
18
- </F>}
19
- <F style={{flex:1}}>
20
- <S style={e.filePreviewName}numberOfLines={1}>
7
+ </C>];const J=new RegExp(`(${Z(B)})`,"gi");return t.split(J).map((j,$)=>j.toLowerCase()===B.toLowerCase()?<C key={$}style={e.highlight}>
8
+ {j}
9
+ </C>:<C key={$}style={K}>
10
+ {j}
11
+ </C>)}if(D&&T._isFile){const t=T,k=t.type?.includes("image");return<S style={e.treeNodeWrapper}>
12
+ <F level={z}/>
13
+ <S style={e.filePreviewNode}>
14
+ {P!==void 0&&<C style={[e.codeKey,{marginBottom:4}]}>{`"${String(P)}": `}</C>}
15
+ <S style={e.filePreviewCard}>
16
+ {k?<Q source={{uri:t.uri}}style={e.filePreviewThumb}resizeMode="cover"/>:<S style={e.filePreviewDoc}>
17
+ <Te color={r.slate400}size={18}/>
18
+ </S>}
19
+ <S style={{flex:1}}>
20
+ <C style={e.filePreviewName}numberOfLines={1}>
21
21
  {t.name}
22
- </S>
23
- <S style={e.filePreviewType}>{t.type}</S>
24
- </F>
25
- </F>
26
- </F>
27
- </F>}if(!I){const t=JSON.stringify(h)??String(h),V=C!==void 0?`"${String(C)}": `:null;return<F style={e.treeNodeWrapper}>
28
- <E level={z}/>
29
- <F style={e.leafRow}>
30
- <S selectable={!0}style={e.codeLine}>
31
- {V&&<S style={e.codeKey}>{V}</S>}
32
- {H(t,h)}
33
- </S>
34
- </F>
35
- </F>}const W=B?h.map((t,V)=>[V,t]):Object.entries(h),M=B?`[${W.length}]`:`{${W.length}}`;return<F>
36
- <F style={e.treeNodeWrapper}>
37
- <E level={z}/>
38
- <U style={e.treeRow}onPress={()=>v(t=>!t)}hitSlop={{top:8,bottom:8,left:8,right:8}}>
39
- <F style={{transform:[{rotate:L?"180deg":"0deg"}],marginRight:6}}>
40
- <Fe color="#64748B"size={11}/>
41
- </F>
42
- {C!==void 0&&<S style={[e.codeKey,e.treeKeyMargin]}>{`"${String(C)}": `}</S>}
43
- <S style={e.codeSyntax}>{B?"[":"{"}</S>
44
- <F style={B?e.arrayBadge:e.objectBadge}>
45
- <S style={B?e.arrayBadgeText:e.objectBadgeText}>
46
- {M}
22
+ </C>
23
+ <C style={e.filePreviewType}>{t.type}</C>
47
24
  </S>
48
- </F>
25
+ </S>
26
+ </S>
27
+ </S>}if(!D){const t=JSON.stringify(T)??String(T),k=P!==void 0?`"${String(P)}": `:null;return<S style={e.treeNodeWrapper}>
28
+ <F level={z}/>
29
+ <S style={e.leafRow}>
30
+ <C selectable={!0}style={e.codeLine}>
31
+ {k&&<C style={e.codeKey}>{k}</C>}
32
+ {O(t,T)}
33
+ </C>
34
+ </S>
35
+ </S>}const I=R?T.map((t,k)=>[k,t]):Object.entries(T),E=R?`[${I.length}]`:`{${I.length}}`;return<S>
36
+ <S style={e.treeNodeWrapper}>
37
+ <F level={z}/>
38
+ <U style={e.treeRow}onPress={()=>G(t=>!t)}hitSlop={{top:8,bottom:8,left:8,right:8}}>
39
+ <S style={{transform:[{rotate:L?"180deg":"0deg"}],marginRight:6}}>
40
+ <Se color={r.grayTextWeak}size={11}/>
41
+ </S>
42
+ {P!==void 0&&<C style={[e.codeKey,e.treeKeyMargin]}>{`"${String(P)}": `}</C>}
43
+ <C style={e.codeSyntax}>{R?"[":"{"}</C>
44
+ <S style={R?e.arrayBadge:e.objectBadge}>
45
+ <C style={R?e.arrayBadgeText:e.objectBadgeText}>
46
+ {E}
47
+ </C>
48
+ </S>
49
49
  </U>
50
- </F>
50
+ </S>
51
51
 
52
- {L&&W.map(([t,V])=><P key={String(t)}name={t}data={V}level={z+1}search={R}forceOpen={N}defaultExpandDepth={D}/>)}
52
+ {L&&I.map(([t,k])=><W key={String(t)}name={t}data={k}level={z+1}search={B}forceOpen={N}defaultExpandDepth={v}/>)}
53
53
 
54
- {L&&<F style={e.treeNodeWrapper}>
55
- <E level={z}/>
56
- <F style={{paddingLeft:18}}>
57
- <S style={e.codeSyntax}>{B?"]":"}"}</S>
58
- </F>
59
- </F>}
60
- </F>}),e=X.create({treeNodeWrapper:{flexDirection:"row",alignItems:"stretch"},indentGuidesContainer:{flexDirection:"row",alignItems:"stretch"},indentGuideCell:{width:14,alignItems:"flex-start",justifyContent:"center",position:"relative"},indentGuideLine:{position:"absolute",left:4,top:0,bottom:0,width:1,backgroundColor:"#E2E8F0"},leafRow:{paddingVertical:2,flex:1},treeRow:{flexDirection:"row",alignItems:"center",paddingVertical:3,flex:1},treeKeyMargin:{marginRight:2},codeLine:{fontFamily:T,fontSize:12,lineHeight:18,color:"#0F172A"},codeKey:{fontFamily:T,fontSize:12,color:"#4F46E5",fontWeight:"600"},codeSyntax:{fontFamily:T,fontSize:12,color:"#64748B"},syntaxString:{fontFamily:T,fontSize:12,color:"#059669"},syntaxNumber:{fontFamily:T,fontSize:12,color:"#D97706"},syntaxBoolean:{fontFamily:T,fontSize:12,color:"#DB2777"},syntaxNull:{fontFamily:T,fontSize:12,color:"#E11D48",fontStyle:"italic"},highlight:{backgroundColor:"#FEF08A",color:"#854D0E",fontFamily:T,fontWeight:"700",borderRadius:2},arrayBadge:{backgroundColor:"#EEF2FF",borderColor:"#C7D2FE",borderWidth:1,borderRadius:5,paddingHorizontal:5,paddingVertical:1,marginLeft:6},arrayBadgeText:{fontFamily:T,color:"#4F46E5",fontSize:10,fontWeight:"600"},objectBadge:{backgroundColor:"#F1F5F9",borderColor:"#CBD5E1",borderWidth:1,borderRadius:5,paddingHorizontal:5,paddingVertical:1,marginLeft:6},objectBadgeText:{fontFamily:T,color:"#475569",fontSize:10,fontWeight:"600"},filePreviewNode:{marginVertical:4},filePreviewCard:{flexDirection:"row",alignItems:"center",backgroundColor:"#FFFFFF",borderRadius:8,borderWidth:1,borderColor:"#E2E8F0",padding:8,gap:8,marginTop:2},filePreviewThumb:{width:36,height:36,borderRadius:4},filePreviewDoc:{width:36,height:36,borderRadius:4,backgroundColor:"#F1F5F9",alignItems:"center",justifyContent:"center"},filePreviewName:{fontFamily:T,fontSize:11.5,color:"#0F172A"},filePreviewType:{fontFamily:T,fontSize:10,color:"#64748B",marginTop:2}});export default Ce;
54
+ {L&&<S style={e.treeNodeWrapper}>
55
+ <F level={z}/>
56
+ <S style={{paddingLeft:18}}>
57
+ <C style={e.codeSyntax}>{R?"]":"}"}</C>
58
+ </S>
59
+ </S>}
60
+ </S>}),e=X.create({treeNodeWrapper:{flexDirection:"row",alignItems:"stretch"},indentGuidesContainer:{flexDirection:"row",alignItems:"stretch"},indentGuideCell:{width:14,alignItems:"flex-start",justifyContent:"center",position:"relative"},indentGuideLine:{position:"absolute",left:4,top:0,bottom:0,width:1,backgroundColor:r.dividerColor},leafRow:{paddingVertical:2,flex:1},treeRow:{flexDirection:"row",alignItems:"center",paddingVertical:3,flex:1},treeKeyMargin:{marginRight:2},codeLine:{fontFamily:V,fontSize:12,lineHeight:18,color:r.primaryBlack},codeKey:{fontFamily:V,fontSize:12,color:r.brandPurple,fontWeight:"600"},codeSyntax:{fontFamily:V,fontSize:12,color:r.grayTextWeak},syntaxString:{fontFamily:V,fontSize:12,color:r.emerald600},syntaxNumber:{fontFamily:V,fontSize:12,color:r.amber600},syntaxBoolean:{fontFamily:V,fontSize:12,color:r.pink600},syntaxNull:{fontFamily:V,fontSize:12,color:r.rose600,fontStyle:"italic"},highlight:{backgroundColor:r.yellow200,color:r.yellow800,fontFamily:V,fontWeight:"700",borderRadius:2},arrayBadge:{backgroundColor:r.purple50,borderColor:r.purple200,borderWidth:1,borderRadius:5,paddingHorizontal:5,paddingVertical:1,marginLeft:6},arrayBadgeText:{fontFamily:V,color:r.brandPurple,fontSize:10,fontWeight:"600"},objectBadge:{backgroundColor:r.graySurface,borderColor:r.grayBorderSecondary,borderWidth:1,borderRadius:5,paddingHorizontal:5,paddingVertical:1,marginLeft:6},objectBadgeText:{fontFamily:V,color:r.grayText,fontSize:10,fontWeight:"600"},filePreviewNode:{marginVertical:4},filePreviewCard:{flexDirection:"row",alignItems:"center",backgroundColor:r.primaryLight,borderRadius:8,borderWidth:1,borderColor:r.dividerColor,padding:8,gap:8,marginTop:2},filePreviewThumb:{width:36,height:36,borderRadius:4},filePreviewDoc:{width:36,height:36,borderRadius:4,backgroundColor:r.graySurface,alignItems:"center",justifyContent:"center"},filePreviewName:{fontFamily:V,fontSize:11.5,color:r.primaryBlack},filePreviewType:{fontFamily:V,fontSize:10,color:r.grayTextWeak,marginTop:2}});export default Ce;
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "2.3.20";
1
+ export declare const LIB_VERSION = "2.3.22";
@@ -1 +1 @@
1
- export const LIB_VERSION="2.3.20";
1
+ export const LIB_VERSION="2.3.22";
@@ -1 +1 @@
1
- import{AppColors as d}from"../styles/AppColors";import{t as r}from"../i18n";import{NativeModules as I,Platform as F,TurboModuleRegistry as ye}from"react-native";let A=null,z=!1;const T=[];let le=!1;export const setBundleModuleEnabled=e=>{le=e},getBundleModuleEnabled=()=>le;const Ne=()=>{try{const e=I?.SourceCode,n=e?.scriptURL||e?.getConstants?.()?.scriptURL;if(typeof n=="string"&&n.length>0)return{scriptURL:n}}catch{}try{const e=ye?.get?.("SourceCode"),n=e?.getConstants?.(),o=e?.scriptURL||n?.scriptURL;if(typeof o=="string"&&o.length>0)return{scriptURL:o}}catch{}return null};export const getHostScriptURL=()=>{try{const e=Ne()?.scriptURL;if(typeof e=="string"&&e.length>0)return e}catch{}try{const e=I?.PlatformConstants?.serverHost||I?.AndroidConstants?.serverHost||I?.DevSettings?.serverHost||I?.DevSettings?.getConstants?.()?.serverHost;if(typeof e=="string"&&e.length>0)return`${e.startsWith("http")?e:`http://${e}`}/index.bundle?platform=${F.OS}&dev=true`}catch{}try{const e=globalThis?.__DEV_SERVER_URL__||globalThis?.__METRO_SERVER_HOST__||globalThis?.__DEV_SERVER_PORT__||globalThis?.__METRO_PORT__;if(typeof e=="number")return`http://${F.OS==="android"?"10.0.2.2":"localhost"}:${e}/index.bundle?platform=${F.OS}&dev=true`;if(typeof e=="string"&&e.length>0)return/^\d+$/.test(e)?`http://${F.OS==="android"?"10.0.2.2":"localhost"}:${e}/index.bundle?platform=${F.OS}&dev=true`:e.startsWith("http")?e:`http://${e}/index.bundle?platform=${F.OS}&dev=true`}catch{}return""};const ue=[8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,19e3,19001,3e3],_e=e=>{if(!e||typeof e!="string")return{host:null,port:null};const n=e.match(/^https?:\/\/([^:/]+)(?::(\d+))?/);return n?{host:n[1]||null,port:n[2]?parseInt(n[2],10):null}:{host:null,port:null}},Fe=async(e,n=3e3)=>{const{host:o,port:l}=_e(e);if(e&&e.startsWith("http"))try{const b=new AbortController,k=setTimeout(()=>b.abort(),n),g=await fetch(e,{signal:b.signal});if(clearTimeout(k),g.ok){const f=g.headers.get("content-length"),x=await g.text();if(x&&x.length>0){const M=f&&parseInt(f,10)||x.length;return{text:x,bytes:M,url:e}}}}catch{}const a=o?[o,"localhost","127.0.0.1",...F.OS==="android"?["10.0.2.2","10.0.3.2"]:[]]:["localhost","127.0.0.1",...F.OS==="android"?["10.0.2.2","10.0.3.2"]:[]],m=Array.from(new Set(a)),h=l?Array.from(new Set([l,...ue])):ue,c=[];for(const b of m)for(const k of h)c.push(new Promise(async(g,f)=>{const x=new AbortController,M=setTimeout(()=>x.abort(),700);try{const j=await fetch(`http://${b}:${k}/status`,{signal:x.signal});if(clearTimeout(M),j.ok){const C=await j.text();if(C&&C.includes("packager-status:running")){g({host:b,port:k});return}}}catch{clearTimeout(M)}f(new Error("unreachable"))}));let u=null;try{u=await new Promise((b,k)=>{let g=c.length;if(g===0){k(new Error("No candidate hosts"));return}c.forEach(f=>{f.then(b).catch(()=>{g--,g===0&&k(new Error("All probes failed"))})})})}catch{u=null}if(u){const b=`http://${u.host}:${u.port}/index.bundle?platform=${F.OS}&dev=true`;try{const k=new AbortController,g=setTimeout(()=>k.abort(),n),f=await fetch(b,{signal:k.signal});if(clearTimeout(g),f.ok){const x=f.headers.get("content-length"),M=await f.text();if(M&&M.length>0){const j=x&&parseInt(x,10)||M.length;return{text:M,bytes:j,url:b}}}}catch{}}return null},pe=new Set,me=new Map;export const trackRuntimeModuleExecution=()=>{try{const e=globalThis,n=e.__r;if(typeof n=="function"&&!n.__inspectorTracked){const o=function(l,...a){return pe.add(Number(l)),n.call(this,l,...a)};Object.defineProperty(o,"__inspectorTracked",{value:!0,enumerable:!1}),e.__r=o}}catch{}},trackRuntimeDefine=()=>{try{const e=globalThis,n=e.__d;if(typeof n=="function"&&!n.__inspectorTracked){const o=function(l,a,m,h,...c){return typeof h=="string"&&h.length>0&&me.set(Number(a),{id:Number(a),path:h}),n.call(this,l,a,m,h,...c)};Object.defineProperty(o,"__inspectorTracked",{value:!0,enumerable:!1}),e.__d=o}}catch{}};trackRuntimeModuleExecution(),trackRuntimeDefine();const Ae=[{id:1,deps:[2,3,4],path:"index.js"},{id:2,deps:[4,5,13,14,15,16],path:"App.tsx"},{id:3,deps:[],path:"node_modules/react-native/index.js"},{id:4,deps:[],path:"node_modules/react/index.js"},{id:5,deps:[6,7],path:"node_modules/@react-navigation/native/src/index.ts"},{id:6,deps:[],path:"node_modules/react-native-screens/src/index.ts"},{id:7,deps:[],path:"node_modules/react-native-safe-area-context/src/index.ts"},{id:8,deps:[],path:"node_modules/react-native-svg/src/index.ts"},{id:9,deps:[],path:"node_modules/axios/index.js"},{id:10,deps:[],path:"node_modules/i18next/dist/esm/i18next.js"},{id:11,deps:[12],path:"node_modules/react-redux/src/index.ts"},{id:12,deps:[],path:"node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"},{id:13,deps:[],path:"src/components/Inspector/BundleTab.tsx"},{id:14,deps:[],path:"src/navigation/RootNavigator.tsx"},{id:15,deps:[],path:"src/screens/HomeScreen.tsx"},{id:16,deps:[],path:"src/store/index.ts"},{id:17,deps:[],path:"assets/images/logo.png"},{id:18,deps:[],path:"package.json"}],We=e=>{const n=[],o=new Set;if(e&&e.length>0){const l=/\/\/[#@]\s*sourceURL=(?:https?:\/\/[^\s\r\n/]+\/|file:\/\/)?([^\s\r\n?#]+)/g;let a,m=9e5;for(;(a=l.exec(e))!==null;){const u=a[1];if(u&&u.length>0&&!u.endsWith(".bundle")){const b=m++;o.has(b)||(o.add(b),n.push({id:b,deps:[],path:u}))}}const h=/,\s*(\d+)\s*,\s*(?:\[[^\]\r\n]{0,500}\]|\{[^}\r\n]{0,500}\})\s*,\s*["']([^"'\r\n]+)["']\s*\)/g;let c;for(;(c=h.exec(e))!==null;){const u=parseInt(c[1],10),b=c[2]||"";!o.has(u)&&b.length>0&&(o.add(u),n.push({id:u,deps:[],path:b}))}}return me.forEach((l,a)=>{o.has(a)||(o.add(a),n.push({id:a,deps:[],path:l.path}))}),n.length===0?Ae:n},De=e=>{const n=new Set;if(!e)return n;const o=/__r\s*\(\s*(\d+)\s*\)/g;let l;for(;(l=o.exec(e))!==null;)n.add(parseInt(l[1],10));return n},Se=e=>{const n=e.map(c=>c.replace(/\\/g,"/"));for(const c of n){const u=c.indexOf("/node_modules/");if(u!==-1)return c.slice(0,u+1)}for(const c of n){const u=c.match(/^(.*\/)(?:index\.[jt]sx?|app\.[jt]sx?|package\.json)(?:[?#].*)?$/i);if(u&&u[1])return u[1]}const o=n.filter(c=>c.startsWith("/")&&!c.includes("/node_modules/"));if(o.length===0)return"";if(o.length===1){const c=o[0].lastIndexOf("/");return c>0?o[0].slice(0,c+1):""}const l=o.map(c=>c.split("/"));let a=0;const m=l[0],h=Math.min(...l.map(c=>c.length));for(;a<h-1;){const c=m[a];if(l.every(u=>u[a]===c))a++;else break}return a>0?m.slice(0,a).join("/")+"/":""},we=(e,n)=>{let o=e.replace(/\\/g,"/");const l=o.search(/[?#]/);return l!==-1&&(o=o.slice(0,l)),o=o.replace(/^(?:https?:\/\/[^/]+\/|file:\/\/)/,""),n&&o.startsWith(n)&&(o=o.slice(n.length)),o=o.replace(/^(\.\.\/)+/,"").replace(/^\.\//,"").replace(/^\/+/,""),o||(o=e.split("/").pop()||e),o},je=e=>{if(e.includes("node_modules/")){const n=e.match(/node_modules\/(?:@([^/]+)\/([^/]+)|([^/]+))/);return n?{isPkg:!0,pkgName:n[1]&&n[2]?`@${n[1]}/${n[2]}`:n[3]}:{isPkg:!0}}return e.includes("react-native-inapp-inspector")?{isPkg:!0,pkgName:"react-native-inapp-inspector"}:e.includes(".yarn/")||e.includes(".pnpm/")?{isPkg:!0}:e.includes("/dist/esm/")||e.includes("/dist/commonjs/")||e.includes("/dist/cjs/")||e.startsWith("dist/esm/")||e.startsWith("dist/commonjs/")||e.startsWith("dist/")||e.includes("/react-native-inapp-inspector/dist/")?{isPkg:!0,pkgName:"react-native-inapp-inspector"}:{isPkg:!1}},Pe=e=>e.startsWith("<<")||e.startsWith("[metro]")||e.includes("metro-runtime")||e.includes("polyfills/require.js")||e.includes("prelude_commonjs")||e.includes("Libraries/Core/InitializeCore.js")||e.includes("@babel/runtime");export const parseBundleSource=(e,n,o,l=!0)=>{const a=!!globalThis.HermesInternal,m=Number((n/(1024*1024)).toFixed(2)),h=Math.round(n/1024),c=We(e),u=De(e),b=new Map;for(const t of c)b.set(t.id,t);const k=new Set,g=[],f=t=>{k.has(t)||(k.add(t),g.push(t))};f(0),u.forEach(t=>f(t)),pe.forEach(t=>f(t));for(const t of c){const s=t.path.toLowerCase().replace(/\\/g,"/");(s.endsWith("/index.js")||s.endsWith("/index.ts")||s.endsWith("/index.tsx")||s==="index.js"||s.endsWith("/app.tsx")||s.endsWith("/app.js")||s.endsWith("/app.jsx")||s==="app.tsx"||s==="app.js"||s.endsWith("app.json"))&&f(t.id)}for(;g.length>0;){const t=g.shift(),s=b.get(t);if(s&&s.deps)for(const i of s.deps)f(i)}const x=new Map,M=[];for(const t of c){const s=t.path.replace(/\\/g,"/"),{isPkg:i,pkgName:N}=je(s);if(i){N&&!N.startsWith(".")&&x.set(N,(x.get(N)||0)+1);continue}Pe(s)||M.push({mod:t,rawPath:s})}const j=Se(c.map(t=>t.path)),C=[];let he=0;for(const{mod:t,rawPath:s}of M){const i=we(s,j);if(!(i.endsWith(".tsx")||i.endsWith(".ts")||i.endsWith(".jsx")||i.endsWith(".js")||i.endsWith(".mjs")||i.endsWith(".cjs")||i.endsWith(".json")||i.endsWith(".png")||i.endsWith(".jpg")||i.endsWith(".jpeg")||i.endsWith(".gif")||i.endsWith(".webp")||i.endsWith(".svg")||i.endsWith(".bmp")||i.endsWith(".ico")||i.endsWith(".ttf")||i.endsWith(".otf")||i.endsWith(".woff")||i.endsWith(".woff2")||i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".html")||i.endsWith(".md")||i.endsWith(".graphql")||i.endsWith(".gql")))continue;const p=i.split(".").pop()?.toUpperCase()||"JS",$=i.split("/").pop()||i;let _="javascript",D=d.indigo500;p==="TSX"||p==="TS"?(_="typescript",D=d.sky500):p==="PNG"||p==="JPG"||p==="JPEG"||p==="GIF"||p==="WEBP"||p==="SVG"||p==="BMP"||p==="ICO"?(_="image",D=d.pink500):p==="TTF"||p==="OTF"||p==="WOFF"||p==="WOFF2"?(_="font",D=d.purple500):(p==="JSON"||p==="CSS"||p==="SCSS"||p==="HTML"||p==="MD"||p==="GRAPHQL"||p==="GQL")&&(_="json",D=d.emerald500);const oe=Math.max(2,Math.round(h*.15/Math.max(c.length,20))),ie=!(i.includes(".test.")||i.includes(".spec.")||i.includes("__tests__")||i.includes("__mocks__")||i.includes(".stories.")||i.includes("fixtures/"));C.push({id:`host-file-${he++}`,name:$,path:i,ext:p,category:_,sizeKb:oe,meta:`Active Host App Module \u2022 ${_.toUpperCase()}`,color:D,status:ie?"optimal":"warning",advice:ie?"In-Use: Bundled and active in host application dependency tree":"Not consumed: Test fixture or orphaned file packaged in bundle",isConsumed:ie})}const be=t=>{const s=[d.indigo500,d.sky500,d.pink500,d.purple500,d.emerald500,d.amber500,d.red500,d.teal500,"#3B82F6",d.fuchsia500,d.orange500,d.lime500,"#06B6D4","#A855F7",d.errorColor];let i=0;for(let N=0;N<t.length;N++)i=t.charCodeAt(N)+((i<<5)-i);return s[Math.abs(i)%s.length]},fe=t=>{const s=t.toLowerCase();return s.includes("navigation")||s.includes("router")||s.includes("screen")?"navigation":s.includes("ui")||s.includes("reanimated")||s.includes("gesture")||s.includes("svg")||s.includes("lottie")||s.includes("vector")||s.includes("icon")||s.includes("image")||s.includes("gradient")?"ui":s.includes("axios")||s.includes("fetch")||s.includes("query")||s.includes("apollo")||s.includes("network")||s.includes("socket")||s.includes("http")?"network":s==="react"||s==="react-native"||s.includes("metro")||s.includes("babel")||s.includes("core")?"core":"utils"},ge=t=>t.startsWith("@react-navigation/")?t==="@react-navigation/native"?null:"@react-navigation/native":t.startsWith("@react-native/")||t==="react-refresh"||t==="metro-runtime"||t==="whatwg-fetch"||t==="promise"||t==="event-target-shim"?"react-native":t==="scheduler"||t==="loose-envify"||t==="object-assign"?"react":t==="use-sync-external-store"||t==="reselect"||t==="redux-thunk"||t==="immer"?"react-redux":t==="follow-redirects"||t==="form-data"||t==="proxy-from-env"?"axios":t==="clone-deep"||t==="html-parse-stringify"||t==="@babel/runtime"?"i18next":t==="css-select"||t==="css-tree"||t==="entities"?"react-native-svg":null,re=Array.from(x.entries()),xe=re.reduce((t,[,s])=>t+s,0)||1,y=[];re.forEach(([t,s],i)=>{const N=fe(t),p=be(t),$=ge(t)||void 0,_=!$,D=Math.max(8,Math.round(h*.52*s/Math.max(xe,1))),oe=Number((D/Math.max(h,1)*100).toFixed(1));y.push({id:`host-pkg-${i}`,name:t,version:"",latestVersion:"",sizeKb:D,percentage:oe,type:_?"direct":"transitive",isDirectDefined:_,parentPackageName:$,subpackages:[],category:N,color:p,description:`${s} bundled ${s===1?"module":"modules"}`,npmUrl:`https://www.npmjs.com/package/${t}`,isDeprecated:!1,lastActive:`${s} modules`})});const L=new Map;y.forEach(t=>{t.isDirectDefined&&L.set(t.name,t)}),y.forEach(t=>{if(t.parentPackageName&&L.has(t.parentPackageName)){const s=L.get(t.parentPackageName);s.subpackages||(s.subpackages=[]),s.subpackages.push(t)}}),y.sort((t,s)=>s.sizeKb-t.sizeKb);let H=0;for(const t of y)H+=t.sizeKb||0;let B=0,K=0;for(const t of C)t.category==="image"||t.category==="font"?K+=t.sizeKb||0:B+=t.sizeKb||0;const U=B>0?B:Math.round(h*.18),R=H>0?H:Math.round(h*.58),O=K>0?K:Math.round(h*.08),ce=Math.max(0,h-U-R-O),v=Number((h*.38/1024).toFixed(2)),P=Number((R/1024).toFixed(2)),V=Number((O/1024).toFixed(2)),E=Math.min(y.length,55),q=Number((48+E*.35+P*.9).toFixed(1)),G=Number((38+E*.22+P*.6).toFixed(1)),J=Number((30+V*2.2).toFixed(1)),Q=6.4,S=Number((v+q+G+J+Q).toFixed(1)),ke=Number((S*.655).toFixed(1)),X=Number((20+E*.12+P*.4).toFixed(1)),Y=Number((14+E*.08+P*.25).toFixed(1)),Z=Number((16+V*1.5).toFixed(1)),W=Number((v+X+Y+Z+3.8).toFixed(1)),ae=Number((W*.54).toFixed(1)),ee=Number((195+E*.55+P*1.6).toFixed(1)),te=Number((54+E*.2+P*.6).toFixed(1)),se=Number((58+V*2.8).toFixed(1)),ne=8.5,w=Number((v+ee+te+se+ne).toFixed(1)),Me=Number(w.toFixed(1)),ve=[{id:"ios-c1",name:r("bundle.iosComp1Name"),category:"frameworks",sizeMb:q,pct:Number((q/S*100).toFixed(1)),color:d.indigo500,description:r("bundle.iosComp1Desc",{count:y.length}),advice:r("bundle.iosComp1Advice")},{id:"ios-c2",name:r("bundle.iosComp2Name"),category:"native",sizeMb:G,pct:Number((G/S*100).toFixed(1)),color:d.sky500,description:r("bundle.iosComp2Desc"),advice:r("bundle.iosComp2Advice")},{id:"ios-c3",name:r("bundle.iosComp3Name"),category:"assets",sizeMb:J,pct:Number((J/S*100).toFixed(1)),color:d.pink500,description:r("bundle.iosComp3Desc"),advice:r("bundle.iosComp3Advice")},{id:"ios-c4",name:r("bundle.iosComp4Name"),category:"js",sizeMb:v,pct:Number((v/S*100).toFixed(1)),color:d.emerald500,description:r("bundle.iosComp4Desc",{count:C.length}),advice:r("bundle.iosComp4Advice")},{id:"ios-c5",name:r("bundle.iosComp5Name"),category:"meta",sizeMb:Q,pct:Number((Q/S*100).toFixed(1)),color:d.amber500,description:r("bundle.iosComp5Desc"),advice:r("bundle.iosComp5Advice")}],de=[{id:"and-c1",name:r("bundle.andComp1Name"),category:"native",sizeMb:X,pct:Number((X/W*100).toFixed(1)),color:d.sky500,description:r("bundle.andComp1Desc",{count:y.length}),advice:r("bundle.andComp1Advice")},{id:"and-c2",name:r("bundle.andComp2Name"),category:"frameworks",sizeMb:Y,pct:Number((Y/W*100).toFixed(1)),color:d.indigo500,description:r("bundle.andComp2Desc"),advice:r("bundle.andComp2Advice")},{id:"and-c3",name:r("bundle.andComp3Name"),category:"assets",sizeMb:Z,pct:Number((Z/W*100).toFixed(1)),color:d.pink500,description:r("bundle.andComp3Desc"),advice:r("bundle.andComp3Advice")},{id:"and-c4",name:r("bundle.andComp4Name"),category:"js",sizeMb:v,pct:Number((v/W*100).toFixed(1)),color:d.emerald500,description:r("bundle.andComp4Desc",{count:C.length}),advice:r("bundle.andComp4Advice")},{id:"and-c5",name:r("bundle.andComp5Name"),category:"meta",sizeMb:3.8,pct:Number((3.8/W*100).toFixed(1)),color:d.amber500,description:r("bundle.andComp5Desc"),advice:r("bundle.andComp5Advice")}],Ce=[{id:"apk-c1",name:r("bundle.apkComp1Name"),category:"native",sizeMb:ee,pct:Number((ee/w*100).toFixed(1)),color:d.sky500,description:r("bundle.apkComp1Desc"),advice:r("bundle.apkComp1Advice")},{id:"apk-c2",name:r("bundle.apkComp2Name"),category:"frameworks",sizeMb:te,pct:Number((te/w*100).toFixed(1)),color:d.indigo500,description:r("bundle.apkComp2Desc"),advice:r("bundle.apkComp2Advice")},{id:"apk-c3",name:r("bundle.apkComp3Name"),category:"assets",sizeMb:se,pct:Number((se/w*100).toFixed(1)),color:d.pink500,description:r("bundle.apkComp3Desc"),advice:r("bundle.apkComp3Advice")},{id:"apk-c4",name:r("bundle.apkComp4Name"),category:"js",sizeMb:v,pct:Number((v/w*100).toFixed(1)),color:d.emerald500,description:r("bundle.apkComp4Desc",{count:C.length}),advice:r("bundle.apkComp4Advice")},{id:"apk-c5",name:r("bundle.apkComp5Name"),category:"meta",sizeMb:ne,pct:Number((ne/w*100).toFixed(1)),color:d.amber500,description:r("bundle.apkComp5Desc"),advice:r("bundle.apkComp5Advice")}];return{isLive:l,scriptURL:o,totalDevBytes:n,totalDevMb:m,totalDevKb:h,isHermes:a,moduleCount:c.length||C.length+y.length,packageCount:y.length,filesCount:C.length,splitUp:{appSource:{kb:U,mb:Number((U/1024).toFixed(2)),pct:15},nodeModules:{kb:R,mb:Number((R/1024).toFixed(2)),pct:52},assetsMedia:{kb:O,mb:Number((O/1024).toFixed(2)),pct:12},metroDevOverhead:{kb:ce,mb:Number((ce/1024).toFixed(2)),pct:21}},files:C,packages:y,production:{ios:{totalInstallMb:S,totalDownloadMb:ke,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:ve},androidAab:{totalInstallMb:W,totalDownloadMb:ae,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:de},androidApk:{totalInstallMb:w,totalDownloadMb:Me,compressionRatioPct:Number(((m-v)/Math.max(m,1)*.7).toFixed(1)),components:Ce},android:{totalInstallMb:W,totalDownloadMb:ae,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:de}}}},getInitialBundleAnalysis=()=>{if(A)return A;const e=getHostScriptURL();return parseBundleSource("",684e4,e||"unknown",!1)},analyzeHostAppBundle=async(e=!1)=>{if(e&&(A=null),A&&!e)return A;if(z)return new Promise(a=>{T.push(a)});z=!0;const n=getHostScriptURL();try{const a=await Fe(n,2500);if(a&&a.text&&a.text.length>0){const m=parseBundleSource(a.text,a.bytes,a.url);return A=m,z=!1,T.forEach(h=>h(m)),T.length=0,m}}catch{}const l=parseBundleSource("",684e4,n||"unknown",!1);return A=l,z=!1,T.forEach(a=>a(l)),T.length=0,l},clearCachedBundleAnalysis=()=>{A=null},getCachedBundleAnalysis=()=>A;
1
+ import{AppColors as a}from"../styles/AppColors";import{t as r}from"../i18n";import{NativeModules as I,Platform as F,TurboModuleRegistry as ye}from"react-native";let A=null,z=!1;const T=[];let le=!1;export const setBundleModuleEnabled=e=>{le=e},getBundleModuleEnabled=()=>le;const Ne=()=>{try{const e=I?.SourceCode,n=e?.scriptURL||e?.getConstants?.()?.scriptURL;if(typeof n=="string"&&n.length>0)return{scriptURL:n}}catch{}try{const e=ye?.get?.("SourceCode"),n=e?.getConstants?.(),o=e?.scriptURL||n?.scriptURL;if(typeof o=="string"&&o.length>0)return{scriptURL:o}}catch{}return null};export const getHostScriptURL=()=>{try{const e=Ne()?.scriptURL;if(typeof e=="string"&&e.length>0)return e}catch{}try{const e=I?.PlatformConstants?.serverHost||I?.AndroidConstants?.serverHost||I?.DevSettings?.serverHost||I?.DevSettings?.getConstants?.()?.serverHost;if(typeof e=="string"&&e.length>0)return`${e.startsWith("http")?e:`http://${e}`}/index.bundle?platform=${F.OS}&dev=true`}catch{}try{const e=globalThis?.__DEV_SERVER_URL__||globalThis?.__METRO_SERVER_HOST__||globalThis?.__DEV_SERVER_PORT__||globalThis?.__METRO_PORT__;if(typeof e=="number")return`http://${F.OS==="android"?"10.0.2.2":"localhost"}:${e}/index.bundle?platform=${F.OS}&dev=true`;if(typeof e=="string"&&e.length>0)return/^\d+$/.test(e)?`http://${F.OS==="android"?"10.0.2.2":"localhost"}:${e}/index.bundle?platform=${F.OS}&dev=true`:e.startsWith("http")?e:`http://${e}/index.bundle?platform=${F.OS}&dev=true`}catch{}return""};const ue=[8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,19e3,19001,3e3],_e=e=>{if(!e||typeof e!="string")return{host:null,port:null};const n=e.match(/^https?:\/\/([^:/]+)(?::(\d+))?/);return n?{host:n[1]||null,port:n[2]?parseInt(n[2],10):null}:{host:null,port:null}},Fe=async(e,n=3e3)=>{const{host:o,port:l}=_e(e);if(e&&e.startsWith("http"))try{const b=new AbortController,k=setTimeout(()=>b.abort(),n),g=await fetch(e,{signal:b.signal});if(clearTimeout(k),g.ok){const f=g.headers.get("content-length"),x=await g.text();if(x&&x.length>0){const M=f&&parseInt(f,10)||x.length;return{text:x,bytes:M,url:e}}}}catch{}const d=o?[o,"localhost","127.0.0.1",...F.OS==="android"?["10.0.2.2","10.0.3.2"]:[]]:["localhost","127.0.0.1",...F.OS==="android"?["10.0.2.2","10.0.3.2"]:[]],m=Array.from(new Set(d)),h=l?Array.from(new Set([l,...ue])):ue,c=[];for(const b of m)for(const k of h)c.push(new Promise(async(g,f)=>{const x=new AbortController,M=setTimeout(()=>x.abort(),700);try{const j=await fetch(`http://${b}:${k}/status`,{signal:x.signal});if(clearTimeout(M),j.ok){const C=await j.text();if(C&&C.includes("packager-status:running")){g({host:b,port:k});return}}}catch{clearTimeout(M)}f(new Error("unreachable"))}));let u=null;try{u=await new Promise((b,k)=>{let g=c.length;if(g===0){k(new Error("No candidate hosts"));return}c.forEach(f=>{f.then(b).catch(()=>{g--,g===0&&k(new Error("All probes failed"))})})})}catch{u=null}if(u){const b=`http://${u.host}:${u.port}/index.bundle?platform=${F.OS}&dev=true`;try{const k=new AbortController,g=setTimeout(()=>k.abort(),n),f=await fetch(b,{signal:k.signal});if(clearTimeout(g),f.ok){const x=f.headers.get("content-length"),M=await f.text();if(M&&M.length>0){const j=x&&parseInt(x,10)||M.length;return{text:M,bytes:j,url:b}}}}catch{}}return null},pe=new Set,me=new Map;export const trackRuntimeModuleExecution=()=>{try{const e=globalThis,n=e.__r;if(typeof n=="function"&&!n.__inspectorTracked){const o=function(l,...d){return pe.add(Number(l)),n.call(this,l,...d)};Object.defineProperty(o,"__inspectorTracked",{value:!0,enumerable:!1}),e.__r=o}}catch{}},trackRuntimeDefine=()=>{try{const e=globalThis,n=e.__d;if(typeof n=="function"&&!n.__inspectorTracked){const o=function(l,d,m,h,...c){return typeof h=="string"&&h.length>0&&me.set(Number(d),{id:Number(d),path:h}),n.call(this,l,d,m,h,...c)};Object.defineProperty(o,"__inspectorTracked",{value:!0,enumerable:!1}),e.__d=o}}catch{}};trackRuntimeModuleExecution(),trackRuntimeDefine();const Ae=[{id:1,deps:[2,3,4],path:"index.js"},{id:2,deps:[4,5,13,14,15,16],path:"App.tsx"},{id:3,deps:[],path:"node_modules/react-native/index.js"},{id:4,deps:[],path:"node_modules/react/index.js"},{id:5,deps:[6,7],path:"node_modules/@react-navigation/native/src/index.ts"},{id:6,deps:[],path:"node_modules/react-native-screens/src/index.ts"},{id:7,deps:[],path:"node_modules/react-native-safe-area-context/src/index.ts"},{id:8,deps:[],path:"node_modules/react-native-svg/src/index.ts"},{id:9,deps:[],path:"node_modules/axios/index.js"},{id:10,deps:[],path:"node_modules/i18next/dist/esm/i18next.js"},{id:11,deps:[12],path:"node_modules/react-redux/src/index.ts"},{id:12,deps:[],path:"node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"},{id:13,deps:[],path:"src/components/Inspector/BundleTab.tsx"},{id:14,deps:[],path:"src/navigation/RootNavigator.tsx"},{id:15,deps:[],path:"src/screens/HomeScreen.tsx"},{id:16,deps:[],path:"src/store/index.ts"},{id:17,deps:[],path:"assets/images/logo.png"},{id:18,deps:[],path:"package.json"}],We=e=>{const n=[],o=new Set;if(e&&e.length>0){const l=/\/\/[#@]\s*sourceURL=(?:https?:\/\/[^\s\r\n/]+\/|file:\/\/)?([^\s\r\n?#]+)/g;let d,m=9e5;for(;(d=l.exec(e))!==null;){const u=d[1];if(u&&u.length>0&&!u.endsWith(".bundle")){const b=m++;o.has(b)||(o.add(b),n.push({id:b,deps:[],path:u}))}}const h=/,\s*(\d+)\s*,\s*(?:\[[^\]\r\n]{0,500}\]|\{[^}\r\n]{0,500}\})\s*,\s*["']([^"'\r\n]+)["']\s*\)/g;let c;for(;(c=h.exec(e))!==null;){const u=parseInt(c[1],10),b=c[2]||"";!o.has(u)&&b.length>0&&(o.add(u),n.push({id:u,deps:[],path:b}))}}return me.forEach((l,d)=>{o.has(d)||(o.add(d),n.push({id:d,deps:[],path:l.path}))}),n.length===0?Ae:n},Se=e=>{const n=new Set;if(!e)return n;const o=/__r\s*\(\s*(\d+)\s*\)/g;let l;for(;(l=o.exec(e))!==null;)n.add(parseInt(l[1],10));return n},De=e=>{const n=e.map(c=>c.replace(/\\/g,"/"));for(const c of n){const u=c.indexOf("/node_modules/");if(u!==-1)return c.slice(0,u+1)}for(const c of n){const u=c.match(/^(.*\/)(?:index\.[jt]sx?|app\.[jt]sx?|package\.json)(?:[?#].*)?$/i);if(u&&u[1])return u[1]}const o=n.filter(c=>c.startsWith("/")&&!c.includes("/node_modules/"));if(o.length===0)return"";if(o.length===1){const c=o[0].lastIndexOf("/");return c>0?o[0].slice(0,c+1):""}const l=o.map(c=>c.split("/"));let d=0;const m=l[0],h=Math.min(...l.map(c=>c.length));for(;d<h-1;){const c=m[d];if(l.every(u=>u[d]===c))d++;else break}return d>0?m.slice(0,d).join("/")+"/":""},we=(e,n)=>{let o=e.replace(/\\/g,"/");const l=o.search(/[?#]/);return l!==-1&&(o=o.slice(0,l)),o=o.replace(/^(?:https?:\/\/[^/]+\/|file:\/\/)/,""),n&&o.startsWith(n)&&(o=o.slice(n.length)),o=o.replace(/^(\.\.\/)+/,"").replace(/^\.\//,"").replace(/^\/+/,""),o||(o=e.split("/").pop()||e),o},je=e=>{if(e.includes("node_modules/")){const n=e.match(/node_modules\/(?:@([^/]+)\/([^/]+)|([^/]+))/);return n?{isPkg:!0,pkgName:n[1]&&n[2]?`@${n[1]}/${n[2]}`:n[3]}:{isPkg:!0}}return e.includes("react-native-inapp-inspector")?{isPkg:!0,pkgName:"react-native-inapp-inspector"}:e.includes(".yarn/")||e.includes(".pnpm/")?{isPkg:!0}:e.includes("/dist/esm/")||e.includes("/dist/commonjs/")||e.includes("/dist/cjs/")||e.startsWith("dist/esm/")||e.startsWith("dist/commonjs/")||e.startsWith("dist/")||e.includes("/react-native-inapp-inspector/dist/")?{isPkg:!0,pkgName:"react-native-inapp-inspector"}:{isPkg:!1}},Pe=e=>e.startsWith("<<")||e.startsWith("[metro]")||e.includes("metro-runtime")||e.includes("polyfills/require.js")||e.includes("prelude_commonjs")||e.includes("Libraries/Core/InitializeCore.js")||e.includes("@babel/runtime");export const parseBundleSource=(e,n,o,l=!0)=>{const d=!!globalThis.HermesInternal,m=Number((n/(1024*1024)).toFixed(2)),h=Math.round(n/1024),c=We(e),u=Se(e),b=new Map;for(const t of c)b.set(t.id,t);const k=new Set,g=[],f=t=>{k.has(t)||(k.add(t),g.push(t))};f(0),u.forEach(t=>f(t)),pe.forEach(t=>f(t));for(const t of c){const s=t.path.toLowerCase().replace(/\\/g,"/");(s.endsWith("/index.js")||s.endsWith("/index.ts")||s.endsWith("/index.tsx")||s==="index.js"||s.endsWith("/app.tsx")||s.endsWith("/app.js")||s.endsWith("/app.jsx")||s==="app.tsx"||s==="app.js"||s.endsWith("app.json"))&&f(t.id)}for(;g.length>0;){const t=g.shift(),s=b.get(t);if(s&&s.deps)for(const i of s.deps)f(i)}const x=new Map,M=[];for(const t of c){const s=t.path.replace(/\\/g,"/"),{isPkg:i,pkgName:N}=je(s);if(i){N&&!N.startsWith(".")&&x.set(N,(x.get(N)||0)+1);continue}Pe(s)||M.push({mod:t,rawPath:s})}const j=De(c.map(t=>t.path)),C=[];let he=0;for(const{mod:t,rawPath:s}of M){const i=we(s,j);if(!(i.endsWith(".tsx")||i.endsWith(".ts")||i.endsWith(".jsx")||i.endsWith(".js")||i.endsWith(".mjs")||i.endsWith(".cjs")||i.endsWith(".json")||i.endsWith(".png")||i.endsWith(".jpg")||i.endsWith(".jpeg")||i.endsWith(".gif")||i.endsWith(".webp")||i.endsWith(".svg")||i.endsWith(".bmp")||i.endsWith(".ico")||i.endsWith(".ttf")||i.endsWith(".otf")||i.endsWith(".woff")||i.endsWith(".woff2")||i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".html")||i.endsWith(".md")||i.endsWith(".graphql")||i.endsWith(".gql")))continue;const p=i.split(".").pop()?.toUpperCase()||"JS",$=i.split("/").pop()||i;let _="javascript",S=a.indigo500;p==="TSX"||p==="TS"?(_="typescript",S=a.sky500):p==="PNG"||p==="JPG"||p==="JPEG"||p==="GIF"||p==="WEBP"||p==="SVG"||p==="BMP"||p==="ICO"?(_="image",S=a.pink500):p==="TTF"||p==="OTF"||p==="WOFF"||p==="WOFF2"?(_="font",S=a.purple500):(p==="JSON"||p==="CSS"||p==="SCSS"||p==="HTML"||p==="MD"||p==="GRAPHQL"||p==="GQL")&&(_="json",S=a.emerald500);const oe=Math.max(2,Math.round(h*.15/Math.max(c.length,20))),ie=!(i.includes(".test.")||i.includes(".spec.")||i.includes("__tests__")||i.includes("__mocks__")||i.includes(".stories.")||i.includes("fixtures/"));C.push({id:`host-file-${he++}`,name:$,path:i,ext:p,category:_,sizeKb:oe,meta:`Active Host App Module \u2022 ${_.toUpperCase()}`,color:S,status:ie?"optimal":"warning",advice:ie?"In-Use: Bundled and active in host application dependency tree":"Not consumed: Test fixture or orphaned file packaged in bundle",isConsumed:ie})}const be=t=>{const s=[a.indigo500,a.sky500,a.pink500,a.purple500,a.emerald500,a.amber500,a.red500,a.teal500,a.blue500,a.fuchsia500,a.orange500,a.lime500,a.cyan500,a.purple900,a.errorColor];let i=0;for(let N=0;N<t.length;N++)i=t.charCodeAt(N)+((i<<5)-i);return s[Math.abs(i)%s.length]},fe=t=>{const s=t.toLowerCase();return s.includes("navigation")||s.includes("router")||s.includes("screen")?"navigation":s.includes("ui")||s.includes("reanimated")||s.includes("gesture")||s.includes("svg")||s.includes("lottie")||s.includes("vector")||s.includes("icon")||s.includes("image")||s.includes("gradient")?"ui":s.includes("axios")||s.includes("fetch")||s.includes("query")||s.includes("apollo")||s.includes("network")||s.includes("socket")||s.includes("http")?"network":s==="react"||s==="react-native"||s.includes("metro")||s.includes("babel")||s.includes("core")?"core":"utils"},ge=t=>t.startsWith("@react-navigation/")?t==="@react-navigation/native"?null:"@react-navigation/native":t.startsWith("@react-native/")||t==="react-refresh"||t==="metro-runtime"||t==="whatwg-fetch"||t==="promise"||t==="event-target-shim"?"react-native":t==="scheduler"||t==="loose-envify"||t==="object-assign"?"react":t==="use-sync-external-store"||t==="reselect"||t==="redux-thunk"||t==="immer"?"react-redux":t==="follow-redirects"||t==="form-data"||t==="proxy-from-env"?"axios":t==="clone-deep"||t==="html-parse-stringify"||t==="@babel/runtime"?"i18next":t==="css-select"||t==="css-tree"||t==="entities"?"react-native-svg":null,re=Array.from(x.entries()),xe=re.reduce((t,[,s])=>t+s,0)||1,y=[];re.forEach(([t,s],i)=>{const N=fe(t),p=be(t),$=ge(t)||void 0,_=!$,S=Math.max(8,Math.round(h*.52*s/Math.max(xe,1))),oe=Number((S/Math.max(h,1)*100).toFixed(1));y.push({id:`host-pkg-${i}`,name:t,version:"",latestVersion:"",sizeKb:S,percentage:oe,type:_?"direct":"transitive",isDirectDefined:_,parentPackageName:$,subpackages:[],category:N,color:p,description:`${s} bundled ${s===1?"module":"modules"}`,npmUrl:`https://www.npmjs.com/package/${t}`,isDeprecated:!1,lastActive:`${s} modules`})});const L=new Map;y.forEach(t=>{t.isDirectDefined&&L.set(t.name,t)}),y.forEach(t=>{if(t.parentPackageName&&L.has(t.parentPackageName)){const s=L.get(t.parentPackageName);s.subpackages||(s.subpackages=[]),s.subpackages.push(t)}}),y.sort((t,s)=>s.sizeKb-t.sizeKb);let H=0;for(const t of y)H+=t.sizeKb||0;let B=0,K=0;for(const t of C)t.category==="image"||t.category==="font"?K+=t.sizeKb||0:B+=t.sizeKb||0;const U=B>0?B:Math.round(h*.18),R=H>0?H:Math.round(h*.58),O=K>0?K:Math.round(h*.08),ce=Math.max(0,h-U-R-O),v=Number((h*.38/1024).toFixed(2)),P=Number((R/1024).toFixed(2)),V=Number((O/1024).toFixed(2)),E=Math.min(y.length,55),q=Number((48+E*.35+P*.9).toFixed(1)),G=Number((38+E*.22+P*.6).toFixed(1)),J=Number((30+V*2.2).toFixed(1)),Q=6.4,D=Number((v+q+G+J+Q).toFixed(1)),ke=Number((D*.655).toFixed(1)),X=Number((20+E*.12+P*.4).toFixed(1)),Y=Number((14+E*.08+P*.25).toFixed(1)),Z=Number((16+V*1.5).toFixed(1)),W=Number((v+X+Y+Z+3.8).toFixed(1)),ae=Number((W*.54).toFixed(1)),ee=Number((195+E*.55+P*1.6).toFixed(1)),te=Number((54+E*.2+P*.6).toFixed(1)),se=Number((58+V*2.8).toFixed(1)),ne=8.5,w=Number((v+ee+te+se+ne).toFixed(1)),Me=Number(w.toFixed(1)),ve=[{id:"ios-c1",name:r("bundle.iosComp1Name"),category:"frameworks",sizeMb:q,pct:Number((q/D*100).toFixed(1)),color:a.indigo500,description:r("bundle.iosComp1Desc",{count:y.length}),advice:r("bundle.iosComp1Advice")},{id:"ios-c2",name:r("bundle.iosComp2Name"),category:"native",sizeMb:G,pct:Number((G/D*100).toFixed(1)),color:a.sky500,description:r("bundle.iosComp2Desc"),advice:r("bundle.iosComp2Advice")},{id:"ios-c3",name:r("bundle.iosComp3Name"),category:"assets",sizeMb:J,pct:Number((J/D*100).toFixed(1)),color:a.pink500,description:r("bundle.iosComp3Desc"),advice:r("bundle.iosComp3Advice")},{id:"ios-c4",name:r("bundle.iosComp4Name"),category:"js",sizeMb:v,pct:Number((v/D*100).toFixed(1)),color:a.emerald500,description:r("bundle.iosComp4Desc",{count:C.length}),advice:r("bundle.iosComp4Advice")},{id:"ios-c5",name:r("bundle.iosComp5Name"),category:"meta",sizeMb:Q,pct:Number((Q/D*100).toFixed(1)),color:a.amber500,description:r("bundle.iosComp5Desc"),advice:r("bundle.iosComp5Advice")}],de=[{id:"and-c1",name:r("bundle.andComp1Name"),category:"native",sizeMb:X,pct:Number((X/W*100).toFixed(1)),color:a.sky500,description:r("bundle.andComp1Desc",{count:y.length}),advice:r("bundle.andComp1Advice")},{id:"and-c2",name:r("bundle.andComp2Name"),category:"frameworks",sizeMb:Y,pct:Number((Y/W*100).toFixed(1)),color:a.indigo500,description:r("bundle.andComp2Desc"),advice:r("bundle.andComp2Advice")},{id:"and-c3",name:r("bundle.andComp3Name"),category:"assets",sizeMb:Z,pct:Number((Z/W*100).toFixed(1)),color:a.pink500,description:r("bundle.andComp3Desc"),advice:r("bundle.andComp3Advice")},{id:"and-c4",name:r("bundle.andComp4Name"),category:"js",sizeMb:v,pct:Number((v/W*100).toFixed(1)),color:a.emerald500,description:r("bundle.andComp4Desc",{count:C.length}),advice:r("bundle.andComp4Advice")},{id:"and-c5",name:r("bundle.andComp5Name"),category:"meta",sizeMb:3.8,pct:Number((3.8/W*100).toFixed(1)),color:a.amber500,description:r("bundle.andComp5Desc"),advice:r("bundle.andComp5Advice")}],Ce=[{id:"apk-c1",name:r("bundle.apkComp1Name"),category:"native",sizeMb:ee,pct:Number((ee/w*100).toFixed(1)),color:a.sky500,description:r("bundle.apkComp1Desc"),advice:r("bundle.apkComp1Advice")},{id:"apk-c2",name:r("bundle.apkComp2Name"),category:"frameworks",sizeMb:te,pct:Number((te/w*100).toFixed(1)),color:a.indigo500,description:r("bundle.apkComp2Desc"),advice:r("bundle.apkComp2Advice")},{id:"apk-c3",name:r("bundle.apkComp3Name"),category:"assets",sizeMb:se,pct:Number((se/w*100).toFixed(1)),color:a.pink500,description:r("bundle.apkComp3Desc"),advice:r("bundle.apkComp3Advice")},{id:"apk-c4",name:r("bundle.apkComp4Name"),category:"js",sizeMb:v,pct:Number((v/w*100).toFixed(1)),color:a.emerald500,description:r("bundle.apkComp4Desc",{count:C.length}),advice:r("bundle.apkComp4Advice")},{id:"apk-c5",name:r("bundle.apkComp5Name"),category:"meta",sizeMb:ne,pct:Number((ne/w*100).toFixed(1)),color:a.amber500,description:r("bundle.apkComp5Desc"),advice:r("bundle.apkComp5Advice")}];return{isLive:l,scriptURL:o,totalDevBytes:n,totalDevMb:m,totalDevKb:h,isHermes:d,moduleCount:c.length||C.length+y.length,packageCount:y.length,filesCount:C.length,splitUp:{appSource:{kb:U,mb:Number((U/1024).toFixed(2)),pct:15},nodeModules:{kb:R,mb:Number((R/1024).toFixed(2)),pct:52},assetsMedia:{kb:O,mb:Number((O/1024).toFixed(2)),pct:12},metroDevOverhead:{kb:ce,mb:Number((ce/1024).toFixed(2)),pct:21}},files:C,packages:y,production:{ios:{totalInstallMb:D,totalDownloadMb:ke,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:ve},androidAab:{totalInstallMb:W,totalDownloadMb:ae,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:de},androidApk:{totalInstallMb:w,totalDownloadMb:Me,compressionRatioPct:Number(((m-v)/Math.max(m,1)*.7).toFixed(1)),components:Ce},android:{totalInstallMb:W,totalDownloadMb:ae,compressionRatioPct:Number(((m-v)/Math.max(m,1)*100).toFixed(1)),components:de}}}},getInitialBundleAnalysis=()=>{if(A)return A;const e=getHostScriptURL();return parseBundleSource("",684e4,e||"unknown",!1)},analyzeHostAppBundle=async(e=!1)=>{if(e&&(A=null),A&&!e)return A;if(z)return new Promise(d=>{T.push(d)});z=!0;const n=getHostScriptURL();try{const d=await Fe(n,2500);if(d&&d.text&&d.text.length>0){const m=parseBundleSource(d.text,d.bytes,d.url);return A=m,z=!1,T.forEach(h=>h(m)),T.length=0,m}}catch{}const l=parseBundleSource("",684e4,n||"unknown",!1);return A=l,z=!1,T.forEach(d=>d(l)),T.length=0,l},clearCachedBundleAnalysis=()=>{A=null},getCachedBundleAnalysis=()=>A;
@@ -11,6 +11,7 @@ export declare const getDurationColor: (duration: number | null) => string;
11
11
  export declare const getSize: (data: unknown) => string;
12
12
  export declare const formatBytes: (bytes: number) => string;
13
13
  export declare const copyToClipboard: (value: unknown, label?: string) => void;
14
+ export declare const copyImageOrMediaToClipboard: (uri: string, label?: string) => Promise<void>;
14
15
  export declare const getPath: (url: string) => string;
15
16
  export declare const getBaseUrl: (url: string) => string;
16
17
  export declare const getCurlCommand: (log: NetworkLog) => string;
@@ -1,8 +1,8 @@
1
- import{Platform as _,ToastAndroid as b,Alert as D,NativeModules as p,Linking as S}from"react-native";import $ from"@react-native-clipboard/clipboard";import{showToast as M}from"./toast";import{AppColors as c}from"../styles/AppColors";import{DOMAIN_COLORS as v,DURATION_FAST_MS as T,DURATION_SLOW_MS as j}from"../constants";export*from"./searchQueryParser";export*from"./memoryManager";export*from"./toast";export const isLocalDebugEnvironment=()=>{const t=typeof __DEV__<"u"&&!!__DEV__,e=p.SourceCode?.scriptURL||"",n=e.startsWith("http://")||e.startsWith("https://")||e.includes(":8081")||e.includes(":8082");return t||n},getDomainColor=t=>{if(!t)return v[0];let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return v[Math.abs(e)%v.length]},formatDateTime=t=>{const e=new Date(t),n=(g,l=2)=>String(g).padStart(l,"0"),r=n(e.getDate()),o=n(e.getMonth()+1),s=e.getFullYear(),i=n(e.getHours()),a=n(e.getMinutes()),f=n(e.getSeconds());return`${r}/${o}/${s} ${i}:${a}:${f}`},formatTimestamp=t=>{try{const e=new Date(t),n=e.getHours().toString().padStart(2,"0"),r=e.getMinutes().toString().padStart(2,"0"),o=e.getSeconds().toString().padStart(2,"0"),s=e.getMilliseconds().toString().padStart(3,"0");return`${n}:${r}:${o}.${s}`}catch{return"\u2014"}},getStatusColor=t=>!t||t===0?c.errorColor:t>=500?c.errorColor:t>=400?c.darkOrange:t>=300?c.warningIconGold:c.greenColor,getDurationColor=t=>t==null?c.grayTextWeak:t<T?c.greenColor:t<j?c.lightOrange:c.errorColor,getSize=t=>{try{const e=JSON.stringify(t)?.length??0;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}catch{return"\u2014"}},formatBytes=t=>{if(t===0||!t||isNaN(t))return"0 B";const e=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,r)).toFixed(1))} ${n[r]||"B"}`},copyToClipboard=(t,e)=>{const n=typeof t=="function"?t():t;let r="";if(typeof n=="string")r=n;else try{r=JSON.stringify(n,null,2)}catch{r=String(n)}try{typeof $?.setString=="function"?$.setString(r):typeof $?.default?.setString=="function"&&$.default.setString(r)}catch(o){__DEV__&&console.warn("[NetworkInspector] Clipboard.setString failed:",o)}try{M(e?`${e} copied to clipboard`:"Copied to clipboard")}catch{}try{_.OS==="android"&&b?.show&&b.show(e?`${e} copied to clipboard`:"Copied to clipboard",b.SHORT)}catch{}},getPath=t=>{try{const e=new URL(t);return e.pathname+(e.search?e.search:"")}catch{return t.replace(/^https?:\/\/[^/?#]+/,"")||"/"}},getBaseUrl=t=>{try{const e=new URL(t);return`${e.protocol}//${e.host}`}catch{const e=t.match(/^(https?:\/\/[^/]+)/);return e?e[1]:""}},getCurlCommand=t=>{let e=`curl -X ${t.method} "${t.url}"`;if(t.requestHeaders&&Object.entries(t.requestHeaders).forEach(([n,r])=>{e+=` \\
1
+ import{Platform as C,ToastAndroid as y,Alert as M,NativeModules as p,Linking as $}from"react-native";import b from"@react-native-clipboard/clipboard";import{showToast as L}from"./toast";import{copyMediaToClipboard as D}from"../native/NativeInspector";import{AppColors as c}from"../styles/AppColors";import{DOMAIN_COLORS as v,DURATION_FAST_MS as j,DURATION_SLOW_MS as P}from"../constants";export*from"./searchQueryParser";export*from"./memoryManager";export*from"./toast";export const isLocalDebugEnvironment=()=>{const t=typeof __DEV__<"u"&&!!__DEV__,e=p.SourceCode?.scriptURL||"",n=e.startsWith("http://")||e.startsWith("https://")||e.includes(":8081")||e.includes(":8082");return t||n},getDomainColor=t=>{if(!t)return v[0];let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return v[Math.abs(e)%v.length]},formatDateTime=t=>{const e=new Date(t),n=(g,l=2)=>String(g).padStart(l,"0"),r=n(e.getDate()),o=n(e.getMonth()+1),s=e.getFullYear(),i=n(e.getHours()),a=n(e.getMinutes()),f=n(e.getSeconds());return`${r}/${o}/${s} ${i}:${a}:${f}`},formatTimestamp=t=>{try{const e=new Date(t),n=e.getHours().toString().padStart(2,"0"),r=e.getMinutes().toString().padStart(2,"0"),o=e.getSeconds().toString().padStart(2,"0"),s=e.getMilliseconds().toString().padStart(3,"0");return`${n}:${r}:${o}.${s}`}catch{return"\u2014"}},getStatusColor=t=>!t||t===0?c.errorColor:t>=500?c.errorColor:t>=400?c.darkOrange:t>=300?c.warningIconGold:c.greenColor,getDurationColor=t=>t==null?c.grayTextWeak:t<j?c.greenColor:t<P?c.lightOrange:c.errorColor,getSize=t=>{try{const e=JSON.stringify(t)?.length??0;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}catch{return"\u2014"}},formatBytes=t=>{if(t===0||!t||isNaN(t))return"0 B";const e=1024,n=["B","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,r)).toFixed(1))} ${n[r]||"B"}`},copyToClipboard=(t,e)=>{const n=typeof t=="function"?t():t;let r="";if(typeof n=="string")r=n;else try{r=JSON.stringify(n,null,2)}catch{r=String(n)}try{typeof b?.setString=="function"?b.setString(r):typeof b?.default?.setString=="function"&&b.default.setString(r)}catch(o){__DEV__&&console.warn("[NetworkInspector] Clipboard.setString failed:",o)}try{L(e?`${e} copied to clipboard`:"Copied to clipboard")}catch{}try{C.OS==="android"&&y?.show&&y.show(e?`${e} copied to clipboard`:"Copied to clipboard",y.SHORT)}catch{}},copyImageOrMediaToClipboard=async(t,e="Image")=>{if(!t)return;let n=!1;try{n=await D(t)}catch{n=!1}if(!n){copyToClipboard(t,e);return}try{L(`${e} copied to clipboard`)}catch{}try{C.OS==="android"&&y?.show&&y.show(`${e} copied to clipboard`,y.SHORT)}catch{}},getPath=t=>{try{const e=new URL(t);return e.pathname+(e.search?e.search:"")}catch{return t.replace(/^https?:\/\/[^/?#]+/,"")||"/"}},getBaseUrl=t=>{try{const e=new URL(t);return`${e.protocol}//${e.host}`}catch{const e=t.match(/^(https?:\/\/[^/]+)/);return e?e[1]:""}},getCurlCommand=t=>{let e=`curl -X ${t.method} "${t.url}"`;if(t.requestHeaders&&Object.entries(t.requestHeaders).forEach(([n,r])=>{e+=` \\
2
2
  -H "${n}: ${r}"`}),t.request&&t.method!=="GET"){const n=typeof t.request=="string"?t.request:JSON.stringify(t.request);e+=` \\
3
- -d '${n.replace(/'/g,"'\\''")}'`}return e},getFetchCommand=t=>{const e={method:t.method};return t.requestHeaders&&Object.keys(t.requestHeaders).length>0&&(e.headers=t.requestHeaders),t.request&&t.method!=="GET"&&(e.body=JSON.stringify(t.request)),`fetch("${t.url}", ${JSON.stringify(e,null,2)})`},deduplicateLogs=t=>{const e=new Map;return t.forEach(n=>{if(!e.has(n.id))e.set(n.id,n);else{const r=e.get(n.id);(r.status==null&&n.status!=null||(n.startTime??0)>=(r.startTime??0))&&e.set(n.id,n)}}),Array.from(e.values()).sort((n,r)=>r.id-n.id)},escapeRegex=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),getNavigationInfo=(t,e=[])=>{if(!t)return{path:e.length>0?e.join(" \u2794 "):"",params:null};if(t.name&&!t.routes)return{path:e.length>0?[...e,t.name].join(" \u2794 "):t.name,params:t.params||null};if(!t.routes||!Array.isArray(t.routes)||t.routes.length===0)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const n=typeof t.index=="number"&&t.index>=0&&t.index<t.routes.length?t.index:0,r=t.routes[n];if(!r)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const o=r.name?[...e,r.name]:e;return r?.state?getNavigationInfo(r.state,o):{path:o.length>0?o.join(" \u2794 "):r.name||"",params:r.params||null}},getLogPageName=(t,e)=>{const n=e||t?.routeInfo;if(n&&n.path&&n.path!=="Navigators"){const r=n.path.split(" \u2794 ").map(o=>o.trim()).filter(Boolean);return r.length>0?r[r.length-1]:n.path}if(t.caller&&t.caller!=="Unknown")try{const r=t.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);if(r&&r[1]){const o=r[1];if(!["networklogger","fetch","axios","apiclient","request","http","index","nativeinspector","inappinspector","bundleanalyzer"].includes(o.toLowerCase()))return o}}catch{}if(t.url)try{const o=t.url.split("?")[0].split("#")[0].replace(/^https?:\/\//i,""),s=o.indexOf("/");if(s!==-1){const a=o.substring(s+1).split("/").filter(Boolean),f=["api","v1","v2","v3","v4","rest","graphql","json","data","service","app"],g=a.filter(l=>!f.includes(l.toLowerCase()));if(g.length>0){const l=g[0];return l.charAt(0).toUpperCase()+l.slice(1)}}const i=o.split("/")[0];if(i)return i}catch{}return"General"},flattenObject=(t,e="")=>{let n={};return typeof t=="object"&&t!==null?Array.isArray(t)?t.forEach((r,o)=>{Object.assign(n,flattenObject(r,e?`${e}[${o}]`:`[${o}]`))}):Object.keys(t).forEach(r=>{Object.assign(n,flattenObject(t[r],e?`${e}.${r}`:r))}):n[e||"root"]=t,n},getDiff=(t,e)=>{const n=flattenObject(t),r=flattenObject(e),o=[];return new Set([...Object.keys(n),...Object.keys(r)]).forEach(i=>{i in n?i in r?n[i]!==r[i]&&o.push({type:"changed",path:i,oldVal:n[i],newVal:r[i]}):o.push({type:"removed",path:i,oldVal:n[i]}):o.push({type:"added",path:i,newVal:r[i]})}),o.sort((i,a)=>i.path.localeCompare(a.path))},formatDisplayUrl=t=>t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`:"",getLocalizedFilePath=(t,e,n)=>t.replace("country-language",`${e?.toLowerCase()}-${n?.toLowerCase()}`),getLocalizedFilePathWithSlash=(t,e,n)=>t.replace("country/language",`${e?.toLowerCase()}/${n?.toLowerCase()}`),isAllValuesEmpty=t=>!t||typeof t!="object"?!0:Object.values(t).every(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0),formatDateTimeToAnalytics=t=>new Date(t)?.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),getBundleIdentifier=()=>{const t=p.RNDeviceInfo;if(t&&typeof t.bundleId=="string")return t.bundleId;if(t&&typeof t.getBundleId=="function")try{const o=t.getBundleId();if(typeof o=="string")return o}catch{}const e=p.ExponentConstants;if(e&&e.manifest){const o=e.manifest;if(o.ios&&o.ios.bundleIdentifier)return o.ios.bundleIdentifier;if(o.android&&o.android.package)return o.android.package}const n=p.ExpoApplication;if(n&&typeof n.applicationId=="string")return n.applicationId;const r=p.SourceCode;if(r&&typeof r.scriptURL=="string"){const o=r.scriptURL;if(o.includes("assets/"))try{const s=o.match(/assets\/([^/?#]+)/);if(s&&s[1])return s[1]}catch{}}return"org.reactjs.native.example"},getAppName=()=>{const t=p.PlatformConstants;t&&t.interfaceIdiom;const e=p.RNDeviceInfo;if(e&&typeof e.appName=="string")return e.appName;const n=p.ExpoApplication;if(n&&typeof n.applicationName=="string")return n.applicationName;const r=p.ExponentConstants;if(r&&r.manifest){const i=r.manifest;if(i.name)return i.name}const o=p.AppInfo;if(o&&typeof o.appName=="string")return o.appName;const s=getBundleIdentifier();if(s&&s!=="org.reactjs.native.example"){const i=s.split("."),a=i[i.length-1];return a?a.charAt(0).toUpperCase()+a.slice(1):"App"}return"App"},getAppVersionAndBuild=()=>{let t="",e="";const n=p.ExpoApplication;n&&(typeof n.nativeAppVersion=="string"&&(t=n.nativeAppVersion),typeof n.nativeBuildVersion=="string"&&(e=n.nativeBuildVersion));const r=p.ExponentConstants;if(r){const a=r.manifest||r.expoConfig;a&&(!t&&a.version&&(t=String(a.version)),e||(a.ios?.buildNumber?e=String(a.ios.buildNumber):a.android?.versionCode&&(e=String(a.android.versionCode))))}const o=p.RNDeviceInfo;if(o){if(!t){if(typeof o.appVersion=="string")t=o.appVersion;else if(typeof o.getVersion=="function")try{t=o.getVersion()}catch{}}if(!e){if(typeof o.buildNumber=="string")e=o.buildNumber;else if(typeof o.getBuildNumber=="function")try{e=o.getBuildNumber()}catch{}}}const s=_.constants||p.PlatformConstants;if(s&&(!t&&s.Version&&typeof s.Version=="string"&&s.Version.includes(".")&&(t=s.Version),!t&&s.reactNativeVersion)){const a=s.reactNativeVersion;a.major!==void 0&&(t=`${a.major}.${a.minor}.${a.patch}`)}const i=p.AppInfo;return i&&(!t&&typeof i.versionName=="string"&&(t=i.versionName),!e&&typeof i.versionCode=="string"&&(e=i.versionCode)),t||(t="1.0.0"),e||(e="1"),{version:t,build:e,formatted:`${t} (${e})`}},handleOpenExternalLink=t=>{if(!t)return;const e=formatDisplayUrl(t);D.alert("Open Link",`Do you want to open this link in your web browser?
3
+ -d '${n.replace(/'/g,"'\\''")}'`}return e},getFetchCommand=t=>{const e={method:t.method};return t.requestHeaders&&Object.keys(t.requestHeaders).length>0&&(e.headers=t.requestHeaders),t.request&&t.method!=="GET"&&(e.body=JSON.stringify(t.request)),`fetch("${t.url}", ${JSON.stringify(e,null,2)})`},deduplicateLogs=t=>{const e=new Map;return t.forEach(n=>{if(!e.has(n.id))e.set(n.id,n);else{const r=e.get(n.id);(r.status==null&&n.status!=null||(n.startTime??0)>=(r.startTime??0))&&e.set(n.id,n)}}),Array.from(e.values()).sort((n,r)=>r.id-n.id)},escapeRegex=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),getNavigationInfo=(t,e=[])=>{if(!t)return{path:e.length>0?e.join(" \u2794 "):"",params:null};if(t.name&&!t.routes)return{path:e.length>0?[...e,t.name].join(" \u2794 "):t.name,params:t.params||null};if(!t.routes||!Array.isArray(t.routes)||t.routes.length===0)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const n=typeof t.index=="number"&&t.index>=0&&t.index<t.routes.length?t.index:0,r=t.routes[n];if(!r)return{path:e.length>0?e.join(" \u2794 "):"",params:null};const o=r.name?[...e,r.name]:e;return r?.state?getNavigationInfo(r.state,o):{path:o.length>0?o.join(" \u2794 "):r.name||"",params:r.params||null}},getLogPageName=(t,e)=>{const n=e||t?.routeInfo;if(n&&n.path&&n.path!=="Navigators"){const r=n.path.split(" \u2794 ").map(o=>o.trim()).filter(Boolean);return r.length>0?r[r.length-1]:n.path}if(t.caller&&t.caller!=="Unknown")try{const r=t.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);if(r&&r[1]){const o=r[1];if(!["networklogger","fetch","axios","apiclient","request","http","index","nativeinspector","inappinspector","bundleanalyzer"].includes(o.toLowerCase()))return o}}catch{}if(t.url)try{const o=t.url.split("?")[0].split("#")[0].replace(/^https?:\/\//i,""),s=o.indexOf("/");if(s!==-1){const a=o.substring(s+1).split("/").filter(Boolean),f=["api","v1","v2","v3","v4","rest","graphql","json","data","service","app"],g=a.filter(l=>!f.includes(l.toLowerCase()));if(g.length>0){const l=g[0];return l.charAt(0).toUpperCase()+l.slice(1)}}const i=o.split("/")[0];if(i)return i}catch{}return"General"},flattenObject=(t,e="")=>{let n={};return typeof t=="object"&&t!==null?Array.isArray(t)?t.forEach((r,o)=>{Object.assign(n,flattenObject(r,e?`${e}[${o}]`:`[${o}]`))}):Object.keys(t).forEach(r=>{Object.assign(n,flattenObject(t[r],e?`${e}.${r}`:r))}):n[e||"root"]=t,n},getDiff=(t,e)=>{const n=flattenObject(t),r=flattenObject(e),o=[];return new Set([...Object.keys(n),...Object.keys(r)]).forEach(i=>{i in n?i in r?n[i]!==r[i]&&o.push({type:"changed",path:i,oldVal:n[i],newVal:r[i]}):o.push({type:"removed",path:i,oldVal:n[i]}):o.push({type:"added",path:i,newVal:r[i]})}),o.sort((i,a)=>i.path.localeCompare(a.path))},formatDisplayUrl=t=>t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`:"",getLocalizedFilePath=(t,e,n)=>t.replace("country-language",`${e?.toLowerCase()}-${n?.toLowerCase()}`),getLocalizedFilePathWithSlash=(t,e,n)=>t.replace("country/language",`${e?.toLowerCase()}/${n?.toLowerCase()}`),isAllValuesEmpty=t=>!t||typeof t!="object"?!0:Object.values(t).every(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0),formatDateTimeToAnalytics=t=>new Date(t)?.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),getBundleIdentifier=()=>{const t=p.RNDeviceInfo;if(t&&typeof t.bundleId=="string")return t.bundleId;if(t&&typeof t.getBundleId=="function")try{const o=t.getBundleId();if(typeof o=="string")return o}catch{}const e=p.ExponentConstants;if(e&&e.manifest){const o=e.manifest;if(o.ios&&o.ios.bundleIdentifier)return o.ios.bundleIdentifier;if(o.android&&o.android.package)return o.android.package}const n=p.ExpoApplication;if(n&&typeof n.applicationId=="string")return n.applicationId;const r=p.SourceCode;if(r&&typeof r.scriptURL=="string"){const o=r.scriptURL;if(o.includes("assets/"))try{const s=o.match(/assets\/([^/?#]+)/);if(s&&s[1])return s[1]}catch{}}return"org.reactjs.native.example"},getAppName=()=>{const t=p.PlatformConstants;t&&t.interfaceIdiom;const e=p.RNDeviceInfo;if(e&&typeof e.appName=="string")return e.appName;const n=p.ExpoApplication;if(n&&typeof n.applicationName=="string")return n.applicationName;const r=p.ExponentConstants;if(r&&r.manifest){const i=r.manifest;if(i.name)return i.name}const o=p.AppInfo;if(o&&typeof o.appName=="string")return o.appName;const s=getBundleIdentifier();if(s&&s!=="org.reactjs.native.example"){const i=s.split("."),a=i[i.length-1];return a?a.charAt(0).toUpperCase()+a.slice(1):"App"}return"App"},getAppVersionAndBuild=()=>{let t="",e="";const n=p.ExpoApplication;n&&(typeof n.nativeAppVersion=="string"&&(t=n.nativeAppVersion),typeof n.nativeBuildVersion=="string"&&(e=n.nativeBuildVersion));const r=p.ExponentConstants;if(r){const a=r.manifest||r.expoConfig;a&&(!t&&a.version&&(t=String(a.version)),e||(a.ios?.buildNumber?e=String(a.ios.buildNumber):a.android?.versionCode&&(e=String(a.android.versionCode))))}const o=p.RNDeviceInfo;if(o){if(!t){if(typeof o.appVersion=="string")t=o.appVersion;else if(typeof o.getVersion=="function")try{t=o.getVersion()}catch{}}if(!e){if(typeof o.buildNumber=="string")e=o.buildNumber;else if(typeof o.getBuildNumber=="function")try{e=o.getBuildNumber()}catch{}}}const s=C.constants||p.PlatformConstants;if(s&&(!t&&s.Version&&typeof s.Version=="string"&&s.Version.includes(".")&&(t=s.Version),!t&&s.reactNativeVersion)){const a=s.reactNativeVersion;a.major!==void 0&&(t=`${a.major}.${a.minor}.${a.patch}`)}const i=p.AppInfo;return i&&(!t&&typeof i.versionName=="string"&&(t=i.versionName),!e&&typeof i.versionCode=="string"&&(e=i.versionCode)),t||(t="1.0.0"),e||(e="1"),{version:t,build:e,formatted:`${t} (${e})`}},handleOpenExternalLink=t=>{if(!t)return;const e=formatDisplayUrl(t);M.alert("Open Link",`Do you want to open this link in your web browser?
4
4
 
5
- ${e}`,[{text:"Cancel",style:"cancel"},{text:"Open",onPress:()=>{S.openURL(e).catch(()=>{})}}])},formatTimeShort=t=>{const e=new Date(t),n=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0");return`${n}:${r}:${o}`},formatTime=t=>{const e=new Date(t),n=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0"),s=String(e.getMilliseconds()).padStart(3,"0");return`${n}:${r}:${o}.${s}`},formatGap=t=>{if(t<1e3)return`+${t}ms`;const e=Math.round(t/1e3);if(e<60)return`+${e}s`;const n=Math.floor(e/60),r=e%60;return r>0?`+${n}m ${r}s`:`+${n}m`},getJsonContent=t=>{if(!t)return null;const e=[];for(let n=0;n<t.length;n++)(t[n]==="{"||t[n]==="[")&&e.push(n);for(const n of e){const r=t.substring(n).trim();try{const o=JSON.parse(r);if(o!==null&&typeof o=="object")return{header:t.substring(0,n).trim(),data:o}}catch{}}return null},getJsonPreviewText=(t,e=4)=>{try{const n=JSON.stringify(t,null,2),r=n.split(`
5
+ ${e}`,[{text:"Cancel",style:"cancel"},{text:"Open",onPress:()=>{$.openURL(e).catch(()=>{})}}])},formatTimeShort=t=>{const e=new Date(t),n=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0");return`${n}:${r}:${o}`},formatTime=t=>{const e=new Date(t),n=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0"),s=String(e.getMilliseconds()).padStart(3,"0");return`${n}:${r}:${o}.${s}`},formatGap=t=>{if(t<1e3)return`+${t}ms`;const e=Math.round(t/1e3);if(e<60)return`+${e}s`;const n=Math.floor(e/60),r=e%60;return r>0?`+${n}m ${r}s`:`+${n}m`},getJsonContent=t=>{if(!t)return null;const e=[];for(let n=0;n<t.length;n++)(t[n]==="{"||t[n]==="[")&&e.push(n);for(const n of e){const r=t.substring(n).trim();try{const o=JSON.parse(r);if(o!==null&&typeof o=="object")return{header:t.substring(0,n).trim(),data:o}}catch{}}return null},getJsonPreviewText=(t,e=4)=>{try{const n=JSON.stringify(t,null,2),r=n.split(`
6
6
  `);return r.length>e?{text:r.slice(0,e).join(`
7
7
  `)+`
8
- ...`,hasMore:!0}:{text:n,hasMore:!1}}catch{return{text:String(t),hasMore:!1}}},parseStackLine=(t,e=!1)=>{let n=t.trim().replace(/^at /,"");if(n.includes("@")){const w=n.indexOf("@"),O=n.substring(0,w).trim(),I=n.substring(w+1).trim();n=O?`${O} (${I})`:I}const r=n.match(/^(.*?)\s*\((.*?)\)$/);let o="<anonymous>",s=n;r&&(o=r[1].trim()||"<anonymous>",s=r[2].trim()),(o.startsWith("?anon_")||o==="?")&&(o="anonymous"),s=s.replace(/^address at /,"");const i=s.match(/^(.*?):(\d+):(\d+)$/);let a=s,f,g;i&&(a=i[1],f=i[2],g=i[3]);let l=a.split("?")[0].split("&")[0].replace(/[)]+$/,"").replace(/\/\/+$/,"");l=l.replace(/^(?:https?:\/\/[^\/]+\/|file:\/\/\/|webpack:\/\/\/?)/,"");const m=l.split("/").filter(Boolean).pop()||l,y=m.match(/\.([a-z0-9]+)$/i),u=y?y[1].toLowerCase():"",h=u==="tsx"||u==="jsx"||u==="ts"||u==="js"?u:"other",x=s==="native"||l==="native",C=l.includes("InternalBytecode")||l.includes("metro-runtime")||l.includes("regenerator-runtime")||o==="tryCallOne"||o==="asyncGeneratorStep"||o==="_next"||o==="next"&&x,N=l.includes("node_modules")||l.includes("react-native/Libraries")||l.includes("react-native-inapp-inspector")&&!l.includes("/example/"),A=!x&&!C&&!N&&(h==="tsx"||h==="jsx"||h==="ts"||h==="js"||!m.includes(".bundle")),L=A?"app":N?"dependency":x?"native":"runtime",B=C||x||o==="asyncGeneratorStep"||o==="_next";let d=l;d.includes("/example/")?d=d.substring(d.indexOf("/example/")+9):d.includes("/src/")?d=d.substring(d.indexOf("/src/")+1):d.includes("/node_modules/")&&(d=d.substring(d.indexOf("/node_modules/")+14));const E=f?`${m}:${f}${g?`:${g}`:""}`:m;return{raw:t,functionName:o,fileName:m,fullPath:d,rawFilePath:a,fileExt:h,frameType:L,isUserCode:A,isRuntimeNoise:B,lineNumber:f,columnNumber:g,isOrigin:e,copyableLocation:E}},openInVSCode=(t,e,n)=>{const r=e?Number(e):1,o=n?Number(n):1,s=e?`:${e}`:"",i=n?`:${n}`:"",a=t.replace(/^file:\/\//,"");let f=null;try{const u=p?.SourceCode?.scriptURL||p?.PlatformConstants?.serverHost||p?.DevSettings?.serverHost;if(typeof u=="string"&&u.length>0){const h=u.match(/^(https?:\/\/[^/]+)/);h?f=h[1]:!u.startsWith("http")&&u.includes(":")&&(f=`http://${u}`)}}catch{}Array.from(new Set([...f?[f]:[],"http://localhost:8081","http://127.0.0.1:8081","http://10.0.2.2:8081"])).forEach(u=>{try{fetch(`${u}/open-stack-frame`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:a,lineNumber:r,column:o})}).catch(()=>{})}catch{}});const l=`vscode://file/${a.replace(/^\/+/,"")}${s}${i}`,m=`cursor://file/${a.replace(/^\/+/,"")}${s}${i}`,y=`vscode-insiders://file/${a.replace(/^\/+/,"")}${s}${i}`;S.openURL(l).catch(()=>{S.openURL(m).catch(()=>{S.openURL(y).catch(()=>{copyToClipboard(`${a}${s}${i}`,"Location")})})})},ANALYTICS_EVENT_PALETTE=[c.googleBlue,c.googleGreen,c.googlePurple,c.googleTeal,c.googleRed,c.googleOrange,c.blue700,c.materialGreen],getEventColor=t=>{const e=typeof t=="string"?t:String(t||"");let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return ANALYTICS_EVENT_PALETTE[Math.abs(n)%ANALYTICS_EVENT_PALETTE.length]};export{getEventCategory,registerGAPlugin}from"./gaAnalyticsRegistry";export const getCategoryColors=t=>{switch(t){case"page_view":case"Page View":return{bg:c.blueBg,border:c.blueBorder,text:c.blue800};case"ecommerce":case"Ecommerce":return{bg:c.greenBg,border:c.greenBorder,text:c.materialGreen};case"system":case"System":return{bg:c.greyBg,border:c.greyBorder,text:c.grey600};default:return{bg:c.purpleBg,border:c.purpleBorder,text:c.purpleText}}},getRuntimeDiagnostics=()=>{const t=typeof global.HermesInternal<"u",e=typeof global._v8runtime<"u",n=t?"hermes":e?"v8":"jsc",o=typeof global.nativeFabricUIManager<"u"||!!global.__turboModuleProxy?"fabric":"paper";let s=32.4,i=64;try{const a=global.HermesInternal?.getInstrumentedStats?.();a?.js_heap_size?(s=Number((a.js_heap_size/(1024*1024)).toFixed(1)),i=Number(((a.js_allocated_bytes||a.js_heap_size*1.6)/(1024*1024)).toFixed(1))):global.performance?.memory?.usedJSHeapSize&&(s=Number((global.performance.memory.usedJSHeapSize/(1024*1024)).toFixed(1)),i=Number((global.performance.memory.totalJSHeapSize/(1024*1024)).toFixed(1)))}catch{}return{engineType:n,archType:o,usedHeapMb:s,totalAllocMb:i}};
8
+ ...`,hasMore:!0}:{text:n,hasMore:!1}}catch{return{text:String(t),hasMore:!1}}},parseStackLine=(t,e=!1)=>{let n=t.trim().replace(/^at /,"");if(n.includes("@")){const O=n.indexOf("@"),I=n.substring(0,O).trim(),_=n.substring(O+1).trim();n=I?`${I} (${_})`:_}const r=n.match(/^(.*?)\s*\((.*?)\)$/);let o="<anonymous>",s=n;r&&(o=r[1].trim()||"<anonymous>",s=r[2].trim()),(o.startsWith("?anon_")||o==="?")&&(o="anonymous"),s=s.replace(/^address at /,"");const i=s.match(/^(.*?):(\d+):(\d+)$/);let a=s,f,g;i&&(a=i[1],f=i[2],g=i[3]);let l=a.split("?")[0].split("&")[0].replace(/[)]+$/,"").replace(/\/\/+$/,"");l=l.replace(/^(?:https?:\/\/[^\/]+\/|file:\/\/\/|webpack:\/\/\/?)/,"");const m=l.split("/").filter(Boolean).pop()||l,x=m.match(/\.([a-z0-9]+)$/i),u=x?x[1].toLowerCase():"",h=u==="tsx"||u==="jsx"||u==="ts"||u==="js"?u:"other",S=s==="native"||l==="native",N=l.includes("InternalBytecode")||l.includes("metro-runtime")||l.includes("regenerator-runtime")||o==="tryCallOne"||o==="asyncGeneratorStep"||o==="_next"||o==="next"&&S,w=l.includes("node_modules")||l.includes("react-native/Libraries")||l.includes("react-native-inapp-inspector")&&!l.includes("/example/"),A=!S&&!N&&!w&&(h==="tsx"||h==="jsx"||h==="ts"||h==="js"||!m.includes(".bundle")),T=A?"app":w?"dependency":S?"native":"runtime",B=N||S||o==="asyncGeneratorStep"||o==="_next";let d=l;d.includes("/example/")?d=d.substring(d.indexOf("/example/")+9):d.includes("/src/")?d=d.substring(d.indexOf("/src/")+1):d.includes("/node_modules/")&&(d=d.substring(d.indexOf("/node_modules/")+14));const E=f?`${m}:${f}${g?`:${g}`:""}`:m;return{raw:t,functionName:o,fileName:m,fullPath:d,rawFilePath:a,fileExt:h,frameType:T,isUserCode:A,isRuntimeNoise:B,lineNumber:f,columnNumber:g,isOrigin:e,copyableLocation:E}},openInVSCode=(t,e,n)=>{const r=e?Number(e):1,o=n?Number(n):1,s=e?`:${e}`:"",i=n?`:${n}`:"",a=t.replace(/^file:\/\//,"");let f=null;try{const u=p?.SourceCode?.scriptURL||p?.PlatformConstants?.serverHost||p?.DevSettings?.serverHost;if(typeof u=="string"&&u.length>0){const h=u.match(/^(https?:\/\/[^/]+)/);h?f=h[1]:!u.startsWith("http")&&u.includes(":")&&(f=`http://${u}`)}}catch{}Array.from(new Set([...f?[f]:[],"http://localhost:8081","http://127.0.0.1:8081","http://10.0.2.2:8081"])).forEach(u=>{try{fetch(`${u}/open-stack-frame`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:a,lineNumber:r,column:o})}).catch(()=>{})}catch{}});const l=`vscode://file/${a.replace(/^\/+/,"")}${s}${i}`,m=`cursor://file/${a.replace(/^\/+/,"")}${s}${i}`,x=`vscode-insiders://file/${a.replace(/^\/+/,"")}${s}${i}`;$.openURL(l).catch(()=>{$.openURL(m).catch(()=>{$.openURL(x).catch(()=>{copyToClipboard(`${a}${s}${i}`,"Location")})})})},ANALYTICS_EVENT_PALETTE=[c.googleBlue,c.googleGreen,c.googlePurple,c.googleTeal,c.googleRed,c.googleOrange,c.blue700,c.materialGreen],getEventColor=t=>{const e=typeof t=="string"?t:String(t||"");let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return ANALYTICS_EVENT_PALETTE[Math.abs(n)%ANALYTICS_EVENT_PALETTE.length]};export{getEventCategory,registerGAPlugin}from"./gaAnalyticsRegistry";export const getCategoryColors=t=>{switch(t){case"page_view":case"Page View":return{bg:c.blueBg,border:c.blueBorder,text:c.blue800};case"ecommerce":case"Ecommerce":return{bg:c.greenBg,border:c.greenBorder,text:c.materialGreen};case"system":case"System":return{bg:c.greyBg,border:c.greyBorder,text:c.grey600};default:return{bg:c.purpleBg,border:c.purpleBorder,text:c.purpleText}}},getRuntimeDiagnostics=()=>{const t=typeof global.HermesInternal<"u",e=typeof global._v8runtime<"u",n=t?"hermes":e?"v8":"jsc",o=typeof global.nativeFabricUIManager<"u"||!!global.__turboModuleProxy?"fabric":"paper";let s=32.4,i=64;try{const a=global.HermesInternal?.getInstrumentedStats?.();a?.js_heap_size?(s=Number((a.js_heap_size/(1024*1024)).toFixed(1)),i=Number(((a.js_allocated_bytes||a.js_heap_size*1.6)/(1024*1024)).toFixed(1))):global.performance?.memory?.usedJSHeapSize&&(s=Number((global.performance.memory.usedJSHeapSize/(1024*1024)).toFixed(1)),i=Number((global.performance.memory.totalJSHeapSize/(1024*1024)).toFixed(1)))}catch{}return{engineType:n,archType:o,usedHeapMb:s,totalAllocMb:i}};
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import Tt,{useEffect as i,useMemo as y,useRef as f,useState as a,useCallback as I}from"react";import{Alert as ce,Animated as u,Easing as lr,PanResponder as Qr,Platform as Et,UIManager as Yr,LogBox as cr}from"react-native";import{NavigationContext as Zr}from"@react-navigation/native";import{I18nextProvider as Kr,i18n as en}from"./i18n";import Cn from"./components/ErrorBoundary";import Sn from"./components/Inspector/MainScreen";import{InspectorContext as xn,animateNextLayout as bn}from"./components/Inspector/InspectorContext";import{formatDisplayUrl as Ln,getNavigationInfo as ur,getLogPageName as wn,deduplicateLogs as tt,getDomainColor as vn,getEventCategory as Rn,matchNetworkLogQuery as An,setupMemoryWarningHandler as Nn}from"./helpers";import{loadSettings as Mn,saveSettings as Tn,setCustomStorage as En,clearPersistedSettings as Pn,calculateRamBasedLimits as fr}from"./helpers/settingsStore";import{getNativeSystemMetrics as In,pushNativeLogRecord as Ae,fetchNativeCachedPage as Dn}from"./native/NativeInspector";import{setupNetworkLogger as Fn,clearNetworkLogs as Pt,subscribeNetworkLogs as On,setNetworkModuleEnabled as Bn,setMaxNetworkLogsLimit as Vn,setRouteInfoProvider as dr}from"./customHooks/networkLogger";import{setupConsoleLogger as _n,clearConsoleLogs as mr,subscribeConsoleLogs as kn,setConsoleModuleEnabled as qn}from"./customHooks/consoleLogger";import{IGNORED_LOG_PREFIXES as ue}from"./customHooks/logFilters";import{setupGlobalCrashHandler as Hn,subscribeCrashEvents as Un,getCrashRecords as st,clearCrashRecords as pr,setMaxCrashLogsLimit as hr,setCrashModuleEnabled as jn}from"./customHooks/crashHandler";import{trackActiveTelemetryHeartbeat as zn,setTelemetryEnabled as gr,trackInspectorTabView as yr,trackInspectorScreenView as $n}from"./helpers/telemetry";import{subscribeAnalyticsEvents as Wn,clearAnalyticsEvents as Cr,autoSetupAnalyticsLogger as Jn,isAnalyticsConnected as It,setAnalyticsModuleEnabled as Gn}from"./customHooks/analyticsLogger";import{getReduxState as Dt,subscribeReduxState as Xn,setReduxAutoRefresh as Qn,getLastActionForReducer as Ft,clearActionHistory as Yn,isReduxConnected as Ot,setReduxModuleEnabled as Zn}from"./customHooks/reduxLogger";import{setPerformanceModuleEnabled as Kn}from"./customHooks/performanceTracker";import{setBundleModuleEnabled as ea}from"./customHooks/bundleAnalyzer";import{hideNativeFloatingButton as Ne,subscribeNativeFloatingButtonPress as ta,subscribeNativeDeviceShake as sa,isNativeModuleAvailable as ra}from"./native/NativeInspector";import{fetchRemoteConfigModuleStatus as na}from"./helpers/remoteConfig";import{ScreenCapture as aa}from"./capture";import{LIB_VERSION as oa}from"./constants";import{toggleGlobalTheme as Sr}from"./styles";const Ca=({enabled:v=!0,storage:O,navigationRef:L,appIcon:Bt,environment:Vt,initialVisible:xr=!1,visible:Me,remoteConfig:Te})=>{En(O||null);const[Ee,rt]=a(!1),[_t,Pe]=a(null),[kt,Ie]=a({}),[De,nt]=a(90),[Fe,at]=a("slide"),[C,B]=a([]),[g,Y]=a(Me??xr??!1),[qt,ot]=a(!1),br=I(()=>{ot(!0),Y(!1)},[]);i(()=>{Me!==void 0&&Y(Me)},[Me]);const[Ht,Ut]=a(!1),[p,it]=a(null),[Oe,fe]=a(new Set),[Z,jt]=a(""),[Be,Lr]=a("all"),[Ve,wr]=a(!1),[_e,vr]=a(!1),[N,Rr]=a("all"),[zt,lt]=a(""),[$t,Ar]=a(""),[Wt,ct]=a(null),[Jt,ut]=a(null),[Gt,Nr]=a("state"),[Xt,Qt]=a("response");i(()=>(cr.ignoreAllLogs(v),()=>{cr.ignoreAllLogs(!1)}),[v]),i(()=>{p&&(Qt("response"),lt(""))},[p]);const[de,ft]=a(new Set),[me,dt]=a(new Set),[Yt,mt]=a({}),[Zt,pt]=a(new Set),[Kt,Mr]=a(!0),[ke,Tr]=a("newest"),[qe,Er]=a("newest"),[es,ts]=a(!0),[ss,rs]=a(!0),[ns,as]=a(!1),[os,is]=a(!1),[m,$]=a("apis"),[He,W]=a([]),[J,G]=a([]),[ls,ht]=a(null),[K,Pr]=a(!1),cs=f(K);cs.current=K;const pe=f([]),[ee,Ir]=a(!1),us=f(ee);us.current=ee;const he=f([]),[te,Dr]=a(!1),fs=f(te);fs.current=te;const ge=f([]),[ds,ms]=a(0),[ps,hs]=a(0),[gs,ys]=a(0),[Cs,Ss]=a(0),Ue=I(async()=>{try{const t=await aa.getMediaList(),e=t?t.length:0;return Ss(e),e}catch{return Ss(0),0}},[]);i(()=>{g&&Ue()},[g,Ue]);const[ye,V]=a(()=>st()),[xs,se]=a(null),[_,je]=a(50);i(()=>{hr(_)},[_]),i(()=>{g&&(m==="apis"&&hs(C.length),m==="logs"&&ms(J.length),m==="crash"&&ys(ye.length))},[g]),i(()=>{m==="apis"&&hs(C.length)},[m,C.length]),i(()=>{m==="logs"&&ms(J.length)},[m,J.length]),i(()=>{m==="crash"&&ys(ye.length)},[m,ye.length]);const[re,ze]=a(100),[k,gt]=a({info:!0,warn:!0,error:!0}),q=y(()=>J.filter(e=>{const r=e.type;if(r==="info"&&!k?.info||r==="warn"&&!k?.warn||r==="error"&&!k?.error)return!1;const s=e.message||"";return![...ue&&ue.info||[],...ue&&ue.warn||[],...ue&&ue.error||[]].filter(d=>typeof d=="string"&&d.trim().length>0).some(d=>s.toLowerCase().trim().startsWith(d.toLowerCase().trim())||s.toLowerCase().trim().includes(d.toLowerCase().trim()))}).slice(0,re),[J,k,re]),[M,bs]=a(""),[T,Ls]=a(new Set(["all"])),[ws,Fr]=a(null),[vs,Or]=a(!1),[Rs,Br]=a(!1),[As,Vr]=a("module"),[S,$e]=a({apis:!0,logs:!0,analytics:!1,redux:!1,bundle:!1,performance:!1,crash:!1,device:!1,storage:!1,debugging:!1,media:!0}),[H,We]=a(250),[ne,Je]=a(150),[ae,yt]=a(!0),[Ct,_r]=a(1800),[oe,St]=a(!0),[Ge,xt]=a(1),[U,Xe]=a("apis"),[j,bt]=a(!1),[Lt,wt]=a(!0);i(()=>{Bn(!!S.apis),qn(!!S.logs),Gn(!!S.analytics),Zn(!!S.redux),Kn(!!S.performance),jn(!!S.crash),ea(!!S.bundle)},[S]),i(()=>{In().then(t=>{if(t){const e=t.totalPhysicalRamMb-t.residentRamMb,r=Math.max(200,Math.round(e>0?e:1500));if(_r(r),ae){const s=fr(r);We(s.maxNetworkLogs),ze(s.maxConsoleLogs),Je(s.maxAnalyticsEvents),je(s.maxCrashRecords)}}}).catch(()=>{})},[ae]);const kr=async()=>{await Pn(),rt(!1),Sr(!1),nt(90),at("slide"),$e({apis:!0,logs:!0,analytics:!1,redux:!1,bundle:!1,performance:!1,crash:!1,device:!1,storage:!1,debugging:!1,media:!0}),Xe("apis"),yt(!0);const t=fr(Ct);je(t.maxCrashRecords),We(t.maxNetworkLogs),ze(t.maxConsoleLogs),Je(t.maxAnalyticsEvents),gt({info:!0,warn:!0,error:!0}),St(!0),xt(1),bt(!1),wt(!0),ce.alert("Settings Reset","All settings have been reset to default values.")},Ns=f(!1);i(()=>{let t=!1;return Mn().then(e=>{if(!t){if(e.isDark!=null&&(rt(e.isDark),Sr(e.isDark)),e.modalHeightPercent!=null&&nt(e.modalHeightPercent),e.modalAnimationType&&at(e.modalAnimationType),e.tabVisibility&&$e(r=>({...r,...e.tabVisibility,apis:!0})),e.defaultTab&&Xe(e.defaultTab),e.isAutoRamLimitEnabled!=null&&yt(e.isAutoRamLimitEnabled),e.maxNetworkLogs!=null&&We(e.maxNetworkLogs),e.maxConsoleLogs!=null&&ze(e.maxConsoleLogs),e.maxAnalyticsEventsLimit!=null&&Je(e.maxAnalyticsEventsLimit),e.maxCrashLogs!=null&&je(e.maxCrashLogs),e.showConsoleLevels&&gt(e.showConsoleLevels),e.reduxAutoRefresh!=null&&St(e.reduxAutoRefresh),e.reduxExpandDepth!=null&&xt(e.reduxExpandDepth),e.showDuplicateLogs!=null&&bt(e.showDuplicateLogs),e.showUpdateToast!=null&&wt(e.showUpdateToast),e.defaultTab){const r=e.defaultTab,s={apis:!0,logs:!0,analytics:!1,redux:!1,bundle:!1,performance:!1,crash:!1,device:!1,storage:!1,...e.tabVisibility||{},apis:!0};$(s[r]?r:"apis")}Ns.current=!0}}),()=>{t=!0}},[]),i(()=>{let t=!0;if(Te!==!1)return na(typeof Te=="object"?Te:void 0).then(e=>{t&&e&&$e(r=>({...r,...e,apis:e.apis??!0}))}).catch(()=>{}),()=>{t=!1}},[Te]),i(()=>{Ns.current&&Tn({isDark:Ee,modalHeightPercent:De,modalAnimationType:Fe,tabVisibility:S,defaultTab:U,maxNetworkLogs:H,maxConsoleLogs:re,maxAnalyticsEventsLimit:ne,maxCrashLogs:_,isAutoRamLimitEnabled:ae,showConsoleLevels:k,reduxAutoRefresh:oe,reduxExpandDepth:Ge,showDuplicateLogs:j,showUpdateToast:Lt})},[Ee,De,Fe,S,U,H,re,ne,_,ae,k,oe,Ge,j]);const[Ce,qr]=a(null),Ms=y(()=>{if(!Ce)return!1;const t=s=>s.replace(/^v/,"").split(".").map(n=>parseInt(n,10)||0),e=t(oa),r=t(Ce);for(let s=0;s<3;s++){if((r[s]||0)>(e[s]||0))return!0;if((r[s]||0)<(e[s]||0))return!1}return!1},[Ce]);i(()=>{if(typeof __DEV__>"u"||!__DEV__)return;let t=!1;return fetch("https://registry.npmjs.org/react-native-inapp-inspector/latest").then(e=>e.ok?e.json():null).then(e=>{!t&&e&&typeof e.version=="string"&&qr(e.version)}).catch(()=>{}),()=>{t=!0}},[]),i(()=>{Qn(oe)},[oe]),i(()=>{m==="redux"&&!Ot()&&$("apis"),m==="analytics"&&!It()&&$("apis")},[m]);const Ts=t=>{t!=="apis"&&(t==="redux"&&!Ot()||t==="analytics"&&!It()||$e(e=>{const r=!e[t],s={...e,[t]:r};return!r&&m===t&&(bn(),$("apis")),!r&&U===t&&Xe("apis"),s}))},vt=I(async(t,e="")=>{if(t==="apis"||t==="logs"||t==="analytics"||t==="crash"){const r=await Dn(t,0,100,e);r&&r.items&&r.items.length>0&&(t==="apis"?B(r.items):t==="logs"?G(r.items):t==="analytics"?W(r.items):t==="crash"&&V(r.items))}},[]),Es=I(t=>{t==="redux"&&!Ot()||t==="analytics"&&!It()||(it(null),Qe(null),ht(null),ct(null),ut(null),se(null),typeof Tt.startTransition=="function"?Tt.startTransition(()=>{$(t),vt(t)}):($(t),vt(t)),yr(t))},[vt]),[Ps,Qe]=a(null),[ie,Is]=a(""),[o,Ds]=a({categories:new Set(["all"]),screens:new Set,sources:new Set(["all"]),userTypes:new Set(["all"]),timeWindow:"all",payloadComplexity:"all",hasRevenue:!1,hasItems:!1,hasUserProps:!1,hasParams:!1,onlyDuplicates:!1,onlyConversions:!1,sortBy:"time_desc"}),Fs=y(()=>!!(o.categories.size>0&&!o.categories.has("all")||o.screens.size>0||o.sources.size>0&&!o.sources.has("all")||o.userTypes.size>0&&!o.userTypes.has("all")||o.timeWindow!=="all"||o.payloadComplexity!=="all"||o.hasRevenue||o.hasItems||o.hasUserProps||o.hasParams||o.onlyDuplicates||o.onlyConversions||o.sortBy!=="time_desc"),[o]),Os=I(()=>{Ds({categories:new Set(["all"]),screens:new Set,sources:new Set(["all"]),userTypes:new Set(["all"]),timeWindow:"all",payloadComplexity:"all",hasRevenue:!1,hasItems:!1,hasUserProps:!1,hasParams:!1,onlyDuplicates:!1,onlyConversions:!1,sortBy:"time_desc"})},[]),[Bs,Hr]=a(!1),[Vs,Ur]=a(!1),[_s,ks]=a(new Set),Se=f(new Set),[Rt,At]=a(null),qs=Tt.useContext(Zr)!==void 0,X=f({path:"",params:null});i(()=>(dr(()=>X.current),()=>{dr(null)}),[]),i(()=>{if(Rt){const t=ur(Rt);t?.path&&(X.current=t)}},[Rt]),i(()=>{if(!L)return;const t=()=>{try{if(typeof L.isReady=="function"&&L.isReady()){const r=typeof L.getCurrentRoute=="function"?L.getCurrentRoute():null;r?.name&&(X.current={path:r.name,params:r.params||null});const s=L.getRootState();if(s){At(s);const n=ur(s);n?.path&&(X.current=n)}}}catch{}};t();const e=typeof L.addListener=="function"?L.addListener("state",()=>{t()}):null;return()=>{e&&e()}},[L]);const R=f(new Map),le=f(new Set),[Hs,Us]=a(new Set),xe=f(new u.Value(1)).current,be=f(new u.Value(.4)).current,Le=f(new u.Value(1)).current,we=f(new u.Value(0)).current,ve=f(new u.Value(0)).current,x=f(new u.ValueXY({x:0,y:0})).current,Ye=f({x:0,y:0});i(()=>{const t=x.x.addListener(r=>Ye.current.x=r.value),e=x.y.addListener(r=>Ye.current.y=r.value);return()=>{x.x.removeListener(t),x.y.removeListener(e)}},[x]);const Ze=f(!1),js=f(Qr.create({onStartShouldSetPanResponder:()=>!1,onMoveShouldSetPanResponder:(t,e)=>Math.abs(e.dx)>4||Math.abs(e.dy)>4,onPanResponderGrant:()=>{Ze.current=!0,x.setOffset({x:Ye.current.x,y:Ye.current.y}),x.setValue({x:0,y:0})},onPanResponderMove:u.event([null,{dx:x.x,dy:x.y}],{useNativeDriver:!1}),onPanResponderRelease:()=>{x.flattenOffset(),setTimeout(()=>{Ze.current=!1},50)},onPanResponderTerminate:()=>{x.flattenOffset(),Ze.current=!1}})).current,zs=I(()=>{u.sequence([u.timing(ve,{toValue:1,duration:320,useNativeDriver:!1}),u.timing(ve,{toValue:0,duration:0,useNativeDriver:!1})]).start(),zr()},[ve]);i(()=>{Et.OS==="android"&&Yr.setLayoutAnimationEnabledExperimental?.(!0)},[]),i(()=>{if(g)return;const t=u.loop(u.sequence([u.timing(xe,{toValue:1.2,duration:800,useNativeDriver:!1}),u.timing(xe,{toValue:1,duration:800,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[xe,g]),i(()=>{if(g)return;const t=u.loop(u.sequence([u.timing(we,{toValue:1,duration:3200,easing:lr.inOut(lr.ease),useNativeDriver:!1}),u.delay(3500),u.timing(we,{toValue:0,duration:0,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[we,g]),i(()=>{const t=u.loop(u.sequence([u.timing(be,{toValue:1,duration:1200,useNativeDriver:!1}),u.timing(be,{toValue:.4,duration:1200,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[be]),i(()=>{const t=u.loop(u.sequence([u.timing(Le,{toValue:1.3,duration:800,useNativeDriver:!1}),u.timing(Le,{toValue:.8,duration:800,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[Le]);const jr=y(()=>ra(),[]),z=(Et.OS==="ios"||Et.OS==="android")&&jr;i(()=>{z&&Ne().catch(()=>{})},[z,g]),i(()=>{if(!z)return;const t=ta(()=>{Ne().catch(()=>{}),Y(!0)});return()=>{t()}},[z]),i(()=>{if(!z)return;const t=sa(()=>{Y(e=>{const r=!e;return r&&Ne().catch(()=>{}),r})});return()=>{t()}},[z]);const $s=f(g);i(()=>{if($s.current=g,g){$n("InspectorModal");const t=U==="apis"||S?.[U]?U:"apis";if($(t),yr(t),pe.current.length>0){const n=tt(pe.current),l=new Set(n.map(d=>d.id));le.current=l,B(n)}he.current.length>0&&G(he.current),ge.current.length>0&&W(ge.current);const e=Dt();e&&(Pe(typeof e=="object"?{...e}:e),Ie({...Ft()}));const r=st();r.length>0&&V(r);const s=requestAnimationFrame(()=>{Ut(!0)});return()=>{cancelAnimationFrame(s)}}else Ut(!1),fe(new Set)},[g]),i(()=>{Fn(),Pt(),_n(),Jn(),Hn();const t=Nn(),e=$s,r=Un(c=>{if(c.message==="__CLEARED__"){V([]),se(null);return}const Q=st();Q.length>0&&Ae("crash",JSON.stringify(Q[0])),e.current&&V(Q)}),s=st();s.length>0&&(s.forEach(c=>Ae("crash",JSON.stringify(c))),V(s));let n,l=!0;const d=On(c=>{if(pe.current=c,c.length>0&&Ae("apis",JSON.stringify(c[0])),cs.current||!e.current)return;clearTimeout(n);const Q=()=>{const w=tt(c),A=new Set(w.map(P=>P.id)),h=new Set;A.forEach(P=>{le.current.has(P)||h.add(P)}),le.current=A,h.size>0&&(h.forEach(P=>{if(!R.current.has(P)){const Gr=w.find(Xr=>Xr.id===P)?.routeInfo||X.current;R.current.set(P,Gr)}}),Us(h),setTimeout(()=>Us(new Set),1200)),B(w)};if(l){l=!1;const w=tt(c),A=new Set(w.map(h=>h.id));le.current=A,w.forEach(h=>{if(!R.current.has(h.id)){const P=h?.routeInfo||X.current;R.current.set(h.id,P)}}),B(w)}else n=setTimeout(Q,250)});let b,Re=!0;const Nt=Wn(c=>{if(ge.current=c,c.length>0&&Ae("analytics",JSON.stringify(c[0])),fs.current||!e.current)return;clearTimeout(b);const Q=()=>{const w=new Set(c.map(h=>h.id)),A=new Set;w.forEach(h=>{Se.current.has(h)||A.add(h)}),Se.current=w,A.size>0&&(A.forEach(h=>{R.current.has(h+1e6)||R.current.set(h+1e6,X.current)}),ks(A),setTimeout(()=>ks(new Set),1200)),W(c)};if(Re){Re=!1;const w=new Set(c.map(A=>A.id));Se.current=w,W(c)}else b=setTimeout(Q,200)});let E,F=!0;const Mt=kn(c=>{he.current=c,c.length>0&&Ae("logs",JSON.stringify(c[0])),!us.current&&e.current&&(clearTimeout(E),F?(F=!1,G(c)):E=setTimeout(()=>{G(c)},200))}),et=Dt();et&&(Pe(typeof et=="object"?{...et}:et),Ie({...Ft()}));const Jr=Xn(()=>{if(!e.current)return;const c=Dt();Pe(c&&typeof c=="object"?{...c}:c),Ie({...Ft()})});return()=>{d(),clearTimeout(n),Nt(),clearTimeout(b),Mt(),clearTimeout(E),Jr(),r(),t()}},[]),i(()=>{Vn(H)},[H]),i(()=>{hr(_)},[_]),i(()=>{if(!K&&pe.current.length>0){const t=tt(pe.current);B(t)}},[K]),i(()=>{!te&&ge.current.length>0&&W(ge.current)},[te]),i(()=>{!ee&&he.current.length>0&&G(he.current)},[ee]),i(()=>{ts(!0),rs(!0),as(!1),is(!1),lt("")},[p]);const D=y(()=>{let t=C.filter(e=>{if(N&&N!=="all"){if(N==="errors"){if(!(e.status===0||e.status==null||typeof e.status=="number"&&e.status>=400))return!1}else if(N==="success"){if(!(typeof e.status=="number"&&e.status>=200&&e.status<400))return!1}else if(N==="slow"){if((e.duration||0)<500)return!1}else if(N==="graphql"){if(!((e.url||"").toLowerCase().includes("graphql")||(e.client||"").toLowerCase().includes("graphql")||(e.client||"").toLowerCase().includes("apollo")))return!1}else if(e.method?.toUpperCase()!==N.toUpperCase())return!1}if(de.size>0&&![...de].some(s=>{if(s==="ALL")return!0;if(s==="Failed")return e.status===0||e.status==null;const n=parseInt(s,10);return isNaN(n)?String(e.status)[0]===s[0]:Number(e.status)===n})||me.size>0&&![...me].some(s=>s==="ALL"?!0:e.method?.toUpperCase()===s))return!1;if(Z&&Z.trim().length>0){const r=R.current.get(e.id)?.path||"";if(!An(e,Z,r,{scope:Be,isRegex:Ve,isCaseSensitive:_e}))return!1}return!0});if(ke==="oldest"&&(t=[...t].reverse()),!j){const e=[];for(const r of t){const s=e[e.length-1];s&&s.method===r.method&&s.url===r.url&&s.status===r.status?e[e.length-1]={...s,duplicateCount:(s.duplicateCount||1)+1}:e.push({...r,duplicateCount:1})}t=e}return t.slice(0,H)},[C,Z,Be,Ve,_e,N,de,me,ke,H,j]),Ws=y(()=>{const t=new Set;return C.forEach(e=>{e.method&&t.add(e.method.toUpperCase())}),["ALL",...Array.from(t)]},[C]),Js=I((t,e)=>{mt(r=>{const s=r[t]||new Set(["success","failed","loading"]),n=new Set(s);return n.has(e)?n.delete(e):n.add(e),{...r,[t]:n}})},[]),Gs=I(t=>{pt(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},[]),Xs=y(()=>{const t=[],e=new Map;for(let s=0;s<D.length;s++){const n=D[s],l=R.current.get(n.id)||n?.routeInfo,d=wn(n,l);let b=e.get(d);b||(b={pageName:d,color:vn(d),logs:[]},e.set(d,b)),b.logs.push(n)}let r=0;return e.forEach(s=>{let n=0,l=0,d=0;s.logs.forEach(E=>{E.status==null?d++:E.status===0||E.status>=400?l++:n++});const b=Yt[s.pageName]||new Set(["success","failed","loading"]),Re=Zt.has(s.pageName),Nt=s.logs[0]?.startTime||0;if(t.push({type:"header",id:`hdr-${s.pageName}`,pageName:s.pageName,color:s.color,stats:{success:n,failed:l,loading:d},timestamp:Nt,activeFilters:b,isCollapsed:Re,isFirst:r===0}),r++,!Re){const E=s.logs.filter(F=>F.status==null?b.has("loading"):F.status===0||F.status>=400?b.has("failed"):b.has("success"));E.forEach((F,Mt)=>{t.push({type:"log",id:`log-${F.id}`,log:F,isLast:Mt===E.length-1,color:s.color})})}}),t},[D,C,Yt,Zt]),{minStart:Qs,totalRange:Ys}=y(()=>{if(D.length===0)return{minStart:0,totalRange:0};const t=Math.min(...D.map(r=>r.startTime)),e=Math.max(...D.map(r=>r.startTime+(r.duration||10)));return{minStart:t,totalRange:e-t}},[D]),Ke=y(()=>{if(!p)return null;const t=C.findIndex(e=>e.id===p.id);if(t===-1)return null;for(let e=t+1;e<C.length;e++){const r=C[e];if(r.url===p.url&&r.method===p.method)return r}return null},[p,C]),Zs=Ke?Ke.request:null,Ks=Ke?Ke.response:null,er=y(()=>{let t=He;if(ie&&ie.trim().length>0){const s=ie.trim().toLowerCase().split(/\s+/).filter(Boolean);t=t.filter(n=>{const l=[n.name||"",JSON.stringify(n.params||""),JSON.stringify(n.userProperties||""),n.screenName||"",n.pageTitle||"",n.userId||"",n.source||""].join(" ").toLowerCase();return s.every(d=>l.includes(d))})}if(o.categories.size>0&&!o.categories.has("all")&&(t=t.filter(s=>{const n=Rn(s.name);return o.categories.has(n)})),o.timeWindow!=="all"){const s=Date.now(),n=o.timeWindow==="1m"?s-60*1e3:o.timeWindow==="5m"?s-300*1e3:o.timeWindow==="15m"?s-900*1e3:s-3600*1e3;t=t.filter(l=>l.timestamp>=n)}if(o.sources.size>0&&!o.sources.has("all")&&(t=t.filter(s=>o.sources.has(s.source||"manual"))),o.userTypes.size>0&&!o.userTypes.has("all")&&(t=t.filter(s=>{const n=!!(s.userId&&s.userId.trim()!=="");return!!(o.userTypes.has("identified")&&n||o.userTypes.has("anonymous")&&!n)})),o.payloadComplexity!=="all"&&(o.payloadComplexity==="none"?t=t.filter(s=>!s.params||Object.keys(s.params).length===0):o.payloadComplexity==="simple"?t=t.filter(s=>s.params&&Object.keys(s.params).length<=3):o.payloadComplexity==="heavy"&&(t=t.filter(s=>s.params&&Object.keys(s.params).length>3))),o.onlyConversions){const s=["purchase","item_purchase","ecommerce_purchase","sign_up","login","lead","generate_lead","tutorial_complete","add_payment_info","begin_checkout","spend_virtual_currency"];t=t.filter(n=>s.some(l=>n.name.toLowerCase().includes(l)))}o.screens.size>0&&(t=t.filter(s=>{const n=s.screenName||s.params?.firebase_screen||s.params?.screen_name||s.params?.firebase_screen_class||s.screenClass||"";return o.screens.has(n)})),o.hasRevenue&&(t=t.filter(s=>s.params?.value!=null&&!isNaN(Number(s.params.value))||s.params?.price!=null&&!isNaN(Number(s.params.price)))),o.hasItems&&(t=t.filter(s=>Array.isArray(s.params?.items)&&s.params.items.length>0)),o.hasUserProps&&(t=t.filter(s=>s.userProperties&&Object.keys(s.userProperties).length>0)),o.hasParams&&(t=t.filter(s=>s.params&&Object.keys(s.params).length>0));const e=[];for(const s of t){if(e.length===0){e.push({...s,count:1});continue}const n=e[e.length-1];n.name===s.name&&JSON.stringify(n.params)===JSON.stringify(s.params)&&JSON.stringify(n.userProperties)===JSON.stringify(s.userProperties)?(n.count=(n.count||1)+1,n.timestamp=s.timestamp,n.id=s.id):e.push({...s,count:1})}let r=e;return o.onlyDuplicates&&(r=r.filter(s=>(s.count||1)>1)),o.sortBy==="time_asc"?r=[...r].sort((s,n)=>s.timestamp-n.timestamp):o.sortBy==="revenue_desc"?r=[...r].sort((s,n)=>{const l=Number(s.params?.value??s.params?.price??0);return Number(n.params?.value??n.params?.price??0)-l}):o.sortBy==="count_desc"&&(r=[...r].sort((s,n)=>(n.count||1)-(s.count||1))),r.slice(0,ne)},[He,ie,o,ne]),tr=y(()=>{let t=q;if(T.size>0&&!T.has("all")&&(t=t.filter(e=>!!(T.has("user-log")&&e.sourceMethod==="log"||T.has("info")&&(e.sourceMethod==="info"||e.type==="info"&&e.sourceMethod!=="log")||T.has("warn")&&(e.type==="warn"||e.sourceMethod==="warn")||T.has("error")&&(e.type==="error"||e.sourceMethod==="error")||T.has("analytics")&&e.message?.toLowerCase().includes("[analytics error]")))),M&&M.trim().length>0){const e=M.trim().toLowerCase().split(/\s+/).filter(Boolean);t=t.filter(r=>{const s=[r.message||"",r.caller||"",r.type||"",r.sourceMethod||"",r.stack||""].join(" ").toLowerCase();return e.every(n=>n==="error"||n==="err"?r.type==="error"||s.includes(n):n==="warn"||n==="warning"?r.type==="warn"||s.includes(n):n==="info"&&r.type==="info"||s.includes(n))})}if(t=[...t].sort((e,r)=>qe==="newest"?r.timestamp-e.timestamp:e.timestamp-r.timestamp),!j){const e=[];for(const r of t){const s=e[e.length-1];s&&s.type===r.type&&s.sourceMethod===r.sourceMethod&&s.message===r.message?e[e.length-1]={...s,duplicateCount:(s.duplicateCount||1)+1}:e.push({...r,duplicateCount:1})}t=e}return t},[q,T,M,qe,j]),sr=y(()=>{let t=q;if(M&&M.trim().length>0){const r=M.trim().toLowerCase().split(/\s+/).filter(Boolean);t=q.filter(s=>{const n=[s.message||"",s.caller||"",s.type||"",s.sourceMethod||"",s.stack||""].join(" ").toLowerCase();return r.every(l=>l==="error"||l==="err"?s.type==="error"||n.includes(l):l==="warn"||l==="warning"?s.type==="warn"||n.includes(l):l==="info"&&s.type==="info"||n.includes(l))})}const e=q.length;return{all:`${t.length}/${e}`,info:`${t.filter(r=>r.sourceMethod==="info"||r.type==="info"&&r.sourceMethod!=="log").length}/${e}`,warn:`${t.filter(r=>r.type==="warn"||r.sourceMethod==="warn").length}/${e}`,error:`${t.filter(r=>r.type==="error"||r.sourceMethod==="error").length}/${e}`,"user-log":`${t.filter(r=>r.sourceMethod==="log").length}/${e}`,analytics:`${t.filter(r=>r.message.toLowerCase().includes("[analytics error]")).length}/${e}`}},[q,M]),rr=I(()=>{Y(!1),ot(!1),setTimeout(()=>{it(null),Qe(null),ht(null),ct(null),ut(null),se(null)},300)},[]);function zr(){Pt(),B([]),fe(new Set),mt({}),pt(new Set),ft(new Set),dt(new Set),jt(""),le.current=new Set,R.current=new Map,Cr(),W([]),Is(""),Se.current=new Set,mr(),G([]),Ls(new Set(["all"])),bs("")}function nr(){if(m==="logs"){ce.alert("Clear Logs","Are you sure you want to clear all console logs?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{mr(),G([])},style:"destructive"}]);return}if(m==="analytics"){ce.alert("Clear Analytics","Are you sure you want to clear all analytics events?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{Cr(),W([]),Qe(null),Se.current=new Set},style:"destructive"}]);return}if(m==="redux"){ce.alert("Clear Redux Timeline","Are you sure you want to clear the dispatched action history?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{Yn(),Ie({})},style:"destructive"}]);return}if(m==="crash"){ce.alert("Clear Crash History","Are you sure you want to clear all intercepted crash records?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{pr(),V([]),se(null)},style:"destructive"}]);return}Oe.size>0?(B(t=>t.filter(e=>!Oe.has(e.id))),fe(new Set)):ce.alert("Clear Logs","Are you sure you want to clear all network logs?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:$r,style:"destructive"}])}function $r(){Pt(),B([]),fe(new Set),mt({}),pt(new Set),ft(new Set),dt(new Set),le.current=new Set,R.current=new Map}const ar=y(()=>{if(!p)return"";try{const e=new URL(p.url).pathname.split("/").filter(Boolean);return e.length>0?`/${e.slice(-2).join("/")}`:"/"}catch{const t=p.url.split("/").filter(Boolean);return t.length>0?`/${t.slice(-2).join("/")}`:p.url}},[p]),or=y(()=>p?Ln(p.url):"",[p]),ir=I(t=>{fe(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},[]),Wr=y(()=>({visible:g,setVisible:Y,closeModal:rr,isMinimized:qt,setIsMinimized:ot,minimizeInspector:br,isReady:Ht,enabled:v,isEnabled:v,appIcon:Bt,environment:Vt,modalHeightPercent:De,setModalHeightPercent:nt,modalAnimationType:Fe,setModalAnimationType:at,hasNavigationContext:qs,setNavState:At,activeTab:m,switchActiveTab:Es,tabVisibility:S,toggleTabVisibility:Ts,lastReadApisCount:ps,lastReadLogsCount:ds,mediaCount:Cs,refreshMediaCount:Ue,selected:p,setSelected:it,selectedEvent:Ps,setSelectedEvent:Qe,selectedLog:ls,setSelectedLog:ht,showHeaderInfo:Kt,setShowHeaderInfo:Mr,settingsPage:ws,setSettingsPage:Fr,isFeedbackOpen:vs,setIsFeedbackOpen:Or,isAboutOpen:Rs,setIsAboutOpen:Br,updateAvailable:Ms,latestNpmVersion:Ce,clearAnim:ve,activePulseAnim:be,unreadPulseAnim:Le,runClearAllWithAnimation:zs,useNativeFab:z,fabPan:x,fabPanResponder:js,fabDraggedRef:Ze,pulseAnim:xe,fabShineAnim:we,logs:C,filteredLogs:D,groupedData:Xs,search:Z,setSearch:jt,searchScope:Be,setSearchScope:Lr,isRegexSearch:Ve,setIsRegexSearch:wr,isCaseSensitive:_e,setIsCaseSensitive:vr,quickFilter:N,setQuickFilter:Rr,statusFilters:de,setStatusFilters:ft,methodFilters:me,setMethodFilters:dt,availableMethods:Ws,sortOrder:ke,setSortOrder:Tr,selectedLogs:Oe,toggleSelect:ir,minStart:Qs,totalRange:Ys,newLogIds:Hs,toggleSectionFilter:Js,toggleSectionCollapse:Gs,handleDelete:nr,isNetworkPaused:K,setIsNetworkPaused:Pr,detailTitle:ar,detailDisplayUrl:or,apiDetailActiveTab:Xt,setApiDetailActiveTab:Qt,detailSearch:zt,setDetailSearch:lt,reqExpanded:es,setReqExpanded:ts,resExpanded:ss,setResExpanded:rs,showReqDiff:ns,setShowReqDiff:as,showResDiff:os,setShowResDiff:is,prevRequestData:Zs,prevResponseData:Ks,logRouteMapRef:R,consoleLogs:J,visibleConsoleLogs:q,filteredConsoleLogs:tr,logSearch:M,setLogSearch:bs,logFilters:T,setLogFilters:Ls,logCounts:sr,logSortOrder:qe,setLogSortOrder:Er,isConsolePaused:ee,setIsConsolePaused:Ir,analyticsEvents:He,filteredAnalyticsEvents:er,analyticsSearch:ie,setAnalyticsSearch:Is,analyticsFilters:o,setAnalyticsFilters:Ds,isAnalyticsFilterApplied:Fs,resetAnalyticsFilters:Os,newEventIds:_s,isAnalyticsLayoutReady:Bs,setIsAnalyticsLayoutReady:Hr,analyticsHeaderExpanded:Vs,setAnalyticsHeaderExpanded:Ur,isAnalyticsPaused:te,setIsAnalyticsPaused:Dr,reduxState:_t,setReduxState:Pe,reduxLastActionMap:kt,reduxSearch:$t,setReduxSearch:Ar,selectedReduxSlice:Wt,setSelectedReduxSlice:ct,selectedReduxAction:Jt,setSelectedReduxAction:ut,reduxActiveSubTab:Gt,setReduxActiveSubTab:Nr,crashRecords:ye,setCrashRecords:V,selectedCrash:xs,setSelectedCrash:se,lastReadCrashesCount:gs,maxCrashLogs:_,setMaxCrashLogs:je,clearAllCrashes:()=>{pr(),V([]),se(null)},settingsActiveSubTab:As,setSettingsActiveSubTab:Vr,defaultTab:U,setDefaultTab:Xe,isDark:Ee,setIsDark:rt,showDuplicateLogs:j,setShowDuplicateLogs:bt,showUpdateToast:Lt,setShowUpdateToast:wt,showConsoleLevels:k,setShowConsoleLevels:gt,resetToDefaults:kr,storage:O,maxNetworkLogs:H,setMaxNetworkLogs:We,maxConsoleLogs:re,setMaxConsoleLogs:ze,maxAnalyticsEventsLimit:ne,setMaxAnalyticsEventsLimit:Je,isAutoRamLimitEnabled:ae,setIsAutoRamLimitEnabled:yt,deviceFreeRamMb:Ct,reduxAutoRefresh:oe,setReduxAutoRefreshState:St,reduxExpandDepth:Ge,setReduxExpandDepth:xt}),[g,rr,Ht,v,Bt,Vt,De,Fe,qs,At,m,Es,S,Ts,ps,ds,Cs,Ue,p,Ps,ls,Kt,ws,vs,Rs,Ms,Ce,ve,be,Le,zs,z,x,js,xe,we,C,D,Xs,Z,Be,Ve,_e,N,de,me,Ws,ke,Oe,ir,Qs,Ys,Hs,Js,Gs,nr,K,ar,or,Xt,zt,es,ss,ns,os,Zs,Ks,J,q,tr,M,T,sr,qe,ee,He,er,ie,o,Fs,Os,_s,Bs,Vs,te,_t,kt,$t,Wt,Jt,Gt,ye,xs,gs,_,As,U,Ee,j,Lt,k,O,H,re,ne,ae,Ct,oe,Ge,qt]);return<xn.Provider value={Wr}>
2
- <Sn/>
3
- </xn.Provider>},Sa=v=>{const O=v?.enabled??!0,L=v?.telemetry??!0;return i(()=>(O?L?zn(!0,v?.environment):gr(!1):(Ne().catch(()=>{}),gr(!1)),()=>{Ne().catch(()=>{})}),[O,L,v?.environment]),O?<Kr i18n={en}>
4
- <Cn fallbackType="inline">
5
- <Ca{...v}enabled={O}/>
6
- </Cn>
7
- </Kr>:null};export default Sa;export{setupNetworkLogger,clearNetworkLogs,subscribeNetworkLogs,addAxiosInterceptors}from"./customHooks/networkLogger";export{setupConsoleLogger,clearConsoleLogs,subscribeConsoleLogs}from"./customHooks/consoleLogger";export{setupAnalyticsLogger,logAnalyticsEvent,subscribeAnalyticsEvents,clearAnalyticsEvents,getCurrentUserProperties,getCurrentUserId,getDefaultEventParameters,getCollectionEnabled}from"./customHooks/analyticsLogger";export{setupGlobalCrashHandler,subscribeCrashEvents,emitCrashEvent,getCrashRecords,clearCrashRecords,simulateTestCrash,exportCrashReport,parseCrashStackTrace,recordCustomCrash,addCrashBreadcrumb,recordNavigationBreadcrumb,recordNetworkBreadcrumb,recordReduxBreadcrumb,recordUserActionBreadcrumb,computeCrashFingerprint}from"./customHooks/crashHandler";export{default as CrashTab}from"./components/Inspector/CrashTab";export{default as ErrorBoundary}from"./components/ErrorBoundary";export{connectReduxStore,inspectorReduxMiddleware,getReduxState,subscribeReduxState,getActionHistory,clearActionHistory,getLastActionForReducer}from"./customHooks/reduxLogger";export{getEventCategory,registerGAPlugin}from"./helpers/gaAnalyticsRegistry";export{usePerformanceTracker,useComponentProfiler,useNavigationProfiler,trackComponentRender,trackNavigationTransition,trackHeavyTask,measureAsync,getHermesMemoryStats,registerComponentProfile,subscribeRenderProfiles,getRenderProfiles,logPerformanceEvent,clearPerformanceEvents,subscribePerformanceEvents,getPerformanceEvents,getInitialRenderProfiles,getInitialPerformanceEvents,generateFixSnippet}from"./customHooks/performanceTracker";export{InspectLog,InspectTrackTime,InspectCatch}from"./decorators";export{getNativeDeviceMetrics,enableNativeCrashProtection,subscribeNativeCrashes,showNativeFloatingButton,hideNativeFloatingButton,setNativeFloatingButtonBadge,subscribeNativeFloatingButtonPress,subscribeNativeDeviceShake,startNativeFpsMonitoring,stopNativeFpsMonitoring,getNativeFpsMetrics,getNativeStorageItem,setNativeStorageItem,isNativeModuleAvailable}from"./native/NativeInspector";export{setupMemoryWarningHandler,pruneAllLogs,subscribeMemoryWarning}from"./helpers";export{setMaxNetworkLogsLimit,getMaxNetworkLogsLimit,pruneNetworkLogs}from"./customHooks/networkLogger";export{setMaxConsoleLogsLimit,getMaxConsoleLogsLimit,pruneConsoleLogs}from"./customHooks/consoleLogger";export{setMaxReduxHistoryLimit,getMaxReduxHistoryLimit,pruneReduxHistory}from"./customHooks/reduxLogger";export{setMaxAnalyticsLogsLimit,getMaxAnalyticsLogsLimit,pruneAnalyticsLogs}from"./customHooks/analyticsLogger";export{getMaxCrashLogsLimit,pruneCrashRecords}from"./customHooks/crashHandler";export{setMaxPerformanceEventsLimit,getMaxPerformanceEventsLimit,prunePerformanceEvents}from"./customHooks/performanceTracker";export{BrandSquareIcon,BrandCircleIcon}from"./components/NetworkIcons";export{connectAsyncStorage,connectMMKV,isAsyncStorageConnected,isMMKVConnected,getRegisteredMMKVInstanceIds,fetchStorageEntries,setStorageEntry,removeStorageEntry,clearStorageDriver,subscribeToStorageChanges}from"./customHooks/storageInspector";export{ActiveTab,Method,StatusFilter,SortOrder,LocalFilter,ModalAnimationType,SettingsPage,SettingsSubTab,LogFilter,ConsoleLogType,AnalyticsEventSource,GAEventCategory,StackFrameType,DiffResultType,BundleSubTab,PerformanceSubTab,CrashType,CrashExportFormat,CrashDetailSubTab,CrashFilterType,BreadcrumbType}from"./types";export{AppFonts,setAppFonts}from"./styles/AppFonts";export{AppColors,setAppColors,getThemeColors,updateAppColorsTheme}from"./styles/AppColors";export{t,i18n,useTranslation,setLanguage,addTranslations,setTranslations,I18nextProvider}from"./i18n";export{fetchRemoteConfigModuleStatus,isFirebaseRemoteConfigAvailable}from"./helpers/remoteConfig";export{ScreenCapture,ScreenRecorder}from"./capture";export{LIB_VERSION}from"./constants/version";
1
+ import Tt,{useEffect as i,useMemo as y,useRef as f,useState as a,useCallback as I}from"react";import{Alert as ce,Animated as u,Easing as ir,PanResponder as Gr,Platform as Et,UIManager as Xr,LogBox as lr}from"react-native";import{NavigationContext as Qr}from"@react-navigation/native";import{I18nextProvider as Yr,i18n as Zr}from"./i18n";import Kr from"./components/ErrorBoundary";import Cn from"./components/Inspector/MainScreen";import{InspectorContext as Sn,animateNextLayout as xn}from"./components/Inspector/InspectorContext";import{formatDisplayUrl as bn,getNavigationInfo as cr,getLogPageName as Ln,deduplicateLogs as tt,getDomainColor as wn,getEventCategory as vn,matchNetworkLogQuery as Rn,setupMemoryWarningHandler as An}from"./helpers";import{loadSettings as Nn,saveSettings as Mn,setCustomStorage as Tn,clearPersistedSettings as En,calculateRamBasedLimits as ur}from"./helpers/settingsStore";import{getNativeSystemMetrics as Pn,pushNativeLogRecord as Ae,fetchNativeCachedPage as In}from"./native/NativeInspector";import{setupNetworkLogger as Dn,clearNetworkLogs as Pt,subscribeNetworkLogs as Fn,setNetworkModuleEnabled as Bn,setMaxNetworkLogsLimit as On,setRouteInfoProvider as fr}from"./customHooks/networkLogger";import{setupConsoleLogger as Vn,clearConsoleLogs as dr,subscribeConsoleLogs as _n,setConsoleModuleEnabled as kn}from"./customHooks/consoleLogger";import{IGNORED_LOG_PREFIXES as ue}from"./customHooks/logFilters";import{setupGlobalCrashHandler as qn,subscribeCrashEvents as Hn,getCrashRecords as st,clearCrashRecords as mr,setMaxCrashLogsLimit as pr,setCrashModuleEnabled as Un}from"./customHooks/crashHandler";import{trackActiveTelemetryHeartbeat as jn,setTelemetryEnabled as hr,trackInspectorTabView as gr,trackInspectorScreenView as zn}from"./helpers/telemetry";import{subscribeAnalyticsEvents as $n,clearAnalyticsEvents as yr,autoSetupAnalyticsLogger as Wn,isAnalyticsConnected as It,setAnalyticsModuleEnabled as Jn}from"./customHooks/analyticsLogger";import{getReduxState as Dt,subscribeReduxState as Gn,setReduxAutoRefresh as Xn,getLastActionForReducer as Ft,clearActionHistory as Qn,isReduxConnected as Bt,setReduxModuleEnabled as Yn}from"./customHooks/reduxLogger";import{setPerformanceModuleEnabled as Zn}from"./customHooks/performanceTracker";import{setBundleModuleEnabled as Kn}from"./customHooks/bundleAnalyzer";import{hideNativeFloatingButton as Ne,subscribeNativeFloatingButtonPress as ea,subscribeNativeDeviceShake as ta,isNativeModuleAvailable as sa}from"./native/NativeInspector";import{fetchRemoteConfigModuleStatus as ra}from"./helpers/remoteConfig";import{ScreenCapture as na}from"./capture";import{LIB_VERSION as aa}from"./constants";import{toggleGlobalTheme as Cr}from"./styles";const Ca=({enabled:v=!0,storage:B,navigationRef:L,appIcon:Ot,environment:Vt,initialVisible:Sr=!1,visible:Me,remoteConfig:Te})=>{Tn(B||null);const[Ee,rt]=a(!1),[_t,Pe]=a(null),[kt,Ie]=a({}),[De,nt]=a(90),[Fe,at]=a("slide"),[C,O]=a([]),[g,Y]=a(Me??Sr??!1),[qt,ot]=a(!1),xr=I(()=>{ot(!0),Y(!1)},[]);i(()=>{Me!==void 0&&Y(Me)},[Me]);const[Ht,Ut]=a(!1),[p,it]=a(null),[Be,fe]=a(new Set),[Z,jt]=a(""),[Oe,br]=a("all"),[Ve,Lr]=a(!1),[_e,wr]=a(!1),[N,vr]=a("all"),[zt,lt]=a(""),[$t,Rr]=a(""),[Wt,ct]=a(null),[Jt,ut]=a(null),[Gt,Ar]=a("state"),[Xt,Qt]=a("response");i(()=>(lr.ignoreAllLogs(v),()=>{lr.ignoreAllLogs(!1)}),[v]),i(()=>{p&&(Qt("response"),lt(""))},[p]);const[de,ft]=a(new Set),[me,dt]=a(new Set),[Yt,mt]=a({}),[Zt,pt]=a(new Set),[Kt,Nr]=a(!0),[ke,Mr]=a("newest"),[qe,Tr]=a("newest"),[es,ts]=a(!0),[ss,rs]=a(!0),[ns,as]=a(!1),[os,is]=a(!1),[m,$]=a("apis"),[He,W]=a([]),[J,G]=a([]),[ls,ht]=a(null),[K,Er]=a(!1),cs=f(K);cs.current=K;const pe=f([]),[ee,Pr]=a(!1),us=f(ee);us.current=ee;const he=f([]),[te,Ir]=a(!1),fs=f(te);fs.current=te;const ge=f([]),[ds,ms]=a(0),[ps,hs]=a(0),[gs,ys]=a(0),[Cs,Ss]=a(0),Ue=I(async()=>{try{const t=await na.getMediaList(),e=t?t.length:0;return Ss(e),e}catch{return Ss(0),0}},[]);i(()=>{g&&Ue()},[g,Ue]);const[ye,V]=a(()=>st()),[xs,se]=a(null),[_,je]=a(50);i(()=>{pr(_)},[_]),i(()=>{g&&(m==="apis"&&hs(C.length),m==="logs"&&ms(J.length),m==="crash"&&ys(ye.length))},[g]),i(()=>{m==="apis"&&hs(C.length)},[m,C.length]),i(()=>{m==="logs"&&ms(J.length)},[m,J.length]),i(()=>{m==="crash"&&ys(ye.length)},[m,ye.length]);const[re,ze]=a(100),[k,gt]=a({info:!0,warn:!0,error:!0}),q=y(()=>J.filter(e=>{const r=e.type;if(r==="info"&&!k?.info||r==="warn"&&!k?.warn||r==="error"&&!k?.error)return!1;const s=e.message||"";return![...ue&&ue.info||[],...ue&&ue.warn||[],...ue&&ue.error||[]].filter(d=>typeof d=="string"&&d.trim().length>0).some(d=>s.toLowerCase().trim().startsWith(d.toLowerCase().trim())||s.toLowerCase().trim().includes(d.toLowerCase().trim()))}).slice(0,re),[J,k,re]),[M,bs]=a(""),[T,Ls]=a(new Set(["all"])),[ws,Dr]=a(null),[vs,Fr]=a(!1),[Rs,Br]=a("module"),[S,$e]=a({apis:!0,logs:!0,analytics:!1,redux:!1,bundle:!1,performance:!1,crash:!1,device:!1,storage:!1,debugging:!1,media:!0}),[H,We]=a(250),[ne,Je]=a(150),[ae,yt]=a(!0),[Ct,Or]=a(1800),[oe,St]=a(!0),[Ge,xt]=a(1),[U,Xe]=a("apis"),[j,bt]=a(!1),[Lt,wt]=a(!0);i(()=>{Bn(!!S.apis),kn(!!S.logs),Jn(!!S.analytics),Yn(!!S.redux),Zn(!!S.performance),Un(!!S.crash),Kn(!!S.bundle)},[S]),i(()=>{Pn().then(t=>{if(t){const e=t.totalPhysicalRamMb-t.residentRamMb,r=Math.max(200,Math.round(e>0?e:1500));if(Or(r),ae){const s=ur(r);We(s.maxNetworkLogs),ze(s.maxConsoleLogs),Je(s.maxAnalyticsEvents),je(s.maxCrashRecords)}}}).catch(()=>{})},[ae]);const Vr=async()=>{await En(),rt(!1),Cr(!1),nt(90),at("slide"),$e({apis:!0,logs:!0,analytics:!1,redux:!1,bundle:!1,performance:!1,crash:!1,device:!1,storage:!1,debugging:!1,media:!0}),Xe("apis"),yt(!0);const t=ur(Ct);je(t.maxCrashRecords),We(t.maxNetworkLogs),ze(t.maxConsoleLogs),Je(t.maxAnalyticsEvents),gt({info:!0,warn:!0,error:!0}),St(!0),xt(1),bt(!1),wt(!0),ce.alert("Settings Reset","All settings have been reset to default values.")},As=f(!1);i(()=>{let t=!1;return Nn().then(e=>{if(!t){if(e.isDark!=null&&(rt(e.isDark),Cr(e.isDark)),e.modalHeightPercent!=null&&nt(e.modalHeightPercent),e.modalAnimationType&&at(e.modalAnimationType),e.tabVisibility&&$e(r=>({...r,...e.tabVisibility,apis:!0})),e.defaultTab&&Xe(e.defaultTab),e.isAutoRamLimitEnabled!=null&&yt(e.isAutoRamLimitEnabled),e.maxNetworkLogs!=null&&We(e.maxNetworkLogs),e.maxConsoleLogs!=null&&ze(e.maxConsoleLogs),e.maxAnalyticsEventsLimit!=null&&Je(e.maxAnalyticsEventsLimit),e.maxCrashLogs!=null&&je(e.maxCrashLogs),e.showConsoleLevels&&gt(e.showConsoleLevels),e.reduxAutoRefresh!=null&&St(e.reduxAutoRefresh),e.reduxExpandDepth!=null&&xt(e.reduxExpandDepth),e.showDuplicateLogs!=null&&bt(e.showDuplicateLogs),e.showUpdateToast!=null&&wt(e.showUpdateToast),e.defaultTab){const r=e.defaultTab,s={apis:!0,logs:!0,analytics:!1,redux:!1,bundle:!1,performance:!1,crash:!1,device:!1,storage:!1,...e.tabVisibility||{},apis:!0};$(s[r]?r:"apis")}As.current=!0}}),()=>{t=!0}},[]),i(()=>{let t=!0;if(Te!==!1)return ra(typeof Te=="object"?Te:void 0).then(e=>{t&&e&&$e(r=>({...r,...e,apis:e.apis??!0}))}).catch(()=>{}),()=>{t=!1}},[Te]),i(()=>{As.current&&Mn({isDark:Ee,modalHeightPercent:De,modalAnimationType:Fe,tabVisibility:S,defaultTab:U,maxNetworkLogs:H,maxConsoleLogs:re,maxAnalyticsEventsLimit:ne,maxCrashLogs:_,isAutoRamLimitEnabled:ae,showConsoleLevels:k,reduxAutoRefresh:oe,reduxExpandDepth:Ge,showDuplicateLogs:j,showUpdateToast:Lt})},[Ee,De,Fe,S,U,H,re,ne,_,ae,k,oe,Ge,j]);const[Ce,_r]=a(null),Ns=y(()=>{if(!Ce)return!1;const t=s=>s.replace(/^v/,"").split(".").map(n=>parseInt(n,10)||0),e=t(aa),r=t(Ce);for(let s=0;s<3;s++){if((r[s]||0)>(e[s]||0))return!0;if((r[s]||0)<(e[s]||0))return!1}return!1},[Ce]);i(()=>{if(typeof __DEV__>"u"||!__DEV__)return;let t=!1;return fetch("https://registry.npmjs.org/react-native-inapp-inspector/latest").then(e=>e.ok?e.json():null).then(e=>{!t&&e&&typeof e.version=="string"&&_r(e.version)}).catch(()=>{}),()=>{t=!0}},[]),i(()=>{Xn(oe)},[oe]),i(()=>{m==="redux"&&!Bt()&&$("apis"),m==="analytics"&&!It()&&$("apis")},[m]);const Ms=t=>{t!=="apis"&&(t==="redux"&&!Bt()||t==="analytics"&&!It()||$e(e=>{const r=!e[t],s={...e,[t]:r};return!r&&m===t&&(xn(),$("apis")),!r&&U===t&&Xe("apis"),s}))},vt=I(async(t,e="")=>{if(t==="apis"||t==="logs"||t==="analytics"||t==="crash"){const r=await In(t,0,100,e);r&&r.items&&r.items.length>0&&(t==="apis"?O(r.items):t==="logs"?G(r.items):t==="analytics"?W(r.items):t==="crash"&&V(r.items))}},[]),Ts=I(t=>{t==="redux"&&!Bt()||t==="analytics"&&!It()||(it(null),Qe(null),ht(null),ct(null),ut(null),se(null),typeof Tt.startTransition=="function"?Tt.startTransition(()=>{$(t),vt(t)}):($(t),vt(t)),gr(t))},[vt]),[Es,Qe]=a(null),[ie,Ps]=a(""),[o,Is]=a({categories:new Set(["all"]),screens:new Set,sources:new Set(["all"]),userTypes:new Set(["all"]),timeWindow:"all",payloadComplexity:"all",hasRevenue:!1,hasItems:!1,hasUserProps:!1,hasParams:!1,onlyDuplicates:!1,onlyConversions:!1,sortBy:"time_desc"}),Ds=y(()=>!!(o.categories.size>0&&!o.categories.has("all")||o.screens.size>0||o.sources.size>0&&!o.sources.has("all")||o.userTypes.size>0&&!o.userTypes.has("all")||o.timeWindow!=="all"||o.payloadComplexity!=="all"||o.hasRevenue||o.hasItems||o.hasUserProps||o.hasParams||o.onlyDuplicates||o.onlyConversions||o.sortBy!=="time_desc"),[o]),Fs=I(()=>{Is({categories:new Set(["all"]),screens:new Set,sources:new Set(["all"]),userTypes:new Set(["all"]),timeWindow:"all",payloadComplexity:"all",hasRevenue:!1,hasItems:!1,hasUserProps:!1,hasParams:!1,onlyDuplicates:!1,onlyConversions:!1,sortBy:"time_desc"})},[]),[Bs,kr]=a(!1),[Os,qr]=a(!1),[Vs,_s]=a(new Set),Se=f(new Set),[Rt,At]=a(null),ks=Tt.useContext(Qr)!==void 0,X=f({path:"",params:null});i(()=>(fr(()=>X.current),()=>{fr(null)}),[]),i(()=>{if(Rt){const t=cr(Rt);t?.path&&(X.current=t)}},[Rt]),i(()=>{if(!L)return;const t=()=>{try{if(typeof L.isReady=="function"&&L.isReady()){const r=typeof L.getCurrentRoute=="function"?L.getCurrentRoute():null;r?.name&&(X.current={path:r.name,params:r.params||null});const s=L.getRootState();if(s){At(s);const n=cr(s);n?.path&&(X.current=n)}}}catch{}};t();const e=typeof L.addListener=="function"?L.addListener("state",()=>{t()}):null;return()=>{e&&e()}},[L]);const R=f(new Map),le=f(new Set),[qs,Hs]=a(new Set),xe=f(new u.Value(1)).current,be=f(new u.Value(.4)).current,Le=f(new u.Value(1)).current,we=f(new u.Value(0)).current,ve=f(new u.Value(0)).current,x=f(new u.ValueXY({x:0,y:0})).current,Ye=f({x:0,y:0});i(()=>{const t=x.x.addListener(r=>Ye.current.x=r.value),e=x.y.addListener(r=>Ye.current.y=r.value);return()=>{x.x.removeListener(t),x.y.removeListener(e)}},[x]);const Ze=f(!1),Us=f(Gr.create({onStartShouldSetPanResponder:()=>!1,onMoveShouldSetPanResponder:(t,e)=>Math.abs(e.dx)>4||Math.abs(e.dy)>4,onPanResponderGrant:()=>{Ze.current=!0,x.setOffset({x:Ye.current.x,y:Ye.current.y}),x.setValue({x:0,y:0})},onPanResponderMove:u.event([null,{dx:x.x,dy:x.y}],{useNativeDriver:!1}),onPanResponderRelease:()=>{x.flattenOffset(),setTimeout(()=>{Ze.current=!1},50)},onPanResponderTerminate:()=>{x.flattenOffset(),Ze.current=!1}})).current,js=I(()=>{u.sequence([u.timing(ve,{toValue:1,duration:320,useNativeDriver:!1}),u.timing(ve,{toValue:0,duration:0,useNativeDriver:!1})]).start(),Ur()},[ve]);i(()=>{Et.OS==="android"&&Xr.setLayoutAnimationEnabledExperimental?.(!0)},[]),i(()=>{if(g)return;const t=u.loop(u.sequence([u.timing(xe,{toValue:1.2,duration:800,useNativeDriver:!1}),u.timing(xe,{toValue:1,duration:800,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[xe,g]),i(()=>{if(g)return;const t=u.loop(u.sequence([u.timing(we,{toValue:1,duration:3200,easing:ir.inOut(ir.ease),useNativeDriver:!1}),u.delay(3500),u.timing(we,{toValue:0,duration:0,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[we,g]),i(()=>{const t=u.loop(u.sequence([u.timing(be,{toValue:1,duration:1200,useNativeDriver:!1}),u.timing(be,{toValue:.4,duration:1200,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[be]),i(()=>{const t=u.loop(u.sequence([u.timing(Le,{toValue:1.3,duration:800,useNativeDriver:!1}),u.timing(Le,{toValue:.8,duration:800,useNativeDriver:!1})]));return t.start(),()=>t.stop()},[Le]);const Hr=y(()=>sa(),[]),z=(Et.OS==="ios"||Et.OS==="android")&&Hr;i(()=>{z&&Ne().catch(()=>{})},[z,g]),i(()=>{if(!z)return;const t=ea(()=>{Ne().catch(()=>{}),Y(!0)});return()=>{t()}},[z]),i(()=>{if(!z)return;const t=ta(()=>{Y(e=>{const r=!e;return r&&Ne().catch(()=>{}),r})});return()=>{t()}},[z]);const zs=f(g);i(()=>{if(zs.current=g,g){zn("InspectorModal");const t=U==="apis"||S?.[U]?U:"apis";if($(t),gr(t),pe.current.length>0){const n=tt(pe.current),l=new Set(n.map(d=>d.id));le.current=l,O(n)}he.current.length>0&&G(he.current),ge.current.length>0&&W(ge.current);const e=Dt();e&&(Pe(typeof e=="object"?{...e}:e),Ie({...Ft()}));const r=st();r.length>0&&V(r);const s=requestAnimationFrame(()=>{Ut(!0)});return()=>{cancelAnimationFrame(s)}}else Ut(!1),fe(new Set)},[g]),i(()=>{Dn(),Pt(),Vn(),Wn(),qn();const t=An(),e=zs,r=Hn(c=>{if(c.message==="__CLEARED__"){V([]),se(null);return}const Q=st();Q.length>0&&Ae("crash",JSON.stringify(Q[0])),e.current&&V(Q)}),s=st();s.length>0&&(s.forEach(c=>Ae("crash",JSON.stringify(c))),V(s));let n,l=!0;const d=Fn(c=>{if(pe.current=c,c.length>0&&Ae("apis",JSON.stringify(c[0])),cs.current||!e.current)return;clearTimeout(n);const Q=()=>{const w=tt(c),A=new Set(w.map(P=>P.id)),h=new Set;A.forEach(P=>{le.current.has(P)||h.add(P)}),le.current=A,h.size>0&&(h.forEach(P=>{if(!R.current.has(P)){const Wr=w.find(Jr=>Jr.id===P)?.routeInfo||X.current;R.current.set(P,Wr)}}),Hs(h),setTimeout(()=>Hs(new Set),1200)),O(w)};if(l){l=!1;const w=tt(c),A=new Set(w.map(h=>h.id));le.current=A,w.forEach(h=>{if(!R.current.has(h.id)){const P=h?.routeInfo||X.current;R.current.set(h.id,P)}}),O(w)}else n=setTimeout(Q,250)});let b,Re=!0;const Nt=$n(c=>{if(ge.current=c,c.length>0&&Ae("analytics",JSON.stringify(c[0])),fs.current||!e.current)return;clearTimeout(b);const Q=()=>{const w=new Set(c.map(h=>h.id)),A=new Set;w.forEach(h=>{Se.current.has(h)||A.add(h)}),Se.current=w,A.size>0&&(A.forEach(h=>{R.current.has(h+1e6)||R.current.set(h+1e6,X.current)}),_s(A),setTimeout(()=>_s(new Set),1200)),W(c)};if(Re){Re=!1;const w=new Set(c.map(A=>A.id));Se.current=w,W(c)}else b=setTimeout(Q,200)});let E,F=!0;const Mt=_n(c=>{he.current=c,c.length>0&&Ae("logs",JSON.stringify(c[0])),!us.current&&e.current&&(clearTimeout(E),F?(F=!1,G(c)):E=setTimeout(()=>{G(c)},200))}),et=Dt();et&&(Pe(typeof et=="object"?{...et}:et),Ie({...Ft()}));const $r=Gn(()=>{if(!e.current)return;const c=Dt();Pe(c&&typeof c=="object"?{...c}:c),Ie({...Ft()})});return()=>{d(),clearTimeout(n),Nt(),clearTimeout(b),Mt(),clearTimeout(E),$r(),r(),t()}},[]),i(()=>{On(H)},[H]),i(()=>{pr(_)},[_]),i(()=>{if(!K&&pe.current.length>0){const t=tt(pe.current);O(t)}},[K]),i(()=>{!te&&ge.current.length>0&&W(ge.current)},[te]),i(()=>{!ee&&he.current.length>0&&G(he.current)},[ee]),i(()=>{ts(!0),rs(!0),as(!1),is(!1),lt("")},[p]);const D=y(()=>{let t=C.filter(e=>{if(N&&N!=="all"){if(N==="errors"){if(!(e.status===0||e.status==null||typeof e.status=="number"&&e.status>=400))return!1}else if(N==="success"){if(!(typeof e.status=="number"&&e.status>=200&&e.status<400))return!1}else if(N==="slow"){if((e.duration||0)<500)return!1}else if(N==="graphql"){if(!((e.url||"").toLowerCase().includes("graphql")||(e.client||"").toLowerCase().includes("graphql")||(e.client||"").toLowerCase().includes("apollo")))return!1}else if(e.method?.toUpperCase()!==N.toUpperCase())return!1}if(de.size>0&&![...de].some(s=>{if(s==="ALL")return!0;if(s==="Failed")return e.status===0||e.status==null;const n=parseInt(s,10);return isNaN(n)?String(e.status)[0]===s[0]:Number(e.status)===n})||me.size>0&&![...me].some(s=>s==="ALL"?!0:e.method?.toUpperCase()===s))return!1;if(Z&&Z.trim().length>0){const r=R.current.get(e.id)?.path||"";if(!Rn(e,Z,r,{scope:Oe,isRegex:Ve,isCaseSensitive:_e}))return!1}return!0});if(ke==="oldest"&&(t=[...t].reverse()),!j){const e=[];for(const r of t){const s=e[e.length-1];s&&s.method===r.method&&s.url===r.url&&s.status===r.status?e[e.length-1]={...s,duplicateCount:(s.duplicateCount||1)+1}:e.push({...r,duplicateCount:1})}t=e}return t.slice(0,H)},[C,Z,Oe,Ve,_e,N,de,me,ke,H,j]),$s=y(()=>{const t=new Set;return C.forEach(e=>{e.method&&t.add(e.method.toUpperCase())}),["ALL",...Array.from(t)]},[C]),Ws=I((t,e)=>{mt(r=>{const s=r[t]||new Set(["success","failed","loading"]),n=new Set(s);return n.has(e)?n.delete(e):n.add(e),{...r,[t]:n}})},[]),Js=I(t=>{pt(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},[]),Gs=y(()=>{const t=[],e=new Map;for(let s=0;s<D.length;s++){const n=D[s],l=R.current.get(n.id)||n?.routeInfo,d=Ln(n,l);let b=e.get(d);b||(b={pageName:d,color:wn(d),logs:[]},e.set(d,b)),b.logs.push(n)}let r=0;return e.forEach(s=>{let n=0,l=0,d=0;s.logs.forEach(E=>{E.status==null?d++:E.status===0||E.status>=400?l++:n++});const b=Yt[s.pageName]||new Set(["success","failed","loading"]),Re=Zt.has(s.pageName),Nt=s.logs[0]?.startTime||0;if(t.push({type:"header",id:`hdr-${s.pageName}`,pageName:s.pageName,color:s.color,stats:{success:n,failed:l,loading:d},timestamp:Nt,activeFilters:b,isCollapsed:Re,isFirst:r===0}),r++,!Re){const E=s.logs.filter(F=>F.status==null?b.has("loading"):F.status===0||F.status>=400?b.has("failed"):b.has("success"));E.forEach((F,Mt)=>{t.push({type:"log",id:`log-${F.id}`,log:F,isLast:Mt===E.length-1,color:s.color})})}}),t},[D,C,Yt,Zt]),{minStart:Xs,totalRange:Qs}=y(()=>{if(D.length===0)return{minStart:0,totalRange:0};const t=Math.min(...D.map(r=>r.startTime)),e=Math.max(...D.map(r=>r.startTime+(r.duration||10)));return{minStart:t,totalRange:e-t}},[D]),Ke=y(()=>{if(!p)return null;const t=C.findIndex(e=>e.id===p.id);if(t===-1)return null;for(let e=t+1;e<C.length;e++){const r=C[e];if(r.url===p.url&&r.method===p.method)return r}return null},[p,C]),Ys=Ke?Ke.request:null,Zs=Ke?Ke.response:null,Ks=y(()=>{let t=He;if(ie&&ie.trim().length>0){const s=ie.trim().toLowerCase().split(/\s+/).filter(Boolean);t=t.filter(n=>{const l=[n.name||"",JSON.stringify(n.params||""),JSON.stringify(n.userProperties||""),n.screenName||"",n.pageTitle||"",n.userId||"",n.source||""].join(" ").toLowerCase();return s.every(d=>l.includes(d))})}if(o.categories.size>0&&!o.categories.has("all")&&(t=t.filter(s=>{const n=vn(s.name);return o.categories.has(n)})),o.timeWindow!=="all"){const s=Date.now(),n=o.timeWindow==="1m"?s-60*1e3:o.timeWindow==="5m"?s-300*1e3:o.timeWindow==="15m"?s-900*1e3:s-3600*1e3;t=t.filter(l=>l.timestamp>=n)}if(o.sources.size>0&&!o.sources.has("all")&&(t=t.filter(s=>o.sources.has(s.source||"manual"))),o.userTypes.size>0&&!o.userTypes.has("all")&&(t=t.filter(s=>{const n=!!(s.userId&&s.userId.trim()!=="");return!!(o.userTypes.has("identified")&&n||o.userTypes.has("anonymous")&&!n)})),o.payloadComplexity!=="all"&&(o.payloadComplexity==="none"?t=t.filter(s=>!s.params||Object.keys(s.params).length===0):o.payloadComplexity==="simple"?t=t.filter(s=>s.params&&Object.keys(s.params).length<=3):o.payloadComplexity==="heavy"&&(t=t.filter(s=>s.params&&Object.keys(s.params).length>3))),o.onlyConversions){const s=["purchase","item_purchase","ecommerce_purchase","sign_up","login","lead","generate_lead","tutorial_complete","add_payment_info","begin_checkout","spend_virtual_currency"];t=t.filter(n=>s.some(l=>n.name.toLowerCase().includes(l)))}o.screens.size>0&&(t=t.filter(s=>{const n=s.screenName||s.params?.firebase_screen||s.params?.screen_name||s.params?.firebase_screen_class||s.screenClass||"";return o.screens.has(n)})),o.hasRevenue&&(t=t.filter(s=>s.params?.value!=null&&!isNaN(Number(s.params.value))||s.params?.price!=null&&!isNaN(Number(s.params.price)))),o.hasItems&&(t=t.filter(s=>Array.isArray(s.params?.items)&&s.params.items.length>0)),o.hasUserProps&&(t=t.filter(s=>s.userProperties&&Object.keys(s.userProperties).length>0)),o.hasParams&&(t=t.filter(s=>s.params&&Object.keys(s.params).length>0));const e=[];for(const s of t){if(e.length===0){e.push({...s,count:1});continue}const n=e[e.length-1];n.name===s.name&&JSON.stringify(n.params)===JSON.stringify(s.params)&&JSON.stringify(n.userProperties)===JSON.stringify(s.userProperties)?(n.count=(n.count||1)+1,n.timestamp=s.timestamp,n.id=s.id):e.push({...s,count:1})}let r=e;return o.onlyDuplicates&&(r=r.filter(s=>(s.count||1)>1)),o.sortBy==="time_asc"?r=[...r].sort((s,n)=>s.timestamp-n.timestamp):o.sortBy==="revenue_desc"?r=[...r].sort((s,n)=>{const l=Number(s.params?.value??s.params?.price??0);return Number(n.params?.value??n.params?.price??0)-l}):o.sortBy==="count_desc"&&(r=[...r].sort((s,n)=>(n.count||1)-(s.count||1))),r.slice(0,ne)},[He,ie,o,ne]),er=y(()=>{let t=q;if(T.size>0&&!T.has("all")&&(t=t.filter(e=>!!(T.has("user-log")&&e.sourceMethod==="log"||T.has("info")&&(e.sourceMethod==="info"||e.type==="info"&&e.sourceMethod!=="log")||T.has("warn")&&(e.type==="warn"||e.sourceMethod==="warn")||T.has("error")&&(e.type==="error"||e.sourceMethod==="error")||T.has("analytics")&&e.message?.toLowerCase().includes("[analytics error]")))),M&&M.trim().length>0){const e=M.trim().toLowerCase().split(/\s+/).filter(Boolean);t=t.filter(r=>{const s=[r.message||"",r.caller||"",r.type||"",r.sourceMethod||"",r.stack||""].join(" ").toLowerCase();return e.every(n=>n==="error"||n==="err"?r.type==="error"||s.includes(n):n==="warn"||n==="warning"?r.type==="warn"||s.includes(n):n==="info"&&r.type==="info"||s.includes(n))})}if(t=[...t].sort((e,r)=>qe==="newest"?r.timestamp-e.timestamp:e.timestamp-r.timestamp),!j){const e=[];for(const r of t){const s=e[e.length-1];s&&s.type===r.type&&s.sourceMethod===r.sourceMethod&&s.message===r.message?e[e.length-1]={...s,duplicateCount:(s.duplicateCount||1)+1}:e.push({...r,duplicateCount:1})}t=e}return t},[q,T,M,qe,j]),tr=y(()=>{let t=q;if(M&&M.trim().length>0){const r=M.trim().toLowerCase().split(/\s+/).filter(Boolean);t=q.filter(s=>{const n=[s.message||"",s.caller||"",s.type||"",s.sourceMethod||"",s.stack||""].join(" ").toLowerCase();return r.every(l=>l==="error"||l==="err"?s.type==="error"||n.includes(l):l==="warn"||l==="warning"?s.type==="warn"||n.includes(l):l==="info"&&s.type==="info"||n.includes(l))})}const e=q.length;return{all:`${t.length}/${e}`,info:`${t.filter(r=>r.sourceMethod==="info"||r.type==="info"&&r.sourceMethod!=="log").length}/${e}`,warn:`${t.filter(r=>r.type==="warn"||r.sourceMethod==="warn").length}/${e}`,error:`${t.filter(r=>r.type==="error"||r.sourceMethod==="error").length}/${e}`,"user-log":`${t.filter(r=>r.sourceMethod==="log").length}/${e}`,analytics:`${t.filter(r=>r.message.toLowerCase().includes("[analytics error]")).length}/${e}`}},[q,M]),sr=I(()=>{Y(!1),ot(!1),setTimeout(()=>{it(null),Qe(null),ht(null),ct(null),ut(null),se(null)},300)},[]);function Ur(){Pt(),O([]),fe(new Set),mt({}),pt(new Set),ft(new Set),dt(new Set),jt(""),le.current=new Set,R.current=new Map,yr(),W([]),Ps(""),Se.current=new Set,dr(),G([]),Ls(new Set(["all"])),bs("")}function rr(){if(m==="logs"){ce.alert("Clear Logs","Are you sure you want to clear all console logs?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{dr(),G([])},style:"destructive"}]);return}if(m==="analytics"){ce.alert("Clear Analytics","Are you sure you want to clear all analytics events?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{yr(),W([]),Qe(null),Se.current=new Set},style:"destructive"}]);return}if(m==="redux"){ce.alert("Clear Redux Timeline","Are you sure you want to clear the dispatched action history?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{Qn(),Ie({})},style:"destructive"}]);return}if(m==="crash"){ce.alert("Clear Crash History","Are you sure you want to clear all intercepted crash records?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:()=>{mr(),V([]),se(null)},style:"destructive"}]);return}Be.size>0?(O(t=>t.filter(e=>!Be.has(e.id))),fe(new Set)):ce.alert("Clear Logs","Are you sure you want to clear all network logs?",[{text:"Cancel",style:"cancel"},{text:"Clear All",onPress:jr,style:"destructive"}])}function jr(){Pt(),O([]),fe(new Set),mt({}),pt(new Set),ft(new Set),dt(new Set),le.current=new Set,R.current=new Map}const nr=y(()=>{if(!p)return"";try{const e=new URL(p.url).pathname.split("/").filter(Boolean);return e.length>0?`/${e.slice(-2).join("/")}`:"/"}catch{const t=p.url.split("/").filter(Boolean);return t.length>0?`/${t.slice(-2).join("/")}`:p.url}},[p]),ar=y(()=>p?bn(p.url):"",[p]),or=I(t=>{fe(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},[]),zr=y(()=>({visible:g,setVisible:Y,closeModal:sr,isMinimized:qt,setIsMinimized:ot,minimizeInspector:xr,isReady:Ht,enabled:v,isEnabled:v,appIcon:Ot,environment:Vt,modalHeightPercent:De,setModalHeightPercent:nt,modalAnimationType:Fe,setModalAnimationType:at,hasNavigationContext:ks,setNavState:At,activeTab:m,switchActiveTab:Ts,tabVisibility:S,toggleTabVisibility:Ms,lastReadApisCount:ps,lastReadLogsCount:ds,mediaCount:Cs,refreshMediaCount:Ue,selected:p,setSelected:it,selectedEvent:Es,setSelectedEvent:Qe,selectedLog:ls,setSelectedLog:ht,showHeaderInfo:Kt,setShowHeaderInfo:Nr,settingsPage:ws,setSettingsPage:Dr,isAboutOpen:vs,setIsAboutOpen:Fr,updateAvailable:Ns,latestNpmVersion:Ce,clearAnim:ve,activePulseAnim:be,unreadPulseAnim:Le,runClearAllWithAnimation:js,useNativeFab:z,fabPan:x,fabPanResponder:Us,fabDraggedRef:Ze,pulseAnim:xe,fabShineAnim:we,logs:C,filteredLogs:D,groupedData:Gs,search:Z,setSearch:jt,searchScope:Oe,setSearchScope:br,isRegexSearch:Ve,setIsRegexSearch:Lr,isCaseSensitive:_e,setIsCaseSensitive:wr,quickFilter:N,setQuickFilter:vr,statusFilters:de,setStatusFilters:ft,methodFilters:me,setMethodFilters:dt,availableMethods:$s,sortOrder:ke,setSortOrder:Mr,selectedLogs:Be,toggleSelect:or,minStart:Xs,totalRange:Qs,newLogIds:qs,toggleSectionFilter:Ws,toggleSectionCollapse:Js,handleDelete:rr,isNetworkPaused:K,setIsNetworkPaused:Er,detailTitle:nr,detailDisplayUrl:ar,apiDetailActiveTab:Xt,setApiDetailActiveTab:Qt,detailSearch:zt,setDetailSearch:lt,reqExpanded:es,setReqExpanded:ts,resExpanded:ss,setResExpanded:rs,showReqDiff:ns,setShowReqDiff:as,showResDiff:os,setShowResDiff:is,prevRequestData:Ys,prevResponseData:Zs,logRouteMapRef:R,consoleLogs:J,visibleConsoleLogs:q,filteredConsoleLogs:er,logSearch:M,setLogSearch:bs,logFilters:T,setLogFilters:Ls,logCounts:tr,logSortOrder:qe,setLogSortOrder:Tr,isConsolePaused:ee,setIsConsolePaused:Pr,analyticsEvents:He,filteredAnalyticsEvents:Ks,analyticsSearch:ie,setAnalyticsSearch:Ps,analyticsFilters:o,setAnalyticsFilters:Is,isAnalyticsFilterApplied:Ds,resetAnalyticsFilters:Fs,newEventIds:Vs,isAnalyticsLayoutReady:Bs,setIsAnalyticsLayoutReady:kr,analyticsHeaderExpanded:Os,setAnalyticsHeaderExpanded:qr,isAnalyticsPaused:te,setIsAnalyticsPaused:Ir,reduxState:_t,setReduxState:Pe,reduxLastActionMap:kt,reduxSearch:$t,setReduxSearch:Rr,selectedReduxSlice:Wt,setSelectedReduxSlice:ct,selectedReduxAction:Jt,setSelectedReduxAction:ut,reduxActiveSubTab:Gt,setReduxActiveSubTab:Ar,crashRecords:ye,setCrashRecords:V,selectedCrash:xs,setSelectedCrash:se,lastReadCrashesCount:gs,maxCrashLogs:_,setMaxCrashLogs:je,clearAllCrashes:()=>{mr(),V([]),se(null)},settingsActiveSubTab:Rs,setSettingsActiveSubTab:Br,defaultTab:U,setDefaultTab:Xe,isDark:Ee,setIsDark:rt,showDuplicateLogs:j,setShowDuplicateLogs:bt,showUpdateToast:Lt,setShowUpdateToast:wt,showConsoleLevels:k,setShowConsoleLevels:gt,resetToDefaults:Vr,storage:B,maxNetworkLogs:H,setMaxNetworkLogs:We,maxConsoleLogs:re,setMaxConsoleLogs:ze,maxAnalyticsEventsLimit:ne,setMaxAnalyticsEventsLimit:Je,isAutoRamLimitEnabled:ae,setIsAutoRamLimitEnabled:yt,deviceFreeRamMb:Ct,reduxAutoRefresh:oe,setReduxAutoRefreshState:St,reduxExpandDepth:Ge,setReduxExpandDepth:xt}),[g,sr,Ht,v,Ot,Vt,De,Fe,ks,At,m,Ts,S,Ms,ps,ds,Cs,Ue,p,Es,ls,Kt,ws,vs,Ns,Ce,ve,be,Le,js,z,x,Us,xe,we,C,D,Gs,Z,Oe,Ve,_e,N,de,me,$s,ke,Be,or,Xs,Qs,qs,Ws,Js,rr,K,nr,ar,Xt,zt,es,ss,ns,os,Ys,Zs,J,q,er,M,T,tr,qe,ee,He,Ks,ie,o,Ds,Fs,Vs,Bs,Os,te,_t,kt,$t,Wt,Jt,Gt,ye,xs,gs,_,Rs,U,Ee,j,Lt,k,B,H,re,ne,ae,Ct,oe,Ge,qt]);return<Sn.Provider value={zr}>
2
+ <Cn/>
3
+ </Sn.Provider>},Sa=v=>{const B=v?.enabled??!0,L=v?.telemetry??!0;return i(()=>(B?L?jn(!0,v?.environment):hr(!1):(Ne().catch(()=>{}),hr(!1)),()=>{Ne().catch(()=>{})}),[B,L,v?.environment]),B?<Yr i18n={Zr}>
4
+ <Kr fallbackType="inline">
5
+ <Ca{...v}enabled={B}/>
6
+ </Kr>
7
+ </Yr>:null};export default Sa;export{setupNetworkLogger,clearNetworkLogs,subscribeNetworkLogs,addAxiosInterceptors}from"./customHooks/networkLogger";export{setupConsoleLogger,clearConsoleLogs,subscribeConsoleLogs}from"./customHooks/consoleLogger";export{setupAnalyticsLogger,logAnalyticsEvent,subscribeAnalyticsEvents,clearAnalyticsEvents,getCurrentUserProperties,getCurrentUserId,getDefaultEventParameters,getCollectionEnabled}from"./customHooks/analyticsLogger";export{setupGlobalCrashHandler,subscribeCrashEvents,emitCrashEvent,getCrashRecords,clearCrashRecords,simulateTestCrash,exportCrashReport,parseCrashStackTrace,recordCustomCrash,addCrashBreadcrumb,recordNavigationBreadcrumb,recordNetworkBreadcrumb,recordReduxBreadcrumb,recordUserActionBreadcrumb,computeCrashFingerprint}from"./customHooks/crashHandler";export{default as CrashTab}from"./components/Inspector/CrashTab";export{default as ErrorBoundary}from"./components/ErrorBoundary";export{connectReduxStore,inspectorReduxMiddleware,getReduxState,subscribeReduxState,getActionHistory,clearActionHistory,getLastActionForReducer}from"./customHooks/reduxLogger";export{getEventCategory,registerGAPlugin}from"./helpers/gaAnalyticsRegistry";export{usePerformanceTracker,useComponentProfiler,useNavigationProfiler,trackComponentRender,trackNavigationTransition,trackHeavyTask,measureAsync,getHermesMemoryStats,registerComponentProfile,subscribeRenderProfiles,getRenderProfiles,logPerformanceEvent,clearPerformanceEvents,subscribePerformanceEvents,getPerformanceEvents,getInitialRenderProfiles,getInitialPerformanceEvents,generateFixSnippet}from"./customHooks/performanceTracker";export{InspectLog,InspectTrackTime,InspectCatch}from"./decorators";export{getNativeDeviceMetrics,enableNativeCrashProtection,subscribeNativeCrashes,showNativeFloatingButton,hideNativeFloatingButton,setNativeFloatingButtonBadge,subscribeNativeFloatingButtonPress,subscribeNativeDeviceShake,startNativeFpsMonitoring,stopNativeFpsMonitoring,getNativeFpsMetrics,getNativeStorageItem,setNativeStorageItem,isNativeModuleAvailable}from"./native/NativeInspector";export{setupMemoryWarningHandler,pruneAllLogs,subscribeMemoryWarning}from"./helpers";export{setMaxNetworkLogsLimit,getMaxNetworkLogsLimit,pruneNetworkLogs}from"./customHooks/networkLogger";export{setMaxConsoleLogsLimit,getMaxConsoleLogsLimit,pruneConsoleLogs}from"./customHooks/consoleLogger";export{setMaxReduxHistoryLimit,getMaxReduxHistoryLimit,pruneReduxHistory}from"./customHooks/reduxLogger";export{setMaxAnalyticsLogsLimit,getMaxAnalyticsLogsLimit,pruneAnalyticsLogs}from"./customHooks/analyticsLogger";export{getMaxCrashLogsLimit,pruneCrashRecords}from"./customHooks/crashHandler";export{setMaxPerformanceEventsLimit,getMaxPerformanceEventsLimit,prunePerformanceEvents}from"./customHooks/performanceTracker";export{BrandSquareIcon,BrandCircleIcon}from"./components/NetworkIcons";export{connectAsyncStorage,connectMMKV,isAsyncStorageConnected,isMMKVConnected,getRegisteredMMKVInstanceIds,fetchStorageEntries,setStorageEntry,removeStorageEntry,clearStorageDriver,subscribeToStorageChanges}from"./customHooks/storageInspector";export{ActiveTab,Method,StatusFilter,SortOrder,LocalFilter,ModalAnimationType,SettingsPage,SettingsSubTab,LogFilter,ConsoleLogType,AnalyticsEventSource,GAEventCategory,StackFrameType,DiffResultType,BundleSubTab,PerformanceSubTab,CrashType,CrashExportFormat,CrashDetailSubTab,CrashFilterType,BreadcrumbType}from"./types";export{AppFonts,setAppFonts}from"./styles/AppFonts";export{AppColors,setAppColors,getThemeColors,updateAppColorsTheme}from"./styles/AppColors";export{t,i18n,useTranslation,setLanguage,addTranslations,setTranslations,I18nextProvider}from"./i18n";export{fetchRemoteConfigModuleStatus,isFirebaseRemoteConfigAvailable}from"./helpers/remoteConfig";export{ScreenCapture,ScreenRecorder}from"./capture";export{LIB_VERSION}from"./constants/version";
@@ -137,3 +137,4 @@ export declare const convertNativeVideoToGif: (videoUri: string, options?: GifCo
137
137
  export declare const fetchCapturedMediaList: () => Promise<CapturedMediaItem[]>;
138
138
  export declare const deleteCapturedMediaFile: (uri: string) => Promise<boolean>;
139
139
  export declare const clearAllCapturedMediaFiles: () => Promise<boolean>;
140
+ export declare const copyMediaToClipboard: (filePath: string) => Promise<boolean>;
@@ -1 +1 @@
1
- import{NativeModules as i,NativeEventEmitter as f,DeviceEventEmitter as l}from"react-native";import g from"./NativeNetworkInspector";const t=g||i.NetworkInspectorModule;export const isNativeModuleAvailable=()=>!!t;const d=()=>{try{if(i&&i.NetworkInspectorModule)return new f(i.NetworkInspectorModule)}catch{}return null},n=d();export const getNativeDeviceMetrics=async()=>{if(!t||!t.getDeviceMetrics)return null;try{return await t.getDeviceMetrics()}catch{return null}},enableNativeCrashProtection=async e=>{if(!t||!t.enableNativeCrashProtection)return!1;try{const r=await t.enableNativeCrashProtection();return e?.showFloatingButton===!0&&await showNativeFloatingButton(),!!r}catch{return!1}},subscribeNativeCrashes=e=>{const r=[];try{const s=l.addListener("onNativeCrash",e);r.push(()=>s.remove())}catch{}if(n)try{const s=n.addListener("onNativeCrash",e);r.push(()=>s.remove())}catch{}return()=>{r.forEach(s=>{try{s()}catch{}})}},showNativeFloatingButton=async e=>{if(!t||!t.showFloatingButton)return!1;try{return!!await t.showFloatingButton(e||{})}catch{return!1}},hideNativeFloatingButton=async()=>{if(!t||!t.hideFloatingButton)return!1;try{return!!await t.hideFloatingButton()}catch{return!1}},setNativeFloatingButtonBadge=async e=>{if(!t||!t.setFloatingButtonBadge)return!1;try{return!!await t.setFloatingButtonBadge(e)}catch{return!1}},subscribeNativeFloatingButtonPress=e=>{const r=[];try{const a=l.addListener("onFloatingButtonPress",e);r.push(()=>a.remove())}catch{}if(n)try{const a=n.addListener("onFloatingButtonPress",e);r.push(()=>a.remove())}catch{}const s=setInterval(async()=>{if(t&&t.checkFloatingButtonPress)try{await t.checkFloatingButtonPress()&&e()}catch{}},180);return r.push(()=>clearInterval(s)),()=>{r.forEach(a=>{try{a()}catch{}})}},startNativeFpsMonitoring=async()=>{if(!t||!t.startFpsMonitoring)return!1;try{return!!await t.startFpsMonitoring()}catch{return!1}},stopNativeFpsMonitoring=async()=>{if(!t||!t.stopFpsMonitoring)return!1;try{return!!await t.stopFpsMonitoring()}catch{return!1}},getNativeFpsMetrics=async()=>{if(!t||!t.getFpsMetrics)return{fps:60,targetFps:60};try{const e=await t.getFpsMetrics();return{fps:typeof e?.fps=="number"?e.fps:60,targetFps:typeof e?.targetFps=="number"?e.targetFps:60}}catch{return{fps:60,targetFps:60}}},subscribeNativeDeviceShake=e=>{if(!n)return()=>{};try{const r=n.addListener("onDeviceShake",e);return()=>{r.remove()}}catch{return()=>{}}},getNativeStorageItem=async e=>{if(!t||!t.getNativeStorageItem)return null;try{const r=await t.getNativeStorageItem(e);return typeof r=="string"?r:null}catch{return null}},setNativeStorageItem=async(e,r)=>{if(!t||!t.setNativeStorageItem)return!1;try{return!!await t.setNativeStorageItem(e,r)}catch{return!1}},triggerNativeHaptic=async(e="light")=>{if(!t||!t.triggerHaptic)return!1;try{return!!await t.triggerHaptic(e)}catch{return!1}},getNativeSystemMetrics=async()=>{if(!t||!t.getNativeSystemMetrics)return null;try{return await t.getNativeSystemMetrics()}catch{return null}},pushNativeLogRecord=async(e,r)=>{if(!t||!t.pushNativeLogRecord)return!1;try{return!!await t.pushNativeLogRecord(e,r)}catch{return!1}},fetchNativeCachedPage=async(e,r=0,s=50,a="")=>{if(!t||!t.getNativeCachedPage)return null;try{const c=await t.getNativeCachedPage(e,r,s,a);if(!c)return null;const o=JSON.parse(c),p=(o.items||[]).map(u=>typeof u=="string"?JSON.parse(u):u);return{pageKey:o.pageKey||e,total:o.total||0,offset:o.offset||r,items:p}}catch{return null}},takeNativeScreenshot=async e=>{if(!t||!t.takeScreenshot)return null;try{return await t.takeScreenshot(e||{})}catch{return null}},startNativeVideoRecording=async e=>{if(!t||!t.startVideoRecording)return!1;try{return!!await t.startVideoRecording(e||{})}catch{return!1}},stopNativeVideoRecording=async()=>{if(!t||!t.stopVideoRecording)return null;try{return await t.stopVideoRecording()}catch{return null}},isNativeRecordingActive=async()=>{if(!t||!t.isRecording)return!1;try{return!!await t.isRecording()}catch{return!1}},playNativeVideo=async e=>{if(!t||!t.playVideo)return!1;try{return!!await t.playVideo(e)}catch{return!1}},convertNativeVideoToGif=async(e,r)=>{if(!t||!t.convertToGif)return null;try{return await t.convertToGif(e,r||{})}catch{return null}},fetchCapturedMediaList=async()=>{if(!t||!t.getCapturedMedia)return[];try{const e=await t.getCapturedMedia();if(!e)return[];const r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}},deleteCapturedMediaFile=async e=>{if(!t||!t.deleteCapturedMedia)return!1;try{return!!await t.deleteCapturedMedia(e)}catch{return!1}},clearAllCapturedMediaFiles=async()=>{if(!t||!t.clearAllCapturedMedia)return!1;try{return!!await t.clearAllCapturedMedia()}catch{return!1}};
1
+ import{NativeModules as i,NativeEventEmitter as f,DeviceEventEmitter as l}from"react-native";import d from"./NativeNetworkInspector";const t=d||i.NetworkInspectorModule;export const isNativeModuleAvailable=()=>!!t;const g=()=>{try{if(i&&i.NetworkInspectorModule)return new f(i.NetworkInspectorModule)}catch{}return null},n=g();export const getNativeDeviceMetrics=async()=>{if(!t||!t.getDeviceMetrics)return null;try{return await t.getDeviceMetrics()}catch{return null}},enableNativeCrashProtection=async e=>{if(!t||!t.enableNativeCrashProtection)return!1;try{const r=await t.enableNativeCrashProtection();return e?.showFloatingButton===!0&&await showNativeFloatingButton(),!!r}catch{return!1}},subscribeNativeCrashes=e=>{const r=[];try{const s=l.addListener("onNativeCrash",e);r.push(()=>s.remove())}catch{}if(n)try{const s=n.addListener("onNativeCrash",e);r.push(()=>s.remove())}catch{}return()=>{r.forEach(s=>{try{s()}catch{}})}},showNativeFloatingButton=async e=>{if(!t||!t.showFloatingButton)return!1;try{return!!await t.showFloatingButton(e||{})}catch{return!1}},hideNativeFloatingButton=async()=>{if(!t||!t.hideFloatingButton)return!1;try{return!!await t.hideFloatingButton()}catch{return!1}},setNativeFloatingButtonBadge=async e=>{if(!t||!t.setFloatingButtonBadge)return!1;try{return!!await t.setFloatingButtonBadge(e)}catch{return!1}},subscribeNativeFloatingButtonPress=e=>{const r=[];try{const a=l.addListener("onFloatingButtonPress",e);r.push(()=>a.remove())}catch{}if(n)try{const a=n.addListener("onFloatingButtonPress",e);r.push(()=>a.remove())}catch{}const s=setInterval(async()=>{if(t&&t.checkFloatingButtonPress)try{await t.checkFloatingButtonPress()&&e()}catch{}},180);return r.push(()=>clearInterval(s)),()=>{r.forEach(a=>{try{a()}catch{}})}},startNativeFpsMonitoring=async()=>{if(!t||!t.startFpsMonitoring)return!1;try{return!!await t.startFpsMonitoring()}catch{return!1}},stopNativeFpsMonitoring=async()=>{if(!t||!t.stopFpsMonitoring)return!1;try{return!!await t.stopFpsMonitoring()}catch{return!1}},getNativeFpsMetrics=async()=>{if(!t||!t.getFpsMetrics)return{fps:60,targetFps:60};try{const e=await t.getFpsMetrics();return{fps:typeof e?.fps=="number"?e.fps:60,targetFps:typeof e?.targetFps=="number"?e.targetFps:60}}catch{return{fps:60,targetFps:60}}},subscribeNativeDeviceShake=e=>{if(!n)return()=>{};try{const r=n.addListener("onDeviceShake",e);return()=>{r.remove()}}catch{return()=>{}}},getNativeStorageItem=async e=>{if(!t||!t.getNativeStorageItem)return null;try{const r=await t.getNativeStorageItem(e);return typeof r=="string"?r:null}catch{return null}},setNativeStorageItem=async(e,r)=>{if(!t||!t.setNativeStorageItem)return!1;try{return!!await t.setNativeStorageItem(e,r)}catch{return!1}},triggerNativeHaptic=async(e="light")=>{if(!t||!t.triggerHaptic)return!1;try{return!!await t.triggerHaptic(e)}catch{return!1}},getNativeSystemMetrics=async()=>{if(!t||!t.getNativeSystemMetrics)return null;try{return await t.getNativeSystemMetrics()}catch{return null}},pushNativeLogRecord=async(e,r)=>{if(!t||!t.pushNativeLogRecord)return!1;try{return!!await t.pushNativeLogRecord(e,r)}catch{return!1}},fetchNativeCachedPage=async(e,r=0,s=50,a="")=>{if(!t||!t.getNativeCachedPage)return null;try{const c=await t.getNativeCachedPage(e,r,s,a);if(!c)return null;const o=JSON.parse(c),p=(o.items||[]).map(u=>typeof u=="string"?JSON.parse(u):u);return{pageKey:o.pageKey||e,total:o.total||0,offset:o.offset||r,items:p}}catch{return null}},takeNativeScreenshot=async e=>{if(!t||!t.takeScreenshot)return null;try{return await t.takeScreenshot(e||{})}catch{return null}},startNativeVideoRecording=async e=>{if(!t||!t.startVideoRecording)return!1;try{return!!await t.startVideoRecording(e||{})}catch{return!1}},stopNativeVideoRecording=async()=>{if(!t||!t.stopVideoRecording)return null;try{return await t.stopVideoRecording()}catch{return null}},isNativeRecordingActive=async()=>{if(!t||!t.isRecording)return!1;try{return!!await t.isRecording()}catch{return!1}},playNativeVideo=async e=>{if(!t||!t.playVideo)return!1;try{return!!await t.playVideo(e)}catch{return!1}},convertNativeVideoToGif=async(e,r)=>{if(!t||!t.convertToGif)return null;try{return await t.convertToGif(e,r||{})}catch{return null}},fetchCapturedMediaList=async()=>{if(!t||!t.getCapturedMedia)return[];try{const e=await t.getCapturedMedia();if(!e)return[];const r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}},deleteCapturedMediaFile=async e=>{if(!t||!t.deleteCapturedMedia)return!1;try{return!!await t.deleteCapturedMedia(e)}catch{return!1}},clearAllCapturedMediaFiles=async()=>{if(!t||!t.clearAllCapturedMedia)return!1;try{return!!await t.clearAllCapturedMedia()}catch{return!1}},copyMediaToClipboard=async e=>{if(!e||!t||!t.copyMediaToClipboard)return!1;try{return!!(await t.copyMediaToClipboard(e))?.success}catch{return!1}};