react-native-inapp-inspector 2.5.12 → 2.5.13

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 (186) hide show
  1. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  2. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  3. package/android/.gradle/8.9/executionHistory/executionHistory.lock +0 -0
  4. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  5. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  6. package/android/.gradle/8.9/gc.properties +0 -0
  7. package/android/.gradle/9.2.0/checksums/checksums.lock +0 -0
  8. package/android/.gradle/9.2.0/fileChanges/last-build.bin +0 -0
  9. package/android/.gradle/9.2.0/fileHashes/fileHashes.bin +0 -0
  10. package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
  11. package/android/.gradle/9.2.0/gc.properties +0 -0
  12. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  13. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  14. package/android/.gradle/vcs-1/gc.properties +0 -0
  15. package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
  16. package/android/src/main/AndroidManifest.xml +11 -0
  17. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +379 -19
  18. package/android/src/main/res/xml/inappinspector_file_paths.xml +7 -0
  19. package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +47 -49
  20. package/dist/commonjs/components/Inspector/BoxModelVisualizer.d.ts +8 -0
  21. package/dist/commonjs/components/Inspector/BoxModelVisualizer.js +76 -0
  22. package/dist/commonjs/components/Inspector/ConsoleExportModal.js +51 -51
  23. package/dist/commonjs/components/Inspector/CrashTab.js +17 -17
  24. package/dist/commonjs/components/Inspector/DebuggingTab.js +24 -24
  25. package/dist/commonjs/components/Inspector/DeviceInfoTab.js +2 -2
  26. package/dist/commonjs/components/Inspector/FabLauncher.js +2 -2
  27. package/dist/commonjs/components/Inspector/FloatingCaptureWidget.js +2 -2
  28. package/dist/commonjs/components/Inspector/InspectorHeader.js +10 -10
  29. package/dist/commonjs/components/Inspector/MediaGalleryTab.js +10 -10
  30. package/dist/commonjs/components/Inspector/MediaPreviewModal.d.ts +1 -0
  31. package/dist/commonjs/components/Inspector/MediaPreviewModal.js +222 -222
  32. package/dist/commonjs/components/Inspector/NetworkExportModal.d.ts +10 -0
  33. package/dist/commonjs/components/Inspector/NetworkExportModal.js +333 -0
  34. package/dist/commonjs/components/Inspector/NetworkTab.js +48 -41
  35. package/dist/commonjs/components/Inspector/NpmStarPrompt.js +11 -12
  36. package/dist/commonjs/components/Inspector/ReduxDetail.js +17 -19
  37. package/dist/commonjs/components/Inspector/ReduxTab.js +5 -5
  38. package/dist/commonjs/components/Inspector/SettingsPanel.js +3 -6
  39. package/dist/commonjs/components/Inspector/SocketCard.js +2 -2
  40. package/dist/commonjs/components/Inspector/SupportPage.js +5 -5
  41. package/dist/commonjs/components/Inspector/UiA11yAuditPanel.d.ts +7 -0
  42. package/dist/commonjs/components/Inspector/UiA11yAuditPanel.js +97 -0
  43. package/dist/commonjs/components/Inspector/UiInspectorDetail.d.ts +2 -0
  44. package/dist/commonjs/components/Inspector/UiInspectorDetail.js +485 -0
  45. package/dist/commonjs/components/Inspector/UiInspectorOverlay.d.ts +2 -0
  46. package/dist/commonjs/components/Inspector/UiInspectorOverlay.js +199 -0
  47. package/dist/commonjs/components/Inspector/UiInspectorTab.d.ts +2 -0
  48. package/dist/commonjs/components/Inspector/UiInspectorTab.js +117 -0
  49. package/dist/commonjs/components/Inspector/UiLiveStyleTweaker.d.ts +10 -0
  50. package/dist/commonjs/components/Inspector/UiLiveStyleTweaker.js +148 -0
  51. package/dist/commonjs/components/Inspector/index.d.ts +28 -0
  52. package/dist/commonjs/components/Inspector/index.js +1 -0
  53. package/dist/commonjs/components/LogCard.js +9 -7
  54. package/dist/commonjs/constants/index.js +1 -1
  55. package/dist/commonjs/constants/telemetryConfig.d.ts +3 -3
  56. package/dist/commonjs/constants/telemetryConfig.js +1 -1
  57. package/dist/commonjs/constants/version.d.ts +1 -1
  58. package/dist/commonjs/constants/version.js +1 -1
  59. package/dist/commonjs/customHooks/crashHandler.d.ts +1 -1
  60. package/dist/commonjs/customHooks/crashHandler.js +6 -6
  61. package/dist/commonjs/customHooks/uiInspectorManager.d.ts +22 -0
  62. package/dist/commonjs/customHooks/uiInspectorManager.js +1 -0
  63. package/dist/commonjs/helpers/index.js +1 -3
  64. package/dist/commonjs/helpers/searchQueryParser.d.ts +1 -0
  65. package/dist/commonjs/helpers/searchQueryParser.js +7 -5
  66. package/dist/commonjs/helpers/shareFormatter.d.ts +16 -0
  67. package/dist/commonjs/helpers/shareFormatter.js +16 -9
  68. package/dist/commonjs/helpers/uiInspectorEngine.d.ts +62 -0
  69. package/dist/commonjs/helpers/uiInspectorEngine.js +19 -0
  70. package/dist/commonjs/i18n/locales/ar.json +1 -1
  71. package/dist/commonjs/i18n/locales/bn.json +1 -1
  72. package/dist/commonjs/i18n/locales/de.json +1 -1
  73. package/dist/commonjs/i18n/locales/en.json +1 -1
  74. package/dist/commonjs/i18n/locales/es.json +1 -1
  75. package/dist/commonjs/i18n/locales/fr.json +1 -1
  76. package/dist/commonjs/i18n/locales/gu.json +1 -1
  77. package/dist/commonjs/i18n/locales/hi.json +1 -1
  78. package/dist/commonjs/i18n/locales/id.json +1 -1
  79. package/dist/commonjs/i18n/locales/it.json +1 -1
  80. package/dist/commonjs/i18n/locales/ja.json +1 -1
  81. package/dist/commonjs/i18n/locales/kn.json +1 -1
  82. package/dist/commonjs/i18n/locales/ko.json +1 -1
  83. package/dist/commonjs/i18n/locales/ml.json +1 -1
  84. package/dist/commonjs/i18n/locales/mr.json +1 -1
  85. package/dist/commonjs/i18n/locales/nl.json +1 -1
  86. package/dist/commonjs/i18n/locales/pa.json +1 -1
  87. package/dist/commonjs/i18n/locales/pl.json +1 -1
  88. package/dist/commonjs/i18n/locales/pt.json +1 -1
  89. package/dist/commonjs/i18n/locales/ru.json +1 -1
  90. package/dist/commonjs/i18n/locales/ta.json +1 -1
  91. package/dist/commonjs/i18n/locales/te.json +1 -1
  92. package/dist/commonjs/i18n/locales/tr.json +1 -1
  93. package/dist/commonjs/i18n/locales/vi.json +1 -1
  94. package/dist/commonjs/i18n/locales/zh.json +1 -1
  95. package/dist/commonjs/index.d.ts +3 -1
  96. package/dist/commonjs/index.js +3 -3
  97. package/dist/commonjs/native/NativeInspector.d.ts +2 -0
  98. package/dist/commonjs/native/NativeInspector.js +1 -1
  99. package/dist/commonjs/native/NativeNetworkInspector.d.ts +2 -0
  100. package/dist/commonjs/types/editor.d.ts +31 -0
  101. package/dist/esm/components/Inspector/AnalyticsFilterModal.js +73 -75
  102. package/dist/esm/components/Inspector/BoxModelVisualizer.d.ts +8 -0
  103. package/dist/esm/components/Inspector/BoxModelVisualizer.js +76 -0
  104. package/dist/esm/components/Inspector/ConsoleExportModal.js +67 -67
  105. package/dist/esm/components/Inspector/CrashTab.js +58 -58
  106. package/dist/esm/components/Inspector/DebuggingTab.js +89 -89
  107. package/dist/esm/components/Inspector/DeviceInfoTab.js +2 -2
  108. package/dist/esm/components/Inspector/FabLauncher.js +21 -21
  109. package/dist/esm/components/Inspector/FloatingCaptureWidget.js +23 -23
  110. package/dist/esm/components/Inspector/InspectorHeader.js +26 -26
  111. package/dist/esm/components/Inspector/MediaGalleryTab.js +151 -151
  112. package/dist/esm/components/Inspector/MediaPreviewModal.d.ts +1 -0
  113. package/dist/esm/components/Inspector/MediaPreviewModal.js +468 -468
  114. package/dist/esm/components/Inspector/NetworkExportModal.d.ts +10 -0
  115. package/dist/esm/components/Inspector/NetworkExportModal.js +333 -0
  116. package/dist/esm/components/Inspector/NetworkTab.js +118 -111
  117. package/dist/esm/components/Inspector/NpmStarPrompt.js +32 -33
  118. package/dist/esm/components/Inspector/ReduxDetail.js +54 -56
  119. package/dist/esm/components/Inspector/ReduxTab.js +9 -9
  120. package/dist/esm/components/Inspector/SettingsPanel.js +3 -6
  121. package/dist/esm/components/Inspector/SocketCard.js +13 -13
  122. package/dist/esm/components/Inspector/SupportPage.js +5 -5
  123. package/dist/esm/components/Inspector/UiA11yAuditPanel.d.ts +7 -0
  124. package/dist/esm/components/Inspector/UiA11yAuditPanel.js +97 -0
  125. package/dist/esm/components/Inspector/UiInspectorDetail.d.ts +2 -0
  126. package/dist/esm/components/Inspector/UiInspectorDetail.js +422 -0
  127. package/dist/esm/components/Inspector/UiInspectorOverlay.d.ts +2 -0
  128. package/dist/esm/components/Inspector/UiInspectorOverlay.js +138 -0
  129. package/dist/esm/components/Inspector/UiInspectorTab.d.ts +2 -0
  130. package/dist/esm/components/Inspector/UiInspectorTab.js +117 -0
  131. package/dist/esm/components/Inspector/UiLiveStyleTweaker.d.ts +10 -0
  132. package/dist/esm/components/Inspector/UiLiveStyleTweaker.js +148 -0
  133. package/dist/esm/components/Inspector/index.d.ts +28 -0
  134. package/dist/esm/components/Inspector/index.js +1 -0
  135. package/dist/esm/components/LogCard.js +57 -55
  136. package/dist/esm/constants/index.js +1 -1
  137. package/dist/esm/constants/telemetryConfig.d.ts +3 -3
  138. package/dist/esm/constants/telemetryConfig.js +1 -1
  139. package/dist/esm/constants/version.d.ts +1 -1
  140. package/dist/esm/constants/version.js +1 -1
  141. package/dist/esm/customHooks/crashHandler.d.ts +1 -1
  142. package/dist/esm/customHooks/crashHandler.js +6 -6
  143. package/dist/esm/customHooks/uiInspectorManager.d.ts +22 -0
  144. package/dist/esm/customHooks/uiInspectorManager.js +1 -0
  145. package/dist/esm/helpers/index.js +4 -6
  146. package/dist/esm/helpers/searchQueryParser.d.ts +1 -0
  147. package/dist/esm/helpers/searchQueryParser.js +7 -5
  148. package/dist/esm/helpers/shareFormatter.d.ts +16 -0
  149. package/dist/esm/helpers/shareFormatter.js +20 -13
  150. package/dist/esm/helpers/uiInspectorEngine.d.ts +48 -0
  151. package/dist/esm/helpers/uiInspectorEngine.js +19 -0
  152. package/dist/esm/i18n/locales/ar.json +1 -1
  153. package/dist/esm/i18n/locales/bn.json +1 -1
  154. package/dist/esm/i18n/locales/de.json +1 -1
  155. package/dist/esm/i18n/locales/en.json +1 -1
  156. package/dist/esm/i18n/locales/es.json +1 -1
  157. package/dist/esm/i18n/locales/fr.json +1 -1
  158. package/dist/esm/i18n/locales/gu.json +1 -1
  159. package/dist/esm/i18n/locales/hi.json +1 -1
  160. package/dist/esm/i18n/locales/id.json +1 -1
  161. package/dist/esm/i18n/locales/it.json +1 -1
  162. package/dist/esm/i18n/locales/ja.json +1 -1
  163. package/dist/esm/i18n/locales/kn.json +1 -1
  164. package/dist/esm/i18n/locales/ko.json +1 -1
  165. package/dist/esm/i18n/locales/ml.json +1 -1
  166. package/dist/esm/i18n/locales/mr.json +1 -1
  167. package/dist/esm/i18n/locales/nl.json +1 -1
  168. package/dist/esm/i18n/locales/pa.json +1 -1
  169. package/dist/esm/i18n/locales/pl.json +1 -1
  170. package/dist/esm/i18n/locales/pt.json +1 -1
  171. package/dist/esm/i18n/locales/ru.json +1 -1
  172. package/dist/esm/i18n/locales/ta.json +1 -1
  173. package/dist/esm/i18n/locales/te.json +1 -1
  174. package/dist/esm/i18n/locales/tr.json +1 -1
  175. package/dist/esm/i18n/locales/vi.json +1 -1
  176. package/dist/esm/i18n/locales/zh.json +1 -1
  177. package/dist/esm/index.d.ts +3 -1
  178. package/dist/esm/index.js +7 -7
  179. package/dist/esm/native/NativeInspector.d.ts +2 -0
  180. package/dist/esm/native/NativeInspector.js +1 -1
  181. package/dist/esm/native/NativeNetworkInspector.d.ts +2 -0
  182. package/dist/esm/types/editor.d.ts +31 -0
  183. package/ios/NetworkInspectorModule.mm +314 -16
  184. package/package.json +1 -1
  185. package/src/native/NativeInspector.ts +37 -0
  186. package/src/native/NativeNetworkInspector.ts +2 -0
@@ -1,15 +1,22 @@
1
- import{Alert as b,Share as x}from"react-native";import{formatDateTime as c,getCurlCommand as P}from"./index";function r(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}export function formatApiReport(e){const n=(e.method||"GET").toUpperCase(),t=e.status===0?"Failed / Network Error":e.status!=null?`${e.status} ${e.status===200?"OK":""}`.trim():"Pending",i=e.duration!=null?`${e.duration}ms`:"N/A",o=c(e.startTime||Date.now()),s=P(e),a=["\u{1F680} API INSPECTION REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Method: ${n}`,`\u{1F4CA} Status: ${t}`,`\u23F1\uFE0F Duration: ${i}`,`\u{1F552} Time: ${o}`];return e.client&&a.push(`\u{1F50C} Client: ${e.client.toUpperCase()}`),a.push(`\u{1F310} URL: ${e.url||"N/A"}`),a.push(""),e.requestHeaders&&Object.keys(e.requestHeaders).length>0&&(a.push("\u{1F4CB} Request Headers:"),a.push(r(e.requestHeaders)),a.push("")),e.request!=null&&e.request!==""&&(a.push("\u{1F4DD} Request Body:"),a.push(r(e.request)),a.push("")),e.responseHeaders&&Object.keys(e.responseHeaders).length>0&&(a.push("\u{1F4D1} Response Headers:"),a.push(r(e.responseHeaders)),a.push("")),e.response!=null&&e.response!==""&&(a.push("\u{1F4E5} Response Data:"),a.push(r(e.response)),a.push("")),s&&(a.push("\u{1F4BB} cURL Command:"),a.push(s),a.push("")),a.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),a.push("Generated by React Native InApp Inspector"),a.join(`
2
- `)}export function formatPushReport(e){const n=c(e.timestamp||Date.now()),t=(e.source||"push").toUpperCase(),i=(e.appState||"unknown").toUpperCase(),o=(e.action||"received").toUpperCase(),s=["\u{1F514} PUSH NOTIFICATION REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Title: ${e.title||"(No Title)"}`,`\u{1F4DD} Body: ${e.body||"(No Body)"}`,`\u{1F3E2} Source: ${t}${e.domain?` (${e.domain})`:""}`,`\u{1F194} Message ID: ${e.id||"N/A"}`,`\u{1F4F1} App State: ${i}`,`\u{1F3AF} Action: ${o}`,`\u{1F552} Time: ${n}`];return e.subtitle&&s.push(`\u{1F4D1} Subtitle: ${e.subtitle}`),e.channelId&&s.push(`\u{1F3F7}\uFE0F Channel: ${e.channelId}`),e.priority&&s.push(`\u26A1 Priority: ${e.priority}`),e.badge!=null&&s.push(`\u{1F522} Badge: ${e.badge}`),e.sound&&s.push(`\u{1F50A} Sound: ${e.sound}`),e.imageUrl&&s.push(`\u{1F5BC}\uFE0F Image: ${e.imageUrl}`),s.push(""),e.data&&Object.keys(e.data).length>0&&(s.push("\u{1F4E6} Custom Data Payload:"),s.push(r(e.data)),s.push("")),e.customDomainAttributes&&Object.keys(e.customDomainAttributes).length>0&&(s.push("\u{1F3E2} Domain Attributes:"),s.push(r(e.customDomainAttributes)),s.push("")),e.rawPayload!=null&&(s.push("\u2699\uFE0F Raw Payload:"),s.push(r(e.rawPayload)),s.push("")),s.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),s.push("Generated by React Native InApp Inspector"),s.join(`
3
- `)}export function formatCrashReport(e){const n=`${e.dateStr||""} ${e.timeStr||""}`.trim()||c(e.timestamp),t=["\u{1F4A5} CRASH REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u26A0\uFE0F Error: ${e.name||"Error"}: ${e.message||"Unknown error"}`,`\u{1F6A8} Fatal: ${e.isFatal?"YES (Fatal)":"NO (Caught)"}`,`\u{1F3F7}\uFE0F Type: ${(e.type||"js").toUpperCase()}`,`\u{1F552} Time: ${n}`];return e.deviceInfo&&t.push(`\u{1F4F1} Platform: ${e.deviceInfo.platform||"N/A"} (OS: ${e.deviceInfo.osVersion||"N/A"}, RN: ${e.deviceInfo.rnVersion||"N/A"})`),e.memoryInfo?.usedJSHeapSize&&t.push(`\u{1F4BE} Used Heap: ${Math.round(e.memoryInfo.usedJSHeapSize/(1024*1024))} MB`),t.push(""),e.stack&&(t.push("\u{1F4DC} Stack Trace:"),t.push(e.stack),t.push("")),e.breadcrumbs&&e.breadcrumbs.length>0&&(t.push(`\u{1F43E} Breadcrumbs (${e.breadcrumbs.length}):`),e.breadcrumbs.slice(-10).forEach(i=>{t.push(` \u2022 [${i.type}] ${i.message} (${c(i.timestamp)})`)}),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
4
- `)}export function formatAnalyticsReport(e){const n=c(e.timestamp),t=["\u{1F4CA} ANALYTICS EVENT REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Event Name: ${e.name||"Unknown"}`,`\u{1F3E2} Source: ${(e.source||"manual").toUpperCase()}`,`\u{1F552} Timestamp: ${n}`];return e.screenName&&t.push(`\u{1F4F1} Screen Name: ${e.screenName}`),e.userId&&t.push(`\u{1F464} User ID: ${e.userId}`),e.trackingId&&t.push(`\u{1F194} Tracking ID: ${e.trackingId}`),t.push(""),e.params&&Object.keys(e.params).length>0&&(t.push("\u{1F4E6} Event Parameters:"),t.push(r(e.params)),t.push("")),e.userProperties&&Object.keys(e.userProperties).length>0&&(t.push("\u{1F464} User Properties:"),t.push(r(e.userProperties)),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
5
- `)}export function formatReduxReport(e){const n=typeof e.timestamp=="number"?c(e.timestamp):e.timestamp,t=["\u{1F504} REDUX ACTION REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Action Type: ${e.type||"UNKNOWN"}`,`\u{1F552} Timestamp: ${n}`];return e.caller&&t.push(`\u{1F4CD} Caller: ${e.caller}`),e.originType&&t.push(`\u2699\uFE0F Origin: ${e.originType}`),e.affectedSlices&&e.affectedSlices.length>0&&t.push(`\u{1F370} Slices: ${e.affectedSlices.join(", ")}`),t.push(""),t.push("\u{1F4E6} Action Payload:"),t.push(r(e.payload)),t.push(""),e.prevState!==void 0&&(t.push("\u23EE\uFE0F Previous State:"),t.push(r(e.prevState)),t.push("")),e.nextState!==void 0&&(t.push("\u23ED\uFE0F Next State:"),t.push(r(e.nextState)),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
6
- `)}export function formatLogReport(e){const n=c(e.timestamp),t=["\u{1F4DC} CONSOLE LOG REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Level: ${(e.type||"info").toUpperCase()}`,`\u{1F552} Timestamp: ${n}`,`\u{1F4AC} Message: ${e.message||""}`];return e.caller&&t.push(`\u{1F4CD} Caller: ${e.caller}`),t.push(""),e.rawArgs&&e.rawArgs.length>0&&(t.push("\u{1F4E6} Arguments:"),t.push(r(e.rawArgs)),t.push("")),(e.stack||e.errorStack)&&(t.push("\u{1F4DC} Stack Trace:"),t.push(e.stack||e.errorStack||""),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
7
- `)}async function m(e,n){try{await x.share({title:e,message:n},{dialogTitle:e})}catch(t){t?.message!=="User did not share"&&b.alert("Share Error",t?.message||"Failed to open share sheet")}}export async function shareApiReport(e){const n=formatApiReport(e),t=`API: ${e.method||"GET"} ${e.url?.substring(0,40)||""}`;await m(t,n)}export async function sharePushReport(e){const n=formatPushReport(e),t=`Push: ${e.title||e.id||"Notification"}`;await m(t,n)}export async function shareCrashReport(e){const n=formatCrashReport(e),t=`Crash: ${e.name||e.message||"Error"}`;await m(t,n)}export async function shareAnalyticsReport(e){const n=formatAnalyticsReport(e),t=`Analytics: ${e.name||"Event"}`;await m(t,n)}export async function shareReduxReport(e){const n=formatReduxReport(e),t=`Redux: ${e.type||"Action"}`;await m(t,n)}export async function shareLogReport(e){const n=formatLogReport(e),t=`Log: ${(e.type||"info").toUpperCase()} - ${e.message?.substring(0,30)||""}`;await m(t,n)}export function formatSocketReport(e){const n=(e.client||"websocket").toUpperCase(),t=(e.status||"open").toUpperCase(),i=e.duration!=null?`${e.duration}ms`:"Active / Open",o=c(e.startTime||Date.now()),s=["\u{1F50C} WEBSOCKET / SOCKET.IO REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4E1} Client: ${n}`,`\u{1F310} URL: ${e.url||"N/A"}`,`\u26A1 Status: ${t}`,`\u23F1\uFE0F Connected: ${o}`,`\u23F3 Duration: ${i}`,`\u{1F4E6} Total Frames: ${e.frames?.length||0} (${e.sentCount||0} sent, ${e.receivedCount||0} recvd)`,`\u{1F4CA} Data Size: ${(e.totalBytesSent||0)+(e.totalBytesReceived||0)} bytes`];return e.protocols&&s.push(`\u{1F4DC} Protocols: ${Array.isArray(e.protocols)?e.protocols.join(", "):e.protocols}`),e.closeCode!=null&&s.push(`\u{1F6D1} Close Code: ${e.closeCode} (${e.closeReason||"N/A"})`),e.error&&s.push(`\u274C Error: ${e.error}`),e.caller&&s.push(`\u{1F4CD} Caller: ${e.caller}`),e.query&&Object.keys(e.query).length>0&&(s.push(""),s.push("\u{1F50D} Query Parameters:"),s.push(r(e.query))),e.frames&&e.frames.length>0&&(s.push(""),s.push("\u{1F4AC} Recent Message Frames:"),e.frames.slice(-10).forEach((a,$)=>{const g=a.direction==="send"?"\u2B06\uFE0F SEND":"\u2B07\uFE0F RECV",f=a.eventName?` [${a.eventName}]`:"";s.push(`--- Frame #${$+1} (${g}${f}, ${a.type}, ${a.size||0}B) ---`),s.push(r(a.data))})),s.push(""),s.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),s.push("Generated by React Native InApp Inspector"),s.join(`
8
- `)}export async function shareSocketReport(e){const n=formatSocketReport(e),t=`Socket: ${e.client?.toUpperCase()||"WS"} ${e.url?.substring(0,35)||""}`;await m(t,n)}export const DEFAULT_CONSOLE_EXPORT_OPTIONS={includeStackTrace:!1,includeArguments:!1,includeCaller:!1,includeTimestamps:!1,includeAppInfo:!1,includeDuplicates:!1,ignorePattern:""};export function generateConsoleLogsFilename(e="txt"){const n=new Date,t=String(n.getDate()).padStart(2,"0"),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getFullYear()).slice(-2),s=Math.random().toString(36).substring(2,8).padEnd(6,"0");return`log_${t}${i}${o}_${s}.${e==="log"?"log":"txt"}`}export function formatConsoleLogsExport(e,n="txt",t=DEFAULT_CONSOLE_EXPORT_OPTIONS){if(!e||e.length===0)return"No console logs to export.";const{includeStackTrace:i=!1,includeArguments:o=!1,includeCaller:s=!1,includeTimestamps:a=!1,includeAppInfo:$=!1,includeDuplicates:g=!1,ignorePattern:f=""}=t;let C=e;if(f&&f.trim().length>0)try{const p=new RegExp(f.trim(),"i");C=e.filter(l=>{const S=l.message||"",d=l.rawArgs?r(l.rawArgs):"",y=l.caller||"";return!p.test(S)&&!p.test(d)&&!p.test(y)})}catch{}if(C.length===0)return"No console logs to export (all filtered out).";const R=new Date().toLocaleString(),h="********************************************************************************",A=[];$&&A.push(`/${h}`,` * \u{1F4DC} CONSOLE LOGS EXPORT (${n.toUpperCase()})`,` * \u{1F552} Exported At: ${R}`,` * \u{1F4CA} Total Logs: ${e.length}`," * \u2699\uFE0F Generator: React Native InApp Inspector",` ${h}/`,"");const N=e.map((p,l)=>{const S=l+1,d=c(p.timestamp),y=(p.type||"info").toUpperCase(),O=g&&p.duplicateCount&&p.duplicateCount>1?` [DUPLICATES: \xD7${p.duplicateCount}]`:"",u=[`/${h}`,` * \u{1F4CC} LOG #${S} Starts [${y}]${a?` - ${d}`:""}${O}`,` ${h}/`];if(s&&p.caller&&u.push(`\u{1F4CD} Caller: ${p.caller}`),a&&u.push(`\u{1F552} Time: ${d}`),u.push(`\u{1F3F7}\uFE0F Level: ${y}`),p.sourceMethod&&p.sourceMethod!==p.type&&u.push(`\u2699\uFE0F Method: console.${p.sourceMethod}()`),u.push(""),u.push("\u{1F4AC} Message:"),u.push(p.message||"(Empty message)"),o&&p.rawArgs&&p.rawArgs.length>0&&(u.push(""),u.push("\u{1F4E6} Arguments / Data:"),u.push(r(p.rawArgs))),i&&(p.stack||p.errorStack)){u.push(""),u.push("\u{1F4DC} Stack Trace & Frames:");const E=(p.stack||p.errorStack||"").split(`
9
- `).map(I=>` ${I}`).join(`
10
- `);u.push(E)}return u.push(""),u.push(`/${h}`),u.push(` * \u{1F3C1} LOG #${S} Ends`),u.push(` ${h}/`),u.join(`
1
+ import{Alert as L,Share as b}from"react-native";import{writeNativeExportFile as D,shareNativeFile as k}from"../native/NativeInspector";import{formatDateTime as S,getCurlCommand as w}from"./index";function m(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}export function formatApiReport(e){const n=(e.method||"GET").toUpperCase(),t=e.status===0?"Failed / Network Error":e.status!=null?`${e.status} ${e.status===200?"OK":""}`.trim():"Pending",a=e.duration!=null?`${e.duration}ms`:"N/A",p=S(e.startTime||Date.now()),s=w(e),i=["\u{1F680} API INSPECTION REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Method: ${n}`,`\u{1F4CA} Status: ${t}`,`\u23F1\uFE0F Duration: ${a}`,`\u{1F552} Time: ${p}`];return e.client&&i.push(`\u{1F50C} Client: ${e.client.toUpperCase()}`),i.push(`\u{1F310} URL: ${e.url||"N/A"}`),i.push(""),e.requestHeaders&&Object.keys(e.requestHeaders).length>0&&(i.push("\u{1F4CB} Request Headers:"),i.push(m(e.requestHeaders)),i.push("")),e.request!=null&&e.request!==""&&(i.push("\u{1F4DD} Request Body:"),i.push(m(e.request)),i.push("")),e.responseHeaders&&Object.keys(e.responseHeaders).length>0&&(i.push("\u{1F4D1} Response Headers:"),i.push(m(e.responseHeaders)),i.push("")),e.response!=null&&e.response!==""&&(i.push("\u{1F4E5} Response Data:"),i.push(m(e.response)),i.push("")),s&&(i.push("\u{1F4BB} cURL Command:"),i.push(s),i.push("")),i.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),i.push("Generated by React Native InApp Inspector"),i.join(`
2
+ `)}export function formatPushReport(e){const n=S(e.timestamp||Date.now()),t=(e.source||"push").toUpperCase(),a=(e.appState||"unknown").toUpperCase(),p=(e.action||"received").toUpperCase(),s=["\u{1F514} PUSH NOTIFICATION REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Title: ${e.title||"(No Title)"}`,`\u{1F4DD} Body: ${e.body||"(No Body)"}`,`\u{1F3E2} Source: ${t}${e.domain?` (${e.domain})`:""}`,`\u{1F194} Message ID: ${e.id||"N/A"}`,`\u{1F4F1} App State: ${a}`,`\u{1F3AF} Action: ${p}`,`\u{1F552} Time: ${n}`];return e.subtitle&&s.push(`\u{1F4D1} Subtitle: ${e.subtitle}`),e.channelId&&s.push(`\u{1F3F7}\uFE0F Channel: ${e.channelId}`),e.priority&&s.push(`\u26A1 Priority: ${e.priority}`),e.badge!=null&&s.push(`\u{1F522} Badge: ${e.badge}`),e.sound&&s.push(`\u{1F50A} Sound: ${e.sound}`),e.imageUrl&&s.push(`\u{1F5BC}\uFE0F Image: ${e.imageUrl}`),s.push(""),e.data&&Object.keys(e.data).length>0&&(s.push("\u{1F4E6} Custom Data Payload:"),s.push(m(e.data)),s.push("")),e.customDomainAttributes&&Object.keys(e.customDomainAttributes).length>0&&(s.push("\u{1F3E2} Domain Attributes:"),s.push(m(e.customDomainAttributes)),s.push("")),e.rawPayload!=null&&(s.push("\u2699\uFE0F Raw Payload:"),s.push(m(e.rawPayload)),s.push("")),s.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),s.push("Generated by React Native InApp Inspector"),s.join(`
3
+ `)}export function formatCrashReport(e){const n=`${e.dateStr||""} ${e.timeStr||""}`.trim()||S(e.timestamp),t=["\u{1F4A5} CRASH REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u26A0\uFE0F Error: ${e.name||"Error"}: ${e.message||"Unknown error"}`,`\u{1F6A8} Fatal: ${e.isFatal?"YES (Fatal)":"NO (Caught)"}`,`\u{1F3F7}\uFE0F Type: ${(e.type||"js").toUpperCase()}`,`\u{1F552} Time: ${n}`];return e.deviceInfo&&t.push(`\u{1F4F1} Platform: ${e.deviceInfo.platform||"N/A"} (OS: ${e.deviceInfo.osVersion||"N/A"}, RN: ${e.deviceInfo.rnVersion||"N/A"})`),e.memoryInfo?.usedJSHeapSize&&t.push(`\u{1F4BE} Used Heap: ${Math.round(e.memoryInfo.usedJSHeapSize/(1024*1024))} MB`),t.push(""),e.stack&&(t.push("\u{1F4DC} Stack Trace:"),t.push(e.stack),t.push("")),e.breadcrumbs&&e.breadcrumbs.length>0&&(t.push(`\u{1F43E} Breadcrumbs (${e.breadcrumbs.length}):`),e.breadcrumbs.slice(-10).forEach(a=>{t.push(` \u2022 [${a.type}] ${a.message} (${S(a.timestamp)})`)}),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
4
+ `)}export function formatAnalyticsReport(e){const n=S(e.timestamp),t=["\u{1F4CA} ANALYTICS EVENT REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Event Name: ${e.name||"Unknown"}`,`\u{1F3E2} Source: ${(e.source||"manual").toUpperCase()}`,`\u{1F552} Timestamp: ${n}`];return e.screenName&&t.push(`\u{1F4F1} Screen Name: ${e.screenName}`),e.userId&&t.push(`\u{1F464} User ID: ${e.userId}`),e.trackingId&&t.push(`\u{1F194} Tracking ID: ${e.trackingId}`),t.push(""),e.params&&Object.keys(e.params).length>0&&(t.push("\u{1F4E6} Event Parameters:"),t.push(m(e.params)),t.push("")),e.userProperties&&Object.keys(e.userProperties).length>0&&(t.push("\u{1F464} User Properties:"),t.push(m(e.userProperties)),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
5
+ `)}export function formatReduxReport(e){const n=typeof e.timestamp=="number"?S(e.timestamp):e.timestamp,t=["\u{1F504} REDUX ACTION REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Action Type: ${e.type||"UNKNOWN"}`,`\u{1F552} Timestamp: ${n}`];return e.caller&&t.push(`\u{1F4CD} Caller: ${e.caller}`),e.originType&&t.push(`\u2699\uFE0F Origin: ${e.originType}`),e.affectedSlices&&e.affectedSlices.length>0&&t.push(`\u{1F370} Slices: ${e.affectedSlices.join(", ")}`),t.push(""),t.push("\u{1F4E6} Action Payload:"),t.push(m(e.payload)),t.push(""),e.prevState!==void 0&&(t.push("\u23EE\uFE0F Previous State:"),t.push(m(e.prevState)),t.push("")),e.nextState!==void 0&&(t.push("\u23ED\uFE0F Next State:"),t.push(m(e.nextState)),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
6
+ `)}export function formatLogReport(e){const n=S(e.timestamp),t=["\u{1F4DC} CONSOLE LOG REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4CC} Level: ${(e.type||"info").toUpperCase()}`,`\u{1F552} Timestamp: ${n}`,`\u{1F4AC} Message: ${e.message||""}`];return e.caller&&t.push(`\u{1F4CD} Caller: ${e.caller}`),t.push(""),e.rawArgs&&e.rawArgs.length>0&&(t.push("\u{1F4E6} Arguments:"),t.push(m(e.rawArgs)),t.push("")),(e.stack||e.errorStack)&&(t.push("\u{1F4DC} Stack Trace:"),t.push(e.stack||e.errorStack||""),t.push("")),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push("Generated by React Native InApp Inspector"),t.join(`
7
+ `)}async function y(e,n,t){try{const a=t||`export_${Date.now()}.txt`,p=await D(a,n);if(p){const s=a.endsWith(".json")?"application/json":(a.endsWith(".log")||a.endsWith(".txt"),"text/plain");if(await k(p,s,e))return}await b.share({title:e,message:n,url:p||void 0},{dialogTitle:e,subject:e})}catch(a){a?.message!=="User did not share"&&L.alert("Share Error",a?.message||"Failed to open share sheet")}}export async function shareApiReport(e){const n=formatApiReport(e),t=`api_${e.id??Date.now()}.txt`,a=`API: ${e.method||"GET"} ${e.url?.substring(0,40)||""}`;await y(a,n,t)}export async function sharePushReport(e){const n=formatPushReport(e),t=`push_${e.id??Date.now()}.txt`,a=`Push: ${e.title||e.id||"Notification"}`;await y(a,n,t)}export async function shareCrashReport(e){const n=formatCrashReport(e),t=`crash_${e.timestamp??Date.now()}.txt`,a=`Crash: ${e.name||e.message||"Error"}`;await y(a,n,t)}export async function shareAnalyticsReport(e){const n=formatAnalyticsReport(e),t=`analytics_${e.id??Date.now()}.txt`,a=`Analytics: ${e.name||"Event"}`;await y(a,n,t)}export async function shareReduxReport(e){const n=formatReduxReport(e),t=`redux_${e.id??Date.now()}.txt`,a=`Redux: ${e.type||"Action"}`;await y(a,n,t)}export async function shareLogReport(e){const n=formatLogReport(e),t=`log_${e.id??Date.now()}.txt`,a=`Log: ${(e.type||"info").toUpperCase()} - ${e.message?.substring(0,30)||""}`;await y(a,n,t)}export function formatSocketReport(e){const n=(e.client||"websocket").toUpperCase(),t=(e.status||"open").toUpperCase(),a=e.duration!=null?`${e.duration}ms`:"Active / Open",p=S(e.startTime||Date.now()),s=["\u{1F50C} WEBSOCKET / SOCKET.IO REPORT","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",`\u{1F4E1} Client: ${n}`,`\u{1F310} URL: ${e.url||"N/A"}`,`\u26A1 Status: ${t}`,`\u23F1\uFE0F Connected: ${p}`,`\u23F3 Duration: ${a}`,`\u{1F4E6} Total Frames: ${e.frames?.length||0} (${e.sentCount||0} sent, ${e.receivedCount||0} recvd)`,`\u{1F4CA} Data Size: ${(e.totalBytesSent||0)+(e.totalBytesReceived||0)} bytes`];return e.protocols&&s.push(`\u{1F4DC} Protocols: ${Array.isArray(e.protocols)?e.protocols.join(", "):e.protocols}`),e.closeCode!=null&&s.push(`\u{1F6D1} Close Code: ${e.closeCode} (${e.closeReason||"N/A"})`),e.error&&s.push(`\u274C Error: ${e.error}`),e.caller&&s.push(`\u{1F4CD} Caller: ${e.caller}`),e.query&&Object.keys(e.query).length>0&&(s.push(""),s.push("\u{1F50D} Query Parameters:"),s.push(m(e.query))),e.frames&&e.frames.length>0&&(s.push(""),s.push("\u{1F4AC} Recent Message Frames:"),e.frames.slice(-10).forEach((i,C)=>{const T=i.direction==="send"?"\u2B06\uFE0F SEND":"\u2B07\uFE0F RECV",R=i.eventName?` [${i.eventName}]`:"";s.push(`--- Frame #${C+1} (${T}${R}, ${i.type}, ${i.size||0}B) ---`),s.push(m(i.data))})),s.push(""),s.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),s.push("Generated by React Native InApp Inspector"),s.join(`
8
+ `)}export async function shareSocketReport(e){const n=formatSocketReport(e),t=`socket_${e.id??Date.now()}.txt`,a=`Socket: ${e.client?.toUpperCase()||"WS"} ${e.url?.substring(0,35)||""}`;await y(a,n,t)}export const DEFAULT_CONSOLE_EXPORT_OPTIONS={includeStackTrace:!1,includeArguments:!1,includeCaller:!1,includeTimestamps:!1,includeAppInfo:!1,includeDuplicates:!1,ignorePattern:""};export function generateConsoleLogsFilename(e="txt"){const n=new Date,t=String(n.getDate()).padStart(2,"0"),a=String(n.getMonth()+1).padStart(2,"0"),p=String(n.getFullYear()).slice(-2),s=Math.random().toString(36).substring(2,8).padEnd(6,"0");return`log_${t}${a}${p}_${s}.${e==="log"?"log":"txt"}`}export function formatConsoleLogsExport(e,n="txt",t=DEFAULT_CONSOLE_EXPORT_OPTIONS){if(!e||e.length===0)return"No console logs to export.";const{includeStackTrace:a=!1,includeArguments:p=!1,includeCaller:s=!1,includeTimestamps:i=!1,includeAppInfo:C=!1,includeDuplicates:T=!1,ignorePattern:R=""}=t;let x=e;if(R&&R.trim().length>0)try{const c=new RegExp(R.trim(),"i");x=e.filter(r=>{const o=r.message||"",f=r.rawArgs?m(r.rawArgs):"",l=r.caller||"";return!c.test(o)&&!c.test(f)&&!c.test(l)})}catch{}if(x.length===0)return"No console logs to export (all filtered out).";const P=new Date().toLocaleString(),d="********************************************************************************",$=[];C&&$.push(`/${d}`,` * \u{1F4DC} CONSOLE LOGS EXPORT (${n.toUpperCase()})`,` * \u{1F552} Exported At: ${P}`,` * \u{1F4CA} Total Logs: ${e.length}`," * \u2699\uFE0F Generator: React Native InApp Inspector",` ${d}/`,"");const O=e.map((c,r)=>{const o=r+1,f=S(c.timestamp),l=(c.type||"info").toUpperCase(),g=T&&c.duplicateCount&&c.duplicateCount>1?` [DUPLICATES: \xD7${c.duplicateCount}]`:"",h=[`/${d}`,` * \u{1F4CC} LOG #${o} Starts [${l}]${i?` - ${f}`:""}${g}`,` ${d}/`];if(s&&c.caller&&h.push(`\u{1F4CD} Caller: ${c.caller}`),i&&h.push(`\u{1F552} Time: ${f}`),h.push(`\u{1F3F7}\uFE0F Level: ${l}`),c.sourceMethod&&c.sourceMethod!==c.type&&h.push(`\u2699\uFE0F Method: console.${c.sourceMethod}()`),h.push(""),h.push("\u{1F4AC} Message:"),h.push(c.message||"(Empty message)"),p&&c.rawArgs&&c.rawArgs.length>0&&(h.push(""),h.push("\u{1F4E6} Arguments / Data:"),h.push(m(c.rawArgs))),a&&(c.stack||c.errorStack)){h.push(""),h.push("\u{1F4DC} Stack Trace & Frames:");const A=(c.stack||c.errorStack||"").split(`
9
+ `).map(u=>` ${u}`).join(`
10
+ `);h.push(A)}return h.push(""),h.push(`/${d}`),h.push(` * \u{1F3C1} LOG #${o} Ends`),h.push(` ${d}/`),h.join(`
11
11
  `)}).join(`
12
12
 
13
- `),T=$?["",`/${h}`," * \u{1F3C1} END OF CONSOLE LOGS EXPORT",` ${h}/`].join(`
14
- `):"";return`${A.join(`
15
- `)}${N}${T}`}export function estimateConsoleLogsExportSize(e,n="txt",t=DEFAULT_CONSOLE_EXPORT_OPTIONS){if(!e||e.length===0)return 0;const i=Math.min(e.length,20),o=e.slice(0,i),a=formatConsoleLogsExport(o,n,t).length/i;return Math.round(a*e.length)}export async function shareConsoleLogs(e,n="txt",t=DEFAULT_CONSOLE_EXPORT_OPTIONS,i){const o=formatConsoleLogsExport(e,n,t),s=generateConsoleLogsFilename(n);await m(i||s,o)}
13
+ `),I=C?["",`/${d}`," * \u{1F3C1} END OF CONSOLE LOGS EXPORT",` ${d}/`].join(`
14
+ `):"";return`${$.join(`
15
+ `)}${O}${I}`}export function estimateConsoleLogsExportSize(e,n="txt",t=DEFAULT_CONSOLE_EXPORT_OPTIONS){if(!e||e.length===0)return 0;const a=Math.min(e.length,20),p=e.slice(0,a),i=formatConsoleLogsExport(p,n,t).length/a;return Math.round(i*e.length)}export async function shareConsoleLogs(e,n="txt",t=DEFAULT_CONSOLE_EXPORT_OPTIONS,a){const p=formatConsoleLogsExport(e,n,t),s=generateConsoleLogsFilename(n);await y(a||s,p,s)}export const DEFAULT_NETWORK_EXPORT_OPTIONS={includeRequestHeaders:!1,includeRequestBody:!1,includeResponseHeaders:!1,includeResponseBody:!1,includeCurlCommand:!1,includeTimestamps:!1,includeAppInfo:!1,ignorePattern:""};export function generateNetworkLogsFilename(e="txt"){const n=new Date,t=String(n.getDate()).padStart(2,"0"),a=String(n.getMonth()+1).padStart(2,"0"),p=String(n.getFullYear()).slice(-2),s=Math.random().toString(36).substring(2,8).padEnd(6,"0");return`api_${t}${a}${p}_${s}.${e==="log"?"log":"txt"}`}export function formatNetworkLogsExport(e,n="txt",t=DEFAULT_NETWORK_EXPORT_OPTIONS){if(!e||e.length===0)return"No API requests to export.";const{includeRequestHeaders:a=!1,includeRequestBody:p=!1,includeResponseHeaders:s=!1,includeResponseBody:i=!1,includeCurlCommand:C=!1,includeTimestamps:T=!1,includeAppInfo:R=!1,ignorePattern:x=""}=t;let N=e;if(x&&x.trim().length>0)try{const r=new RegExp(x.trim(),"i");N=e.filter(o=>{const f=o.url||"",l=o.method||"",g=o.client||"",h=o.request?m(o.request):"",A=o.response?m(o.response):"",u=o.requestHeaders?m(o.requestHeaders):"",E=o.responseHeaders?m(o.responseHeaders):"";return!r.test(f)&&!r.test(l)&&!r.test(g)&&!r.test(h)&&!r.test(A)&&!r.test(u)&&!r.test(E)})}catch{}if(N.length===0)return"No API requests to export (all filtered out).";const d=new Date().toLocaleString(),$="********************************************************************************";if(n==="json"){const r=N.map((o,f)=>{const l={index:f+1,id:o.id,url:o.url,method:(o.method||"GET").toUpperCase(),status:o.status,duration:o.duration,startTime:o.startTime,client:o.client};return a&&o.requestHeaders&&(l.requestHeaders=o.requestHeaders),p&&o.request!=null&&(l.request=o.request),s&&o.responseHeaders&&(l.responseHeaders=o.responseHeaders),i&&o.response!=null&&(l.response=o.response),C&&(l.curl=w(o)),l});return JSON.stringify(r,null,2)}if(n==="curl"){const r=["#!/usr/bin/env bash","# ============================================================================== ","# \u{1F680} API Network Logs - cURL Script Export",`# \u{1F552} Exported At: ${d}`,`# \u{1F4CA} Total Commands: ${N.length}`,"# \u2699\uFE0F Generator: React Native InApp Inspector",`# ==============================================================================
16
+ `];return N.forEach((o,f)=>{const l=f+1,g=(o.method||"GET").toUpperCase(),h=o.status===0?"Failed / Error":o.status!=null?String(o.status):"Pending",A=o.duration!=null?`${o.duration}ms`:"N/A",u=S(o.startTime||Date.now());r.push(`# Request #${l}: [${g}] ${o.url||"N/A"} (Status: ${h}, ${A}, ${u})`);const E=w(o);E?r.push(E):r.push(`curl -X ${g} "${o.url||""}"`),r.push("")}),r.join(`
17
+ `)}const O=[];R&&O.push(`/${$}`,` * \u{1F680} API NETWORK LOGS EXPORT (${n.toUpperCase()})`,` * \u{1F552} Exported At: ${d}`,` * \u{1F4CA} Total Requests: ${N.length}`," * \u2699\uFE0F Generator: React Native InApp Inspector",` ${$}/`,"");const I=N.map((r,o)=>{const f=o+1,l=S(r.startTime||Date.now()),g=(r.method||"GET").toUpperCase(),h=r.status===0?"Failed / Network Error":r.status!=null?`${r.status} ${r.status===200?"OK":""}`.trim():"Pending",A=r.duration!=null?`${r.duration}ms`:"N/A",u=[`/${$}`,` * \u{1F4CC} REQUEST #${f} Starts [${g}] [${h}] [${A}]${T?` - ${l}`:""}`,` ${$}/`];if(u.push(`\u{1F310} URL: ${r.url||"N/A"}`),u.push(`\u{1F4CC} Method: ${g}`),u.push(`\u{1F4CA} Status: ${h}`),u.push(`\u23F1\uFE0F Duration: ${A}`),T&&u.push(`\u{1F552} Time: ${l}`),r.client&&u.push(`\u{1F50C} Client: ${r.client.toUpperCase()}`),a&&r.requestHeaders&&Object.keys(r.requestHeaders).length>0&&(u.push(""),u.push("\u{1F4CB} Request Headers:"),u.push(m(r.requestHeaders))),p&&r.request!=null&&r.request!==""&&(u.push(""),u.push("\u{1F4DD} Request Body:"),u.push(m(r.request))),s&&r.responseHeaders&&Object.keys(r.responseHeaders).length>0&&(u.push(""),u.push("\u{1F4D1} Response Headers:"),u.push(m(r.responseHeaders))),i&&r.response!=null&&r.response!==""&&(u.push(""),u.push("\u{1F4E5} Response Data:"),u.push(m(r.response))),C){const E=w(r);E&&(u.push(""),u.push("\u{1F4BB} cURL Command:"),u.push(E))}return u.push(""),u.push(`/${$}`),u.push(` * \u{1F3C1} REQUEST #${f} Ends`),u.push(` ${$}/`),u.join(`
18
+ `)}).join(`
19
+
20
+ `),c=R?["",`/${$}`," * \u{1F3C1} END OF API NETWORK LOGS EXPORT",` ${$}/`].join(`
21
+ `):"";return`${O.join(`
22
+ `)}${I}${c}`}export function estimateNetworkLogsExportSize(e,n="txt",t=DEFAULT_NETWORK_EXPORT_OPTIONS){if(!e||e.length===0)return 0;const a=Math.min(e.length,10),p=e.slice(0,a),i=formatNetworkLogsExport(p,n,t).length/a;return Math.round(i*e.length)}export async function shareNetworkLogs(e,n="txt",t=DEFAULT_NETWORK_EXPORT_OPTIONS,a){const p=formatNetworkLogsExport(e,n,t),s=generateNetworkLogsFilename(n);await y(a||s,p,s)}
@@ -0,0 +1,48 @@
1
+ import { A11yAuditResult, BoxModelMetrics, HierarchyBreadcrumbItem, InspectedElementInfo } from '../types';
2
+ export declare function getCleanComponentName(type: any): string;
3
+ export declare function buildHierarchyFromFiber(fiber: any): HierarchyBreadcrumbItem[];
4
+ export declare function getDynamicInspectorDataForPoint(locationX: number, locationY: number, inspectedViewRef?: any): Promise<InspectedElementInfo | null>;
5
+ export declare function extractBoxModel(flattenedStyle?: Record<string, any>, layout?: {
6
+ width: number;
7
+ height: number;
8
+ }): BoxModelMetrics;
9
+ export declare function categorizeStyles(flattened?: Record<string, any>): {
10
+ layout: Record<string, any>;
11
+ dimensions: Record<string, any>;
12
+ position: Record<string, any>;
13
+ spacing: Record<string, any>;
14
+ typography: Record<string, any>;
15
+ appearance: Record<string, any>;
16
+ borders: Record<string, any>;
17
+ transforms: Record<string, any>;
18
+ other: Record<string, any>;
19
+ };
20
+ export declare function calculateContrastRatio(textColor?: string, bgColor?: string): {
21
+ ratio: any;
22
+ score: "N/A";
23
+ } | {
24
+ ratio: number;
25
+ score: "AAA" | "AA" | "Fail";
26
+ };
27
+ export declare function auditAccessibility(props?: Record<string, any>, layout?: {
28
+ width: number;
29
+ height: number;
30
+ }, styles?: Record<string, any>): A11yAuditResult;
31
+ export declare function generateJsxSnippet(componentName: string, props?: Record<string, any>, styles?: Record<string, any>): string;
32
+ export declare function generateFullJsxSegmentSnippet(componentName: string, props?: Record<string, any>, styles?: Record<string, any>): {
33
+ code: string;
34
+ sourceFile?: string;
35
+ sourceLocation?: string;
36
+ lineNumber?: number;
37
+ columnNumber?: number;
38
+ };
39
+ export declare function generateStyleSheetSnippet(componentName: string, styles?: Record<string, any>): string;
40
+ export declare function generateCssSnippet(componentName: string, styles?: Record<string, any>): string;
41
+ export declare function createInspectedElement(componentName: string, props: Record<string, any>, layout: {
42
+ x: number;
43
+ y: number;
44
+ width: number;
45
+ height: number;
46
+ pageX: number;
47
+ pageY: number;
48
+ }, hierarchy?: HierarchyBreadcrumbItem[], nativeTag?: number, snapshotUri?: string, snapshotBase64?: string): InspectedElementInfo;
@@ -0,0 +1,19 @@
1
+ import{StyleSheet as S,Platform as j}from"react-native";export function getCleanComponentName(t){if(!t)return"Unknown";if(typeof t=="string")return t==="RCTView"||t==="AndroidHorizontalScrollView"?"View":t==="RCTText"||t==="RCTRawText"||t==="RCTVirtualText"?"Text":t==="RCTImageView"||t==="RCTCxxImageView"?"Image":t==="RCTScrollView"?"ScrollView":t==="RCTModalHostView"?"Modal":t==="RCTSafeAreaView"?"SafeAreaView":t.replace(/^RCT/,"").replace(/^Android/,"");if(typeof t=="function")return t.displayName||t.name||"Component";if(typeof t=="object"){if(t.$$typeof?.toString().includes("memo")&&t.type)return`Memo(${getCleanComponentName(t.type)})`;if(t.$$typeof?.toString().includes("forward_ref")&&(t.render||t.type))return t.displayName||`ForwardRef(${getCleanComponentName(t.render||t.type)})`;if(t.displayName)return t.displayName;if(t.name)return t.name}return"Component"}function I(t){if(!t)return!0;const e=t.toLowerCase();return e.includes("provider")||e.includes("consumer")||e.includes("context")||e==="errorboundary"||e==="moduleerrorboundary"||e.includes("inspector")||e==="anonymous"}export function buildHierarchyFromFiber(t){const e=[];let o=t,a=0;for(;o&&a<25;){if(o.type){const r=getCleanComponentName(o.type),s=typeof o.type=="string",l=o.memoizedProps||{},n=l.style?S.flatten(l.style):void 0;(!I(r)||e.length===0)&&e.unshift({id:`breadcrumb_${a}_${r}`,displayName:r,componentName:r,depth:a,isHostComponent:s,props:l,styles:n})}o=o.return,a++}return e}export function getDynamicInspectorDataForPoint(t,e,o){return new Promise(a=>{let r=!1;const s=setTimeout(()=>{if(!r){r=!0;const n=L(t,e);a(n)}},120),l=n=>{if(!r&&n&&(n.frame||n.hierarchy&&n.hierarchy.length>0)){r=!0,clearTimeout(s);const{frame:c,props:i,hierarchy:p,selectedIndex:d,touchedViewTag:f,closestInstance:u}=n,h=[];Array.isArray(p)&&p.forEach((m,_)=>{const N=m?.type||m,g=m?.name||getCleanComponentName(N)||`View_${_}`;let y={};try{if(typeof m.getInspectorData=="function"){const H=m.getInspectorData();H?.props&&(y=H.props)}else m.props?y=m.props:m.memoizedProps&&(y=m.memoizedProps)}catch{}const R=y?.style||typeof m.getInspectorData=="function"&&m.getInspectorData()?.props?.style,A=R?S.flatten(R):void 0;h.push({id:`crumb_${_}_${g}`,displayName:getCleanComponentName(g),componentName:g,depth:_,isHostComponent:typeof g=="string"&&(g.startsWith("RCT")||g==="View"||g==="Text"||g==="Image"),props:y,styles:A})});const b=d!=null&&h[d]?h[d]:h[h.length-1],x=b?.componentName||(u?getCleanComponentName(u.type):"View"),$=getCleanComponentName(x),w=i&&Object.keys(i).length>0?i:b?.props||{},O=w.style?S.flatten(w.style):b?.styles||{},C={x:c?.left??t,y:c?.top??e,width:c?.width??0,height:c?.height??0,pageX:c?.left??t,pageY:c?.top??e},T=createInspectedElement($,w,C,h.length>0?h:void 0,f);a(T)}};try{const n=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__||typeof window<"u"&&window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n&&n.renderers){const c=Array.from(n.renderers.values());let i=!1,p=o||null;if(!p&&n._fiberRoots)try{for(const d of n._fiberRoots.values())if(d&&d.size>0){const f=Array.from(d.values())[0];if(f?.containerInfo){p=f.containerInfo;break}}}catch{}for(const d of c){const f=d?.rendererConfig?.getInspectorDataForViewAtPoint;if(typeof f=="function")try{f(p,t,e,u=>(l(u),!0)),i=!0}catch{}}if(!i){clearTimeout(s),r=!0;const d=L(t,e);a(d)}}else{clearTimeout(s),r=!0;const c=L(t,e);a(c)}}catch{clearTimeout(s),r=!0;const n=L(t,e);a(n)}})}function L(t,e){try{const o=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__||typeof window<"u"&&window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!o||!o._fiberRoots)return null;let a=null;for(const d of o._fiberRoots.values())if(d&&d.size>0){const f=Array.from(d.values())[0];if(f?.current){a=f.current;break}}if(!a)return null;const r=[];let s=a,l=0;for(;s&&l<30;){if(s.type){const d=getCleanComponentName(s.type),f=typeof s.type=="string",u=s.memoizedProps||s.pendingProps||{},h=u.style?S.flatten(u.style):void 0;I(d)||r.push({id:`fiber_crumb_${l}_${d}`,displayName:d,componentName:d,depth:l,isHostComponent:f,props:u,styles:h})}s=s.child,l++}if(r.length===0)return null;const n=r[r.length-1],c=n.props||{},i=n.styles||{},p={x:i.left??t,y:i.top??e,width:i.width??120,height:i.height??44,pageX:i.left??t,pageY:i.top??e};return createInspectedElement(n.componentName,c,p,r)}catch{return null}}export function extractBoxModel(t={},e={width:0,height:0}){const o=(y,R=0)=>{const A=typeof y=="number"?y:parseFloat(y);return isNaN(A)?R:A},a=o(t.margin,0),r=o(t.marginVertical,a),s=o(t.marginHorizontal,a),l=o(t.marginTop,r),n=o(t.marginBottom,r),c=o(t.marginLeft,s),i=o(t.marginRight,s),p=o(t.padding,0),d=o(t.paddingVertical,p),f=o(t.paddingHorizontal,p),u=o(t.paddingTop,d),h=o(t.paddingBottom,d),b=o(t.paddingLeft,f),x=o(t.paddingRight,f),$=o(t.borderWidth,0),w=o(t.borderTopWidth,$),O=o(t.borderBottomWidth,$),C=o(t.borderLeftWidth,$),T=o(t.borderRightWidth,$),m=e.width||o(t.width,0),_=e.height||o(t.height,0),N=Math.max(0,m-(b+x+C+T)),g=Math.max(0,_-(u+h+w+O));return{margin:{top:l,right:i,bottom:n,left:c},border:{top:w,right:T,bottom:O,left:C},padding:{top:u,right:x,bottom:h,left:b},content:{width:Math.round(N*10)/10,height:Math.round(g*10)/10}}}export function categorizeStyles(t={}){const e={layout:{},dimensions:{},position:{},spacing:{},typography:{},appearance:{},borders:{},transforms:{},other:{}},o=new Set(["flex","flexDirection","justifyContent","alignItems","alignSelf","alignContent","flexWrap","flexGrow","flexShrink","flexBasis","gap","rowGap","columnGap"]),a=new Set(["width","height","minWidth","maxWidth","minHeight","maxHeight","aspectRatio"]),r=new Set(["position","top","bottom","left","right","start","end","zIndex"]),s=new Set(["padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingHorizontal","paddingVertical","paddingStart","paddingEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginHorizontal","marginVertical","marginStart","marginEnd"]),l=new Set(["color","fontSize","fontWeight","fontFamily","fontStyle","lineHeight","letterSpacing","textAlign","textAlignVertical","textDecorationLine","textDecorationStyle","textDecorationColor","textTransform","includeFontPadding"]),n=new Set(["backgroundColor","opacity","overflow","elevation","shadowColor","shadowOffset","shadowOpacity","shadowRadius","backfaceVisibility"]),c=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderStyle"]);for(const[i,p]of Object.entries(t))p!==void 0&&(o.has(i)?e.layout[i]=p:a.has(i)?e.dimensions[i]=p:r.has(i)?e.position[i]=p:s.has(i)?e.spacing[i]=p:l.has(i)?e.typography[i]=p:n.has(i)?e.appearance[i]=p:c.has(i)?e.borders[i]=p:i==="transform"?e.transforms[i]=p:e.other[i]=p);return e}function v(t){const e=t.replace("#","");if(e.length<6)return .5;const o=parseInt(e.substring(0,2),16)/255,a=parseInt(e.substring(2,4),16)/255,r=parseInt(e.substring(4,6),16)/255,s=[o,a,r].map(l=>l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4));return .2126*s[0]+.7152*s[1]+.0722*s[2]}export function calculateContrastRatio(t,e){if(!t||!e||!t.startsWith("#")||!e.startsWith("#"))return{ratio:void 0,score:"N/A"};const o=v(t),a=v(e),r=Math.max(o,a),s=Math.min(o,a),l=(r+.05)/(s+.05),n=Math.round(l*100)/100;let c="Fail";return n>=7?c="AAA":n>=4.5&&(c="AA"),{ratio:n,score:c}}export function auditAccessibility(t={},e={width:0,height:0},o={}){const a=j.OS==="android",r=a?48:44,s=typeof t.onPress=="function"||typeof t.onLongPress=="function"||t.accessible===!0,l=e.width||o.width||0,n=e.height||o.height||0,c=[];let i=!0;s&&(l>0||n>0)&&(l<r||n<r)&&(i=!1,c.push(`Touch target is ${Math.round(l)}\xD7${Math.round(n)}pt. Recommended min is ${r}\xD7${r}pt for ${a?"Android Material Design":"Apple iOS HIG"}.`));const p=!!(t.accessibilityLabel||t["aria-label"]||t.accessibilityTitle);s&&!p&&!t.children&&typeof t.children!="string"&&c.push("Interactive element is missing an accessibilityLabel / aria-label.");const d=o.color,f=o.backgroundColor,u=calculateContrastRatio(d,f);return u.score==="Fail"&&u.ratio!==void 0&&c.push(`Contrast ratio is ${u.ratio}:1 (below WCAG AA minimum 4.5:1).`),{hasValidTouchTarget:i,touchTargetWidth:l,touchTargetHeight:n,recommendedMinSize:r,contrastRatio:u.ratio,contrastScore:u.score,textColor:d,backgroundColor:f,hasAccessibilityLabel:p,accessibilityRole:t.accessibilityRole||t.role,accessibilityHint:t.accessibilityHint,issues:c}}export function generateJsxSnippet(t,e={},o={}){return generateFullJsxSegmentSnippet(t,e,o).code}function D(t,e){return typeof e=="string"?`${t}="${e}"`:typeof e=="boolean"?e?t:`${t}={false}`:typeof e=="number"?`${t}={${e}}`:typeof e=="function"?`${t}={() => {}}`:typeof e=="object"&&e!==null?`${t}={${JSON.stringify(e)}}`:`${t}={${String(e)}}`}function V(t,e=1){if(t==null)return"";const o=" ".repeat(e);if(typeof t=="string"||typeof t=="number")return`${o}${t}`;if(Array.isArray(t))return t.map(a=>V(a,e)).filter(Boolean).join(`
2
+ `);if(typeof t=="object"&&t.type){const a=typeof t.type=="string"?t.type:t.type.displayName||t.type.name||"Component",r=t.props||{},s=[];for(const[n,c]of Object.entries(r))n==="children"||n==="__source"||n==="__self"||n==="_source"||s.push(D(n,c));const l=s.length?" "+s.join(" "):"";if(r.children){const n=V(r.children,e+1);return`${o}<${a}${l}>
3
+ ${n}
4
+ ${o}</${a}>`}return`${o}<${a}${l} />`}return""}export function generateFullJsxSegmentSnippet(t,e={},o={}){const a=e.__source||e._source,r=a?.fileName,s=a?.lineNumber,l=a?.columnNumber,n=r?r.replace(/^.*[\\/]/,""):void 0,c=n&&s?`${n}:${s}${l?`:${l}`:""}`:void 0,i=[];for(const[f,u]of Object.entries(e))f==="children"||f==="style"||f==="key"||f==="__source"||f==="__self"||f==="_source"||i.push(D(f,u));Object.keys(o).length>0&&i.push(`style={styles.${t.toLowerCase()||"container"}}`);const p=V(e.children,1);let d="";return i.length<=1&&!p?d=`<${t}${i.length?" "+i.join(" "):""} />`:p?d=`<${t}${i.length?`
5
+ `+i.join(`
6
+ `):""}>
7
+ ${p}
8
+ </${t}>`:d=`<${t}
9
+ ${i.join(`
10
+ `)}
11
+ />`,{code:d,sourceFile:r,sourceLocation:c,lineNumber:s,columnNumber:l}}export function generateStyleSheetSnippet(t,e={}){const o=" ",a=[];for(const[s,l]of Object.entries(e)){if(l===void 0)continue;const n=typeof l=="string"?`'${l}'`:typeof l=="object"?JSON.stringify(l):String(l);a.push(`${o}${s}: ${n},`)}const r=a.length>0?`{
12
+ ${a.join(`
13
+ `)}
14
+ }`:"{}";return`const styles = StyleSheet.create({
15
+ ${t.toLowerCase()}Container: ${r},
16
+ });`}export function generateCssSnippet(t,e={}){const o=[];for(const[r,s]of Object.entries(e)){if(s===void 0)continue;const l=r.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),n=typeof s=="number"?`${s}px`:String(s);o.push(` ${l}: ${n};`)}const a=o.length>0?`{
17
+ ${o.join(`
18
+ `)}
19
+ }`:"{}";return`.${t.toLowerCase()}-element ${a}`}export function createInspectedElement(t,e={},o,a=[],r,s,l){const n=e.style?S.flatten(e.style)||{}:{},c={...n},i=extractBoxModel(c,o),p=auditAccessibility(e,o,c);return{id:`elem_${Date.now()}_${Math.random().toString(36).substring(2,6)}`,componentName:t,displayName:t,hierarchy:a.length>0?a:[{id:"root_app",displayName:"App",componentName:"App",depth:0,isHostComponent:!1},{id:"inspected_node",displayName:t,componentName:t,depth:1,isHostComponent:!0,props:e,styles:c}],props:e,originalStyles:n,flattenedStyles:c,tweakedStyles:{},layout:o,boxModel:i,a11y:p,nativeTag:r,snapshotUri:s,snapshotBase64:l,timestamp:Date.now()}}