react-native-inapp-inspector 2.3.19 → 2.3.21

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 (353) hide show
  1. package/README.md +14 -14
  2. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +67 -0
  3. package/dist/commonjs/analytics.js +1 -24
  4. package/dist/commonjs/bundle.js +1 -16
  5. package/dist/commonjs/capture.js +1 -35
  6. package/dist/commonjs/components/AnalyticsDetail.js +92 -623
  7. package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
  8. package/dist/commonjs/components/AnalyticsGraph.js +70 -370
  9. package/dist/commonjs/components/AnimatedEntrance.js +1 -11
  10. package/dist/commonjs/components/AppHeaderLogo.js +7 -134
  11. package/dist/commonjs/components/BrandCircleIcon.js +73 -118
  12. package/dist/commonjs/components/BrandSquareIcon.js +63 -108
  13. package/dist/commonjs/components/CodeSnippet.js +48 -623
  14. package/dist/commonjs/components/ConsoleLogCard.js +63 -537
  15. package/dist/commonjs/components/CopyButton.js +3 -89
  16. package/dist/commonjs/components/DiffViewer.js +19 -83
  17. package/dist/commonjs/components/DomainHeader.js +27 -127
  18. package/dist/commonjs/components/EmptyState.js +10 -87
  19. package/dist/commonjs/components/EndOfListFooter.js +7 -81
  20. package/dist/commonjs/components/ErrorBoundary.js +72 -566
  21. package/dist/commonjs/components/HeadersSection.js +31 -110
  22. package/dist/commonjs/components/HighlightText.js +17 -58
  23. package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
  24. package/dist/commonjs/components/Inspector/AboutModal.js +243 -0
  25. package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
  26. package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
  27. package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
  28. package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
  29. package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
  30. package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
  31. package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
  32. package/dist/commonjs/components/Inspector/DebuggingTab.js +74 -875
  33. package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
  34. package/dist/commonjs/components/Inspector/FabLauncher.js +42 -466
  35. package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
  36. package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
  37. package/dist/commonjs/components/Inspector/InspectorHeader.js +191 -1110
  38. package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
  39. package/dist/commonjs/components/Inspector/MainScreen.js +52 -335
  40. package/dist/commonjs/components/Inspector/MediaGalleryTab.js +97 -644
  41. package/dist/commonjs/components/Inspector/MediaPreviewModal.js +90 -605
  42. package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
  43. package/dist/commonjs/components/Inspector/NetworkDetail.js +89 -411
  44. package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
  45. package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
  46. package/dist/commonjs/components/Inspector/NpmStarPrompt.js +18 -434
  47. package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
  48. package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
  49. package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
  50. package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
  51. package/dist/commonjs/components/Inspector/SettingsPanel.js +427 -3807
  52. package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
  53. package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
  54. package/dist/commonjs/components/Inspector/TabBar.js +36 -334
  55. package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +37 -412
  56. package/dist/commonjs/components/JsonViewer.js +168 -381
  57. package/dist/commonjs/components/LogCard.js +57 -567
  58. package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
  59. package/dist/commonjs/components/MetaAccordion.js +69 -238
  60. package/dist/commonjs/components/MiniBarChart.js +3 -56
  61. package/dist/commonjs/components/MiniLineChart.js +3 -58
  62. package/dist/commonjs/components/NetworkIcons.d.ts +13 -0
  63. package/dist/commonjs/components/NetworkIcons.js +521 -1022
  64. package/dist/commonjs/components/QRCodeView.js +5 -79
  65. package/dist/commonjs/components/SectionHeader.js +15 -37
  66. package/dist/commonjs/components/SegmentedTabs.js +7 -62
  67. package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
  68. package/dist/commonjs/components/Slider.js +15 -243
  69. package/dist/commonjs/components/SourcePageCard.js +30 -89
  70. package/dist/commonjs/components/Toast.js +5 -147
  71. package/dist/commonjs/components/TouchableScale.js +3 -24
  72. package/dist/commonjs/components/TreeNode.js +55 -130
  73. package/dist/commonjs/console.js +1 -16
  74. package/dist/commonjs/constants/index.js +1 -32
  75. package/dist/commonjs/constants/telemetryConfig.js +1 -6
  76. package/dist/commonjs/constants/version.d.ts +1 -1
  77. package/dist/commonjs/constants/version.js +1 -4
  78. package/dist/commonjs/crash.js +1 -23
  79. package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
  80. package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
  81. package/dist/commonjs/customHooks/consoleLogger.js +6 -445
  82. package/dist/commonjs/customHooks/crashHandler.js +7 -656
  83. package/dist/commonjs/customHooks/logFilters.js +1 -23
  84. package/dist/commonjs/customHooks/networkLogger.js +2 -536
  85. package/dist/commonjs/customHooks/performanceTracker.js +63 -750
  86. package/dist/commonjs/customHooks/reduxLogger.js +2 -313
  87. package/dist/commonjs/customHooks/storageInspector.js +1 -435
  88. package/dist/commonjs/customHooks/useAccordion.js +1 -18
  89. package/dist/commonjs/decorators/index.js +1 -100
  90. package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
  91. package/dist/commonjs/helpers/index.d.ts +1 -0
  92. package/dist/commonjs/helpers/index.js +8 -921
  93. package/dist/commonjs/helpers/memoryManager.js +1 -99
  94. package/dist/commonjs/helpers/qrGenerator.js +1 -367
  95. package/dist/commonjs/helpers/remoteConfig.js +1 -165
  96. package/dist/commonjs/helpers/searchQueryParser.js +1 -62
  97. package/dist/commonjs/helpers/settingsStore.js +1 -144
  98. package/dist/commonjs/helpers/telemetry.js +1 -501
  99. package/dist/commonjs/helpers/toast.js +1 -20
  100. package/dist/commonjs/i18n/index.js +1 -90
  101. package/dist/commonjs/i18n/locales/en.json +1 -1140
  102. package/dist/commonjs/index.js +5 -2168
  103. package/dist/commonjs/metro.js +6 -468
  104. package/dist/commonjs/native/NativeInspector.d.ts +1 -0
  105. package/dist/commonjs/native/NativeInspector.js +1 -415
  106. package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
  107. package/dist/commonjs/network.js +1 -13
  108. package/dist/commonjs/performance.js +1 -29
  109. package/dist/commonjs/redux.js +1 -20
  110. package/dist/commonjs/storage.js +1 -14
  111. package/dist/commonjs/styles/AppColors.js +1 -423
  112. package/dist/commonjs/styles/AppFonts.js +1 -17
  113. package/dist/commonjs/styles/common.js +1 -190
  114. package/dist/commonjs/styles/index.d.ts +6 -0
  115. package/dist/commonjs/styles/index.js +1 -1589
  116. package/dist/commonjs/types/enums.d.ts +0 -1
  117. package/dist/commonjs/types/enums.js +1 -152
  118. package/dist/commonjs/types/index.js +1 -18
  119. package/dist/commonjs/types/interfaces.d.ts +2 -2
  120. package/dist/commonjs/types/interfaces.js +1 -2
  121. package/dist/esm/analytics.js +1 -2
  122. package/dist/esm/bundle.js +1 -2
  123. package/dist/esm/capture.js +1 -32
  124. package/dist/esm/components/AnalyticsDetail.js +171 -664
  125. package/dist/esm/components/AnalyticsEventCard.js +77 -335
  126. package/dist/esm/components/AnalyticsGraph.js +95 -357
  127. package/dist/esm/components/AnimatedEntrance.js +1 -6
  128. package/dist/esm/components/AppHeaderLogo.js +7 -94
  129. package/dist/esm/components/BrandCircleIcon.js +114 -119
  130. package/dist/esm/components/BrandSquareIcon.js +73 -78
  131. package/dist/esm/components/CodeSnippet.js +58 -595
  132. package/dist/esm/components/ConsoleLogCard.js +91 -526
  133. package/dist/esm/components/CopyButton.js +3 -51
  134. package/dist/esm/components/DiffViewer.js +22 -48
  135. package/dist/esm/components/DomainHeader.js +43 -138
  136. package/dist/esm/components/EmptyState.js +17 -56
  137. package/dist/esm/components/EndOfListFooter.js +15 -83
  138. package/dist/esm/components/ErrorBoundary.js +125 -582
  139. package/dist/esm/components/HeadersSection.js +52 -93
  140. package/dist/esm/components/HighlightText.js +17 -53
  141. package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
  142. package/dist/esm/components/Inspector/AboutModal.js +243 -0
  143. package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
  144. package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
  145. package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
  146. package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
  147. package/dist/esm/components/Inspector/CrashDetail.js +236 -747
  148. package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
  149. package/dist/esm/components/Inspector/CrashTab.js +177 -711
  150. package/dist/esm/components/Inspector/DebuggingTab.js +164 -925
  151. package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
  152. package/dist/esm/components/Inspector/FabLauncher.js +68 -454
  153. package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
  154. package/dist/esm/components/Inspector/InspectorContext.js +1 -12
  155. package/dist/esm/components/Inspector/InspectorHeader.js +282 -1163
  156. package/dist/esm/components/Inspector/LogDetail.js +235 -1023
  157. package/dist/esm/components/Inspector/MainScreen.js +78 -323
  158. package/dist/esm/components/Inspector/MediaGalleryTab.js +143 -650
  159. package/dist/esm/components/Inspector/MediaPreviewModal.js +138 -613
  160. package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
  161. package/dist/esm/components/Inspector/NetworkDetail.js +138 -455
  162. package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
  163. package/dist/esm/components/Inspector/NetworkTab.js +125 -517
  164. package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
  165. package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
  166. package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
  167. package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
  168. package/dist/esm/components/Inspector/ReduxTab.js +144 -722
  169. package/dist/esm/components/Inspector/SettingsPanel.js +643 -3985
  170. package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
  171. package/dist/esm/components/Inspector/StorageTab.js +172 -866
  172. package/dist/esm/components/Inspector/TabBar.js +45 -305
  173. package/dist/esm/components/Inspector/UpdateAvailableModal.js +80 -418
  174. package/dist/esm/components/JsonViewer.js +179 -354
  175. package/dist/esm/components/LogCard.js +93 -565
  176. package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
  177. package/dist/esm/components/MetaAccordion.js +136 -267
  178. package/dist/esm/components/MiniBarChart.js +3 -18
  179. package/dist/esm/components/MiniLineChart.js +3 -20
  180. package/dist/esm/components/NetworkIcons.d.ts +13 -0
  181. package/dist/esm/components/NetworkIcons.js +523 -838
  182. package/dist/esm/components/QRCodeView.js +8 -45
  183. package/dist/esm/components/SectionHeader.js +22 -39
  184. package/dist/esm/components/SegmentedTabs.js +8 -58
  185. package/dist/esm/components/SkeletonPlaceholder.js +30 -163
  186. package/dist/esm/components/Slider.js +24 -213
  187. package/dist/esm/components/SourcePageCard.js +65 -86
  188. package/dist/esm/components/Toast.js +10 -117
  189. package/dist/esm/components/TouchableScale.js +3 -19
  190. package/dist/esm/components/TreeNode.js +58 -95
  191. package/dist/esm/console.js +1 -2
  192. package/dist/esm/constants/index.js +1 -28
  193. package/dist/esm/constants/telemetryConfig.js +1 -3
  194. package/dist/esm/constants/version.d.ts +1 -1
  195. package/dist/esm/constants/version.js +1 -1
  196. package/dist/esm/crash.js +1 -2
  197. package/dist/esm/customHooks/analyticsLogger.js +1 -230
  198. package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
  199. package/dist/esm/customHooks/consoleLogger.js +6 -432
  200. package/dist/esm/customHooks/crashHandler.js +7 -630
  201. package/dist/esm/customHooks/logFilters.js +1 -20
  202. package/dist/esm/customHooks/networkLogger.js +2 -519
  203. package/dist/esm/customHooks/performanceTracker.js +63 -723
  204. package/dist/esm/customHooks/reduxLogger.js +2 -293
  205. package/dist/esm/customHooks/storageInspector.js +1 -418
  206. package/dist/esm/customHooks/useAccordion.js +1 -16
  207. package/dist/esm/decorators/index.js +1 -95
  208. package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
  209. package/dist/esm/helpers/index.d.ts +1 -0
  210. package/dist/esm/helpers/index.js +8 -861
  211. package/dist/esm/helpers/memoryManager.js +1 -91
  212. package/dist/esm/helpers/qrGenerator.js +1 -364
  213. package/dist/esm/helpers/remoteConfig.js +1 -160
  214. package/dist/esm/helpers/searchQueryParser.js +1 -59
  215. package/dist/esm/helpers/settingsStore.js +1 -134
  216. package/dist/esm/helpers/telemetry.js +1 -489
  217. package/dist/esm/helpers/toast.js +1 -15
  218. package/dist/esm/i18n/index.js +1 -78
  219. package/dist/esm/i18n/locales/en.json +1 -1140
  220. package/dist/esm/index.js +7 -1982
  221. package/dist/esm/metro.js +6 -459
  222. package/dist/esm/native/NativeInspector.d.ts +1 -0
  223. package/dist/esm/native/NativeInspector.js +1 -382
  224. package/dist/esm/native/NativeNetworkInspector.js +1 -2
  225. package/dist/esm/network.js +1 -1
  226. package/dist/esm/performance.js +1 -2
  227. package/dist/esm/redux.js +1 -1
  228. package/dist/esm/storage.js +1 -1
  229. package/dist/esm/styles/AppColors.js +1 -417
  230. package/dist/esm/styles/AppFonts.js +1 -13
  231. package/dist/esm/styles/common.js +1 -186
  232. package/dist/esm/styles/index.d.ts +6 -0
  233. package/dist/esm/styles/index.js +1 -1551
  234. package/dist/esm/types/enums.d.ts +0 -1
  235. package/dist/esm/types/enums.js +1 -149
  236. package/dist/esm/types/index.js +1 -2
  237. package/dist/esm/types/interfaces.d.ts +2 -2
  238. package/dist/esm/types/interfaces.js +1 -1
  239. package/ios/NetworkInspectorModule.mm +60 -12
  240. package/package.json +5 -3
  241. package/src/native/NativeInspector.ts +18 -0
  242. package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +0 -7
  243. package/dist/commonjs/components/Inspector/FeedbackModal.js +0 -552
  244. package/dist/esm/components/Inspector/FeedbackModal.d.ts +0 -7
  245. package/dist/esm/components/Inspector/FeedbackModal.js +0 -515
  246. package/src/analytics.ts +0 -35
  247. package/src/bundle.ts +0 -25
  248. package/src/capture.ts +0 -109
  249. package/src/components/AnalyticsDetail.tsx +0 -870
  250. package/src/components/AnalyticsEventCard.tsx +0 -444
  251. package/src/components/AnalyticsGraph.tsx +0 -583
  252. package/src/components/AnimatedEntrance.tsx +0 -20
  253. package/src/components/AppHeaderLogo.tsx +0 -143
  254. package/src/components/BrandCircleIcon.tsx +0 -144
  255. package/src/components/BrandSquareIcon.tsx +0 -184
  256. package/src/components/CodeSnippet.tsx +0 -725
  257. package/src/components/ConsoleLogCard.tsx +0 -679
  258. package/src/components/CopyButton.tsx +0 -87
  259. package/src/components/DiffViewer.tsx +0 -82
  260. package/src/components/DomainHeader.tsx +0 -224
  261. package/src/components/EmptyState.tsx +0 -97
  262. package/src/components/EndOfListFooter.tsx +0 -100
  263. package/src/components/ErrorBoundary.tsx +0 -688
  264. package/src/components/HeadersSection.tsx +0 -172
  265. package/src/components/HighlightText.tsx +0 -100
  266. package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
  267. package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
  268. package/src/components/Inspector/BundleTab.tsx +0 -4768
  269. package/src/components/Inspector/ConsoleTab.tsx +0 -726
  270. package/src/components/Inspector/CrashDetail.tsx +0 -997
  271. package/src/components/Inspector/CrashFilterModal.tsx +0 -721
  272. package/src/components/Inspector/CrashTab.tsx +0 -933
  273. package/src/components/Inspector/DebuggingTab.tsx +0 -1103
  274. package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
  275. package/src/components/Inspector/FabLauncher.tsx +0 -590
  276. package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
  277. package/src/components/Inspector/FeedbackModal.tsx +0 -626
  278. package/src/components/Inspector/InspectorContext.tsx +0 -28
  279. package/src/components/Inspector/InspectorHeader.tsx +0 -1583
  280. package/src/components/Inspector/LogDetail.tsx +0 -1431
  281. package/src/components/Inspector/MainScreen.tsx +0 -460
  282. package/src/components/Inspector/MediaGalleryTab.tsx +0 -829
  283. package/src/components/Inspector/MediaPreviewModal.tsx +0 -783
  284. package/src/components/Inspector/NavigationTracker.tsx +0 -13
  285. package/src/components/Inspector/NetworkDetail.tsx +0 -778
  286. package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
  287. package/src/components/Inspector/NetworkTab.tsx +0 -820
  288. package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
  289. package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
  290. package/src/components/Inspector/PerformanceTab.tsx +0 -1967
  291. package/src/components/Inspector/ReduxDetail.tsx +0 -1651
  292. package/src/components/Inspector/ReduxTab.tsx +0 -987
  293. package/src/components/Inspector/SettingsPanel.tsx +0 -5136
  294. package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
  295. package/src/components/Inspector/StorageTab.tsx +0 -1159
  296. package/src/components/Inspector/TabBar.tsx +0 -431
  297. package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
  298. package/src/components/JsonViewer.tsx +0 -549
  299. package/src/components/LogCard.tsx +0 -694
  300. package/src/components/LogSyntaxHighlighter.tsx +0 -178
  301. package/src/components/MetaAccordion.tsx +0 -355
  302. package/src/components/MiniBarChart.tsx +0 -42
  303. package/src/components/MiniLineChart.tsx +0 -33
  304. package/src/components/NetworkIcons.tsx +0 -2655
  305. package/src/components/QRCodeView.tsx +0 -75
  306. package/src/components/SectionHeader.tsx +0 -101
  307. package/src/components/SegmentedTabs.tsx +0 -84
  308. package/src/components/SkeletonPlaceholder.tsx +0 -206
  309. package/src/components/Slider.tsx +0 -300
  310. package/src/components/SourcePageCard.tsx +0 -150
  311. package/src/components/Toast.tsx +0 -131
  312. package/src/components/TouchableScale.tsx +0 -61
  313. package/src/components/TreeNode.tsx +0 -171
  314. package/src/console.ts +0 -24
  315. package/src/constants/index.ts +0 -41
  316. package/src/constants/telemetryConfig.ts +0 -4
  317. package/src/constants/version.ts +0 -3
  318. package/src/crash.ts +0 -32
  319. package/src/customHooks/analyticsLogger.ts +0 -336
  320. package/src/customHooks/bundleAnalyzer.ts +0 -1256
  321. package/src/customHooks/consoleLogger.ts +0 -530
  322. package/src/customHooks/crashHandler.ts +0 -944
  323. package/src/customHooks/logFilters.ts +0 -32
  324. package/src/customHooks/networkLogger.ts +0 -624
  325. package/src/customHooks/performanceTracker.ts +0 -1014
  326. package/src/customHooks/reduxLogger.ts +0 -406
  327. package/src/customHooks/storageInspector.ts +0 -513
  328. package/src/customHooks/useAccordion.tsx +0 -27
  329. package/src/decorators/index.ts +0 -184
  330. package/src/helpers/gaAnalyticsRegistry.ts +0 -204
  331. package/src/helpers/index.ts +0 -1092
  332. package/src/helpers/memoryManager.ts +0 -138
  333. package/src/helpers/qrGenerator.ts +0 -430
  334. package/src/helpers/remoteConfig.ts +0 -212
  335. package/src/helpers/searchQueryParser.ts +0 -84
  336. package/src/helpers/settingsStore.ts +0 -171
  337. package/src/helpers/telemetry.ts +0 -568
  338. package/src/helpers/toast.ts +0 -17
  339. package/src/i18n/index.ts +0 -104
  340. package/src/i18n/locales/en.json +0 -1141
  341. package/src/index.tsx +0 -2650
  342. package/src/metro.ts +0 -598
  343. package/src/network.ts +0 -22
  344. package/src/performance.ts +0 -38
  345. package/src/redux.ts +0 -23
  346. package/src/storage.ts +0 -18
  347. package/src/styles/AppColors.ts +0 -455
  348. package/src/styles/AppFonts.ts +0 -26
  349. package/src/styles/common.ts +0 -209
  350. package/src/styles/index.ts +0 -1606
  351. package/src/types/enums.ts +0 -210
  352. package/src/types/index.ts +0 -34
  353. package/src/types/interfaces.ts +0 -535
@@ -1,861 +1,8 @@
1
- import { Platform, ToastAndroid, Alert, NativeModules, Linking, } from 'react-native';
2
- import Clipboard from '@react-native-clipboard/clipboard';
3
- import { showToast } from './toast';
4
- import { AppColors } from '../styles/AppColors';
5
- import { DOMAIN_COLORS, DURATION_FAST_MS, DURATION_SLOW_MS } from '../constants';
6
- export * from './searchQueryParser';
7
- export * from './memoryManager';
8
- export * from './toast';
9
- export const isLocalDebugEnvironment = () => {
10
- const isDev = typeof __DEV__ !== 'undefined' && Boolean(__DEV__);
11
- const scriptURL = NativeModules.SourceCode?.scriptURL || '';
12
- const hasDevServer = scriptURL.startsWith('http://') ||
13
- scriptURL.startsWith('https://') ||
14
- scriptURL.includes(':8081') ||
15
- scriptURL.includes(':8082');
16
- return isDev || hasDevServer;
17
- };
18
- export const getDomainColor = (domain) => {
19
- if (!domain)
20
- return DOMAIN_COLORS[0];
21
- let hash = 0;
22
- for (let i = 0; i < domain.length; i++) {
23
- hash = domain.charCodeAt(i) + ((hash << 5) - hash);
24
- }
25
- return DOMAIN_COLORS[Math.abs(hash) % DOMAIN_COLORS.length];
26
- };
27
- export const formatDateTime = (timestamp) => {
28
- const date = new Date(timestamp);
29
- const pad = (n, len = 2) => String(n).padStart(len, '0');
30
- const day = pad(date.getDate());
31
- const month = pad(date.getMonth() + 1);
32
- const year = date.getFullYear();
33
- const hours = pad(date.getHours());
34
- const minutes = pad(date.getMinutes());
35
- const seconds = pad(date.getSeconds());
36
- return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
37
- };
38
- export const formatTimestamp = (timestamp) => {
39
- try {
40
- const date = new Date(timestamp);
41
- const hours = date.getHours().toString().padStart(2, '0');
42
- const minutes = date.getMinutes().toString().padStart(2, '0');
43
- const seconds = date.getSeconds().toString().padStart(2, '0');
44
- const ms = date.getMilliseconds().toString().padStart(3, '0');
45
- return `${hours}:${minutes}:${seconds}.${ms}`;
46
- }
47
- catch {
48
- return '—';
49
- }
50
- };
51
- export const getStatusColor = (status) => {
52
- if (!status || status === 0)
53
- return AppColors.errorColor;
54
- if (status >= 500)
55
- return AppColors.errorColor;
56
- if (status >= 400)
57
- return AppColors.darkOrange;
58
- if (status >= 300)
59
- return AppColors.warningIconGold;
60
- return AppColors.greenColor;
61
- };
62
- export const getDurationColor = (duration) => {
63
- if (duration == null)
64
- return AppColors.grayTextWeak;
65
- if (duration < DURATION_FAST_MS)
66
- return AppColors.greenColor;
67
- if (duration < DURATION_SLOW_MS)
68
- return AppColors.lightOrange;
69
- return AppColors.errorColor;
70
- };
71
- export const getSize = (data) => {
72
- try {
73
- const bytes = JSON.stringify(data)?.length ?? 0;
74
- return bytes < 1024 ? `${bytes} B` : `${(bytes / 1024).toFixed(1)} KB`;
75
- }
76
- catch {
77
- return '—';
78
- }
79
- };
80
- export const formatBytes = (bytes) => {
81
- if (bytes === 0 || !bytes || isNaN(bytes))
82
- return '0 B';
83
- const k = 1024;
84
- const sizes = ['B', 'KB', 'MB', 'GB'];
85
- const i = Math.floor(Math.log(bytes) / Math.log(k));
86
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i] || 'B'}`;
87
- };
88
- export const copyToClipboard = (value, label) => {
89
- const resolved = typeof value === 'function' ? value() : value;
90
- let textToCopy = '';
91
- if (typeof resolved === 'string') {
92
- textToCopy = resolved;
93
- }
94
- else {
95
- try {
96
- textToCopy = JSON.stringify(resolved, null, 2);
97
- }
98
- catch {
99
- textToCopy = String(resolved);
100
- }
101
- }
102
- try {
103
- if (typeof Clipboard?.setString === 'function') {
104
- Clipboard.setString(textToCopy);
105
- }
106
- else if (typeof Clipboard?.default?.setString === 'function') {
107
- Clipboard.default.setString(textToCopy);
108
- }
109
- }
110
- catch (err) {
111
- if (__DEV__) {
112
- console.warn('[NetworkInspector] Clipboard.setString failed:', err);
113
- }
114
- }
115
- try {
116
- showToast(label ? `${label} copied to clipboard` : 'Copied to clipboard');
117
- }
118
- catch { }
119
- try {
120
- if (Platform.OS === 'android' && ToastAndroid?.show) {
121
- ToastAndroid.show(label ? `${label} copied to clipboard` : 'Copied to clipboard', ToastAndroid.SHORT);
122
- }
123
- }
124
- catch { }
125
- };
126
- export const getPath = (url) => {
127
- try {
128
- const u = new URL(url);
129
- return u.pathname + (u.search ? u.search : '');
130
- }
131
- catch {
132
- const withoutDomain = url.replace(/^https?:\/\/[^/?#]+/, '');
133
- return withoutDomain || '/';
134
- }
135
- };
136
- export const getBaseUrl = (url) => {
137
- try {
138
- const u = new URL(url);
139
- return `${u.protocol}//${u.host}`;
140
- }
141
- catch {
142
- const match = url.match(/^(https?:\/\/[^/]+)/);
143
- return match ? match[1] : '';
144
- }
145
- };
146
- export const getCurlCommand = (log) => {
147
- let cmd = `curl -X ${log.method} "${log.url}"`;
148
- if (log.requestHeaders) {
149
- Object.entries(log.requestHeaders).forEach(([k, v]) => {
150
- cmd += ` \\\n -H "${k}: ${v}"`;
151
- });
152
- }
153
- if (log.request && log.method !== 'GET') {
154
- const body = typeof log.request === 'string'
155
- ? log.request
156
- : JSON.stringify(log.request);
157
- cmd += ` \\\n -d '${body.replace(/'/g, "'\\''")}'`;
158
- }
159
- return cmd;
160
- };
161
- export const getFetchCommand = (log) => {
162
- const opts = { method: log.method };
163
- if (log.requestHeaders && Object.keys(log.requestHeaders).length > 0) {
164
- opts.headers = log.requestHeaders;
165
- }
166
- if (log.request && log.method !== 'GET') {
167
- opts.body = JSON.stringify(log.request);
168
- }
169
- return `fetch("${log.url}", ${JSON.stringify(opts, null, 2)})`;
170
- };
171
- export const deduplicateLogs = (raw) => {
172
- const map = new Map();
173
- raw.forEach(entry => {
174
- if (!map.has(entry.id)) {
175
- map.set(entry.id, entry);
176
- }
177
- else {
178
- const existing = map.get(entry.id);
179
- if (existing.status == null && entry.status != null) {
180
- map.set(entry.id, entry);
181
- }
182
- else if ((entry.startTime ?? 0) >= (existing.startTime ?? 0)) {
183
- map.set(entry.id, entry);
184
- }
185
- }
186
- });
187
- return Array.from(map.values()).sort((a, b) => b.id - a.id);
188
- };
189
- export const escapeRegex = (str) => {
190
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
191
- };
192
- export const getNavigationInfo = (state, path = []) => {
193
- if (!state) {
194
- return {
195
- path: path.length > 0 ? path.join(' ➔ ') : '',
196
- params: null,
197
- };
198
- }
199
- if (state.name && !state.routes) {
200
- const fullPath = path.length > 0 ? [...path, state.name].join(' ➔ ') : state.name;
201
- return { path: fullPath, params: state.params || null };
202
- }
203
- if (!state.routes ||
204
- !Array.isArray(state.routes) ||
205
- state.routes.length === 0) {
206
- return {
207
- path: path.length > 0 ? path.join(' ➔ ') : '',
208
- params: null,
209
- };
210
- }
211
- const index = typeof state.index === 'number' &&
212
- state.index >= 0 &&
213
- state.index < state.routes.length
214
- ? state.index
215
- : 0;
216
- const route = state.routes[index];
217
- if (!route) {
218
- return {
219
- path: path.length > 0 ? path.join(' ➔ ') : '',
220
- params: null,
221
- };
222
- }
223
- const currentPath = route.name ? [...path, route.name] : path;
224
- if (route?.state) {
225
- return getNavigationInfo(route.state, currentPath);
226
- }
227
- const resolved = currentPath.length > 0 ? currentPath.join(' ➔ ') : route.name || '';
228
- return { path: resolved, params: route.params || null };
229
- };
230
- export const getLogPageName = (log, routeInfo) => {
231
- const effectiveRoute = routeInfo || log?.routeInfo;
232
- if (effectiveRoute &&
233
- effectiveRoute.path &&
234
- effectiveRoute.path !== 'Navigators') {
235
- const parts = effectiveRoute.path
236
- .split(' ➔ ')
237
- .map((s) => s.trim())
238
- .filter(Boolean);
239
- if (parts.length > 0) {
240
- return parts[parts.length - 1];
241
- }
242
- return effectiveRoute.path;
243
- }
244
- if (log.caller && log.caller !== 'Unknown') {
245
- try {
246
- const match = log.caller.match(/([^/\\]+)\.(tsx|jsx|ts|js)/i);
247
- if (match && match[1]) {
248
- const file = match[1];
249
- const ignored = [
250
- 'networklogger',
251
- 'fetch',
252
- 'axios',
253
- 'apiclient',
254
- 'request',
255
- 'http',
256
- 'index',
257
- 'nativeinspector',
258
- 'inappinspector',
259
- 'bundleanalyzer',
260
- ];
261
- if (!ignored.includes(file.toLowerCase())) {
262
- return file;
263
- }
264
- }
265
- }
266
- catch (e) { }
267
- }
268
- if (log.url) {
269
- try {
270
- const cleanUrl = log.url.split('?')[0].split('#')[0];
271
- const withoutProto = cleanUrl.replace(/^https?:\/\//i, '');
272
- const slashIdx = withoutProto.indexOf('/');
273
- if (slashIdx !== -1) {
274
- const pathSegments = withoutProto
275
- .substring(slashIdx + 1)
276
- .split('/')
277
- .filter(Boolean);
278
- const ignoredSegments = [
279
- 'api',
280
- 'v1',
281
- 'v2',
282
- 'v3',
283
- 'v4',
284
- 'rest',
285
- 'graphql',
286
- 'json',
287
- 'data',
288
- 'service',
289
- 'app',
290
- ];
291
- const meaningful = pathSegments.filter(s => !ignoredSegments.includes(s.toLowerCase()));
292
- if (meaningful.length > 0) {
293
- const seg = meaningful[0];
294
- return seg.charAt(0).toUpperCase() + seg.slice(1);
295
- }
296
- }
297
- const host = withoutProto.split('/')[0];
298
- if (host)
299
- return host;
300
- }
301
- catch (e) { }
302
- }
303
- return 'General';
304
- };
305
- export const flattenObject = (obj, prefix = '') => {
306
- let result = {};
307
- if (typeof obj === 'object' && obj !== null) {
308
- if (Array.isArray(obj)) {
309
- obj.forEach((v, i) => {
310
- Object.assign(result, flattenObject(v, prefix ? `${prefix}[${i}]` : `[${i}]`));
311
- });
312
- }
313
- else {
314
- Object.keys(obj).forEach(k => {
315
- Object.assign(result, flattenObject(obj[k], prefix ? `${prefix}.${k}` : k));
316
- });
317
- }
318
- }
319
- else {
320
- result[prefix || 'root'] = obj;
321
- }
322
- return result;
323
- };
324
- export const getDiff = (oldObj, newObj) => {
325
- const oldFlat = flattenObject(oldObj);
326
- const newFlat = flattenObject(newObj);
327
- const diff = [];
328
- const allKeys = new Set([...Object.keys(oldFlat), ...Object.keys(newFlat)]);
329
- allKeys.forEach(k => {
330
- if (!(k in oldFlat)) {
331
- diff.push({ type: 'added', path: k, newVal: newFlat[k] });
332
- }
333
- else if (!(k in newFlat)) {
334
- diff.push({ type: 'removed', path: k, oldVal: oldFlat[k] });
335
- }
336
- else if (oldFlat[k] !== newFlat[k]) {
337
- diff.push({
338
- type: 'changed',
339
- path: k,
340
- oldVal: oldFlat[k],
341
- newVal: newFlat[k],
342
- });
343
- }
344
- });
345
- return diff.sort((a, b) => a.path.localeCompare(b.path));
346
- };
347
- export const formatDisplayUrl = (url) => {
348
- if (!url)
349
- return '';
350
- if (url.startsWith('http://') || url.startsWith('https://'))
351
- return url;
352
- return `https://${url}`;
353
- };
354
- export const getLocalizedFilePath = (path, country, language) => {
355
- const url = path.replace('country-language', `${country?.toLowerCase()}-${language?.toLowerCase()}`);
356
- return url;
357
- };
358
- export const getLocalizedFilePathWithSlash = (path, country, language) => {
359
- const url = path.replace('country/language', `${country?.toLowerCase()}/${language?.toLowerCase()}`);
360
- return url;
361
- };
362
- export const isAllValuesEmpty = (obj) => {
363
- if (!obj || typeof obj !== 'object')
364
- return true;
365
- return Object.values(obj).every(value => value &&
366
- typeof value === 'object' &&
367
- !Array.isArray(value) &&
368
- Object.keys(value).length === 0);
369
- };
370
- export const formatDateTimeToAnalytics = (ts) => {
371
- const d = new Date(ts);
372
- return d?.toLocaleString(undefined, {
373
- month: 'short',
374
- day: 'numeric',
375
- hour: '2-digit',
376
- minute: '2-digit',
377
- second: '2-digit',
378
- });
379
- };
380
- export const getBundleIdentifier = () => {
381
- const RNDeviceInfo = NativeModules.RNDeviceInfo;
382
- if (RNDeviceInfo && typeof RNDeviceInfo.bundleId === 'string') {
383
- return RNDeviceInfo.bundleId;
384
- }
385
- if (RNDeviceInfo && typeof RNDeviceInfo.getBundleId === 'function') {
386
- try {
387
- const res = RNDeviceInfo.getBundleId();
388
- if (typeof res === 'string')
389
- return res;
390
- }
391
- catch (e) { }
392
- }
393
- const ExponentConstants = NativeModules.ExponentConstants;
394
- if (ExponentConstants && ExponentConstants.manifest) {
395
- const manifest = ExponentConstants.manifest;
396
- if (manifest.ios && manifest.ios.bundleIdentifier) {
397
- return manifest.ios.bundleIdentifier;
398
- }
399
- if (manifest.android && manifest.android.package) {
400
- return manifest.android.package;
401
- }
402
- }
403
- const ExpoApplication = NativeModules.ExpoApplication;
404
- if (ExpoApplication && typeof ExpoApplication.applicationId === 'string') {
405
- return ExpoApplication.applicationId;
406
- }
407
- const SourceCode = NativeModules.SourceCode;
408
- if (SourceCode && typeof SourceCode.scriptURL === 'string') {
409
- const url = SourceCode.scriptURL;
410
- if (url.includes('assets/')) {
411
- try {
412
- const match = url.match(/assets\/([^/?#]+)/);
413
- if (match && match[1]) {
414
- return match[1];
415
- }
416
- }
417
- catch (e) { }
418
- }
419
- }
420
- return 'org.reactjs.native.example';
421
- };
422
- export const getAppName = () => {
423
- const constants = NativeModules.PlatformConstants;
424
- if (constants && typeof constants.interfaceIdiom === 'string') {
425
- }
426
- const RNDeviceInfo = NativeModules.RNDeviceInfo;
427
- if (RNDeviceInfo && typeof RNDeviceInfo.appName === 'string') {
428
- return RNDeviceInfo.appName;
429
- }
430
- const ExpoApplication = NativeModules.ExpoApplication;
431
- if (ExpoApplication && typeof ExpoApplication.applicationName === 'string') {
432
- return ExpoApplication.applicationName;
433
- }
434
- const ExponentConstants = NativeModules.ExponentConstants;
435
- if (ExponentConstants && ExponentConstants.manifest) {
436
- const manifest = ExponentConstants.manifest;
437
- if (manifest.name)
438
- return manifest.name;
439
- }
440
- const AppInfo = NativeModules.AppInfo;
441
- if (AppInfo && typeof AppInfo.appName === 'string') {
442
- return AppInfo.appName;
443
- }
444
- const bundleId = getBundleIdentifier();
445
- if (bundleId && bundleId !== 'org.reactjs.native.example') {
446
- const parts = bundleId.split('.');
447
- const last = parts[parts.length - 1];
448
- return last ? last.charAt(0).toUpperCase() + last.slice(1) : 'App';
449
- }
450
- return 'App';
451
- };
452
- export const getAppVersionAndBuild = () => {
453
- let version = '';
454
- let build = '';
455
- const ExpoApplication = NativeModules.ExpoApplication;
456
- if (ExpoApplication) {
457
- if (typeof ExpoApplication.nativeAppVersion === 'string') {
458
- version = ExpoApplication.nativeAppVersion;
459
- }
460
- if (typeof ExpoApplication.nativeBuildVersion === 'string') {
461
- build = ExpoApplication.nativeBuildVersion;
462
- }
463
- }
464
- const ExponentConstants = NativeModules.ExponentConstants;
465
- if (ExponentConstants) {
466
- const manifest = ExponentConstants.manifest || ExponentConstants.expoConfig;
467
- if (manifest) {
468
- if (!version && manifest.version) {
469
- version = String(manifest.version);
470
- }
471
- if (!build) {
472
- if (manifest.ios?.buildNumber) {
473
- build = String(manifest.ios.buildNumber);
474
- }
475
- else if (manifest.android?.versionCode) {
476
- build = String(manifest.android.versionCode);
477
- }
478
- }
479
- }
480
- }
481
- const RNDeviceInfo = NativeModules.RNDeviceInfo;
482
- if (RNDeviceInfo) {
483
- if (!version) {
484
- if (typeof RNDeviceInfo.appVersion === 'string') {
485
- version = RNDeviceInfo.appVersion;
486
- }
487
- else if (typeof RNDeviceInfo.getVersion === 'function') {
488
- try {
489
- version = RNDeviceInfo.getVersion();
490
- }
491
- catch (e) { }
492
- }
493
- }
494
- if (!build) {
495
- if (typeof RNDeviceInfo.buildNumber === 'string') {
496
- build = RNDeviceInfo.buildNumber;
497
- }
498
- else if (typeof RNDeviceInfo.getBuildNumber === 'function') {
499
- try {
500
- build = RNDeviceInfo.getBuildNumber();
501
- }
502
- catch (e) { }
503
- }
504
- }
505
- }
506
- const constants = Platform.constants || NativeModules.PlatformConstants;
507
- if (constants) {
508
- if (!version &&
509
- constants.Version &&
510
- typeof constants.Version === 'string' &&
511
- constants.Version.includes('.')) {
512
- version = constants.Version;
513
- }
514
- if (!version && constants.reactNativeVersion) {
515
- const rnv = constants.reactNativeVersion;
516
- if (rnv.major !== undefined) {
517
- version = `${rnv.major}.${rnv.minor}.${rnv.patch}`;
518
- }
519
- }
520
- }
521
- const AppInfo = NativeModules.AppInfo;
522
- if (AppInfo) {
523
- if (!version && typeof AppInfo.versionName === 'string') {
524
- version = AppInfo.versionName;
525
- }
526
- if (!build && typeof AppInfo.versionCode === 'string') {
527
- build = AppInfo.versionCode;
528
- }
529
- }
530
- if (!version)
531
- version = '1.0.0';
532
- if (!build)
533
- build = '1';
534
- return {
535
- version,
536
- build,
537
- formatted: `${version} (${build})`,
538
- };
539
- };
540
- export const handleOpenExternalLink = (url) => {
541
- if (!url)
542
- return;
543
- const openUrl = formatDisplayUrl(url);
544
- Alert.alert('Open Link', `Do you want to open this link in your web browser?\n\n${openUrl}`, [
545
- { text: 'Cancel', style: 'cancel' },
546
- {
547
- text: 'Open',
548
- onPress: () => {
549
- Linking.openURL(openUrl).catch(() => { });
550
- },
551
- },
552
- ]);
553
- };
554
- export const formatTimeShort = (ts) => {
555
- const d = new Date(ts);
556
- const hh = String(d.getHours()).padStart(2, '0');
557
- const mm = String(d.getMinutes()).padStart(2, '0');
558
- const ss = String(d.getSeconds()).padStart(2, '0');
559
- return `${hh}:${mm}:${ss}`;
560
- };
561
- export const formatTime = (ts) => {
562
- const d = new Date(ts);
563
- const hh = String(d.getHours()).padStart(2, '0');
564
- const mm = String(d.getMinutes()).padStart(2, '0');
565
- const ss = String(d.getSeconds()).padStart(2, '0');
566
- const ms = String(d.getMilliseconds()).padStart(3, '0');
567
- return `${hh}:${mm}:${ss}.${ms}`;
568
- };
569
- export const formatGap = (ms) => {
570
- if (ms < 1000)
571
- return `+${ms}ms`;
572
- const s = Math.round(ms / 1000);
573
- if (s < 60)
574
- return `+${s}s`;
575
- const m = Math.floor(s / 60);
576
- const rem = s % 60;
577
- return rem > 0 ? `+${m}m ${rem}s` : `+${m}m`;
578
- };
579
- export const getJsonContent = (message) => {
580
- if (!message)
581
- return null;
582
- const indices = [];
583
- for (let i = 0; i < message.length; i++) {
584
- if (message[i] === '{' || message[i] === '[') {
585
- indices.push(i);
586
- }
587
- }
588
- for (const index of indices) {
589
- const candidate = message.substring(index).trim();
590
- try {
591
- const parsed = JSON.parse(candidate);
592
- if (parsed !== null && typeof parsed === 'object') {
593
- const header = message.substring(0, index).trim();
594
- return { header, data: parsed };
595
- }
596
- }
597
- catch (e) {
598
- }
599
- }
600
- return null;
601
- };
602
- export const getJsonPreviewText = (data, maxLines = 4) => {
603
- try {
604
- const formatted = JSON.stringify(data, null, 2);
605
- const lines = formatted.split('\n');
606
- if (lines.length > maxLines) {
607
- return {
608
- text: lines.slice(0, maxLines).join('\n') + '\n...',
609
- hasMore: true,
610
- };
611
- }
612
- return {
613
- text: formatted,
614
- hasMore: false,
615
- };
616
- }
617
- catch (e) {
618
- return {
619
- text: String(data),
620
- hasMore: false,
621
- };
622
- }
623
- };
624
- export const parseStackLine = (rawLine, isOrigin = false) => {
625
- let line = rawLine.trim().replace(/^at /, '');
626
- if (line.includes('@')) {
627
- const atIndex = line.indexOf('@');
628
- const funcPart = line.substring(0, atIndex).trim();
629
- const pathPart = line.substring(atIndex + 1).trim();
630
- line = funcPart ? `${funcPart} (${pathPart})` : pathPart;
631
- }
632
- const parenMatch = line.match(/^(.*?)\s*\((.*?)\)$/);
633
- let functionName = '<anonymous>';
634
- let locationPart = line;
635
- if (parenMatch) {
636
- functionName = parenMatch[1].trim() || '<anonymous>';
637
- locationPart = parenMatch[2].trim();
638
- }
639
- if (functionName.startsWith('?anon_') || functionName === '?') {
640
- functionName = 'anonymous';
641
- }
642
- locationPart = locationPart.replace(/^address at /, '');
643
- const locMatch = locationPart.match(/^(.*?):(\d+):(\d+)$/);
644
- let fullPath = locationPart;
645
- let lineNumber;
646
- let columnNumber;
647
- if (locMatch) {
648
- fullPath = locMatch[1];
649
- lineNumber = locMatch[2];
650
- columnNumber = locMatch[3];
651
- }
652
- let cleanPath = fullPath
653
- .split('?')[0]
654
- .split('&')[0]
655
- .replace(/[)]+$/, '')
656
- .replace(/\/\/+$/, '');
657
- cleanPath = cleanPath.replace(/^(?:https?:\/\/[^\/]+\/|file:\/\/\/|webpack:\/\/\/?)/, '');
658
- const fileName = cleanPath.split('/').filter(Boolean).pop() || cleanPath;
659
- const extMatch = fileName.match(/\.([a-z0-9]+)$/i);
660
- const ext = extMatch ? extMatch[1].toLowerCase() : '';
661
- const fileExt = ext === 'tsx' || ext === 'jsx' || ext === 'ts' || ext === 'js'
662
- ? ext
663
- : 'other';
664
- const isNative = locationPart === 'native' || cleanPath === 'native';
665
- const isInternalBytecode = cleanPath.includes('InternalBytecode') ||
666
- cleanPath.includes('metro-runtime') ||
667
- cleanPath.includes('regenerator-runtime') ||
668
- functionName === 'tryCallOne' ||
669
- functionName === 'asyncGeneratorStep' ||
670
- functionName === '_next' ||
671
- (functionName === 'next' && isNative);
672
- const isDependency = cleanPath.includes('node_modules') ||
673
- cleanPath.includes('react-native/Libraries') ||
674
- (cleanPath.includes('react-native-inapp-inspector') &&
675
- !cleanPath.includes('/example/'));
676
- const isUserCode = !isNative &&
677
- !isInternalBytecode &&
678
- !isDependency &&
679
- (fileExt === 'tsx' ||
680
- fileExt === 'jsx' ||
681
- fileExt === 'ts' ||
682
- fileExt === 'js' ||
683
- !fileName.includes('.bundle'));
684
- const frameType = isUserCode
685
- ? 'app'
686
- : isDependency
687
- ? 'dependency'
688
- : isNative
689
- ? 'native'
690
- : 'runtime';
691
- const isRuntimeNoise = isInternalBytecode ||
692
- isNative ||
693
- functionName === 'asyncGeneratorStep' ||
694
- functionName === '_next';
695
- let relativePath = cleanPath;
696
- if (relativePath.includes('/example/')) {
697
- relativePath = relativePath.substring(relativePath.indexOf('/example/') + 9);
698
- }
699
- else if (relativePath.includes('/src/')) {
700
- relativePath = relativePath.substring(relativePath.indexOf('/src/') + 1);
701
- }
702
- else if (relativePath.includes('/node_modules/')) {
703
- relativePath = relativePath.substring(relativePath.indexOf('/node_modules/') + 14);
704
- }
705
- const copyableLocation = lineNumber
706
- ? `${fileName}:${lineNumber}${columnNumber ? `:${columnNumber}` : ''}`
707
- : fileName;
708
- return {
709
- raw: rawLine,
710
- functionName,
711
- fileName,
712
- fullPath: relativePath,
713
- rawFilePath: fullPath,
714
- fileExt,
715
- frameType,
716
- isUserCode,
717
- isRuntimeNoise,
718
- lineNumber,
719
- columnNumber,
720
- isOrigin,
721
- copyableLocation,
722
- };
723
- };
724
- export const openInVSCode = (filePath, lineNumber, columnNumber) => {
725
- const numLine = lineNumber ? Number(lineNumber) : 1;
726
- const numCol = columnNumber ? Number(columnNumber) : 1;
727
- const line = lineNumber ? `:${lineNumber}` : '';
728
- const col = columnNumber ? `:${columnNumber}` : '';
729
- const cleanPath = filePath.replace(/^file:\/\//, '');
730
- let extractedOrigin = null;
731
- try {
732
- const scriptURL = NativeModules?.SourceCode?.scriptURL ||
733
- NativeModules?.PlatformConstants?.serverHost ||
734
- NativeModules?.DevSettings?.serverHost;
735
- if (typeof scriptURL === 'string' && scriptURL.length > 0) {
736
- const match = scriptURL.match(/^(https?:\/\/[^/]+)/);
737
- if (match) {
738
- extractedOrigin = match[1];
739
- }
740
- else if (!scriptURL.startsWith('http') && scriptURL.includes(':')) {
741
- extractedOrigin = `http://${scriptURL}`;
742
- }
743
- }
744
- }
745
- catch { }
746
- const metroHosts = Array.from(new Set([
747
- ...(extractedOrigin ? [extractedOrigin] : []),
748
- 'http://localhost:8081',
749
- 'http://127.0.0.1:8081',
750
- 'http://10.0.2.2:8081',
751
- ]));
752
- metroHosts.forEach(host => {
753
- try {
754
- fetch(`${host}/open-stack-frame`, {
755
- method: 'POST',
756
- headers: { 'Content-Type': 'application/json' },
757
- body: JSON.stringify({
758
- file: cleanPath,
759
- lineNumber: numLine,
760
- column: numCol,
761
- }),
762
- }).catch(() => { });
763
- }
764
- catch { }
765
- });
766
- const vscodeUrl = `vscode://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
767
- const cursorUrl = `cursor://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
768
- const vscodeInsidersUrl = `vscode-insiders://file/${cleanPath.replace(/^\/+/, '')}${line}${col}`;
769
- Linking.openURL(vscodeUrl).catch(() => {
770
- Linking.openURL(cursorUrl).catch(() => {
771
- Linking.openURL(vscodeInsidersUrl).catch(() => {
772
- copyToClipboard(`${cleanPath}${line}${col}`, 'Location');
773
- });
774
- });
775
- });
776
- };
777
- export const ANALYTICS_EVENT_PALETTE = [
778
- AppColors.googleBlue,
779
- AppColors.googleGreen,
780
- AppColors.googlePurple,
781
- AppColors.googleTeal,
782
- AppColors.googleRed,
783
- AppColors.googleOrange,
784
- AppColors.blue700,
785
- AppColors.materialGreen,
786
- ];
787
- export const getEventColor = (name) => {
788
- const safeName = typeof name === 'string' ? name : String(name || '');
789
- let hash = 0;
790
- for (let i = 0; i < safeName.length; i++) {
791
- hash = (hash * 31 + safeName.charCodeAt(i)) | 0;
792
- }
793
- return ANALYTICS_EVENT_PALETTE[Math.abs(hash) % ANALYTICS_EVENT_PALETTE.length];
794
- };
795
- export { getEventCategory, registerGAPlugin, } from './gaAnalyticsRegistry';
796
- export const getCategoryColors = (category) => {
797
- switch (category) {
798
- case 'page_view':
799
- case 'Page View':
800
- return {
801
- bg: AppColors.blueBg,
802
- border: AppColors.blueBorder,
803
- text: AppColors.blue800,
804
- };
805
- case 'ecommerce':
806
- case 'Ecommerce':
807
- return {
808
- bg: AppColors.greenBg,
809
- border: AppColors.greenBorder,
810
- text: AppColors.materialGreen,
811
- };
812
- case 'system':
813
- case 'System':
814
- return {
815
- bg: AppColors.greyBg,
816
- border: AppColors.greyBorder,
817
- text: AppColors.grey600,
818
- };
819
- default:
820
- return {
821
- bg: AppColors.purpleBg,
822
- border: AppColors.purpleBorder,
823
- text: AppColors.purpleText,
824
- };
825
- }
826
- };
827
- export const getRuntimeDiagnostics = () => {
828
- const isHermes = typeof global.HermesInternal !== 'undefined';
829
- const isV8 = typeof global._v8runtime !== 'undefined';
830
- const engineType = isHermes
831
- ? 'hermes'
832
- : isV8
833
- ? 'v8'
834
- : 'jsc';
835
- const isFabric = typeof global.nativeFabricUIManager !== 'undefined' ||
836
- Boolean(global.__turboModuleProxy);
837
- const archType = isFabric ? 'fabric' : 'paper';
838
- let usedHeapMb = 32.4;
839
- let totalAllocMb = 64.0;
840
- try {
841
- const hermesStats = global.HermesInternal?.getInstrumentedStats?.();
842
- if (hermesStats?.js_heap_size) {
843
- usedHeapMb = Number((hermesStats.js_heap_size / (1024 * 1024)).toFixed(1));
844
- totalAllocMb = Number(((hermesStats.js_allocated_bytes || hermesStats.js_heap_size * 1.6) /
845
- (1024 * 1024)).toFixed(1));
846
- }
847
- else if (global.performance?.memory?.usedJSHeapSize) {
848
- usedHeapMb = Number((global.performance.memory.usedJSHeapSize /
849
- (1024 * 1024)).toFixed(1));
850
- totalAllocMb = Number((global.performance.memory.totalJSHeapSize /
851
- (1024 * 1024)).toFixed(1));
852
- }
853
- }
854
- catch { }
855
- return {
856
- engineType,
857
- archType,
858
- usedHeapMb,
859
- totalAllocMb,
860
- };
861
- };
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
+ -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=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
+
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
+ `);return r.length>e?{text:r.slice(0,e).join(`
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 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}};