procsi 0.2.6

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 (296) hide show
  1. package/LICENSE +665 -0
  2. package/README.md +587 -0
  3. package/dist/cli/commands/clear.d.ts +3 -0
  4. package/dist/cli/commands/clear.d.ts.map +1 -0
  5. package/dist/cli/commands/clear.js +30 -0
  6. package/dist/cli/commands/clear.js.map +1 -0
  7. package/dist/cli/commands/daemon.d.ts +3 -0
  8. package/dist/cli/commands/daemon.d.ts.map +1 -0
  9. package/dist/cli/commands/daemon.js +59 -0
  10. package/dist/cli/commands/daemon.js.map +1 -0
  11. package/dist/cli/commands/debug-dump.d.ts +27 -0
  12. package/dist/cli/commands/debug-dump.d.ts.map +1 -0
  13. package/dist/cli/commands/debug-dump.js +102 -0
  14. package/dist/cli/commands/debug-dump.js.map +1 -0
  15. package/dist/cli/commands/helpers.d.ts +18 -0
  16. package/dist/cli/commands/helpers.d.ts.map +1 -0
  17. package/dist/cli/commands/helpers.js +34 -0
  18. package/dist/cli/commands/helpers.js.map +1 -0
  19. package/dist/cli/commands/init.d.ts +9 -0
  20. package/dist/cli/commands/init.d.ts.map +1 -0
  21. package/dist/cli/commands/init.js +28 -0
  22. package/dist/cli/commands/init.js.map +1 -0
  23. package/dist/cli/commands/intercept.d.ts +9 -0
  24. package/dist/cli/commands/intercept.d.ts.map +1 -0
  25. package/dist/cli/commands/intercept.js +121 -0
  26. package/dist/cli/commands/intercept.js.map +1 -0
  27. package/dist/cli/commands/interceptors.d.ts +3 -0
  28. package/dist/cli/commands/interceptors.d.ts.map +1 -0
  29. package/dist/cli/commands/interceptors.js +163 -0
  30. package/dist/cli/commands/interceptors.js.map +1 -0
  31. package/dist/cli/commands/mcp.d.ts +3 -0
  32. package/dist/cli/commands/mcp.d.ts.map +1 -0
  33. package/dist/cli/commands/mcp.js +24 -0
  34. package/dist/cli/commands/mcp.js.map +1 -0
  35. package/dist/cli/commands/off.d.ts +8 -0
  36. package/dist/cli/commands/off.d.ts.map +1 -0
  37. package/dist/cli/commands/off.js +34 -0
  38. package/dist/cli/commands/off.js.map +1 -0
  39. package/dist/cli/commands/on.d.ts +9 -0
  40. package/dist/cli/commands/on.d.ts.map +1 -0
  41. package/dist/cli/commands/on.js +121 -0
  42. package/dist/cli/commands/on.js.map +1 -0
  43. package/dist/cli/commands/project.d.ts +3 -0
  44. package/dist/cli/commands/project.d.ts.map +1 -0
  45. package/dist/cli/commands/project.js +15 -0
  46. package/dist/cli/commands/project.js.map +1 -0
  47. package/dist/cli/commands/restart.d.ts +3 -0
  48. package/dist/cli/commands/restart.d.ts.map +1 -0
  49. package/dist/cli/commands/restart.js +35 -0
  50. package/dist/cli/commands/restart.js.map +1 -0
  51. package/dist/cli/commands/status.d.ts +3 -0
  52. package/dist/cli/commands/status.d.ts.map +1 -0
  53. package/dist/cli/commands/status.js +66 -0
  54. package/dist/cli/commands/status.js.map +1 -0
  55. package/dist/cli/commands/stop.d.ts +3 -0
  56. package/dist/cli/commands/stop.d.ts.map +1 -0
  57. package/dist/cli/commands/stop.js +24 -0
  58. package/dist/cli/commands/stop.js.map +1 -0
  59. package/dist/cli/commands/tui.d.ts +3 -0
  60. package/dist/cli/commands/tui.d.ts.map +1 -0
  61. package/dist/cli/commands/tui.js +36 -0
  62. package/dist/cli/commands/tui.js.map +1 -0
  63. package/dist/cli/commands/vars.d.ts +36 -0
  64. package/dist/cli/commands/vars.d.ts.map +1 -0
  65. package/dist/cli/commands/vars.js +207 -0
  66. package/dist/cli/commands/vars.js.map +1 -0
  67. package/dist/cli/index.d.ts +3 -0
  68. package/dist/cli/index.d.ts.map +1 -0
  69. package/dist/cli/index.js +37 -0
  70. package/dist/cli/index.js.map +1 -0
  71. package/dist/cli/tui/App.d.ts +15 -0
  72. package/dist/cli/tui/App.d.ts.map +1 -0
  73. package/dist/cli/tui/App.js +544 -0
  74. package/dist/cli/tui/App.js.map +1 -0
  75. package/dist/cli/tui/components/AccordionContent.d.ts +28 -0
  76. package/dist/cli/tui/components/AccordionContent.d.ts.map +1 -0
  77. package/dist/cli/tui/components/AccordionContent.js +87 -0
  78. package/dist/cli/tui/components/AccordionContent.js.map +1 -0
  79. package/dist/cli/tui/components/AccordionPanel.d.ts +38 -0
  80. package/dist/cli/tui/components/AccordionPanel.d.ts.map +1 -0
  81. package/dist/cli/tui/components/AccordionPanel.js +110 -0
  82. package/dist/cli/tui/components/AccordionPanel.js.map +1 -0
  83. package/dist/cli/tui/components/AccordionSection.d.ts +32 -0
  84. package/dist/cli/tui/components/AccordionSection.d.ts.map +1 -0
  85. package/dist/cli/tui/components/AccordionSection.js +41 -0
  86. package/dist/cli/tui/components/AccordionSection.js.map +1 -0
  87. package/dist/cli/tui/components/BodyView.d.ts +14 -0
  88. package/dist/cli/tui/components/BodyView.d.ts.map +1 -0
  89. package/dist/cli/tui/components/BodyView.js +39 -0
  90. package/dist/cli/tui/components/BodyView.js.map +1 -0
  91. package/dist/cli/tui/components/ExportModal.d.ts +34 -0
  92. package/dist/cli/tui/components/ExportModal.d.ts.map +1 -0
  93. package/dist/cli/tui/components/ExportModal.js +109 -0
  94. package/dist/cli/tui/components/ExportModal.js.map +1 -0
  95. package/dist/cli/tui/components/FilterBar.d.ts +21 -0
  96. package/dist/cli/tui/components/FilterBar.d.ts.map +1 -0
  97. package/dist/cli/tui/components/FilterBar.js +155 -0
  98. package/dist/cli/tui/components/FilterBar.js.map +1 -0
  99. package/dist/cli/tui/components/HeadersView.d.ts +13 -0
  100. package/dist/cli/tui/components/HeadersView.d.ts.map +1 -0
  101. package/dist/cli/tui/components/HeadersView.js +8 -0
  102. package/dist/cli/tui/components/HeadersView.js.map +1 -0
  103. package/dist/cli/tui/components/HelpModal.d.ts +13 -0
  104. package/dist/cli/tui/components/HelpModal.d.ts.map +1 -0
  105. package/dist/cli/tui/components/HelpModal.js +78 -0
  106. package/dist/cli/tui/components/HelpModal.js.map +1 -0
  107. package/dist/cli/tui/components/HintContent.d.ts +25 -0
  108. package/dist/cli/tui/components/HintContent.d.ts.map +1 -0
  109. package/dist/cli/tui/components/HintContent.js +44 -0
  110. package/dist/cli/tui/components/HintContent.js.map +1 -0
  111. package/dist/cli/tui/components/InfoModal.d.ts +15 -0
  112. package/dist/cli/tui/components/InfoModal.d.ts.map +1 -0
  113. package/dist/cli/tui/components/InfoModal.js +17 -0
  114. package/dist/cli/tui/components/InfoModal.js.map +1 -0
  115. package/dist/cli/tui/components/JsonExplorerModal.d.ts +24 -0
  116. package/dist/cli/tui/components/JsonExplorerModal.d.ts.map +1 -0
  117. package/dist/cli/tui/components/JsonExplorerModal.js +311 -0
  118. package/dist/cli/tui/components/JsonExplorerModal.js.map +1 -0
  119. package/dist/cli/tui/components/Modal.d.ts +26 -0
  120. package/dist/cli/tui/components/Modal.d.ts.map +1 -0
  121. package/dist/cli/tui/components/Modal.js +15 -0
  122. package/dist/cli/tui/components/Modal.js.map +1 -0
  123. package/dist/cli/tui/components/Panel.d.ts +19 -0
  124. package/dist/cli/tui/components/Panel.d.ts.map +1 -0
  125. package/dist/cli/tui/components/Panel.js +37 -0
  126. package/dist/cli/tui/components/Panel.js.map +1 -0
  127. package/dist/cli/tui/components/RequestDetails.d.ts +16 -0
  128. package/dist/cli/tui/components/RequestDetails.d.ts.map +1 -0
  129. package/dist/cli/tui/components/RequestDetails.js +23 -0
  130. package/dist/cli/tui/components/RequestDetails.js.map +1 -0
  131. package/dist/cli/tui/components/RequestList.d.ts +21 -0
  132. package/dist/cli/tui/components/RequestList.d.ts.map +1 -0
  133. package/dist/cli/tui/components/RequestList.js +30 -0
  134. package/dist/cli/tui/components/RequestList.js.map +1 -0
  135. package/dist/cli/tui/components/RequestListItem.d.ts +36 -0
  136. package/dist/cli/tui/components/RequestListItem.d.ts.map +1 -0
  137. package/dist/cli/tui/components/RequestListItem.js +130 -0
  138. package/dist/cli/tui/components/RequestListItem.js.map +1 -0
  139. package/dist/cli/tui/components/SaveModal.d.ts +30 -0
  140. package/dist/cli/tui/components/SaveModal.d.ts.map +1 -0
  141. package/dist/cli/tui/components/SaveModal.js +95 -0
  142. package/dist/cli/tui/components/SaveModal.js.map +1 -0
  143. package/dist/cli/tui/components/StatusBar.d.ts +39 -0
  144. package/dist/cli/tui/components/StatusBar.d.ts.map +1 -0
  145. package/dist/cli/tui/components/StatusBar.js +53 -0
  146. package/dist/cli/tui/components/StatusBar.js.map +1 -0
  147. package/dist/cli/tui/components/TextViewerModal.d.ts +19 -0
  148. package/dist/cli/tui/components/TextViewerModal.d.ts.map +1 -0
  149. package/dist/cli/tui/components/TextViewerModal.js +227 -0
  150. package/dist/cli/tui/components/TextViewerModal.js.map +1 -0
  151. package/dist/cli/tui/hooks/useBodyExport.d.ts +26 -0
  152. package/dist/cli/tui/hooks/useBodyExport.d.ts.map +1 -0
  153. package/dist/cli/tui/hooks/useBodyExport.js +173 -0
  154. package/dist/cli/tui/hooks/useBodyExport.js.map +1 -0
  155. package/dist/cli/tui/hooks/useExport.d.ts +29 -0
  156. package/dist/cli/tui/hooks/useExport.d.ts.map +1 -0
  157. package/dist/cli/tui/hooks/useExport.js +64 -0
  158. package/dist/cli/tui/hooks/useExport.js.map +1 -0
  159. package/dist/cli/tui/hooks/useRequests.d.ts +26 -0
  160. package/dist/cli/tui/hooks/useRequests.d.ts.map +1 -0
  161. package/dist/cli/tui/hooks/useRequests.js +131 -0
  162. package/dist/cli/tui/hooks/useRequests.js.map +1 -0
  163. package/dist/cli/tui/hooks/useSaveBinary.d.ts +26 -0
  164. package/dist/cli/tui/hooks/useSaveBinary.d.ts.map +1 -0
  165. package/dist/cli/tui/hooks/useSaveBinary.js +165 -0
  166. package/dist/cli/tui/hooks/useSaveBinary.js.map +1 -0
  167. package/dist/cli/tui/hooks/useSpinner.d.ts +5 -0
  168. package/dist/cli/tui/hooks/useSpinner.d.ts.map +1 -0
  169. package/dist/cli/tui/hooks/useSpinner.js +25 -0
  170. package/dist/cli/tui/hooks/useSpinner.js.map +1 -0
  171. package/dist/cli/tui/hooks/useStdoutDimensions.d.ts +11 -0
  172. package/dist/cli/tui/hooks/useStdoutDimensions.d.ts.map +1 -0
  173. package/dist/cli/tui/hooks/useStdoutDimensions.js +29 -0
  174. package/dist/cli/tui/hooks/useStdoutDimensions.js.map +1 -0
  175. package/dist/cli/tui/utils/binary.d.ts +24 -0
  176. package/dist/cli/tui/utils/binary.d.ts.map +1 -0
  177. package/dist/cli/tui/utils/binary.js +152 -0
  178. package/dist/cli/tui/utils/binary.js.map +1 -0
  179. package/dist/cli/tui/utils/clipboard.d.ts +9 -0
  180. package/dist/cli/tui/utils/clipboard.d.ts.map +1 -0
  181. package/dist/cli/tui/utils/clipboard.js +58 -0
  182. package/dist/cli/tui/utils/clipboard.js.map +1 -0
  183. package/dist/cli/tui/utils/content-type.d.ts +8 -0
  184. package/dist/cli/tui/utils/content-type.d.ts.map +1 -0
  185. package/dist/cli/tui/utils/content-type.js +10 -0
  186. package/dist/cli/tui/utils/content-type.js.map +1 -0
  187. package/dist/cli/tui/utils/curl.d.ts +9 -0
  188. package/dist/cli/tui/utils/curl.d.ts.map +1 -0
  189. package/dist/cli/tui/utils/curl.js +54 -0
  190. package/dist/cli/tui/utils/curl.js.map +1 -0
  191. package/dist/cli/tui/utils/filters.d.ts +6 -0
  192. package/dist/cli/tui/utils/filters.d.ts.map +1 -0
  193. package/dist/cli/tui/utils/filters.js +13 -0
  194. package/dist/cli/tui/utils/filters.js.map +1 -0
  195. package/dist/cli/tui/utils/formatters.d.ts +49 -0
  196. package/dist/cli/tui/utils/formatters.d.ts.map +1 -0
  197. package/dist/cli/tui/utils/formatters.js +200 -0
  198. package/dist/cli/tui/utils/formatters.js.map +1 -0
  199. package/dist/cli/tui/utils/har.d.ts +75 -0
  200. package/dist/cli/tui/utils/har.d.ts.map +1 -0
  201. package/dist/cli/tui/utils/har.js +117 -0
  202. package/dist/cli/tui/utils/har.js.map +1 -0
  203. package/dist/cli/tui/utils/json-tree.d.ts +69 -0
  204. package/dist/cli/tui/utils/json-tree.d.ts.map +1 -0
  205. package/dist/cli/tui/utils/json-tree.js +339 -0
  206. package/dist/cli/tui/utils/json-tree.js.map +1 -0
  207. package/dist/cli/tui/utils/open-external.d.ts +17 -0
  208. package/dist/cli/tui/utils/open-external.d.ts.map +1 -0
  209. package/dist/cli/tui/utils/open-external.js +57 -0
  210. package/dist/cli/tui/utils/open-external.js.map +1 -0
  211. package/dist/cli/tui/utils/syntax-highlight.d.ts +16 -0
  212. package/dist/cli/tui/utils/syntax-highlight.d.ts.map +1 -0
  213. package/dist/cli/tui/utils/syntax-highlight.js +64 -0
  214. package/dist/cli/tui/utils/syntax-highlight.js.map +1 -0
  215. package/dist/daemon/control.d.ts +21 -0
  216. package/dist/daemon/control.d.ts.map +1 -0
  217. package/dist/daemon/control.js +311 -0
  218. package/dist/daemon/control.js.map +1 -0
  219. package/dist/daemon/htpx-client.d.ts +8 -0
  220. package/dist/daemon/htpx-client.d.ts.map +1 -0
  221. package/dist/daemon/htpx-client.js +25 -0
  222. package/dist/daemon/htpx-client.js.map +1 -0
  223. package/dist/daemon/index.d.ts +3 -0
  224. package/dist/daemon/index.d.ts.map +1 -0
  225. package/dist/daemon/index.js +178 -0
  226. package/dist/daemon/index.js.map +1 -0
  227. package/dist/daemon/interceptor-loader.d.ts +30 -0
  228. package/dist/daemon/interceptor-loader.d.ts.map +1 -0
  229. package/dist/daemon/interceptor-loader.js +249 -0
  230. package/dist/daemon/interceptor-loader.js.map +1 -0
  231. package/dist/daemon/interceptor-runner.d.ts +39 -0
  232. package/dist/daemon/interceptor-runner.d.ts.map +1 -0
  233. package/dist/daemon/interceptor-runner.js +312 -0
  234. package/dist/daemon/interceptor-runner.js.map +1 -0
  235. package/dist/daemon/procsi-client.d.ts +8 -0
  236. package/dist/daemon/procsi-client.d.ts.map +1 -0
  237. package/dist/daemon/procsi-client.js +25 -0
  238. package/dist/daemon/procsi-client.js.map +1 -0
  239. package/dist/daemon/proxy.d.ts +34 -0
  240. package/dist/daemon/proxy.d.ts.map +1 -0
  241. package/dist/daemon/proxy.js +213 -0
  242. package/dist/daemon/proxy.js.map +1 -0
  243. package/dist/daemon/storage.d.ts +130 -0
  244. package/dist/daemon/storage.d.ts.map +1 -0
  245. package/dist/daemon/storage.js +761 -0
  246. package/dist/daemon/storage.js.map +1 -0
  247. package/dist/interceptors.d.ts +2 -0
  248. package/dist/interceptors.d.ts.map +1 -0
  249. package/dist/interceptors.js +2 -0
  250. package/dist/interceptors.js.map +1 -0
  251. package/dist/mcp/server.d.ts +110 -0
  252. package/dist/mcp/server.d.ts.map +1 -0
  253. package/dist/mcp/server.js +806 -0
  254. package/dist/mcp/server.js.map +1 -0
  255. package/dist/overrides/node.d.ts +30 -0
  256. package/dist/overrides/node.d.ts.map +1 -0
  257. package/dist/overrides/node.js +66 -0
  258. package/dist/overrides/node.js.map +1 -0
  259. package/dist/shared/config.d.ts +21 -0
  260. package/dist/shared/config.d.ts.map +1 -0
  261. package/dist/shared/config.js +83 -0
  262. package/dist/shared/config.js.map +1 -0
  263. package/dist/shared/content-type.d.ts +64 -0
  264. package/dist/shared/content-type.d.ts.map +1 -0
  265. package/dist/shared/content-type.js +145 -0
  266. package/dist/shared/content-type.js.map +1 -0
  267. package/dist/shared/control-client.d.ts +144 -0
  268. package/dist/shared/control-client.d.ts.map +1 -0
  269. package/dist/shared/control-client.js +272 -0
  270. package/dist/shared/control-client.js.map +1 -0
  271. package/dist/shared/daemon.d.ts +33 -0
  272. package/dist/shared/daemon.d.ts.map +1 -0
  273. package/dist/shared/daemon.js +231 -0
  274. package/dist/shared/daemon.js.map +1 -0
  275. package/dist/shared/logger.d.ts +47 -0
  276. package/dist/shared/logger.d.ts.map +1 -0
  277. package/dist/shared/logger.js +200 -0
  278. package/dist/shared/logger.js.map +1 -0
  279. package/dist/shared/project.d.ts +76 -0
  280. package/dist/shared/project.d.ts.map +1 -0
  281. package/dist/shared/project.js +185 -0
  282. package/dist/shared/project.js.map +1 -0
  283. package/dist/shared/proxy-info.d.ts +10 -0
  284. package/dist/shared/proxy-info.d.ts.map +1 -0
  285. package/dist/shared/proxy-info.js +15 -0
  286. package/dist/shared/proxy-info.js.map +1 -0
  287. package/dist/shared/types.d.ts +128 -0
  288. package/dist/shared/types.d.ts.map +1 -0
  289. package/dist/shared/types.js +5 -0
  290. package/dist/shared/types.js.map +1 -0
  291. package/dist/shared/version.d.ts +5 -0
  292. package/dist/shared/version.d.ts.map +1 -0
  293. package/dist/shared/version.js +21 -0
  294. package/dist/shared/version.js.map +1 -0
  295. package/package.json +113 -0
  296. package/skills/procsi/SKILL.md +228 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check whether a filter has any active conditions.
3
+ */
4
+ export function isFilterActive(filter) {
5
+ return ((filter.methods !== undefined && filter.methods.length > 0) ||
6
+ filter.statusRange !== undefined ||
7
+ (filter.search !== undefined && filter.search.length > 0) ||
8
+ filter.host !== undefined ||
9
+ filter.pathPrefix !== undefined ||
10
+ filter.since !== undefined ||
11
+ filter.before !== undefined);
12
+ }
13
+ //# sourceMappingURL=filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/filters.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAqB;IAClD,OAAO,CACL,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3D,MAAM,CAAC,WAAW,KAAK,SAAS;QAChC,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACzD,MAAM,CAAC,IAAI,KAAK,SAAS;QACzB,MAAM,CAAC,UAAU,KAAK,SAAS;QAC/B,MAAM,CAAC,KAAK,KAAK,SAAS;QAC1B,MAAM,CAAC,MAAM,KAAK,SAAS,CAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Formatting utilities for TUI display.
3
+ */
4
+ /**
5
+ * Format a timestamp as a relative time string (e.g., "2s ago", "5m ago").
6
+ */
7
+ export declare function formatRelativeTime(timestamp: number): string;
8
+ /**
9
+ * Format duration in milliseconds to a human-readable string.
10
+ */
11
+ export declare function formatDuration(durationMs: number | undefined): string;
12
+ /**
13
+ * Format byte size to human-readable string.
14
+ */
15
+ export declare function formatSize(bytes: number | undefined): string;
16
+ /**
17
+ * Truncate a string to a maximum length, adding ellipsis if needed.
18
+ */
19
+ export declare function truncate(str: string, maxLength: number): string;
20
+ /**
21
+ * Pad a string to a fixed width (left-aligned by default).
22
+ */
23
+ export declare function padRight(str: string, width: number): string;
24
+ /**
25
+ * Pad a string to a fixed width (right-aligned).
26
+ */
27
+ export declare function padLeft(str: string, width: number): string;
28
+ /**
29
+ * Format HTTP method with consistent width.
30
+ */
31
+ export declare function formatMethod(method: string): string;
32
+ /**
33
+ * Format HTTP status code.
34
+ */
35
+ export declare function formatStatus(status: number | undefined): string;
36
+ /**
37
+ * Get the standard text for an HTTP status code.
38
+ */
39
+ export declare function getStatusText(status: number | undefined): string;
40
+ /**
41
+ * Insert a zero-width space after "://" to prevent terminals from
42
+ * auto-detecting URLs and rendering them as clickable hyperlinks.
43
+ */
44
+ export declare function breakUrl(url: string): string;
45
+ /**
46
+ * Extract short content type for display (e.g., "application/json" -> "json")
47
+ */
48
+ export declare function shortContentType(contentType: string | undefined): string;
49
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAqB5D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAiBrE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAwB5D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAK/D;AAkED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAKhE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAYxE"}
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Formatting utilities for TUI display.
3
+ */
4
+ /**
5
+ * Format a timestamp as a relative time string (e.g., "2s ago", "5m ago").
6
+ */
7
+ export function formatRelativeTime(timestamp) {
8
+ const now = Date.now();
9
+ const diffMs = now - timestamp;
10
+ const diffSec = Math.floor(diffMs / 1000);
11
+ if (diffSec < 60) {
12
+ return `${diffSec}s ago`;
13
+ }
14
+ const diffMin = Math.floor(diffSec / 60);
15
+ if (diffMin < 60) {
16
+ return `${diffMin}m ago`;
17
+ }
18
+ const diffHour = Math.floor(diffMin / 60);
19
+ if (diffHour < 24) {
20
+ return `${diffHour}h ago`;
21
+ }
22
+ const diffDay = Math.floor(diffHour / 24);
23
+ return `${diffDay}d ago`;
24
+ }
25
+ /**
26
+ * Format duration in milliseconds to a human-readable string.
27
+ */
28
+ export function formatDuration(durationMs) {
29
+ if (durationMs === undefined) {
30
+ return "-";
31
+ }
32
+ if (durationMs < 1000) {
33
+ return `${durationMs}ms`;
34
+ }
35
+ const seconds = durationMs / 1000;
36
+ if (seconds < 60) {
37
+ return `${seconds.toFixed(1)}s`;
38
+ }
39
+ const minutes = Math.floor(seconds / 60);
40
+ const remainingSeconds = Math.floor(seconds % 60);
41
+ return `${minutes}m${remainingSeconds}s`;
42
+ }
43
+ /**
44
+ * Format byte size to human-readable string.
45
+ */
46
+ export function formatSize(bytes) {
47
+ if (bytes === undefined || bytes === 0) {
48
+ return "-";
49
+ }
50
+ const units = ["B", "KB", "MB", "GB"];
51
+ let size = bytes;
52
+ let unitIndex = 0;
53
+ while (size >= 1024 && unitIndex < units.length - 1) {
54
+ size /= 1024;
55
+ unitIndex++;
56
+ }
57
+ const unit = units[unitIndex];
58
+ if (unit === undefined) {
59
+ return `${bytes}B`;
60
+ }
61
+ if (unitIndex === 0) {
62
+ return `${size}${unit}`;
63
+ }
64
+ return `${size.toFixed(1)}${unit}`;
65
+ }
66
+ /**
67
+ * Truncate a string to a maximum length, adding ellipsis if needed.
68
+ */
69
+ export function truncate(str, maxLength) {
70
+ if (str.length <= maxLength) {
71
+ return str;
72
+ }
73
+ return str.slice(0, maxLength - 1) + "…";
74
+ }
75
+ /**
76
+ * Pad a string to a fixed width (left-aligned by default).
77
+ */
78
+ export function padRight(str, width) {
79
+ if (str.length >= width) {
80
+ return str.slice(0, width);
81
+ }
82
+ return str + " ".repeat(width - str.length);
83
+ }
84
+ /**
85
+ * Pad a string to a fixed width (right-aligned).
86
+ */
87
+ export function padLeft(str, width) {
88
+ if (str.length >= width) {
89
+ return str.slice(0, width);
90
+ }
91
+ return " ".repeat(width - str.length) + str;
92
+ }
93
+ /**
94
+ * Format HTTP method with consistent width.
95
+ */
96
+ export function formatMethod(method) {
97
+ return padRight(method.toUpperCase(), 7);
98
+ }
99
+ /**
100
+ * Format HTTP status code.
101
+ */
102
+ export function formatStatus(status) {
103
+ if (status === undefined) {
104
+ return "...";
105
+ }
106
+ return String(status);
107
+ }
108
+ /**
109
+ * Standard HTTP status text lookup.
110
+ */
111
+ const HTTP_STATUS_TEXT = {
112
+ // 1xx Informational
113
+ 100: "Continue",
114
+ 101: "Switching Protocols",
115
+ 102: "Processing",
116
+ 103: "Early Hints",
117
+ // 2xx Success
118
+ 200: "OK",
119
+ 201: "Created",
120
+ 202: "Accepted",
121
+ 203: "Non-Authoritative Information",
122
+ 204: "No Content",
123
+ 205: "Reset Content",
124
+ 206: "Partial Content",
125
+ 207: "Multi-Status",
126
+ // 3xx Redirection
127
+ 300: "Multiple Choices",
128
+ 301: "Moved Permanently",
129
+ 302: "Found",
130
+ 303: "See Other",
131
+ 304: "Not Modified",
132
+ 307: "Temporary Redirect",
133
+ 308: "Permanent Redirect",
134
+ // 4xx Client Error
135
+ 400: "Bad Request",
136
+ 401: "Unauthorized",
137
+ 402: "Payment Required",
138
+ 403: "Forbidden",
139
+ 404: "Not Found",
140
+ 405: "Method Not Allowed",
141
+ 406: "Not Acceptable",
142
+ 407: "Proxy Authentication Required",
143
+ 408: "Request Timeout",
144
+ 409: "Conflict",
145
+ 410: "Gone",
146
+ 411: "Length Required",
147
+ 412: "Precondition Failed",
148
+ 413: "Content Too Large",
149
+ 414: "URI Too Long",
150
+ 415: "Unsupported Media Type",
151
+ 416: "Range Not Satisfiable",
152
+ 417: "Expectation Failed",
153
+ 418: "I'm a Teapot",
154
+ 422: "Unprocessable Content",
155
+ 429: "Too Many Requests",
156
+ 431: "Request Header Fields Too Large",
157
+ // 5xx Server Error
158
+ 500: "Internal Server Error",
159
+ 501: "Not Implemented",
160
+ 502: "Bad Gateway",
161
+ 503: "Service Unavailable",
162
+ 504: "Gateway Timeout",
163
+ 505: "HTTP Version Not Supported",
164
+ 507: "Insufficient Storage",
165
+ 511: "Network Authentication Required",
166
+ };
167
+ /**
168
+ * Get the standard text for an HTTP status code.
169
+ */
170
+ export function getStatusText(status) {
171
+ if (status === undefined) {
172
+ return "";
173
+ }
174
+ return HTTP_STATUS_TEXT[status] ?? "";
175
+ }
176
+ /**
177
+ * Insert a zero-width space after "://" to prevent terminals from
178
+ * auto-detecting URLs and rendering them as clickable hyperlinks.
179
+ */
180
+ export function breakUrl(url) {
181
+ return url.replace("://", "://\u200B");
182
+ }
183
+ /**
184
+ * Extract short content type for display (e.g., "application/json" -> "json")
185
+ */
186
+ export function shortContentType(contentType) {
187
+ if (!contentType)
188
+ return "";
189
+ // Extract the main type (before any parameters like charset)
190
+ const mainType = contentType.split(";")[0]?.trim() ?? "";
191
+ // For common types, show just the subtype
192
+ if (mainType.startsWith("application/")) {
193
+ return mainType.replace("application/", "");
194
+ }
195
+ if (mainType.startsWith("text/")) {
196
+ return mainType.replace("text/", "");
197
+ }
198
+ return mainType;
199
+ }
200
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE1C,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,OAAO,GAAG,OAAO,OAAO,CAAC;IAC3B,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,OAAO,GAAG,OAAO,OAAO,CAAC;IAC3B,CAAC;IA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IAC9C,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACjC,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Generate HAR (HTTP Archive) format from captured requests.
3
+ */
4
+ import type { CapturedRequest } from "../../../shared/types.js";
5
+ /**
6
+ * HAR 1.2 specification types.
7
+ */
8
+ interface HarEntry {
9
+ startedDateTime: string;
10
+ time: number;
11
+ request: {
12
+ method: string;
13
+ url: string;
14
+ httpVersion: string;
15
+ cookies: unknown[];
16
+ headers: {
17
+ name: string;
18
+ value: string;
19
+ }[];
20
+ queryString: {
21
+ name: string;
22
+ value: string;
23
+ }[];
24
+ postData?: {
25
+ mimeType: string;
26
+ text: string;
27
+ };
28
+ headersSize: number;
29
+ bodySize: number;
30
+ };
31
+ response: {
32
+ status: number;
33
+ statusText: string;
34
+ httpVersion: string;
35
+ cookies: unknown[];
36
+ headers: {
37
+ name: string;
38
+ value: string;
39
+ }[];
40
+ content: {
41
+ size: number;
42
+ mimeType: string;
43
+ text?: string;
44
+ };
45
+ redirectURL: string;
46
+ headersSize: number;
47
+ bodySize: number;
48
+ };
49
+ cache: Record<string, never>;
50
+ timings: {
51
+ send: number;
52
+ wait: number;
53
+ receive: number;
54
+ };
55
+ }
56
+ interface Har {
57
+ log: {
58
+ version: string;
59
+ creator: {
60
+ name: string;
61
+ version: string;
62
+ };
63
+ entries: HarEntry[];
64
+ };
65
+ }
66
+ /**
67
+ * Generate a HAR object from captured requests.
68
+ */
69
+ export declare function generateHar(requests: CapturedRequest[]): Har;
70
+ /**
71
+ * Generate HAR JSON string from captured requests.
72
+ */
73
+ export declare function generateHarString(requests: CapturedRequest[]): string;
74
+ export {};
75
+ //# sourceMappingURL=har.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"har.d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KAAK,CAAC,CAAC;IAC7B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,UAAU,GAAG;IACX,GAAG,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,CAAC;KACrB,CAAC;CACH;AAsGD;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,GAAG,CAW5D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,MAAM,CAErE"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Generate HAR (HTTP Archive) format from captured requests.
3
+ */
4
+ import { getProcsiVersion } from "../../../shared/version.js";
5
+ import { getStatusText } from "./formatters.js";
6
+ /**
7
+ * Parse query string from URL.
8
+ */
9
+ function parseQueryString(url) {
10
+ try {
11
+ const parsedUrl = new URL(url);
12
+ const result = [];
13
+ parsedUrl.searchParams.forEach((value, name) => {
14
+ result.push({ name, value });
15
+ });
16
+ return result;
17
+ }
18
+ catch {
19
+ return [];
20
+ }
21
+ }
22
+ /**
23
+ * Convert headers object to HAR format.
24
+ */
25
+ function headersToHar(headers) {
26
+ if (!headers) {
27
+ return [];
28
+ }
29
+ return Object.entries(headers).map(([name, value]) => ({ name, value }));
30
+ }
31
+ /**
32
+ * Get content type from headers.
33
+ */
34
+ function getContentType(headers) {
35
+ if (!headers) {
36
+ return "application/octet-stream";
37
+ }
38
+ const contentType = headers["content-type"] || headers["Content-Type"] || "application/octet-stream";
39
+ return contentType;
40
+ }
41
+ /**
42
+ * Convert a captured request to HAR entry format.
43
+ */
44
+ function requestToHarEntry(request) {
45
+ const requestBodySize = request.requestBody?.length ?? 0;
46
+ const responseBodySize = request.responseBody?.length ?? 0;
47
+ const requestHeadersSize = JSON.stringify(request.requestHeaders).length;
48
+ const responseHeadersSize = JSON.stringify(request.responseHeaders ?? {}).length;
49
+ const entry = {
50
+ startedDateTime: new Date(request.timestamp).toISOString(),
51
+ time: request.durationMs ?? 0,
52
+ request: {
53
+ method: request.method,
54
+ url: request.url,
55
+ httpVersion: "HTTP/1.1",
56
+ cookies: [],
57
+ headers: headersToHar(request.requestHeaders),
58
+ queryString: parseQueryString(request.url),
59
+ headersSize: requestHeadersSize,
60
+ bodySize: requestBodySize,
61
+ },
62
+ response: {
63
+ status: request.responseStatus ?? 0,
64
+ statusText: getStatusText(request.responseStatus),
65
+ httpVersion: "HTTP/1.1",
66
+ cookies: [],
67
+ headers: headersToHar(request.responseHeaders),
68
+ content: {
69
+ size: responseBodySize,
70
+ mimeType: getContentType(request.responseHeaders),
71
+ },
72
+ redirectURL: "",
73
+ headersSize: responseHeadersSize,
74
+ bodySize: responseBodySize,
75
+ },
76
+ cache: {},
77
+ timings: {
78
+ send: 0,
79
+ wait: request.durationMs ?? 0,
80
+ receive: 0,
81
+ },
82
+ };
83
+ // Add request body if present
84
+ if (request.requestBody && request.requestBody.length > 0) {
85
+ entry.request.postData = {
86
+ mimeType: getContentType(request.requestHeaders),
87
+ text: request.requestBody.toString("utf-8"),
88
+ };
89
+ }
90
+ // Add response body if present
91
+ if (request.responseBody && request.responseBody.length > 0) {
92
+ entry.response.content.text = request.responseBody.toString("utf-8");
93
+ }
94
+ return entry;
95
+ }
96
+ /**
97
+ * Generate a HAR object from captured requests.
98
+ */
99
+ export function generateHar(requests) {
100
+ return {
101
+ log: {
102
+ version: "1.2",
103
+ creator: {
104
+ name: "procsi",
105
+ version: getProcsiVersion(),
106
+ },
107
+ entries: requests.map(requestToHarEntry),
108
+ },
109
+ };
110
+ }
111
+ /**
112
+ * Generate HAR JSON string from captured requests.
113
+ */
114
+ export function generateHarString(requests) {
115
+ return JSON.stringify(generateHar(requests), null, 2);
116
+ }
117
+ //# sourceMappingURL=har.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"har.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/har.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAwDhD;;GAEG;AACH,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAsC,EAAE,CAAC;QACrD,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC7C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CACnB,OAA2C;IAE3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,OAA2C;IACjE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,0BAA0B,CAAC;IACpC,CAAC;IACD,MAAM,WAAW,GACf,OAAO,CAAC,cAAc,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,IAAI,0BAA0B,CAAC;IACnF,OAAO,WAAW,CAAC;AACrB,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ible JSON tree.
3
+ * Used by JsonExplorerModal to render an interactive tree view.
4
+ */
5
+ export interface JsonTreeNode {
6
+ /** Unique key path, e.g. "root.data.users[0].name" */
7
+ path: string;
8
+ /** Display label, e.g. "name", "[0]", "(root)" */
9
+ key: string;
10
+ /** Indentation level (0 = root) */
11
+ depth: number;
12
+ /** Node type */
13
+ type: "object" | "array" | "primitive";
14
+ /** Display value — primitives: formatted value, containers: "{3 keys}" / "[5 items]" */
15
+ value: string;
16
+ /** Whether the node has children that can be expanded */
17
+ expandable: boolean;
18
+ }
19
+ /**
20
+ * Build a flat array of visible tree nodes by recursively walking the JSON data.
21
+ * Children of collapsed nodes are skipped.
22
+ */
23
+ export declare function buildVisibleNodes(data: unknown, expandedPaths: Set<string>): JsonTreeNode[];
24
+ /**
25
+ * Toggle a node's expansion state. Returns a new Set.
26
+ */
27
+ export declare function toggleNode(expandedPaths: Set<string>, path: string): Set<string>;
28
+ /**
29
+ * Compute default expansion: root + all depth-1 nodes.
30
+ */
31
+ export declare function defaultExpansion(data: unknown): Set<string>;
32
+ /**
33
+ * Expand all container nodes in the data.
34
+ */
35
+ export declare function expandAll(data: unknown): Set<string>;
36
+ /**
37
+ * Collapse everything.
38
+ */
39
+ export declare function collapseAll(): Set<string>;
40
+ /**
41
+ * Find the parent path of a given path.
42
+ * Returns null for the root path.
43
+ */
44
+ export declare function parentPath(path: string): string | null;
45
+ export interface FilterResult {
46
+ matchingPaths: Set<string>;
47
+ expandedPaths: Set<string>;
48
+ }
49
+ /**
50
+ * Filter nodes by dotted path prefix.
51
+ * Returns matching paths and the set of paths that should be expanded to reveal them.
52
+ * Returns null if filter text is empty.
53
+ *
54
+ * Supports:
55
+ * - Dotted paths: "data.users"
56
+ * - Array indices: "data.users[0]"
57
+ * - Case-insensitive matching
58
+ */
59
+ export declare function filterByPath(data: unknown, filterText: string): FilterResult | null;
60
+ /**
61
+ * Resolve a tree node path to the actual value in the data.
62
+ */
63
+ export declare function getValueAtPath(data: unknown, path: string): unknown;
64
+ /**
65
+ * Build a breadcrumb trail from a node path.
66
+ * e.g. "root.data.users[0].name" → ["(root)", "data", "users", "[0]", "name"]
67
+ */
68
+ export declare function buildBreadcrumb(path: string): string[];
69
+ //# sourceMappingURL=json-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-tree.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/json-tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;IACvC,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAoDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,YAAY,EAAE,CA4B3F;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAQhF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAwB3D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAsBpD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAAC,MAAM,CAAC,CAEzC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAetD;AAED,MAAM,WAAW,YAAY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