shieldcortex 4.14.8 → 4.14.10

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 (305) hide show
  1. package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
  2. package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
  3. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page.js.nft.json +1 -1
  4. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/admin/page_client-reference-manifest.js +1 -1
  5. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page.js.nft.json +1 -1
  6. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/cloud/page_client-reference-manifest.js +1 -1
  7. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page.js.nft.json +1 -1
  8. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/capture/page_client-reference-manifest.js +1 -1
  9. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page.js.nft.json +1 -1
  10. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/graph/page_client-reference-manifest.js +1 -1
  11. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page.js.nft.json +1 -1
  12. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
  13. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page.js.nft.json +1 -1
  14. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/recall/page_client-reference-manifest.js +1 -1
  15. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page.js.nft.json +1 -1
  16. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/review/page_client-reference-manifest.js +1 -1
  17. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page.js.nft.json +1 -1
  18. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/memory/timeline/page_client-reference-manifest.js +1 -1
  19. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page.js.nft.json +1 -1
  20. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/overview/page_client-reference-manifest.js +1 -1
  21. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page.js.nft.json +1 -1
  22. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/audit/page_client-reference-manifest.js +1 -1
  23. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page.js.nft.json +1 -1
  24. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/intercepts/page_client-reference-manifest.js +1 -1
  25. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page.js.nft.json +1 -1
  26. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/iron-dome/page_client-reference-manifest.js +1 -1
  27. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page.js.nft.json +1 -1
  28. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/page_client-reference-manifest.js +1 -1
  29. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page.js.nft.json +1 -1
  30. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/policies/page_client-reference-manifest.js +1 -1
  31. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page.js.nft.json +1 -1
  32. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/protection/quarantine/page_client-reference-manifest.js +1 -1
  33. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  34. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  35. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page.js.nft.json +1 -1
  36. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/page_client-reference-manifest.js +1 -1
  37. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page.js.nft.json +1 -1
  38. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/supply-chain/xray/page_client-reference-manifest.js +1 -1
  39. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page.js.nft.json +1 -1
  40. package/dashboard/.next/standalone/dashboard/.next/server/app/(dashboard)/xray/page_client-reference-manifest.js +1 -1
  41. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
  42. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
  43. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  44. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  45. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  46. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  47. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  48. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  49. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +9 -1
  50. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +3 -2
  51. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +3 -2
  52. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  53. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +3 -2
  54. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  55. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  56. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -2
  57. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.html +1 -1
  58. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.rsc +19 -16
  59. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin/__PAGE__.segment.rsc +1 -1
  60. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk/admin.segment.rsc +1 -1
  61. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  62. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_full.segment.rsc +19 -16
  63. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  64. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_index.segment.rsc +3 -2
  65. package/dashboard/.next/standalone/dashboard/.next/server/app/admin.segments/_tree.segment.rsc +3 -2
  66. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.html +1 -1
  67. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.rsc +19 -16
  68. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud/__PAGE__.segment.rsc +1 -1
  69. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk/cloud.segment.rsc +1 -1
  70. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  71. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_full.segment.rsc +19 -16
  72. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_head.segment.rsc +1 -1
  73. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_index.segment.rsc +3 -2
  74. package/dashboard/.next/standalone/dashboard/.next/server/app/cloud.segments/_tree.segment.rsc +3 -2
  75. package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
  76. package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +3 -2
  77. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  78. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +3 -2
  79. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  80. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +3 -2
  81. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +3 -2
  82. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.html +1 -1
  83. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.rsc +21 -17
  84. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture/__PAGE__.segment.rsc +1 -1
  85. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory/capture.segment.rsc +1 -1
  86. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  87. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  88. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_full.segment.rsc +21 -17
  89. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_head.segment.rsc +1 -1
  90. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_index.segment.rsc +3 -2
  91. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/capture.segments/_tree.segment.rsc +3 -2
  92. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.html +1 -1
  93. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.rsc +21 -17
  94. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph/__PAGE__.segment.rsc +1 -1
  95. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory/graph.segment.rsc +1 -1
  96. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  97. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  98. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_full.segment.rsc +21 -17
  99. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_head.segment.rsc +1 -1
  100. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_index.segment.rsc +3 -2
  101. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/graph.segments/_tree.segment.rsc +3 -2
  102. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.html +1 -1
  103. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.rsc +21 -17
  104. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall/__PAGE__.segment.rsc +1 -1
  105. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory/recall.segment.rsc +1 -1
  106. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  107. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  108. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_full.segment.rsc +21 -17
  109. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_head.segment.rsc +1 -1
  110. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_index.segment.rsc +3 -2
  111. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/recall.segments/_tree.segment.rsc +3 -2
  112. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.html +1 -1
  113. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.rsc +21 -17
  114. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review/__PAGE__.segment.rsc +1 -1
  115. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory/review.segment.rsc +1 -1
  116. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  117. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  118. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_full.segment.rsc +21 -17
  119. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_head.segment.rsc +1 -1
  120. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_index.segment.rsc +3 -2
  121. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/review.segments/_tree.segment.rsc +3 -2
  122. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.html +1 -1
  123. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.rsc +21 -17
  124. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline/__PAGE__.segment.rsc +1 -1
  125. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory/timeline.segment.rsc +1 -1
  126. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  127. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  128. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_full.segment.rsc +21 -17
  129. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_head.segment.rsc +1 -1
  130. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_index.segment.rsc +3 -2
  131. package/dashboard/.next/standalone/dashboard/.next/server/app/memory/timeline.segments/_tree.segment.rsc +3 -2
  132. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.html +9 -1
  133. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.rsc +26 -21
  134. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory/__PAGE__.segment.rsc +3 -3
  135. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk/memory.segment.rsc +1 -1
  136. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  137. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_full.segment.rsc +26 -21
  138. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_head.segment.rsc +1 -1
  139. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_index.segment.rsc +3 -2
  140. package/dashboard/.next/standalone/dashboard/.next/server/app/memory.segments/_tree.segment.rsc +3 -2
  141. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.html +9 -1
  142. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.rsc +25 -20
  143. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview/__PAGE__.segment.rsc +3 -3
  144. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk/overview.segment.rsc +1 -1
  145. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  146. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_full.segment.rsc +25 -20
  147. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_head.segment.rsc +1 -1
  148. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_index.segment.rsc +3 -2
  149. package/dashboard/.next/standalone/dashboard/.next/server/app/overview.segments/_tree.segment.rsc +3 -2
  150. package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  151. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.html +1 -1
  152. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.rsc +21 -17
  153. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit/__PAGE__.segment.rsc +1 -1
  154. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection/audit.segment.rsc +1 -1
  155. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  156. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  157. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_full.segment.rsc +21 -17
  158. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_head.segment.rsc +1 -1
  159. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_index.segment.rsc +3 -2
  160. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/audit.segments/_tree.segment.rsc +3 -2
  161. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.html +1 -1
  162. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.rsc +21 -17
  163. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts/__PAGE__.segment.rsc +1 -1
  164. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection/intercepts.segment.rsc +1 -1
  165. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  166. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  167. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_full.segment.rsc +21 -17
  168. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_head.segment.rsc +1 -1
  169. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_index.segment.rsc +3 -2
  170. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/intercepts.segments/_tree.segment.rsc +3 -2
  171. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.html +1 -1
  172. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.rsc +21 -17
  173. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome/__PAGE__.segment.rsc +1 -1
  174. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection/iron-dome.segment.rsc +1 -1
  175. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  176. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  177. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_full.segment.rsc +21 -17
  178. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_head.segment.rsc +1 -1
  179. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_index.segment.rsc +3 -2
  180. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/iron-dome.segments/_tree.segment.rsc +3 -2
  181. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.html +1 -1
  182. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.rsc +21 -17
  183. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies/__PAGE__.segment.rsc +1 -1
  184. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection/policies.segment.rsc +1 -1
  185. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  186. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  187. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_full.segment.rsc +21 -17
  188. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_head.segment.rsc +1 -1
  189. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_index.segment.rsc +3 -2
  190. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/policies.segments/_tree.segment.rsc +3 -2
  191. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.html +1 -1
  192. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.rsc +21 -17
  193. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine/__PAGE__.segment.rsc +1 -1
  194. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection/quarantine.segment.rsc +1 -1
  195. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  196. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  197. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_full.segment.rsc +21 -17
  198. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_head.segment.rsc +1 -1
  199. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_index.segment.rsc +3 -2
  200. package/dashboard/.next/standalone/dashboard/.next/server/app/protection/quarantine.segments/_tree.segment.rsc +3 -2
  201. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.html +9 -1
  202. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.rsc +20 -17
  203. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection/__PAGE__.segment.rsc +2 -2
  204. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk/protection.segment.rsc +1 -1
  205. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  206. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_full.segment.rsc +20 -17
  207. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_head.segment.rsc +1 -1
  208. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_index.segment.rsc +3 -2
  209. package/dashboard/.next/standalone/dashboard/.next/server/app/protection.segments/_tree.segment.rsc +3 -2
  210. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.html +9 -1
  211. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.rsc +23 -17
  212. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings/__PAGE__.segment.rsc +2 -2
  213. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk/settings.segment.rsc +1 -1
  214. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  215. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_full.segment.rsc +23 -17
  216. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  217. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_index.segment.rsc +3 -2
  218. package/dashboard/.next/standalone/dashboard/.next/server/app/settings.segments/_tree.segment.rsc +3 -2
  219. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.html +1 -1
  220. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.rsc +21 -17
  221. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray/__PAGE__.segment.rsc +1 -1
  222. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain/xray.segment.rsc +1 -1
  223. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
  224. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  225. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_full.segment.rsc +21 -17
  226. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_head.segment.rsc +1 -1
  227. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_index.segment.rsc +3 -2
  228. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain/xray.segments/_tree.segment.rsc +3 -2
  229. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.html +1 -1
  230. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.rsc +20 -17
  231. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain/__PAGE__.segment.rsc +1 -1
  232. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk/supply-chain.segment.rsc +1 -1
  233. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  234. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_full.segment.rsc +20 -17
  235. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_head.segment.rsc +1 -1
  236. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_index.segment.rsc +3 -2
  237. package/dashboard/.next/standalone/dashboard/.next/server/app/supply-chain.segments/_tree.segment.rsc +3 -2
  238. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.html +9 -1
  239. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.rsc +23 -17
  240. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray/__PAGE__.segment.rsc +2 -2
  241. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk/xray.segment.rsc +1 -1
  242. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/!KGRhc2hib2FyZCk.segment.rsc +7 -7
  243. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_full.segment.rsc +23 -17
  244. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_head.segment.rsc +1 -1
  245. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_index.segment.rsc +3 -2
  246. package/dashboard/.next/standalone/dashboard/.next/server/app/xray.segments/_tree.segment.rsc +3 -2
  247. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/9f1d4_lucide-react_dist_esm_icons_3a8e61d9._.js +3 -0
  248. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/[root-of-the-server]__7d500b5a._.js +9 -1
  249. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_1c5148b9._.js +3 -0
  250. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_204d1c9e._.js +3 -0
  251. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_30ecb37e._.js +3 -0
  252. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_415e5b1b._.js +3 -0
  253. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_442a0173._.js +3 -0
  254. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_64f63df9._.js +3 -0
  255. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_6999a855._.js +3 -0
  256. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_7cb6f257._.js +3 -0
  257. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_c219bf07._.js +8 -8
  258. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_c343baff._.js +3 -0
  259. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_app_(dashboard)_overview_page_tsx_8c105626._.js +3 -0
  260. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_protection_ProtectionOverview_tsx_54554a97._.js +2 -2
  261. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_settings_SettingsView_tsx_16dc83a7._.js +1 -1
  262. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_d191b6dc._.js +3 -0
  263. package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +9 -1
  264. package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
  265. package/dashboard/.next/standalone/dashboard/.next/static/chunks/2473c16c0c2f6b5f.css +2 -0
  266. package/dashboard/.next/standalone/dashboard/.next/static/chunks/5f18f98891076bc5.js +1 -0
  267. package/dashboard/.next/standalone/dashboard/.next/static/chunks/75769fa28c7a2e99.js +1 -0
  268. package/dashboard/.next/standalone/dashboard/.next/static/chunks/8d4a0f601450b091.js +1 -0
  269. package/dashboard/.next/standalone/dashboard/.next/static/chunks/a092294b7089c7a6.js +15 -0
  270. package/dashboard/.next/standalone/dashboard/.next/static/chunks/{b308a787e8cbc2a9.js → b053d5f11418d645.js} +2 -2
  271. package/dashboard/.next/standalone/dashboard/.next/static/chunks/bf725d638cce46d4.css +1 -0
  272. package/dashboard/.next/standalone/dashboard/.next/static/chunks/d05e311dfccb5729.js +1 -0
  273. package/dashboard/.next/standalone/dashboard/.next/static/chunks/e9f4b8da354f1005.js +1 -0
  274. package/dashboard/.next/standalone/dashboard/.next/static/chunks/f645461768b1089e.js +1 -0
  275. package/dashboard/.next/standalone/dashboard/.next/static/chunks/fe6075d947234b5d.js +1 -0
  276. package/dist/cli/update.js +58 -21
  277. package/package.json +1 -1
  278. package/plugins/openclaw/dist/openclaw.plugin.json +1 -1
  279. package/scripts/lib/prompt-sanitiser.mjs +71 -0
  280. package/scripts/prompt-recall-hook.mjs +8 -1
  281. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_01f6ceb0._.js +0 -3
  282. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_20c6acea._.js +0 -3
  283. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_2a8eef6b._.js +0 -3
  284. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_35a9932a._.js +0 -3
  285. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_37f17371._.js +0 -3
  286. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_77cb2b63._.js +0 -3
  287. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_a16ef10a._.js +0 -3
  288. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_f9cd1dc2._.js +0 -3
  289. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_fefd3b85._.js +0 -3
  290. package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_src_components_de7ac4f9._.js +0 -3
  291. package/dashboard/.next/standalone/dashboard/.next/static/chunks/015dc64369f26b7d.css +0 -3
  292. package/dashboard/.next/standalone/dashboard/.next/static/chunks/2fe84829530e61a3.js +0 -1
  293. package/dashboard/.next/standalone/dashboard/.next/static/chunks/34d0309a4e34b084.js +0 -1
  294. package/dashboard/.next/standalone/dashboard/.next/static/chunks/3b7fdf1ee828254c.js +0 -1
  295. package/dashboard/.next/standalone/dashboard/.next/static/chunks/4c90ebd2c08cd656.js +0 -15
  296. package/dashboard/.next/standalone/dashboard/.next/static/chunks/4d4af0cecaef56f2.js +0 -1
  297. package/dashboard/.next/standalone/dashboard/.next/static/chunks/4eb86dc2f379d3ca.js +0 -1
  298. package/dashboard/.next/standalone/dashboard/.next/static/chunks/6ea97c8dc9e30ea5.js +0 -1
  299. package/dashboard/.next/standalone/dashboard/.next/static/chunks/74ea1a87751e93a3.js +0 -1
  300. package/dashboard/.next/standalone/dashboard/.next/static/chunks/910628c23329a773.js +0 -1
  301. package/dashboard/.next/standalone/dashboard/.next/static/chunks/bdb50889a1c1ab37.js +0 -1
  302. package/dashboard/.next/standalone/dashboard/.next/static/chunks/d0bf5ccba09917dd.js +0 -1
  303. /package/dashboard/.next/standalone/dashboard/.next/static/{Jl7qLU_jMGBOmQt84tzX3 → GpAjC0YC0ARE4GOhhmhHQ}/_buildManifest.js +0 -0
  304. /package/dashboard/.next/standalone/dashboard/.next/static/{Jl7qLU_jMGBOmQt84tzX3 → GpAjC0YC0ARE4GOhhmhHQ}/_clientMiddlewareManifest.json +0 -0
  305. /package/dashboard/.next/standalone/dashboard/.next/static/{Jl7qLU_jMGBOmQt84tzX3 → GpAjC0YC0ARE4GOhhmhHQ}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27241,e=>{"use strict";let t,a,r,s,c;var i=e.i(27493),l=e.i(16871),n=e.i(4),o=e.i(53615),d=e.i(18509),x=e.i(24929);let m=(0,x.default)("radio-tower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);var p=e.i(27528),u=e.i(51069),v=e.i(46194),h=e.i(40950),g=e.i(22534),b=e.i(45688),y=e.i(71921),j=e.i(1235),f=e.i(88969);let N=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function w(){let e=await (0,f.authFetch)(`${N}/api/iron-dome/status`);if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to fetch Iron Dome status"));return e.json()}async function k(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e})});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to activate Iron Dome"));return t.json()}async function C(){let e=await (0,f.authFetch)(`${N}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to deactivate Iron Dome"));return e.json()}async function S(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to update Iron Dome configuration"));return t.json()}async function _(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to scan text"));return t.json()}async function A(){let e=await (0,f.authFetch)(`${N}/api/iron-dome/emergency-stop`,{method:"POST"});if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to trigger emergency stop"));return e.json()}async function E(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e||"Resumed via dashboard"})});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to resume operations"));return t.json()}async function P(){let e=await (0,f.authFetch)(`${N}/api/control/status`);if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to fetch control status"));return e.json()}async function L(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let a=await (0,f.authFetch)(`${N}/api/iron-dome/audit?${t}`);if(!a.ok)throw Error(await (0,f.readApiError)(a,"Failed to fetch Iron Dome audit"));return a.json()}function z(){return(0,b.useQuery)({queryKey:["iron-dome-status"],queryFn:w,refetchInterval:3e4,retry:2})}var F=e.i(87353);let $=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function T(e){let t=new URLSearchParams;e?.limit&&t.set("limit",String(e.limit)),e?.severity&&t.set("severity",e.severity),e?.outcome&&t.set("outcome",e.outcome),e?.tool&&t.set("tool",e.tool);let a=await (0,f.authFetch)(`${$}/api/v1/intercepts?${t}`);if(!a.ok)throw Error(await (0,f.readApiError)(a,"Failed to fetch interceptor events"));return a.json()}function I(e){return(0,b.useQuery)({queryKey:["interceptor-events",e],queryFn:()=>T(e),refetchInterval:3e4,retry:2})}var M=e.i(84982);let q=(0,x.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var R=e.i(15771),O=e.i(77715),D=e.i(66949),Q=e.i(71259);let K=(0,x.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),U=(0,x.default)("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),B=(0,x.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),V=(0,x.default)("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),H=(0,x.default)("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),J=(0,x.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),G=(0,x.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var W=e.i(77744),X=e.i(19711);let Z=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",Y=[{id:1,name:"Block API key patterns",priority:1,condition_type:"regex",condition_value:"sk-[a-zA-Z0-9]{32,}",action:"block",enabled:!0},{id:2,name:"Quarantine code injection",priority:2,condition_type:"regex",condition_value:"eval\\(|Function\\(",action:"quarantine",enabled:!0},{id:3,name:"Allow internal docs",priority:10,condition_type:"source",condition_value:"agent:docs-helper",action:"allow",enabled:!1}],ee=[{id:1,name:"Internal tool abuse",category:"tool_misuse",severity:"high",regex:"execute_tool\\(.*?delete|drop|truncate",description:"Detects attempts to use internal tools for destructive operations.",enabled:!0},{id:2,name:"PII exfiltration",category:"data_leak",severity:"critical",regex:"(SSN|social.security|\\d{3}-\\d{2}-\\d{4})",description:"Catches social security number patterns in agent memory writes.",enabled:!0},{id:3,name:"Prompt override attempt",category:"injection",severity:"medium",regex:"ignore.*(previous|above|prior).*instructions",description:"Detects common prompt injection override phrases.",enabled:!0}],et=[{id:1,name:"Strict Healthcare",description:"Blocks all PII patterns, requires approval for external actions, whitelists only HIPAA-compliant channels.",is_active:!0},{id:2,name:"Dev Sandbox",description:"Permissive mode for development. Allows all channels, logs but does not block. Ideal for testing.",is_active:!1}];function ea(){let e,t,a,{data:r,isLoading:s,isLocked:c}={...e=(0,b.useQuery)({queryKey:["custom-patterns"],queryFn:()=>(0,f.gatedFetch)(`${Z}/api/patterns`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom patterns");return e.json()}),retry:(e,t)=>!(t instanceof f.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof f.FeatureLockedError},l=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${Z}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-patterns"]})}})),o=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${Z}/api/patterns/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["custom-patterns"]})}})),d=(0,y.useMutation)({mutationFn:({id:e,text:t})=>(0,f.gatedFetch)(`${Z}/api/patterns/${e}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t})}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)}))}),[x,m]=(0,n.useState)(!1),[p,u]=(0,n.useState)(null),[v,h]=(0,n.useState)({name:"",category:"custom",severity:"medium",regex:"",description:""}),g=r?.patterns??[],N=!0,w="";if(v.regex)try{new RegExp(v.regex)}catch(e){N=!1,w=e.message}return c?(0,i.jsx)(er,{}):(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(q,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Injection Patterns"}),(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.length,"/50"]})]}),(0,i.jsxs)("button",{onClick:()=>m(!x),className:"flex items-center gap-1 px-2 py-1 text-xs bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] rounded hover:bg-[var(--sc-coral)]/30 transition-colors",children:[(0,i.jsx)(G,{size:12})," Add Pattern"]})]}),x&&(0,i.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate(v,{onSuccess:()=>{m(!1),h({name:"",category:"custom",severity:"medium",regex:"",description:""})}})},className:"p-3 bg-[var(--sc-bg-elevated)] rounded-lg space-y-2",children:[(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,i.jsx)("input",{value:v.name,onChange:e=>h(t=>({...t,name:e.target.value})),placeholder:"Pattern name",required:!0,className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsxs)("select",{value:v.severity,onChange:e=>h(t=>({...t,severity:e.target.value})),className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"critical",children:"Critical"}),(0,i.jsx)("option",{value:"high",children:"High"}),(0,i.jsx)("option",{value:"medium",children:"Medium"}),(0,i.jsx)("option",{value:"low",children:"Low"})]})]}),(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("input",{value:v.regex,onChange:e=>h(t=>({...t,regex:e.target.value})),placeholder:"Regex pattern",required:!0,className:`w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border rounded text-[var(--sc-text-primary)] font-mono placeholder:text-[var(--sc-text-muted)] ${N?"border-[var(--sc-border)]":"border-[var(--sc-coral)]"}`}),!N&&(0,i.jsx)("p",{className:"text-[10px] text-[var(--sc-coral)] mt-0.5",children:w})]}),(0,i.jsx)("input",{value:v.description,onChange:e=>h(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:"w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"submit",disabled:l.isPending||!N,className:"px-3 py-1 text-xs bg-[var(--sc-coral)] text-[var(--sc-text-primary)] rounded hover:bg-[var(--sc-coral)] disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,i.jsx)("button",{type:"button",onClick:()=>m(!1),className:"px-3 py-1 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]",children:"Cancel"})]}),l.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:l.error.message})]}),s?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:"Loading patterns..."}):0===g.length?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:'No custom patterns yet. Click "Add Pattern" to create one.'}):(0,i.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,i.jsxs)("div",{className:"px-3 py-2 bg-[var(--sc-bg-elevated)] rounded text-xs space-y-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1 font-medium",children:e.name}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity||"high"===e.severity?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"medium"===e.severity?"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]":"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)]"}`,children:e.severity}),(0,i.jsx)("button",{onClick:()=>u(p?.id===e.id?null:{id:e.id,text:""}),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-cyan)]",title:"Test pattern",children:(0,i.jsx)(J,{size:12})}),(0,i.jsx)("button",{onClick:()=>o.mutate(e.id),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-coral)]",children:(0,i.jsx)(W.Trash2,{size:12})})]}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] block truncate",children:e.regex}),p?.id===e.id&&(0,i.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,i.jsx)("input",{value:p.text,onChange:t=>u({id:e.id,text:t.target.value}),placeholder:"Test text...",className:"flex-1 px-2 py-1 text-[10px] bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsx)("button",{onClick:()=>d.mutate({id:e.id,text:p.text}),disabled:!p.text,className:"px-2 py-1 text-[10px] bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] rounded hover:bg-[var(--sc-cyan)]/30 disabled:opacity-50",children:"Test"}),d.data&&(0,i.jsxs)("span",{className:"text-[10px] text-[var(--sc-text-secondary)] self-center",children:[d.data.count," matches"]})]})]},e.id))})]})}function er(){return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(q,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Injection Patterns"}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:"0/50"})]}),(0,i.jsx)("div",{className:"space-y-1",children:ee.map(e=>(0,i.jsxs)("div",{className:"px-3 py-2 bg-[var(--sc-bg-elevated)] rounded text-xs space-y-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1 font-medium",children:e.name}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity||"high"===e.severity?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]"}`,children:e.severity})]}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] block truncate",children:e.regex})]},e.id))})]})}function es(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"custom_injection_patterns",label:"Define up to 50 custom regex patterns for detecting domain-specific threats.",children:(0,i.jsx)(ea,{})})})}var ec=e.i(16511);let ei=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function el(){let e,t,a,r,{data:s,isLoading:c,isLocked:l}={...e=(0,b.useQuery)({queryKey:["custom-policies"],queryFn:()=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom policies");return e.json()}),retry:(e,t)=>!(t instanceof f.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof f.FeatureLockedError},o=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-policies"]})}})),d=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["custom-policies"]})}})),x=(r=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies/${e}/activate`,{method:"PUT"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{r.invalidateQueries({queryKey:["custom-policies"]})}})),[m,u]=(0,n.useState)(!1),[v,h]=(0,n.useState)({name:"",description:""}),g=s?.policies??[];return l?(0,i.jsx)(en,{}):(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(p.Shield,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Iron Dome Policies"}),(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.length,"/10"]})]}),(0,i.jsxs)("button",{onClick:()=>u(!m),className:"flex items-center gap-1 px-2 py-1 text-xs bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] rounded hover:bg-[var(--sc-coral)]/30 transition-colors",children:[(0,i.jsx)(G,{size:12})," Create Policy"]})]}),m&&(0,i.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.mutate({name:v.name,description:v.description,config:{}},{onSuccess:()=>{u(!1),h({name:"",description:""})}})},className:"p-3 bg-[var(--sc-bg-elevated)]/50 rounded-lg space-y-2",children:[(0,i.jsx)("input",{value:v.name,onChange:e=>h(t=>({...t,name:e.target.value})),placeholder:"Policy name",required:!0,className:"w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsx)("textarea",{value:v.description,onChange:e=>h(t=>({...t,description:e.target.value})),placeholder:"Description",rows:2,className:"w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)] resize-none"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"submit",disabled:o.isPending,className:"px-3 py-1 text-xs bg-[var(--sc-coral)] text-[var(--sc-text-primary)] rounded hover:bg-[var(--sc-coral)] disabled:opacity-50",children:o.isPending?"Creating...":"Create"}),(0,i.jsx)("button",{type:"button",onClick:()=>u(!1),className:"px-3 py-1 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]",children:"Cancel"})]}),o.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:o.error.message})]}),c?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:"Loading policies..."}):0===g.length?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:'No custom policies yet. Click "Create Policy" to get started.'}):(0,i.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:[(0,i.jsxs)("div",{className:"flex-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] font-medium",children:e.name}),1===e.is_active&&(0,i.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] text-[10px] font-medium",children:"Active"})]}),e.description&&(0,i.jsx)("p",{className:"text-[var(--sc-text-muted)] text-[10px] mt-0.5",children:e.description})]}),!e.is_active&&(0,i.jsxs)("button",{onClick:()=>x.mutate(e.id),className:"flex items-center gap-1 px-2 py-1 text-[10px] bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] rounded hover:bg-[var(--sc-cyan)]/30",title:"Set active",children:[(0,i.jsx)(ec.Check,{size:10})," Activate"]}),(0,i.jsx)("button",{onClick:()=>d.mutate(e.id),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-coral)]",children:(0,i.jsx)(W.Trash2,{size:12})})]},e.id))})]})}function en(){return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(p.Shield,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Iron Dome Policies"}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:"0/10"})]}),(0,i.jsx)("div",{className:"space-y-1",children:et.map(e=>(0,i.jsx)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:(0,i.jsxs)("div",{className:"flex-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] font-medium",children:e.name}),e.is_active&&(0,i.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] text-[10px] font-medium",children:"Active"})]}),(0,i.jsx)("p",{className:"text-[var(--sc-text-muted)] text-[10px] mt-0.5",children:e.description})]})},e.id))})]})}function eo(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)]/50 border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"custom_iron_dome_policies",label:"Create custom Iron Dome policies with tailored action gates and trust levels.",children:(0,i.jsx)(el,{})})})}let ed=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:p.Shield},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:D.Lock},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:B},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:d.AlertTriangle}],ex=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:V},{name:"Instruction Gateway",description:"Trusted channel validation",icon:K},{name:"Action Gate",description:"Approve / block external actions",icon:D.Lock},{name:"PII Guard",description:"Block sensitive data output",icon:Q.Eye},{name:"Kill Switch",description:"Emergency stop phrase",icon:U},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:B}],em={critical:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] border-[var(--sc-coral)]/30",high:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] border-[var(--sc-coral)]/30",medium:"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)] border-[var(--sc-amber)]/30",low:"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)] border-[var(--sc-border)]/30"},ep={CRITICAL:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]",HIGH:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]",MEDIUM:"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]",LOW:"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)]",NONE:"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]"};function eu(){let e,t,a,r,s,{data:c,isLoading:l}=z(),{data:o}=(0,b.useQuery)({queryKey:["iron-dome-audit",50],queryFn:()=>L(50),refetchInterval:3e4,retry:2}),d=(e=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>k(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),x=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:C,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),m=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>S(e),onSuccess:()=>{a.invalidateQueries({queryKey:["iron-dome-status"]}),a.invalidateQueries({queryKey:["iron-dome-audit"]})}})),u=(0,y.useMutation)({mutationFn:_}),v=(r=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:A,onSuccess:()=>{r.invalidateQueries({queryKey:["iron-dome-status"]}),r.invalidateQueries({queryKey:["iron-dome-audit"]}),r.invalidateQueries({queryKey:["control-status"]})}})),h=(s=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>E(e),onSuccess:()=>{s.invalidateQueries({queryKey:["control-status"]}),s.invalidateQueries({queryKey:["iron-dome-status"]}),s.invalidateQueries({queryKey:["iron-dome-audit"]})}})),{data:g}=(0,b.useQuery)({queryKey:["control-status"],queryFn:P,refetchInterval:5e3,retry:2}),[f,N]=(0,n.useState)(""),[w,F]=(0,n.useState)(null),[$,T]=(0,n.useState)(""),I=c?.enabled??!1,D=g?.killSwitchActive??!1,Q=g?.killSwitchMeta??null,K=c?.profile,B=c?.config,G=B?.killPhrase??"",[W,X]=(0,n.useState)(G),[Z,Y]=(0,n.useState)(G);G!==Z&&(Y(G),X(G));let ee=o?.logs??[],et=ee.filter(e=>"BLOCK"===e.firewall_result).length,ea=ee.filter(e=>"ALLOW"===e.firewall_result).length,er=!!B&&W.trim()!==(B?.killPhrase??"");return(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[l?(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)] animate-pulse",children:"Loading..."}):(0,i.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${I?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] border border-[var(--sc-coral)]/30":"bg-[var(--sc-bg-elevated)]/50 text-[var(--sc-text-muted)]"}`,children:I?"ACTIVE":"INACTIVE"}),I&&(0,i.jsxs)("button",{onClick:()=>{x.mutate()},disabled:x.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-[var(--sc-coral)]/10 border border-[var(--sc-coral)]/30 hover:bg-[var(--sc-coral)]/20 disabled:opacity-50 rounded-lg text-xs font-medium text-[var(--sc-coral)] transition-colors",children:[x.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(U,{size:12}),"Deactivate"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:"Security Profiles"}),(0,i.jsx)("div",{className:"grid grid-cols-2 gap-2",children:ed.map(({id:e,label:t,description:a,icon:r})=>(0,i.jsxs)("button",{onClick:()=>{d.mutate(e)},disabled:d.isPending,className:`text-left p-3 rounded-lg border transition-colors ${K===e?"border-[var(--sc-coral)]/50 bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]":"border-[var(--sc-border)] bg-[var(--sc-bg-elevated)]/50 text-[var(--sc-text-secondary)] hover:border-[var(--sc-text-muted)]"}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,i.jsx)(r,{size:12}),(0,i.jsx)("span",{className:"text-xs font-medium",children:t})]}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:a})]},e))})]}),(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:"Module Status"}),(0,i.jsx)("div",{className:"space-y-2",children:ex.map(({name:e,description:t,icon:a})=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-[var(--sc-bg-elevated)]/50",children:[(0,i.jsx)(a,{size:14,className:I?"text-[var(--sc-coral)]":"text-[var(--sc-text-muted)]"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("div",{className:"text-xs font-medium text-[var(--sc-text-primary)]",children:e}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] truncate",children:t})]}),(0,i.jsx)("span",{className:`w-2 h-2 rounded-full ${I?"bg-[var(--sc-coral)]":"bg-[var(--sc-text-muted)]"}`})]},e))})]})]}),B&&(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:"Active Configuration"}),(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] uppercase mb-1",children:"Trusted Channels"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:B.trustedChannels.map(e=>(0,i.jsx)("span",{className:"px-1.5 py-0.5 bg-[var(--sc-bg-elevated)] rounded text-[var(--sc-text-secondary)]",children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] uppercase mb-1",children:"Requires Approval"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:B.requireApproval.map(e=>(0,i.jsx)("span",{className:"px-1.5 py-0.5 bg-[var(--sc-coral)]/10 border border-[var(--sc-coral)]/20 rounded text-[var(--sc-coral)]",children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] uppercase mb-1",children:"Kill Phrase"}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)("input",{type:"text",value:W,onChange:e=>X(e.target.value),placeholder:"Set emergency stop phrase",className:"w-full bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] rounded-lg px-3 py-2 text-xs text-[var(--sc-text-primary)] font-mono placeholder:text-[var(--sc-text-muted)] focus:outline-none focus:ring-1 focus:ring-[var(--sc-coral)]"}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("button",{onClick:()=>m.mutate({killPhrase:W.trim()}),disabled:m.isPending||!W.trim()||!er,className:"px-3 py-1.5 rounded-lg bg-[var(--sc-coral)] hover:bg-[var(--sc-coral)]/80 disabled:opacity-50 text-[11px] font-medium text-[var(--sc-text-primary)] transition-colors",children:m.isPending?"Saving...":"Save phrase"}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:I?"Say this in a conversation to trigger lockdown.":"This will apply the next time Iron Dome is active."})]})]})]})]})]}),D?(0,i.jsxs)("div",{className:"glass-card-strong p-6 border-2 !border-[var(--sc-coral)]/50 animate-pulse-slow",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,i.jsx)(H,{size:18,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-bold text-[var(--sc-coral)] uppercase tracking-wide",children:"Kill Switch Active"}),(0,i.jsx)("span",{className:"ml-auto text-[10px] bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] px-2 py-0.5 rounded-full border border-[var(--sc-coral)]/30",children:"LOCKDOWN"})]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]/80 mb-2",children:"All agent operations are blocked. No memory reads, writes, graph queries, or consolidation. Iron Dome remains active and continues protecting."}),Q&&(0,i.jsxs)("div",{className:"bg-[var(--sc-coral)]/10 border border-[var(--sc-coral)]/20 rounded-lg p-3 mb-4 space-y-1",children:[(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)("span",{className:"text-[var(--sc-coral)] font-medium",children:"Triggered:"})," ",new Date(Q.triggeredAt).toLocaleString()]}),(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)("span",{className:"text-[var(--sc-coral)] font-medium",children:"Source:"})," ","kill_phrase"===Q.source?`Kill phrase "${Q.phrase}"`:"manual"===Q.source?"Manual (dashboard)":"mcp_tool"===Q.source?"MCP tool":Q.source]}),void 0!==Q.memoryCountAtTrigger&&(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)("span",{className:"text-[var(--sc-coral)] font-medium",children:"Memories at trigger:"})," ",Q.memoryCountAtTrigger]})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)("input",{type:"text",value:$,onChange:e=>T(e.target.value),placeholder:"Reason for resuming (required)...",className:"w-full bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] rounded-lg px-3 py-2 text-xs text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)] focus:outline-none focus:ring-1 focus:ring-green-500"}),(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsxs)("button",{onClick:()=>{$.trim()&&(h.mutate($.trim()),T(""))},disabled:h.isPending||!$.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-[var(--sc-cyan)] hover:bg-[var(--sc-cyan-mid)] disabled:opacity-50 rounded-lg text-xs font-medium text-[var(--sc-text-primary)] transition-colors",children:[h.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(J,{size:12}),"Resume Agent"]}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Only resume after you've investigated the threat"})]})]})]}):(0,i.jsxs)("div",{className:"glass-card p-6 !border-[var(--sc-coral)]/30",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,i.jsx)(H,{size:14,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-coral)]",children:"Emergency Stop"})]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-secondary)] mb-3",children:"Immediately halts your agent when you suspect it has been compromised or is acting on poisoned data. Blocks ALL operations — no reads, writes, or modifications. Iron Dome stays active."}),B?.killPhrase&&(0,i.jsxs)("p",{className:"text-[10px] text-[var(--sc-text-muted)] mb-3",children:["Kill phrase: ",(0,i.jsxs)("span",{className:"font-mono text-[var(--sc-text-secondary)]",children:['"',B.killPhrase,'"']})," — say this in conversation for hands-free stop"]}),(0,i.jsxs)("button",{onClick:()=>v.mutate(),disabled:v.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-[var(--sc-coral)] hover:bg-[var(--sc-coral)]/80 disabled:opacity-50 rounded-lg text-xs font-bold text-[var(--sc-text-primary)] uppercase tracking-wider transition-colors",children:[v.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(H,{size:14}),"Emergency Stop"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsxs)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:[(0,i.jsx)(V,{size:14,className:"inline mr-1.5 text-[var(--sc-coral)]"}),"Injection Scanner"]}),(0,i.jsx)("textarea",{value:f,onChange:e=>N(e.target.value),placeholder:"Paste suspicious text to scan for injection patterns...",className:"w-full h-28 bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] rounded-lg p-3 text-sm text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)] resize-none focus:outline-none focus:ring-1 focus:ring-[var(--sc-coral)] focus:border-[var(--sc-coral)]"}),(0,i.jsxs)("button",{onClick:()=>{f.trim()&&u.mutate(f,{onSuccess:e=>F(e)})},disabled:u.isPending||!f.trim(),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 bg-[var(--sc-coral)] hover:bg-[var(--sc-coral)]/80 disabled:opacity-50 rounded-lg text-xs font-medium text-[var(--sc-text-primary)] transition-colors",children:[u.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(q,{size:12}),"Scan"]}),w&&(0,i.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[w.clean?(0,i.jsx)(R.CheckCircle2,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(O.XCircle,{size:14,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${ep[w.riskLevel]??"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)]"}`,children:w.riskLevel}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-secondary)]",children:w.summary})]}),w.detections.map((e,t)=>(0,i.jsxs)("div",{className:`border rounded-lg p-3 ${em[e.severity]??"border-[var(--sc-border)]"}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,i.jsx)("span",{className:"text-[10px] font-medium uppercase",children:e.severity}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-primary)]",children:e.category.replace(/_/g," ")})]}),(0,i.jsx)("p",{className:"text-[11px] text-[var(--sc-text-secondary)] mb-1",children:e.description}),(0,i.jsx)("code",{className:"text-[10px] text-[var(--sc-text-muted)] bg-[var(--sc-bg-elevated)] px-1.5 py-0.5 rounded block truncate",children:e.match})]},t))]})]}),(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Event Feed"}),(0,i.jsxs)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:["Last ",ee.length," events"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)]/50 rounded-lg p-2 text-center",children:[(0,i.jsx)("div",{className:"text-sm font-bold text-[var(--sc-text-primary)]",children:ee.length}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Total"})]}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)]/50 rounded-lg p-2 text-center",children:[(0,i.jsx)("div",{className:"text-sm font-bold text-[var(--sc-coral)]",children:et}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Blocked"})]}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)]/50 rounded-lg p-2 text-center",children:[(0,i.jsx)("div",{className:"text-sm font-bold text-[var(--sc-cyan)]",children:ea}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Allowed"})]})]}),(0,i.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===ee.length?(0,i.jsxs)("div",{className:"text-center py-6",children:[(0,i.jsx)(p.Shield,{size:20,className:"text-[var(--sc-text-muted)] mx-auto mb-1.5"}),(0,i.jsx)("p",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"No Iron Dome events yet"})]}):ee.map((e,t)=>(0,i.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-[var(--sc-bg-elevated)]/50 text-xs",children:[(0,i.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===e.firewall_result?"bg-[var(--sc-coral)]":"bg-[var(--sc-cyan)]"}`}),(0,i.jsx)("span",{className:"text-[var(--sc-text-secondary)] truncate flex-1",children:(e.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)] shrink-0",children:new Date(e.timestamp).toLocaleTimeString()})]},e.id??t))})]})]}),(0,i.jsx)(es,{}),(0,i.jsx)(eo,{})]})}var ev=e.i(42098);let eh=(0,x.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var eg=e.i(13808);let eb=(0,x.default)("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]),ey=(0,x.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);var ej=e.i(17278);let ef=(0,x.default)("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),eN=(0,x.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),ew=(0,x.default)("square-minus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);function ek({action:e,item:t,onConfirm:a,onCancel:r}){let[s,c]=(0,n.useState)(""),l="yes"===s.trim().toLowerCase(),o="memory_file"===t.source_type;return(0,i.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-6 max-w-md w-full mx-4",children:[(0,i.jsxs)("h3",{className:"text-sm font-semibold text-[var(--sc-text-primary)] mb-2",children:["approve"===e?"Approve":"Reject"," quarantined item?"]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-secondary)] mb-1",children:(0,i.jsx)("strong",{children:t.title||"Untitled"})}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-muted)] mb-4",children:"approve"===e?o?"This will mark the memory-file finding as reviewed. The source file is not modified.":"This will approve the item and promote it into memory.":o?"This will dismiss the memory-file finding. The source file is not deleted or edited.":"This will permanently discard the memory."}),(0,i.jsxs)("div",{className:"mb-4",children:[(0,i.jsxs)("label",{className:"text-xs text-[var(--sc-text-secondary)] block mb-1",children:["Type ",(0,i.jsx)("strong",{className:"text-[var(--sc-text-primary)]",children:"YES"})," to confirm:"]}),(0,i.jsx)("input",{type:"text",value:s,onChange:e=>c(e.target.value),className:"w-full bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] text-[var(--sc-text-primary)] text-sm rounded-lg px-3 py-2 focus:ring-[var(--sc-cyan)] focus:border-[var(--sc-cyan)]",autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&l&&a(),"Escape"===e.key&&r()}})]}),(0,i.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,i.jsx)("button",{onClick:r,className:"px-3 py-1.5 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)] transition-colors",children:"Cancel"}),(0,i.jsx)("button",{onClick:a,disabled:!l,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${l?"approve"===e?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-cyan-mid)]":"bg-[var(--sc-coral)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-coral-mid)]":"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-muted)] cursor-not-allowed"}`,children:"approve"===e&&o?"Mark reviewed":"approve"===e?"Approve":"Reject"})]})]})})}function eC({annotation:e}){var t;return(0,i.jsxs)("div",{className:"mb-3 rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)]/70 p-3",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--sc-cyan)]",children:[(0,i.jsx)(eh,{size:12})," Local AI Explainer"]}),(0,i.jsx)("span",{className:"rounded border border-[var(--sc-border)] px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] text-[var(--sc-text-secondary)]",children:e.category.replace(/_/g," ")}),(0,i.jsx)("span",{className:`rounded border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] ${"approve"===(t=e.suggestedAction)?"text-[var(--sc-cyan)] bg-[var(--sc-cyan)]/10 border-[var(--sc-cyan)]/25":"reject"===t?"text-[var(--sc-coral)] bg-[var(--sc-coral)]/10 border-[var(--sc-coral)]/25":"create_rule"===t?"text-[var(--sc-amber)] bg-[var(--sc-amber)]/10 border-[var(--sc-amber)]/25":"text-[var(--sc-text-secondary)] bg-[var(--sc-surface-interactive)] border-[var(--sc-border)]"}`,children:e.suggestedAction.replace(/_/g," ")}),(0,i.jsxs)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[Math.round(100*e.confidence),"% confidence"]}),e.similarGroupKey&&(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(eb,{size:11})," ",e.similarGroupKey]})]}),(0,i.jsx)("p",{className:"mt-2 text-xs leading-5 text-[var(--sc-text-primary)]",children:e.summary}),(0,i.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-[var(--sc-text-secondary)]",children:e.reasoning}),e.evidence.length>0&&(0,i.jsx)("div",{className:"mt-2 space-y-1.5",children:e.evidence.map((e,t)=>(0,i.jsxs)("div",{className:"rounded border border-[var(--sc-border)] bg-[var(--sc-bg-surface)] px-2 py-1.5",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:e.reason}),(0,i.jsxs)("div",{className:"mt-0.5 text-[11px] text-[var(--sc-text-primary)] break-words",children:['"',e.snippet,'"']})]},`${e.snippet}-${t}`))})]})}function eS(){let{projectFilter:e}=(0,ev.useDashboardStore)(),[t,a]=(0,n.useState)("pending"),{data:r,isLoading:s}=(0,F.useQuarantine)(t,100,e||void 0),{data:c}=(0,F.useReviewCopilotStatus)(),l=(0,F.useApproveQuarantine)(),o=(0,F.useRejectQuarantine)(),x=(0,F.useBulkApproveQuarantine)(),m=(0,F.useBulkRejectQuarantine)(),p=(0,F.useAnnotateQuarantine)(),u=(0,F.useAnnotatePendingQuarantine)(),[v,h]=(0,n.useState)(null),[g,b]=(0,n.useState)(new Set),[y,j]=(0,n.useState)(null),f=l.error?.message||o.error?.message||x.error?.message||m.error?.message||p.error?.message||u.error?.message||null,N=r?.items??[],w=N.filter(e=>"pending"===e.status),k=N.filter(e=>e.annotation),C=w.filter(e=>!e.annotation),S=w.filter(e=>g.has(e.id)).filter(e=>"memory_file"===e.source_type).length,_=(()=>{let e=new Map;for(let t of k){let a=t.annotation?.similarGroupKey;a&&e.set(a,(e.get(a)??0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,3)})(),A=w.length>0&&w.every(e=>g.has(e.id)),E=w.some(e=>g.has(e.id)),P=p.isPending||u.isPending,L=!!(c?.enabled&&c.featureEnabled&&c.modelCached);return(0,i.jsxs)("div",{className:"space-y-6",children:[v&&(0,i.jsx)(ek,{action:v.action,item:v.item,onConfirm:()=>{v&&("approve"===v.action?l.mutate(v.item.id):o.mutate({id:v.item.id}),h(null))},onCancel:()=>h(null)}),y&&(0,i.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-6 max-w-md w-full mx-4",children:[(0,i.jsxs)("h3",{className:"text-sm font-semibold text-[var(--sc-text-primary)] mb-2",children:["approve"===y?"Approve":"Reject"," ",g.size," item",1!==g.size?"s":"","?"]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-secondary)] mb-4",children:"approve"===y?S>0?"Memory-file findings will be marked reviewed without editing files. Other selected items will be promoted into memory.":"This will approve all selected items and promote them into memory.":S>0?"Memory-file findings will be dismissed without editing files. Other selected memories will be discarded.":"This will permanently discard all selected memories."}),(0,i.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,i.jsx)("button",{onClick:()=>j(null),className:"px-3 py-1.5 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)] transition-colors",children:"Cancel"}),(0,i.jsxs)("button",{onClick:()=>{if(!y||0===g.size)return;let e=Array.from(g);"approve"===y?x.mutate(e):m.mutate(e),b(new Set),j(null)},className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${"approve"===y?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-cyan-mid)]":"bg-[var(--sc-coral)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-coral-mid)]"}`,children:["approve"===y?"Approve":"Reject"," ",g.size," item",1!==g.size?"s":""]})]})]})}),(0,i.jsx)(X.ProFeatureGate,{feature:"local_ai_explainer",label:"Use a local model to explain and group quarantined items without sending content to the cloud.",children:(0,i.jsx)("div",{className:"glass-card p-5",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-[var(--sc-text-primary)]",children:[(0,i.jsx)(eg.Sparkles,{size:16,className:"text-[var(--sc-cyan)]"}),"Local AI Explainer"]}),(0,i.jsx)("span",{className:`rounded border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] ${c?.enabled?"border-[var(--sc-cyan)]/25 bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]":"border-[var(--sc-border)] bg-[var(--sc-surface-interactive)] text-[var(--sc-text-muted)]"}`,children:c?.enabled?"enabled":"disabled"}),(0,i.jsx)("span",{className:`rounded border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] ${c?.modelCached?"border-[var(--sc-cyan)]/25 bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]":"border-[var(--sc-border)] bg-[var(--sc-surface-interactive)] text-[var(--sc-text-muted)]"}`,children:c?.modelCached?"model cached":"model not cached"})]}),(0,i.jsx)("div",{className:"mt-2 text-xs leading-5 text-[var(--sc-text-secondary)]",children:c?.enabled?c.modelCached?"Explain unreviewed quarantine items locally; approve and reject decisions stay manual.":"Download the local model first: shieldcortex review-copilot download-model":"Enable from the CLI first: shieldcortex review-copilot enable"}),(0,i.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsxs)("span",{className:C.length>0?"text-[var(--sc-amber)]":"",children:[C.length," need explanation"]}),(0,i.jsxs)("span",{children:[k.length," explained in this view"]}),_.map(([e,t])=>(0,i.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,i.jsx)(eb,{size:11})," ",e,": ",t]},e))]})]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,i.jsxs)("button",{onClick:()=>{u.mutate({limit:Math.min(Math.max(C.length,1),100),project:e||void 0})},disabled:!L||P||0===C.length,className:"inline-flex items-center gap-1.5 rounded-lg bg-[var(--sc-cyan)]/10 px-3 py-1.5 text-xs font-semibold text-[var(--sc-cyan)] transition-colors hover:bg-[var(--sc-cyan)]/20 disabled:pointer-events-none disabled:opacity-45",children:[u.isPending?(0,i.jsx)(M.Loader2,{size:13,className:"animate-spin"}):(0,i.jsx)(ey,{size:13}),"Explain all"]})})]})})}),(0,i.jsxs)("div",{className:"glass-card p-5",children:[(0,i.jsx)("div",{className:"flex items-center justify-between",children:(0,i.jsx)("div",{className:"flex gap-1 bg-[var(--sc-bg-elevated)] rounded-lg p-0.5",children:["pending","approved","rejected"].map(e=>(0,i.jsx)("button",{onClick:()=>{a(e),b(new Set)},className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${t===e?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)]":"text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:e},e))})}),"pending"===t&&w.length>0&&(0,i.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,i.jsxs)("button",{onClick:()=>{A?b(new Set):b(new Set(w.map(e=>e.id)))},className:"flex items-center gap-1.5 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)] transition-colors",children:[A?(0,i.jsx)(ef,{size:14,className:"text-[var(--sc-cyan)]"}):E?(0,i.jsx)(ew,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(eN,{size:14}),A?"Deselect all":"Select all"]}),E&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.size," selected"]}),(0,i.jsxs)("button",{onClick:()=>j("approve"),className:"flex items-center gap-1 px-2.5 py-1 text-xs bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)] rounded-lg hover:bg-[var(--sc-cyan)]/20 transition-colors",children:[(0,i.jsx)(ec.Check,{size:12})," Approve"]}),(0,i.jsxs)("button",{onClick:()=>j("reject"),className:"flex items-center gap-1 px-2.5 py-1 text-xs bg-[var(--sc-coral)]/10 text-[var(--sc-coral)] rounded-lg hover:bg-[var(--sc-coral)]/20 transition-colors",children:[(0,i.jsx)(ej.X,{size:12})," Reject"]})]})]})]}),f&&(0,i.jsx)("div",{className:"glass-card p-5 border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 text-sm text-[var(--sc-coral)]",children:f}),(0,i.jsx)("div",{children:s?(0,i.jsx)("div",{className:"glass-card p-5 flex items-center justify-center h-32",children:(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] animate-pulse",children:"Loading quarantine items..."})}):0===N.length?(0,i.jsxs)("div",{className:"glass-card p-5 flex flex-col items-center justify-center h-32 text-[var(--sc-text-muted)]",children:[(0,i.jsx)(d.AlertTriangle,{size:24,className:"mb-2 text-[var(--sc-text-muted)]"}),(0,i.jsxs)("span",{className:"text-xs",children:["No ",t," items"]})]}):(0,i.jsx)("div",{className:"space-y-3",children:N.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})(),a="memory_file"===e.source_type;return(0,i.jsxs)("div",{className:`glass-card p-5 ${g.has(e.id)?"border-[var(--sc-cyan)]/50":"pending"===e.status&&!e.annotation?"border-[var(--sc-amber)]/35":""}`,children:[(0,i.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,i.jsxs)("div",{className:"flex items-start gap-2.5",children:["pending"===e.status&&(0,i.jsx)("button",{onClick:()=>{var t;return t=e.id,void b(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a})},className:"mt-0.5 text-[var(--sc-text-muted)] hover:text-[var(--sc-cyan)] transition-colors shrink-0",children:g.has(e.id)?(0,i.jsx)(ef,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(eN,{size:14})}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("h4",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:e.title||"Untitled"}),"pending"===e.status&&!e.annotation&&(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-[var(--sc-amber)]/25 bg-[var(--sc-amber)]/10 px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.12em] text-[var(--sc-amber)]",children:[(0,i.jsx)(eh,{size:10})," Needs explanation"]})]}),(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)] mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleString(),e.anomaly_score>0&&(0,i.jsxs)("span",{className:`ml-2 ${e.anomaly_score>.5?"text-[var(--sc-coral)]":"text-[var(--sc-amber)]"}`,children:["Anomaly: ",e.anomaly_score.toFixed(2)]})]}),a&&(0,i.jsx)("div",{className:"mt-1 break-all font-mono text-[10px] text-[var(--sc-text-muted)]",children:e.source_identifier})]})]}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-coral)] bg-[var(--sc-coral)]/10 px-2 py-0.5 rounded",children:e.reason?.slice(0,50)||"Threat detected"})]}),(0,i.jsx)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3 mb-3 text-xs text-[var(--sc-text-primary)] whitespace-pre-wrap break-words",children:e.content?.slice(0,500)||"No content"}),t.length>0&&(0,i.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:t.map((e,t)=>(0,i.jsx)("span",{className:"text-[9px] text-[var(--sc-amber)] bg-[var(--sc-amber)]/10 px-1.5 py-0.5 rounded",children:e},t))}),e.annotation&&(0,i.jsx)(eC,{annotation:e.annotation}),"pending"===e.status&&(0,i.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,i.jsxs)("button",{onClick:()=>p.mutate(e.id),disabled:!L||p.isPending||u.isPending,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--sc-bg-elevated)] text-[var(--sc-text-secondary)] border border-[var(--sc-border)] rounded-lg hover:text-[var(--sc-cyan)] transition-colors disabled:pointer-events-none disabled:opacity-45",children:[p.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(ey,{size:12}),e.annotation?"Re-explain":"Explain"]}),(0,i.jsxs)("button",{onClick:()=>h({action:"approve",item:e}),disabled:l.isPending||x.isPending,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)] rounded-lg hover:bg-[var(--sc-cyan)]/20 transition-colors",children:[(0,i.jsx)(ec.Check,{size:12})," ",a?"Mark reviewed":"Approve"]}),(0,i.jsxs)("button",{onClick:()=>h({action:"reject",item:e}),disabled:o.isPending||m.isPending,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--sc-coral)]/10 text-[var(--sc-coral)] rounded-lg hover:bg-[var(--sc-coral)]/20 transition-colors",children:[(0,i.jsx)(ej.X,{size:12})," Reject"]})]}),e.reviewed_at&&(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:["approved"===e.status?"Approved":"Rejected"," by ",e.reviewed_by," at ",new Date(e.reviewed_at).toLocaleString()]})]},e.id)})})})]})}let e_=(0,x.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),eA=(0,x.default)("file-braces",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);var eE=e.i(75025);let eP=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function eL(){let e=(0,y.useMutation)({mutationFn:async({format:e,startTime:t,endTime:a})=>{let r=new URLSearchParams({format:e});t&&r.set("startTime",t),a&&r.set("endTime",a);let s=await (0,f.gatedFetch)(`${eP}/api/audit/export?${r}`);if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Export failed");let c=await s.blob(),i=URL.createObjectURL(c),l=document.createElement("a");return l.href=i,l.download=`shieldcortex-audit-${Date.now()}.${"csv"===e?"csv":"json"}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(i),200),{success:!0}}}),[t,a]=(0,n.useState)("json");return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(e_,{size:16,className:"text-[var(--sc-cyan)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Export Audit Logs"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsxs)("div",{className:"flex rounded-lg overflow-hidden border border-[var(--sc-border)]",children:[(0,i.jsxs)("button",{onClick:()=>a("json"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"json"===t?"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]":"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:[(0,i.jsx)(eA,{size:12})," JSON"]}),(0,i.jsxs)("button",{onClick:()=>a("csv"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"csv"===t?"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]":"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:[(0,i.jsx)(eE.FileText,{size:12})," CSV"]})]}),(0,i.jsxs)("button",{onClick:()=>e.mutate({format:t}),disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-1.5 text-xs bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] rounded-lg hover:bg-[var(--sc-cyan)] disabled:opacity-50 transition-colors",children:[(0,i.jsx)(e_,{size:12}),e.isPending?"Exporting...":"Export"]})]}),e.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:e.error.message}),e.isSuccess&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-cyan)]",children:"Export downloaded successfully."})]})}function ez(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"audit_export",label:"Export your full audit trail as JSON or CSV for compliance reporting.",children:(0,i.jsx)(eL,{})})})}var eF=e.i(76490);function e$({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"card",className:(0,eF.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function eT({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"card-header",className:(0,eF.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function eI({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"card-content",className:(0,eF.cn)("px-6",e),...t})}function eM(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var eq=Symbol.for("react.lazy"),eR=n[" use ".trim().toString()];function eO(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===eq&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var eD=((c=n.forwardRef((e,t)=>{let{children:a,...r}=e;if(eO(a)&&"function"==typeof eR&&(a=eR(a._payload)),n.isValidElement(a)){var s;let e,c,i=(s=a,(c=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(c=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),l=function(e,t){let a={...t};for(let r in t){let s=e[r],c=t[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...e)=>{let t=c(...e);return s(...e),t}:s&&(a[r]=s):"style"===r?a[r]={...s,...c}:"className"===r&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...e,...a}}(r,a.props);return a.type!==n.Fragment&&(l.ref=t?function(...e){return t=>{let a=!1,r=e.map(e=>{let r=eM(e,t);return a||"function"!=typeof r||(a=!0),r});if(a)return()=>{for(let t=0;t<r.length;t++){let a=r[t];"function"==typeof a?a():eM(e[t],null)}}}}(t,i):i),n.cloneElement(a,l)}return n.Children.count(a)>1?n.Children.only(null):null})).displayName="Slot.SlotClone",t=c,(a=n.forwardRef((e,a)=>{let{children:r,...s}=e;eO(r)&&"function"==typeof eR&&(r=eR(r._payload));let c=n.Children.toArray(r),l=c.find(eK);if(l){let e=l.props.children,r=c.map(t=>t!==l?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,i.jsx)(t,{...s,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,r):null})}return(0,i.jsx)(t,{...s,ref:a,children:r})})).displayName="Slot.Slot",a),eQ=Symbol("radix.slottable");function eK(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===eQ}var eU=e.i(2941);let eB=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,eV=eU.clsx,eH=(r="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",s={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-[var(--sc-text-primary)] hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},e=>{var t;if((null==s?void 0:s.variants)==null)return eV(r,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:a,defaultVariants:c}=s,i=Object.keys(a).map(t=>{let r=null==e?void 0:e[t],s=null==c?void 0:c[t];if(null===r)return null;let i=eB(r)||eB(s);return a[t][i]}),l=e&&Object.entries(e).reduce((e,t)=>{let[a,r]=t;return void 0===r||(e[a]=r),e},{});return eV(r,i,null==s||null==(t=s.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:a,className:r,...s}=t;return Object.entries(s).every(e=>{let[t,a]=e;return Array.isArray(a)?a.includes({...c,...l}[t]):({...c,...l})[t]===a})?[...e,a,r]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function eJ({className:e,variant:t="default",size:a="default",asChild:r=!1,...s}){return(0,i.jsx)(r?eD:"button",{"data-slot":"button","data-variant":t,"data-size":a,className:(0,eF.cn)(eH({variant:t,size:a,className:e})),...s})}var eG=e.i(76624),eW=e.i(23457),eX=e.i(44250),eZ=e.i(45256);let eY={ALLOW:{color:"#22C55E",bg:"rgba(34, 197, 94, 0.15)",label:"Allowed"},BLOCK:{color:"#EF4444",bg:"rgba(239, 68, 68, 0.15)",label:"Blocked"},QUARANTINE:{color:"#EAB308",bg:"rgba(234, 179, 8, 0.15)",label:"Quarantined"}},e0={PUBLIC:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"},INTERNAL:{color:"#60a5fa",bg:"rgba(96, 165, 250, 0.15)"},CONFIDENTIAL:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},RESTRICTED:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"}},e1={instruction_injection:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},privilege_escalation:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},credential_leak:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},encoding_obfuscation:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},fragmented_payload:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},external_url:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},pipeline_error:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"}};function e2(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function e5(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function e4({entry:e,onClose:t,onViewMemory:a}){let r,[s,c]=(0,n.useState)(!1),l=(0,eW.useLocalAiExplain)(),o=eY[e.firewall_result]||eY.ALLOW,d=e0[e.sensitivity_level]||e0.PUBLIC,x=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),m=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.blocked_patterns),p=(0,n.useCallback)(()=>{let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})},[e]),u=(0,n.useCallback)(()=>{l.mutate({kind:"audit_event",title:`${e.firewall_result} audit event`,content:[`Audit ID: ${e.id}`,`Result: ${e.firewall_result}`,`Source: ${e.source_type}:${e.source_identifier}`,e.project?`Project: ${e.project}`:"",`Trust score: ${e.trust_score}`,`Anomaly score: ${e.anomaly_score}`,`Sensitivity: ${e.sensitivity_level}`,null!==e.fragmentation_score?`Fragmentation score: ${e.fragmentation_score}`:"",x.length?`Threat indicators: ${x.join(", ")}`:"",m.length?`Blocked patterns:
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27241,e=>{"use strict";let t,a,r,s,c;var i=e.i(27493),l=e.i(16871),n=e.i(4),o=e.i(53615),d=e.i(18509),x=e.i(24929);let m=(0,x.default)("radio-tower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);var u=e.i(27528),p=e.i(51069),v=e.i(46194),h=e.i(40950),g=e.i(22534),b=e.i(45688),y=e.i(71921),j=e.i(1235),f=e.i(88969);let N=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function w(){let e=await (0,f.authFetch)(`${N}/api/iron-dome/status`);if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to fetch Iron Dome status"));return e.json()}async function k(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e})});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to activate Iron Dome"));return t.json()}async function C(){let e=await (0,f.authFetch)(`${N}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to deactivate Iron Dome"));return e.json()}async function _(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to update Iron Dome configuration"));return t.json()}async function S(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to scan text"));return t.json()}async function A(){let e=await (0,f.authFetch)(`${N}/api/iron-dome/emergency-stop`,{method:"POST"});if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to trigger emergency stop"));return e.json()}async function E(e){let t=await (0,f.authFetch)(`${N}/api/iron-dome/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e||"Resumed via dashboard"})});if(!t.ok)throw Error(await (0,f.readApiError)(t,"Failed to resume operations"));return t.json()}async function L(){let e=await (0,f.authFetch)(`${N}/api/control/status`);if(!e.ok)throw Error(await (0,f.readApiError)(e,"Failed to fetch control status"));return e.json()}async function P(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let a=await (0,f.authFetch)(`${N}/api/iron-dome/audit?${t}`);if(!a.ok)throw Error(await (0,f.readApiError)(a,"Failed to fetch Iron Dome audit"));return a.json()}function $(){return(0,b.useQuery)({queryKey:["iron-dome-status"],queryFn:w,refetchInterval:3e4,retry:2})}var z=e.i(87353);let F=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function T(e){let t=new URLSearchParams;e?.limit&&t.set("limit",String(e.limit)),e?.severity&&t.set("severity",e.severity),e?.outcome&&t.set("outcome",e.outcome),e?.tool&&t.set("tool",e.tool);let a=await (0,f.authFetch)(`${F}/api/v1/intercepts?${t}`);if(!a.ok)throw Error(await (0,f.readApiError)(a,"Failed to fetch interceptor events"));return a.json()}function I(e){return(0,b.useQuery)({queryKey:["interceptor-events",e],queryFn:()=>T(e),refetchInterval:3e4,retry:2})}var M=e.i(84982);let q=(0,x.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var O=e.i(15771),D=e.i(77715),R=e.i(66949),Q=e.i(71259);let K=(0,x.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),U=(0,x.default)("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),B=(0,x.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),V=(0,x.default)("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),H=(0,x.default)("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),W=(0,x.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),J=(0,x.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var G=e.i(77744),X=e.i(19711);let Z=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",Y=[{id:1,name:"Block API key patterns",priority:1,condition_type:"regex",condition_value:"sk-[a-zA-Z0-9]{32,}",action:"block",enabled:!0},{id:2,name:"Quarantine code injection",priority:2,condition_type:"regex",condition_value:"eval\\(|Function\\(",action:"quarantine",enabled:!0},{id:3,name:"Allow internal docs",priority:10,condition_type:"source",condition_value:"agent:docs-helper",action:"allow",enabled:!1}],ee=[{id:1,name:"Internal tool abuse",category:"tool_misuse",severity:"high",regex:"execute_tool\\(.*?delete|drop|truncate",description:"Detects attempts to use internal tools for destructive operations.",enabled:!0},{id:2,name:"PII exfiltration",category:"data_leak",severity:"critical",regex:"(SSN|social.security|\\d{3}-\\d{2}-\\d{4})",description:"Catches social security number patterns in agent memory writes.",enabled:!0},{id:3,name:"Prompt override attempt",category:"injection",severity:"medium",regex:"ignore.*(previous|above|prior).*instructions",description:"Detects common prompt injection override phrases.",enabled:!0}],et=[{id:1,name:"Strict Healthcare",description:"Blocks all PII patterns, requires approval for external actions, whitelists only HIPAA-compliant channels.",is_active:!0},{id:2,name:"Dev Sandbox",description:"Permissive mode for development. Allows all channels, logs but does not block. Ideal for testing.",is_active:!1}];function ea(){let e,t,a,{data:r,isLoading:s,isLocked:c}={...e=(0,b.useQuery)({queryKey:["custom-patterns"],queryFn:()=>(0,f.gatedFetch)(`${Z}/api/patterns`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom patterns");return e.json()}),retry:(e,t)=>!(t instanceof f.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof f.FeatureLockedError},l=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${Z}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-patterns"]})}})),o=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${Z}/api/patterns/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["custom-patterns"]})}})),d=(0,y.useMutation)({mutationFn:({id:e,text:t})=>(0,f.gatedFetch)(`${Z}/api/patterns/${e}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t})}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)}))}),[x,m]=(0,n.useState)(!1),[u,p]=(0,n.useState)(null),[v,h]=(0,n.useState)({name:"",category:"custom",severity:"medium",regex:"",description:""}),g=r?.patterns??[],N=!0,w="";if(v.regex)try{new RegExp(v.regex)}catch(e){N=!1,w=e.message}return c?(0,i.jsx)(er,{}):(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(q,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Injection Patterns"}),(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.length,"/50"]})]}),(0,i.jsxs)("button",{onClick:()=>m(!x),className:"flex items-center gap-1 px-2 py-1 text-xs bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] rounded hover:bg-[var(--sc-coral)]/30 transition-colors",children:[(0,i.jsx)(J,{size:12})," Add Pattern"]})]}),x&&(0,i.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate(v,{onSuccess:()=>{m(!1),h({name:"",category:"custom",severity:"medium",regex:"",description:""})}})},className:"p-3 bg-[var(--sc-bg-elevated)] rounded-lg space-y-2",children:[(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,i.jsx)("input",{value:v.name,onChange:e=>h(t=>({...t,name:e.target.value})),placeholder:"Pattern name",required:!0,className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsxs)("select",{value:v.severity,onChange:e=>h(t=>({...t,severity:e.target.value})),className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"critical",children:"Critical"}),(0,i.jsx)("option",{value:"high",children:"High"}),(0,i.jsx)("option",{value:"medium",children:"Medium"}),(0,i.jsx)("option",{value:"low",children:"Low"})]})]}),(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("input",{value:v.regex,onChange:e=>h(t=>({...t,regex:e.target.value})),placeholder:"Regex pattern",required:!0,className:`w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border rounded text-[var(--sc-text-primary)] font-mono placeholder:text-[var(--sc-text-muted)] ${N?"border-[var(--sc-border)]":"border-[var(--sc-coral)]"}`}),!N&&(0,i.jsx)("p",{className:"text-[10px] text-[var(--sc-coral)] mt-0.5",children:w})]}),(0,i.jsx)("input",{value:v.description,onChange:e=>h(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:"w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"submit",disabled:l.isPending||!N,className:"px-3 py-1 text-xs bg-[var(--sc-coral)] text-[var(--sc-text-primary)] rounded hover:bg-[var(--sc-coral)] disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,i.jsx)("button",{type:"button",onClick:()=>m(!1),className:"px-3 py-1 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]",children:"Cancel"})]}),l.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:l.error.message})]}),s?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:"Loading patterns..."}):0===g.length?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:'No custom patterns yet. Click "Add Pattern" to create one.'}):(0,i.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,i.jsxs)("div",{className:"px-3 py-2 bg-[var(--sc-bg-elevated)] rounded text-xs space-y-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1 font-medium",children:e.name}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity||"high"===e.severity?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"medium"===e.severity?"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]":"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)]"}`,children:e.severity}),(0,i.jsx)("button",{onClick:()=>p(u?.id===e.id?null:{id:e.id,text:""}),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-cyan)]",title:"Test pattern",children:(0,i.jsx)(W,{size:12})}),(0,i.jsx)("button",{onClick:()=>o.mutate(e.id),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-coral)]",children:(0,i.jsx)(G.Trash2,{size:12})})]}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] block truncate",children:e.regex}),u?.id===e.id&&(0,i.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,i.jsx)("input",{value:u.text,onChange:t=>p({id:e.id,text:t.target.value}),placeholder:"Test text...",className:"flex-1 px-2 py-1 text-[10px] bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsx)("button",{onClick:()=>d.mutate({id:e.id,text:u.text}),disabled:!u.text,className:"px-2 py-1 text-[10px] bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] rounded hover:bg-[var(--sc-cyan)]/30 disabled:opacity-50",children:"Test"}),d.data&&(0,i.jsxs)("span",{className:"text-[10px] text-[var(--sc-text-secondary)] self-center",children:[d.data.count," matches"]})]})]},e.id))})]})}function er(){return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(q,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Injection Patterns"}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:"0/50"})]}),(0,i.jsx)("div",{className:"space-y-1",children:ee.map(e=>(0,i.jsxs)("div",{className:"px-3 py-2 bg-[var(--sc-bg-elevated)] rounded text-xs space-y-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1 font-medium",children:e.name}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity||"high"===e.severity?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]"}`,children:e.severity})]}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] block truncate",children:e.regex})]},e.id))})]})}function es(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"custom_injection_patterns",label:"Define up to 50 custom regex patterns for detecting domain-specific threats.",children:(0,i.jsx)(ea,{})})})}var ec=e.i(16511);let ei=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function el(){let e,t,a,r,{data:s,isLoading:c,isLocked:l}={...e=(0,b.useQuery)({queryKey:["custom-policies"],queryFn:()=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom policies");return e.json()}),retry:(e,t)=>!(t instanceof f.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof f.FeatureLockedError},o=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-policies"]})}})),d=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["custom-policies"]})}})),x=(r=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ei}/api/iron-dome/policies/${e}/activate`,{method:"PUT"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{r.invalidateQueries({queryKey:["custom-policies"]})}})),[m,p]=(0,n.useState)(!1),[v,h]=(0,n.useState)({name:"",description:""}),g=s?.policies??[];return l?(0,i.jsx)(en,{}):(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(u.Shield,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Iron Dome Policies"}),(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.length,"/10"]})]}),(0,i.jsxs)("button",{onClick:()=>p(!m),className:"flex items-center gap-1 px-2 py-1 text-xs bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] rounded hover:bg-[var(--sc-coral)]/30 transition-colors",children:[(0,i.jsx)(J,{size:12})," Create Policy"]})]}),m&&(0,i.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.mutate({name:v.name,description:v.description,config:{}},{onSuccess:()=>{p(!1),h({name:"",description:""})}})},className:"p-3 bg-[var(--sc-bg-elevated)]/50 rounded-lg space-y-2",children:[(0,i.jsx)("input",{value:v.name,onChange:e=>h(t=>({...t,name:e.target.value})),placeholder:"Policy name",required:!0,className:"w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsx)("textarea",{value:v.description,onChange:e=>h(t=>({...t,description:e.target.value})),placeholder:"Description",rows:2,className:"w-full px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)] resize-none"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"submit",disabled:o.isPending,className:"px-3 py-1 text-xs bg-[var(--sc-coral)] text-[var(--sc-text-primary)] rounded hover:bg-[var(--sc-coral)] disabled:opacity-50",children:o.isPending?"Creating...":"Create"}),(0,i.jsx)("button",{type:"button",onClick:()=>p(!1),className:"px-3 py-1 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]",children:"Cancel"})]}),o.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:o.error.message})]}),c?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:"Loading policies..."}):0===g.length?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:'No custom policies yet. Click "Create Policy" to get started.'}):(0,i.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:[(0,i.jsxs)("div",{className:"flex-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] font-medium",children:e.name}),1===e.is_active&&(0,i.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] text-[10px] font-medium",children:"Active"})]}),e.description&&(0,i.jsx)("p",{className:"text-[var(--sc-text-muted)] text-[10px] mt-0.5",children:e.description})]}),!e.is_active&&(0,i.jsxs)("button",{onClick:()=>x.mutate(e.id),className:"flex items-center gap-1 px-2 py-1 text-[10px] bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] rounded hover:bg-[var(--sc-cyan)]/30",title:"Set active",children:[(0,i.jsx)(ec.Check,{size:10})," Activate"]}),(0,i.jsx)("button",{onClick:()=>d.mutate(e.id),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-coral)]",children:(0,i.jsx)(G.Trash2,{size:12})})]},e.id))})]})}function en(){return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(u.Shield,{size:16,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Iron Dome Policies"}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:"0/10"})]}),(0,i.jsx)("div",{className:"space-y-1",children:et.map(e=>(0,i.jsx)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:(0,i.jsxs)("div",{className:"flex-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] font-medium",children:e.name}),e.is_active&&(0,i.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] text-[10px] font-medium",children:"Active"})]}),(0,i.jsx)("p",{className:"text-[var(--sc-text-muted)] text-[10px] mt-0.5",children:e.description})]})},e.id))})]})}function eo(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)]/50 border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"custom_iron_dome_policies",label:"Create custom Iron Dome policies with tailored action gates and trust levels.",children:(0,i.jsx)(el,{})})})}let ed=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:u.Shield},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:R.Lock},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:B},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:d.AlertTriangle}],ex=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:V},{name:"Instruction Gateway",description:"Trusted channel validation",icon:K},{name:"Action Gate",description:"Approve / block external actions",icon:R.Lock},{name:"PII Guard",description:"Block sensitive data output",icon:Q.Eye},{name:"Kill Switch",description:"Emergency stop phrase",icon:U},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:B}],em={critical:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] border-[var(--sc-coral)]/30",high:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] border-[var(--sc-coral)]/30",medium:"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)] border-[var(--sc-amber)]/30",low:"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)] border-[var(--sc-border)]/30"},eu={CRITICAL:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]",HIGH:"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]",MEDIUM:"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]",LOW:"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)]",NONE:"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]"};function ep(){let e,t,a,r,s,{data:c,isLoading:l}=$(),{data:o}=(0,b.useQuery)({queryKey:["iron-dome-audit",50],queryFn:()=>P(50),refetchInterval:3e4,retry:2}),d=(e=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>k(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),x=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:C,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),m=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>_(e),onSuccess:()=>{a.invalidateQueries({queryKey:["iron-dome-status"]}),a.invalidateQueries({queryKey:["iron-dome-audit"]})}})),p=(0,y.useMutation)({mutationFn:S}),v=(r=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:A,onSuccess:()=>{r.invalidateQueries({queryKey:["iron-dome-status"]}),r.invalidateQueries({queryKey:["iron-dome-audit"]}),r.invalidateQueries({queryKey:["control-status"]})}})),h=(s=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>E(e),onSuccess:()=>{s.invalidateQueries({queryKey:["control-status"]}),s.invalidateQueries({queryKey:["iron-dome-status"]}),s.invalidateQueries({queryKey:["iron-dome-audit"]})}})),{data:g}=(0,b.useQuery)({queryKey:["control-status"],queryFn:L,refetchInterval:5e3,retry:2}),[f,N]=(0,n.useState)(""),[w,z]=(0,n.useState)(null),[F,T]=(0,n.useState)(""),I=c?.enabled??!1,R=g?.killSwitchActive??!1,Q=g?.killSwitchMeta??null,K=c?.profile,B=c?.config,J=B?.killPhrase??"",[G,X]=(0,n.useState)(J),[Z,Y]=(0,n.useState)(J);J!==Z&&(Y(J),X(J));let ee=o?.logs??[],et=ee.filter(e=>"BLOCK"===e.firewall_result).length,ea=ee.filter(e=>"ALLOW"===e.firewall_result).length,er=!!B&&G.trim()!==(B?.killPhrase??"");return(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[l?(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)] animate-pulse",children:"Loading..."}):(0,i.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${I?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] border border-[var(--sc-coral)]/30":"bg-[var(--sc-bg-elevated)]/50 text-[var(--sc-text-muted)]"}`,children:I?"ACTIVE":"INACTIVE"}),I&&(0,i.jsxs)("button",{onClick:()=>{x.mutate()},disabled:x.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-[var(--sc-coral)]/10 border border-[var(--sc-coral)]/30 hover:bg-[var(--sc-coral)]/20 disabled:opacity-50 rounded-lg text-xs font-medium text-[var(--sc-coral)] transition-colors",children:[x.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(U,{size:12}),"Deactivate"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:"Security Profiles"}),(0,i.jsx)("div",{className:"grid grid-cols-2 gap-2",children:ed.map(({id:e,label:t,description:a,icon:r})=>(0,i.jsxs)("button",{onClick:()=>{d.mutate(e)},disabled:d.isPending,className:`text-left p-3 rounded-lg border transition-colors ${K===e?"border-[var(--sc-coral)]/50 bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]":"border-[var(--sc-border)] bg-[var(--sc-bg-elevated)]/50 text-[var(--sc-text-secondary)] hover:border-[var(--sc-text-muted)]"}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,i.jsx)(r,{size:12}),(0,i.jsx)("span",{className:"text-xs font-medium",children:t})]}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:a})]},e))})]}),(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:"Module Status"}),(0,i.jsx)("div",{className:"space-y-2",children:ex.map(({name:e,description:t,icon:a})=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-[var(--sc-bg-elevated)]/50",children:[(0,i.jsx)(a,{size:14,className:I?"text-[var(--sc-coral)]":"text-[var(--sc-text-muted)]"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("div",{className:"text-xs font-medium text-[var(--sc-text-primary)]",children:e}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] truncate",children:t})]}),(0,i.jsx)("span",{className:`w-2 h-2 rounded-full ${I?"bg-[var(--sc-coral)]":"bg-[var(--sc-text-muted)]"}`})]},e))})]})]}),B&&(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:"Active Configuration"}),(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] uppercase mb-1",children:"Trusted Channels"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:B.trustedChannels.map(e=>(0,i.jsx)("span",{className:"px-1.5 py-0.5 bg-[var(--sc-bg-elevated)] rounded text-[var(--sc-text-secondary)]",children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] uppercase mb-1",children:"Requires Approval"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:B.requireApproval.map(e=>(0,i.jsx)("span",{className:"px-1.5 py-0.5 bg-[var(--sc-coral)]/10 border border-[var(--sc-coral)]/20 rounded text-[var(--sc-coral)]",children:e},e))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)] uppercase mb-1",children:"Kill Phrase"}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)("input",{type:"text",value:G,onChange:e=>X(e.target.value),placeholder:"Set emergency stop phrase",className:"w-full bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] rounded-lg px-3 py-2 text-xs text-[var(--sc-text-primary)] font-mono placeholder:text-[var(--sc-text-muted)] focus:outline-none focus:ring-1 focus:ring-[var(--sc-coral)]"}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("button",{onClick:()=>m.mutate({killPhrase:G.trim()}),disabled:m.isPending||!G.trim()||!er,className:"px-3 py-1.5 rounded-lg bg-[var(--sc-coral)] hover:bg-[var(--sc-coral)]/80 disabled:opacity-50 text-[11px] font-medium text-[var(--sc-text-primary)] transition-colors",children:m.isPending?"Saving...":"Save phrase"}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:I?"Say this in a conversation to trigger lockdown.":"This will apply the next time Iron Dome is active."})]})]})]})]})]}),R?(0,i.jsxs)("div",{className:"glass-card-strong p-6 border-2 !border-[var(--sc-coral)]/50 animate-pulse-slow",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,i.jsx)(H,{size:18,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-bold text-[var(--sc-coral)] uppercase tracking-wide",children:"Kill Switch Active"}),(0,i.jsx)("span",{className:"ml-auto text-[10px] bg-[var(--sc-coral)]/20 text-[var(--sc-coral)] px-2 py-0.5 rounded-full border border-[var(--sc-coral)]/30",children:"LOCKDOWN"})]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]/80 mb-2",children:"All agent operations are blocked. No memory reads, writes, graph queries, or consolidation. Iron Dome remains active and continues protecting."}),Q&&(0,i.jsxs)("div",{className:"bg-[var(--sc-coral)]/10 border border-[var(--sc-coral)]/20 rounded-lg p-3 mb-4 space-y-1",children:[(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)("span",{className:"text-[var(--sc-coral)] font-medium",children:"Triggered:"})," ",new Date(Q.triggeredAt).toLocaleString()]}),(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)("span",{className:"text-[var(--sc-coral)] font-medium",children:"Source:"})," ","kill_phrase"===Q.source?`Kill phrase "${Q.phrase}"`:"manual"===Q.source?"Manual (dashboard)":"mcp_tool"===Q.source?"MCP tool":Q.source]}),void 0!==Q.memoryCountAtTrigger&&(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)("span",{className:"text-[var(--sc-coral)] font-medium",children:"Memories at trigger:"})," ",Q.memoryCountAtTrigger]})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)("input",{type:"text",value:F,onChange:e=>T(e.target.value),placeholder:"Reason for resuming (required)...",className:"w-full bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] rounded-lg px-3 py-2 text-xs text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)] focus:outline-none focus:ring-1 focus:ring-green-500"}),(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsxs)("button",{onClick:()=>{F.trim()&&(h.mutate(F.trim()),T(""))},disabled:h.isPending||!F.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-[var(--sc-cyan)] hover:bg-[var(--sc-cyan-mid)] disabled:opacity-50 rounded-lg text-xs font-medium text-[var(--sc-text-primary)] transition-colors",children:[h.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(W,{size:12}),"Resume Agent"]}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Only resume after you've investigated the threat"})]})]})]}):(0,i.jsxs)("div",{className:"glass-card p-6 !border-[var(--sc-coral)]/30",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,i.jsx)(H,{size:14,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-coral)]",children:"Emergency Stop"})]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-secondary)] mb-3",children:"Immediately halts your agent when you suspect it has been compromised or is acting on poisoned data. Blocks ALL operations — no reads, writes, or modifications. Iron Dome stays active."}),B?.killPhrase&&(0,i.jsxs)("p",{className:"text-[10px] text-[var(--sc-text-muted)] mb-3",children:["Kill phrase: ",(0,i.jsxs)("span",{className:"font-mono text-[var(--sc-text-secondary)]",children:['"',B.killPhrase,'"']})," — say this in conversation for hands-free stop"]}),(0,i.jsxs)("button",{onClick:()=>v.mutate(),disabled:v.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-[var(--sc-coral)] hover:bg-[var(--sc-coral)]/80 disabled:opacity-50 rounded-lg text-xs font-bold text-[var(--sc-text-primary)] uppercase tracking-wider transition-colors",children:[v.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(H,{size:14}),"Emergency Stop"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsxs)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)] mb-3",children:[(0,i.jsx)(V,{size:14,className:"inline mr-1.5 text-[var(--sc-coral)]"}),"Injection Scanner"]}),(0,i.jsx)("textarea",{value:f,onChange:e=>N(e.target.value),placeholder:"Paste suspicious text to scan for injection patterns...",className:"w-full h-28 bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] rounded-lg p-3 text-sm text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)] resize-none focus:outline-none focus:ring-1 focus:ring-[var(--sc-coral)] focus:border-[var(--sc-coral)]"}),(0,i.jsxs)("button",{onClick:()=>{f.trim()&&p.mutate(f,{onSuccess:e=>z(e)})},disabled:p.isPending||!f.trim(),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 bg-[var(--sc-coral)] hover:bg-[var(--sc-coral)]/80 disabled:opacity-50 rounded-lg text-xs font-medium text-[var(--sc-text-primary)] transition-colors",children:[p.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(q,{size:12}),"Scan"]}),w&&(0,i.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[w.clean?(0,i.jsx)(O.CheckCircle2,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(D.XCircle,{size:14,className:"text-[var(--sc-coral)]"}),(0,i.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${eu[w.riskLevel]??"bg-[var(--sc-bg-elevated)]/20 text-[var(--sc-text-secondary)]"}`,children:w.riskLevel}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-secondary)]",children:w.summary})]}),w.detections.map((e,t)=>(0,i.jsxs)("div",{className:`border rounded-lg p-3 ${em[e.severity]??"border-[var(--sc-border)]"}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,i.jsx)("span",{className:"text-[10px] font-medium uppercase",children:e.severity}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-primary)]",children:e.category.replace(/_/g," ")})]}),(0,i.jsx)("p",{className:"text-[11px] text-[var(--sc-text-secondary)] mb-1",children:e.description}),(0,i.jsx)("code",{className:"text-[10px] text-[var(--sc-text-muted)] bg-[var(--sc-bg-elevated)] px-1.5 py-0.5 rounded block truncate",children:e.match})]},t))]})]}),(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Event Feed"}),(0,i.jsxs)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:["Last ",ee.length," events"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)]/50 rounded-lg p-2 text-center",children:[(0,i.jsx)("div",{className:"text-sm font-bold text-[var(--sc-text-primary)]",children:ee.length}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Total"})]}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)]/50 rounded-lg p-2 text-center",children:[(0,i.jsx)("div",{className:"text-sm font-bold text-[var(--sc-coral)]",children:et}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Blocked"})]}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)]/50 rounded-lg p-2 text-center",children:[(0,i.jsx)("div",{className:"text-sm font-bold text-[var(--sc-cyan)]",children:ea}),(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Allowed"})]})]}),(0,i.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===ee.length?(0,i.jsxs)("div",{className:"text-center py-6",children:[(0,i.jsx)(u.Shield,{size:20,className:"text-[var(--sc-text-muted)] mx-auto mb-1.5"}),(0,i.jsx)("p",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"No Iron Dome events yet"})]}):ee.map((e,t)=>(0,i.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-[var(--sc-bg-elevated)]/50 text-xs",children:[(0,i.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===e.firewall_result?"bg-[var(--sc-coral)]":"bg-[var(--sc-cyan)]"}`}),(0,i.jsx)("span",{className:"text-[var(--sc-text-secondary)] truncate flex-1",children:(e.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-text-muted)] shrink-0",children:new Date(e.timestamp).toLocaleTimeString()})]},e.id??t))})]})]}),(0,i.jsx)(es,{}),(0,i.jsx)(eo,{})]})}var ev=e.i(42098);let eh=(0,x.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var eg=e.i(13808);let eb=(0,x.default)("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]),ey=(0,x.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);var ej=e.i(17278);let ef=(0,x.default)("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),eN=(0,x.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),ew=(0,x.default)("square-minus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);function ek({action:e,item:t,onConfirm:a,onCancel:r}){let[s,c]=(0,n.useState)(""),l="yes"===s.trim().toLowerCase(),o="memory_file"===t.source_type;return(0,i.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-6 max-w-md w-full mx-4",children:[(0,i.jsxs)("h3",{className:"text-sm font-semibold text-[var(--sc-text-primary)] mb-2",children:["approve"===e?"Approve":"Reject"," quarantined item?"]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-secondary)] mb-1",children:(0,i.jsx)("strong",{children:t.title||"Untitled"})}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-muted)] mb-4",children:"approve"===e?o?"This will mark the memory-file finding as reviewed. The source file is not modified.":"This will approve the item and promote it into memory.":o?"This will dismiss the memory-file finding. The source file is not deleted or edited.":"This will permanently discard the memory."}),(0,i.jsxs)("div",{className:"mb-4",children:[(0,i.jsxs)("label",{className:"text-xs text-[var(--sc-text-secondary)] block mb-1",children:["Type ",(0,i.jsx)("strong",{className:"text-[var(--sc-text-primary)]",children:"YES"})," to confirm:"]}),(0,i.jsx)("input",{type:"text",value:s,onChange:e=>c(e.target.value),className:"w-full bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] text-[var(--sc-text-primary)] text-sm rounded-lg px-3 py-2 focus:ring-[var(--sc-cyan)] focus:border-[var(--sc-cyan)]",autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&l&&a(),"Escape"===e.key&&r()}})]}),(0,i.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,i.jsx)("button",{onClick:r,className:"px-3 py-1.5 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)] transition-colors",children:"Cancel"}),(0,i.jsx)("button",{onClick:a,disabled:!l,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${l?"approve"===e?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-cyan-mid)]":"bg-[var(--sc-coral)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-coral-mid)]":"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-muted)] cursor-not-allowed"}`,children:"approve"===e&&o?"Mark reviewed":"approve"===e?"Approve":"Reject"})]})]})})}function eC({annotation:e}){var t;return(0,i.jsxs)("div",{className:"mb-3 rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)]/70 p-3",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--sc-cyan)]",children:[(0,i.jsx)(eh,{size:12})," Local AI Explainer"]}),(0,i.jsx)("span",{className:"rounded border border-[var(--sc-border)] px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] text-[var(--sc-text-secondary)]",children:e.category.replace(/_/g," ")}),(0,i.jsx)("span",{className:`rounded border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] ${"approve"===(t=e.suggestedAction)?"text-[var(--sc-cyan)] bg-[var(--sc-cyan)]/10 border-[var(--sc-cyan)]/25":"reject"===t?"text-[var(--sc-coral)] bg-[var(--sc-coral)]/10 border-[var(--sc-coral)]/25":"create_rule"===t?"text-[var(--sc-amber)] bg-[var(--sc-amber)]/10 border-[var(--sc-amber)]/25":"text-[var(--sc-text-secondary)] bg-[var(--sc-surface-interactive)] border-[var(--sc-border)]"}`,children:e.suggestedAction.replace(/_/g," ")}),(0,i.jsxs)("span",{className:"text-[10px] text-[var(--sc-text-muted)]",children:[Math.round(100*e.confidence),"% confidence"]}),e.similarGroupKey&&(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(eb,{size:11})," ",e.similarGroupKey]})]}),(0,i.jsx)("p",{className:"mt-2 text-xs leading-5 text-[var(--sc-text-primary)]",children:e.summary}),(0,i.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-[var(--sc-text-secondary)]",children:e.reasoning}),e.evidence.length>0&&(0,i.jsx)("div",{className:"mt-2 space-y-1.5",children:e.evidence.map((e,t)=>(0,i.jsxs)("div",{className:"rounded border border-[var(--sc-border)] bg-[var(--sc-bg-surface)] px-2 py-1.5",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:e.reason}),(0,i.jsxs)("div",{className:"mt-0.5 text-[11px] text-[var(--sc-text-primary)] break-words",children:['"',e.snippet,'"']})]},`${e.snippet}-${t}`))})]})}function e_(){let{projectFilter:e}=(0,ev.useDashboardStore)(),[t,a]=(0,n.useState)("pending"),{data:r,isLoading:s}=(0,z.useQuarantine)(t,100,e||void 0),{data:c}=(0,z.useReviewCopilotStatus)(),l=(0,z.useApproveQuarantine)(),o=(0,z.useRejectQuarantine)(),x=(0,z.useBulkApproveQuarantine)(),m=(0,z.useBulkRejectQuarantine)(),u=(0,z.useAnnotateQuarantine)(),p=(0,z.useAnnotatePendingQuarantine)(),[v,h]=(0,n.useState)(null),[g,b]=(0,n.useState)(new Set),[y,j]=(0,n.useState)(null),f=l.error?.message||o.error?.message||x.error?.message||m.error?.message||u.error?.message||p.error?.message||null,N=r?.items??[],w=N.filter(e=>"pending"===e.status),k=N.filter(e=>e.annotation),C=w.filter(e=>!e.annotation),_=w.filter(e=>g.has(e.id)).filter(e=>"memory_file"===e.source_type).length,S=(()=>{let e=new Map;for(let t of k){let a=t.annotation?.similarGroupKey;a&&e.set(a,(e.get(a)??0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,3)})(),A=w.length>0&&w.every(e=>g.has(e.id)),E=w.some(e=>g.has(e.id)),L=u.isPending||p.isPending,P=!!(c?.enabled&&c.featureEnabled&&c.modelCached);return(0,i.jsxs)("div",{className:"space-y-6",children:[v&&(0,i.jsx)(ek,{action:v.action,item:v.item,onConfirm:()=>{v&&("approve"===v.action?l.mutate(v.item.id):o.mutate({id:v.item.id}),h(null))},onCancel:()=>h(null)}),y&&(0,i.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-6 max-w-md w-full mx-4",children:[(0,i.jsxs)("h3",{className:"text-sm font-semibold text-[var(--sc-text-primary)] mb-2",children:["approve"===y?"Approve":"Reject"," ",g.size," item",1!==g.size?"s":"","?"]}),(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-secondary)] mb-4",children:"approve"===y?_>0?"Memory-file findings will be marked reviewed without editing files. Other selected items will be promoted into memory.":"This will approve all selected items and promote them into memory.":_>0?"Memory-file findings will be dismissed without editing files. Other selected memories will be discarded.":"This will permanently discard all selected memories."}),(0,i.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,i.jsx)("button",{onClick:()=>j(null),className:"px-3 py-1.5 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)] transition-colors",children:"Cancel"}),(0,i.jsxs)("button",{onClick:()=>{if(!y||0===g.size)return;let e=Array.from(g);"approve"===y?x.mutate(e):m.mutate(e),b(new Set),j(null)},className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${"approve"===y?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-cyan-mid)]":"bg-[var(--sc-coral)] text-[var(--sc-text-primary)] hover:bg-[var(--sc-coral-mid)]"}`,children:["approve"===y?"Approve":"Reject"," ",g.size," item",1!==g.size?"s":""]})]})]})}),(0,i.jsx)(X.ProFeatureGate,{feature:"local_ai_explainer",label:"Use a local model to explain and group quarantined items without sending content to the cloud.",children:(0,i.jsx)("div",{className:"glass-card p-5",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-[var(--sc-text-primary)]",children:[(0,i.jsx)(eg.Sparkles,{size:16,className:"text-[var(--sc-cyan)]"}),"Local AI Explainer"]}),(0,i.jsx)("span",{className:`rounded border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] ${c?.enabled?"border-[var(--sc-cyan)]/25 bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]":"border-[var(--sc-border)] bg-[var(--sc-surface-interactive)] text-[var(--sc-text-muted)]"}`,children:c?.enabled?"enabled":"disabled"}),(0,i.jsx)("span",{className:`rounded border px-2 py-0.5 text-[10px] uppercase tracking-[0.12em] ${c?.modelCached?"border-[var(--sc-cyan)]/25 bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]":"border-[var(--sc-border)] bg-[var(--sc-surface-interactive)] text-[var(--sc-text-muted)]"}`,children:c?.modelCached?"model cached":"model not cached"})]}),(0,i.jsx)("div",{className:"mt-2 text-xs leading-5 text-[var(--sc-text-secondary)]",children:c?.enabled?c.modelCached?"Explain unreviewed quarantine items locally; approve and reject decisions stay manual.":"Download the local model first: shieldcortex review-copilot download-model":"Enable from the CLI first: shieldcortex review-copilot enable"}),(0,i.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[10px] text-[var(--sc-text-muted)]",children:[(0,i.jsxs)("span",{className:C.length>0?"text-[var(--sc-amber)]":"",children:[C.length," need explanation"]}),(0,i.jsxs)("span",{children:[k.length," explained in this view"]}),S.map(([e,t])=>(0,i.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,i.jsx)(eb,{size:11})," ",e,": ",t]},e))]})]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,i.jsxs)("button",{onClick:()=>{p.mutate({limit:Math.min(Math.max(C.length,1),100),project:e||void 0})},disabled:!P||L||0===C.length,className:"inline-flex items-center gap-1.5 rounded-lg bg-[var(--sc-cyan)]/10 px-3 py-1.5 text-xs font-semibold text-[var(--sc-cyan)] transition-colors hover:bg-[var(--sc-cyan)]/20 disabled:pointer-events-none disabled:opacity-45",children:[p.isPending?(0,i.jsx)(M.Loader2,{size:13,className:"animate-spin"}):(0,i.jsx)(ey,{size:13}),"Explain all"]})})]})})}),(0,i.jsxs)("div",{className:"glass-card p-5",children:[(0,i.jsx)("div",{className:"flex items-center justify-between",children:(0,i.jsx)("div",{className:"flex gap-1 bg-[var(--sc-bg-elevated)] rounded-lg p-0.5",children:["pending","approved","rejected"].map(e=>(0,i.jsx)("button",{onClick:()=>{a(e),b(new Set)},className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${t===e?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)]":"text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:e},e))})}),"pending"===t&&w.length>0&&(0,i.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,i.jsxs)("button",{onClick:()=>{A?b(new Set):b(new Set(w.map(e=>e.id)))},className:"flex items-center gap-1.5 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)] transition-colors",children:[A?(0,i.jsx)(ef,{size:14,className:"text-[var(--sc-cyan)]"}):E?(0,i.jsx)(ew,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(eN,{size:14}),A?"Deselect all":"Select all"]}),E&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.size," selected"]}),(0,i.jsxs)("button",{onClick:()=>j("approve"),className:"flex items-center gap-1 px-2.5 py-1 text-xs bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)] rounded-lg hover:bg-[var(--sc-cyan)]/20 transition-colors",children:[(0,i.jsx)(ec.Check,{size:12})," Approve"]}),(0,i.jsxs)("button",{onClick:()=>j("reject"),className:"flex items-center gap-1 px-2.5 py-1 text-xs bg-[var(--sc-coral)]/10 text-[var(--sc-coral)] rounded-lg hover:bg-[var(--sc-coral)]/20 transition-colors",children:[(0,i.jsx)(ej.X,{size:12})," Reject"]})]})]})]}),f&&(0,i.jsx)("div",{className:"glass-card p-5 border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 text-sm text-[var(--sc-coral)]",children:f}),(0,i.jsx)("div",{children:s?(0,i.jsx)("div",{className:"glass-card p-5 flex items-center justify-center h-32",children:(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] animate-pulse",children:"Loading quarantine items..."})}):0===N.length?(0,i.jsxs)("div",{className:"glass-card p-5 flex flex-col items-center justify-center h-32 text-[var(--sc-text-muted)]",children:[(0,i.jsx)(d.AlertTriangle,{size:24,className:"mb-2 text-[var(--sc-text-muted)]"}),(0,i.jsxs)("span",{className:"text-xs",children:["No ",t," items"]})]}):(0,i.jsx)("div",{className:"space-y-3",children:N.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})(),a="memory_file"===e.source_type;return(0,i.jsxs)("div",{className:`glass-card p-5 ${g.has(e.id)?"border-[var(--sc-cyan)]/50":"pending"===e.status&&!e.annotation?"border-[var(--sc-amber)]/35":""}`,children:[(0,i.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,i.jsxs)("div",{className:"flex items-start gap-2.5",children:["pending"===e.status&&(0,i.jsx)("button",{onClick:()=>{var t;return t=e.id,void b(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a})},className:"mt-0.5 text-[var(--sc-text-muted)] hover:text-[var(--sc-cyan)] transition-colors shrink-0",children:g.has(e.id)?(0,i.jsx)(ef,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(eN,{size:14})}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("h4",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:e.title||"Untitled"}),"pending"===e.status&&!e.annotation&&(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-[var(--sc-amber)]/25 bg-[var(--sc-amber)]/10 px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.12em] text-[var(--sc-amber)]",children:[(0,i.jsx)(eh,{size:10})," Needs explanation"]})]}),(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)] mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleString(),e.anomaly_score>0&&(0,i.jsxs)("span",{className:`ml-2 ${e.anomaly_score>.5?"text-[var(--sc-coral)]":"text-[var(--sc-amber)]"}`,children:["Anomaly: ",e.anomaly_score.toFixed(2)]})]}),a&&(0,i.jsx)("div",{className:"mt-1 break-all font-mono text-[10px] text-[var(--sc-text-muted)]",children:e.source_identifier})]})]}),(0,i.jsx)("span",{className:"text-[10px] text-[var(--sc-coral)] bg-[var(--sc-coral)]/10 px-2 py-0.5 rounded",children:e.reason?.slice(0,50)||"Threat detected"})]}),(0,i.jsx)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3 mb-3 text-xs text-[var(--sc-text-primary)] whitespace-pre-wrap break-words",children:e.content?.slice(0,500)||"No content"}),t.length>0&&(0,i.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:t.map((e,t)=>(0,i.jsx)("span",{className:"text-[9px] text-[var(--sc-amber)] bg-[var(--sc-amber)]/10 px-1.5 py-0.5 rounded",children:e},t))}),e.annotation&&(0,i.jsx)(eC,{annotation:e.annotation}),"pending"===e.status&&(0,i.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,i.jsxs)("button",{onClick:()=>u.mutate(e.id),disabled:!P||u.isPending||p.isPending,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--sc-bg-elevated)] text-[var(--sc-text-secondary)] border border-[var(--sc-border)] rounded-lg hover:text-[var(--sc-cyan)] transition-colors disabled:pointer-events-none disabled:opacity-45",children:[u.isPending?(0,i.jsx)(M.Loader2,{size:12,className:"animate-spin"}):(0,i.jsx)(ey,{size:12}),e.annotation?"Re-explain":"Explain"]}),(0,i.jsxs)("button",{onClick:()=>h({action:"approve",item:e}),disabled:l.isPending||x.isPending,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)] rounded-lg hover:bg-[var(--sc-cyan)]/20 transition-colors",children:[(0,i.jsx)(ec.Check,{size:12})," ",a?"Mark reviewed":"Approve"]}),(0,i.jsxs)("button",{onClick:()=>h({action:"reject",item:e}),disabled:o.isPending||m.isPending,className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-[var(--sc-coral)]/10 text-[var(--sc-coral)] rounded-lg hover:bg-[var(--sc-coral)]/20 transition-colors",children:[(0,i.jsx)(ej.X,{size:12})," Reject"]})]}),e.reviewed_at&&(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:["approved"===e.status?"Approved":"Rejected"," by ",e.reviewed_by," at ",new Date(e.reviewed_at).toLocaleString()]})]},e.id)})})})]})}var eS=e.i(16467),eA=e.i(95659);let eE=(0,x.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),eL=(0,x.default)("file-braces",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);var eP=e.i(75025);let e$=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function ez(){let e=(0,y.useMutation)({mutationFn:async({format:e,startTime:t,endTime:a})=>{let r=new URLSearchParams({format:e});t&&r.set("startTime",t),a&&r.set("endTime",a);let s=await (0,f.gatedFetch)(`${e$}/api/audit/export?${r}`);if(!s.ok)throw Error((await s.json().catch(()=>({}))).error||"Export failed");let c=await s.blob(),i=URL.createObjectURL(c),l=document.createElement("a");return l.href=i,l.download=`shieldcortex-audit-${Date.now()}.${"csv"===e?"csv":"json"}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(i),200),{success:!0}}}),[t,a]=(0,n.useState)("json");return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(eE,{size:16,className:"text-[var(--sc-cyan)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Export Audit Logs"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsxs)("div",{className:"flex rounded-lg overflow-hidden border border-[var(--sc-border)]",children:[(0,i.jsxs)("button",{onClick:()=>a("json"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"json"===t?"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]":"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:[(0,i.jsx)(eL,{size:12})," JSON"]}),(0,i.jsxs)("button",{onClick:()=>a("csv"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"csv"===t?"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]":"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:[(0,i.jsx)(eP.FileText,{size:12})," CSV"]})]}),(0,i.jsxs)("button",{onClick:()=>e.mutate({format:t}),disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-1.5 text-xs bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] rounded-lg hover:bg-[var(--sc-cyan)] disabled:opacity-50 transition-colors",children:[(0,i.jsx)(eE,{size:12}),e.isPending?"Exporting...":"Export"]})]}),e.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:e.error.message}),e.isSuccess&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-cyan)]",children:"Export downloaded successfully."})]})}function eF(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"audit_export",label:"Export your full audit trail as JSON or CSV for compliance reporting.",children:(0,i.jsx)(ez,{})})})}var eT=e.i(76490);function eI({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"card",className:(0,eT.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function eM({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"card-header",className:(0,eT.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function eq({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"card-content",className:(0,eT.cn)("px-6",e),...t})}function eO(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var eD=Symbol.for("react.lazy"),eR=n[" use ".trim().toString()];function eQ(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===eD&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var eK=((c=n.forwardRef((e,t)=>{let{children:a,...r}=e;if(eQ(a)&&"function"==typeof eR&&(a=eR(a._payload)),n.isValidElement(a)){var s;let e,c,i=(s=a,(c=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(c=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),l=function(e,t){let a={...t};for(let r in t){let s=e[r],c=t[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...e)=>{let t=c(...e);return s(...e),t}:s&&(a[r]=s):"style"===r?a[r]={...s,...c}:"className"===r&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...e,...a}}(r,a.props);return a.type!==n.Fragment&&(l.ref=t?function(...e){return t=>{let a=!1,r=e.map(e=>{let r=eO(e,t);return a||"function"!=typeof r||(a=!0),r});if(a)return()=>{for(let t=0;t<r.length;t++){let a=r[t];"function"==typeof a?a():eO(e[t],null)}}}}(t,i):i),n.cloneElement(a,l)}return n.Children.count(a)>1?n.Children.only(null):null})).displayName="Slot.SlotClone",t=c,(a=n.forwardRef((e,a)=>{let{children:r,...s}=e;eQ(r)&&"function"==typeof eR&&(r=eR(r._payload));let c=n.Children.toArray(r),l=c.find(eB);if(l){let e=l.props.children,r=c.map(t=>t!==l?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,i.jsx)(t,{...s,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,r):null})}return(0,i.jsx)(t,{...s,ref:a,children:r})})).displayName="Slot.Slot",a),eU=Symbol("radix.slottable");function eB(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===eU}var eV=e.i(2941);let eH=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,eW=eV.clsx,eJ=(r="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",s={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-[var(--sc-text-primary)] hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},e=>{var t;if((null==s?void 0:s.variants)==null)return eW(r,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:a,defaultVariants:c}=s,i=Object.keys(a).map(t=>{let r=null==e?void 0:e[t],s=null==c?void 0:c[t];if(null===r)return null;let i=eH(r)||eH(s);return a[t][i]}),l=e&&Object.entries(e).reduce((e,t)=>{let[a,r]=t;return void 0===r||(e[a]=r),e},{});return eW(r,i,null==s||null==(t=s.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:a,className:r,...s}=t;return Object.entries(s).every(e=>{let[t,a]=e;return Array.isArray(a)?a.includes({...c,...l}[t]):({...c,...l})[t]===a})?[...e,a,r]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function eG({className:e,variant:t="default",size:a="default",asChild:r=!1,...s}){return(0,i.jsx)(r?eK:"button",{"data-slot":"button","data-variant":t,"data-size":a,className:(0,eT.cn)(eJ({variant:t,size:a,className:e})),...s})}var eX=e.i(76624),eZ=e.i(23457),eY=e.i(44250),e0=e.i(45256);let e1={ALLOW:{color:"#22C55E",bg:"rgba(34, 197, 94, 0.15)",label:"Allowed"},BLOCK:{color:"#EF4444",bg:"rgba(239, 68, 68, 0.15)",label:"Blocked"},QUARANTINE:{color:"#EAB308",bg:"rgba(234, 179, 8, 0.15)",label:"Quarantined"}},e2={PUBLIC:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"},INTERNAL:{color:"#60a5fa",bg:"rgba(96, 165, 250, 0.15)"},CONFIDENTIAL:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},RESTRICTED:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"}},e5={instruction_injection:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},privilege_escalation:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},credential_leak:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},encoding_obfuscation:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},fragmented_payload:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},external_url:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},pipeline_error:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"}};function e4(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function e3(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function e6({entry:e,onClose:t,onViewMemory:a}){let r,[s,c]=(0,n.useState)(!1),l=(0,eZ.useLocalAiExplain)(),o=e1[e.firewall_result]||e1.ALLOW,d=e2[e.sensitivity_level]||e2.PUBLIC,x=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),m=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.blocked_patterns),u=(0,n.useCallback)(()=>{let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})},[e]),p=(0,n.useCallback)(()=>{l.mutate({kind:"audit_event",title:`${e.firewall_result} audit event`,content:[`Audit ID: ${e.id}`,`Result: ${e.firewall_result}`,`Source: ${e.source_type}:${e.source_identifier}`,e.project?`Project: ${e.project}`:"",`Trust score: ${e.trust_score}`,`Anomaly score: ${e.anomaly_score}`,`Sensitivity: ${e.sensitivity_level}`,null!==e.fragmentation_score?`Fragmentation score: ${e.fragmentation_score}`:"",x.length?`Threat indicators: ${x.join(", ")}`:"",m.length?`Blocked patterns:
2
2
  ${m.join("\n")}`:"",e.reason?`Reason:
3
- ${e.reason}`:""].filter(Boolean).join("\n\n"),project:e.project,source:`${e.source_type}:${e.source_identifier}`,signals:[e.firewall_result,e.sensitivity_level,...x],metadata:{auditId:e.id,memoryId:e.memory_id,trustScore:e.trust_score,anomalyScore:e.anomaly_score,pipelineDurationMs:e.pipeline_duration_ms}})},[m,e,l,x]);return(0,i.jsxs)(e$,{className:"bg-[var(--sc-bg-surface)] border-[var(--sc-border)] overflow-hidden",children:[(0,i.jsxs)(eT,{className:"border-b border-[var(--sc-border)] pb-3",children:[(0,i.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:o.bg,color:o.color},children:o.label}),(0,i.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:d.bg,color:d.color},children:e.sensitivity_level})]}),(0,i.jsx)(eJ,{variant:"ghost",size:"sm",onClick:t,className:"text-[var(--sc-text-secondary)] hover:text-white -mt-1",children:"✕"})]}),(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-secondary)] mt-2",children:new Date(e.timestamp).toLocaleString()}),e.project&&(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)] mt-1",children:["Project: ",e.project]})]}),(0,i.jsxs)(eI,{className:"p-4 space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Source"}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,i.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",children:e.source_type})}),e.source_identifier&&(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-primary)] mt-1 font-mono break-all",children:e.source_identifier})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Scores"}),(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Trust"}),(0,i.jsxs)("div",{className:"text-lg font-bold",style:{color:e2(e.trust_score)},children:[(100*e.trust_score).toFixed(0),"%"]}),(0,i.jsx)("div",{className:"mt-1 h-1.5 bg-[var(--sc-bg-elevated)] rounded-full overflow-hidden",children:(0,i.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.trust_score}%`,backgroundColor:e2(e.trust_score)}})})]}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Anomaly"}),(0,i.jsxs)("div",{className:"text-lg font-bold",style:{color:e5(e.anomaly_score)},children:[(100*e.anomaly_score).toFixed(0),"%"]}),(0,i.jsx)("div",{className:"mt-1 h-1.5 bg-[var(--sc-bg-elevated)] rounded-full overflow-hidden",children:(0,i.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.anomaly_score}%`,backgroundColor:e5(e.anomaly_score)}})})]}),null!==e.fragmentation_score&&(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Fragmentation"}),(0,i.jsxs)("div",{className:"text-lg font-bold text-[var(--sc-text-primary)]",children:[(100*e.fragmentation_score).toFixed(0),"%"]}),(0,i.jsx)("div",{className:"mt-1 h-1.5 bg-[var(--sc-bg-elevated)] rounded-full overflow-hidden",children:(0,i.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*e.fragmentation_score}%`}})})]}),null!==e.pipeline_duration_ms&&(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Pipeline"}),(0,i.jsxs)("div",{className:"text-lg font-bold text-[var(--sc-text-primary)]",children:[e.pipeline_duration_ms,"ms"]})]})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Threat Indicators"}),x.length>0?(0,i.jsx)("div",{className:"flex flex-wrap gap-1.5",children:x.map((e,t)=>{let a=e1[e]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,i.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:a.bg,color:a.color},children:e.replace(/_/g," ")},t)})}):(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)]",children:"No threats detected"})]}),m.length>0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Blocked Patterns"}),(0,i.jsx)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3 max-h-32 overflow-y-auto",children:m.map((e,t)=>(0,i.jsx)("div",{className:"text-[11px] text-[var(--sc-text-primary)] font-mono break-all mb-1 last:mb-0",children:e},t))})]}),e.reason&&(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Reason"}),(0,i.jsx)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-primary)] whitespace-pre-wrap leading-relaxed",children:e.reason})})]}),l.data?.explanation&&(0,i.jsx)(eG.LocalAiExplanationPanel,{explanation:l.data.explanation,actions:(r=function(e){if(!e)return null;let t=e.trim();return t.includes("/")&&/\.[A-Za-z0-9]{1,8}(?::\d+)?$/.test(t)?t:null}(e.source_identifier))?[{key:"open",label:"Open in editor",icon:(0,i.jsx)(eZ.ExternalLink,{size:13}),variant:"outline",onClick:()=>{let e=(0,eX.buildEditorUrl)(r.replace(/:\d+$/,""),Number(r.match(/:(\d+)$/)?.[1])||void 0);e&&(window.location.href=e)}}]:[]}),l.error&&(0,i.jsx)("div",{className:"rounded-lg border border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 p-3 text-xs text-[var(--sc-coral)]",children:l.error instanceof Error?l.error.message:"Local explanation failed"}),(0,i.jsxs)("div",{className:"flex gap-2 pt-2",children:[e.memory_id&&a&&(0,i.jsx)(eJ,{variant:"default",size:"sm",onClick:()=>a(e.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,i.jsxs)(eJ,{variant:"outline",size:"sm",onClick:u,disabled:l.isPending,className:`flex-1 border-[var(--sc-border)] text-[var(--sc-text-primary)] hover:text-white ${l.isPending?"glow-cyan-pulse":""}`,children:[l.isPending?(0,i.jsx)(M.Loader2,{size:13,className:"mr-1 animate-spin"}):(0,i.jsx)(eg.Sparkles,{size:13,className:"mr-1"}),"Explain"]}),(0,i.jsx)(eJ,{variant:"outline",size:"sm",onClick:p,className:`flex-1 border-[var(--sc-border)] transition-all ${s?"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] border-[var(--sc-cyan)]/50":"text-[var(--sc-text-primary)] hover:text-white"}`,children:s?"Copied":"Copy JSON"})]})]})]})}let e3={ALLOW:"bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",BLOCK:"bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",QUARANTINE:"bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]"};function e6(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:a}=(0,ev.useDashboardStore)(),[r,s]=(0,n.useState)("24h"),[c,l]=(0,n.useState)(void 0),[o,d]=(0,n.useState)(void 0),x={"24h":24,"7d":168,"30d":720},[m,p]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{p(Date.now())},[r]);let u=(0,n.useMemo)(()=>new Date(6e4*Math.floor((m-36e5*x[r])/6e4)).toISOString(),[m,r]),{data:v,isLoading:h}=(0,F.useAuditLogs)({startTime:u,source:c,firewallResult:o,project:e||void 0,limit:200}),g=(0,n.useMemo)(()=>v?.logs??[],[v?.logs]),b=g.filter(e=>"BLOCK"===e.firewall_result).length,y=g.filter(e=>"QUARANTINE"===e.firewall_result).length,j=g.filter(e=>"ALLOW"===e.firewall_result).length,f=(0,n.useCallback)(e=>{if(!t||0===g.length)return;let r=g.findIndex(e=>e.id===t.id);"Escape"===e.key?a(null):"ArrowDown"===e.key&&r<g.length-1?(e.preventDefault(),a(g[r+1])):"ArrowUp"===e.key&&r>0&&(e.preventDefault(),a(g[r-1]))},[t,g,a]);return(0,n.useEffect)(()=>(window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)),[f]),(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{className:"glass-card-strong p-5",children:[(0,i.jsx)("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between mb-3",children:(0,i.jsx)("div",{className:"flex gap-1 bg-[var(--sc-bg-elevated)] rounded-lg p-0.5 ml-auto",children:["24h","7d","30d"].map(e=>(0,i.jsx)("button",{onClick:()=>s(e),className:`px-3 py-1 text-xs rounded-md transition-colors ${r===e?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)]":"text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:e},e))})}),(0,i.jsxs)("div",{className:"mb-4 grid gap-3 md:grid-cols-4",children:[(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Entries"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-text-primary)]",children:g.length})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Allowed"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-cyan)]",children:j})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Blocked"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-coral)]",children:b})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Quarantined"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-amber)]",children:y})]})]}),(0,i.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,i.jsxs)("select",{value:o||"",onChange:e=>d(e.target.value||void 0),className:"bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] text-[var(--sc-text-primary)] text-xs rounded-lg px-2 py-1",children:[(0,i.jsx)("option",{value:"",children:"All Results"}),(0,i.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,i.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,i.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,i.jsxs)("select",{value:c||"",onChange:e=>l(e.target.value||void 0),className:"bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] text-[var(--sc-text-primary)] text-xs rounded-lg px-2 py-1",children:[(0,i.jsx)("option",{value:"",children:"All Sources"}),(0,i.jsx)("option",{value:"hook",children:"Hook"}),(0,i.jsx)("option",{value:"api",children:"API"}),(0,i.jsx)("option",{value:"agent",children:"Agent"}),(0,i.jsx)("option",{value:"user",children:"User"}),(0,i.jsx)("option",{value:"cli",children:"CLI"})]}),(0,i.jsx)("button",{onClick:()=>a(null),className:"ml-auto rounded-full border border-[var(--sc-border)] bg-[var(--sc-bg-surface)] px-3 py-1 text-xs text-[var(--sc-text-primary)] transition-colors hover:border-[var(--sc-border)] hover:text-[var(--sc-text-primary)]",children:"Clear selection"})]})]}),(0,i.jsxs)("div",{className:`grid gap-6 ${t?"xl:grid-cols-[minmax(0,1.35fr)_360px]":""}`,children:[(0,i.jsx)("div",{className:"glass-card overflow-hidden",children:h?(0,i.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] animate-pulse",children:"Loading audit logs..."})}):0===g.length?(0,i.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)]",children:"No audit entries for this period"})}):(0,i.jsx)("div",{className:"overflow-x-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs",children:[(0,i.jsx)("thead",{className:"bg-[var(--sc-bg-deep)]",children:(0,i.jsxs)("tr",{className:"border-b border-[var(--sc-border)]",children:[(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Time"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Source"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Result"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Trust"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Anomaly"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Reason"})]})}),(0,i.jsx)("tbody",{children:g.map(e=>(0,i.jsxs)("tr",{onClick:()=>{a(t?.id===e.id?null:e)},className:`border-b border-[var(--sc-border)] cursor-pointer transition-colors ${t?.id===e.id?"bg-[var(--sc-cyan)]/10 hover:bg-[var(--sc-cyan)]/15":"hover:bg-[var(--sc-surface-interactive)]"}`,children:[(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-secondary)] whitespace-nowrap",children:new Date(e.timestamp).toLocaleString()}),(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-primary)]",children:e.source_type}),(0,i.jsx)("td",{className:"px-4 py-2",children:(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${e3[e.firewall_result]||"text-[var(--sc-text-secondary)]"}`,children:e.firewall_result})}),(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-secondary)]",children:e.trust_score.toFixed(1)}),(0,i.jsx)("td",{className:"px-4 py-2",children:(0,i.jsx)("span",{className:e.anomaly_score>.5?"text-[var(--sc-coral)]":e.anomaly_score>.2?"text-[var(--sc-amber)]":"text-[var(--sc-text-secondary)]",children:e.anomaly_score.toFixed(2)})}),(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-secondary)] max-w-xs truncate",children:e.reason||"—"})]},e.id))})]})})}),t&&(0,i.jsx)("div",{className:"xl:sticky xl:top-6 self-start",children:(0,i.jsx)(e4,{entry:t,onClose:()=>a(null)})})]}),(0,i.jsxs)("details",{className:"glass-card p-6",children:[(0,i.jsx)("summary",{className:"cursor-pointer list-none text-sm font-medium text-[var(--sc-text-primary)]",children:"Export audit trail"}),(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)(ez,{})})]})]})}var e8=e.i(45434),e7=e.i(19331);let e9={critical:"border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",high:"border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",medium:"border-[var(--sc-amber)]/30 bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]",low:"border-[var(--sc-border)] bg-[var(--sc-bg-elevated)]/80 text-[var(--sc-text-primary)]"},te={approved:"bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",denied:"bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]",auto_denied:"bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",warned:"bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]",logged:"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-primary)]",failure_allowed:"bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",failure_denied:"bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]"};function tt(){let[e,t]=(0,n.useState)(""),[a,r]=(0,n.useState)(""),[s,c]=(0,n.useState)(""),{data:l,isLoading:o}=I({limit:100,severity:e||void 0,outcome:a||void 0,tool:s||void 0}),x=l?.entries??[],m=l?.summary,p=(0,n.useMemo)(()=>(m?.topTools??[]).map(e=>e.tool),[m?.topTools]);return(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(e8.Activity,{size:12}),"Total"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-text-primary)]",children:m?.total??0})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(R.CheckCircle2,{size:12}),"Approved"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-cyan)]",children:m?.approved??0})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(d.AlertTriangle,{size:12}),"Denied"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-amber)]",children:m?.denied??0})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(u.ShieldAlert,{size:12}),"Failures"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-coral)]",children:m?.failures??0})]})]}),(0,i.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,i.jsxs)("select",{value:e,onChange:e=>t(e.target.value),className:"rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-3 py-1.5 text-xs text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"",children:"All severities"}),(0,i.jsx)("option",{value:"critical",children:"Critical"}),(0,i.jsx)("option",{value:"high",children:"High"}),(0,i.jsx)("option",{value:"medium",children:"Medium"}),(0,i.jsx)("option",{value:"low",children:"Low"})]}),(0,i.jsxs)("select",{value:a,onChange:e=>r(e.target.value),className:"rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-3 py-1.5 text-xs text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"",children:"All outcomes"}),(0,i.jsx)("option",{value:"approved",children:"Approved"}),(0,i.jsx)("option",{value:"denied",children:"Denied"}),(0,i.jsx)("option",{value:"auto_denied",children:"Auto denied"}),(0,i.jsx)("option",{value:"warned",children:"Warned"}),(0,i.jsx)("option",{value:"logged",children:"Logged"}),(0,i.jsx)("option",{value:"failure_allowed",children:"Failure allowed"}),(0,i.jsx)("option",{value:"failure_denied",children:"Failure denied"})]}),(0,i.jsxs)("select",{value:s,onChange:e=>c(e.target.value),className:"rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-3 py-1.5 text-xs text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"",children:"Top tools"}),p.map(e=>(0,i.jsx)("option",{value:e,children:e},e))]})]})]}),(0,i.jsx)("div",{className:"glass-card-strong p-5 overflow-hidden",children:o?(0,i.jsx)("div",{className:"flex h-32 items-center justify-center text-sm text-[var(--sc-text-secondary)]",children:"Loading interceptor events…"}):0===x.length?(0,i.jsx)("div",{className:"flex h-32 items-center justify-center text-sm text-[var(--sc-text-secondary)]",children:"No interceptor events found for the current filters."}):(0,i.jsx)("div",{className:"divide-y divide-[var(--sc-border)]",children:x.map((e,t)=>(0,i.jsxs)("div",{className:"grid gap-4 px-5 py-4 lg:grid-cols-[220px_minmax(0,1fr)_220px]",children:[(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--sc-text-muted)]",children:[(0,i.jsx)(e7.Clock3,{size:12}),new Date(e.ts).toLocaleString()]}),(0,i.jsx)("div",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:e.tool}),(0,i.jsx)("div",{className:`inline-flex rounded-full border px-2.5 py-1 text-[11px] ${e9[e.severity]??e9.low}`,children:e.severity.toUpperCase()})]}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Preview"}),(0,i.jsx)("p",{className:"mt-2 line-clamp-4 text-sm leading-6 text-[var(--sc-text-primary)]",children:e.preview||"No preview captured."}),(0,i.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(e.threats??[]).map(e=>(0,i.jsx)("span",{className:"rounded-full border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-2.5 py-1 text-[11px] text-[var(--sc-text-primary)]",children:e},e)),(!e.threats||0===e.threats.length)&&(0,i.jsx)("span",{className:"rounded-full border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-2.5 py-1 text-[11px] text-[var(--sc-text-secondary)]",children:"No explicit threat tags"})]})]}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Outcome"}),(0,i.jsx)("div",{className:`mt-1 inline-flex rounded-full px-2.5 py-1 text-[11px] ${te[e.outcome]??te.logged}`,children:e.outcome.replace(/_/g," ")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Firewall"}),(0,i.jsx)("div",{className:"mt-1 text-sm text-[var(--sc-text-primary)]",children:e.firewallResult})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Action"}),(0,i.jsx)("div",{className:"mt-1 text-sm text-[var(--sc-text-primary)]",children:e.action})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Anomaly score"}),(0,i.jsx)("div",{className:"mt-1 text-sm text-[var(--sc-text-primary)]",children:e.anomalyScore.toFixed(2)})]})]})]},`${e.ts}-${e.tool}-${t}`))})})]})}let ta=(0,x.default)("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),tr=(0,x.default)("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),ts=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function tc(){let e,t,a,r,{data:s,isLoading:c,isLocked:l}={...e=(0,b.useQuery)({queryKey:["firewall-rules"],queryFn:()=>(0,f.gatedFetch)(`${ts}/api/firewall-rules`).then(e=>{if(!e.ok)throw Error("Failed to fetch firewall rules");return e.json()}),retry:(e,t)=>!(t instanceof f.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof f.FeatureLockedError},o=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ts}/api/firewall-rules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["firewall-rules"]})}})),d=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:({id:e,...t})=>(0,f.gatedFetch)(`${ts}/api/firewall-rules/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["firewall-rules"]})}})),x=(r=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${ts}/api/firewall-rules/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{r.invalidateQueries({queryKey:["firewall-rules"]})}})),[m,u]=(0,n.useState)(!1),[v,h]=(0,n.useState)({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"}),g=s?.rules??[];return l?(0,i.jsx)(ti,{}):(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(p.Shield,{size:16,className:"text-[var(--sc-cyan)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Firewall Rules"}),(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.length,"/25"]})]}),(0,i.jsxs)("button",{onClick:()=>u(!m),className:"flex items-center gap-1 px-2 py-1 text-xs bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] rounded hover:bg-[var(--sc-cyan)]/30 transition-colors",children:[(0,i.jsx)(G,{size:12})," Add Rule"]})]}),m&&(0,i.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.mutate(v,{onSuccess:()=>{u(!1),h({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"})}})},className:"p-3 bg-[var(--sc-bg-elevated)]/50 rounded-lg space-y-2",children:[(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,i.jsx)("input",{value:v.name,onChange:e=>h(t=>({...t,name:e.target.value})),placeholder:"Rule name",required:!0,className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsx)("input",{value:v.priority,onChange:e=>h(t=>({...t,priority:Number(e.target.value)})),type:"number",placeholder:"Priority",className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]"})]}),(0,i.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,i.jsxs)("select",{value:v.condition_type,onChange:e=>h(t=>({...t,condition_type:e.target.value})),className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"regex",children:"Regex"}),(0,i.jsx)("option",{value:"source",children:"Source"}),(0,i.jsx)("option",{value:"keyword",children:"Keyword"})]}),(0,i.jsx)("input",{value:v.condition_value,onChange:e=>h(t=>({...t,condition_value:e.target.value})),placeholder:"Condition value",required:!0,className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsxs)("select",{value:v.action,onChange:e=>h(t=>({...t,action:e.target.value})),className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"block",children:"Block"}),(0,i.jsx)("option",{value:"quarantine",children:"Quarantine"}),(0,i.jsx)("option",{value:"allow",children:"Allow"})]})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"submit",disabled:o.isPending,className:"px-3 py-1 text-xs bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] rounded hover:bg-[var(--sc-cyan)]/80 disabled:opacity-50",children:o.isPending?"Creating...":"Create"}),(0,i.jsx)("button",{type:"button",onClick:()=>u(!1),className:"px-3 py-1 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]",children:"Cancel"})]}),o.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:o.error.message})]}),c?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:"Loading rules..."}):0===g.length?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:'No custom rules yet. Click "Add Rule" to create one.'}):(0,i.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-secondary)] w-6 text-right",children:e.priority}),(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1",children:e.name}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"quarantine"===e.action?"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]":"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]"}`,children:e.action}),(0,i.jsx)("button",{onClick:()=>d.mutate({id:e.id,enabled:+!e.enabled}),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-text-primary)]",title:e.enabled?"Disable":"Enable",children:e.enabled?(0,i.jsx)(tr,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(ta,{size:14})}),(0,i.jsx)("button",{onClick:()=>x.mutate(e.id),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-coral)]",children:(0,i.jsx)(W.Trash2,{size:12})})]},e.id))})]})}function ti(){return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(p.Shield,{size:16,className:"text-[var(--sc-cyan)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Firewall Rules"}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:"0/25"})]}),(0,i.jsx)("div",{className:"space-y-1",children:Y.map(e=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-secondary)] w-6 text-right",children:e.priority}),(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1",children:e.name}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"quarantine"===e.action?"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]":"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]"}`,children:e.action})]},e.id))})]})}function tl(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)]/50 border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"custom_firewall_rules",label:"Add custom rules to control what gets blocked, allowed, or quarantined.",children:(0,i.jsx)(tc,{})})})}function tn(){return(0,i.jsx)("div",{className:"h-full overflow-y-auto bg-[var(--sc-bg-deep)]",children:(0,i.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6 p-6",children:[(0,i.jsxs)("section",{className:"rounded-2xl border border-[var(--sc-border)] bg-[var(--sc-bg-surface)]/70 p-6",children:[(0,i.jsx)("div",{className:"text-[11px] uppercase tracking-[0.2em] text-[var(--sc-cyan)]",children:"Protection / Policies"}),(0,i.jsx)("h2",{className:"mt-3 text-3xl font-semibold text-[var(--sc-text-primary)]",children:"Policy management"}),(0,i.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-[var(--sc-text-secondary)]",children:"Keep operator-tuned controls in one place. Firewall rules and Iron Dome policies should not be buried inside larger screens when they directly shape blocking, quarantine, and approval behavior."})]}),(0,i.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,i.jsx)(tl,{}),(0,i.jsx)(eo,{})]})]})})}function to(){let e=(0,l.useSearchParams)().get("tab"),t=e&&["dome","quarantine","audit","intercepts","policies"].includes(e)?e:null,[a,r]=(0,n.useState)("dome"),s=t??a,{data:c}=z(),{data:o}=(0,F.useAuditStats)("24h"),{data:x}=(0,F.useQuarantine)("pending",10),{data:g}=I({limit:25}),b=[{id:"dome",label:"Iron Dome",icon:(0,i.jsx)(u.ShieldAlert,{size:14})},{id:"quarantine",label:"Quarantine",count:x?.total??0},{id:"audit",label:"Audit"},{id:"intercepts",label:"Intercepts",count:g?.summary?.total??0},{id:"policies",label:"Policies",locked:!1}];return(0,i.jsx)("div",{className:"h-full overflow-y-auto",children:(0,i.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6 p-6",children:[(0,i.jsx)(h.PageHeader,{eyebrow:"Defence",title:"Protection",subtitle:"Active controls, review queues, and operator policy tuning.",tabs:b,activeTab:s,onTabChange:e=>r(e)}),(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[(0,i.jsx)(v.StatCard,{label:"Iron Dome",value:c?.enabled?"Active":"Inactive",icon:p.Shield,accent:c?.enabled?"cyan":"muted"}),(0,i.jsx)(v.StatCard,{label:"Blocked (24h)",value:o?.blockedCount??0,icon:u.ShieldAlert,accent:o?.blockedCount?"coral":"muted"}),(0,i.jsx)(v.StatCard,{label:"Quarantine",value:x?.total??0,icon:d.AlertTriangle,accent:x?.total?"amber":"muted"}),(0,i.jsx)(v.StatCard,{label:"Intercepts",value:g?.summary?.total??0,icon:m,accent:"cyan"})]}),(0,i.jsxs)("div",{children:["dome"===s&&(0,i.jsx)(eu,{}),"quarantine"===s&&(0,i.jsx)(eS,{}),"audit"===s&&(0,i.jsx)(e6,{}),"intercepts"===s&&(0,i.jsx)(tt,{}),"policies"===s&&(0,i.jsx)(tn,{})]})]})})}function td(){return(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(o.PageSkeleton,{}),children:(0,i.jsx)(to,{})})}e.s(["ProtectionOverview",()=>td],27241)}]);
3
+ ${e.reason}`:""].filter(Boolean).join("\n\n"),project:e.project,source:`${e.source_type}:${e.source_identifier}`,signals:[e.firewall_result,e.sensitivity_level,...x],metadata:{auditId:e.id,memoryId:e.memory_id,trustScore:e.trust_score,anomalyScore:e.anomaly_score,pipelineDurationMs:e.pipeline_duration_ms}})},[m,e,l,x]);return(0,i.jsxs)(eI,{className:"bg-[var(--sc-bg-surface)] border-[var(--sc-border)] overflow-hidden",children:[(0,i.jsxs)(eM,{className:"border-b border-[var(--sc-border)] pb-3",children:[(0,i.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:o.bg,color:o.color},children:o.label}),(0,i.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:d.bg,color:d.color},children:e.sensitivity_level})]}),(0,i.jsx)(eG,{variant:"ghost",size:"sm",onClick:t,className:"text-[var(--sc-text-secondary)] hover:text-white -mt-1",children:"✕"})]}),(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-secondary)] mt-2",children:new Date(e.timestamp).toLocaleString()}),e.project&&(0,i.jsxs)("div",{className:"text-[10px] text-[var(--sc-text-muted)] mt-1",children:["Project: ",e.project]})]}),(0,i.jsxs)(eq,{className:"p-4 space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Source"}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,i.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",children:e.source_type})}),e.source_identifier&&(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-primary)] mt-1 font-mono break-all",children:e.source_identifier})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Scores"}),(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Trust"}),(0,i.jsxs)("div",{className:"text-lg font-bold",style:{color:e4(e.trust_score)},children:[(100*e.trust_score).toFixed(0),"%"]}),(0,i.jsx)("div",{className:"mt-1 h-1.5 bg-[var(--sc-bg-elevated)] rounded-full overflow-hidden",children:(0,i.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.trust_score}%`,backgroundColor:e4(e.trust_score)}})})]}),(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Anomaly"}),(0,i.jsxs)("div",{className:"text-lg font-bold",style:{color:e3(e.anomaly_score)},children:[(100*e.anomaly_score).toFixed(0),"%"]}),(0,i.jsx)("div",{className:"mt-1 h-1.5 bg-[var(--sc-bg-elevated)] rounded-full overflow-hidden",children:(0,i.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.anomaly_score}%`,backgroundColor:e3(e.anomaly_score)}})})]}),null!==e.fragmentation_score&&(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Fragmentation"}),(0,i.jsxs)("div",{className:"text-lg font-bold text-[var(--sc-text-primary)]",children:[(100*e.fragmentation_score).toFixed(0),"%"]}),(0,i.jsx)("div",{className:"mt-1 h-1.5 bg-[var(--sc-bg-elevated)] rounded-full overflow-hidden",children:(0,i.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*e.fragmentation_score}%`}})})]}),null!==e.pipeline_duration_ms&&(0,i.jsxs)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:[(0,i.jsx)("div",{className:"text-[10px] text-[var(--sc-text-muted)]",children:"Pipeline"}),(0,i.jsxs)("div",{className:"text-lg font-bold text-[var(--sc-text-primary)]",children:[e.pipeline_duration_ms,"ms"]})]})]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Threat Indicators"}),x.length>0?(0,i.jsx)("div",{className:"flex flex-wrap gap-1.5",children:x.map((e,t)=>{let a=e5[e]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,i.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:a.bg,color:a.color},children:e.replace(/_/g," ")},t)})}):(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)]",children:"No threats detected"})]}),m.length>0&&(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Blocked Patterns"}),(0,i.jsx)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3 max-h-32 overflow-y-auto",children:m.map((e,t)=>(0,i.jsx)("div",{className:"text-[11px] text-[var(--sc-text-primary)] font-mono break-all mb-1 last:mb-0",children:e},t))})]}),e.reason&&(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-xs font-medium text-[var(--sc-text-secondary)] mb-2",children:"Reason"}),(0,i.jsx)("div",{className:"bg-[var(--sc-bg-elevated)] rounded-lg p-3",children:(0,i.jsx)("p",{className:"text-xs text-[var(--sc-text-primary)] whitespace-pre-wrap leading-relaxed",children:e.reason})})]}),l.data?.explanation&&(0,i.jsx)(eX.LocalAiExplanationPanel,{explanation:l.data.explanation,actions:(r=function(e){if(!e)return null;let t=e.trim();return t.includes("/")&&/\.[A-Za-z0-9]{1,8}(?::\d+)?$/.test(t)?t:null}(e.source_identifier))?[{key:"open",label:"Open in editor",icon:(0,i.jsx)(e0.ExternalLink,{size:13}),variant:"outline",onClick:()=>{let e=(0,eY.buildEditorUrl)(r.replace(/:\d+$/,""),Number(r.match(/:(\d+)$/)?.[1])||void 0);e&&(window.location.href=e)}}]:[]}),l.error&&(0,i.jsx)("div",{className:"rounded-lg border border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 p-3 text-xs text-[var(--sc-coral)]",children:l.error instanceof Error?l.error.message:"Local explanation failed"}),(0,i.jsxs)("div",{className:"flex gap-2 pt-2",children:[e.memory_id&&a&&(0,i.jsx)(eG,{variant:"default",size:"sm",onClick:()=>a(e.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,i.jsxs)(eG,{variant:"outline",size:"sm",onClick:p,disabled:l.isPending,className:`flex-1 border-[var(--sc-border)] text-[var(--sc-text-primary)] hover:text-white ${l.isPending?"glow-cyan-pulse":""}`,children:[l.isPending?(0,i.jsx)(M.Loader2,{size:13,className:"mr-1 animate-spin"}):(0,i.jsx)(eg.Sparkles,{size:13,className:"mr-1"}),"Explain"]}),(0,i.jsx)(eG,{variant:"outline",size:"sm",onClick:u,className:`flex-1 border-[var(--sc-border)] transition-all ${s?"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] border-[var(--sc-cyan)]/50":"text-[var(--sc-text-primary)] hover:text-white"}`,children:s?"Copied":"Copy JSON"})]})]})]})}let e8={ALLOW:"safe",BLOCK:"critical",QUARANTINE:"medium"};function e7(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:a}=(0,ev.useDashboardStore)(),[r,s]=(0,n.useState)("24h"),[c,l]=(0,n.useState)(void 0),[o,d]=(0,n.useState)(void 0),x={"24h":24,"7d":168,"30d":720},[m,u]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{u(Date.now())},[r]);let p=(0,n.useMemo)(()=>new Date(6e4*Math.floor((m-36e5*x[r])/6e4)).toISOString(),[m,r]),{data:v,isLoading:h}=(0,z.useAuditLogs)({startTime:p,source:c,firewallResult:o,project:e||void 0,limit:200}),g=(0,n.useMemo)(()=>v?.logs??[],[v?.logs]),b=g.filter(e=>"BLOCK"===e.firewall_result).length,y=g.filter(e=>"QUARANTINE"===e.firewall_result).length,j=g.filter(e=>"ALLOW"===e.firewall_result).length,f=(0,n.useCallback)(e=>{if(!t||0===g.length)return;let r=g.findIndex(e=>e.id===t.id);"Escape"===e.key?a(null):"ArrowDown"===e.key&&r<g.length-1?(e.preventDefault(),a(g[r+1])):"ArrowUp"===e.key&&r>0&&(e.preventDefault(),a(g[r-1]))},[t,g,a]);return(0,n.useEffect)(()=>(window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)),[f]),(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsx)(eS.GlassCard,{title:"audit.filter",statusLine:`window=${r} \xb7 entries=${g.length} \xb7 allow=${j} \xb7 block=${b} \xb7 quarantine=${y}`,children:(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3 font-mono text-xs",children:[(0,i.jsx)("span",{className:"text-[var(--term-text-muted)]",children:"range"}),(0,i.jsx)("span",{className:"text-[var(--term-text-muted)]","aria-hidden":!0,children:"="}),(0,i.jsx)("div",{className:"flex gap-1",children:["24h","7d","30d"].map(e=>(0,i.jsxs)("button",{type:"button",onClick:()=>s(e),className:`px-2 py-0.5 transition-colors ${r===e?"text-[var(--term-electric-fg)]":"text-[var(--term-text-muted)] hover:text-[var(--term-text)]"}`,children:["[",e,"]"]},e))}),(0,i.jsx)("span",{className:"text-[var(--term-text-muted)] ml-3",children:"result"}),(0,i.jsx)("span",{className:"text-[var(--term-text-muted)]","aria-hidden":!0,children:"="}),(0,i.jsxs)("select",{"aria-label":"Filter by firewall result",value:o||"",onChange:e=>d(e.target.value||void 0),className:"bg-[var(--term-surface-2)] border border-[var(--term-border)] text-[var(--term-text)] text-xs rounded-sm px-2 py-0.5 font-mono focus:outline-none focus:border-[var(--term-electric)]",children:[(0,i.jsx)("option",{value:"",children:"*"}),(0,i.jsx)("option",{value:"ALLOW",children:"ALLOW"}),(0,i.jsx)("option",{value:"BLOCK",children:"BLOCK"}),(0,i.jsx)("option",{value:"QUARANTINE",children:"QUARANTINE"})]}),(0,i.jsx)("span",{className:"text-[var(--term-text-muted)] ml-3",children:"source"}),(0,i.jsx)("span",{className:"text-[var(--term-text-muted)]","aria-hidden":!0,children:"="}),(0,i.jsxs)("select",{"aria-label":"Filter by source",value:c||"",onChange:e=>l(e.target.value||void 0),className:"bg-[var(--term-surface-2)] border border-[var(--term-border)] text-[var(--term-text)] text-xs rounded-sm px-2 py-0.5 font-mono focus:outline-none focus:border-[var(--term-electric)]",children:[(0,i.jsx)("option",{value:"",children:"*"}),(0,i.jsx)("option",{value:"hook",children:"hook"}),(0,i.jsx)("option",{value:"api",children:"api"}),(0,i.jsx)("option",{value:"agent",children:"agent"}),(0,i.jsx)("option",{value:"user",children:"user"}),(0,i.jsx)("option",{value:"cli",children:"cli"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(null),className:"ml-auto text-[var(--term-text-muted)] hover:text-[var(--term-text)]",children:"[clear]"})]})}),(0,i.jsxs)("div",{className:`grid gap-6 ${t?"xl:grid-cols-[minmax(0,1.35fr)_360px]":""}`,children:[(0,i.jsx)(eS.GlassCard,{title:"audit.log",bodyPadding:!1,statusLine:h?"loading…":`${g.length} entr${1===g.length?"y":"ies"}`,children:h?(0,i.jsx)("div",{className:"flex items-center justify-center h-32 font-mono",children:(0,i.jsx)("div",{className:"text-xs text-[var(--term-text-muted)] animate-pulse",children:"$ tail -f audit.log…"})}):0===g.length?(0,i.jsx)("div",{className:"flex items-center justify-center h-32 font-mono",children:(0,i.jsx)("div",{className:"text-xs text-[var(--term-text-muted)]",children:"# no audit entries for this period"})}):(0,i.jsx)("div",{className:"overflow-x-auto font-mono",children:(0,i.jsxs)("table",{className:"w-full text-xs",children:[(0,i.jsx)("thead",{className:"bg-[var(--term-surface-2)] sticky top-0",children:(0,i.jsxs)("tr",{className:"border-b border-[var(--term-border)]",children:[(0,i.jsx)("th",{className:"text-left text-[var(--term-text-muted)] font-normal px-3 py-2 uppercase tracking-wider text-[10px]",children:"timestamp"}),(0,i.jsx)("th",{className:"text-left text-[var(--term-text-muted)] font-normal px-3 py-2 uppercase tracking-wider text-[10px]",children:"result"}),(0,i.jsx)("th",{className:"text-left text-[var(--term-text-muted)] font-normal px-3 py-2 uppercase tracking-wider text-[10px]",children:"source"}),(0,i.jsx)("th",{className:"text-right text-[var(--term-text-muted)] font-normal px-3 py-2 uppercase tracking-wider text-[10px]",children:"trust"}),(0,i.jsx)("th",{className:"text-right text-[var(--term-text-muted)] font-normal px-3 py-2 uppercase tracking-wider text-[10px]",children:"anomaly"}),(0,i.jsx)("th",{className:"text-left text-[var(--term-text-muted)] font-normal px-3 py-2 uppercase tracking-wider text-[10px]",children:"reason"})]})}),(0,i.jsx)("tbody",{children:g.map(e=>{let r=e8[e.firewall_result]??(0,eA.riskVariant)("INFO"),s=t?.id===e.id;return(0,i.jsxs)("tr",{onClick:()=>{a(t?.id===e.id?null:e)},className:`border-b border-[var(--term-border)] cursor-pointer transition-colors ${s?"bg-[var(--term-surface-2)]":"hover:bg-[var(--term-surface-2)]"}`,children:[(0,i.jsx)("td",{className:"px-3 py-1.5 text-[var(--term-text-muted)] whitespace-nowrap tabular-nums",children:new Date(e.timestamp).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z")}),(0,i.jsx)("td",{className:"px-3 py-1.5 whitespace-nowrap",children:(0,i.jsx)(eA.Badge,{variant:r,children:e.firewall_result})}),(0,i.jsx)("td",{className:"px-3 py-1.5 text-[var(--term-text)]",children:e.source_type}),(0,i.jsx)("td",{className:"px-3 py-1.5 text-right text-[var(--term-text-dim)] tabular-nums",children:e.trust_score.toFixed(1)}),(0,i.jsx)("td",{className:"px-3 py-1.5 text-right tabular-nums",children:(0,i.jsx)("span",{className:e.anomaly_score>.5?"text-[var(--term-danger)]":e.anomaly_score>.2?"text-[var(--term-warn)]":"text-[var(--term-text-muted)]",children:e.anomaly_score.toFixed(2)})}),(0,i.jsx)("td",{className:"px-3 py-1.5 text-[var(--term-text-dim)] max-w-xs truncate",children:e.reason||"—"})]},e.id)})})]})})}),t&&(0,i.jsx)("div",{className:"xl:sticky xl:top-6 self-start",children:(0,i.jsx)(e6,{entry:t,onClose:()=>a(null)})})]}),(0,i.jsxs)("details",{className:"glass-card p-5",children:[(0,i.jsxs)("summary",{className:"cursor-pointer list-none font-mono text-sm text-[var(--term-text)]",children:[(0,i.jsx)("span",{className:"text-[var(--term-electric-fg)]",children:"$"})," shieldcortex audit export"]}),(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)(eF,{})})]})]})}let e9={ALLOW:"bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",BLOCK:"bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",QUARANTINE:"bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]"};function te(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:a}=(0,ev.useDashboardStore)(),[r,s]=(0,n.useState)("24h"),[c,l]=(0,n.useState)(void 0),[o,d]=(0,n.useState)(void 0),x={"24h":24,"7d":168,"30d":720},[m,u]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{u(Date.now())},[r]);let p=(0,n.useMemo)(()=>new Date(6e4*Math.floor((m-36e5*x[r])/6e4)).toISOString(),[m,r]),{data:v,isLoading:h}=(0,z.useAuditLogs)({startTime:p,source:c,firewallResult:o,project:e||void 0,limit:200}),g=(0,n.useMemo)(()=>v?.logs??[],[v?.logs]),b=g.filter(e=>"BLOCK"===e.firewall_result).length,y=g.filter(e=>"QUARANTINE"===e.firewall_result).length,j=g.filter(e=>"ALLOW"===e.firewall_result).length,f=(0,n.useCallback)(e=>{if(!t||0===g.length)return;let r=g.findIndex(e=>e.id===t.id);"Escape"===e.key?a(null):"ArrowDown"===e.key&&r<g.length-1?(e.preventDefault(),a(g[r+1])):"ArrowUp"===e.key&&r>0&&(e.preventDefault(),a(g[r-1]))},[t,g,a]);return(0,n.useEffect)(()=>(window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)),[f]),(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{className:"glass-card-strong p-5",children:[(0,i.jsx)("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between mb-3",children:(0,i.jsx)("div",{className:"flex gap-1 bg-[var(--sc-bg-elevated)] rounded-lg p-0.5 ml-auto",children:["24h","7d","30d"].map(e=>(0,i.jsx)("button",{onClick:()=>s(e),className:`px-3 py-1 text-xs rounded-md transition-colors ${r===e?"bg-[var(--sc-cyan)] text-[var(--sc-text-primary)]":"text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]"}`,children:e},e))})}),(0,i.jsxs)("div",{className:"mb-4 grid gap-3 md:grid-cols-4",children:[(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Entries"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-text-primary)]",children:g.length})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Allowed"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-cyan)]",children:j})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Blocked"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-coral)]",children:b})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)] p-3",children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Quarantined"}),(0,i.jsx)("div",{className:"mt-1 text-xl font-semibold text-[var(--sc-amber)]",children:y})]})]}),(0,i.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,i.jsxs)("select",{value:o||"",onChange:e=>d(e.target.value||void 0),className:"bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] text-[var(--sc-text-primary)] text-xs rounded-lg px-2 py-1",children:[(0,i.jsx)("option",{value:"",children:"All Results"}),(0,i.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,i.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,i.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,i.jsxs)("select",{value:c||"",onChange:e=>l(e.target.value||void 0),className:"bg-[var(--sc-bg-elevated)] border border-[var(--sc-border)] text-[var(--sc-text-primary)] text-xs rounded-lg px-2 py-1",children:[(0,i.jsx)("option",{value:"",children:"All Sources"}),(0,i.jsx)("option",{value:"hook",children:"Hook"}),(0,i.jsx)("option",{value:"api",children:"API"}),(0,i.jsx)("option",{value:"agent",children:"Agent"}),(0,i.jsx)("option",{value:"user",children:"User"}),(0,i.jsx)("option",{value:"cli",children:"CLI"})]}),(0,i.jsx)("button",{onClick:()=>a(null),className:"ml-auto rounded-full border border-[var(--sc-border)] bg-[var(--sc-bg-surface)] px-3 py-1 text-xs text-[var(--sc-text-primary)] transition-colors hover:border-[var(--sc-border)] hover:text-[var(--sc-text-primary)]",children:"Clear selection"})]})]}),(0,i.jsxs)("div",{className:`grid gap-6 ${t?"xl:grid-cols-[minmax(0,1.35fr)_360px]":""}`,children:[(0,i.jsx)("div",{className:"glass-card overflow-hidden",children:h?(0,i.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] animate-pulse",children:"Loading audit logs..."})}):0===g.length?(0,i.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)]",children:"No audit entries for this period"})}):(0,i.jsx)("div",{className:"overflow-x-auto",children:(0,i.jsxs)("table",{className:"w-full text-xs",children:[(0,i.jsx)("thead",{className:"bg-[var(--sc-bg-deep)]",children:(0,i.jsxs)("tr",{className:"border-b border-[var(--sc-border)]",children:[(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Time"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Source"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Result"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Trust"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Anomaly"}),(0,i.jsx)("th",{className:"text-left text-[var(--sc-text-muted)] font-medium px-4 py-2",children:"Reason"})]})}),(0,i.jsx)("tbody",{children:g.map(e=>(0,i.jsxs)("tr",{onClick:()=>{a(t?.id===e.id?null:e)},className:`border-b border-[var(--sc-border)] cursor-pointer transition-colors ${t?.id===e.id?"bg-[var(--sc-cyan)]/10 hover:bg-[var(--sc-cyan)]/15":"hover:bg-[var(--sc-surface-interactive)]"}`,children:[(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-secondary)] whitespace-nowrap",children:new Date(e.timestamp).toLocaleString()}),(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-primary)]",children:e.source_type}),(0,i.jsx)("td",{className:"px-4 py-2",children:(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${e9[e.firewall_result]||"text-[var(--sc-text-secondary)]"}`,children:e.firewall_result})}),(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-secondary)]",children:e.trust_score.toFixed(1)}),(0,i.jsx)("td",{className:"px-4 py-2",children:(0,i.jsx)("span",{className:e.anomaly_score>.5?"text-[var(--sc-coral)]":e.anomaly_score>.2?"text-[var(--sc-amber)]":"text-[var(--sc-text-secondary)]",children:e.anomaly_score.toFixed(2)})}),(0,i.jsx)("td",{className:"px-4 py-2 text-[var(--sc-text-secondary)] max-w-xs truncate",children:e.reason||"—"})]},e.id))})]})})}),t&&(0,i.jsx)("div",{className:"xl:sticky xl:top-6 self-start",children:(0,i.jsx)(e6,{entry:t,onClose:()=>a(null)})})]}),(0,i.jsxs)("details",{className:"glass-card p-6",children:[(0,i.jsx)("summary",{className:"cursor-pointer list-none text-sm font-medium text-[var(--sc-text-primary)]",children:"Export audit trail"}),(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)(eF,{})})]})]})}function tt(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"contents theme-glass:hidden",children:(0,i.jsx)(e7,{})}),(0,i.jsx)("div",{className:"hidden theme-glass:contents",children:(0,i.jsx)(te,{})})]})}var ta=e.i(45434),tr=e.i(19331);let ts={critical:"border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",high:"border-[var(--sc-coral)]/30 bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",medium:"border-[var(--sc-amber)]/30 bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]",low:"border-[var(--sc-border)] bg-[var(--sc-bg-elevated)]/80 text-[var(--sc-text-primary)]"},tc={approved:"bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",denied:"bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]",auto_denied:"bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]",warned:"bg-[var(--sc-amber)]/10 text-[var(--sc-amber)]",logged:"bg-[var(--sc-bg-elevated)] text-[var(--sc-text-primary)]",failure_allowed:"bg-[var(--sc-cyan)]/10 text-[var(--sc-cyan)]",failure_denied:"bg-[var(--sc-coral)]/10 text-[var(--sc-coral)]"};function ti(){let[e,t]=(0,n.useState)(""),[a,r]=(0,n.useState)(""),[s,c]=(0,n.useState)(""),{data:l,isLoading:o}=I({limit:100,severity:e||void 0,outcome:a||void 0,tool:s||void 0}),x=l?.entries??[],m=l?.summary,u=(0,n.useMemo)(()=>(m?.topTools??[]).map(e=>e.tool),[m?.topTools]);return(0,i.jsxs)("div",{className:"space-y-6",children:[(0,i.jsxs)("div",{className:"glass-card p-6",children:[(0,i.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(ta.Activity,{size:12}),"Total"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-text-primary)]",children:m?.total??0})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(O.CheckCircle2,{size:12}),"Approved"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-cyan)]",children:m?.approved??0})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(d.AlertTriangle,{size:12}),"Denied"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-amber)]",children:m?.denied??0})]}),(0,i.jsxs)("div",{className:"rounded-xl border border-[var(--sc-border)] bg-[var(--sc-bg-deep)]/60 p-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:[(0,i.jsx)(p.ShieldAlert,{size:12}),"Failures"]}),(0,i.jsx)("div",{className:"mt-2 text-xl font-semibold text-[var(--sc-coral)]",children:m?.failures??0})]})]}),(0,i.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,i.jsxs)("select",{value:e,onChange:e=>t(e.target.value),className:"rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-3 py-1.5 text-xs text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"",children:"All severities"}),(0,i.jsx)("option",{value:"critical",children:"Critical"}),(0,i.jsx)("option",{value:"high",children:"High"}),(0,i.jsx)("option",{value:"medium",children:"Medium"}),(0,i.jsx)("option",{value:"low",children:"Low"})]}),(0,i.jsxs)("select",{value:a,onChange:e=>r(e.target.value),className:"rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-3 py-1.5 text-xs text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"",children:"All outcomes"}),(0,i.jsx)("option",{value:"approved",children:"Approved"}),(0,i.jsx)("option",{value:"denied",children:"Denied"}),(0,i.jsx)("option",{value:"auto_denied",children:"Auto denied"}),(0,i.jsx)("option",{value:"warned",children:"Warned"}),(0,i.jsx)("option",{value:"logged",children:"Logged"}),(0,i.jsx)("option",{value:"failure_allowed",children:"Failure allowed"}),(0,i.jsx)("option",{value:"failure_denied",children:"Failure denied"})]}),(0,i.jsxs)("select",{value:s,onChange:e=>c(e.target.value),className:"rounded-lg border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-3 py-1.5 text-xs text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"",children:"Top tools"}),u.map(e=>(0,i.jsx)("option",{value:e,children:e},e))]})]})]}),(0,i.jsx)("div",{className:"glass-card-strong p-5 overflow-hidden",children:o?(0,i.jsx)("div",{className:"flex h-32 items-center justify-center text-sm text-[var(--sc-text-secondary)]",children:"Loading interceptor events…"}):0===x.length?(0,i.jsx)("div",{className:"flex h-32 items-center justify-center text-sm text-[var(--sc-text-secondary)]",children:"No interceptor events found for the current filters."}):(0,i.jsx)("div",{className:"divide-y divide-[var(--sc-border)]",children:x.map((e,t)=>(0,i.jsxs)("div",{className:"grid gap-4 px-5 py-4 lg:grid-cols-[220px_minmax(0,1fr)_220px]",children:[(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--sc-text-muted)]",children:[(0,i.jsx)(tr.Clock3,{size:12}),new Date(e.ts).toLocaleString()]}),(0,i.jsx)("div",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:e.tool}),(0,i.jsx)("div",{className:`inline-flex rounded-full border px-2.5 py-1 text-[11px] ${ts[e.severity]??ts.low}`,children:e.severity.toUpperCase()})]}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("div",{className:"text-xs uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Preview"}),(0,i.jsx)("p",{className:"mt-2 line-clamp-4 text-sm leading-6 text-[var(--sc-text-primary)]",children:e.preview||"No preview captured."}),(0,i.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(e.threats??[]).map(e=>(0,i.jsx)("span",{className:"rounded-full border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-2.5 py-1 text-[11px] text-[var(--sc-text-primary)]",children:e},e)),(!e.threats||0===e.threats.length)&&(0,i.jsx)("span",{className:"rounded-full border border-[var(--sc-border)] bg-[var(--sc-bg-elevated)] px-2.5 py-1 text-[11px] text-[var(--sc-text-secondary)]",children:"No explicit threat tags"})]})]}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Outcome"}),(0,i.jsx)("div",{className:`mt-1 inline-flex rounded-full px-2.5 py-1 text-[11px] ${tc[e.outcome]??tc.logged}`,children:e.outcome.replace(/_/g," ")})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Firewall"}),(0,i.jsx)("div",{className:"mt-1 text-sm text-[var(--sc-text-primary)]",children:e.firewallResult})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Action"}),(0,i.jsx)("div",{className:"mt-1 text-sm text-[var(--sc-text-primary)]",children:e.action})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-[var(--sc-text-muted)]",children:"Anomaly score"}),(0,i.jsx)("div",{className:"mt-1 text-sm text-[var(--sc-text-primary)]",children:e.anomalyScore.toFixed(2)})]})]})]},`${e.ts}-${e.tool}-${t}`))})})]})}let tl=(0,x.default)("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),tn=(0,x.default)("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),to=g.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function td(){let e,t,a,r,{data:s,isLoading:c,isLocked:l}={...e=(0,b.useQuery)({queryKey:["firewall-rules"],queryFn:()=>(0,f.gatedFetch)(`${to}/api/firewall-rules`).then(e=>{if(!e.ok)throw Error("Failed to fetch firewall rules");return e.json()}),retry:(e,t)=>!(t instanceof f.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof f.FeatureLockedError},o=(t=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${to}/api/firewall-rules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["firewall-rules"]})}})),d=(a=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:({id:e,...t})=>(0,f.gatedFetch)(`${to}/api/firewall-rules/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{a.invalidateQueries({queryKey:["firewall-rules"]})}})),x=(r=(0,j.useQueryClient)(),(0,y.useMutation)({mutationFn:e=>(0,f.gatedFetch)(`${to}/api/firewall-rules/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{r.invalidateQueries({queryKey:["firewall-rules"]})}})),[m,p]=(0,n.useState)(!1),[v,h]=(0,n.useState)({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"}),g=s?.rules??[];return l?(0,i.jsx)(tx,{}):(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(u.Shield,{size:16,className:"text-[var(--sc-cyan)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Firewall Rules"}),(0,i.jsxs)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:[g.length,"/25"]})]}),(0,i.jsxs)("button",{onClick:()=>p(!m),className:"flex items-center gap-1 px-2 py-1 text-xs bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)] rounded hover:bg-[var(--sc-cyan)]/30 transition-colors",children:[(0,i.jsx)(J,{size:12})," Add Rule"]})]}),m&&(0,i.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.mutate(v,{onSuccess:()=>{p(!1),h({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"})}})},className:"p-3 bg-[var(--sc-bg-elevated)]/50 rounded-lg space-y-2",children:[(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,i.jsx)("input",{value:v.name,onChange:e=>h(t=>({...t,name:e.target.value})),placeholder:"Rule name",required:!0,className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsx)("input",{value:v.priority,onChange:e=>h(t=>({...t,priority:Number(e.target.value)})),type:"number",placeholder:"Priority",className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]"})]}),(0,i.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,i.jsxs)("select",{value:v.condition_type,onChange:e=>h(t=>({...t,condition_type:e.target.value})),className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"regex",children:"Regex"}),(0,i.jsx)("option",{value:"source",children:"Source"}),(0,i.jsx)("option",{value:"keyword",children:"Keyword"})]}),(0,i.jsx)("input",{value:v.condition_value,onChange:e=>h(t=>({...t,condition_value:e.target.value})),placeholder:"Condition value",required:!0,className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)] placeholder:text-[var(--sc-text-muted)]"}),(0,i.jsxs)("select",{value:v.action,onChange:e=>h(t=>({...t,action:e.target.value})),className:"px-2 py-1.5 text-xs bg-[var(--sc-bg-surface)] border border-[var(--sc-border)] rounded text-[var(--sc-text-primary)]",children:[(0,i.jsx)("option",{value:"block",children:"Block"}),(0,i.jsx)("option",{value:"quarantine",children:"Quarantine"}),(0,i.jsx)("option",{value:"allow",children:"Allow"})]})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("button",{type:"submit",disabled:o.isPending,className:"px-3 py-1 text-xs bg-[var(--sc-cyan)] text-[var(--sc-text-primary)] rounded hover:bg-[var(--sc-cyan)]/80 disabled:opacity-50",children:o.isPending?"Creating...":"Create"}),(0,i.jsx)("button",{type:"button",onClick:()=>p(!1),className:"px-3 py-1 text-xs text-[var(--sc-text-secondary)] hover:text-[var(--sc-text-primary)]",children:"Cancel"})]}),o.error&&(0,i.jsx)("p",{className:"text-xs text-[var(--sc-coral)]",children:o.error.message})]}),c?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:"Loading rules..."}):0===g.length?(0,i.jsx)("div",{className:"text-xs text-[var(--sc-text-muted)] py-4 text-center",children:'No custom rules yet. Click "Add Rule" to create one.'}):(0,i.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-secondary)] w-6 text-right",children:e.priority}),(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1",children:e.name}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"quarantine"===e.action?"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]":"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]"}`,children:e.action}),(0,i.jsx)("button",{onClick:()=>d.mutate({id:e.id,enabled:+!e.enabled}),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-text-primary)]",title:e.enabled?"Disable":"Enable",children:e.enabled?(0,i.jsx)(tn,{size:14,className:"text-[var(--sc-cyan)]"}):(0,i.jsx)(tl,{size:14})}),(0,i.jsx)("button",{onClick:()=>x.mutate(e.id),className:"text-[var(--sc-text-muted)] hover:text-[var(--sc-coral)]",children:(0,i.jsx)(G.Trash2,{size:12})})]},e.id))})]})}function tx(){return(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(u.Shield,{size:16,className:"text-[var(--sc-cyan)]"}),(0,i.jsx)("h3",{className:"text-sm font-medium text-[var(--sc-text-primary)]",children:"Custom Firewall Rules"}),(0,i.jsx)("span",{className:"text-xs text-[var(--sc-text-muted)]",children:"0/25"})]}),(0,i.jsx)("div",{className:"space-y-1",children:Y.map(e=>(0,i.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-[var(--sc-bg-elevated)]/30 rounded text-xs",children:[(0,i.jsx)("span",{className:"text-[var(--sc-text-secondary)] w-6 text-right",children:e.priority}),(0,i.jsx)("span",{className:"text-[var(--sc-text-primary)] flex-1",children:e.name}),(0,i.jsx)("code",{className:"text-[var(--sc-text-muted)] text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,i.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-[var(--sc-coral)]/20 text-[var(--sc-coral)]":"quarantine"===e.action?"bg-[var(--sc-amber)]/20 text-[var(--sc-amber)]":"bg-[var(--sc-cyan)]/20 text-[var(--sc-cyan)]"}`,children:e.action})]},e.id))})]})}function tm(){return(0,i.jsx)("div",{className:"bg-[var(--sc-bg-surface)]/50 border border-[var(--sc-border)] rounded-xl p-4",children:(0,i.jsx)(X.ProFeatureGate,{feature:"custom_firewall_rules",label:"Add custom rules to control what gets blocked, allowed, or quarantined.",children:(0,i.jsx)(td,{})})})}function tu(){return(0,i.jsx)("div",{className:"h-full overflow-y-auto bg-[var(--sc-bg-deep)]",children:(0,i.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6 p-6",children:[(0,i.jsxs)("section",{className:"rounded-2xl border border-[var(--sc-border)] bg-[var(--sc-bg-surface)]/70 p-6",children:[(0,i.jsx)("div",{className:"text-[11px] uppercase tracking-[0.2em] text-[var(--sc-cyan)]",children:"Protection / Policies"}),(0,i.jsx)("h2",{className:"mt-3 text-3xl font-semibold text-[var(--sc-text-primary)]",children:"Policy management"}),(0,i.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-[var(--sc-text-secondary)]",children:"Keep operator-tuned controls in one place. Firewall rules and Iron Dome policies should not be buried inside larger screens when they directly shape blocking, quarantine, and approval behavior."})]}),(0,i.jsxs)("div",{className:"grid gap-6 xl:grid-cols-2",children:[(0,i.jsx)(tm,{}),(0,i.jsx)(eo,{})]})]})})}function tp(){let e=(0,l.useSearchParams)().get("tab"),t=e&&["dome","quarantine","audit","intercepts","policies"].includes(e)?e:null,[a,r]=(0,n.useState)("dome"),s=t??a,{data:c}=$(),{data:o}=(0,z.useAuditStats)("24h"),{data:x}=(0,z.useQuarantine)("pending",10),{data:g}=I({limit:25}),b=[{id:"dome",label:"Iron Dome",icon:(0,i.jsx)(p.ShieldAlert,{size:14})},{id:"quarantine",label:"Quarantine",count:x?.total??0},{id:"audit",label:"Audit"},{id:"intercepts",label:"Intercepts",count:g?.summary?.total??0},{id:"policies",label:"Policies",locked:!1}];return(0,i.jsx)("div",{className:"h-full overflow-y-auto",children:(0,i.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6 p-6",children:[(0,i.jsx)(h.PageHeader,{eyebrow:"Defence",title:"Protection",subtitle:"Active controls, review queues, and operator policy tuning.",tabs:b,activeTab:s,onTabChange:e=>r(e)}),(0,i.jsxs)("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[(0,i.jsx)(v.StatCard,{label:"Iron Dome",value:c?.enabled?"Active":"Inactive",icon:u.Shield,accent:c?.enabled?"cyan":"muted"}),(0,i.jsx)(v.StatCard,{label:"Blocked (24h)",value:o?.blockedCount??0,icon:p.ShieldAlert,accent:o?.blockedCount?"coral":"muted"}),(0,i.jsx)(v.StatCard,{label:"Quarantine",value:x?.total??0,icon:d.AlertTriangle,accent:x?.total?"amber":"muted"}),(0,i.jsx)(v.StatCard,{label:"Intercepts",value:g?.summary?.total??0,icon:m,accent:"cyan"})]}),(0,i.jsxs)("div",{children:["dome"===s&&(0,i.jsx)(ep,{}),"quarantine"===s&&(0,i.jsx)(e_,{}),"audit"===s&&(0,i.jsx)(tt,{}),"intercepts"===s&&(0,i.jsx)(ti,{}),"policies"===s&&(0,i.jsx)(tu,{})]})]})})}function tv(){return(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(o.PageSkeleton,{}),children:(0,i.jsx)(tp,{})})}e.s(["ProtectionOverview",()=>tv],27241)}]);