@openrig/cli 0.3.1 → 0.3.3-rc.0

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 (358) hide show
  1. package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +1 -1
  2. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +8 -8
  3. package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
  4. package/daemon/dist/adapters/cmux-transport.js +51 -9
  5. package/daemon/dist/adapters/cmux-transport.js.map +1 -1
  6. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  7. package/daemon/dist/adapters/codex-runtime-adapter.js +34 -5
  8. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  9. package/daemon/dist/adapters/tmux.d.ts +68 -1
  10. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  11. package/daemon/dist/adapters/tmux.js +141 -2
  12. package/daemon/dist/adapters/tmux.js.map +1 -1
  13. package/daemon/dist/db/migrations/037_mission_control_actions.d.ts +5 -1
  14. package/daemon/dist/db/migrations/037_mission_control_actions.d.ts.map +1 -1
  15. package/daemon/dist/db/migrations/037_mission_control_actions.js +5 -1
  16. package/daemon/dist/db/migrations/037_mission_control_actions.js.map +1 -1
  17. package/daemon/dist/db/migrations/041_rig_policy.d.ts +32 -0
  18. package/daemon/dist/db/migrations/041_rig_policy.d.ts.map +1 -0
  19. package/daemon/dist/db/migrations/041_rig_policy.js +47 -0
  20. package/daemon/dist/db/migrations/041_rig_policy.js.map +1 -0
  21. package/daemon/dist/db/migrations/042_rig_archive.d.ts +16 -0
  22. package/daemon/dist/db/migrations/042_rig_archive.d.ts.map +1 -0
  23. package/daemon/dist/db/migrations/042_rig_archive.js +21 -0
  24. package/daemon/dist/db/migrations/042_rig_archive.js.map +1 -0
  25. package/daemon/dist/domain/agent-images/resume-token-discovery.js +1 -1
  26. package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -1
  27. package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts.map +1 -1
  28. package/daemon/dist/domain/agent-images/snapshot-capturer.js +2 -1
  29. package/daemon/dist/domain/agent-images/snapshot-capturer.js.map +1 -1
  30. package/daemon/dist/domain/agent-manifest.js +27 -0
  31. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  32. package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
  33. package/daemon/dist/domain/bootstrap-orchestrator.js +86 -6
  34. package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
  35. package/daemon/dist/domain/bundle-agent-images-router.d.ts +95 -0
  36. package/daemon/dist/domain/bundle-agent-images-router.d.ts.map +1 -0
  37. package/daemon/dist/domain/bundle-agent-images-router.js +140 -0
  38. package/daemon/dist/domain/bundle-agent-images-router.js.map +1 -0
  39. package/daemon/dist/domain/bundle-assembler.d.ts +18 -1
  40. package/daemon/dist/domain/bundle-assembler.d.ts.map +1 -1
  41. package/daemon/dist/domain/bundle-assembler.js +11 -1
  42. package/daemon/dist/domain/bundle-assembler.js.map +1 -1
  43. package/daemon/dist/domain/bundle-audit.d.ts +89 -0
  44. package/daemon/dist/domain/bundle-audit.d.ts.map +1 -0
  45. package/daemon/dist/domain/bundle-audit.js +87 -0
  46. package/daemon/dist/domain/bundle-audit.js.map +1 -0
  47. package/daemon/dist/domain/bundle-conflict-detector.d.ts +57 -0
  48. package/daemon/dist/domain/bundle-conflict-detector.d.ts.map +1 -0
  49. package/daemon/dist/domain/bundle-conflict-detector.js +49 -0
  50. package/daemon/dist/domain/bundle-conflict-detector.js.map +1 -0
  51. package/daemon/dist/domain/bundle-context-packs-router.d.ts +100 -0
  52. package/daemon/dist/domain/bundle-context-packs-router.d.ts.map +1 -0
  53. package/daemon/dist/domain/bundle-context-packs-router.js +158 -0
  54. package/daemon/dist/domain/bundle-context-packs-router.js.map +1 -0
  55. package/daemon/dist/domain/bundle-plugins-router.d.ts +69 -0
  56. package/daemon/dist/domain/bundle-plugins-router.d.ts.map +1 -0
  57. package/daemon/dist/domain/bundle-plugins-router.js +87 -0
  58. package/daemon/dist/domain/bundle-plugins-router.js.map +1 -0
  59. package/daemon/dist/domain/bundle-skills-router.d.ts +62 -0
  60. package/daemon/dist/domain/bundle-skills-router.d.ts.map +1 -0
  61. package/daemon/dist/domain/bundle-skills-router.js +90 -0
  62. package/daemon/dist/domain/bundle-skills-router.js.map +1 -0
  63. package/daemon/dist/domain/bundle-types.d.ts +106 -0
  64. package/daemon/dist/domain/bundle-types.d.ts.map +1 -1
  65. package/daemon/dist/domain/bundle-types.js +375 -0
  66. package/daemon/dist/domain/bundle-types.js.map +1 -1
  67. package/daemon/dist/domain/bundle-workflow-specs-router.d.ts +94 -0
  68. package/daemon/dist/domain/bundle-workflow-specs-router.d.ts.map +1 -0
  69. package/daemon/dist/domain/bundle-workflow-specs-router.js +144 -0
  70. package/daemon/dist/domain/bundle-workflow-specs-router.js.map +1 -0
  71. package/daemon/dist/domain/context-monitor.d.ts +5 -1
  72. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  73. package/daemon/dist/domain/context-monitor.js +28 -15
  74. package/daemon/dist/domain/context-monitor.js.map +1 -1
  75. package/daemon/dist/domain/graph-projection.d.ts +6 -0
  76. package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
  77. package/daemon/dist/domain/graph-projection.js +6 -0
  78. package/daemon/dist/domain/graph-projection.js.map +1 -1
  79. package/daemon/dist/domain/native-resume-probe.js +7 -7
  80. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  81. package/daemon/dist/domain/node-inventory.d.ts +18 -0
  82. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  83. package/daemon/dist/domain/node-inventory.js +98 -0
  84. package/daemon/dist/domain/node-inventory.js.map +1 -1
  85. package/daemon/dist/domain/node-launcher.d.ts +12 -0
  86. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  87. package/daemon/dist/domain/node-launcher.js +25 -1
  88. package/daemon/dist/domain/node-launcher.js.map +1 -1
  89. package/daemon/dist/domain/pod-bundle-assembler.d.ts +16 -1
  90. package/daemon/dist/domain/pod-bundle-assembler.d.ts.map +1 -1
  91. package/daemon/dist/domain/pod-bundle-assembler.js +11 -1
  92. package/daemon/dist/domain/pod-bundle-assembler.js.map +1 -1
  93. package/daemon/dist/domain/profile-resolver.d.ts +10 -0
  94. package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
  95. package/daemon/dist/domain/profile-resolver.js +4 -0
  96. package/daemon/dist/domain/profile-resolver.js.map +1 -1
  97. package/daemon/dist/domain/ps-projection.d.ts +28 -1
  98. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  99. package/daemon/dist/domain/ps-projection.js +67 -1
  100. package/daemon/dist/domain/ps-projection.js.map +1 -1
  101. package/daemon/dist/domain/queue-repository.d.ts +37 -1
  102. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  103. package/daemon/dist/domain/queue-repository.js +99 -2
  104. package/daemon/dist/domain/queue-repository.js.map +1 -1
  105. package/daemon/dist/domain/restore-check-service.d.ts +4 -0
  106. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  107. package/daemon/dist/domain/restore-check-service.js +16 -7
  108. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  109. package/daemon/dist/domain/rig-expansion-service.d.ts +1 -1
  110. package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
  111. package/daemon/dist/domain/rig-expansion-service.js +12 -10
  112. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  113. package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts +48 -0
  114. package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts.map +1 -0
  115. package/daemon/dist/domain/rig-policy/rig-policy-defaults.js +96 -0
  116. package/daemon/dist/domain/rig-policy/rig-policy-defaults.js.map +1 -0
  117. package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts +46 -0
  118. package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts.map +1 -0
  119. package/daemon/dist/domain/rig-policy/rig-policy-store.js +171 -0
  120. package/daemon/dist/domain/rig-policy/rig-policy-store.js.map +1 -0
  121. package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts +145 -0
  122. package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts.map +1 -0
  123. package/daemon/dist/domain/rig-policy/rig-policy-types.js +52 -0
  124. package/daemon/dist/domain/rig-policy/rig-policy-types.js.map +1 -0
  125. package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts +58 -0
  126. package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts.map +1 -0
  127. package/daemon/dist/domain/rig-policy/rig-policy-validator.js +211 -0
  128. package/daemon/dist/domain/rig-policy/rig-policy-validator.js.map +1 -0
  129. package/daemon/dist/domain/rig-repository.d.ts +28 -2
  130. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  131. package/daemon/dist/domain/rig-repository.js +40 -3
  132. package/daemon/dist/domain/rig-repository.js.map +1 -1
  133. package/daemon/dist/domain/rigspec-instantiator.d.ts +177 -1
  134. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  135. package/daemon/dist/domain/rigspec-instantiator.js +414 -55
  136. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  137. package/daemon/dist/domain/rigspec-preflight.d.ts +19 -1
  138. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  139. package/daemon/dist/domain/rigspec-preflight.js +30 -12
  140. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  141. package/daemon/dist/domain/rigspec-schema.d.ts +1 -0
  142. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  143. package/daemon/dist/domain/rigspec-schema.js +4 -1
  144. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  145. package/daemon/dist/domain/seat-activity-service.d.ts +79 -0
  146. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -0
  147. package/daemon/dist/domain/seat-activity-service.js +123 -0
  148. package/daemon/dist/domain/seat-activity-service.js.map +1 -0
  149. package/daemon/dist/domain/session-transport.d.ts +15 -0
  150. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  151. package/daemon/dist/domain/session-transport.js +8 -3
  152. package/daemon/dist/domain/session-transport.js.map +1 -1
  153. package/daemon/dist/domain/slices/slice-indexer.d.ts +12 -0
  154. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  155. package/daemon/dist/domain/slices/slice-indexer.js +23 -0
  156. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  157. package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
  158. package/daemon/dist/domain/spec-library-service.js +19 -0
  159. package/daemon/dist/domain/spec-library-service.js.map +1 -1
  160. package/daemon/dist/domain/topology-converge.d.ts +97 -0
  161. package/daemon/dist/domain/topology-converge.d.ts.map +1 -0
  162. package/daemon/dist/domain/topology-converge.js +70 -0
  163. package/daemon/dist/domain/topology-converge.js.map +1 -0
  164. package/daemon/dist/domain/types.d.ts +85 -3
  165. package/daemon/dist/domain/types.d.ts.map +1 -1
  166. package/daemon/dist/domain/types.js.map +1 -1
  167. package/daemon/dist/domain/whoami-service.d.ts +8 -0
  168. package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
  169. package/daemon/dist/domain/whoami-service.js +1 -0
  170. package/daemon/dist/domain/whoami-service.js.map +1 -1
  171. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  172. package/daemon/dist/domain/workflow-runtime.js +9 -1
  173. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  174. package/daemon/dist/domain/workflow-spec-cache.d.ts +41 -0
  175. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  176. package/daemon/dist/domain/workflow-spec-cache.js +63 -0
  177. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  178. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +7 -0
  179. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
  180. package/daemon/dist/domain/workspace/default-workspace-scaffold.js +156 -3
  181. package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
  182. package/daemon/dist/domain/workspace/workspace-doctor.d.ts +197 -0
  183. package/daemon/dist/domain/workspace/workspace-doctor.d.ts.map +1 -0
  184. package/daemon/dist/domain/workspace/workspace-doctor.js +448 -0
  185. package/daemon/dist/domain/workspace/workspace-doctor.js.map +1 -0
  186. package/daemon/dist/index.d.ts.map +1 -1
  187. package/daemon/dist/index.js +11 -0
  188. package/daemon/dist/index.js.map +1 -1
  189. package/daemon/dist/routes/bundles.d.ts.map +1 -1
  190. package/daemon/dist/routes/bundles.js +966 -7
  191. package/daemon/dist/routes/bundles.js.map +1 -1
  192. package/daemon/dist/routes/config.d.ts.map +1 -1
  193. package/daemon/dist/routes/config.js +19 -2
  194. package/daemon/dist/routes/config.js.map +1 -1
  195. package/daemon/dist/routes/info.d.ts +3 -0
  196. package/daemon/dist/routes/info.d.ts.map +1 -0
  197. package/daemon/dist/routes/info.js +20 -0
  198. package/daemon/dist/routes/info.js.map +1 -0
  199. package/daemon/dist/routes/ps.js +4 -1
  200. package/daemon/dist/routes/ps.js.map +1 -1
  201. package/daemon/dist/routes/queue.d.ts +18 -0
  202. package/daemon/dist/routes/queue.d.ts.map +1 -1
  203. package/daemon/dist/routes/queue.js +97 -5
  204. package/daemon/dist/routes/queue.js.map +1 -1
  205. package/daemon/dist/routes/rig-policy.d.ts +9 -0
  206. package/daemon/dist/routes/rig-policy.d.ts.map +1 -0
  207. package/daemon/dist/routes/rig-policy.js +174 -0
  208. package/daemon/dist/routes/rig-policy.js.map +1 -0
  209. package/daemon/dist/routes/rigs.d.ts.map +1 -1
  210. package/daemon/dist/routes/rigs.js +134 -4
  211. package/daemon/dist/routes/rigs.js.map +1 -1
  212. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  213. package/daemon/dist/routes/sessions.js +26 -3
  214. package/daemon/dist/routes/sessions.js.map +1 -1
  215. package/daemon/dist/routes/up.d.ts +25 -0
  216. package/daemon/dist/routes/up.d.ts.map +1 -1
  217. package/daemon/dist/routes/up.js +70 -3
  218. package/daemon/dist/routes/up.js.map +1 -1
  219. package/daemon/dist/routes/workspace.d.ts.map +1 -1
  220. package/daemon/dist/routes/workspace.js +80 -1
  221. package/daemon/dist/routes/workspace.js.map +1 -1
  222. package/daemon/dist/server.d.ts +10 -0
  223. package/daemon/dist/server.d.ts.map +1 -1
  224. package/daemon/dist/server.js +11 -0
  225. package/daemon/dist/server.js.map +1 -1
  226. package/daemon/dist/startup.d.ts.map +1 -1
  227. package/daemon/dist/startup.js +46 -4
  228. package/daemon/dist/startup.js.map +1 -1
  229. package/daemon/docs/reference/getting-started.md +69 -0
  230. package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +28 -4
  231. package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +361 -15
  232. package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +2 -2
  233. package/daemon/specs/rigs/launch/conveyor/rig.yaml +1 -1
  234. package/dist/client.d.ts +3 -0
  235. package/dist/client.d.ts.map +1 -1
  236. package/dist/client.js +13 -1
  237. package/dist/client.js.map +1 -1
  238. package/dist/commands/add.d.ts +4 -0
  239. package/dist/commands/add.d.ts.map +1 -0
  240. package/dist/commands/add.js +115 -0
  241. package/dist/commands/add.js.map +1 -0
  242. package/dist/commands/archive.d.ts +10 -0
  243. package/dist/commands/archive.d.ts.map +1 -0
  244. package/dist/commands/archive.js +68 -0
  245. package/dist/commands/archive.js.map +1 -0
  246. package/dist/commands/bootstrap.js +2 -2
  247. package/dist/commands/bootstrap.js.map +1 -1
  248. package/dist/commands/bundle.d.ts.map +1 -1
  249. package/dist/commands/bundle.js +123 -2
  250. package/dist/commands/bundle.js.map +1 -1
  251. package/dist/commands/config-init-workspace.d.ts.map +1 -1
  252. package/dist/commands/config-init-workspace.js +40 -5
  253. package/dist/commands/config-init-workspace.js.map +1 -1
  254. package/dist/commands/discover.js +2 -2
  255. package/dist/commands/discover.js.map +1 -1
  256. package/dist/commands/down.d.ts +1 -1
  257. package/dist/commands/down.d.ts.map +1 -1
  258. package/dist/commands/down.js +91 -3
  259. package/dist/commands/down.js.map +1 -1
  260. package/dist/commands/ps.d.ts.map +1 -1
  261. package/dist/commands/ps.js +72 -10
  262. package/dist/commands/ps.js.map +1 -1
  263. package/dist/commands/queue.d.ts +6 -0
  264. package/dist/commands/queue.d.ts.map +1 -1
  265. package/dist/commands/queue.js +103 -5
  266. package/dist/commands/queue.js.map +1 -1
  267. package/dist/commands/rig-policy.d.ts +48 -0
  268. package/dist/commands/rig-policy.d.ts.map +1 -0
  269. package/dist/commands/rig-policy.js +429 -0
  270. package/dist/commands/rig-policy.js.map +1 -0
  271. package/dist/commands/scope.d.ts +6 -0
  272. package/dist/commands/scope.d.ts.map +1 -0
  273. package/dist/commands/scope.js +659 -0
  274. package/dist/commands/scope.js.map +1 -0
  275. package/dist/commands/send.d.ts.map +1 -1
  276. package/dist/commands/send.js +11 -0
  277. package/dist/commands/send.js.map +1 -1
  278. package/dist/commands/setup.d.ts +7 -0
  279. package/dist/commands/setup.d.ts.map +1 -1
  280. package/dist/commands/setup.js +28 -1
  281. package/dist/commands/setup.js.map +1 -1
  282. package/dist/commands/status.d.ts.map +1 -1
  283. package/dist/commands/status.js +35 -2
  284. package/dist/commands/status.js.map +1 -1
  285. package/dist/commands/unarchive.d.ts +10 -0
  286. package/dist/commands/unarchive.d.ts.map +1 -0
  287. package/dist/commands/unarchive.js +53 -0
  288. package/dist/commands/unarchive.js.map +1 -0
  289. package/dist/commands/up.d.ts.map +1 -1
  290. package/dist/commands/up.js +97 -0
  291. package/dist/commands/up.js.map +1 -1
  292. package/dist/commands/whoami.d.ts.map +1 -1
  293. package/dist/commands/whoami.js +4 -1
  294. package/dist/commands/whoami.js.map +1 -1
  295. package/dist/commands/workflow.d.ts +9 -0
  296. package/dist/commands/workflow.d.ts.map +1 -1
  297. package/dist/commands/workflow.js +141 -4
  298. package/dist/commands/workflow.js.map +1 -1
  299. package/dist/commands/workspace.d.ts +20 -0
  300. package/dist/commands/workspace.d.ts.map +1 -1
  301. package/dist/commands/workspace.js +140 -10
  302. package/dist/commands/workspace.js.map +1 -1
  303. package/dist/daemon-lifecycle.d.ts +48 -1
  304. package/dist/daemon-lifecycle.d.ts.map +1 -1
  305. package/dist/daemon-lifecycle.js +57 -2
  306. package/dist/daemon-lifecycle.js.map +1 -1
  307. package/dist/index.d.ts +5 -0
  308. package/dist/index.d.ts.map +1 -1
  309. package/dist/index.js +12 -0
  310. package/dist/index.js.map +1 -1
  311. package/dist/lib/scope/dot-id.d.ts +43 -0
  312. package/dist/lib/scope/dot-id.d.ts.map +1 -0
  313. package/dist/lib/scope/dot-id.js +165 -0
  314. package/dist/lib/scope/dot-id.js.map +1 -0
  315. package/dist/lib/scope/scope-fs.d.ts +79 -0
  316. package/dist/lib/scope/scope-fs.d.ts.map +1 -0
  317. package/dist/lib/scope/scope-fs.js +468 -0
  318. package/dist/lib/scope/scope-fs.js.map +1 -0
  319. package/dist/lib/scope/templates.d.ts +38 -0
  320. package/dist/lib/scope/templates.d.ts.map +1 -0
  321. package/dist/lib/scope/templates.js +109 -0
  322. package/dist/lib/scope/templates.js.map +1 -0
  323. package/dist/lib/scope/types.d.ts +61 -0
  324. package/dist/lib/scope/types.d.ts.map +1 -0
  325. package/dist/lib/scope/types.js +38 -0
  326. package/dist/lib/scope/types.js.map +1 -0
  327. package/dist/lib/scope-templates/backlog-deprecation.md +26 -0
  328. package/dist/lib/scope-templates/backlog-tech-debt.md +22 -0
  329. package/dist/lib/scope-templates/bug-fix.md +30 -0
  330. package/dist/lib/scope-templates/mission-notes.md +97 -0
  331. package/dist/lib/scope-templates/mission-placeholder.md +20 -0
  332. package/dist/lib/scope-templates/mission-release.md +25 -0
  333. package/dist/lib/scope-templates/placeholder.md +30 -0
  334. package/dist/lib/scope-templates/release-feature.md +26 -0
  335. package/dist/lib/scope-templates/research.md +22 -0
  336. package/dist/mcp-server.d.ts.map +1 -1
  337. package/dist/mcp-server.js +29 -0
  338. package/dist/mcp-server.js.map +1 -1
  339. package/dist/release-surface/affected-skills.d.ts +49 -0
  340. package/dist/release-surface/affected-skills.d.ts.map +1 -0
  341. package/dist/release-surface/affected-skills.js +153 -0
  342. package/dist/release-surface/affected-skills.js.map +1 -0
  343. package/dist/release-surface/extract-surface.d.ts +23 -0
  344. package/dist/release-surface/extract-surface.d.ts.map +1 -0
  345. package/dist/release-surface/extract-surface.js +193 -0
  346. package/dist/release-surface/extract-surface.js.map +1 -0
  347. package/dist/release-surface/generate.d.ts +2 -0
  348. package/dist/release-surface/generate.d.ts.map +1 -0
  349. package/dist/release-surface/generate.js +51 -0
  350. package/dist/release-surface/generate.js.map +1 -0
  351. package/dist/release-surface/surface-diff.d.ts +40 -0
  352. package/dist/release-surface/surface-diff.d.ts.map +1 -0
  353. package/dist/release-surface/surface-diff.js +212 -0
  354. package/dist/release-surface/surface-diff.js.map +1 -0
  355. package/package.json +2 -2
  356. package/ui/dist/assets/index-CrJgCmkX.js +552 -0
  357. package/ui/dist/index.html +1 -1
  358. package/ui/dist/assets/index-Rl3ZBrUg.js +0 -547
@@ -0,0 +1,552 @@
1
+ var w7=Object.defineProperty;var TA=e=>{throw TypeError(e)};var j7=(e,t,n)=>t in e?w7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ts=(e,t,n)=>j7(e,typeof t!="symbol"?t+"":t,n),Ny=(e,t,n)=>t.has(e)||TA("Cannot "+n);var Y=(e,t,n)=>(Ny(e,t,"read from private field"),n?n.call(e):t.get(e)),be=(e,t,n)=>t.has(e)?TA("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),me=(e,t,n,s)=>(Ny(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Te=(e,t,n)=>(Ny(e,t,"access private method"),n);var Zh=(e,t,n,s)=>({set _(r){me(e,t,r,n)},get _(){return Y(e,t,s)}});function S7(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const a=Object.getOwnPropertyDescriptor(s,r);a&&Object.defineProperty(e,r,a.get?a:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();var Jh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ky={exports:{}},Mu={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var IA;function N7(){if(IA)return Mu;IA=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,r,a){var l=null;if(a!==void 0&&(l=""+a),r.key!==void 0&&(l=""+r.key),"key"in r){a={};for(var u in r)u!=="key"&&(a[u]=r[u])}else a=r;return r=a.ref,{$$typeof:e,type:s,key:l,ref:r!==void 0?r:null,props:a}}return Mu.Fragment=t,Mu.jsx=n,Mu.jsxs=n,Mu}var MA;function k7(){return MA||(MA=1,ky.exports=N7()),ky.exports}var i=k7(),_y={exports:{}},Be={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var OA;function _7(){if(OA)return Be;OA=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),x=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function S(D,V,ne){this.props=D,this.context=V,this.refs=w,this.updater=ne||v}S.prototype.isReactComponent={},S.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,V,"setState")},S.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function E(){}E.prototype=S.prototype;function k(D,V,ne){this.props=D,this.context=V,this.refs=w,this.updater=ne||v}var _=k.prototype=new E;_.constructor=k,b(_,S.prototype),_.isPureReactComponent=!0;var R=Array.isArray;function T(){}var A={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function L(D,V,ne){var U=ne.ref;return{$$typeof:e,type:D,key:V,ref:U!==void 0?U:null,props:ne}}function P(D,V){return L(D.type,V,D.props)}function O(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function B(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ne){return V[ne]})}var H=/\/+/g;function z(D,V){return typeof D=="object"&&D!==null&&D.key!=null?B(""+D.key):V.toString(36)}function W(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(T,T):(D.status="pending",D.then(function(V){D.status==="pending"&&(D.status="fulfilled",D.value=V)},function(V){D.status==="pending"&&(D.status="rejected",D.reason=V)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function $(D,V,ne,U,Q){var K=typeof D;(K==="undefined"||K==="boolean")&&(D=null);var te=!1;if(D===null)te=!0;else switch(K){case"bigint":case"string":case"number":te=!0;break;case"object":switch(D.$$typeof){case e:case t:te=!0;break;case p:return te=D._init,$(te(D._payload),V,ne,U,Q)}}if(te)return Q=Q(D),te=U===""?"."+z(D,0):U,R(Q)?(ne="",te!=null&&(ne=te.replace(H,"$&/")+"/"),$(Q,V,ne,"",function(pe){return pe})):Q!=null&&(O(Q)&&(Q=P(Q,ne+(Q.key==null||D&&D.key===Q.key?"":(""+Q.key).replace(H,"$&/")+"/")+te)),V.push(Q)),1;te=0;var re=U===""?".":U+":";if(R(D))for(var oe=0;oe<D.length;oe++)U=D[oe],K=re+z(U,oe),te+=$(U,V,ne,K,Q);else if(oe=y(D),typeof oe=="function")for(D=oe.call(D),oe=0;!(U=D.next()).done;)U=U.value,K=re+z(U,oe++),te+=$(U,V,ne,K,Q);else if(K==="object"){if(typeof D.then=="function")return $(W(D),V,ne,U,Q);throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return te}function F(D,V,ne){if(D==null)return D;var U=[],Q=0;return $(D,U,"","",function(K){return V.call(ne,K,Q++)}),U}function G(D){if(D._status===-1){var V=D._result;V=V(),V.then(function(ne){(D._status===0||D._status===-1)&&(D._status=1,D._result=ne)},function(ne){(D._status===0||D._status===-1)&&(D._status=2,D._result=ne)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var X=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},Z={map:F,forEach:function(D,V,ne){F(D,function(){V.apply(this,arguments)},ne)},count:function(D){var V=0;return F(D,function(){V++}),V},toArray:function(D){return F(D,function(V){return V})||[]},only:function(D){if(!O(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Be.Activity=m,Be.Children=Z,Be.Component=S,Be.Fragment=n,Be.Profiler=r,Be.PureComponent=k,Be.StrictMode=s,Be.Suspense=d,Be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,Be.__COMPILER_RUNTIME={__proto__:null,c:function(D){return A.H.useMemoCache(D)}},Be.cache=function(D){return function(){return D.apply(null,arguments)}},Be.cacheSignal=function(){return null},Be.cloneElement=function(D,V,ne){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var U=b({},D.props),Q=D.key;if(V!=null)for(K in V.key!==void 0&&(Q=""+V.key),V)!M.call(V,K)||K==="key"||K==="__self"||K==="__source"||K==="ref"&&V.ref===void 0||(U[K]=V[K]);var K=arguments.length-2;if(K===1)U.children=ne;else if(1<K){for(var te=Array(K),re=0;re<K;re++)te[re]=arguments[re+2];U.children=te}return L(D.type,Q,U)},Be.createContext=function(D){return D={$$typeof:l,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:a,_context:D},D},Be.createElement=function(D,V,ne){var U,Q={},K=null;if(V!=null)for(U in V.key!==void 0&&(K=""+V.key),V)M.call(V,U)&&U!=="key"&&U!=="__self"&&U!=="__source"&&(Q[U]=V[U]);var te=arguments.length-2;if(te===1)Q.children=ne;else if(1<te){for(var re=Array(te),oe=0;oe<te;oe++)re[oe]=arguments[oe+2];Q.children=re}if(D&&D.defaultProps)for(U in te=D.defaultProps,te)Q[U]===void 0&&(Q[U]=te[U]);return L(D,K,Q)},Be.createRef=function(){return{current:null}},Be.forwardRef=function(D){return{$$typeof:u,render:D}},Be.isValidElement=O,Be.lazy=function(D){return{$$typeof:p,_payload:{_status:-1,_result:D},_init:G}},Be.memo=function(D,V){return{$$typeof:f,type:D,compare:V===void 0?null:V}},Be.startTransition=function(D){var V=A.T,ne={};A.T=ne;try{var U=D(),Q=A.S;Q!==null&&Q(ne,U),typeof U=="object"&&U!==null&&typeof U.then=="function"&&U.then(T,X)}catch(K){X(K)}finally{V!==null&&ne.types!==null&&(V.types=ne.types),A.T=V}},Be.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},Be.use=function(D){return A.H.use(D)},Be.useActionState=function(D,V,ne){return A.H.useActionState(D,V,ne)},Be.useCallback=function(D,V){return A.H.useCallback(D,V)},Be.useContext=function(D){return A.H.useContext(D)},Be.useDebugValue=function(){},Be.useDeferredValue=function(D,V){return A.H.useDeferredValue(D,V)},Be.useEffect=function(D,V){return A.H.useEffect(D,V)},Be.useEffectEvent=function(D){return A.H.useEffectEvent(D)},Be.useId=function(){return A.H.useId()},Be.useImperativeHandle=function(D,V,ne){return A.H.useImperativeHandle(D,V,ne)},Be.useInsertionEffect=function(D,V){return A.H.useInsertionEffect(D,V)},Be.useLayoutEffect=function(D,V){return A.H.useLayoutEffect(D,V)},Be.useMemo=function(D,V){return A.H.useMemo(D,V)},Be.useOptimistic=function(D,V){return A.H.useOptimistic(D,V)},Be.useReducer=function(D,V,ne){return A.H.useReducer(D,V,ne)},Be.useRef=function(D){return A.H.useRef(D)},Be.useState=function(D){return A.H.useState(D)},Be.useSyncExternalStore=function(D,V,ne){return A.H.useSyncExternalStore(D,V,ne)},Be.useTransition=function(){return A.H.useTransition()},Be.version="19.2.4",Be}var LA;function ef(){return LA||(LA=1,_y.exports=_7()),_y.exports}var C=ef();const wo=Hm(C),p2=S7({__proto__:null,default:wo},[C]);var Cy={exports:{}},Ou={},Ey={exports:{}},Ry={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var PA;function C7(){return PA||(PA=1,(function(e){function t($,F){var G=$.length;$.push(F);e:for(;0<G;){var X=G-1>>>1,Z=$[X];if(0<r(Z,F))$[X]=F,$[G]=Z,G=X;else break e}}function n($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var F=$[0],G=$.pop();if(G!==F){$[0]=G;e:for(var X=0,Z=$.length,D=Z>>>1;X<D;){var V=2*(X+1)-1,ne=$[V],U=V+1,Q=$[U];if(0>r(ne,G))U<Z&&0>r(Q,ne)?($[X]=Q,$[U]=G,X=U):($[X]=ne,$[V]=G,X=V);else if(U<Z&&0>r(Q,G))$[X]=Q,$[U]=G,X=U;else break e}}return F}function r($,F){var G=$.sortIndex-F.sortIndex;return G!==0?G:$.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],f=[],p=1,m=null,x=3,y=!1,v=!1,b=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function _($){for(var F=n(f);F!==null;){if(F.callback===null)s(f);else if(F.startTime<=$)s(f),F.sortIndex=F.expirationTime,t(d,F);else break;F=n(f)}}function R($){if(b=!1,_($),!v)if(n(d)!==null)v=!0,T||(T=!0,B());else{var F=n(f);F!==null&&W(R,F.startTime-$)}}var T=!1,A=-1,M=5,L=-1;function P(){return w?!0:!(e.unstable_now()-L<M)}function O(){if(w=!1,T){var $=e.unstable_now();L=$;var F=!0;try{e:{v=!1,b&&(b=!1,E(A),A=-1),y=!0;var G=x;try{t:{for(_($),m=n(d);m!==null&&!(m.expirationTime>$&&P());){var X=m.callback;if(typeof X=="function"){m.callback=null,x=m.priorityLevel;var Z=X(m.expirationTime<=$);if($=e.unstable_now(),typeof Z=="function"){m.callback=Z,_($),F=!0;break t}m===n(d)&&s(d),_($)}else s(d);m=n(d)}if(m!==null)F=!0;else{var D=n(f);D!==null&&W(R,D.startTime-$),F=!1}}break e}finally{m=null,x=G,y=!1}F=void 0}}finally{F?B():T=!1}}}var B;if(typeof k=="function")B=function(){k(O)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,z=H.port2;H.port1.onmessage=O,B=function(){z.postMessage(null)}}else B=function(){S(O,0)};function W($,F){A=S(function(){$(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function($){switch(x){case 1:case 2:case 3:var F=3;break;default:F=x}var G=x;x=F;try{return $()}finally{x=G}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function($,F){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var G=x;x=$;try{return F()}finally{x=G}},e.unstable_scheduleCallback=function($,F,G){var X=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?X+G:X):G=X,$){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=G+Z,$={id:p++,callback:F,priorityLevel:$,startTime:G,expirationTime:Z,sortIndex:-1},G>X?($.sortIndex=G,t(f,$),n(d)===null&&$===n(f)&&(b?(E(A),A=-1):b=!0,W(R,G-X))):($.sortIndex=Z,t(d,$),v||y||(v=!0,T||(T=!0,B()))),$},e.unstable_shouldYield=P,e.unstable_wrapCallback=function($){var F=x;return function(){var G=x;x=F;try{return $.apply(this,arguments)}finally{x=G}}}})(Ry)),Ry}var $A;function E7(){return $A||($A=1,Ey.exports=C7()),Ey.exports}var Ay={exports:{}},pn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var DA;function R7(){if(DA)return pn;DA=1;var e=ef();function t(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function a(d,f,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:m==null?null:""+m,children:d,containerInfo:f,implementation:p}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return pn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,pn.createPortal=function(d,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return a(d,f,null,p)},pn.flushSync=function(d){var f=l.T,p=s.p;try{if(l.T=null,s.p=2,d)return d()}finally{l.T=f,s.p=p,s.d.f()}},pn.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(d,f))},pn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},pn.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var p=f.as,m=u(p,f.crossOrigin),x=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?s.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:x,fetchPriority:y}):p==="script"&&s.d.X(d,{crossOrigin:m,integrity:x,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},pn.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=u(f.as,f.crossOrigin);s.d.M(d,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&s.d.M(d)},pn.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,m=u(p,f.crossOrigin);s.d.L(d,p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},pn.preloadModule=function(d,f){if(typeof d=="string")if(f){var p=u(f.as,f.crossOrigin);s.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(d)},pn.requestFormReset=function(d){s.d.r(d)},pn.unstable_batchedUpdates=function(d,f){return d(f)},pn.useFormState=function(d,f,p){return l.H.useFormState(d,f,p)},pn.useFormStatus=function(){return l.H.useHostTransitionStatus()},pn.version="19.2.4",pn}var qA;function JP(){if(qA)return Ay.exports;qA=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ay.exports=R7(),Ay.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var zA;function A7(){if(zA)return Ou;zA=1;var e=E7(),t=ef(),n=JP();function s(o){var c="https://react.dev/errors/"+o;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var c=o,h=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(h=c.return),o=c.return;while(o)}return c.tag===3?h:null}function l(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function u(o){if(o.tag===31){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function d(o){if(a(o)!==o)throw Error(s(188))}function f(o){var c=o.alternate;if(!c){if(c=a(o),c===null)throw Error(s(188));return c!==o?null:o}for(var h=o,g=c;;){var j=h.return;if(j===null)break;var N=j.alternate;if(N===null){if(g=j.return,g!==null){h=g;continue}break}if(j.child===N.child){for(N=j.child;N;){if(N===h)return d(j),o;if(N===g)return d(j),c;N=N.sibling}throw Error(s(188))}if(h.return!==g.return)h=j,g=N;else{for(var I=!1,q=j.child;q;){if(q===h){I=!0,h=j,g=N;break}if(q===g){I=!0,g=j,h=N;break}q=q.sibling}if(!I){for(q=N.child;q;){if(q===h){I=!0,h=N,g=j;break}if(q===g){I=!0,g=N,h=j;break}q=q.sibling}if(!I)throw Error(s(189))}}if(h.alternate!==g)throw Error(s(190))}if(h.tag!==3)throw Error(s(188));return h.stateNode.current===h?o:c}function p(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=p(o),c!==null)return c;o=o.sibling}return null}var m=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),O=Symbol.iterator;function B(o){return o===null||typeof o!="object"?null:(o=O&&o[O]||o["@@iterator"],typeof o=="function"?o:null)}var H=Symbol.for("react.client.reference");function z(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===H?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case b:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case R:return"Suspense";case T:return"SuspenseList";case L:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case v:return"Portal";case k:return o.displayName||"Context";case E:return(o._context.displayName||"Context")+".Consumer";case _:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case A:return c=o.displayName||null,c!==null?c:z(o.type)||"Memo";case M:c=o._payload,o=o._init;try{return z(o(c))}catch{}}return null}var W=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},X=[],Z=-1;function D(o){return{current:o}}function V(o){0>Z||(o.current=X[Z],X[Z]=null,Z--)}function ne(o,c){Z++,X[Z]=o.current,o.current=c}var U=D(null),Q=D(null),K=D(null),te=D(null);function re(o,c){switch(ne(K,c),ne(Q,o),ne(U,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?eA(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=eA(c),o=tA(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}V(U),ne(U,o)}function oe(){V(U),V(Q),V(K)}function pe(o){o.memoizedState!==null&&ne(te,o);var c=U.current,h=tA(c,o.type);c!==h&&(ne(Q,o),ne(U,h))}function ge(o){Q.current===o&&(V(U),V(Q)),te.current===o&&(V(te),Ru._currentValue=G)}var ve,xe;function Ne(o){if(ve===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);ve=c&&c[1]||"",xe=-1<h.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ve+o+xe}var we=!1;function De(o,c){if(!o||we)return"";we=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(c){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ce){var le=ce}Reflect.construct(o,[],fe)}else{try{fe.call()}catch(ce){le=ce}o.call(fe.prototype)}}else{try{throw Error()}catch(ce){le=ce}(fe=o())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ce){if(ce&&le&&typeof ce.stack=="string")return[ce.stack,le.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var j=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");j&&j.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=g.DetermineComponentFrameRoot(),I=N[0],q=N[1];if(I&&q){var J=I.split(`
44
+ `),ae=q.split(`
45
+ `);for(j=g=0;g<J.length&&!J[g].includes("DetermineComponentFrameRoot");)g++;for(;j<ae.length&&!ae[j].includes("DetermineComponentFrameRoot");)j++;if(g===J.length||j===ae.length)for(g=J.length-1,j=ae.length-1;1<=g&&0<=j&&J[g]!==ae[j];)j--;for(;1<=g&&0<=j;g--,j--)if(J[g]!==ae[j]){if(g!==1||j!==1)do if(g--,j--,0>j||J[g]!==ae[j]){var ue=`
46
+ `+J[g].replace(" at new "," at ");return o.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",o.displayName)),ue}while(1<=g&&0<=j);break}}}finally{we=!1,Error.prepareStackTrace=h}return(h=o?o.displayName||o.name:"")?Ne(h):""}function Ee(o,c){switch(o.tag){case 26:case 27:case 5:return Ne(o.type);case 16:return Ne("Lazy");case 13:return o.child!==c&&c!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return De(o.type,!1);case 11:return De(o.type.render,!1);case 1:return De(o.type,!0);case 31:return Ne("Activity");default:return""}}function Ct(o){try{var c="",h=null;do c+=Ee(o,h),h=o,o=o.return;while(o);return c}catch(g){return`
47
+ Error generating stack: `+g.message+`
48
+ `+g.stack}}var ut=Object.prototype.hasOwnProperty,jn=e.unstable_scheduleCallback,tn=e.unstable_cancelCallback,Xt=e.unstable_shouldYield,yt=e.unstable_requestPaint,Oe=e.unstable_now,mt=e.unstable_getCurrentPriorityLevel,Kt=e.unstable_ImmediatePriority,Kn=e.unstable_UserBlockingPriority,An=e.unstable_NormalPriority,qo=e.unstable_LowPriority,pr=e.unstable_IdlePriority,qc=e.log,zo=e.unstable_setDisableYieldValue,fn=null,_t=null;function Ks(o){if(typeof qc=="function"&&zo(o),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(fn,o)}catch{}}var Sn=Math.clz32?Math.clz32:fx,ux=Math.log,dx=Math.LN2;function fx(o){return o>>>=0,o===0?32:31-(ux(o)/dx|0)|0}var Bo=256,Fo=262144,Ho=4194304;function mr(o){var c=o&42;if(c!==0)return c;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Uo(o,c,h){var g=o.pendingLanes;if(g===0)return 0;var j=0,N=o.suspendedLanes,I=o.pingedLanes;o=o.warmLanes;var q=g&134217727;return q!==0?(g=q&~N,g!==0?j=mr(g):(I&=q,I!==0?j=mr(I):h||(h=q&~o,h!==0&&(j=mr(h))))):(q=g&~N,q!==0?j=mr(q):I!==0?j=mr(I):h||(h=g&~o,h!==0&&(j=mr(h)))),j===0?0:c!==0&&c!==j&&(c&N)===0&&(N=j&-j,h=c&-c,N>=h||N===32&&(h&4194048)!==0)?c:j}function Sa(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function hx(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rf(){var o=Ho;return Ho<<=1,(Ho&62914560)===0&&(Ho=4194304),o}function zc(o){for(var c=[],h=0;31>h;h++)c.push(o);return c}function Na(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function px(o,c,h,g,j,N){var I=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var q=o.entanglements,J=o.expirationTimes,ae=o.hiddenUpdates;for(h=I&~h;0<h;){var ue=31-Sn(h),fe=1<<ue;q[ue]=0,J[ue]=-1;var le=ae[ue];if(le!==null)for(ae[ue]=null,ue=0;ue<le.length;ue++){var ce=le[ue];ce!==null&&(ce.lane&=-536870913)}h&=~fe}g!==0&&Af(o,g,0),N!==0&&j===0&&o.tag!==0&&(o.suspendedLanes|=N&~(I&~c))}function Af(o,c,h){o.pendingLanes|=c,o.suspendedLanes&=~c;var g=31-Sn(c);o.entangledLanes|=c,o.entanglements[g]=o.entanglements[g]|1073741824|h&261930}function Tf(o,c){var h=o.entangledLanes|=c;for(o=o.entanglements;h;){var g=31-Sn(h),j=1<<g;j&c|o[g]&c&&(o[g]|=c),h&=~j}}function If(o,c){var h=c&-c;return h=(h&42)!==0?1:Bc(h),(h&(o.suspendedLanes|c))!==0?0:h}function Bc(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Fc(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Mf(){var o=F.p;return o!==0?o:(o=window.event,o===void 0?32:NA(o.type))}function Of(o,c){var h=F.p;try{return F.p=o,c()}finally{F.p=h}}var Ws=Math.random().toString(36).slice(2),Wt="__reactFiber$"+Ws,hn="__reactProps$"+Ws,gr="__reactContainer$"+Ws,Vo="__reactEvents$"+Ws,Lf="__reactListeners$"+Ws,mx="__reactHandles$"+Ws,Pf="__reactResources$"+Ws,ka="__reactMarker$"+Ws;function Hc(o){delete o[Wt],delete o[hn],delete o[Vo],delete o[Lf],delete o[mx]}function ii(o){var c=o[Wt];if(c)return c;for(var h=o.parentNode;h;){if(c=h[gr]||h[Wt]){if(h=c.alternate,c.child!==null||h!==null&&h.child!==null)for(o=lA(o);o!==null;){if(h=o[Wt])return h;o=lA(o)}return c}o=h,h=o.parentNode}return null}function ai(o){if(o=o[Wt]||o[gr]){var c=o.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return o}return null}function oi(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o.stateNode;throw Error(s(33))}function li(o){var c=o[Pf];return c||(c=o[Pf]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function qt(o){o[ka]=!0}var $f=new Set,Df={};function xr(o,c){ci(o,c),ci(o+"Capture",c)}function ci(o,c){for(Df[o]=c,o=0;o<c.length;o++)$f.add(c[o])}var gx=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Uc={},qf={};function xx(o){return ut.call(qf,o)?!0:ut.call(Uc,o)?!1:gx.test(o)?qf[o]=!0:(Uc[o]=!0,!1)}function Go(o,c,h){if(xx(c))if(h===null)o.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":o.removeAttribute(c);return;case"boolean":var g=c.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){o.removeAttribute(c);return}}o.setAttribute(c,""+h)}}function Ko(o,c,h){if(h===null)o.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(c);return}o.setAttribute(c,""+h)}}function Cs(o,c,h,g){if(g===null)o.removeAttribute(h);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(h);return}o.setAttributeNS(c,h,""+g)}}function Tn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function zf(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function yx(o,c,h){var g=Object.getOwnPropertyDescriptor(o.constructor.prototype,c);if(!o.hasOwnProperty(c)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var j=g.get,N=g.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return j.call(this)},set:function(I){h=""+I,N.call(this,I)}}),Object.defineProperty(o,c,{enumerable:g.enumerable}),{getValue:function(){return h},setValue:function(I){h=""+I},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function ui(o){if(!o._valueTracker){var c=zf(o)?"checked":"value";o._valueTracker=yx(o,c,""+o[c])}}function Bf(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var h=c.getValue(),g="";return o&&(g=zf(o)?o.checked?"true":"false":o.value),o=g,o!==h?(c.setValue(o),!0):!1}function _a(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var vx=/[\n"\\]/g;function In(o){return o.replace(vx,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function Ca(o,c,h,g,j,N,I,q){o.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?o.type=I:o.removeAttribute("type"),c!=null?I==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+Tn(c)):o.value!==""+Tn(c)&&(o.value=""+Tn(c)):I!=="submit"&&I!=="reset"||o.removeAttribute("value"),c!=null?Vc(o,I,Tn(c)):h!=null?Vc(o,I,Tn(h)):g!=null&&o.removeAttribute("value"),j==null&&N!=null&&(o.defaultChecked=!!N),j!=null&&(o.checked=j&&typeof j!="function"&&typeof j!="symbol"),q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?o.name=""+Tn(q):o.removeAttribute("name")}function Ff(o,c,h,g,j,N,I,q){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(o.type=N),c!=null||h!=null){if(!(N!=="submit"&&N!=="reset"||c!=null)){ui(o);return}h=h!=null?""+Tn(h):"",c=c!=null?""+Tn(c):h,q||c===o.value||(o.value=c),o.defaultValue=c}g=g??j,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=q?o.checked:!!g,o.defaultChecked=!!g,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(o.name=I),ui(o)}function Vc(o,c,h){c==="number"&&_a(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function yr(o,c,h,g){if(o=o.options,c){c={};for(var j=0;j<h.length;j++)c["$"+h[j]]=!0;for(h=0;h<o.length;h++)j=c.hasOwnProperty("$"+o[h].value),o[h].selected!==j&&(o[h].selected=j),j&&g&&(o[h].defaultSelected=!0)}else{for(h=""+Tn(h),c=null,j=0;j<o.length;j++){if(o[j].value===h){o[j].selected=!0,g&&(o[j].defaultSelected=!0);return}c!==null||o[j].disabled||(c=o[j])}c!==null&&(c.selected=!0)}}function Y_(o,c,h){if(c!=null&&(c=""+Tn(c),c!==o.value&&(o.value=c),h==null)){o.defaultValue!==c&&(o.defaultValue=c);return}o.defaultValue=h!=null?""+Tn(h):""}function Q_(o,c,h,g){if(c==null){if(g!=null){if(h!=null)throw Error(s(92));if(W(g)){if(1<g.length)throw Error(s(93));g=g[0]}h=g}h==null&&(h=""),c=h}h=Tn(c),o.defaultValue=h,g=o.textContent,g===h&&g!==""&&g!==null&&(o.value=g),ui(o)}function Wo(o,c){if(c){var h=o.firstChild;if(h&&h===o.lastChild&&h.nodeType===3){h.nodeValue=c;return}}o.textContent=c}var gB=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function X_(o,c,h){var g=c.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?g?o.setProperty(c,""):c==="float"?o.cssFloat="":o[c]="":g?o.setProperty(c,h):typeof h!="number"||h===0||gB.has(c)?c==="float"?o.cssFloat=h:o[c]=(""+h).trim():o[c]=h+"px"}function Z_(o,c,h){if(c!=null&&typeof c!="object")throw Error(s(62));if(o=o.style,h!=null){for(var g in h)!h.hasOwnProperty(g)||c!=null&&c.hasOwnProperty(g)||(g.indexOf("--")===0?o.setProperty(g,""):g==="float"?o.cssFloat="":o[g]="");for(var j in c)g=c[j],c.hasOwnProperty(j)&&h[j]!==g&&X_(o,j,g)}else for(var N in c)c.hasOwnProperty(N)&&X_(o,N,c[N])}function bx(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xB=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),yB=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hf(o){return yB.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function vr(){}var wx=null;function jx(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Yo=null,Qo=null;function J_(o){var c=ai(o);if(c&&(o=c.stateNode)){var h=o[hn]||null;e:switch(o=c.stateNode,c.type){case"input":if(Ca(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),c=h.name,h.type==="radio"&&c!=null){for(h=o;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+In(""+c)+'"][type="radio"]'),c=0;c<h.length;c++){var g=h[c];if(g!==o&&g.form===o.form){var j=g[hn]||null;if(!j)throw Error(s(90));Ca(g,j.value,j.defaultValue,j.defaultValue,j.checked,j.defaultChecked,j.type,j.name)}}for(c=0;c<h.length;c++)g=h[c],g.form===o.form&&Bf(g)}break e;case"textarea":Y_(o,h.value,h.defaultValue);break e;case"select":c=h.value,c!=null&&yr(o,!!h.multiple,c,!1)}}}var Sx=!1;function eC(o,c,h){if(Sx)return o(c,h);Sx=!0;try{var g=o(c);return g}finally{if(Sx=!1,(Yo!==null||Qo!==null)&&(Ah(),Yo&&(c=Yo,o=Qo,Qo=Yo=null,J_(c),o)))for(c=0;c<o.length;c++)J_(o[c])}}function Gc(o,c){var h=o.stateNode;if(h===null)return null;var g=h[hn]||null;if(g===null)return null;h=g[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(h&&typeof h!="function")throw Error(s(231,c,typeof h));return h}var br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nx=!1;if(br)try{var Kc={};Object.defineProperty(Kc,"passive",{get:function(){Nx=!0}}),window.addEventListener("test",Kc,Kc),window.removeEventListener("test",Kc,Kc)}catch{Nx=!1}var di=null,kx=null,Uf=null;function tC(){if(Uf)return Uf;var o,c=kx,h=c.length,g,j="value"in di?di.value:di.textContent,N=j.length;for(o=0;o<h&&c[o]===j[o];o++);var I=h-o;for(g=1;g<=I&&c[h-g]===j[N-g];g++);return Uf=j.slice(o,1<g?1-g:void 0)}function Vf(o){var c=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function Gf(){return!0}function nC(){return!1}function Mn(o){function c(h,g,j,N,I){this._reactName=h,this._targetInst=j,this.type=g,this.nativeEvent=N,this.target=I,this.currentTarget=null;for(var q in o)o.hasOwnProperty(q)&&(h=o[q],this[q]=h?h(N):N[q]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?Gf:nC,this.isPropagationStopped=nC,this}return m(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=Gf)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=Gf)},persist:function(){},isPersistent:Gf}),c}var Ea={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Kf=Mn(Ea),Wc=m({},Ea,{view:0,detail:0}),vB=Mn(Wc),_x,Cx,Yc,Wf=m({},Wc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rx,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Yc&&(Yc&&o.type==="mousemove"?(_x=o.screenX-Yc.screenX,Cx=o.screenY-Yc.screenY):Cx=_x=0,Yc=o),_x)},movementY:function(o){return"movementY"in o?o.movementY:Cx}}),sC=Mn(Wf),bB=m({},Wf,{dataTransfer:0}),wB=Mn(bB),jB=m({},Wc,{relatedTarget:0}),Ex=Mn(jB),SB=m({},Ea,{animationName:0,elapsedTime:0,pseudoElement:0}),NB=Mn(SB),kB=m({},Ea,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),_B=Mn(kB),CB=m({},Ea,{data:0}),rC=Mn(CB),EB={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},RB={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},AB={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function TB(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=AB[o])?!!c[o]:!1}function Rx(){return TB}var IB=m({},Wc,{key:function(o){if(o.key){var c=EB[o.key]||o.key;if(c!=="Unidentified")return c}return o.type==="keypress"?(o=Vf(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?RB[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rx,charCode:function(o){return o.type==="keypress"?Vf(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Vf(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),MB=Mn(IB),OB=m({},Wf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),iC=Mn(OB),LB=m({},Wc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rx}),PB=Mn(LB),$B=m({},Ea,{propertyName:0,elapsedTime:0,pseudoElement:0}),DB=Mn($B),qB=m({},Wf,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),zB=Mn(qB),BB=m({},Ea,{newState:0,oldState:0}),FB=Mn(BB),HB=[9,13,27,32],Ax=br&&"CompositionEvent"in window,Qc=null;br&&"documentMode"in document&&(Qc=document.documentMode);var UB=br&&"TextEvent"in window&&!Qc,aC=br&&(!Ax||Qc&&8<Qc&&11>=Qc),oC=" ",lC=!1;function cC(o,c){switch(o){case"keyup":return HB.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uC(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Xo=!1;function VB(o,c){switch(o){case"compositionend":return uC(c);case"keypress":return c.which!==32?null:(lC=!0,oC);case"textInput":return o=c.data,o===oC&&lC?null:o;default:return null}}function GB(o,c){if(Xo)return o==="compositionend"||!Ax&&cC(o,c)?(o=tC(),Uf=kx=di=null,Xo=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return aC&&c.locale!=="ko"?null:c.data;default:return null}}var KB={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function dC(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!KB[o.type]:c==="textarea"}function fC(o,c,h,g){Yo?Qo?Qo.push(g):Qo=[g]:Yo=g,c=$h(c,"onChange"),0<c.length&&(h=new Kf("onChange","change",null,h,g),o.push({event:h,listeners:c}))}var Xc=null,Zc=null;function WB(o){WR(o,0)}function Yf(o){var c=oi(o);if(Bf(c))return o}function hC(o,c){if(o==="change")return c}var pC=!1;if(br){var Tx;if(br){var Ix="oninput"in document;if(!Ix){var mC=document.createElement("div");mC.setAttribute("oninput","return;"),Ix=typeof mC.oninput=="function"}Tx=Ix}else Tx=!1;pC=Tx&&(!document.documentMode||9<document.documentMode)}function gC(){Xc&&(Xc.detachEvent("onpropertychange",xC),Zc=Xc=null)}function xC(o){if(o.propertyName==="value"&&Yf(Zc)){var c=[];fC(c,Zc,o,jx(o)),eC(WB,c)}}function YB(o,c,h){o==="focusin"?(gC(),Xc=c,Zc=h,Xc.attachEvent("onpropertychange",xC)):o==="focusout"&&gC()}function QB(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Yf(Zc)}function XB(o,c){if(o==="click")return Yf(c)}function ZB(o,c){if(o==="input"||o==="change")return Yf(c)}function JB(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Wn=typeof Object.is=="function"?Object.is:JB;function Jc(o,c){if(Wn(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var h=Object.keys(o),g=Object.keys(c);if(h.length!==g.length)return!1;for(g=0;g<h.length;g++){var j=h[g];if(!ut.call(c,j)||!Wn(o[j],c[j]))return!1}return!0}function yC(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function vC(o,c){var h=yC(o);o=0;for(var g;h;){if(h.nodeType===3){if(g=o+h.textContent.length,o<=c&&g>=c)return{node:h,offset:c-o};o=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=yC(h)}}function bC(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?bC(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function wC(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=_a(o.document);c instanceof o.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)o=c.contentWindow;else break;c=_a(o.document)}return c}function Mx(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var eF=br&&"documentMode"in document&&11>=document.documentMode,Zo=null,Ox=null,eu=null,Lx=!1;function jC(o,c,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Lx||Zo==null||Zo!==_a(g)||(g=Zo,"selectionStart"in g&&Mx(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),eu&&Jc(eu,g)||(eu=g,g=$h(Ox,"onSelect"),0<g.length&&(c=new Kf("onSelect","select",null,c,h),o.push({event:c,listeners:g}),c.target=Zo)))}function Ra(o,c){var h={};return h[o.toLowerCase()]=c.toLowerCase(),h["Webkit"+o]="webkit"+c,h["Moz"+o]="moz"+c,h}var Jo={animationend:Ra("Animation","AnimationEnd"),animationiteration:Ra("Animation","AnimationIteration"),animationstart:Ra("Animation","AnimationStart"),transitionrun:Ra("Transition","TransitionRun"),transitionstart:Ra("Transition","TransitionStart"),transitioncancel:Ra("Transition","TransitionCancel"),transitionend:Ra("Transition","TransitionEnd")},Px={},SC={};br&&(SC=document.createElement("div").style,"AnimationEvent"in window||(delete Jo.animationend.animation,delete Jo.animationiteration.animation,delete Jo.animationstart.animation),"TransitionEvent"in window||delete Jo.transitionend.transition);function Aa(o){if(Px[o])return Px[o];if(!Jo[o])return o;var c=Jo[o],h;for(h in c)if(c.hasOwnProperty(h)&&h in SC)return Px[o]=c[h];return o}var NC=Aa("animationend"),kC=Aa("animationiteration"),_C=Aa("animationstart"),tF=Aa("transitionrun"),nF=Aa("transitionstart"),sF=Aa("transitioncancel"),CC=Aa("transitionend"),EC=new Map,$x="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");$x.push("scrollEnd");function Es(o,c){EC.set(o,c),xr(c,[o])}var Qf=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},os=[],el=0,Dx=0;function Xf(){for(var o=el,c=Dx=el=0;c<o;){var h=os[c];os[c++]=null;var g=os[c];os[c++]=null;var j=os[c];os[c++]=null;var N=os[c];if(os[c++]=null,g!==null&&j!==null){var I=g.pending;I===null?j.next=j:(j.next=I.next,I.next=j),g.pending=j}N!==0&&RC(h,j,N)}}function Zf(o,c,h,g){os[el++]=o,os[el++]=c,os[el++]=h,os[el++]=g,Dx|=g,o.lanes|=g,o=o.alternate,o!==null&&(o.lanes|=g)}function qx(o,c,h,g){return Zf(o,c,h,g),Jf(o)}function Ta(o,c){return Zf(o,null,null,c),Jf(o)}function RC(o,c,h){o.lanes|=h;var g=o.alternate;g!==null&&(g.lanes|=h);for(var j=!1,N=o.return;N!==null;)N.childLanes|=h,g=N.alternate,g!==null&&(g.childLanes|=h),N.tag===22&&(o=N.stateNode,o===null||o._visibility&1||(j=!0)),o=N,N=N.return;return o.tag===3?(N=o.stateNode,j&&c!==null&&(j=31-Sn(h),o=N.hiddenUpdates,g=o[j],g===null?o[j]=[c]:g.push(c),c.lane=h|536870912),N):null}function Jf(o){if(50<ju)throw ju=0,W0=null,Error(s(185));for(var c=o.return;c!==null;)o=c,c=o.return;return o.tag===3?o.stateNode:null}var tl={};function rF(o,c,h,g){this.tag=o,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yn(o,c,h,g){return new rF(o,c,h,g)}function zx(o){return o=o.prototype,!(!o||!o.isReactComponent)}function wr(o,c){var h=o.alternate;return h===null?(h=Yn(o.tag,c,o.key,o.mode),h.elementType=o.elementType,h.type=o.type,h.stateNode=o.stateNode,h.alternate=o,o.alternate=h):(h.pendingProps=c,h.type=o.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=o.flags&65011712,h.childLanes=o.childLanes,h.lanes=o.lanes,h.child=o.child,h.memoizedProps=o.memoizedProps,h.memoizedState=o.memoizedState,h.updateQueue=o.updateQueue,c=o.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=o.sibling,h.index=o.index,h.ref=o.ref,h.refCleanup=o.refCleanup,h}function AC(o,c){o.flags&=65011714;var h=o.alternate;return h===null?(o.childLanes=0,o.lanes=c,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=h.childLanes,o.lanes=h.lanes,o.child=h.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=h.memoizedProps,o.memoizedState=h.memoizedState,o.updateQueue=h.updateQueue,o.type=h.type,c=h.dependencies,o.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),o}function eh(o,c,h,g,j,N){var I=0;if(g=o,typeof o=="function")zx(o)&&(I=1);else if(typeof o=="string")I=c7(o,h,U.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case L:return o=Yn(31,h,c,j),o.elementType=L,o.lanes=N,o;case b:return Ia(h.children,j,N,c);case w:I=8,j|=24;break;case S:return o=Yn(12,h,c,j|2),o.elementType=S,o.lanes=N,o;case R:return o=Yn(13,h,c,j),o.elementType=R,o.lanes=N,o;case T:return o=Yn(19,h,c,j),o.elementType=T,o.lanes=N,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case k:I=10;break e;case E:I=9;break e;case _:I=11;break e;case A:I=14;break e;case M:I=16,g=null;break e}I=29,h=Error(s(130,o===null?"null":typeof o,"")),g=null}return c=Yn(I,h,c,j),c.elementType=o,c.type=g,c.lanes=N,c}function Ia(o,c,h,g){return o=Yn(7,o,g,c),o.lanes=h,o}function Bx(o,c,h){return o=Yn(6,o,null,c),o.lanes=h,o}function TC(o){var c=Yn(18,null,null,0);return c.stateNode=o,c}function Fx(o,c,h){return c=Yn(4,o.children!==null?o.children:[],o.key,c),c.lanes=h,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}var IC=new WeakMap;function ls(o,c){if(typeof o=="object"&&o!==null){var h=IC.get(o);return h!==void 0?h:(c={value:o,source:c,stack:Ct(c)},IC.set(o,c),c)}return{value:o,source:c,stack:Ct(c)}}var nl=[],sl=0,th=null,tu=0,cs=[],us=0,fi=null,Ys=1,Qs="";function jr(o,c){nl[sl++]=tu,nl[sl++]=th,th=o,tu=c}function MC(o,c,h){cs[us++]=Ys,cs[us++]=Qs,cs[us++]=fi,fi=o;var g=Ys;o=Qs;var j=32-Sn(g)-1;g&=~(1<<j),h+=1;var N=32-Sn(c)+j;if(30<N){var I=j-j%5;N=(g&(1<<I)-1).toString(32),g>>=I,j-=I,Ys=1<<32-Sn(c)+j|h<<j|g,Qs=N+o}else Ys=1<<N|h<<j|g,Qs=o}function Hx(o){o.return!==null&&(jr(o,1),MC(o,1,0))}function Ux(o){for(;o===th;)th=nl[--sl],nl[sl]=null,tu=nl[--sl],nl[sl]=null;for(;o===fi;)fi=cs[--us],cs[us]=null,Qs=cs[--us],cs[us]=null,Ys=cs[--us],cs[us]=null}function OC(o,c){cs[us++]=Ys,cs[us++]=Qs,cs[us++]=fi,Ys=c.id,Qs=c.overflow,fi=o}var nn=null,vt=null,Ze=!1,hi=null,ds=!1,Vx=Error(s(519));function pi(o){var c=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nu(ls(c,o)),Vx}function LC(o){var c=o.stateNode,h=o.type,g=o.memoizedProps;switch(c[Wt]=o,c[hn]=g,h){case"dialog":Ye("cancel",c),Ye("close",c);break;case"iframe":case"object":case"embed":Ye("load",c);break;case"video":case"audio":for(h=0;h<Nu.length;h++)Ye(Nu[h],c);break;case"source":Ye("error",c);break;case"img":case"image":case"link":Ye("error",c),Ye("load",c);break;case"details":Ye("toggle",c);break;case"input":Ye("invalid",c),Ff(c,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Ye("invalid",c);break;case"textarea":Ye("invalid",c),Q_(c,g.value,g.defaultValue,g.children)}h=g.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||c.textContent===""+h||g.suppressHydrationWarning===!0||ZR(c.textContent,h)?(g.popover!=null&&(Ye("beforetoggle",c),Ye("toggle",c)),g.onScroll!=null&&Ye("scroll",c),g.onScrollEnd!=null&&Ye("scrollend",c),g.onClick!=null&&(c.onclick=vr),c=!0):c=!1,c||pi(o,!0)}function PC(o){for(nn=o.return;nn;)switch(nn.tag){case 5:case 31:case 13:ds=!1;return;case 27:case 3:ds=!0;return;default:nn=nn.return}}function rl(o){if(o!==nn)return!1;if(!Ze)return PC(o),Ze=!0,!1;var c=o.tag,h;if((h=c!==3&&c!==27)&&((h=c===5)&&(h=o.type,h=!(h!=="form"&&h!=="button")||cy(o.type,o.memoizedProps)),h=!h),h&&vt&&pi(o),PC(o),c===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(317));vt=oA(o)}else if(c===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(317));vt=oA(o)}else c===27?(c=vt,Ei(o.type)?(o=py,py=null,vt=o):vt=c):vt=nn?hs(o.stateNode.nextSibling):null;return!0}function Ma(){vt=nn=null,Ze=!1}function Gx(){var o=hi;return o!==null&&($n===null?$n=o:$n.push.apply($n,o),hi=null),o}function nu(o){hi===null?hi=[o]:hi.push(o)}var Kx=D(null),Oa=null,Sr=null;function mi(o,c,h){ne(Kx,c._currentValue),c._currentValue=h}function Nr(o){o._currentValue=Kx.current,V(Kx)}function Wx(o,c,h){for(;o!==null;){var g=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,g!==null&&(g.childLanes|=c)):g!==null&&(g.childLanes&c)!==c&&(g.childLanes|=c),o===h)break;o=o.return}}function Yx(o,c,h,g){var j=o.child;for(j!==null&&(j.return=o);j!==null;){var N=j.dependencies;if(N!==null){var I=j.child;N=N.firstContext;e:for(;N!==null;){var q=N;N=j;for(var J=0;J<c.length;J++)if(q.context===c[J]){N.lanes|=h,q=N.alternate,q!==null&&(q.lanes|=h),Wx(N.return,h,o),g||(I=null);break e}N=q.next}}else if(j.tag===18){if(I=j.return,I===null)throw Error(s(341));I.lanes|=h,N=I.alternate,N!==null&&(N.lanes|=h),Wx(I,h,o),I=null}else I=j.child;if(I!==null)I.return=j;else for(I=j;I!==null;){if(I===o){I=null;break}if(j=I.sibling,j!==null){j.return=I.return,I=j;break}I=I.return}j=I}}function il(o,c,h,g){o=null;for(var j=c,N=!1;j!==null;){if(!N){if((j.flags&524288)!==0)N=!0;else if((j.flags&262144)!==0)break}if(j.tag===10){var I=j.alternate;if(I===null)throw Error(s(387));if(I=I.memoizedProps,I!==null){var q=j.type;Wn(j.pendingProps.value,I.value)||(o!==null?o.push(q):o=[q])}}else if(j===te.current){if(I=j.alternate,I===null)throw Error(s(387));I.memoizedState.memoizedState!==j.memoizedState.memoizedState&&(o!==null?o.push(Ru):o=[Ru])}j=j.return}o!==null&&Yx(c,o,h,g),c.flags|=262144}function nh(o){for(o=o.firstContext;o!==null;){if(!Wn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function La(o){Oa=o,Sr=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function sn(o){return $C(Oa,o)}function sh(o,c){return Oa===null&&La(o),$C(o,c)}function $C(o,c){var h=c._currentValue;if(c={context:c,memoizedValue:h,next:null},Sr===null){if(o===null)throw Error(s(308));Sr=c,o.dependencies={lanes:0,firstContext:c},o.flags|=524288}else Sr=Sr.next=c;return h}var iF=typeof AbortController<"u"?AbortController:function(){var o=[],c=this.signal={aborted:!1,addEventListener:function(h,g){o.push(g)}};this.abort=function(){c.aborted=!0,o.forEach(function(h){return h()})}},aF=e.unstable_scheduleCallback,oF=e.unstable_NormalPriority,zt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qx(){return{controller:new iF,data:new Map,refCount:0}}function su(o){o.refCount--,o.refCount===0&&aF(oF,function(){o.controller.abort()})}var ru=null,Xx=0,al=0,ol=null;function lF(o,c){if(ru===null){var h=ru=[];Xx=0,al=ey(),ol={status:"pending",value:void 0,then:function(g){h.push(g)}}}return Xx++,c.then(DC,DC),c}function DC(){if(--Xx===0&&ru!==null){ol!==null&&(ol.status="fulfilled");var o=ru;ru=null,al=0,ol=null;for(var c=0;c<o.length;c++)(0,o[c])()}}function cF(o,c){var h=[],g={status:"pending",value:null,reason:null,then:function(j){h.push(j)}};return o.then(function(){g.status="fulfilled",g.value=c;for(var j=0;j<h.length;j++)(0,h[j])(c)},function(j){for(g.status="rejected",g.reason=j,j=0;j<h.length;j++)(0,h[j])(void 0)}),g}var qC=$.S;$.S=function(o,c){jR=Oe(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&lF(o,c),qC!==null&&qC(o,c)};var Pa=D(null);function Zx(){var o=Pa.current;return o!==null?o:pt.pooledCache}function rh(o,c){c===null?ne(Pa,Pa.current):ne(Pa,c.pool)}function zC(){var o=Zx();return o===null?null:{parent:zt._currentValue,pool:o}}var ll=Error(s(460)),Jx=Error(s(474)),ih=Error(s(542)),ah={then:function(){}};function BC(o){return o=o.status,o==="fulfilled"||o==="rejected"}function FC(o,c,h){switch(h=o[h],h===void 0?o.push(c):h!==c&&(c.then(vr,vr),c=h),c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,UC(o),o;default:if(typeof c.status=="string")c.then(vr,vr);else{if(o=pt,o!==null&&100<o.shellSuspendCounter)throw Error(s(482));o=c,o.status="pending",o.then(function(g){if(c.status==="pending"){var j=c;j.status="fulfilled",j.value=g}},function(g){if(c.status==="pending"){var j=c;j.status="rejected",j.reason=g}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,UC(o),o}throw Da=c,ll}}function $a(o){try{var c=o._init;return c(o._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?(Da=h,ll):h}}var Da=null;function HC(){if(Da===null)throw Error(s(459));var o=Da;return Da=null,o}function UC(o){if(o===ll||o===ih)throw Error(s(483))}var cl=null,iu=0;function oh(o){var c=iu;return iu+=1,cl===null&&(cl=[]),FC(cl,o,c)}function au(o,c){c=c.props.ref,o.ref=c!==void 0?c:null}function lh(o,c){throw c.$$typeof===x?Error(s(525)):(o=Object.prototype.toString.call(c),Error(s(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o)))}function VC(o){function c(se,ee){if(o){var ie=se.deletions;ie===null?(se.deletions=[ee],se.flags|=16):ie.push(ee)}}function h(se,ee){if(!o)return null;for(;ee!==null;)c(se,ee),ee=ee.sibling;return null}function g(se){for(var ee=new Map;se!==null;)se.key!==null?ee.set(se.key,se):ee.set(se.index,se),se=se.sibling;return ee}function j(se,ee){return se=wr(se,ee),se.index=0,se.sibling=null,se}function N(se,ee,ie){return se.index=ie,o?(ie=se.alternate,ie!==null?(ie=ie.index,ie<ee?(se.flags|=67108866,ee):ie):(se.flags|=67108866,ee)):(se.flags|=1048576,ee)}function I(se){return o&&se.alternate===null&&(se.flags|=67108866),se}function q(se,ee,ie,de){return ee===null||ee.tag!==6?(ee=Bx(ie,se.mode,de),ee.return=se,ee):(ee=j(ee,ie),ee.return=se,ee)}function J(se,ee,ie,de){var Re=ie.type;return Re===b?ue(se,ee,ie.props.children,de,ie.key):ee!==null&&(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===M&&$a(Re)===ee.type)?(ee=j(ee,ie.props),au(ee,ie),ee.return=se,ee):(ee=eh(ie.type,ie.key,ie.props,null,se.mode,de),au(ee,ie),ee.return=se,ee)}function ae(se,ee,ie,de){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ie.containerInfo||ee.stateNode.implementation!==ie.implementation?(ee=Fx(ie,se.mode,de),ee.return=se,ee):(ee=j(ee,ie.children||[]),ee.return=se,ee)}function ue(se,ee,ie,de,Re){return ee===null||ee.tag!==7?(ee=Ia(ie,se.mode,de,Re),ee.return=se,ee):(ee=j(ee,ie),ee.return=se,ee)}function fe(se,ee,ie){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=Bx(""+ee,se.mode,ie),ee.return=se,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ie=eh(ee.type,ee.key,ee.props,null,se.mode,ie),au(ie,ee),ie.return=se,ie;case v:return ee=Fx(ee,se.mode,ie),ee.return=se,ee;case M:return ee=$a(ee),fe(se,ee,ie)}if(W(ee)||B(ee))return ee=Ia(ee,se.mode,ie,null),ee.return=se,ee;if(typeof ee.then=="function")return fe(se,oh(ee),ie);if(ee.$$typeof===k)return fe(se,sh(se,ee),ie);lh(se,ee)}return null}function le(se,ee,ie,de){var Re=ee!==null?ee.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Re!==null?null:q(se,ee,""+ie,de);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:return ie.key===Re?J(se,ee,ie,de):null;case v:return ie.key===Re?ae(se,ee,ie,de):null;case M:return ie=$a(ie),le(se,ee,ie,de)}if(W(ie)||B(ie))return Re!==null?null:ue(se,ee,ie,de,null);if(typeof ie.then=="function")return le(se,ee,oh(ie),de);if(ie.$$typeof===k)return le(se,ee,sh(se,ie),de);lh(se,ie)}return null}function ce(se,ee,ie,de,Re){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return se=se.get(ie)||null,q(ee,se,""+de,Re);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case y:return se=se.get(de.key===null?ie:de.key)||null,J(ee,se,de,Re);case v:return se=se.get(de.key===null?ie:de.key)||null,ae(ee,se,de,Re);case M:return de=$a(de),ce(se,ee,ie,de,Re)}if(W(de)||B(de))return se=se.get(ie)||null,ue(ee,se,de,Re,null);if(typeof de.then=="function")return ce(se,ee,ie,oh(de),Re);if(de.$$typeof===k)return ce(se,ee,ie,sh(ee,de),Re);lh(ee,de)}return null}function je(se,ee,ie,de){for(var Re=null,tt=null,Ce=ee,Ue=ee=0,Xe=null;Ce!==null&&Ue<ie.length;Ue++){Ce.index>Ue?(Xe=Ce,Ce=null):Xe=Ce.sibling;var nt=le(se,Ce,ie[Ue],de);if(nt===null){Ce===null&&(Ce=Xe);break}o&&Ce&&nt.alternate===null&&c(se,Ce),ee=N(nt,ee,Ue),tt===null?Re=nt:tt.sibling=nt,tt=nt,Ce=Xe}if(Ue===ie.length)return h(se,Ce),Ze&&jr(se,Ue),Re;if(Ce===null){for(;Ue<ie.length;Ue++)Ce=fe(se,ie[Ue],de),Ce!==null&&(ee=N(Ce,ee,Ue),tt===null?Re=Ce:tt.sibling=Ce,tt=Ce);return Ze&&jr(se,Ue),Re}for(Ce=g(Ce);Ue<ie.length;Ue++)Xe=ce(Ce,se,Ue,ie[Ue],de),Xe!==null&&(o&&Xe.alternate!==null&&Ce.delete(Xe.key===null?Ue:Xe.key),ee=N(Xe,ee,Ue),tt===null?Re=Xe:tt.sibling=Xe,tt=Xe);return o&&Ce.forEach(function(Mi){return c(se,Mi)}),Ze&&jr(se,Ue),Re}function Ae(se,ee,ie,de){if(ie==null)throw Error(s(151));for(var Re=null,tt=null,Ce=ee,Ue=ee=0,Xe=null,nt=ie.next();Ce!==null&&!nt.done;Ue++,nt=ie.next()){Ce.index>Ue?(Xe=Ce,Ce=null):Xe=Ce.sibling;var Mi=le(se,Ce,nt.value,de);if(Mi===null){Ce===null&&(Ce=Xe);break}o&&Ce&&Mi.alternate===null&&c(se,Ce),ee=N(Mi,ee,Ue),tt===null?Re=Mi:tt.sibling=Mi,tt=Mi,Ce=Xe}if(nt.done)return h(se,Ce),Ze&&jr(se,Ue),Re;if(Ce===null){for(;!nt.done;Ue++,nt=ie.next())nt=fe(se,nt.value,de),nt!==null&&(ee=N(nt,ee,Ue),tt===null?Re=nt:tt.sibling=nt,tt=nt);return Ze&&jr(se,Ue),Re}for(Ce=g(Ce);!nt.done;Ue++,nt=ie.next())nt=ce(Ce,se,Ue,nt.value,de),nt!==null&&(o&&nt.alternate!==null&&Ce.delete(nt.key===null?Ue:nt.key),ee=N(nt,ee,Ue),tt===null?Re=nt:tt.sibling=nt,tt=nt);return o&&Ce.forEach(function(b7){return c(se,b7)}),Ze&&jr(se,Ue),Re}function ht(se,ee,ie,de){if(typeof ie=="object"&&ie!==null&&ie.type===b&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:e:{for(var Re=ie.key;ee!==null;){if(ee.key===Re){if(Re=ie.type,Re===b){if(ee.tag===7){h(se,ee.sibling),de=j(ee,ie.props.children),de.return=se,se=de;break e}}else if(ee.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===M&&$a(Re)===ee.type){h(se,ee.sibling),de=j(ee,ie.props),au(de,ie),de.return=se,se=de;break e}h(se,ee);break}else c(se,ee);ee=ee.sibling}ie.type===b?(de=Ia(ie.props.children,se.mode,de,ie.key),de.return=se,se=de):(de=eh(ie.type,ie.key,ie.props,null,se.mode,de),au(de,ie),de.return=se,se=de)}return I(se);case v:e:{for(Re=ie.key;ee!==null;){if(ee.key===Re)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){h(se,ee.sibling),de=j(ee,ie.children||[]),de.return=se,se=de;break e}else{h(se,ee);break}else c(se,ee);ee=ee.sibling}de=Fx(ie,se.mode,de),de.return=se,se=de}return I(se);case M:return ie=$a(ie),ht(se,ee,ie,de)}if(W(ie))return je(se,ee,ie,de);if(B(ie)){if(Re=B(ie),typeof Re!="function")throw Error(s(150));return ie=Re.call(ie),Ae(se,ee,ie,de)}if(typeof ie.then=="function")return ht(se,ee,oh(ie),de);if(ie.$$typeof===k)return ht(se,ee,sh(se,ie),de);lh(se,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,ee!==null&&ee.tag===6?(h(se,ee.sibling),de=j(ee,ie),de.return=se,se=de):(h(se,ee),de=Bx(ie,se.mode,de),de.return=se,se=de),I(se)):h(se,ee)}return function(se,ee,ie,de){try{iu=0;var Re=ht(se,ee,ie,de);return cl=null,Re}catch(Ce){if(Ce===ll||Ce===ih)throw Ce;var tt=Yn(29,Ce,null,se.mode);return tt.lanes=de,tt.return=se,tt}finally{}}}var qa=VC(!0),GC=VC(!1),gi=!1;function e0(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function t0(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function xi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function yi(o,c,h){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(rt&2)!==0){var j=g.pending;return j===null?c.next=c:(c.next=j.next,j.next=c),g.pending=c,c=Jf(o),RC(o,null,h),c}return Zf(o,g,c,h),Jf(o)}function ou(o,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194048)!==0)){var g=c.lanes;g&=o.pendingLanes,h|=g,c.lanes=h,Tf(o,h)}}function n0(o,c){var h=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var j=null,N=null;if(h=h.firstBaseUpdate,h!==null){do{var I={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};N===null?j=N=I:N=N.next=I,h=h.next}while(h!==null);N===null?j=N=c:N=N.next=c}else j=N=c;h={baseState:g.baseState,firstBaseUpdate:j,lastBaseUpdate:N,shared:g.shared,callbacks:g.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=c:o.next=c,h.lastBaseUpdate=c}var s0=!1;function lu(){if(s0){var o=ol;if(o!==null)throw o}}function cu(o,c,h,g){s0=!1;var j=o.updateQueue;gi=!1;var N=j.firstBaseUpdate,I=j.lastBaseUpdate,q=j.shared.pending;if(q!==null){j.shared.pending=null;var J=q,ae=J.next;J.next=null,I===null?N=ae:I.next=ae,I=J;var ue=o.alternate;ue!==null&&(ue=ue.updateQueue,q=ue.lastBaseUpdate,q!==I&&(q===null?ue.firstBaseUpdate=ae:q.next=ae,ue.lastBaseUpdate=J))}if(N!==null){var fe=j.baseState;I=0,ue=ae=J=null,q=N;do{var le=q.lane&-536870913,ce=le!==q.lane;if(ce?(Qe&le)===le:(g&le)===le){le!==0&&le===al&&(s0=!0),ue!==null&&(ue=ue.next={lane:0,tag:q.tag,payload:q.payload,callback:null,next:null});e:{var je=o,Ae=q;le=c;var ht=h;switch(Ae.tag){case 1:if(je=Ae.payload,typeof je=="function"){fe=je.call(ht,fe,le);break e}fe=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ae.payload,le=typeof je=="function"?je.call(ht,fe,le):je,le==null)break e;fe=m({},fe,le);break e;case 2:gi=!0}}le=q.callback,le!==null&&(o.flags|=64,ce&&(o.flags|=8192),ce=j.callbacks,ce===null?j.callbacks=[le]:ce.push(le))}else ce={lane:le,tag:q.tag,payload:q.payload,callback:q.callback,next:null},ue===null?(ae=ue=ce,J=fe):ue=ue.next=ce,I|=le;if(q=q.next,q===null){if(q=j.shared.pending,q===null)break;ce=q,q=ce.next,ce.next=null,j.lastBaseUpdate=ce,j.shared.pending=null}}while(!0);ue===null&&(J=fe),j.baseState=J,j.firstBaseUpdate=ae,j.lastBaseUpdate=ue,N===null&&(j.shared.lanes=0),Si|=I,o.lanes=I,o.memoizedState=fe}}function KC(o,c){if(typeof o!="function")throw Error(s(191,o));o.call(c)}function WC(o,c){var h=o.callbacks;if(h!==null)for(o.callbacks=null,o=0;o<h.length;o++)KC(h[o],c)}var ul=D(null),ch=D(0);function YC(o,c){o=Mr,ne(ch,o),ne(ul,c),Mr=o|c.baseLanes}function r0(){ne(ch,Mr),ne(ul,ul.current)}function i0(){Mr=ch.current,V(ul),V(ch)}var Qn=D(null),fs=null;function vi(o){var c=o.alternate;ne(Ot,Ot.current&1),ne(Qn,o),fs===null&&(c===null||ul.current!==null||c.memoizedState!==null)&&(fs=o)}function a0(o){ne(Ot,Ot.current),ne(Qn,o),fs===null&&(fs=o)}function QC(o){o.tag===22?(ne(Ot,Ot.current),ne(Qn,o),fs===null&&(fs=o)):bi()}function bi(){ne(Ot,Ot.current),ne(Qn,Qn.current)}function Xn(o){V(Qn),fs===o&&(fs=null),V(Ot)}var Ot=D(0);function uh(o){for(var c=o;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||fy(h)||hy(h)))return c}else if(c.tag===19&&(c.memoizedProps.revealOrder==="forwards"||c.memoizedProps.revealOrder==="backwards"||c.memoizedProps.revealOrder==="unstable_legacy-backwards"||c.memoizedProps.revealOrder==="together")){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var kr=0,He=null,dt=null,Bt=null,dh=!1,dl=!1,za=!1,fh=0,uu=0,fl=null,uF=0;function Et(){throw Error(s(321))}function o0(o,c){if(c===null)return!1;for(var h=0;h<c.length&&h<o.length;h++)if(!Wn(o[h],c[h]))return!1;return!0}function l0(o,c,h,g,j,N){return kr=N,He=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,$.H=o===null||o.memoizedState===null?ME:S0,za=!1,N=h(g,j),za=!1,dl&&(N=ZC(c,h,g,j)),XC(o),N}function XC(o){$.H=hu;var c=dt!==null&&dt.next!==null;if(kr=0,Bt=dt=He=null,dh=!1,uu=0,fl=null,c)throw Error(s(300));o===null||Ft||(o=o.dependencies,o!==null&&nh(o)&&(Ft=!0))}function ZC(o,c,h,g){He=o;var j=0;do{if(dl&&(fl=null),uu=0,dl=!1,25<=j)throw Error(s(301));if(j+=1,Bt=dt=null,o.updateQueue!=null){var N=o.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}$.H=OE,N=c(h,g)}while(dl);return N}function dF(){var o=$.H,c=o.useState()[0];return c=typeof c.then=="function"?du(c):c,o=o.useState()[0],(dt!==null?dt.memoizedState:null)!==o&&(He.flags|=1024),c}function c0(){var o=fh!==0;return fh=0,o}function u0(o,c,h){c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~h}function d0(o){if(dh){for(o=o.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}dh=!1}kr=0,Bt=dt=He=null,dl=!1,uu=fh=0,fl=null}function Nn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?He.memoizedState=Bt=o:Bt=Bt.next=o,Bt}function Lt(){if(dt===null){var o=He.alternate;o=o!==null?o.memoizedState:null}else o=dt.next;var c=Bt===null?He.memoizedState:Bt.next;if(c!==null)Bt=c,dt=o;else{if(o===null)throw He.alternate===null?Error(s(467)):Error(s(310));dt=o,o={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},Bt===null?He.memoizedState=Bt=o:Bt=Bt.next=o}return Bt}function hh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function du(o){var c=uu;return uu+=1,fl===null&&(fl=[]),o=FC(fl,o,c),c=He,(Bt===null?c.memoizedState:Bt.next)===null&&(c=c.alternate,$.H=c===null||c.memoizedState===null?ME:S0),o}function ph(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return du(o);if(o.$$typeof===k)return sn(o)}throw Error(s(438,String(o)))}function f0(o){var c=null,h=He.updateQueue;if(h!==null&&(c=h.memoCache),c==null){var g=He.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(c={data:g.data.map(function(j){return j.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),h===null&&(h=hh(),He.updateQueue=h),h.memoCache=c,h=c.data[c.index],h===void 0)for(h=c.data[c.index]=Array(o),g=0;g<o;g++)h[g]=P;return c.index++,h}function _r(o,c){return typeof c=="function"?c(o):c}function mh(o){var c=Lt();return h0(c,dt,o)}function h0(o,c,h){var g=o.queue;if(g===null)throw Error(s(311));g.lastRenderedReducer=h;var j=o.baseQueue,N=g.pending;if(N!==null){if(j!==null){var I=j.next;j.next=N.next,N.next=I}c.baseQueue=j=N,g.pending=null}if(N=o.baseState,j===null)o.memoizedState=N;else{c=j.next;var q=I=null,J=null,ae=c,ue=!1;do{var fe=ae.lane&-536870913;if(fe!==ae.lane?(Qe&fe)===fe:(kr&fe)===fe){var le=ae.revertLane;if(le===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),fe===al&&(ue=!0);else if((kr&le)===le){ae=ae.next,le===al&&(ue=!0);continue}else fe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},J===null?(q=J=fe,I=N):J=J.next=fe,He.lanes|=le,Si|=le;fe=ae.action,za&&h(N,fe),N=ae.hasEagerState?ae.eagerState:h(N,fe)}else le={lane:fe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},J===null?(q=J=le,I=N):J=J.next=le,He.lanes|=fe,Si|=fe;ae=ae.next}while(ae!==null&&ae!==c);if(J===null?I=N:J.next=q,!Wn(N,o.memoizedState)&&(Ft=!0,ue&&(h=ol,h!==null)))throw h;o.memoizedState=N,o.baseState=I,o.baseQueue=J,g.lastRenderedState=N}return j===null&&(g.lanes=0),[o.memoizedState,g.dispatch]}function p0(o){var c=Lt(),h=c.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=o;var g=h.dispatch,j=h.pending,N=c.memoizedState;if(j!==null){h.pending=null;var I=j=j.next;do N=o(N,I.action),I=I.next;while(I!==j);Wn(N,c.memoizedState)||(Ft=!0),c.memoizedState=N,c.baseQueue===null&&(c.baseState=N),h.lastRenderedState=N}return[N,g]}function JC(o,c,h){var g=He,j=Lt(),N=Ze;if(N){if(h===void 0)throw Error(s(407));h=h()}else h=c();var I=!Wn((dt||j).memoizedState,h);if(I&&(j.memoizedState=h,Ft=!0),j=j.queue,x0(nE.bind(null,g,j,o),[o]),j.getSnapshot!==c||I||Bt!==null&&Bt.memoizedState.tag&1){if(g.flags|=2048,hl(9,{destroy:void 0},tE.bind(null,g,j,h,c),null),pt===null)throw Error(s(349));N||(kr&127)!==0||eE(g,c,h)}return h}function eE(o,c,h){o.flags|=16384,o={getSnapshot:c,value:h},c=He.updateQueue,c===null?(c=hh(),He.updateQueue=c,c.stores=[o]):(h=c.stores,h===null?c.stores=[o]:h.push(o))}function tE(o,c,h,g){c.value=h,c.getSnapshot=g,sE(c)&&rE(o)}function nE(o,c,h){return h(function(){sE(c)&&rE(o)})}function sE(o){var c=o.getSnapshot;o=o.value;try{var h=c();return!Wn(o,h)}catch{return!0}}function rE(o){var c=Ta(o,2);c!==null&&Dn(c,o,2)}function m0(o){var c=Nn();if(typeof o=="function"){var h=o;if(o=h(),za){Ks(!0);try{h()}finally{Ks(!1)}}}return c.memoizedState=c.baseState=o,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:o},c}function iE(o,c,h,g){return o.baseState=h,h0(o,dt,typeof g=="function"?g:_r)}function fF(o,c,h,g,j){if(yh(o))throw Error(s(485));if(o=c.action,o!==null){var N={payload:j,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){N.listeners.push(I)}};$.T!==null?h(!0):N.isTransition=!1,g(N),h=c.pending,h===null?(N.next=c.pending=N,aE(c,N)):(N.next=h.next,c.pending=h.next=N)}}function aE(o,c){var h=c.action,g=c.payload,j=o.state;if(c.isTransition){var N=$.T,I={};$.T=I;try{var q=h(j,g),J=$.S;J!==null&&J(I,q),oE(o,c,q)}catch(ae){g0(o,c,ae)}finally{N!==null&&I.types!==null&&(N.types=I.types),$.T=N}}else try{N=h(j,g),oE(o,c,N)}catch(ae){g0(o,c,ae)}}function oE(o,c,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(g){lE(o,c,g)},function(g){return g0(o,c,g)}):lE(o,c,h)}function lE(o,c,h){c.status="fulfilled",c.value=h,cE(c),o.state=h,c=o.pending,c!==null&&(h=c.next,h===c?o.pending=null:(h=h.next,c.next=h,aE(o,h)))}function g0(o,c,h){var g=o.pending;if(o.pending=null,g!==null){g=g.next;do c.status="rejected",c.reason=h,cE(c),c=c.next;while(c!==g)}o.action=null}function cE(o){o=o.listeners;for(var c=0;c<o.length;c++)(0,o[c])()}function uE(o,c){return c}function dE(o,c){if(Ze){var h=pt.formState;if(h!==null){e:{var g=He;if(Ze){if(vt){t:{for(var j=vt,N=ds;j.nodeType!==8;){if(!N){j=null;break t}if(j=hs(j.nextSibling),j===null){j=null;break t}}N=j.data,j=N==="F!"||N==="F"?j:null}if(j){vt=hs(j.nextSibling),g=j.data==="F!";break e}}pi(g)}g=!1}g&&(c=h[0])}}return h=Nn(),h.memoizedState=h.baseState=c,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uE,lastRenderedState:c},h.queue=g,h=AE.bind(null,He,g),g.dispatch=h,g=m0(!1),N=j0.bind(null,He,!1,g.queue),g=Nn(),j={state:c,dispatch:null,action:o,pending:null},g.queue=j,h=fF.bind(null,He,j,N,h),j.dispatch=h,g.memoizedState=o,[c,h,!1]}function fE(o){var c=Lt();return hE(c,dt,o)}function hE(o,c,h){if(c=h0(o,c,uE)[0],o=mh(_r)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var g=du(c)}catch(I){throw I===ll?ih:I}else g=c;c=Lt();var j=c.queue,N=j.dispatch;return h!==c.memoizedState&&(He.flags|=2048,hl(9,{destroy:void 0},hF.bind(null,j,h),null)),[g,N,o]}function hF(o,c){o.action=c}function pE(o){var c=Lt(),h=dt;if(h!==null)return hE(c,h,o);Lt(),c=c.memoizedState,h=Lt();var g=h.queue.dispatch;return h.memoizedState=o,[c,g,!1]}function hl(o,c,h,g){return o={tag:o,create:h,deps:g,inst:c,next:null},c=He.updateQueue,c===null&&(c=hh(),He.updateQueue=c),h=c.lastEffect,h===null?c.lastEffect=o.next=o:(g=h.next,h.next=o,o.next=g,c.lastEffect=o),o}function mE(){return Lt().memoizedState}function gh(o,c,h,g){var j=Nn();He.flags|=o,j.memoizedState=hl(1|c,{destroy:void 0},h,g===void 0?null:g)}function xh(o,c,h,g){var j=Lt();g=g===void 0?null:g;var N=j.memoizedState.inst;dt!==null&&g!==null&&o0(g,dt.memoizedState.deps)?j.memoizedState=hl(c,N,h,g):(He.flags|=o,j.memoizedState=hl(1|c,N,h,g))}function gE(o,c){gh(8390656,8,o,c)}function x0(o,c){xh(2048,8,o,c)}function pF(o){He.flags|=4;var c=He.updateQueue;if(c===null)c=hh(),He.updateQueue=c,c.events=[o];else{var h=c.events;h===null?c.events=[o]:h.push(o)}}function xE(o){var c=Lt().memoizedState;return pF({ref:c,nextImpl:o}),function(){if((rt&2)!==0)throw Error(s(440));return c.impl.apply(void 0,arguments)}}function yE(o,c){return xh(4,2,o,c)}function vE(o,c){return xh(4,4,o,c)}function bE(o,c){if(typeof c=="function"){o=o();var h=c(o);return function(){typeof h=="function"?h():c(null)}}if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function wE(o,c,h){h=h!=null?h.concat([o]):null,xh(4,4,bE.bind(null,c,o),h)}function y0(){}function jE(o,c){var h=Lt();c=c===void 0?null:c;var g=h.memoizedState;return c!==null&&o0(c,g[1])?g[0]:(h.memoizedState=[o,c],o)}function SE(o,c){var h=Lt();c=c===void 0?null:c;var g=h.memoizedState;if(c!==null&&o0(c,g[1]))return g[0];if(g=o(),za){Ks(!0);try{o()}finally{Ks(!1)}}return h.memoizedState=[g,c],g}function v0(o,c,h){return h===void 0||(kr&1073741824)!==0&&(Qe&261930)===0?o.memoizedState=c:(o.memoizedState=h,o=NR(),He.lanes|=o,Si|=o,h)}function NE(o,c,h,g){return Wn(h,c)?h:ul.current!==null?(o=v0(o,h,g),Wn(o,c)||(Ft=!0),o):(kr&42)===0||(kr&1073741824)!==0&&(Qe&261930)===0?(Ft=!0,o.memoizedState=h):(o=NR(),He.lanes|=o,Si|=o,c)}function kE(o,c,h,g,j){var N=F.p;F.p=N!==0&&8>N?N:8;var I=$.T,q={};$.T=q,j0(o,!1,c,h);try{var J=j(),ae=$.S;if(ae!==null&&ae(q,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var ue=cF(J,g);fu(o,c,ue,es(o))}else fu(o,c,g,es(o))}catch(fe){fu(o,c,{then:function(){},status:"rejected",reason:fe},es())}finally{F.p=N,I!==null&&q.types!==null&&(I.types=q.types),$.T=I}}function mF(){}function b0(o,c,h,g){if(o.tag!==5)throw Error(s(476));var j=_E(o).queue;kE(o,j,c,G,h===null?mF:function(){return CE(o),h(g)})}function _E(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:G},next:null};var h={};return c.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_r,lastRenderedState:h},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function CE(o){var c=_E(o);c.next===null&&(c=o.alternate.memoizedState),fu(o,c.next.queue,{},es())}function w0(){return sn(Ru)}function EE(){return Lt().memoizedState}function RE(){return Lt().memoizedState}function gF(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var h=es();o=xi(h);var g=yi(c,o,h);g!==null&&(Dn(g,c,h),ou(g,c,h)),c={cache:Qx()},o.payload=c;return}c=c.return}}function xF(o,c,h){var g=es();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},yh(o)?TE(c,h):(h=qx(o,c,h,g),h!==null&&(Dn(h,o,g),IE(h,c,g)))}function AE(o,c,h){var g=es();fu(o,c,h,g)}function fu(o,c,h,g){var j={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(yh(o))TE(c,j);else{var N=o.alternate;if(o.lanes===0&&(N===null||N.lanes===0)&&(N=c.lastRenderedReducer,N!==null))try{var I=c.lastRenderedState,q=N(I,h);if(j.hasEagerState=!0,j.eagerState=q,Wn(q,I))return Zf(o,c,j,0),pt===null&&Xf(),!1}catch{}finally{}if(h=qx(o,c,j,g),h!==null)return Dn(h,o,g),IE(h,c,g),!0}return!1}function j0(o,c,h,g){if(g={lane:2,revertLane:ey(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},yh(o)){if(c)throw Error(s(479))}else c=qx(o,h,g,2),c!==null&&Dn(c,o,2)}function yh(o){var c=o.alternate;return o===He||c!==null&&c===He}function TE(o,c){dl=dh=!0;var h=o.pending;h===null?c.next=c:(c.next=h.next,h.next=c),o.pending=c}function IE(o,c,h){if((h&4194048)!==0){var g=c.lanes;g&=o.pendingLanes,h|=g,c.lanes=h,Tf(o,h)}}var hu={readContext:sn,use:ph,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};hu.useEffectEvent=Et;var ME={readContext:sn,use:ph,useCallback:function(o,c){return Nn().memoizedState=[o,c===void 0?null:c],o},useContext:sn,useEffect:gE,useImperativeHandle:function(o,c,h){h=h!=null?h.concat([o]):null,gh(4194308,4,bE.bind(null,c,o),h)},useLayoutEffect:function(o,c){return gh(4194308,4,o,c)},useInsertionEffect:function(o,c){gh(4,2,o,c)},useMemo:function(o,c){var h=Nn();c=c===void 0?null:c;var g=o();if(za){Ks(!0);try{o()}finally{Ks(!1)}}return h.memoizedState=[g,c],g},useReducer:function(o,c,h){var g=Nn();if(h!==void 0){var j=h(c);if(za){Ks(!0);try{h(c)}finally{Ks(!1)}}}else j=c;return g.memoizedState=g.baseState=j,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:j},g.queue=o,o=o.dispatch=xF.bind(null,He,o),[g.memoizedState,o]},useRef:function(o){var c=Nn();return o={current:o},c.memoizedState=o},useState:function(o){o=m0(o);var c=o.queue,h=AE.bind(null,He,c);return c.dispatch=h,[o.memoizedState,h]},useDebugValue:y0,useDeferredValue:function(o,c){var h=Nn();return v0(h,o,c)},useTransition:function(){var o=m0(!1);return o=kE.bind(null,He,o.queue,!0,!1),Nn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,h){var g=He,j=Nn();if(Ze){if(h===void 0)throw Error(s(407));h=h()}else{if(h=c(),pt===null)throw Error(s(349));(Qe&127)!==0||eE(g,c,h)}j.memoizedState=h;var N={value:h,getSnapshot:c};return j.queue=N,gE(nE.bind(null,g,N,o),[o]),g.flags|=2048,hl(9,{destroy:void 0},tE.bind(null,g,N,h,c),null),h},useId:function(){var o=Nn(),c=pt.identifierPrefix;if(Ze){var h=Qs,g=Ys;h=(g&~(1<<32-Sn(g)-1)).toString(32)+h,c="_"+c+"R_"+h,h=fh++,0<h&&(c+="H"+h.toString(32)),c+="_"}else h=uF++,c="_"+c+"r_"+h.toString(32)+"_";return o.memoizedState=c},useHostTransitionStatus:w0,useFormState:dE,useActionState:dE,useOptimistic:function(o){var c=Nn();c.memoizedState=c.baseState=o;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=h,c=j0.bind(null,He,!0,h),h.dispatch=c,[o,c]},useMemoCache:f0,useCacheRefresh:function(){return Nn().memoizedState=gF.bind(null,He)},useEffectEvent:function(o){var c=Nn(),h={impl:o};return c.memoizedState=h,function(){if((rt&2)!==0)throw Error(s(440));return h.impl.apply(void 0,arguments)}}},S0={readContext:sn,use:ph,useCallback:jE,useContext:sn,useEffect:x0,useImperativeHandle:wE,useInsertionEffect:yE,useLayoutEffect:vE,useMemo:SE,useReducer:mh,useRef:mE,useState:function(){return mh(_r)},useDebugValue:y0,useDeferredValue:function(o,c){var h=Lt();return NE(h,dt.memoizedState,o,c)},useTransition:function(){var o=mh(_r)[0],c=Lt().memoizedState;return[typeof o=="boolean"?o:du(o),c]},useSyncExternalStore:JC,useId:EE,useHostTransitionStatus:w0,useFormState:fE,useActionState:fE,useOptimistic:function(o,c){var h=Lt();return iE(h,dt,o,c)},useMemoCache:f0,useCacheRefresh:RE};S0.useEffectEvent=xE;var OE={readContext:sn,use:ph,useCallback:jE,useContext:sn,useEffect:x0,useImperativeHandle:wE,useInsertionEffect:yE,useLayoutEffect:vE,useMemo:SE,useReducer:p0,useRef:mE,useState:function(){return p0(_r)},useDebugValue:y0,useDeferredValue:function(o,c){var h=Lt();return dt===null?v0(h,o,c):NE(h,dt.memoizedState,o,c)},useTransition:function(){var o=p0(_r)[0],c=Lt().memoizedState;return[typeof o=="boolean"?o:du(o),c]},useSyncExternalStore:JC,useId:EE,useHostTransitionStatus:w0,useFormState:pE,useActionState:pE,useOptimistic:function(o,c){var h=Lt();return dt!==null?iE(h,dt,o,c):(h.baseState=o,[o,h.queue.dispatch])},useMemoCache:f0,useCacheRefresh:RE};OE.useEffectEvent=xE;function N0(o,c,h,g){c=o.memoizedState,h=h(g,c),h=h==null?c:m({},c,h),o.memoizedState=h,o.lanes===0&&(o.updateQueue.baseState=h)}var k0={enqueueSetState:function(o,c,h){o=o._reactInternals;var g=es(),j=xi(g);j.payload=c,h!=null&&(j.callback=h),c=yi(o,j,g),c!==null&&(Dn(c,o,g),ou(c,o,g))},enqueueReplaceState:function(o,c,h){o=o._reactInternals;var g=es(),j=xi(g);j.tag=1,j.payload=c,h!=null&&(j.callback=h),c=yi(o,j,g),c!==null&&(Dn(c,o,g),ou(c,o,g))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var h=es(),g=xi(h);g.tag=2,c!=null&&(g.callback=c),c=yi(o,g,h),c!==null&&(Dn(c,o,h),ou(c,o,h))}};function LE(o,c,h,g,j,N,I){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,N,I):c.prototype&&c.prototype.isPureReactComponent?!Jc(h,g)||!Jc(j,N):!0}function PE(o,c,h,g){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,g),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,g),c.state!==o&&k0.enqueueReplaceState(c,c.state,null)}function Ba(o,c){var h=c;if("ref"in c){h={};for(var g in c)g!=="ref"&&(h[g]=c[g])}if(o=o.defaultProps){h===c&&(h=m({},h));for(var j in o)h[j]===void 0&&(h[j]=o[j])}return h}function $E(o){Qf(o)}function DE(o){console.error(o)}function qE(o){Qf(o)}function vh(o,c){try{var h=o.onUncaughtError;h(c.value,{componentStack:c.stack})}catch(g){setTimeout(function(){throw g})}}function zE(o,c,h){try{var g=o.onCaughtError;g(h.value,{componentStack:h.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(j){setTimeout(function(){throw j})}}function _0(o,c,h){return h=xi(h),h.tag=3,h.payload={element:null},h.callback=function(){vh(o,c)},h}function BE(o){return o=xi(o),o.tag=3,o}function FE(o,c,h,g){var j=h.type.getDerivedStateFromError;if(typeof j=="function"){var N=g.value;o.payload=function(){return j(N)},o.callback=function(){zE(c,h,g)}}var I=h.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(o.callback=function(){zE(c,h,g),typeof j!="function"&&(Ni===null?Ni=new Set([this]):Ni.add(this));var q=g.stack;this.componentDidCatch(g.value,{componentStack:q!==null?q:""})})}function yF(o,c,h,g,j){if(h.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(c=h.alternate,c!==null&&il(c,h,j,!0),h=Qn.current,h!==null){switch(h.tag){case 31:case 13:return fs===null?Th():h.alternate===null&&Rt===0&&(Rt=3),h.flags&=-257,h.flags|=65536,h.lanes=j,g===ah?h.flags|=16384:(c=h.updateQueue,c===null?h.updateQueue=new Set([g]):c.add(g),X0(o,g,j)),!1;case 22:return h.flags|=65536,g===ah?h.flags|=16384:(c=h.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([g])},h.updateQueue=c):(h=c.retryQueue,h===null?c.retryQueue=new Set([g]):h.add(g)),X0(o,g,j)),!1}throw Error(s(435,h.tag))}return X0(o,g,j),Th(),!1}if(Ze)return c=Qn.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=j,g!==Vx&&(o=Error(s(422),{cause:g}),nu(ls(o,h)))):(g!==Vx&&(c=Error(s(423),{cause:g}),nu(ls(c,h))),o=o.current.alternate,o.flags|=65536,j&=-j,o.lanes|=j,g=ls(g,h),j=_0(o.stateNode,g,j),n0(o,j),Rt!==4&&(Rt=2)),!1;var N=Error(s(520),{cause:g});if(N=ls(N,h),wu===null?wu=[N]:wu.push(N),Rt!==4&&(Rt=2),c===null)return!0;g=ls(g,h),h=c;do{switch(h.tag){case 3:return h.flags|=65536,o=j&-j,h.lanes|=o,o=_0(h.stateNode,g,o),n0(h,o),!1;case 1:if(c=h.type,N=h.stateNode,(h.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(Ni===null||!Ni.has(N))))return h.flags|=65536,j&=-j,h.lanes|=j,j=BE(j),FE(j,o,h,g),n0(h,j),!1}h=h.return}while(h!==null);return!1}var C0=Error(s(461)),Ft=!1;function rn(o,c,h,g){c.child=o===null?GC(c,null,h,g):qa(c,o.child,h,g)}function HE(o,c,h,g,j){h=h.render;var N=c.ref;if("ref"in g){var I={};for(var q in g)q!=="ref"&&(I[q]=g[q])}else I=g;return La(c),g=l0(o,c,h,I,N,j),q=c0(),o!==null&&!Ft?(u0(o,c,j),Cr(o,c,j)):(Ze&&q&&Hx(c),c.flags|=1,rn(o,c,g,j),c.child)}function UE(o,c,h,g,j){if(o===null){var N=h.type;return typeof N=="function"&&!zx(N)&&N.defaultProps===void 0&&h.compare===null?(c.tag=15,c.type=N,VE(o,c,N,g,j)):(o=eh(h.type,null,g,c,c.mode,j),o.ref=c.ref,o.return=c,c.child=o)}if(N=o.child,!L0(o,j)){var I=N.memoizedProps;if(h=h.compare,h=h!==null?h:Jc,h(I,g)&&o.ref===c.ref)return Cr(o,c,j)}return c.flags|=1,o=wr(N,g),o.ref=c.ref,o.return=c,c.child=o}function VE(o,c,h,g,j){if(o!==null){var N=o.memoizedProps;if(Jc(N,g)&&o.ref===c.ref)if(Ft=!1,c.pendingProps=g=N,L0(o,j))(o.flags&131072)!==0&&(Ft=!0);else return c.lanes=o.lanes,Cr(o,c,j)}return E0(o,c,h,g,j)}function GE(o,c,h,g){var j=g.children,N=o!==null?o.memoizedState:null;if(o===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((c.flags&128)!==0){if(N=N!==null?N.baseLanes|h:h,o!==null){for(g=c.child=o.child,j=0;g!==null;)j=j|g.lanes|g.childLanes,g=g.sibling;g=j&~N}else g=0,c.child=null;return KE(o,c,N,h,g)}if((h&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},o!==null&&rh(c,N!==null?N.cachePool:null),N!==null?YC(c,N):r0(),QC(c);else return g=c.lanes=536870912,KE(o,c,N!==null?N.baseLanes|h:h,h,g)}else N!==null?(rh(c,N.cachePool),YC(c,N),bi(),c.memoizedState=null):(o!==null&&rh(c,null),r0(),bi());return rn(o,c,j,h),c.child}function pu(o,c){return o!==null&&o.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function KE(o,c,h,g,j){var N=Zx();return N=N===null?null:{parent:zt._currentValue,pool:N},c.memoizedState={baseLanes:h,cachePool:N},o!==null&&rh(c,null),r0(),QC(c),o!==null&&il(o,c,g,!0),c.childLanes=j,null}function bh(o,c){return c=jh({mode:c.mode,children:c.children},o.mode),c.ref=o.ref,o.child=c,c.return=o,c}function WE(o,c,h){return qa(c,o.child,null,h),o=bh(c,c.pendingProps),o.flags|=2,Xn(c),c.memoizedState=null,o}function vF(o,c,h){var g=c.pendingProps,j=(c.flags&128)!==0;if(c.flags&=-129,o===null){if(Ze){if(g.mode==="hidden")return o=bh(c,g),c.lanes=536870912,pu(null,o);if(a0(c),(o=vt)?(o=aA(o,ds),o=o!==null&&o.data==="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:fi!==null?{id:Ys,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},h=TC(o),h.return=c,c.child=h,nn=c,vt=null)):o=null,o===null)throw pi(c);return c.lanes=536870912,null}return bh(c,g)}var N=o.memoizedState;if(N!==null){var I=N.dehydrated;if(a0(c),j)if(c.flags&256)c.flags&=-257,c=WE(o,c,h);else if(c.memoizedState!==null)c.child=o.child,c.flags|=128,c=null;else throw Error(s(558));else if(Ft||il(o,c,h,!1),j=(h&o.childLanes)!==0,Ft||j){if(g=pt,g!==null&&(I=If(g,h),I!==0&&I!==N.retryLane))throw N.retryLane=I,Ta(o,I),Dn(g,o,I),C0;Th(),c=WE(o,c,h)}else o=N.treeContext,vt=hs(I.nextSibling),nn=c,Ze=!0,hi=null,ds=!1,o!==null&&OC(c,o),c=bh(c,g),c.flags|=4096;return c}return o=wr(o.child,{mode:g.mode,children:g.children}),o.ref=c.ref,c.child=o,o.return=c,o}function wh(o,c){var h=c.ref;if(h===null)o!==null&&o.ref!==null&&(c.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(s(284));(o===null||o.ref!==h)&&(c.flags|=4194816)}}function E0(o,c,h,g,j){return La(c),h=l0(o,c,h,g,void 0,j),g=c0(),o!==null&&!Ft?(u0(o,c,j),Cr(o,c,j)):(Ze&&g&&Hx(c),c.flags|=1,rn(o,c,h,j),c.child)}function YE(o,c,h,g,j,N){return La(c),c.updateQueue=null,h=ZC(c,g,h,j),XC(o),g=c0(),o!==null&&!Ft?(u0(o,c,N),Cr(o,c,N)):(Ze&&g&&Hx(c),c.flags|=1,rn(o,c,h,N),c.child)}function QE(o,c,h,g,j){if(La(c),c.stateNode===null){var N=tl,I=h.contextType;typeof I=="object"&&I!==null&&(N=sn(I)),N=new h(g,N),c.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=k0,c.stateNode=N,N._reactInternals=c,N=c.stateNode,N.props=g,N.state=c.memoizedState,N.refs={},e0(c),I=h.contextType,N.context=typeof I=="object"&&I!==null?sn(I):tl,N.state=c.memoizedState,I=h.getDerivedStateFromProps,typeof I=="function"&&(N0(c,h,I,g),N.state=c.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(I=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),I!==N.state&&k0.enqueueReplaceState(N,N.state,null),cu(c,g,N,j),lu(),N.state=c.memoizedState),typeof N.componentDidMount=="function"&&(c.flags|=4194308),g=!0}else if(o===null){N=c.stateNode;var q=c.memoizedProps,J=Ba(h,q);N.props=J;var ae=N.context,ue=h.contextType;I=tl,typeof ue=="object"&&ue!==null&&(I=sn(ue));var fe=h.getDerivedStateFromProps;ue=typeof fe=="function"||typeof N.getSnapshotBeforeUpdate=="function",q=c.pendingProps!==q,ue||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(q||ae!==I)&&PE(c,N,g,I),gi=!1;var le=c.memoizedState;N.state=le,cu(c,g,N,j),lu(),ae=c.memoizedState,q||le!==ae||gi?(typeof fe=="function"&&(N0(c,h,fe,g),ae=c.memoizedState),(J=gi||LE(c,h,J,g,le,ae,I))?(ue||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(c.flags|=4194308)):(typeof N.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=g,c.memoizedState=ae),N.props=g,N.state=ae,N.context=I,g=J):(typeof N.componentDidMount=="function"&&(c.flags|=4194308),g=!1)}else{N=c.stateNode,t0(o,c),I=c.memoizedProps,ue=Ba(h,I),N.props=ue,fe=c.pendingProps,le=N.context,ae=h.contextType,J=tl,typeof ae=="object"&&ae!==null&&(J=sn(ae)),q=h.getDerivedStateFromProps,(ae=typeof q=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(I!==fe||le!==J)&&PE(c,N,g,J),gi=!1,le=c.memoizedState,N.state=le,cu(c,g,N,j),lu();var ce=c.memoizedState;I!==fe||le!==ce||gi||o!==null&&o.dependencies!==null&&nh(o.dependencies)?(typeof q=="function"&&(N0(c,h,q,g),ce=c.memoizedState),(ue=gi||LE(c,h,ue,g,le,ce,J)||o!==null&&o.dependencies!==null&&nh(o.dependencies))?(ae||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(g,ce,J),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(g,ce,J)),typeof N.componentDidUpdate=="function"&&(c.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof N.componentDidUpdate!="function"||I===o.memoizedProps&&le===o.memoizedState||(c.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||I===o.memoizedProps&&le===o.memoizedState||(c.flags|=1024),c.memoizedProps=g,c.memoizedState=ce),N.props=g,N.state=ce,N.context=J,g=ue):(typeof N.componentDidUpdate!="function"||I===o.memoizedProps&&le===o.memoizedState||(c.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||I===o.memoizedProps&&le===o.memoizedState||(c.flags|=1024),g=!1)}return N=g,wh(o,c),g=(c.flags&128)!==0,N||g?(N=c.stateNode,h=g&&typeof h.getDerivedStateFromError!="function"?null:N.render(),c.flags|=1,o!==null&&g?(c.child=qa(c,o.child,null,j),c.child=qa(c,null,h,j)):rn(o,c,h,j),c.memoizedState=N.state,o=c.child):o=Cr(o,c,j),o}function XE(o,c,h,g){return Ma(),c.flags|=256,rn(o,c,h,g),c.child}var R0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function A0(o){return{baseLanes:o,cachePool:zC()}}function T0(o,c,h){return o=o!==null?o.childLanes&~h:0,c&&(o|=Jn),o}function ZE(o,c,h){var g=c.pendingProps,j=!1,N=(c.flags&128)!==0,I;if((I=N)||(I=o!==null&&o.memoizedState===null?!1:(Ot.current&2)!==0),I&&(j=!0,c.flags&=-129),I=(c.flags&32)!==0,c.flags&=-33,o===null){if(Ze){if(j?vi(c):bi(),(o=vt)?(o=aA(o,ds),o=o!==null&&o.data!=="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:fi!==null?{id:Ys,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},h=TC(o),h.return=c,c.child=h,nn=c,vt=null)):o=null,o===null)throw pi(c);return hy(o)?c.lanes=32:c.lanes=536870912,null}var q=g.children;return g=g.fallback,j?(bi(),j=c.mode,q=jh({mode:"hidden",children:q},j),g=Ia(g,j,h,null),q.return=c,g.return=c,q.sibling=g,c.child=q,g=c.child,g.memoizedState=A0(h),g.childLanes=T0(o,I,h),c.memoizedState=R0,pu(null,g)):(vi(c),I0(c,q))}var J=o.memoizedState;if(J!==null&&(q=J.dehydrated,q!==null)){if(N)c.flags&256?(vi(c),c.flags&=-257,c=M0(o,c,h)):c.memoizedState!==null?(bi(),c.child=o.child,c.flags|=128,c=null):(bi(),q=g.fallback,j=c.mode,g=jh({mode:"visible",children:g.children},j),q=Ia(q,j,h,null),q.flags|=2,g.return=c,q.return=c,g.sibling=q,c.child=g,qa(c,o.child,null,h),g=c.child,g.memoizedState=A0(h),g.childLanes=T0(o,I,h),c.memoizedState=R0,c=pu(null,g));else if(vi(c),hy(q)){if(I=q.nextSibling&&q.nextSibling.dataset,I)var ae=I.dgst;I=ae,g=Error(s(419)),g.stack="",g.digest=I,nu({value:g,source:null,stack:null}),c=M0(o,c,h)}else if(Ft||il(o,c,h,!1),I=(h&o.childLanes)!==0,Ft||I){if(I=pt,I!==null&&(g=If(I,h),g!==0&&g!==J.retryLane))throw J.retryLane=g,Ta(o,g),Dn(I,o,g),C0;fy(q)||Th(),c=M0(o,c,h)}else fy(q)?(c.flags|=192,c.child=o.child,c=null):(o=J.treeContext,vt=hs(q.nextSibling),nn=c,Ze=!0,hi=null,ds=!1,o!==null&&OC(c,o),c=I0(c,g.children),c.flags|=4096);return c}return j?(bi(),q=g.fallback,j=c.mode,J=o.child,ae=J.sibling,g=wr(J,{mode:"hidden",children:g.children}),g.subtreeFlags=J.subtreeFlags&65011712,ae!==null?q=wr(ae,q):(q=Ia(q,j,h,null),q.flags|=2),q.return=c,g.return=c,g.sibling=q,c.child=g,pu(null,g),g=c.child,q=o.child.memoizedState,q===null?q=A0(h):(j=q.cachePool,j!==null?(J=zt._currentValue,j=j.parent!==J?{parent:J,pool:J}:j):j=zC(),q={baseLanes:q.baseLanes|h,cachePool:j}),g.memoizedState=q,g.childLanes=T0(o,I,h),c.memoizedState=R0,pu(o.child,g)):(vi(c),h=o.child,o=h.sibling,h=wr(h,{mode:"visible",children:g.children}),h.return=c,h.sibling=null,o!==null&&(I=c.deletions,I===null?(c.deletions=[o],c.flags|=16):I.push(o)),c.child=h,c.memoizedState=null,h)}function I0(o,c){return c=jh({mode:"visible",children:c},o.mode),c.return=o,o.child=c}function jh(o,c){return o=Yn(22,o,null,c),o.lanes=0,o}function M0(o,c,h){return qa(c,o.child,null,h),o=I0(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function JE(o,c,h){o.lanes|=c;var g=o.alternate;g!==null&&(g.lanes|=c),Wx(o.return,c,h)}function O0(o,c,h,g,j,N){var I=o.memoizedState;I===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:g,tail:h,tailMode:j,treeForkCount:N}:(I.isBackwards=c,I.rendering=null,I.renderingStartTime=0,I.last=g,I.tail=h,I.tailMode=j,I.treeForkCount=N)}function eR(o,c,h){var g=c.pendingProps,j=g.revealOrder,N=g.tail;g=g.children;var I=Ot.current,q=(I&2)!==0;if(q?(I=I&1|2,c.flags|=128):I&=1,ne(Ot,I),rn(o,c,g,h),g=Ze?tu:0,!q&&o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&JE(o,h,c);else if(o.tag===19)JE(o,h,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(j){case"forwards":for(h=c.child,j=null;h!==null;)o=h.alternate,o!==null&&uh(o)===null&&(j=h),h=h.sibling;h=j,h===null?(j=c.child,c.child=null):(j=h.sibling,h.sibling=null),O0(c,!1,j,h,N,g);break;case"backwards":case"unstable_legacy-backwards":for(h=null,j=c.child,c.child=null;j!==null;){if(o=j.alternate,o!==null&&uh(o)===null){c.child=j;break}o=j.sibling,j.sibling=h,h=j,j=o}O0(c,!0,h,null,N,g);break;case"together":O0(c,!1,null,null,void 0,g);break;default:c.memoizedState=null}return c.child}function Cr(o,c,h){if(o!==null&&(c.dependencies=o.dependencies),Si|=c.lanes,(h&c.childLanes)===0)if(o!==null){if(il(o,c,h,!1),(h&c.childLanes)===0)return null}else return null;if(o!==null&&c.child!==o.child)throw Error(s(153));if(c.child!==null){for(o=c.child,h=wr(o,o.pendingProps),c.child=h,h.return=c;o.sibling!==null;)o=o.sibling,h=h.sibling=wr(o,o.pendingProps),h.return=c;h.sibling=null}return c.child}function L0(o,c){return(o.lanes&c)!==0?!0:(o=o.dependencies,!!(o!==null&&nh(o)))}function bF(o,c,h){switch(c.tag){case 3:re(c,c.stateNode.containerInfo),mi(c,zt,o.memoizedState.cache),Ma();break;case 27:case 5:pe(c);break;case 4:re(c,c.stateNode.containerInfo);break;case 10:mi(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,a0(c),null;break;case 13:var g=c.memoizedState;if(g!==null)return g.dehydrated!==null?(vi(c),c.flags|=128,null):(h&c.child.childLanes)!==0?ZE(o,c,h):(vi(c),o=Cr(o,c,h),o!==null?o.sibling:null);vi(c);break;case 19:var j=(o.flags&128)!==0;if(g=(h&c.childLanes)!==0,g||(il(o,c,h,!1),g=(h&c.childLanes)!==0),j){if(g)return eR(o,c,h);c.flags|=128}if(j=c.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),ne(Ot,Ot.current),g)break;return null;case 22:return c.lanes=0,GE(o,c,h,c.pendingProps);case 24:mi(c,zt,o.memoizedState.cache)}return Cr(o,c,h)}function tR(o,c,h){if(o!==null)if(o.memoizedProps!==c.pendingProps)Ft=!0;else{if(!L0(o,h)&&(c.flags&128)===0)return Ft=!1,bF(o,c,h);Ft=(o.flags&131072)!==0}else Ft=!1,Ze&&(c.flags&1048576)!==0&&MC(c,tu,c.index);switch(c.lanes=0,c.tag){case 16:e:{var g=c.pendingProps;if(o=$a(c.elementType),c.type=o,typeof o=="function")zx(o)?(g=Ba(o,g),c.tag=1,c=QE(null,c,o,g,h)):(c.tag=0,c=E0(null,c,o,g,h));else{if(o!=null){var j=o.$$typeof;if(j===_){c.tag=11,c=HE(null,c,o,g,h);break e}else if(j===A){c.tag=14,c=UE(null,c,o,g,h);break e}}throw c=z(o)||o,Error(s(306,c,""))}}return c;case 0:return E0(o,c,c.type,c.pendingProps,h);case 1:return g=c.type,j=Ba(g,c.pendingProps),QE(o,c,g,j,h);case 3:e:{if(re(c,c.stateNode.containerInfo),o===null)throw Error(s(387));g=c.pendingProps;var N=c.memoizedState;j=N.element,t0(o,c),cu(c,g,null,h);var I=c.memoizedState;if(g=I.cache,mi(c,zt,g),g!==N.cache&&Yx(c,[zt],h,!0),lu(),g=I.element,N.isDehydrated)if(N={element:g,isDehydrated:!1,cache:I.cache},c.updateQueue.baseState=N,c.memoizedState=N,c.flags&256){c=XE(o,c,g,h);break e}else if(g!==j){j=ls(Error(s(424)),c),nu(j),c=XE(o,c,g,h);break e}else{switch(o=c.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(vt=hs(o.firstChild),nn=c,Ze=!0,hi=null,ds=!0,h=GC(c,null,g,h),c.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling}else{if(Ma(),g===j){c=Cr(o,c,h);break e}rn(o,c,g,h)}c=c.child}return c;case 26:return wh(o,c),o===null?(h=fA(c.type,null,c.pendingProps,null))?c.memoizedState=h:Ze||(h=c.type,o=c.pendingProps,g=Dh(K.current).createElement(h),g[Wt]=c,g[hn]=o,an(g,h,o),qt(g),c.stateNode=g):c.memoizedState=fA(c.type,o.memoizedProps,c.pendingProps,o.memoizedState),null;case 27:return pe(c),o===null&&Ze&&(g=c.stateNode=cA(c.type,c.pendingProps,K.current),nn=c,ds=!0,j=vt,Ei(c.type)?(py=j,vt=hs(g.firstChild)):vt=j),rn(o,c,c.pendingProps.children,h),wh(o,c),o===null&&(c.flags|=4194304),c.child;case 5:return o===null&&Ze&&((j=g=vt)&&(g=QF(g,c.type,c.pendingProps,ds),g!==null?(c.stateNode=g,nn=c,vt=hs(g.firstChild),ds=!1,j=!0):j=!1),j||pi(c)),pe(c),j=c.type,N=c.pendingProps,I=o!==null?o.memoizedProps:null,g=N.children,cy(j,N)?g=null:I!==null&&cy(j,I)&&(c.flags|=32),c.memoizedState!==null&&(j=l0(o,c,dF,null,null,h),Ru._currentValue=j),wh(o,c),rn(o,c,g,h),c.child;case 6:return o===null&&Ze&&((o=h=vt)&&(h=XF(h,c.pendingProps,ds),h!==null?(c.stateNode=h,nn=c,vt=null,o=!0):o=!1),o||pi(c)),null;case 13:return ZE(o,c,h);case 4:return re(c,c.stateNode.containerInfo),g=c.pendingProps,o===null?c.child=qa(c,null,g,h):rn(o,c,g,h),c.child;case 11:return HE(o,c,c.type,c.pendingProps,h);case 7:return rn(o,c,c.pendingProps,h),c.child;case 8:return rn(o,c,c.pendingProps.children,h),c.child;case 12:return rn(o,c,c.pendingProps.children,h),c.child;case 10:return g=c.pendingProps,mi(c,c.type,g.value),rn(o,c,g.children,h),c.child;case 9:return j=c.type._context,g=c.pendingProps.children,La(c),j=sn(j),g=g(j),c.flags|=1,rn(o,c,g,h),c.child;case 14:return UE(o,c,c.type,c.pendingProps,h);case 15:return VE(o,c,c.type,c.pendingProps,h);case 19:return eR(o,c,h);case 31:return vF(o,c,h);case 22:return GE(o,c,h,c.pendingProps);case 24:return La(c),g=sn(zt),o===null?(j=Zx(),j===null&&(j=pt,N=Qx(),j.pooledCache=N,N.refCount++,N!==null&&(j.pooledCacheLanes|=h),j=N),c.memoizedState={parent:g,cache:j},e0(c),mi(c,zt,j)):((o.lanes&h)!==0&&(t0(o,c),cu(c,null,null,h),lu()),j=o.memoizedState,N=c.memoizedState,j.parent!==g?(j={parent:g,cache:g},c.memoizedState=j,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=j),mi(c,zt,g)):(g=N.cache,mi(c,zt,g),g!==j.cache&&Yx(c,[zt],h,!0))),rn(o,c,c.pendingProps.children,h),c.child;case 29:throw c.pendingProps}throw Error(s(156,c.tag))}function Er(o){o.flags|=4}function P0(o,c,h,g,j){if((c=(o.mode&32)!==0)&&(c=!1),c){if(o.flags|=16777216,(j&335544128)===j)if(o.stateNode.complete)o.flags|=8192;else if(ER())o.flags|=8192;else throw Da=ah,Jx}else o.flags&=-16777217}function nR(o,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!xA(c))if(ER())o.flags|=8192;else throw Da=ah,Jx}function Sh(o,c){c!==null&&(o.flags|=4),o.flags&16384&&(c=o.tag!==22?Rf():536870912,o.lanes|=c,xl|=c)}function mu(o,c){if(!Ze)switch(o.tailMode){case"hidden":c=o.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?o.tail=null:h.sibling=null;break;case"collapsed":h=o.tail;for(var g=null;h!==null;)h.alternate!==null&&(g=h),h=h.sibling;g===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function bt(o){var c=o.alternate!==null&&o.alternate.child===o.child,h=0,g=0;if(c)for(var j=o.child;j!==null;)h|=j.lanes|j.childLanes,g|=j.subtreeFlags&65011712,g|=j.flags&65011712,j.return=o,j=j.sibling;else for(j=o.child;j!==null;)h|=j.lanes|j.childLanes,g|=j.subtreeFlags,g|=j.flags,j.return=o,j=j.sibling;return o.subtreeFlags|=g,o.childLanes=h,c}function wF(o,c,h){var g=c.pendingProps;switch(Ux(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bt(c),null;case 1:return bt(c),null;case 3:return h=c.stateNode,g=null,o!==null&&(g=o.memoizedState.cache),c.memoizedState.cache!==g&&(c.flags|=2048),Nr(zt),oe(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(o===null||o.child===null)&&(rl(c)?Er(c):o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Gx())),bt(c),null;case 26:var j=c.type,N=c.memoizedState;return o===null?(Er(c),N!==null?(bt(c),nR(c,N)):(bt(c),P0(c,j,null,g,h))):N?N!==o.memoizedState?(Er(c),bt(c),nR(c,N)):(bt(c),c.flags&=-16777217):(o=o.memoizedProps,o!==g&&Er(c),bt(c),P0(c,j,o,g,h)),null;case 27:if(ge(c),h=K.current,j=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==g&&Er(c);else{if(!g){if(c.stateNode===null)throw Error(s(166));return bt(c),null}o=U.current,rl(c)?LC(c):(o=cA(j,g,h),c.stateNode=o,Er(c))}return bt(c),null;case 5:if(ge(c),j=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==g&&Er(c);else{if(!g){if(c.stateNode===null)throw Error(s(166));return bt(c),null}if(N=U.current,rl(c))LC(c);else{var I=Dh(K.current);switch(N){case 1:N=I.createElementNS("http://www.w3.org/2000/svg",j);break;case 2:N=I.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;default:switch(j){case"svg":N=I.createElementNS("http://www.w3.org/2000/svg",j);break;case"math":N=I.createElementNS("http://www.w3.org/1998/Math/MathML",j);break;case"script":N=I.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof g.is=="string"?I.createElement("select",{is:g.is}):I.createElement("select"),g.multiple?N.multiple=!0:g.size&&(N.size=g.size);break;default:N=typeof g.is=="string"?I.createElement(j,{is:g.is}):I.createElement(j)}}N[Wt]=c,N[hn]=g;e:for(I=c.child;I!==null;){if(I.tag===5||I.tag===6)N.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===c)break e;for(;I.sibling===null;){if(I.return===null||I.return===c)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}c.stateNode=N;e:switch(an(N,j,g),j){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Er(c)}}return bt(c),P0(c,c.type,o===null?null:o.memoizedProps,c.pendingProps,h),null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==g&&Er(c);else{if(typeof g!="string"&&c.stateNode===null)throw Error(s(166));if(o=K.current,rl(c)){if(o=c.stateNode,h=c.memoizedProps,g=null,j=nn,j!==null)switch(j.tag){case 27:case 5:g=j.memoizedProps}o[Wt]=c,o=!!(o.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||ZR(o.nodeValue,h)),o||pi(c,!0)}else o=Dh(o).createTextNode(g),o[Wt]=c,c.stateNode=o}return bt(c),null;case 31:if(h=c.memoizedState,o===null||o.memoizedState!==null){if(g=rl(c),h!==null){if(o===null){if(!g)throw Error(s(318));if(o=c.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(s(557));o[Wt]=c}else Ma(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;bt(c),o=!1}else h=Gx(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return c.flags&256?(Xn(c),c):(Xn(c),null);if((c.flags&128)!==0)throw Error(s(558))}return bt(c),null;case 13:if(g=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(j=rl(c),g!==null&&g.dehydrated!==null){if(o===null){if(!j)throw Error(s(318));if(j=c.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(s(317));j[Wt]=c}else Ma(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;bt(c),j=!1}else j=Gx(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=j),j=!0;if(!j)return c.flags&256?(Xn(c),c):(Xn(c),null)}return Xn(c),(c.flags&128)!==0?(c.lanes=h,c):(h=g!==null,o=o!==null&&o.memoizedState!==null,h&&(g=c.child,j=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(j=g.alternate.memoizedState.cachePool.pool),N=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(N=g.memoizedState.cachePool.pool),N!==j&&(g.flags|=2048)),h!==o&&h&&(c.child.flags|=8192),Sh(c,c.updateQueue),bt(c),null);case 4:return oe(),o===null&&ry(c.stateNode.containerInfo),bt(c),null;case 10:return Nr(c.type),bt(c),null;case 19:if(V(Ot),g=c.memoizedState,g===null)return bt(c),null;if(j=(c.flags&128)!==0,N=g.rendering,N===null)if(j)mu(g,!1);else{if(Rt!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(N=uh(o),N!==null){for(c.flags|=128,mu(g,!1),o=N.updateQueue,c.updateQueue=o,Sh(c,o),c.subtreeFlags=0,o=h,h=c.child;h!==null;)AC(h,o),h=h.sibling;return ne(Ot,Ot.current&1|2),Ze&&jr(c,g.treeForkCount),c.child}o=o.sibling}g.tail!==null&&Oe()>Eh&&(c.flags|=128,j=!0,mu(g,!1),c.lanes=4194304)}else{if(!j)if(o=uh(N),o!==null){if(c.flags|=128,j=!0,o=o.updateQueue,c.updateQueue=o,Sh(c,o),mu(g,!0),g.tail===null&&g.tailMode==="hidden"&&!N.alternate&&!Ze)return bt(c),null}else 2*Oe()-g.renderingStartTime>Eh&&h!==536870912&&(c.flags|=128,j=!0,mu(g,!1),c.lanes=4194304);g.isBackwards?(N.sibling=c.child,c.child=N):(o=g.last,o!==null?o.sibling=N:c.child=N,g.last=N)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=Oe(),o.sibling=null,h=Ot.current,ne(Ot,j?h&1|2:h&1),Ze&&jr(c,g.treeForkCount),o):(bt(c),null);case 22:case 23:return Xn(c),i0(),g=c.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(c.flags|=8192):g&&(c.flags|=8192),g?(h&536870912)!==0&&(c.flags&128)===0&&(bt(c),c.subtreeFlags&6&&(c.flags|=8192)):bt(c),h=c.updateQueue,h!==null&&Sh(c,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==h&&(c.flags|=2048),o!==null&&V(Pa),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),c.memoizedState.cache!==h&&(c.flags|=2048),Nr(zt),bt(c),null;case 25:return null;case 30:return null}throw Error(s(156,c.tag))}function jF(o,c){switch(Ux(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Nr(zt),oe(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return ge(c),null;case 31:if(c.memoizedState!==null){if(Xn(c),c.alternate===null)throw Error(s(340));Ma()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 13:if(Xn(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(s(340));Ma()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return V(Ot),null;case 4:return oe(),null;case 10:return Nr(c.type),null;case 22:case 23:return Xn(c),i0(),o!==null&&V(Pa),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return Nr(zt),null;case 25:return null;default:return null}}function sR(o,c){switch(Ux(c),c.tag){case 3:Nr(zt),oe();break;case 26:case 27:case 5:ge(c);break;case 4:oe();break;case 31:c.memoizedState!==null&&Xn(c);break;case 13:Xn(c);break;case 19:V(Ot);break;case 10:Nr(c.type);break;case 22:case 23:Xn(c),i0(),o!==null&&V(Pa);break;case 24:Nr(zt)}}function gu(o,c){try{var h=c.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var j=g.next;h=j;do{if((h.tag&o)===o){g=void 0;var N=h.create,I=h.inst;g=N(),I.destroy=g}h=h.next}while(h!==j)}}catch(q){ct(c,c.return,q)}}function wi(o,c,h){try{var g=c.updateQueue,j=g!==null?g.lastEffect:null;if(j!==null){var N=j.next;g=N;do{if((g.tag&o)===o){var I=g.inst,q=I.destroy;if(q!==void 0){I.destroy=void 0,j=c;var J=h,ae=q;try{ae()}catch(ue){ct(j,J,ue)}}}g=g.next}while(g!==N)}}catch(ue){ct(c,c.return,ue)}}function rR(o){var c=o.updateQueue;if(c!==null){var h=o.stateNode;try{WC(c,h)}catch(g){ct(o,o.return,g)}}}function iR(o,c,h){h.props=Ba(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(g){ct(o,c,g)}}function xu(o,c){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof h=="function"?o.refCleanup=h(g):h.current=g}}catch(j){ct(o,c,j)}}function Xs(o,c){var h=o.ref,g=o.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(j){ct(o,c,j)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(j){ct(o,c,j)}else h.current=null}function aR(o){var c=o.type,h=o.memoizedProps,g=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(j){ct(o,o.return,j)}}function $0(o,c,h){try{var g=o.stateNode;UF(g,o.type,h,c),g[hn]=c}catch(j){ct(o,o.return,j)}}function oR(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ei(o.type)||o.tag===4}function D0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||oR(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ei(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function q0(o,c,h){var g=o.tag;if(g===5||g===6)o=o.stateNode,c?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,c):(c=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,c.appendChild(o),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=vr));else if(g!==4&&(g===27&&Ei(o.type)&&(h=o.stateNode,c=null),o=o.child,o!==null))for(q0(o,c,h),o=o.sibling;o!==null;)q0(o,c,h),o=o.sibling}function Nh(o,c,h){var g=o.tag;if(g===5||g===6)o=o.stateNode,c?h.insertBefore(o,c):h.appendChild(o);else if(g!==4&&(g===27&&Ei(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(Nh(o,c,h),o=o.sibling;o!==null;)Nh(o,c,h),o=o.sibling}function lR(o){var c=o.stateNode,h=o.memoizedProps;try{for(var g=o.type,j=c.attributes;j.length;)c.removeAttributeNode(j[0]);an(c,g,h),c[Wt]=o,c[hn]=h}catch(N){ct(o,o.return,N)}}var Rr=!1,Ht=!1,z0=!1,cR=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function SF(o,c){if(o=o.containerInfo,oy=Vh,o=wC(o),Mx(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var j=g.anchorOffset,N=g.focusNode;g=g.focusOffset;try{h.nodeType,N.nodeType}catch{h=null;break e}var I=0,q=-1,J=-1,ae=0,ue=0,fe=o,le=null;t:for(;;){for(var ce;fe!==h||j!==0&&fe.nodeType!==3||(q=I+j),fe!==N||g!==0&&fe.nodeType!==3||(J=I+g),fe.nodeType===3&&(I+=fe.nodeValue.length),(ce=fe.firstChild)!==null;)le=fe,fe=ce;for(;;){if(fe===o)break t;if(le===h&&++ae===j&&(q=I),le===N&&++ue===g&&(J=I),(ce=fe.nextSibling)!==null)break;fe=le,le=fe.parentNode}fe=ce}h=q===-1||J===-1?null:{start:q,end:J}}else h=null}h=h||{start:0,end:0}}else h=null;for(ly={focusedElem:o,selectionRange:h},Vh=!1,Zt=c;Zt!==null;)if(c=Zt,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,Zt=o;else for(;Zt!==null;){switch(c=Zt,N=c.alternate,o=c.flags,c.tag){case 0:if((o&4)!==0&&(o=c.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h<o.length;h++)j=o[h],j.ref.impl=j.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&N!==null){o=void 0,h=c,j=N.memoizedProps,N=N.memoizedState,g=h.stateNode;try{var je=Ba(h.type,j);o=g.getSnapshotBeforeUpdate(je,N),g.__reactInternalSnapshotBeforeUpdate=o}catch(Ae){ct(h,h.return,Ae)}}break;case 3:if((o&1024)!==0){if(o=c.stateNode.containerInfo,h=o.nodeType,h===9)dy(o);else if(h===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":dy(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(s(163))}if(o=c.sibling,o!==null){o.return=c.return,Zt=o;break}Zt=c.return}}function uR(o,c,h){var g=h.flags;switch(h.tag){case 0:case 11:case 15:Tr(o,h),g&4&&gu(5,h);break;case 1:if(Tr(o,h),g&4)if(o=h.stateNode,c===null)try{o.componentDidMount()}catch(I){ct(h,h.return,I)}else{var j=Ba(h.type,c.memoizedProps);c=c.memoizedState;try{o.componentDidUpdate(j,c,o.__reactInternalSnapshotBeforeUpdate)}catch(I){ct(h,h.return,I)}}g&64&&rR(h),g&512&&xu(h,h.return);break;case 3:if(Tr(o,h),g&64&&(o=h.updateQueue,o!==null)){if(c=null,h.child!==null)switch(h.child.tag){case 27:case 5:c=h.child.stateNode;break;case 1:c=h.child.stateNode}try{WC(o,c)}catch(I){ct(h,h.return,I)}}break;case 27:c===null&&g&4&&lR(h);case 26:case 5:Tr(o,h),c===null&&g&4&&aR(h),g&512&&xu(h,h.return);break;case 12:Tr(o,h);break;case 31:Tr(o,h),g&4&&hR(o,h);break;case 13:Tr(o,h),g&4&&pR(o,h),g&64&&(o=h.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(h=IF.bind(null,h),ZF(o,h))));break;case 22:if(g=h.memoizedState!==null||Rr,!g){c=c!==null&&c.memoizedState!==null||Ht,j=Rr;var N=Ht;Rr=g,(Ht=c)&&!N?Ir(o,h,(h.subtreeFlags&8772)!==0):Tr(o,h),Rr=j,Ht=N}break;case 30:break;default:Tr(o,h)}}function dR(o){var c=o.alternate;c!==null&&(o.alternate=null,dR(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&Hc(c)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var wt=null,On=!1;function Ar(o,c,h){for(h=h.child;h!==null;)fR(o,c,h),h=h.sibling}function fR(o,c,h){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(fn,h)}catch{}switch(h.tag){case 26:Ht||Xs(h,c),Ar(o,c,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:Ht||Xs(h,c);var g=wt,j=On;Ei(h.type)&&(wt=h.stateNode,On=!1),Ar(o,c,h),_u(h.stateNode),wt=g,On=j;break;case 5:Ht||Xs(h,c);case 6:if(g=wt,j=On,wt=null,Ar(o,c,h),wt=g,On=j,wt!==null)if(On)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(h.stateNode)}catch(N){ct(h,c,N)}else try{wt.removeChild(h.stateNode)}catch(N){ct(h,c,N)}break;case 18:wt!==null&&(On?(o=wt,rA(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,h.stateNode),kl(o)):rA(wt,h.stateNode));break;case 4:g=wt,j=On,wt=h.stateNode.containerInfo,On=!0,Ar(o,c,h),wt=g,On=j;break;case 0:case 11:case 14:case 15:wi(2,h,c),Ht||wi(4,h,c),Ar(o,c,h);break;case 1:Ht||(Xs(h,c),g=h.stateNode,typeof g.componentWillUnmount=="function"&&iR(h,c,g)),Ar(o,c,h);break;case 21:Ar(o,c,h);break;case 22:Ht=(g=Ht)||h.memoizedState!==null,Ar(o,c,h),Ht=g;break;default:Ar(o,c,h)}}function hR(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{kl(o)}catch(h){ct(c,c.return,h)}}}function pR(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{kl(o)}catch(h){ct(c,c.return,h)}}function NF(o){switch(o.tag){case 31:case 13:case 19:var c=o.stateNode;return c===null&&(c=o.stateNode=new cR),c;case 22:return o=o.stateNode,c=o._retryCache,c===null&&(c=o._retryCache=new cR),c;default:throw Error(s(435,o.tag))}}function kh(o,c){var h=NF(o);c.forEach(function(g){if(!h.has(g)){h.add(g);var j=MF.bind(null,o,g);g.then(j,j)}})}function Ln(o,c){var h=c.deletions;if(h!==null)for(var g=0;g<h.length;g++){var j=h[g],N=o,I=c,q=I;e:for(;q!==null;){switch(q.tag){case 27:if(Ei(q.type)){wt=q.stateNode,On=!1;break e}break;case 5:wt=q.stateNode,On=!1;break e;case 3:case 4:wt=q.stateNode.containerInfo,On=!0;break e}q=q.return}if(wt===null)throw Error(s(160));fR(N,I,j),wt=null,On=!1,N=j.alternate,N!==null&&(N.return=null),j.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)mR(c,o),c=c.sibling}var Rs=null;function mR(o,c){var h=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Ln(c,o),Pn(o),g&4&&(wi(3,o,o.return),gu(3,o),wi(5,o,o.return));break;case 1:Ln(c,o),Pn(o),g&512&&(Ht||h===null||Xs(h,h.return)),g&64&&Rr&&(o=o.updateQueue,o!==null&&(g=o.callbacks,g!==null&&(h=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=h===null?g:h.concat(g))));break;case 26:var j=Rs;if(Ln(c,o),Pn(o),g&512&&(Ht||h===null||Xs(h,h.return)),g&4){var N=h!==null?h.memoizedState:null;if(g=o.memoizedState,h===null)if(g===null)if(o.stateNode===null){e:{g=o.type,h=o.memoizedProps,j=j.ownerDocument||j;t:switch(g){case"title":N=j.getElementsByTagName("title")[0],(!N||N[ka]||N[Wt]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=j.createElement(g),j.head.insertBefore(N,j.querySelector("head > title"))),an(N,g,h),N[Wt]=o,qt(N),g=N;break e;case"link":var I=mA("link","href",j).get(g+(h.href||""));if(I){for(var q=0;q<I.length;q++)if(N=I[q],N.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&N.getAttribute("rel")===(h.rel==null?null:h.rel)&&N.getAttribute("title")===(h.title==null?null:h.title)&&N.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){I.splice(q,1);break t}}N=j.createElement(g),an(N,g,h),j.head.appendChild(N);break;case"meta":if(I=mA("meta","content",j).get(g+(h.content||""))){for(q=0;q<I.length;q++)if(N=I[q],N.getAttribute("content")===(h.content==null?null:""+h.content)&&N.getAttribute("name")===(h.name==null?null:h.name)&&N.getAttribute("property")===(h.property==null?null:h.property)&&N.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&N.getAttribute("charset")===(h.charSet==null?null:h.charSet)){I.splice(q,1);break t}}N=j.createElement(g),an(N,g,h),j.head.appendChild(N);break;default:throw Error(s(468,g))}N[Wt]=o,qt(N),g=N}o.stateNode=g}else gA(j,o.type,o.stateNode);else o.stateNode=pA(j,g,o.memoizedProps);else N!==g?(N===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):N.count--,g===null?gA(j,o.type,o.stateNode):pA(j,g,o.memoizedProps)):g===null&&o.stateNode!==null&&$0(o,o.memoizedProps,h.memoizedProps)}break;case 27:Ln(c,o),Pn(o),g&512&&(Ht||h===null||Xs(h,h.return)),h!==null&&g&4&&$0(o,o.memoizedProps,h.memoizedProps);break;case 5:if(Ln(c,o),Pn(o),g&512&&(Ht||h===null||Xs(h,h.return)),o.flags&32){j=o.stateNode;try{Wo(j,"")}catch(je){ct(o,o.return,je)}}g&4&&o.stateNode!=null&&(j=o.memoizedProps,$0(o,j,h!==null?h.memoizedProps:j)),g&1024&&(z0=!0);break;case 6:if(Ln(c,o),Pn(o),g&4){if(o.stateNode===null)throw Error(s(162));g=o.memoizedProps,h=o.stateNode;try{h.nodeValue=g}catch(je){ct(o,o.return,je)}}break;case 3:if(Bh=null,j=Rs,Rs=qh(c.containerInfo),Ln(c,o),Rs=j,Pn(o),g&4&&h!==null&&h.memoizedState.isDehydrated)try{kl(c.containerInfo)}catch(je){ct(o,o.return,je)}z0&&(z0=!1,gR(o));break;case 4:g=Rs,Rs=qh(o.stateNode.containerInfo),Ln(c,o),Pn(o),Rs=g;break;case 12:Ln(c,o),Pn(o);break;case 31:Ln(c,o),Pn(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,kh(o,g)));break;case 13:Ln(c,o),Pn(o),o.child.flags&8192&&o.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(Ch=Oe()),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,kh(o,g)));break;case 22:j=o.memoizedState!==null;var J=h!==null&&h.memoizedState!==null,ae=Rr,ue=Ht;if(Rr=ae||j,Ht=ue||J,Ln(c,o),Ht=ue,Rr=ae,Pn(o),g&8192)e:for(c=o.stateNode,c._visibility=j?c._visibility&-2:c._visibility|1,j&&(h===null||J||Rr||Ht||Fa(o)),h=null,c=o;;){if(c.tag===5||c.tag===26){if(h===null){J=h=c;try{if(N=J.stateNode,j)I=N.style,typeof I.setProperty=="function"?I.setProperty("display","none","important"):I.display="none";else{q=J.stateNode;var fe=J.memoizedProps.style,le=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;q.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(je){ct(J,J.return,je)}}}else if(c.tag===6){if(h===null){J=c;try{J.stateNode.nodeValue=j?"":J.memoizedProps}catch(je){ct(J,J.return,je)}}}else if(c.tag===18){if(h===null){J=c;try{var ce=J.stateNode;j?iA(ce,!0):iA(J.stateNode,!1)}catch(je){ct(J,J.return,je)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;h===c&&(h=null),c=c.return}h===c&&(h=null),c.sibling.return=c.return,c=c.sibling}g&4&&(g=o.updateQueue,g!==null&&(h=g.retryQueue,h!==null&&(g.retryQueue=null,kh(o,h))));break;case 19:Ln(c,o),Pn(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,kh(o,g)));break;case 30:break;case 21:break;default:Ln(c,o),Pn(o)}}function Pn(o){var c=o.flags;if(c&2){try{for(var h,g=o.return;g!==null;){if(oR(g)){h=g;break}g=g.return}if(h==null)throw Error(s(160));switch(h.tag){case 27:var j=h.stateNode,N=D0(o);Nh(o,N,j);break;case 5:var I=h.stateNode;h.flags&32&&(Wo(I,""),h.flags&=-33);var q=D0(o);Nh(o,q,I);break;case 3:case 4:var J=h.stateNode.containerInfo,ae=D0(o);q0(o,ae,J);break;default:throw Error(s(161))}}catch(ue){ct(o,o.return,ue)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function gR(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;gR(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function Tr(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)uR(o,c.alternate,c),c=c.sibling}function Fa(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:wi(4,c,c.return),Fa(c);break;case 1:Xs(c,c.return);var h=c.stateNode;typeof h.componentWillUnmount=="function"&&iR(c,c.return,h),Fa(c);break;case 27:_u(c.stateNode);case 26:case 5:Xs(c,c.return),Fa(c);break;case 22:c.memoizedState===null&&Fa(c);break;case 30:Fa(c);break;default:Fa(c)}o=o.sibling}}function Ir(o,c,h){for(h=h&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var g=c.alternate,j=o,N=c,I=N.flags;switch(N.tag){case 0:case 11:case 15:Ir(j,N,h),gu(4,N);break;case 1:if(Ir(j,N,h),g=N,j=g.stateNode,typeof j.componentDidMount=="function")try{j.componentDidMount()}catch(ae){ct(g,g.return,ae)}if(g=N,j=g.updateQueue,j!==null){var q=g.stateNode;try{var J=j.shared.hiddenCallbacks;if(J!==null)for(j.shared.hiddenCallbacks=null,j=0;j<J.length;j++)KC(J[j],q)}catch(ae){ct(g,g.return,ae)}}h&&I&64&&rR(N),xu(N,N.return);break;case 27:lR(N);case 26:case 5:Ir(j,N,h),h&&g===null&&I&4&&aR(N),xu(N,N.return);break;case 12:Ir(j,N,h);break;case 31:Ir(j,N,h),h&&I&4&&hR(j,N);break;case 13:Ir(j,N,h),h&&I&4&&pR(j,N);break;case 22:N.memoizedState===null&&Ir(j,N,h),xu(N,N.return);break;case 30:break;default:Ir(j,N,h)}c=c.sibling}}function B0(o,c){var h=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),o=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(o=c.memoizedState.cachePool.pool),o!==h&&(o!=null&&o.refCount++,h!=null&&su(h))}function F0(o,c){o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&su(o))}function As(o,c,h,g){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)xR(o,c,h,g),c=c.sibling}function xR(o,c,h,g){var j=c.flags;switch(c.tag){case 0:case 11:case 15:As(o,c,h,g),j&2048&&gu(9,c);break;case 1:As(o,c,h,g);break;case 3:As(o,c,h,g),j&2048&&(o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&su(o)));break;case 12:if(j&2048){As(o,c,h,g),o=c.stateNode;try{var N=c.memoizedProps,I=N.id,q=N.onPostCommit;typeof q=="function"&&q(I,c.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(J){ct(c,c.return,J)}}else As(o,c,h,g);break;case 31:As(o,c,h,g);break;case 13:As(o,c,h,g);break;case 23:break;case 22:N=c.stateNode,I=c.alternate,c.memoizedState!==null?N._visibility&2?As(o,c,h,g):yu(o,c):N._visibility&2?As(o,c,h,g):(N._visibility|=2,pl(o,c,h,g,(c.subtreeFlags&10256)!==0||!1)),j&2048&&B0(I,c);break;case 24:As(o,c,h,g),j&2048&&F0(c.alternate,c);break;default:As(o,c,h,g)}}function pl(o,c,h,g,j){for(j=j&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var N=o,I=c,q=h,J=g,ae=I.flags;switch(I.tag){case 0:case 11:case 15:pl(N,I,q,J,j),gu(8,I);break;case 23:break;case 22:var ue=I.stateNode;I.memoizedState!==null?ue._visibility&2?pl(N,I,q,J,j):yu(N,I):(ue._visibility|=2,pl(N,I,q,J,j)),j&&ae&2048&&B0(I.alternate,I);break;case 24:pl(N,I,q,J,j),j&&ae&2048&&F0(I.alternate,I);break;default:pl(N,I,q,J,j)}c=c.sibling}}function yu(o,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var h=o,g=c,j=g.flags;switch(g.tag){case 22:yu(h,g),j&2048&&B0(g.alternate,g);break;case 24:yu(h,g),j&2048&&F0(g.alternate,g);break;default:yu(h,g)}c=c.sibling}}var vu=8192;function ml(o,c,h){if(o.subtreeFlags&vu)for(o=o.child;o!==null;)yR(o,c,h),o=o.sibling}function yR(o,c,h){switch(o.tag){case 26:ml(o,c,h),o.flags&vu&&o.memoizedState!==null&&u7(h,Rs,o.memoizedState,o.memoizedProps);break;case 5:ml(o,c,h);break;case 3:case 4:var g=Rs;Rs=qh(o.stateNode.containerInfo),ml(o,c,h),Rs=g;break;case 22:o.memoizedState===null&&(g=o.alternate,g!==null&&g.memoizedState!==null?(g=vu,vu=16777216,ml(o,c,h),vu=g):ml(o,c,h));break;default:ml(o,c,h)}}function vR(o){var c=o.alternate;if(c!==null&&(o=c.child,o!==null)){c.child=null;do c=o.sibling,o.sibling=null,o=c;while(o!==null)}}function bu(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var h=0;h<c.length;h++){var g=c[h];Zt=g,wR(g,o)}vR(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)bR(o),o=o.sibling}function bR(o){switch(o.tag){case 0:case 11:case 15:bu(o),o.flags&2048&&wi(9,o,o.return);break;case 3:bu(o);break;case 12:bu(o);break;case 22:var c=o.stateNode;o.memoizedState!==null&&c._visibility&2&&(o.return===null||o.return.tag!==13)?(c._visibility&=-3,_h(o)):bu(o);break;default:bu(o)}}function _h(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var h=0;h<c.length;h++){var g=c[h];Zt=g,wR(g,o)}vR(o)}for(o=o.child;o!==null;){switch(c=o,c.tag){case 0:case 11:case 15:wi(8,c,c.return),_h(c);break;case 22:h=c.stateNode,h._visibility&2&&(h._visibility&=-3,_h(c));break;default:_h(c)}o=o.sibling}}function wR(o,c){for(;Zt!==null;){var h=Zt;switch(h.tag){case 0:case 11:case 15:wi(8,h,c);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var g=h.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:su(h.memoizedState.cache)}if(g=h.child,g!==null)g.return=h,Zt=g;else e:for(h=o;Zt!==null;){g=Zt;var j=g.sibling,N=g.return;if(dR(g),g===h){Zt=null;break e}if(j!==null){j.return=N,Zt=j;break e}Zt=N}}}var kF={getCacheForType:function(o){var c=sn(zt),h=c.data.get(o);return h===void 0&&(h=o(),c.data.set(o,h)),h},cacheSignal:function(){return sn(zt).controller.signal}},_F=typeof WeakMap=="function"?WeakMap:Map,rt=0,pt=null,We=null,Qe=0,lt=0,Zn=null,ji=!1,gl=!1,H0=!1,Mr=0,Rt=0,Si=0,Ha=0,U0=0,Jn=0,xl=0,wu=null,$n=null,V0=!1,Ch=0,jR=0,Eh=1/0,Rh=null,Ni=null,Yt=0,ki=null,yl=null,Or=0,G0=0,K0=null,SR=null,ju=0,W0=null;function es(){return(rt&2)!==0&&Qe!==0?Qe&-Qe:$.T!==null?ey():Mf()}function NR(){if(Jn===0)if((Qe&536870912)===0||Ze){var o=Fo;Fo<<=1,(Fo&3932160)===0&&(Fo=262144),Jn=o}else Jn=536870912;return o=Qn.current,o!==null&&(o.flags|=32),Jn}function Dn(o,c,h){(o===pt&&(lt===2||lt===9)||o.cancelPendingCommit!==null)&&(vl(o,0),_i(o,Qe,Jn,!1)),Na(o,h),((rt&2)===0||o!==pt)&&(o===pt&&((rt&2)===0&&(Ha|=h),Rt===4&&_i(o,Qe,Jn,!1)),Zs(o))}function kR(o,c,h){if((rt&6)!==0)throw Error(s(327));var g=!h&&(c&127)===0&&(c&o.expiredLanes)===0||Sa(o,c),j=g?RF(o,c):Q0(o,c,!0),N=g;do{if(j===0){gl&&!g&&_i(o,c,0,!1);break}else{if(h=o.current.alternate,N&&!CF(h)){j=Q0(o,c,!1),N=!1;continue}if(j===2){if(N=c,o.errorRecoveryDisabledLanes&N)var I=0;else I=o.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){c=I;e:{var q=o;j=wu;var J=q.current.memoizedState.isDehydrated;if(J&&(vl(q,I).flags|=256),I=Q0(q,I,!1),I!==2){if(H0&&!J){q.errorRecoveryDisabledLanes|=N,Ha|=N,j=4;break e}N=$n,$n=j,N!==null&&($n===null?$n=N:$n.push.apply($n,N))}j=I}if(N=!1,j!==2)continue}}if(j===1){vl(o,0),_i(o,c,0,!0);break}e:{switch(g=o,N=j,N){case 0:case 1:throw Error(s(345));case 4:if((c&4194048)!==c)break;case 6:_i(g,c,Jn,!ji);break e;case 2:$n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((c&62914560)===c&&(j=Ch+300-Oe(),10<j)){if(_i(g,c,Jn,!ji),Uo(g,0,!0)!==0)break e;Or=c,g.timeoutHandle=nA(_R.bind(null,g,h,$n,Rh,V0,c,Jn,Ha,xl,ji,N,"Throttled",-0,0),j);break e}_R(g,h,$n,Rh,V0,c,Jn,Ha,xl,ji,N,null,-0,0)}}break}while(!0);Zs(o)}function _R(o,c,h,g,j,N,I,q,J,ae,ue,fe,le,ce){if(o.timeoutHandle=-1,fe=c.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vr},yR(c,N,fe);var je=(N&62914560)===N?Ch-Oe():(N&4194048)===N?jR-Oe():0;if(je=d7(fe,je),je!==null){Or=N,o.cancelPendingCommit=je(OR.bind(null,o,c,N,h,g,j,I,q,J,ue,fe,null,le,ce)),_i(o,N,I,!ae);return}}OR(o,c,N,h,g,j,I,q,J)}function CF(o){for(var c=o;;){var h=c.tag;if((h===0||h===11||h===15)&&c.flags&16384&&(h=c.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var g=0;g<h.length;g++){var j=h[g],N=j.getSnapshot;j=j.value;try{if(!Wn(N(),j))return!1}catch{return!1}}if(h=c.child,c.subtreeFlags&16384&&h!==null)h.return=c,c=h;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function _i(o,c,h,g){c&=~U0,c&=~Ha,o.suspendedLanes|=c,o.pingedLanes&=~c,g&&(o.warmLanes|=c),g=o.expirationTimes;for(var j=c;0<j;){var N=31-Sn(j),I=1<<N;g[N]=-1,j&=~I}h!==0&&Af(o,h,c)}function Ah(){return(rt&6)===0?(Su(0),!1):!0}function Y0(){if(We!==null){if(lt===0)var o=We.return;else o=We,Sr=Oa=null,d0(o),cl=null,iu=0,o=We;for(;o!==null;)sR(o.alternate,o),o=o.return;We=null}}function vl(o,c){var h=o.timeoutHandle;h!==-1&&(o.timeoutHandle=-1,KF(h)),h=o.cancelPendingCommit,h!==null&&(o.cancelPendingCommit=null,h()),Or=0,Y0(),pt=o,We=h=wr(o.current,null),Qe=c,lt=0,Zn=null,ji=!1,gl=Sa(o,c),H0=!1,xl=Jn=U0=Ha=Si=Rt=0,$n=wu=null,V0=!1,(c&8)!==0&&(c|=c&32);var g=o.entangledLanes;if(g!==0)for(o=o.entanglements,g&=c;0<g;){var j=31-Sn(g),N=1<<j;c|=o[j],g&=~N}return Mr=c,Xf(),h}function CR(o,c){He=null,$.H=hu,c===ll||c===ih?(c=HC(),lt=3):c===Jx?(c=HC(),lt=4):lt=c===C0?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Zn=c,We===null&&(Rt=1,vh(o,ls(c,o.current)))}function ER(){var o=Qn.current;return o===null?!0:(Qe&4194048)===Qe?fs===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?o===fs:!1}function RR(){var o=$.H;return $.H=hu,o===null?hu:o}function AR(){var o=$.A;return $.A=kF,o}function Th(){Rt=4,ji||(Qe&4194048)!==Qe&&Qn.current!==null||(gl=!0),(Si&134217727)===0&&(Ha&134217727)===0||pt===null||_i(pt,Qe,Jn,!1)}function Q0(o,c,h){var g=rt;rt|=2;var j=RR(),N=AR();(pt!==o||Qe!==c)&&(Rh=null,vl(o,c)),c=!1;var I=Rt;e:do try{if(lt!==0&&We!==null){var q=We,J=Zn;switch(lt){case 8:Y0(),I=6;break e;case 3:case 2:case 9:case 6:Qn.current===null&&(c=!0);var ae=lt;if(lt=0,Zn=null,bl(o,q,J,ae),h&&gl){I=0;break e}break;default:ae=lt,lt=0,Zn=null,bl(o,q,J,ae)}}EF(),I=Rt;break}catch(ue){CR(o,ue)}while(!0);return c&&o.shellSuspendCounter++,Sr=Oa=null,rt=g,$.H=j,$.A=N,We===null&&(pt=null,Qe=0,Xf()),I}function EF(){for(;We!==null;)TR(We)}function RF(o,c){var h=rt;rt|=2;var g=RR(),j=AR();pt!==o||Qe!==c?(Rh=null,Eh=Oe()+500,vl(o,c)):gl=Sa(o,c);e:do try{if(lt!==0&&We!==null){c=We;var N=Zn;t:switch(lt){case 1:lt=0,Zn=null,bl(o,c,N,1);break;case 2:case 9:if(BC(N)){lt=0,Zn=null,IR(c);break}c=function(){lt!==2&&lt!==9||pt!==o||(lt=7),Zs(o)},N.then(c,c);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:BC(N)?(lt=0,Zn=null,IR(c)):(lt=0,Zn=null,bl(o,c,N,7));break;case 5:var I=null;switch(We.tag){case 26:I=We.memoizedState;case 5:case 27:var q=We;if(I?xA(I):q.stateNode.complete){lt=0,Zn=null;var J=q.sibling;if(J!==null)We=J;else{var ae=q.return;ae!==null?(We=ae,Ih(ae)):We=null}break t}}lt=0,Zn=null,bl(o,c,N,5);break;case 6:lt=0,Zn=null,bl(o,c,N,6);break;case 8:Y0(),Rt=6;break e;default:throw Error(s(462))}}AF();break}catch(ue){CR(o,ue)}while(!0);return Sr=Oa=null,$.H=g,$.A=j,rt=h,We!==null?0:(pt=null,Qe=0,Xf(),Rt)}function AF(){for(;We!==null&&!Xt();)TR(We)}function TR(o){var c=tR(o.alternate,o,Mr);o.memoizedProps=o.pendingProps,c===null?Ih(o):We=c}function IR(o){var c=o,h=c.alternate;switch(c.tag){case 15:case 0:c=YE(h,c,c.pendingProps,c.type,void 0,Qe);break;case 11:c=YE(h,c,c.pendingProps,c.type.render,c.ref,Qe);break;case 5:d0(c);default:sR(h,c),c=We=AC(c,Mr),c=tR(h,c,Mr)}o.memoizedProps=o.pendingProps,c===null?Ih(o):We=c}function bl(o,c,h,g){Sr=Oa=null,d0(c),cl=null,iu=0;var j=c.return;try{if(yF(o,j,c,h,Qe)){Rt=1,vh(o,ls(h,o.current)),We=null;return}}catch(N){if(j!==null)throw We=j,N;Rt=1,vh(o,ls(h,o.current)),We=null;return}c.flags&32768?(Ze||g===1?o=!0:gl||(Qe&536870912)!==0?o=!1:(ji=o=!0,(g===2||g===9||g===3||g===6)&&(g=Qn.current,g!==null&&g.tag===13&&(g.flags|=16384))),MR(c,o)):Ih(c)}function Ih(o){var c=o;do{if((c.flags&32768)!==0){MR(c,ji);return}o=c.return;var h=wF(c.alternate,c,Mr);if(h!==null){We=h;return}if(c=c.sibling,c!==null){We=c;return}We=c=o}while(c!==null);Rt===0&&(Rt=5)}function MR(o,c){do{var h=jF(o.alternate,o);if(h!==null){h.flags&=32767,We=h;return}if(h=o.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!c&&(o=o.sibling,o!==null)){We=o;return}We=o=h}while(o!==null);Rt=6,We=null}function OR(o,c,h,g,j,N,I,q,J){o.cancelPendingCommit=null;do Mh();while(Yt!==0);if((rt&6)!==0)throw Error(s(327));if(c!==null){if(c===o.current)throw Error(s(177));if(N=c.lanes|c.childLanes,N|=Dx,px(o,h,N,I,q,J),o===pt&&(We=pt=null,Qe=0),yl=c,ki=o,Or=h,G0=N,K0=j,SR=g,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,OF(An,function(){return qR(),null})):(o.callbackNode=null,o.callbackPriority=0),g=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||g){g=$.T,$.T=null,j=F.p,F.p=2,I=rt,rt|=4;try{SF(o,c,h)}finally{rt=I,F.p=j,$.T=g}}Yt=1,LR(),PR(),$R()}}function LR(){if(Yt===1){Yt=0;var o=ki,c=yl,h=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||h){h=$.T,$.T=null;var g=F.p;F.p=2;var j=rt;rt|=4;try{mR(c,o);var N=ly,I=wC(o.containerInfo),q=N.focusedElem,J=N.selectionRange;if(I!==q&&q&&q.ownerDocument&&bC(q.ownerDocument.documentElement,q)){if(J!==null&&Mx(q)){var ae=J.start,ue=J.end;if(ue===void 0&&(ue=ae),"selectionStart"in q)q.selectionStart=ae,q.selectionEnd=Math.min(ue,q.value.length);else{var fe=q.ownerDocument||document,le=fe&&fe.defaultView||window;if(le.getSelection){var ce=le.getSelection(),je=q.textContent.length,Ae=Math.min(J.start,je),ht=J.end===void 0?Ae:Math.min(J.end,je);!ce.extend&&Ae>ht&&(I=ht,ht=Ae,Ae=I);var se=vC(q,Ae),ee=vC(q,ht);if(se&&ee&&(ce.rangeCount!==1||ce.anchorNode!==se.node||ce.anchorOffset!==se.offset||ce.focusNode!==ee.node||ce.focusOffset!==ee.offset)){var ie=fe.createRange();ie.setStart(se.node,se.offset),ce.removeAllRanges(),Ae>ht?(ce.addRange(ie),ce.extend(ee.node,ee.offset)):(ie.setEnd(ee.node,ee.offset),ce.addRange(ie))}}}}for(fe=[],ce=q;ce=ce.parentNode;)ce.nodeType===1&&fe.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof q.focus=="function"&&q.focus(),q=0;q<fe.length;q++){var de=fe[q];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}Vh=!!oy,ly=oy=null}finally{rt=j,F.p=g,$.T=h}}o.current=c,Yt=2}}function PR(){if(Yt===2){Yt=0;var o=ki,c=yl,h=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||h){h=$.T,$.T=null;var g=F.p;F.p=2;var j=rt;rt|=4;try{uR(o,c.alternate,c)}finally{rt=j,F.p=g,$.T=h}}Yt=3}}function $R(){if(Yt===4||Yt===3){Yt=0,yt();var o=ki,c=yl,h=Or,g=SR;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?Yt=5:(Yt=0,yl=ki=null,DR(o,o.pendingLanes));var j=o.pendingLanes;if(j===0&&(Ni=null),Fc(h),c=c.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(fn,c,void 0,(c.current.flags&128)===128)}catch{}if(g!==null){c=$.T,j=F.p,F.p=2,$.T=null;try{for(var N=o.onRecoverableError,I=0;I<g.length;I++){var q=g[I];N(q.value,{componentStack:q.stack})}}finally{$.T=c,F.p=j}}(Or&3)!==0&&Mh(),Zs(o),j=o.pendingLanes,(h&261930)!==0&&(j&42)!==0?o===W0?ju++:(ju=0,W0=o):ju=0,Su(0)}}function DR(o,c){(o.pooledCacheLanes&=c)===0&&(c=o.pooledCache,c!=null&&(o.pooledCache=null,su(c)))}function Mh(){return LR(),PR(),$R(),qR()}function qR(){if(Yt!==5)return!1;var o=ki,c=G0;G0=0;var h=Fc(Or),g=$.T,j=F.p;try{F.p=32>h?32:h,$.T=null,h=K0,K0=null;var N=ki,I=Or;if(Yt=0,yl=ki=null,Or=0,(rt&6)!==0)throw Error(s(331));var q=rt;if(rt|=4,bR(N.current),xR(N,N.current,I,h),rt=q,Su(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(fn,N)}catch{}return!0}finally{F.p=j,$.T=g,DR(o,c)}}function zR(o,c,h){c=ls(h,c),c=_0(o.stateNode,c,2),o=yi(o,c,2),o!==null&&(Na(o,2),Zs(o))}function ct(o,c,h){if(o.tag===3)zR(o,o,h);else for(;c!==null;){if(c.tag===3){zR(c,o,h);break}else if(c.tag===1){var g=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ni===null||!Ni.has(g))){o=ls(h,o),h=BE(2),g=yi(c,h,2),g!==null&&(FE(h,g,c,o),Na(g,2),Zs(g));break}}c=c.return}}function X0(o,c,h){var g=o.pingCache;if(g===null){g=o.pingCache=new _F;var j=new Set;g.set(c,j)}else j=g.get(c),j===void 0&&(j=new Set,g.set(c,j));j.has(h)||(H0=!0,j.add(h),o=TF.bind(null,o,c,h),c.then(o,o))}function TF(o,c,h){var g=o.pingCache;g!==null&&g.delete(c),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,pt===o&&(Qe&h)===h&&(Rt===4||Rt===3&&(Qe&62914560)===Qe&&300>Oe()-Ch?(rt&2)===0&&vl(o,0):U0|=h,xl===Qe&&(xl=0)),Zs(o)}function BR(o,c){c===0&&(c=Rf()),o=Ta(o,c),o!==null&&(Na(o,c),Zs(o))}function IF(o){var c=o.memoizedState,h=0;c!==null&&(h=c.retryLane),BR(o,h)}function MF(o,c){var h=0;switch(o.tag){case 31:case 13:var g=o.stateNode,j=o.memoizedState;j!==null&&(h=j.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(s(314))}g!==null&&g.delete(c),BR(o,h)}function OF(o,c){return jn(o,c)}var Oh=null,wl=null,Z0=!1,Lh=!1,J0=!1,Ci=0;function Zs(o){o!==wl&&o.next===null&&(wl===null?Oh=wl=o:wl=wl.next=o),Lh=!0,Z0||(Z0=!0,PF())}function Su(o,c){if(!J0&&Lh){J0=!0;do for(var h=!1,g=Oh;g!==null;){if(o!==0){var j=g.pendingLanes;if(j===0)var N=0;else{var I=g.suspendedLanes,q=g.pingedLanes;N=(1<<31-Sn(42|o)+1)-1,N&=j&~(I&~q),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(h=!0,VR(g,N))}else N=Qe,N=Uo(g,g===pt?N:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(N&3)===0||Sa(g,N)||(h=!0,VR(g,N));g=g.next}while(h);J0=!1}}function LF(){FR()}function FR(){Lh=Z0=!1;var o=0;Ci!==0&&GF()&&(o=Ci);for(var c=Oe(),h=null,g=Oh;g!==null;){var j=g.next,N=HR(g,c);N===0?(g.next=null,h===null?Oh=j:h.next=j,j===null&&(wl=h)):(h=g,(o!==0||(N&3)!==0)&&(Lh=!0)),g=j}Yt!==0&&Yt!==5||Su(o),Ci!==0&&(Ci=0)}function HR(o,c){for(var h=o.suspendedLanes,g=o.pingedLanes,j=o.expirationTimes,N=o.pendingLanes&-62914561;0<N;){var I=31-Sn(N),q=1<<I,J=j[I];J===-1?((q&h)===0||(q&g)!==0)&&(j[I]=hx(q,c)):J<=c&&(o.expiredLanes|=q),N&=~q}if(c=pt,h=Qe,h=Uo(o,o===c?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g=o.callbackNode,h===0||o===c&&(lt===2||lt===9)||o.cancelPendingCommit!==null)return g!==null&&g!==null&&tn(g),o.callbackNode=null,o.callbackPriority=0;if((h&3)===0||Sa(o,h)){if(c=h&-h,c===o.callbackPriority)return c;switch(g!==null&&tn(g),Fc(h)){case 2:case 8:h=Kn;break;case 32:h=An;break;case 268435456:h=pr;break;default:h=An}return g=UR.bind(null,o),h=jn(h,g),o.callbackPriority=c,o.callbackNode=h,c}return g!==null&&g!==null&&tn(g),o.callbackPriority=2,o.callbackNode=null,2}function UR(o,c){if(Yt!==0&&Yt!==5)return o.callbackNode=null,o.callbackPriority=0,null;var h=o.callbackNode;if(Mh()&&o.callbackNode!==h)return null;var g=Qe;return g=Uo(o,o===pt?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g===0?null:(kR(o,g,c),HR(o,Oe()),o.callbackNode!=null&&o.callbackNode===h?UR.bind(null,o):null)}function VR(o,c){if(Mh())return null;kR(o,c,!0)}function PF(){WF(function(){(rt&6)!==0?jn(Kt,LF):FR()})}function ey(){if(Ci===0){var o=al;o===0&&(o=Bo,Bo<<=1,(Bo&261888)===0&&(Bo=256)),Ci=o}return Ci}function GR(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Hf(""+o)}function KR(o,c){var h=c.ownerDocument.createElement("input");return h.name=c.name,h.value=c.value,o.id&&h.setAttribute("form",o.id),c.parentNode.insertBefore(h,c),o=new FormData(o),h.parentNode.removeChild(h),o}function $F(o,c,h,g,j){if(c==="submit"&&h&&h.stateNode===j){var N=GR((j[hn]||null).action),I=g.submitter;I&&(c=(c=I[hn]||null)?GR(c.formAction):I.getAttribute("formAction"),c!==null&&(N=c,I=null));var q=new Kf("action","action",null,g,j);o.push({event:q,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Ci!==0){var J=I?KR(j,I):new FormData(j);b0(h,{pending:!0,data:J,method:j.method,action:N},null,J)}}else typeof N=="function"&&(q.preventDefault(),J=I?KR(j,I):new FormData(j),b0(h,{pending:!0,data:J,method:j.method,action:N},N,J))},currentTarget:j}]})}}for(var ty=0;ty<$x.length;ty++){var ny=$x[ty],DF=ny.toLowerCase(),qF=ny[0].toUpperCase()+ny.slice(1);Es(DF,"on"+qF)}Es(NC,"onAnimationEnd"),Es(kC,"onAnimationIteration"),Es(_C,"onAnimationStart"),Es("dblclick","onDoubleClick"),Es("focusin","onFocus"),Es("focusout","onBlur"),Es(tF,"onTransitionRun"),Es(nF,"onTransitionStart"),Es(sF,"onTransitionCancel"),Es(CC,"onTransitionEnd"),ci("onMouseEnter",["mouseout","mouseover"]),ci("onMouseLeave",["mouseout","mouseover"]),ci("onPointerEnter",["pointerout","pointerover"]),ci("onPointerLeave",["pointerout","pointerover"]),xr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xr("onBeforeInput",["compositionend","keypress","textInput","paste"]),xr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Nu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zF=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Nu));function WR(o,c){c=(c&4)!==0;for(var h=0;h<o.length;h++){var g=o[h],j=g.event;g=g.listeners;e:{var N=void 0;if(c)for(var I=g.length-1;0<=I;I--){var q=g[I],J=q.instance,ae=q.currentTarget;if(q=q.listener,J!==N&&j.isPropagationStopped())break e;N=q,j.currentTarget=ae;try{N(j)}catch(ue){Qf(ue)}j.currentTarget=null,N=J}else for(I=0;I<g.length;I++){if(q=g[I],J=q.instance,ae=q.currentTarget,q=q.listener,J!==N&&j.isPropagationStopped())break e;N=q,j.currentTarget=ae;try{N(j)}catch(ue){Qf(ue)}j.currentTarget=null,N=J}}}}function Ye(o,c){var h=c[Vo];h===void 0&&(h=c[Vo]=new Set);var g=o+"__bubble";h.has(g)||(YR(c,o,2,!1),h.add(g))}function sy(o,c,h){var g=0;c&&(g|=4),YR(h,o,g,c)}var Ph="_reactListening"+Math.random().toString(36).slice(2);function ry(o){if(!o[Ph]){o[Ph]=!0,$f.forEach(function(h){h!=="selectionchange"&&(zF.has(h)||sy(h,!1,o),sy(h,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[Ph]||(c[Ph]=!0,sy("selectionchange",!1,c))}}function YR(o,c,h,g){switch(NA(c)){case 2:var j=p7;break;case 8:j=m7;break;default:j=vy}h=j.bind(null,c,h,o),j=void 0,!Nx||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(j=!0),g?j!==void 0?o.addEventListener(c,h,{capture:!0,passive:j}):o.addEventListener(c,h,!0):j!==void 0?o.addEventListener(c,h,{passive:j}):o.addEventListener(c,h,!1)}function iy(o,c,h,g,j){var N=g;if((c&1)===0&&(c&2)===0&&g!==null)e:for(;;){if(g===null)return;var I=g.tag;if(I===3||I===4){var q=g.stateNode.containerInfo;if(q===j)break;if(I===4)for(I=g.return;I!==null;){var J=I.tag;if((J===3||J===4)&&I.stateNode.containerInfo===j)return;I=I.return}for(;q!==null;){if(I=ii(q),I===null)return;if(J=I.tag,J===5||J===6||J===26||J===27){g=N=I;continue e}q=q.parentNode}}g=g.return}eC(function(){var ae=N,ue=jx(h),fe=[];e:{var le=EC.get(o);if(le!==void 0){var ce=Kf,je=o;switch(o){case"keypress":if(Vf(h)===0)break e;case"keydown":case"keyup":ce=MB;break;case"focusin":je="focus",ce=Ex;break;case"focusout":je="blur",ce=Ex;break;case"beforeblur":case"afterblur":ce=Ex;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=sC;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=wB;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=PB;break;case NC:case kC:case _C:ce=NB;break;case CC:ce=DB;break;case"scroll":case"scrollend":ce=vB;break;case"wheel":ce=zB;break;case"copy":case"cut":case"paste":ce=_B;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=iC;break;case"toggle":case"beforetoggle":ce=FB}var Ae=(c&4)!==0,ht=!Ae&&(o==="scroll"||o==="scrollend"),se=Ae?le!==null?le+"Capture":null:le;Ae=[];for(var ee=ae,ie;ee!==null;){var de=ee;if(ie=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||ie===null||se===null||(de=Gc(ee,se),de!=null&&Ae.push(ku(ee,de,ie))),ht)break;ee=ee.return}0<Ae.length&&(le=new ce(le,je,null,h,ue),fe.push({event:le,listeners:Ae}))}}if((c&7)===0){e:{if(le=o==="mouseover"||o==="pointerover",ce=o==="mouseout"||o==="pointerout",le&&h!==wx&&(je=h.relatedTarget||h.fromElement)&&(ii(je)||je[gr]))break e;if((ce||le)&&(le=ue.window===ue?ue:(le=ue.ownerDocument)?le.defaultView||le.parentWindow:window,ce?(je=h.relatedTarget||h.toElement,ce=ae,je=je?ii(je):null,je!==null&&(ht=a(je),Ae=je.tag,je!==ht||Ae!==5&&Ae!==27&&Ae!==6)&&(je=null)):(ce=null,je=ae),ce!==je)){if(Ae=sC,de="onMouseLeave",se="onMouseEnter",ee="mouse",(o==="pointerout"||o==="pointerover")&&(Ae=iC,de="onPointerLeave",se="onPointerEnter",ee="pointer"),ht=ce==null?le:oi(ce),ie=je==null?le:oi(je),le=new Ae(de,ee+"leave",ce,h,ue),le.target=ht,le.relatedTarget=ie,de=null,ii(ue)===ae&&(Ae=new Ae(se,ee+"enter",je,h,ue),Ae.target=ie,Ae.relatedTarget=ht,de=Ae),ht=de,ce&&je)t:{for(Ae=BF,se=ce,ee=je,ie=0,de=se;de;de=Ae(de))ie++;de=0;for(var Re=ee;Re;Re=Ae(Re))de++;for(;0<ie-de;)se=Ae(se),ie--;for(;0<de-ie;)ee=Ae(ee),de--;for(;ie--;){if(se===ee||ee!==null&&se===ee.alternate){Ae=se;break t}se=Ae(se),ee=Ae(ee)}Ae=null}else Ae=null;ce!==null&&QR(fe,le,ce,Ae,!1),je!==null&&ht!==null&&QR(fe,ht,je,Ae,!0)}}e:{if(le=ae?oi(ae):window,ce=le.nodeName&&le.nodeName.toLowerCase(),ce==="select"||ce==="input"&&le.type==="file")var tt=hC;else if(dC(le))if(pC)tt=ZB;else{tt=QB;var Ce=YB}else ce=le.nodeName,!ce||ce.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?ae&&bx(ae.elementType)&&(tt=hC):tt=XB;if(tt&&(tt=tt(o,ae))){fC(fe,tt,h,ue);break e}Ce&&Ce(o,le,ae),o==="focusout"&&ae&&le.type==="number"&&ae.memoizedProps.value!=null&&Vc(le,"number",le.value)}switch(Ce=ae?oi(ae):window,o){case"focusin":(dC(Ce)||Ce.contentEditable==="true")&&(Zo=Ce,Ox=ae,eu=null);break;case"focusout":eu=Ox=Zo=null;break;case"mousedown":Lx=!0;break;case"contextmenu":case"mouseup":case"dragend":Lx=!1,jC(fe,h,ue);break;case"selectionchange":if(eF)break;case"keydown":case"keyup":jC(fe,h,ue)}var Ue;if(Ax)e:{switch(o){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Xo?cC(o,h)&&(Xe="onCompositionEnd"):o==="keydown"&&h.keyCode===229&&(Xe="onCompositionStart");Xe&&(aC&&h.locale!=="ko"&&(Xo||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Xo&&(Ue=tC()):(di=ue,kx="value"in di?di.value:di.textContent,Xo=!0)),Ce=$h(ae,Xe),0<Ce.length&&(Xe=new rC(Xe,o,null,h,ue),fe.push({event:Xe,listeners:Ce}),Ue?Xe.data=Ue:(Ue=uC(h),Ue!==null&&(Xe.data=Ue)))),(Ue=UB?VB(o,h):GB(o,h))&&(Xe=$h(ae,"onBeforeInput"),0<Xe.length&&(Ce=new rC("onBeforeInput","beforeinput",null,h,ue),fe.push({event:Ce,listeners:Xe}),Ce.data=Ue)),$F(fe,o,ae,h,ue)}WR(fe,c)})}function ku(o,c,h){return{instance:o,listener:c,currentTarget:h}}function $h(o,c){for(var h=c+"Capture",g=[];o!==null;){var j=o,N=j.stateNode;if(j=j.tag,j!==5&&j!==26&&j!==27||N===null||(j=Gc(o,h),j!=null&&g.unshift(ku(o,j,N)),j=Gc(o,c),j!=null&&g.push(ku(o,j,N))),o.tag===3)return g;o=o.return}return[]}function BF(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function QR(o,c,h,g,j){for(var N=c._reactName,I=[];h!==null&&h!==g;){var q=h,J=q.alternate,ae=q.stateNode;if(q=q.tag,J!==null&&J===g)break;q!==5&&q!==26&&q!==27||ae===null||(J=ae,j?(ae=Gc(h,N),ae!=null&&I.unshift(ku(h,ae,J))):j||(ae=Gc(h,N),ae!=null&&I.push(ku(h,ae,J)))),h=h.return}I.length!==0&&o.push({event:c,listeners:I})}var FF=/\r\n?/g,HF=/\u0000|\uFFFD/g;function XR(o){return(typeof o=="string"?o:""+o).replace(FF,`
49
+ `).replace(HF,"")}function ZR(o,c){return c=XR(c),XR(o)===c}function ft(o,c,h,g,j,N){switch(h){case"children":typeof g=="string"?c==="body"||c==="textarea"&&g===""||Wo(o,g):(typeof g=="number"||typeof g=="bigint")&&c!=="body"&&Wo(o,""+g);break;case"className":Ko(o,"class",g);break;case"tabIndex":Ko(o,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Ko(o,h,g);break;case"style":Z_(o,g,N);break;case"data":if(c!=="object"){Ko(o,"data",g);break}case"src":case"href":if(g===""&&(c!=="a"||h!=="href")){o.removeAttribute(h);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(h);break}g=Hf(""+g),o.setAttribute(h,g);break;case"action":case"formAction":if(typeof g=="function"){o.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof N=="function"&&(h==="formAction"?(c!=="input"&&ft(o,c,"name",j.name,j,null),ft(o,c,"formEncType",j.formEncType,j,null),ft(o,c,"formMethod",j.formMethod,j,null),ft(o,c,"formTarget",j.formTarget,j,null)):(ft(o,c,"encType",j.encType,j,null),ft(o,c,"method",j.method,j,null),ft(o,c,"target",j.target,j,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(h);break}g=Hf(""+g),o.setAttribute(h,g);break;case"onClick":g!=null&&(o.onclick=vr);break;case"onScroll":g!=null&&Ye("scroll",o);break;case"onScrollEnd":g!=null&&Ye("scrollend",o);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(h=g.__html,h!=null){if(j.children!=null)throw Error(s(60));o.innerHTML=h}}break;case"multiple":o.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":o.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){o.removeAttribute("xlink:href");break}h=Hf(""+g),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(h,""+g):o.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(h,""):o.removeAttribute(h);break;case"capture":case"download":g===!0?o.setAttribute(h,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(h,g):o.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?o.setAttribute(h,g):o.removeAttribute(h);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?o.removeAttribute(h):o.setAttribute(h,g);break;case"popover":Ye("beforetoggle",o),Ye("toggle",o),Go(o,"popover",g);break;case"xlinkActuate":Cs(o,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Cs(o,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Cs(o,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Cs(o,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Cs(o,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Cs(o,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Cs(o,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Cs(o,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Cs(o,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":Go(o,"is",g);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=xB.get(h)||h,Go(o,h,g))}}function ay(o,c,h,g,j,N){switch(h){case"style":Z_(o,g,N);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(h=g.__html,h!=null){if(j.children!=null)throw Error(s(60));o.innerHTML=h}}break;case"children":typeof g=="string"?Wo(o,g):(typeof g=="number"||typeof g=="bigint")&&Wo(o,""+g);break;case"onScroll":g!=null&&Ye("scroll",o);break;case"onScrollEnd":g!=null&&Ye("scrollend",o);break;case"onClick":g!=null&&(o.onclick=vr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Df.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(j=h.endsWith("Capture"),c=h.slice(2,j?h.length-7:void 0),N=o[hn]||null,N=N!=null?N[h]:null,typeof N=="function"&&o.removeEventListener(c,N,j),typeof g=="function")){typeof N!="function"&&N!==null&&(h in o?o[h]=null:o.hasAttribute(h)&&o.removeAttribute(h)),o.addEventListener(c,g,j);break e}h in o?o[h]=g:g===!0?o.setAttribute(h,""):Go(o,h,g)}}}function an(o,c,h){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",o),Ye("load",o);var g=!1,j=!1,N;for(N in h)if(h.hasOwnProperty(N)){var I=h[N];if(I!=null)switch(N){case"src":g=!0;break;case"srcSet":j=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,c));default:ft(o,c,N,I,h,null)}}j&&ft(o,c,"srcSet",h.srcSet,h,null),g&&ft(o,c,"src",h.src,h,null);return;case"input":Ye("invalid",o);var q=N=I=j=null,J=null,ae=null;for(g in h)if(h.hasOwnProperty(g)){var ue=h[g];if(ue!=null)switch(g){case"name":j=ue;break;case"type":I=ue;break;case"checked":J=ue;break;case"defaultChecked":ae=ue;break;case"value":N=ue;break;case"defaultValue":q=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,c));break;default:ft(o,c,g,ue,h,null)}}Ff(o,N,q,J,ae,I,j,!1);return;case"select":Ye("invalid",o),g=I=N=null;for(j in h)if(h.hasOwnProperty(j)&&(q=h[j],q!=null))switch(j){case"value":N=q;break;case"defaultValue":I=q;break;case"multiple":g=q;default:ft(o,c,j,q,h,null)}c=N,h=I,o.multiple=!!g,c!=null?yr(o,!!g,c,!1):h!=null&&yr(o,!!g,h,!0);return;case"textarea":Ye("invalid",o),N=j=g=null;for(I in h)if(h.hasOwnProperty(I)&&(q=h[I],q!=null))switch(I){case"value":g=q;break;case"defaultValue":j=q;break;case"children":N=q;break;case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(91));break;default:ft(o,c,I,q,h,null)}Q_(o,g,j,N);return;case"option":for(J in h)if(h.hasOwnProperty(J)&&(g=h[J],g!=null))switch(J){case"selected":o.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:ft(o,c,J,g,h,null)}return;case"dialog":Ye("beforetoggle",o),Ye("toggle",o),Ye("cancel",o),Ye("close",o);break;case"iframe":case"object":Ye("load",o);break;case"video":case"audio":for(g=0;g<Nu.length;g++)Ye(Nu[g],o);break;case"image":Ye("error",o),Ye("load",o);break;case"details":Ye("toggle",o);break;case"embed":case"source":case"link":Ye("error",o),Ye("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in h)if(h.hasOwnProperty(ae)&&(g=h[ae],g!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,c));default:ft(o,c,ae,g,h,null)}return;default:if(bx(c)){for(ue in h)h.hasOwnProperty(ue)&&(g=h[ue],g!==void 0&&ay(o,c,ue,g,h,void 0));return}}for(q in h)h.hasOwnProperty(q)&&(g=h[q],g!=null&&ft(o,c,q,g,h,null))}function UF(o,c,h,g){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var j=null,N=null,I=null,q=null,J=null,ae=null,ue=null;for(ce in h){var fe=h[ce];if(h.hasOwnProperty(ce)&&fe!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":J=fe;default:g.hasOwnProperty(ce)||ft(o,c,ce,null,g,fe)}}for(var le in g){var ce=g[le];if(fe=h[le],g.hasOwnProperty(le)&&(ce!=null||fe!=null))switch(le){case"type":N=ce;break;case"name":j=ce;break;case"checked":ae=ce;break;case"defaultChecked":ue=ce;break;case"value":I=ce;break;case"defaultValue":q=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,c));break;default:ce!==fe&&ft(o,c,le,ce,g,fe)}}Ca(o,I,q,J,ae,ue,N,j);return;case"select":ce=I=q=le=null;for(N in h)if(J=h[N],h.hasOwnProperty(N)&&J!=null)switch(N){case"value":break;case"multiple":ce=J;default:g.hasOwnProperty(N)||ft(o,c,N,null,g,J)}for(j in g)if(N=g[j],J=h[j],g.hasOwnProperty(j)&&(N!=null||J!=null))switch(j){case"value":le=N;break;case"defaultValue":q=N;break;case"multiple":I=N;default:N!==J&&ft(o,c,j,N,g,J)}c=q,h=I,g=ce,le!=null?yr(o,!!h,le,!1):!!g!=!!h&&(c!=null?yr(o,!!h,c,!0):yr(o,!!h,h?[]:"",!1));return;case"textarea":ce=le=null;for(q in h)if(j=h[q],h.hasOwnProperty(q)&&j!=null&&!g.hasOwnProperty(q))switch(q){case"value":break;case"children":break;default:ft(o,c,q,null,g,j)}for(I in g)if(j=g[I],N=h[I],g.hasOwnProperty(I)&&(j!=null||N!=null))switch(I){case"value":le=j;break;case"defaultValue":ce=j;break;case"children":break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(s(91));break;default:j!==N&&ft(o,c,I,j,g,N)}Y_(o,le,ce);return;case"option":for(var je in h)if(le=h[je],h.hasOwnProperty(je)&&le!=null&&!g.hasOwnProperty(je))switch(je){case"selected":o.selected=!1;break;default:ft(o,c,je,null,g,le)}for(J in g)if(le=g[J],ce=h[J],g.hasOwnProperty(J)&&le!==ce&&(le!=null||ce!=null))switch(J){case"selected":o.selected=le&&typeof le!="function"&&typeof le!="symbol";break;default:ft(o,c,J,le,g,ce)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ae in h)le=h[Ae],h.hasOwnProperty(Ae)&&le!=null&&!g.hasOwnProperty(Ae)&&ft(o,c,Ae,null,g,le);for(ae in g)if(le=g[ae],ce=h[ae],g.hasOwnProperty(ae)&&le!==ce&&(le!=null||ce!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(s(137,c));break;default:ft(o,c,ae,le,g,ce)}return;default:if(bx(c)){for(var ht in h)le=h[ht],h.hasOwnProperty(ht)&&le!==void 0&&!g.hasOwnProperty(ht)&&ay(o,c,ht,void 0,g,le);for(ue in g)le=g[ue],ce=h[ue],!g.hasOwnProperty(ue)||le===ce||le===void 0&&ce===void 0||ay(o,c,ue,le,g,ce);return}}for(var se in h)le=h[se],h.hasOwnProperty(se)&&le!=null&&!g.hasOwnProperty(se)&&ft(o,c,se,null,g,le);for(fe in g)le=g[fe],ce=h[fe],!g.hasOwnProperty(fe)||le===ce||le==null&&ce==null||ft(o,c,fe,le,g,ce)}function JR(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function VF(){if(typeof performance.getEntriesByType=="function"){for(var o=0,c=0,h=performance.getEntriesByType("resource"),g=0;g<h.length;g++){var j=h[g],N=j.transferSize,I=j.initiatorType,q=j.duration;if(N&&q&&JR(I)){for(I=0,q=j.responseEnd,g+=1;g<h.length;g++){var J=h[g],ae=J.startTime;if(ae>q)break;var ue=J.transferSize,fe=J.initiatorType;ue&&JR(fe)&&(J=J.responseEnd,I+=ue*(J<q?1:(q-ae)/(J-ae)))}if(--g,c+=8*(N+I)/(j.duration/1e3),o++,10<o)break}}if(0<o)return c/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var oy=null,ly=null;function Dh(o){return o.nodeType===9?o:o.ownerDocument}function eA(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tA(o,c){if(o===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&c==="foreignObject"?0:o}function cy(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var uy=null;function GF(){var o=window.event;return o&&o.type==="popstate"?o===uy?!1:(uy=o,!0):(uy=null,!1)}var nA=typeof setTimeout=="function"?setTimeout:void 0,KF=typeof clearTimeout=="function"?clearTimeout:void 0,sA=typeof Promise=="function"?Promise:void 0,WF=typeof queueMicrotask=="function"?queueMicrotask:typeof sA<"u"?function(o){return sA.resolve(null).then(o).catch(YF)}:nA;function YF(o){setTimeout(function(){throw o})}function Ei(o){return o==="head"}function rA(o,c){var h=c,g=0;do{var j=h.nextSibling;if(o.removeChild(h),j&&j.nodeType===8)if(h=j.data,h==="/$"||h==="/&"){if(g===0){o.removeChild(j),kl(c);return}g--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")g++;else if(h==="html")_u(o.ownerDocument.documentElement);else if(h==="head"){h=o.ownerDocument.head,_u(h);for(var N=h.firstChild;N;){var I=N.nextSibling,q=N.nodeName;N[ka]||q==="SCRIPT"||q==="STYLE"||q==="LINK"&&N.rel.toLowerCase()==="stylesheet"||h.removeChild(N),N=I}}else h==="body"&&_u(o.ownerDocument.body);h=j}while(h);kl(c)}function iA(o,c){var h=o;o=0;do{var g=h.nextSibling;if(h.nodeType===1?c?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(c?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),g&&g.nodeType===8)if(h=g.data,h==="/$"){if(o===0)break;o--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||o++;h=g}while(h)}function dy(o){var c=o.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var h=c;switch(c=c.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":dy(h),Hc(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}o.removeChild(h)}}function QF(o,c,h,g){for(;o.nodeType===1;){var j=h;if(o.nodeName.toLowerCase()!==c.toLowerCase()){if(!g&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(g){if(!o[ka])switch(c){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(N=o.getAttribute("rel"),N==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(N!==j.rel||o.getAttribute("href")!==(j.href==null||j.href===""?null:j.href)||o.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin)||o.getAttribute("title")!==(j.title==null?null:j.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(N=o.getAttribute("src"),(N!==(j.src==null?null:j.src)||o.getAttribute("type")!==(j.type==null?null:j.type)||o.getAttribute("crossorigin")!==(j.crossOrigin==null?null:j.crossOrigin))&&N&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(c==="input"&&o.type==="hidden"){var N=j.name==null?null:""+j.name;if(j.type==="hidden"&&o.getAttribute("name")===N)return o}else return o;if(o=hs(o.nextSibling),o===null)break}return null}function XF(o,c,h){if(c==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!h||(o=hs(o.nextSibling),o===null))return null;return o}function aA(o,c){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!c||(o=hs(o.nextSibling),o===null))return null;return o}function fy(o){return o.data==="$?"||o.data==="$~"}function hy(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function ZF(o,c){var h=o.ownerDocument;if(o.data==="$~")o._reactRetry=c;else if(o.data!=="$?"||h.readyState!=="loading")c();else{var g=function(){c(),h.removeEventListener("DOMContentLoaded",g)};h.addEventListener("DOMContentLoaded",g),o._reactRetry=g}}function hs(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"||c==="F!"||c==="F")break;if(c==="/$"||c==="/&")return null}}return o}var py=null;function oA(o){o=o.nextSibling;for(var c=0;o;){if(o.nodeType===8){var h=o.data;if(h==="/$"||h==="/&"){if(c===0)return hs(o.nextSibling);c--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||c++}o=o.nextSibling}return null}function lA(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var h=o.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(c===0)return o;c--}else h!=="/$"&&h!=="/&"||c++}o=o.previousSibling}return null}function cA(o,c,h){switch(c=Dh(h),o){case"html":if(o=c.documentElement,!o)throw Error(s(452));return o;case"head":if(o=c.head,!o)throw Error(s(453));return o;case"body":if(o=c.body,!o)throw Error(s(454));return o;default:throw Error(s(451))}}function _u(o){for(var c=o.attributes;c.length;)o.removeAttributeNode(c[0]);Hc(o)}var ps=new Map,uA=new Set;function qh(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Lr=F.d;F.d={f:JF,r:e7,D:t7,C:n7,L:s7,m:r7,X:a7,S:i7,M:o7};function JF(){var o=Lr.f(),c=Ah();return o||c}function e7(o){var c=ai(o);c!==null&&c.tag===5&&c.type==="form"?CE(c):Lr.r(o)}var jl=typeof document>"u"?null:document;function dA(o,c,h){var g=jl;if(g&&typeof c=="string"&&c){var j=In(c);j='link[rel="'+o+'"][href="'+j+'"]',typeof h=="string"&&(j+='[crossorigin="'+h+'"]'),uA.has(j)||(uA.add(j),o={rel:o,crossOrigin:h,href:c},g.querySelector(j)===null&&(c=g.createElement("link"),an(c,"link",o),qt(c),g.head.appendChild(c)))}}function t7(o){Lr.D(o),dA("dns-prefetch",o,null)}function n7(o,c){Lr.C(o,c),dA("preconnect",o,c)}function s7(o,c,h){Lr.L(o,c,h);var g=jl;if(g&&o&&c){var j='link[rel="preload"][as="'+In(c)+'"]';c==="image"&&h&&h.imageSrcSet?(j+='[imagesrcset="'+In(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(j+='[imagesizes="'+In(h.imageSizes)+'"]')):j+='[href="'+In(o)+'"]';var N=j;switch(c){case"style":N=Sl(o);break;case"script":N=Nl(o)}ps.has(N)||(o=m({rel:"preload",href:c==="image"&&h&&h.imageSrcSet?void 0:o,as:c},h),ps.set(N,o),g.querySelector(j)!==null||c==="style"&&g.querySelector(Cu(N))||c==="script"&&g.querySelector(Eu(N))||(c=g.createElement("link"),an(c,"link",o),qt(c),g.head.appendChild(c)))}}function r7(o,c){Lr.m(o,c);var h=jl;if(h&&o){var g=c&&typeof c.as=="string"?c.as:"script",j='link[rel="modulepreload"][as="'+In(g)+'"][href="'+In(o)+'"]',N=j;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=Nl(o)}if(!ps.has(N)&&(o=m({rel:"modulepreload",href:o},c),ps.set(N,o),h.querySelector(j)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Eu(N)))return}g=h.createElement("link"),an(g,"link",o),qt(g),h.head.appendChild(g)}}}function i7(o,c,h){Lr.S(o,c,h);var g=jl;if(g&&o){var j=li(g).hoistableStyles,N=Sl(o);c=c||"default";var I=j.get(N);if(!I){var q={loading:0,preload:null};if(I=g.querySelector(Cu(N)))q.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":c},h),(h=ps.get(N))&&my(o,h);var J=I=g.createElement("link");qt(J),an(J,"link",o),J._p=new Promise(function(ae,ue){J.onload=ae,J.onerror=ue}),J.addEventListener("load",function(){q.loading|=1}),J.addEventListener("error",function(){q.loading|=2}),q.loading|=4,zh(I,c,g)}I={type:"stylesheet",instance:I,count:1,state:q},j.set(N,I)}}}function a7(o,c){Lr.X(o,c);var h=jl;if(h&&o){var g=li(h).hoistableScripts,j=Nl(o),N=g.get(j);N||(N=h.querySelector(Eu(j)),N||(o=m({src:o,async:!0},c),(c=ps.get(j))&&gy(o,c),N=h.createElement("script"),qt(N),an(N,"link",o),h.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},g.set(j,N))}}function o7(o,c){Lr.M(o,c);var h=jl;if(h&&o){var g=li(h).hoistableScripts,j=Nl(o),N=g.get(j);N||(N=h.querySelector(Eu(j)),N||(o=m({src:o,async:!0,type:"module"},c),(c=ps.get(j))&&gy(o,c),N=h.createElement("script"),qt(N),an(N,"link",o),h.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},g.set(j,N))}}function fA(o,c,h,g){var j=(j=K.current)?qh(j):null;if(!j)throw Error(s(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(c=Sl(h.href),h=li(j).hoistableStyles,g=h.get(c),g||(g={type:"style",instance:null,count:0,state:null},h.set(c,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=Sl(h.href);var N=li(j).hoistableStyles,I=N.get(o);if(I||(j=j.ownerDocument||j,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(o,I),(N=j.querySelector(Cu(o)))&&!N._p&&(I.instance=N,I.state.loading=5),ps.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},ps.set(o,h),N||l7(j,o,h,I.state))),c&&g===null)throw Error(s(528,""));return I}if(c&&g!==null)throw Error(s(529,""));return null;case"script":return c=h.async,h=h.src,typeof h=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Nl(h),h=li(j).hoistableScripts,g=h.get(c),g||(g={type:"script",instance:null,count:0,state:null},h.set(c,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,o))}}function Sl(o){return'href="'+In(o)+'"'}function Cu(o){return'link[rel="stylesheet"]['+o+"]"}function hA(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function l7(o,c,h,g){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?g.loading=1:(c=o.createElement("link"),g.preload=c,c.addEventListener("load",function(){return g.loading|=1}),c.addEventListener("error",function(){return g.loading|=2}),an(c,"link",h),qt(c),o.head.appendChild(c))}function Nl(o){return'[src="'+In(o)+'"]'}function Eu(o){return"script[async]"+o}function pA(o,c,h){if(c.count++,c.instance===null)switch(c.type){case"style":var g=o.querySelector('style[data-href~="'+In(h.href)+'"]');if(g)return c.instance=g,qt(g),g;var j=m({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),qt(g),an(g,"style",j),zh(g,h.precedence,o),c.instance=g;case"stylesheet":j=Sl(h.href);var N=o.querySelector(Cu(j));if(N)return c.state.loading|=4,c.instance=N,qt(N),N;g=hA(h),(j=ps.get(j))&&my(g,j),N=(o.ownerDocument||o).createElement("link"),qt(N);var I=N;return I._p=new Promise(function(q,J){I.onload=q,I.onerror=J}),an(N,"link",g),c.state.loading|=4,zh(N,h.precedence,o),c.instance=N;case"script":return N=Nl(h.src),(j=o.querySelector(Eu(N)))?(c.instance=j,qt(j),j):(g=h,(j=ps.get(N))&&(g=m({},h),gy(g,j)),o=o.ownerDocument||o,j=o.createElement("script"),qt(j),an(j,"link",g),o.head.appendChild(j),c.instance=j);case"void":return null;default:throw Error(s(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(g=c.instance,c.state.loading|=4,zh(g,h.precedence,o));return c.instance}function zh(o,c,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),j=g.length?g[g.length-1]:null,N=j,I=0;I<g.length;I++){var q=g[I];if(q.dataset.precedence===c)N=q;else if(N!==j)break}N?N.parentNode.insertBefore(o,N.nextSibling):(c=h.nodeType===9?h.head:h,c.insertBefore(o,c.firstChild))}function my(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.title==null&&(o.title=c.title)}function gy(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.integrity==null&&(o.integrity=c.integrity)}var Bh=null;function mA(o,c,h){if(Bh===null){var g=new Map,j=Bh=new Map;j.set(h,g)}else j=Bh,g=j.get(h),g||(g=new Map,j.set(h,g));if(g.has(o))return g;for(g.set(o,null),h=h.getElementsByTagName(o),j=0;j<h.length;j++){var N=h[j];if(!(N[ka]||N[Wt]||o==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var I=N.getAttribute(c)||"";I=o+I;var q=g.get(I);q?q.push(N):g.set(I,[N])}}return g}function gA(o,c,h){o=o.ownerDocument||o,o.head.insertBefore(h,c==="title"?o.querySelector("head > title"):null)}function c7(o,c,h){if(h===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return o=c.disabled,typeof c.precedence=="string"&&o==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function xA(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function u7(o,c,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var j=Sl(g.href),N=c.querySelector(Cu(j));if(N){c=N._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(o.count++,o=Fh.bind(o),c.then(o,o)),h.state.loading|=4,h.instance=N,qt(N);return}N=c.ownerDocument||c,g=hA(g),(j=ps.get(j))&&my(g,j),N=N.createElement("link"),qt(N);var I=N;I._p=new Promise(function(q,J){I.onload=q,I.onerror=J}),an(N,"link",g),h.instance=N}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,c),(c=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=Fh.bind(o),c.addEventListener("load",h),c.addEventListener("error",h))}}var xy=0;function d7(o,c){return o.stylesheets&&o.count===0&&Uh(o,o.stylesheets),0<o.count||0<o.imgCount?function(h){var g=setTimeout(function(){if(o.stylesheets&&Uh(o,o.stylesheets),o.unsuspend){var N=o.unsuspend;o.unsuspend=null,N()}},6e4+c);0<o.imgBytes&&xy===0&&(xy=62500*VF());var j=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Uh(o,o.stylesheets),o.unsuspend)){var N=o.unsuspend;o.unsuspend=null,N()}},(o.imgBytes>xy?50:800)+c);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(j)}}:null}function Fh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Uh(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Hh=null;function Uh(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Hh=new Map,c.forEach(f7,o),Hh=null,Fh.call(o))}function f7(o,c){if(!(c.state.loading&4)){var h=Hh.get(o);if(h)var g=h.get(null);else{h=new Map,Hh.set(o,h);for(var j=o.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<j.length;N++){var I=j[N];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(h.set(I.dataset.precedence,I),g=I)}g&&h.set(null,g)}j=c.instance,I=j.getAttribute("data-precedence"),N=h.get(I)||g,N===g&&h.set(null,j),h.set(I,j),this.count++,g=Fh.bind(this),j.addEventListener("load",g),j.addEventListener("error",g),N?N.parentNode.insertBefore(j,N.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(j,o.firstChild)),c.state.loading|=4}}var Ru={$$typeof:k,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function h7(o,c,h,g,j,N,I,q,J){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.hiddenUpdates=zc(null),this.identifierPrefix=g,this.onUncaughtError=j,this.onCaughtError=N,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function yA(o,c,h,g,j,N,I,q,J,ae,ue,fe){return o=new h7(o,c,h,I,J,ae,ue,fe,q),c=1,N===!0&&(c|=24),N=Yn(3,null,null,c),o.current=N,N.stateNode=o,c=Qx(),c.refCount++,o.pooledCache=c,c.refCount++,N.memoizedState={element:g,isDehydrated:h,cache:c},e0(N),o}function vA(o){return o?(o=tl,o):tl}function bA(o,c,h,g,j,N){j=vA(j),g.context===null?g.context=j:g.pendingContext=j,g=xi(c),g.payload={element:h},N=N===void 0?null:N,N!==null&&(g.callback=N),h=yi(o,g,c),h!==null&&(Dn(h,o,c),ou(h,o,c))}function wA(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var h=o.retryLane;o.retryLane=h!==0&&h<c?h:c}}function yy(o,c){wA(o,c),(o=o.alternate)&&wA(o,c)}function jA(o){if(o.tag===13||o.tag===31){var c=Ta(o,67108864);c!==null&&Dn(c,o,67108864),yy(o,67108864)}}function SA(o){if(o.tag===13||o.tag===31){var c=es();c=Bc(c);var h=Ta(o,c);h!==null&&Dn(h,o,c),yy(o,c)}}var Vh=!0;function p7(o,c,h,g){var j=$.T;$.T=null;var N=F.p;try{F.p=2,vy(o,c,h,g)}finally{F.p=N,$.T=j}}function m7(o,c,h,g){var j=$.T;$.T=null;var N=F.p;try{F.p=8,vy(o,c,h,g)}finally{F.p=N,$.T=j}}function vy(o,c,h,g){if(Vh){var j=by(g);if(j===null)iy(o,c,g,Gh,h),kA(o,g);else if(x7(j,o,c,h,g))g.stopPropagation();else if(kA(o,g),c&4&&-1<g7.indexOf(o)){for(;j!==null;){var N=ai(j);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var I=mr(N.pendingLanes);if(I!==0){var q=N;for(q.pendingLanes|=2,q.entangledLanes|=2;I;){var J=1<<31-Sn(I);q.entanglements[1]|=J,I&=~J}Zs(N),(rt&6)===0&&(Eh=Oe()+500,Su(0))}}break;case 31:case 13:q=Ta(N,2),q!==null&&Dn(q,N,2),Ah(),yy(N,2)}if(N=by(g),N===null&&iy(o,c,g,Gh,h),N===j)break;j=N}j!==null&&g.stopPropagation()}else iy(o,c,g,null,h)}}function by(o){return o=jx(o),wy(o)}var Gh=null;function wy(o){if(Gh=null,o=ii(o),o!==null){var c=a(o);if(c===null)o=null;else{var h=c.tag;if(h===13){if(o=l(c),o!==null)return o;o=null}else if(h===31){if(o=u(c),o!==null)return o;o=null}else if(h===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null)}}return Gh=o,null}function NA(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(mt()){case Kt:return 2;case Kn:return 8;case An:case qo:return 32;case pr:return 268435456;default:return 32}default:return 32}}var jy=!1,Ri=null,Ai=null,Ti=null,Au=new Map,Tu=new Map,Ii=[],g7="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function kA(o,c){switch(o){case"focusin":case"focusout":Ri=null;break;case"dragenter":case"dragleave":Ai=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":Au.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tu.delete(c.pointerId)}}function Iu(o,c,h,g,j,N){return o===null||o.nativeEvent!==N?(o={blockedOn:c,domEventName:h,eventSystemFlags:g,nativeEvent:N,targetContainers:[j]},c!==null&&(c=ai(c),c!==null&&jA(c)),o):(o.eventSystemFlags|=g,c=o.targetContainers,j!==null&&c.indexOf(j)===-1&&c.push(j),o)}function x7(o,c,h,g,j){switch(c){case"focusin":return Ri=Iu(Ri,o,c,h,g,j),!0;case"dragenter":return Ai=Iu(Ai,o,c,h,g,j),!0;case"mouseover":return Ti=Iu(Ti,o,c,h,g,j),!0;case"pointerover":var N=j.pointerId;return Au.set(N,Iu(Au.get(N)||null,o,c,h,g,j)),!0;case"gotpointercapture":return N=j.pointerId,Tu.set(N,Iu(Tu.get(N)||null,o,c,h,g,j)),!0}return!1}function _A(o){var c=ii(o.target);if(c!==null){var h=a(c);if(h!==null){if(c=h.tag,c===13){if(c=l(h),c!==null){o.blockedOn=c,Of(o.priority,function(){SA(h)});return}}else if(c===31){if(c=u(h),c!==null){o.blockedOn=c,Of(o.priority,function(){SA(h)});return}}else if(c===3&&h.stateNode.current.memoizedState.isDehydrated){o.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Kh(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var h=by(o.nativeEvent);if(h===null){h=o.nativeEvent;var g=new h.constructor(h.type,h);wx=g,h.target.dispatchEvent(g),wx=null}else return c=ai(h),c!==null&&jA(c),o.blockedOn=h,!1;c.shift()}return!0}function CA(o,c,h){Kh(o)&&h.delete(c)}function y7(){jy=!1,Ri!==null&&Kh(Ri)&&(Ri=null),Ai!==null&&Kh(Ai)&&(Ai=null),Ti!==null&&Kh(Ti)&&(Ti=null),Au.forEach(CA),Tu.forEach(CA)}function Wh(o,c){o.blockedOn===c&&(o.blockedOn=null,jy||(jy=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,y7)))}var Yh=null;function EA(o){Yh!==o&&(Yh=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Yh===o&&(Yh=null);for(var c=0;c<o.length;c+=3){var h=o[c],g=o[c+1],j=o[c+2];if(typeof g!="function"){if(wy(g||h)===null)continue;break}var N=ai(h);N!==null&&(o.splice(c,3),c-=3,b0(N,{pending:!0,data:j,method:h.method,action:g},g,j))}}))}function kl(o){function c(J){return Wh(J,o)}Ri!==null&&Wh(Ri,o),Ai!==null&&Wh(Ai,o),Ti!==null&&Wh(Ti,o),Au.forEach(c),Tu.forEach(c);for(var h=0;h<Ii.length;h++){var g=Ii[h];g.blockedOn===o&&(g.blockedOn=null)}for(;0<Ii.length&&(h=Ii[0],h.blockedOn===null);)_A(h),h.blockedOn===null&&Ii.shift();if(h=(o.ownerDocument||o).$$reactFormReplay,h!=null)for(g=0;g<h.length;g+=3){var j=h[g],N=h[g+1],I=j[hn]||null;if(typeof N=="function")I||EA(h);else if(I){var q=null;if(N&&N.hasAttribute("formAction")){if(j=N,I=N[hn]||null)q=I.formAction;else if(wy(j)!==null)continue}else q=I.action;typeof q=="function"?h[g+1]=q:(h.splice(g,3),g-=3),EA(h)}}}function RA(){function o(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(I){return j=I})},focusReset:"manual",scroll:"manual"})}function c(){j!==null&&(j(),j=null),g||setTimeout(h,20)}function h(){if(!g&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,j=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(h,100),function(){g=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),j!==null&&(j(),j=null)}}}function Sy(o){this._internalRoot=o}Qh.prototype.render=Sy.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(s(409));var h=c.current,g=es();bA(h,g,o,c,null,null)},Qh.prototype.unmount=Sy.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;bA(o.current,2,null,o,null,null),Ah(),c[gr]=null}};function Qh(o){this._internalRoot=o}Qh.prototype.unstable_scheduleHydration=function(o){if(o){var c=Mf();o={blockedOn:null,target:o,priority:c};for(var h=0;h<Ii.length&&c!==0&&c<Ii[h].priority;h++);Ii.splice(h,0,o),h===0&&_A(o)}};var AA=t.version;if(AA!=="19.2.4")throw Error(s(527,AA,"19.2.4"));F.findDOMNode=function(o){var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(s(188)):(o=Object.keys(o).join(","),Error(s(268,o)));return o=f(c),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var v7={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xh.isDisabled&&Xh.supportsFiber)try{fn=Xh.inject(v7),_t=Xh}catch{}}return Ou.createRoot=function(o,c){if(!r(o))throw Error(s(299));var h=!1,g="",j=$E,N=DE,I=qE;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(j=c.onUncaughtError),c.onCaughtError!==void 0&&(N=c.onCaughtError),c.onRecoverableError!==void 0&&(I=c.onRecoverableError)),c=yA(o,1,!1,null,null,h,g,null,j,N,I,RA),o[gr]=c.current,ry(o),new Sy(c)},Ou.hydrateRoot=function(o,c,h){if(!r(o))throw Error(s(299));var g=!1,j="",N=$E,I=DE,q=qE,J=null;return h!=null&&(h.unstable_strictMode===!0&&(g=!0),h.identifierPrefix!==void 0&&(j=h.identifierPrefix),h.onUncaughtError!==void 0&&(N=h.onUncaughtError),h.onCaughtError!==void 0&&(I=h.onCaughtError),h.onRecoverableError!==void 0&&(q=h.onRecoverableError),h.formState!==void 0&&(J=h.formState)),c=yA(o,1,!0,c,h??null,g,j,J,N,I,q,RA),c.context=vA(null),h=c.current,g=es(),g=Bc(g),j=xi(g),j.callback=null,yi(h,j,g),h=g,c.current.lanes=h,Na(c,h),Zs(c),o[gr]=c.current,ry(o),new Qh(c)},Ou.version="19.2.4",Ou}var BA;function T7(){if(BA)return Cy.exports;BA=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Cy.exports=A7(),Cy.exports}var I7=T7(),ed=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Ty(e){const t=C.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function M7(e,t,n={},s={}){C.useEffect(()=>{if(!e.current||s.disabled||typeof IntersectionObserver!="function")return;const r=new IntersectionObserver(([a])=>{t(a)},n);return r.observe(e.current),()=>{r.disconnect()}},[t,n,s.disabled,e])}function O7(e){const t=C.useRef(null);return C.useImperativeHandle(e,()=>t.current,[]),t}var L7=!1;function vd(e){return e[e.length-1]}function P7(e){return typeof e=="function"}function na(e,t){return P7(e)?e(t):e}var $7=Object.prototype.hasOwnProperty,FA=Object.prototype.propertyIsEnumerable,D7=()=>Object.create(null),Ua=(e,t)=>sa(e,t,D7);function sa(e,t,n=()=>({}),s=0){if(e===t)return e;if(s>500)return t;const r=t,a=VA(e)&&VA(r);if(!a&&!(um(e)&&um(r)))return r;const l=a?e:HA(e);if(!l)return r;const u=a?r:HA(r);if(!u)return r;const d=l.length,f=u.length,p=a?new Array(f):n();let m=0;for(let x=0;x<f;x++){const y=a?x:u[x],v=e[y],b=r[y];if(v===b){p[y]=v,(a?x<d:$7.call(e,y))&&m++;continue}if(v===null||b===null||typeof v!="object"||typeof b!="object"){p[y]=b;continue}const w=sa(v,b,n,s+1);p[y]=w,w===v&&m++}return d===f&&m===d?e:p}function HA(e){const t=Object.getOwnPropertyNames(e);for(const r of t)if(!FA.call(e,r))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const s=t;for(const r of n){if(!FA.call(e,r))return!1;s.push(r)}return s}function um(e){if(!UA(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!UA(n)||!n.hasOwnProperty("isPrototypeOf"))}function UA(e){return Object.prototype.toString.call(e)==="[object Object]"}function VA(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function mo(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,r=e.length;s<r;s++)if(!mo(e[s],t[s],n))return!1;return!0}if(um(e)&&um(t)){const s=(n==null?void 0:n.ignoreUndefined)??!0;if(n!=null&&n.partial){for(const l in t)if((!s||t[l]!==void 0)&&!mo(e[l],t[l],n))return!1;return!0}let r=0;if(!s)r=Object.keys(e).length;else for(const l in e)e[l]!==void 0&&r++;let a=0;for(const l in t)if((!s||t[l]!==void 0)&&(a++,a>r||!mo(e[l],t[l],n)))return!1;return r===a}return!1}function xc(e){let t,n;const s=new Promise((r,a)=>{t=r,n=a});return s.status="pending",s.resolve=r=>{s.status="resolved",s.value=r,t(r),e==null||e(r)},s.reject=r=>{s.status="rejected",n(r)},s}function bd(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function q7(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function GA(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return q7(t)}var z7=["http:","https:","mailto:","tel:"];function dm(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Lu(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,s="",r;for(;(r=t.exec(e))!==null;)s+=GA(e.slice(n,r.index))+r[0],n=t.lastIndex;s=s+GA(n?e.slice(n):e);let a=!1;return s.startsWith("//")&&(a=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:a}}function B7(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function F7(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Wr(){throw new Error("Invariant failed")}function wd(e){const t=new Map;let n,s;const r=a=>{a.next&&(a.prev?(a.prev.next=a.next,a.next.prev=a.prev,a.next=void 0,s&&(s.next=a,a.prev=s)):(a.next.prev=void 0,n=a.next,a.next=void 0,s&&(a.prev=s,s.next=a)),s=a)};return{get(a){const l=t.get(a);if(l)return r(l),l.value},set(a,l){if(t.size>=e&&n){const d=n;t.delete(d.key),d.next&&(n=d.next,d.next.prev=void 0),d===s&&(s=void 0)}const u=t.get(a);if(u)u.value=l,r(u);else{const d={key:a,value:l,prev:s};s&&(s.next=d),s=d,n||(n=d),t.set(a,d)}},clear(){t.clear(),n=void 0,s=void 0}}}var Qa=4,e$=5;function H7(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function m2(e,t,n=new Uint16Array(6)){const s=e.indexOf("/",t),r=s===-1?e.length:s,a=e.substring(t,r);if(!a||!a.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n;if(a==="$"){const u=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=u,n[4]=u,n[5]=u,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=r,n[4]=r,n[5]=r,n;const l=H7(a);if(l){const[u,d]=l,f=a.charCodeAt(u+1);if(f===45){if(u+2<a.length&&a.charCodeAt(u+2)===36){const p=u+3,m=d;if(p<m)return n[0]=3,n[1]=t+u,n[2]=t+p,n[3]=t+m,n[4]=t+d+1,n[5]=r,n}}else if(f===36){const p=u+1,m=u+2;return m===d?(n[0]=2,n[1]=t+u,n[2]=t+p,n[3]=t+m,n[4]=t+d+1,n[5]=e.length,n):(n[0]=1,n[1]=t+u,n[2]=t+m,n[3]=t+d,n[4]=t+d+1,n[5]=r,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}function Um(e,t,n,s,r,a,l){var d,f,p,m,x,y,v,b,w,S,E,k,_;l==null||l(n);let u=s;{const R=n.fullPath??n.from,T=R.length,A=((d=n.options)==null?void 0:d.caseSensitive)??e,M=!!((p=(f=n.options)==null?void 0:f.params)!=null&&p.parse&&((x=(m=n.options)==null?void 0:m.skipRouteOnParseError)!=null&&x.params));for(;u<T;){const P=m2(R,u,t);let O;const B=u,H=P[5];switch(u=H+1,a++,P[0]){case 0:{const z=R.substring(P[2],P[3]);if(A){const W=(y=r.static)==null?void 0:y.get(z);if(W)O=W;else{r.static??(r.static=new Map);const $=Xa(n.fullPath??n.from);$.parent=r,$.depth=a,O=$,r.static.set(z,$)}}else{const W=z.toLowerCase(),$=(v=r.staticInsensitive)==null?void 0:v.get(W);if($)O=$;else{r.staticInsensitive??(r.staticInsensitive=new Map);const F=Xa(n.fullPath??n.from);F.parent=r,F.depth=a,O=F,r.staticInsensitive.set(W,F)}}break}case 1:{const z=R.substring(B,P[1]),W=R.substring(P[4],H),$=A&&!!(z||W),F=z?$?z:z.toLowerCase():void 0,G=W?$?W:W.toLowerCase():void 0,X=!M&&((b=r.dynamic)==null?void 0:b.find(Z=>!Z.skipOnParamError&&Z.caseSensitive===$&&Z.prefix===F&&Z.suffix===G));if(X)O=X;else{const Z=My(1,n.fullPath??n.from,$,F,G);O=Z,Z.depth=a,Z.parent=r,r.dynamic??(r.dynamic=[]),r.dynamic.push(Z)}break}case 3:{const z=R.substring(B,P[1]),W=R.substring(P[4],H),$=A&&!!(z||W),F=z?$?z:z.toLowerCase():void 0,G=W?$?W:W.toLowerCase():void 0,X=!M&&((w=r.optional)==null?void 0:w.find(Z=>!Z.skipOnParamError&&Z.caseSensitive===$&&Z.prefix===F&&Z.suffix===G));if(X)O=X;else{const Z=My(3,n.fullPath??n.from,$,F,G);O=Z,Z.parent=r,Z.depth=a,r.optional??(r.optional=[]),r.optional.push(Z)}break}case 2:{const z=R.substring(B,P[1]),W=R.substring(P[4],H),$=A&&!!(z||W),F=z?$?z:z.toLowerCase():void 0,G=W?$?W:W.toLowerCase():void 0,X=My(2,n.fullPath??n.from,$,F,G);O=X,X.parent=r,X.depth=a,r.wildcard??(r.wildcard=[]),r.wildcard.push(X)}}r=O}if(M&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const P=Xa(n.fullPath??n.from);P.kind=e$,P.parent=r,a++,P.depth=a,r.pathless??(r.pathless=[]),r.pathless.push(P),r=P}const L=(n.path||!n.children)&&!n.isRoot;if(L&&R.endsWith("/")){const P=Xa(n.fullPath??n.from);P.kind=Qa,P.parent=r,a++,P.depth=a,r.index=P,r=P}r.parse=((E=(S=n.options)==null?void 0:S.params)==null?void 0:E.parse)??null,r.skipOnParamError=M,r.parsingPriority=((_=(k=n.options)==null?void 0:k.skipRouteOnParseError)==null?void 0:_.priority)??0,L&&!r.route&&(r.route=n,r.fullPath=n.fullPath??n.from)}if(n.children)for(const R of n.children)Um(e,t,R,u,r,a,l)}function Iy(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Hi(e){var t,n,s;if(e.pathless)for(const r of e.pathless)Hi(r);if(e.static)for(const r of e.static.values())Hi(r);if(e.staticInsensitive)for(const r of e.staticInsensitive.values())Hi(r);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(Iy);for(const r of e.dynamic)Hi(r)}if((n=e.optional)!=null&&n.length){e.optional.sort(Iy);for(const r of e.optional)Hi(r)}if((s=e.wildcard)!=null&&s.length){e.wildcard.sort(Iy);for(const r of e.wildcard)Hi(r)}}function Xa(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function My(e,t,n,s,r){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:s,suffix:r}}function U7(e,t){const n=Xa("/"),s=new Uint16Array(6);for(const r of e)Um(!1,s,r,1,n,0);Hi(n),t.masksTree=n,t.flatCache=wd(1e3)}function V7(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const s=g2(e,t.masksTree);return t.flatCache.set(e,s),s}function G7(e,t,n,s,r){e||(e="/"),s||(s="/");const a=t?`case\0${e}`:e;let l=r.singleCache.get(a);return l||(l=Xa("/"),Um(t,new Uint16Array(6),{from:e},1,l,0),r.singleCache.set(a,l)),g2(s,l,n)}function K7(e,t,n=!1){const s=n?e:`nofuzz\0${e}`,r=t.matchCache.get(s);if(r!==void 0)return r;e||(e="/");let a;try{a=g2(e,t.segmentTree,n)}catch(l){if(l instanceof URIError)a=null;else throw l}return a&&(a.branch=Q7(a.route)),t.matchCache.set(s,a),a}function W7(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Y7(e,t=!1,n){const s=Xa(e.fullPath),r=new Uint16Array(6),a={},l={};let u=0;return Um(t,r,e,1,s,0,d=>{if(n==null||n(d,u),d.id in a&&Wr(),a[d.id]=d,u!==0&&d.path){const f=W7(d.fullPath);(!l[f]||d.fullPath.endsWith("/"))&&(l[f]=d)}u++}),Hi(s),{processedTree:{segmentTree:s,singleCache:wd(1e3),matchCache:wd(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:l}}function g2(e,t,n=!1){const s=e.split("/"),r=Z7(e,s,t,n);if(!r)return null;const[a]=t$(e,s,r);return{route:r.node.route,rawParams:a,parsedParams:r.parsedParams}}function t$(e,t,n){var p,m,x,y,v,b,w,S,E,k;const s=X7(n.node);let r=null;const a=Object.create(null);let l=((p=n.extract)==null?void 0:p.part)??0,u=((m=n.extract)==null?void 0:m.node)??0,d=((x=n.extract)==null?void 0:x.path)??0,f=((y=n.extract)==null?void 0:y.segment)??0;for(;u<s.length;l++,u++,d++,f++){const _=s[u];if(_.kind===Qa)break;if(_.kind===e$){f--,l--,d--;continue}const R=t[l],T=d;if(R&&(d+=R.length),_.kind===1){r??(r=n.node.fullPath.split("/"));const A=r[f],M=((v=_.prefix)==null?void 0:v.length)??0;if(A.charCodeAt(M)===123){const L=((b=_.suffix)==null?void 0:b.length)??0,P=A.substring(M+2,A.length-L-1),O=R.substring(M,R.length-L);a[P]=decodeURIComponent(O)}else{const L=A.substring(1);a[L]=decodeURIComponent(R)}}else if(_.kind===3){if(n.skipped&1<<u){l--,d=T-1;continue}r??(r=n.node.fullPath.split("/"));const A=r[f],M=((w=_.prefix)==null?void 0:w.length)??0,L=((S=_.suffix)==null?void 0:S.length)??0,P=A.substring(M+3,A.length-L-1),O=_.suffix||_.prefix?R.substring(M,R.length-L):R;O&&(a[P]=decodeURIComponent(O))}else if(_.kind===2){const A=_,M=e.substring(T+(((E=A.prefix)==null?void 0:E.length)??0),e.length-(((k=A.suffix)==null?void 0:k.length)??0)),L=decodeURIComponent(M);a["*"]=L,a._splat=L;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:l,node:u,path:d,segment:f}]}function Q7(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function X7(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Z7(e,t,n,s){if(e==="/"&&n.index)return{node:n.index,skipped:0};const r=!vd(t),a=r&&e!=="/",l=t.length-(r?1:0),u=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let d=null,f=null,p=null;for(;u.length;){const m=u.pop(),{node:x,index:y,skipped:v,depth:b,statics:w,dynamics:S,optionals:E}=m;let{extract:k,rawParams:_,parsedParams:R}=m;if(x.skipOnParamError){if(!Oy(e,t,m))continue;_=m.rawParams,k=m.extract,R=m.parsedParams}s&&x.route&&x.kind!==Qa&&Pu(f,m)&&(f=m);const T=y===l;if(T&&(x.route&&!a&&Pu(p,m)&&(p=m),!x.optional&&!x.wildcard&&!x.index&&!x.pathless))continue;const A=T?void 0:t[y];let M;if(T&&x.index){const L={node:x.index,index:y,skipped:v,depth:b+1,statics:w,dynamics:S,optionals:E,extract:k,rawParams:_,parsedParams:R};let P=!0;if(x.index.skipOnParamError&&(Oy(e,t,L)||(P=!1)),P){if(w===l&&!S&&!E&&!v)return L;Pu(p,L)&&(p=L)}}if(x.wildcard&&Pu(d,m))for(const L of x.wildcard){const{prefix:P,suffix:O}=L;if(P&&(T||!(L.caseSensitive?A:M??(M=A.toLowerCase())).startsWith(P)))continue;if(O){if(T)continue;const H=t.slice(y).join("/").slice(-O.length);if((L.caseSensitive?H:H.toLowerCase())!==O)continue}const B={node:L,index:l,skipped:v,depth:b,statics:w,dynamics:S,optionals:E,extract:k,rawParams:_,parsedParams:R};if(!(L.skipOnParamError&&!Oy(e,t,B))){d=B;break}}if(x.optional){const L=v|1<<b,P=b+1;for(let O=x.optional.length-1;O>=0;O--){const B=x.optional[O];u.push({node:B,index:y,skipped:L,depth:P,statics:w,dynamics:S,optionals:E,extract:k,rawParams:_,parsedParams:R})}if(!T)for(let O=x.optional.length-1;O>=0;O--){const B=x.optional[O],{prefix:H,suffix:z}=B;if(H||z){const W=B.caseSensitive?A:M??(M=A.toLowerCase());if(H&&!W.startsWith(H)||z&&!W.endsWith(z))continue}u.push({node:B,index:y+1,skipped:v,depth:P,statics:w,dynamics:S,optionals:E+1,extract:k,rawParams:_,parsedParams:R})}}if(!T&&x.dynamic&&A)for(let L=x.dynamic.length-1;L>=0;L--){const P=x.dynamic[L],{prefix:O,suffix:B}=P;if(O||B){const H=P.caseSensitive?A:M??(M=A.toLowerCase());if(O&&!H.startsWith(O)||B&&!H.endsWith(B))continue}u.push({node:P,index:y+1,skipped:v,depth:b+1,statics:w,dynamics:S+1,optionals:E,extract:k,rawParams:_,parsedParams:R})}if(!T&&x.staticInsensitive){const L=x.staticInsensitive.get(M??(M=A.toLowerCase()));L&&u.push({node:L,index:y+1,skipped:v,depth:b+1,statics:w+1,dynamics:S,optionals:E,extract:k,rawParams:_,parsedParams:R})}if(!T&&x.static){const L=x.static.get(A);L&&u.push({node:L,index:y+1,skipped:v,depth:b+1,statics:w+1,dynamics:S,optionals:E,extract:k,rawParams:_,parsedParams:R})}if(x.pathless){const L=b+1;for(let P=x.pathless.length-1;P>=0;P--){const O=x.pathless[P];u.push({node:O,index:y,skipped:v,depth:L,statics:w,dynamics:S,optionals:E,extract:k,rawParams:_,parsedParams:R})}}}if(p&&d)return Pu(d,p)?p:d;if(p)return p;if(d)return d;if(s&&f){let m=f.index;for(let y=0;y<f.index;y++)m+=t[y].length;const x=m===e.length?"/":e.slice(m);return f.rawParams??(f.rawParams=Object.create(null)),f.rawParams["**"]=decodeURIComponent(x),f}return null}function Oy(e,t,n){try{const[s,r]=t$(e,t,n);n.rawParams=s,n.extract=r;const a=n.node.parse(s);return n.parsedParams=Object.assign(Object.create(null),n.parsedParams,a),!0}catch{return null}}function Pu(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Qa)>(e.node.kind===Qa)||t.node.kind===Qa==(e.node.kind===Qa)&&t.depth>e.depth))):!0}function Vp(e){return x2(e.filter(t=>t!==void 0).join("/"))}function x2(e){return e.replace(/\/{2,}/g,"/")}function n$(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function aa(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function s$(e){return aa(n$(e))}function fm(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function J7(e,t,n){return fm(e,n)===fm(t,n)}function eH({base:e,to:t,trailingSlash:n="never",cache:s}){const r=t.startsWith("/"),a=!r&&t===".";let l;if(s){l=r?t:a?e:e+"\0"+t;const m=s.get(l);if(m)return m}let u;if(a)u=e.split("/");else if(r)u=t.split("/");else{for(u=e.split("/");u.length>1&&vd(u)==="";)u.pop();const m=t.split("/");for(let x=0,y=m.length;x<y;x++){const v=m[x];v===""?x?x===y-1&&u.push(v):u=[v]:v===".."?u.pop():v==="."||u.push(v)}}u.length>1&&(vd(u)===""?n==="never"&&u.pop():n==="always"&&u.push(""));let d,f="";for(let m=0;m<u.length;m++){m>0&&(f+="/");const x=u[m];if(!x)continue;d=m2(x,0,d);const y=d[0];if(y===0){f+=x;continue}const v=d[5],b=x.substring(0,d[1]),w=x.substring(d[4],v),S=x.substring(d[2],d[3]);y===1?f+=b||w?`${b}{$${S}}${w}`:`$${S}`:y===2?f+=b||w?`${b}{$}${w}`:"$":f+=`${b}{-$${S}}${w}`}f=x2(f);const p=f||"/";return l&&s&&s.set(l,p),p}function tH(e){const t=new Map(e.map(r=>[encodeURIComponent(r),r])),n=Array.from(t.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(n,"g");return r=>r.replace(s,a=>t.get(a)??a)}function Ly(e,t,n){const s=t[e];return typeof s!="string"?s:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(r=>WA(r,n)).join("/"):WA(s,n)}function KA({path:e,params:t,decoder:n,...s}){let r=!1;const a=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:a,isMissingParams:r};if(!e.includes("$"))return{interpolatedPath:e,usedParams:a,isMissingParams:r};const l=e.length;let u=0,d,f="";for(;u<l;){const p=u;d=m2(e,p,d);const m=d[5];if(u=m+1,p===m)continue;const x=d[0];if(x===0){f+="/"+e.substring(p,m);continue}if(x===2){const y=t._splat;a._splat=y,a["*"]=y;const v=e.substring(p,d[1]),b=e.substring(d[4],m);if(!y){r=!0,(v||b)&&(f+="/"+v+b);continue}const w=Ly("_splat",t,n);f+="/"+v+w+b;continue}if(x===1){const y=e.substring(d[2],d[3]);!r&&!(y in t)&&(r=!0),a[y]=t[y];const v=e.substring(p,d[1]),b=e.substring(d[4],m),w=Ly(y,t,n)??"undefined";f+="/"+v+w+b;continue}if(x===3){const y=e.substring(d[2],d[3]),v=t[y];if(v==null)continue;a[y]=v;const b=e.substring(p,d[1]),w=e.substring(d[4],m),S=Ly(y,t,n)??"";f+="/"+b+S+w;continue}}return e.endsWith("/")&&(f+="/"),{usedParams:a,interpolatedPath:f||"/",isMissingParams:r}}function WA(e,t){const n=encodeURIComponent(e);return(t==null?void 0:t(n))??n}function Cn(e){return!!(e!=null&&e.isNotFound)}function nH(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var tN="tsr-scroll-restoration-v1_3",sH=(e,t)=>{let n;return(...s)=>{n||(n=setTimeout(()=>{e(...s),n=null},t))}};function rH(){const e=nH();if(!e)return null;const t=e.getItem(tN);let n=t?JSON.parse(t):{};return{state:n,set:s=>{n=na(s,n)||n;try{e.setItem(tN,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var ep=rH(),iH=e=>e.state.__TSR_key||e.href;function aH(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}var hm=!1;function oH({storageKey:e,key:t,behavior:n,shouldScrollRestoration:s,scrollToTopSelectors:r,location:a}){var f,p;let l;try{l=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(m){console.error(m);return}const u=t||((f=window.history.state)==null?void 0:f.__TSR_key),d=l[u];hm=!0;e:{if(s&&d&&Object.keys(d).length>0){for(const y in d){const v=d[y];if(y==="window")window.scrollTo({top:v.scrollY,left:v.scrollX,behavior:n});else if(y){const b=document.querySelector(y);b&&(b.scrollLeft=v.scrollX,b.scrollTop=v.scrollY)}}break e}const m=(a??window.location).hash.split("#",2)[1];if(m){const y=((p=window.history.state)==null?void 0:p.__hashScrollIntoViewOptions)??!0;if(y){const v=document.getElementById(m);v&&v.scrollIntoView(y)}break e}const x={top:0,left:0,behavior:n};if(window.scrollTo(x),r)for(const y of r){if(y==="window")continue;const v=typeof y=="function"?y():document.querySelector(y);v&&v.scrollTo(x)}}hm=!1}function lH(e,t){if(!ep||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!ep))return;e.isScrollRestorationSetup=!0,hm=!1;const n=e.options.getScrollRestorationKey||iH;window.history.scrollRestoration="manual";const s=r=>{if(hm||!e.isScrollRestoring)return;let a="";if(r.target===document||r.target===window)a="window";else{const u=r.target.getAttribute("data-scroll-restoration-id");u?a=`[data-scroll-restoration-id="${u}"]`:a=aH(r.target)}const l=n(e.stores.location.state);ep.set(u=>{const d=u[l]||(u[l]={}),f=d[a]||(d[a]={});if(a==="window")f.scrollX=window.scrollX||0,f.scrollY=window.scrollY||0;else if(a){const p=document.querySelector(a);p&&(f.scrollX=p.scrollLeft||0,f.scrollY=p.scrollTop||0)}return u})};typeof document<"u"&&document.addEventListener("scroll",sH(s,100),!0),e.subscribe("onRendered",r=>{const a=n(r.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(oH({storageKey:tN,key:a,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&ep.set(l=>(l[a]||(l[a]={}),l)))})}function cH(e){if(typeof document<"u"&&document.querySelector){const t=e.stores.location.state,n=t.state.__hashScrollIntoViewOptions??!0;if(n&&t.hash!==""){const s=document.getElementById(t.hash);s&&s.scrollIntoView(n)}}}function uH(e,t=String){const n=new URLSearchParams;for(const s in e){const r=e[s];r!==void 0&&n.set(s,t(r))}return n.toString()}function Py(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function dH(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[s,r]of t.entries()){const a=n[s];a==null?n[s]=Py(r):Array.isArray(a)?a.push(Py(r)):n[s]=[a,Py(r)]}return n}var fH=pH(JSON.parse),hH=mH(JSON.stringify,JSON.parse);function pH(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=dH(t);for(const s in n){const r=n[s];if(typeof r=="string")try{n[s]=e(r)}catch{}}return n}}function mH(e,t){const n=typeof t=="function";function s(r){if(typeof r=="object"&&r!==null)try{return e(r)}catch{}else if(n&&typeof r=="string")try{return t(r),e(r)}catch{}return r}return r=>{const a=uH(r,s);return a?`?${a}`:""}}var go="__root__";function gH(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Bn(e){return e instanceof Response&&!!e.options}function xH(e){return{input:({url:t})=>{for(const n of e)t=nN(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=r$(e[n],t);return t}}}function yH(e){const t=s$(e.basepath),n=`/${t}`,s=`${n}/`,r=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?s:s.toLowerCase();return{input:({url:l})=>{const u=e.caseSensitive?l.pathname:l.pathname.toLowerCase();return u===r?l.pathname="/":u.startsWith(a)&&(l.pathname=l.pathname.slice(n.length)),l},output:({url:l})=>(l.pathname=Vp(["/",t,l.pathname]),l)}}function nN(e,t){var s;const n=(s=e==null?void 0:e.input)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function r$(e,t){var s;const n=(s=e==null?void 0:e.output)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function vH(e,t){const{createMutableStore:n,createReadonlyStore:s,batch:r,init:a}=t,l=new Map,u=new Map,d=new Map,f=n(e.status),p=n(e.loadedAt),m=n(e.isLoading),x=n(e.isTransitioning),y=n(e.location),v=n(e.resolvedLocation),b=n(e.statusCode),w=n(e.redirect),S=n([]),E=n([]),k=n([]),_=s(()=>$y(l,S.state)),R=s(()=>$y(u,E.state)),T=s(()=>$y(d,k.state)),A=s(()=>S.state[0]),M=s(()=>S.state.some(F=>{var G;return((G=l.get(F))==null?void 0:G.state.status)==="pending"})),L=s(()=>{var F;return{locationHref:y.state.href,resolvedLocationHref:(F=v.state)==null?void 0:F.href,status:f.state}}),P=s(()=>({status:f.state,loadedAt:p.state,isLoading:m.state,isTransitioning:x.state,matches:_.state,location:y.state,resolvedLocation:v.state,statusCode:b.state,redirect:w.state})),O=wd(64);function B(F){let G=O.get(F);return G||(G=s(()=>{const X=S.state;for(const Z of X){const D=l.get(Z);if(D&&D.routeId===F)return D.state}}),O.set(F,G)),G}const H={status:f,loadedAt:p,isLoading:m,isTransitioning:x,location:y,resolvedLocation:v,statusCode:b,redirect:w,matchesId:S,pendingMatchesId:E,cachedMatchesId:k,activeMatchesSnapshot:_,pendingMatchesSnapshot:R,cachedMatchesSnapshot:T,firstMatchId:A,hasPendingMatches:M,matchRouteReactivity:L,activeMatchStoresById:l,pendingMatchStoresById:u,cachedMatchStoresById:d,__store:P,getMatchStoreByRouteId:B,setActiveMatches:z,setPendingMatches:W,setCachedMatches:$};z(e.matches),a==null||a(H);function z(F){Dy(F,l,S,n,r)}function W(F){Dy(F,u,E,n,r)}function $(F){Dy(F,d,k,n,r)}return H}function $y(e,t){const n=[];for(const s of t){const r=e.get(s);r&&n.push(r.state)}return n}function Dy(e,t,n,s,r){const a=e.map(u=>u.id),l=new Set(a);r(()=>{for(const u of t.keys())l.has(u)||t.delete(u);for(const u of e){const d=t.get(u.id);if(!d){const f=s(u);f.routeId=u.routeId,t.set(u.id,f);continue}d.routeId=u.routeId,d.state!==u&&d.setState(()=>u)}F7(n.state,a)||n.setState(()=>a)})}var sN=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},bH=e=>e.stores.matchesId.state.some(t=>{var n;return(n=e.stores.activeMatchStoresById.get(t))==null?void 0:n.state._forcePending}),Vm=(e,t)=>!!(e.preload&&!e.router.stores.activeMatchStoresById.has(t)),xo=(e,t,n=!0)=>{const s={...e.router.options.context??{}},r=n?t:t-1;for(let a=0;a<=r;a++){const l=e.matches[a];if(!l)continue;const u=e.router.getMatch(l.id);u&&Object.assign(s,u.__routeContext,u.__beforeLoadContext)}return s},YA=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,s=e.matches.findIndex(l=>l.routeId===e.router.routeTree.id),r=s>=0?s:0;let a=n?e.matches.findIndex(l=>l.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=r);for(let l=a;l>=0;l--){const u=e.matches[l];if(e.router.looseRoutesById[u.routeId].options.notFoundComponent)return l}return n?a:r},ra=(e,t,n)=>{var s,r,a;if(!(!Bn(n)&&!Cn(n)))throw Bn(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&((s=t._nonReactive.beforeLoadPromise)==null||s.resolve(),(r=t._nonReactive.loaderPromise)==null||r.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,l=>({...l,status:Bn(n)?"redirected":l.status==="pending"?"success":l.status,context:xo(e,t.index),isFetching:!1,error:n})),Cn(n)&&!n.routeId&&(n.routeId=t.routeId),(a=t._nonReactive.loadPromise)==null||a.resolve()),Bn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},i$=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},QA=(e,t,n)=>{const s=xo(e,n);e.updateMatch(t,r=>({...r,context:s}))},$u=(e,t,n,s)=>{var u,d;const{id:r,routeId:a}=e.matches[t],l=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=s,e.firstBadMatchIndex??(e.firstBadMatchIndex=t),ra(e,e.router.getMatch(r),n);try{(d=(u=l.options).onError)==null||d.call(u,n)}catch(f){n=f,ra(e,e.router.getMatch(r),n)}e.updateMatch(r,f=>{var p,m;return(p=f._nonReactive.beforeLoadPromise)==null||p.resolve(),f._nonReactive.beforeLoadPromise=void 0,(m=f._nonReactive.loadPromise)==null||m.resolve(),{...f,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!Bn(n)&&!Cn(n)&&(e.serialError??(e.serialError=n))},a$=(e,t,n,s)=>{var a;if(s._nonReactive.pendingTimeout!==void 0)return;const r=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Vm(e,t)&&(n.options.loader||n.options.beforeLoad||l$(n))&&typeof r=="number"&&r!==1/0&&(n.options.pendingComponent??((a=e.router.options)==null?void 0:a.defaultPendingComponent))){const l=setTimeout(()=>{sN(e)},r);s._nonReactive.pendingTimeout=l}},wH=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;a$(e,t,n,s);const r=()=>{const a=e.router.getMatch(t);a.preload&&(a.status==="redirected"||a.status==="notFound")&&ra(e,a,a.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(r):r()},jH=(e,t,n,s)=>{const r=e.router.getMatch(t);let a=r._nonReactive.loadPromise;r._nonReactive.loadPromise=xc(()=>{a==null||a.resolve(),a=void 0});const{paramsError:l,searchError:u}=r;l&&$u(e,n,l,"PARSE_PARAMS"),u&&$u(e,n,u,"VALIDATE_SEARCH"),a$(e,t,s,r);const d=new AbortController;let f=!1;const p=()=>{f||(f=!0,e.updateMatch(t,_=>({..._,isFetching:"beforeLoad",fetchCount:_.fetchCount+1,abortController:d})))},m=()=>{var _;(_=r._nonReactive.beforeLoadPromise)==null||_.resolve(),r._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,R=>({...R,isFetching:!1}))};if(!s.options.beforeLoad){e.router.batch(()=>{p(),m()});return}r._nonReactive.beforeLoadPromise=xc();const x={...xo(e,n,!1),...r.__routeContext},{search:y,params:v,cause:b}=r,w=Vm(e,t),S={search:y,abortController:d,params:v,preload:w,context:x,location:e.location,navigate:_=>e.router.navigate({..._,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:w?"preload":b,matches:e.matches,routeId:s.id,...e.router.options.additionalContext},E=_=>{if(_===void 0){e.router.batch(()=>{p(),m()});return}(Bn(_)||Cn(_))&&(p(),$u(e,n,_,"BEFORE_LOAD")),e.router.batch(()=>{p(),e.updateMatch(t,R=>({...R,__beforeLoadContext:_})),m()})};let k;try{if(k=s.options.beforeLoad(S),bd(k))return p(),k.catch(_=>{$u(e,n,_,"BEFORE_LOAD")}).then(E)}catch(_){p(),$u(e,n,_,"BEFORE_LOAD")}E(k)},SH=(e,t)=>{const{id:n,routeId:s}=e.matches[t],r=e.router.looseRoutesById[s],a=()=>u(),l=()=>jH(e,n,t,r),u=()=>{if(i$(e,n))return;const d=wH(e,n,r);return bd(d)?d.then(l):l()};return a()},NH=(e,t,n)=>{var a,l,u,d,f,p;const s=e.router.getMatch(t);if(!s||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const r={ssr:e.router.options.ssr,matches:e.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([(l=(a=n.options).head)==null?void 0:l.call(a,r),(d=(u=n.options).scripts)==null?void 0:d.call(u,r),(p=(f=n.options).headers)==null?void 0:p.call(f,r)]).then(([m,x,y])=>({meta:m==null?void 0:m.meta,links:m==null?void 0:m.links,headScripts:m==null?void 0:m.scripts,headers:y,scripts:x,styles:m==null?void 0:m.styles}))},o$=(e,t,n,s,r)=>{const a=t[s-1],{params:l,loaderDeps:u,abortController:d,cause:f}=e.router.getMatch(n),p=xo(e,s),m=Vm(e,n);return{params:l,deps:u,preload:!!m,parentMatchPromise:a,abortController:d,context:p,location:e.location,navigate:x=>e.router.navigate({...x,_fromLocation:e.location}),cause:m?"preload":f,route:r,...e.router.options.additionalContext}},XA=async(e,t,n,s,r)=>{var a,l,u,d,f;try{const p=e.router.getMatch(n);try{(!(L7??e.router.isServer)||p.ssr===!0)&&jd(r);const m=r.options.loader,x=typeof m=="function"?m:m==null?void 0:m.handler,y=x==null?void 0:x(o$(e,t,n,s,r)),v=!!x&&bd(y);if((v||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||p._nonReactive.minPendingPromise)&&e.updateMatch(n,w=>({...w,isFetching:"loader"})),x){const w=v?await y:y;ra(e,e.router.getMatch(n),w),w!==void 0&&e.updateMatch(n,S=>({...S,loaderData:w}))}r._lazyPromise&&await r._lazyPromise;const b=p._nonReactive.minPendingPromise;b&&await b,r._componentsPromise&&await r._componentsPromise,e.updateMatch(n,w=>({...w,error:void 0,context:xo(e,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(m){let x=m;if((x==null?void 0:x.name)==="AbortError"){if(p.abortController.signal.aborted){(a=p._nonReactive.loaderPromise)==null||a.resolve(),p._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,v=>({...v,status:v.status==="pending"?"success":v.status,isFetching:!1,context:xo(e,s)}));return}const y=p._nonReactive.minPendingPromise;y&&await y,Cn(m)&&await((u=(l=r.options.notFoundComponent)==null?void 0:l.preload)==null?void 0:u.call(l)),ra(e,e.router.getMatch(n),m);try{(f=(d=r.options).onError)==null||f.call(d,m)}catch(v){x=v,ra(e,e.router.getMatch(n),v)}!Bn(x)&&!Cn(x)&&await jd(r,["errorComponent"]),e.updateMatch(n,v=>({...v,error:x,context:xo(e,s),status:"error",isFetching:!1}))}}catch(p){const m=e.router.getMatch(n);m&&(m._nonReactive.loaderPromise=void 0),ra(e,m,p)}},kH=async(e,t,n)=>{var y,v,b,w;async function s(S,E,k,_,R){const T=Date.now()-E.updatedAt,A=S?R.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:R.options.staleTime??e.router.options.defaultStaleTime??0,M=R.options.shouldReload,L=typeof M=="function"?M(o$(e,t,r,n,R)):M,{status:P,invalid:O}=_,B=T>=A&&(!!e.forceStaleReload||_.cause==="enter"||k!==void 0&&k!==_.id);l=P==="success"&&(O||(L??B)),S&&R.options.preload===!1||(l&&!e.sync&&p?(u=!0,(async()=>{var H,z;try{await XA(e,t,r,n,R);const W=e.router.getMatch(r);(H=W._nonReactive.loaderPromise)==null||H.resolve(),(z=W._nonReactive.loadPromise)==null||z.resolve(),W._nonReactive.loaderPromise=void 0,W._nonReactive.loadPromise=void 0}catch(W){Bn(W)&&await e.router.navigate(W.options)}})()):P!=="success"||l?await XA(e,t,r,n,R):QA(e,r,n))}const{id:r,routeId:a}=e.matches[n];let l=!1,u=!1;const d=e.router.looseRoutesById[a],f=d.options.loader,p=((typeof f=="function"||f==null?void 0:f.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(i$(e,r)){if(!e.router.getMatch(r))return e.matches[n];QA(e,r,n)}else{const S=e.router.getMatch(r),E=e.router.stores.matchesId.state[n],k=((y=E&&e.router.stores.activeMatchStoresById.get(E)||null)==null?void 0:y.routeId)===a?E:(v=e.router.stores.activeMatchesSnapshot.state.find(R=>R.routeId===a))==null?void 0:v.id,_=Vm(e,r);if(S._nonReactive.loaderPromise){if(S.status==="success"&&!e.sync&&!S.preload&&p)return S;await S._nonReactive.loaderPromise;const R=e.router.getMatch(r),T=R._nonReactive.error||R.error;T&&ra(e,R,T),R.status==="pending"&&await s(_,S,k,R,d)}else{const R=_&&!e.router.stores.activeMatchStoresById.has(r),T=e.router.getMatch(r);T._nonReactive.loaderPromise=xc(),R!==T.preload&&e.updateMatch(r,A=>({...A,preload:R})),await s(_,S,k,T,d)}}const m=e.router.getMatch(r);u||((b=m._nonReactive.loaderPromise)==null||b.resolve(),(w=m._nonReactive.loadPromise)==null||w.resolve(),m._nonReactive.loadPromise=void 0),clearTimeout(m._nonReactive.pendingTimeout),m._nonReactive.pendingTimeout=void 0,u||(m._nonReactive.loaderPromise=void 0),m._nonReactive.dehydrated=void 0;const x=u?m.isFetching:!1;return x!==m.isFetching||m.invalid!==!1?(e.updateMatch(r,S=>({...S,isFetching:x,invalid:!1})),e.router.getMatch(r)):m};async function ZA(e){var x,y;const t=e,n=[];bH(t.router)&&sN(t);let s;for(let v=0;v<t.matches.length;v++){try{const b=SH(t,v);bd(b)&&await b}catch(b){if(Bn(b))throw b;if(Cn(b))s=b;else if(!t.preload)throw b;break}if(t.serialError)break}const r=t.firstBadMatchIndex??t.matches.length,a=s&&!t.preload?YA(t,s):void 0,l=s&&t.preload?0:a!==void 0?Math.min(a+1,r):r;let u,d;for(let v=0;v<l;v++)n.push(kH(t,n,v));try{await Promise.all(n)}catch{const v=await Promise.allSettled(n);for(const b of v){if(b.status!=="rejected")continue;const w=b.reason;if(Bn(w))throw w;Cn(w)?u??(u=w):d??(d=w)}if(d!==void 0)throw d}const f=u??(s&&!t.preload?s:void 0);let p=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!f&&s&&t.preload)return t.matches;if(f){const v=YA(t,f);v===void 0&&Wr();const b=t.matches[v],w=t.router.looseRoutesById[b.routeId],S=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!w.options.notFoundComponent&&S&&(w.options.notFoundComponent=S),f.routeId=b.routeId;const E=b.routeId===t.router.routeTree.id;t.updateMatch(b.id,k=>({...k,...E?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:f},isFetching:!1})),p=v,await jd(w,["notFoundComponent"])}else if(!t.preload){const v=t.matches[0];v.globalNotFound||(y=t.router.getMatch(v.id))!=null&&y.globalNotFound&&t.updateMatch(v.id,b=>({...b,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const v=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await jd(v,["errorComponent"])}for(let v=0;v<=p;v++){const{id:b,routeId:w}=t.matches[v],S=t.router.looseRoutesById[w];try{const E=NH(t,b,S);if(E){const k=await E;t.updateMatch(b,_=>({..._,...k}))}}catch(E){console.error(`Error executing head for route ${w}:`,E)}}const m=sN(t);if(bd(m)&&await m,f)throw f;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function JA(e,t){const n=t.map(s=>{var r,a;return(a=(r=e.options[s])==null?void 0:r.preload)==null?void 0:a.call(r)}).filter(Boolean);if(n.length!==0)return Promise.all(n)}function jd(e,t=Gp){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(s=>{const{id:r,...a}=s.options;Object.assign(e.options,a),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===Gp?(()=>{if(e._componentsPromise===void 0){const s=JA(e,Gp);s?e._componentsPromise=s.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():JA(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function l$(e){var t;for(const n of Gp)if((t=e.options[n])!=null&&t.preload)return!0;return!1}var Gp=["component","errorComponent","pendingComponent","notFoundComponent"],oa="__TSR_index",eT="popstate",tT="beforeunload";function _H(e){let t=e.getLocation();const n=new Set,s=l=>{t=e.getLocation(),n.forEach(u=>u({location:t,action:l}))},r=l=>{e.notifyOnIndexChange??!0?s(l):t=e.getLocation()},a=async({task:l,navigateOpts:u,...d})=>{var m,x;if((u==null?void 0:u.ignoreBlocker)??!1){l();return}const f=((m=e.getBlockers)==null?void 0:m.call(e))??[],p=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&f.length&&p)for(const y of f){const v=pm(d.path,d.state);if(await y.blockerFn({currentLocation:t,nextLocation:v,action:d.type})){(x=e.onBlocked)==null||x.call(e);return}}l()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:l=>(n.add(l),()=>{n.delete(l)}),push:(l,u,d)=>{const f=t.state[oa];u=nT(f+1,u),a({task:()=>{e.pushState(l,u),s({type:"PUSH"})},navigateOpts:d,type:"PUSH",path:l,state:u})},replace:(l,u,d)=>{const f=t.state[oa];u=nT(f,u),a({task:()=>{e.replaceState(l,u),s({type:"REPLACE"})},navigateOpts:d,type:"REPLACE",path:l,state:u})},go:(l,u)=>{a({task:()=>{e.go(l),r({type:"GO",index:l})},navigateOpts:u,type:"GO"})},back:l=>{a({task:()=>{e.back((l==null?void 0:l.ignoreBlocker)??!1),r({type:"BACK"})},navigateOpts:l,type:"BACK"})},forward:l=>{a({task:()=>{e.forward((l==null?void 0:l.ignoreBlocker)??!1),r({type:"FORWARD"})},navigateOpts:l,type:"FORWARD"})},canGoBack:()=>t.state[oa]!==0,createHref:l=>e.createHref(l),block:l=>{var d;if(!e.setBlockers)return()=>{};const u=((d=e.getBlockers)==null?void 0:d.call(e))??[];return e.setBlockers([...u,l]),()=>{var p,m;const f=((p=e.getBlockers)==null?void 0:p.call(e))??[];(m=e.setBlockers)==null||m.call(e,f.filter(x=>x!==l))}},flush:()=>{var l;return(l=e.flush)==null?void 0:l.call(e)},destroy:()=>{var l;return(l=e.destroy)==null?void 0:l.call(e)},notify:s}}function nT(e,t){t||(t={});const n=y2();return{...t,key:n,__TSR_key:n,[oa]:e}}function CH(e){var M,L;const t=typeof document<"u"?window:void 0,n=t.history.pushState,s=t.history.replaceState;let r=[];const a=()=>r,l=P=>r=P,u=(P=>P),d=(()=>pm(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((M=t.history.state)!=null&&M.__TSR_key)&&!((L=t.history.state)!=null&&L.key)){const P=y2();t.history.replaceState({[oa]:0,key:P,__TSR_key:P},"")}let f=d(),p,m=!1,x=!1,y=!1,v=!1;const b=()=>f;let w,S;const E=()=>{w&&(A._ignoreSubscribers=!0,(w.isPush?t.history.pushState:t.history.replaceState)(w.state,"",w.href),A._ignoreSubscribers=!1,w=void 0,S=void 0,p=void 0)},k=(P,O,B)=>{const H=u(O);S||(p=f),f=pm(O,B),w={href:H,state:B,isPush:(w==null?void 0:w.isPush)||P==="push"},S||(S=Promise.resolve().then(()=>E()))},_=P=>{f=d(),A.notify({type:P})},R=async()=>{if(x){x=!1;return}const P=d(),O=P.state[oa]-f.state[oa],B=O===1,H=O===-1,z=!B&&!H||m;m=!1;const W=z?"GO":H?"BACK":"FORWARD",$=z?{type:"GO",index:O}:{type:H?"BACK":"FORWARD"};if(y)y=!1;else{const F=a();if(typeof document<"u"&&F.length){for(const G of F)if(await G.blockerFn({currentLocation:f,nextLocation:P,action:W})){x=!0,t.history.go(1),A.notify($);return}}}f=d(),A.notify($)},T=P=>{if(v){v=!1;return}let O=!1;const B=a();if(typeof document<"u"&&B.length)for(const H of B){const z=H.enableBeforeUnload??!0;if(z===!0){O=!0;break}if(typeof z=="function"&&z()===!0){O=!0;break}}if(O)return P.preventDefault(),P.returnValue=""},A=_H({getLocation:b,getLength:()=>t.history.length,pushState:(P,O)=>k("push",P,O),replaceState:(P,O)=>k("replace",P,O),back:P=>(P&&(y=!0),v=!0,t.history.back()),forward:P=>{P&&(y=!0),v=!0,t.history.forward()},go:P=>{m=!0,t.history.go(P)},createHref:P=>u(P),flush:E,destroy:()=>{t.history.pushState=n,t.history.replaceState=s,t.removeEventListener(tT,T,{capture:!0}),t.removeEventListener(eT,R)},onBlocked:()=>{p&&f!==p&&(f=p)},getBlockers:a,setBlockers:l,notifyOnIndexChange:!1});return t.addEventListener(tT,T,{capture:!0}),t.addEventListener(eT,R),t.history.pushState=function(...P){const O=n.apply(t.history,P);return A._ignoreSubscribers||_("PUSH"),O},t.history.replaceState=function(...P){const O=s.apply(t.history,P);return A._ignoreSubscribers||_("REPLACE"),O},A}function EH(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function pm(e,t){const n=EH(e),s=n.indexOf("#"),r=n.indexOf("?"),a=y2();return{href:n,pathname:n.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:n.length),hash:s>-1?n.substring(s):"",search:r>-1?n.slice(r,s===-1?void 0:s):"",state:t||{[oa]:0,key:a,__TSR_key:a}}}function y2(){return(Math.random()+1).toString(36).substring(7)}function Wl(e,t){const n=t,s=e;return{fromLocation:n,toLocation:s,pathChanged:(n==null?void 0:n.pathname)!==s.pathname,hrefChanged:(n==null?void 0:n.href)!==s.href,hashChanged:(n==null?void 0:n.hash)!==s.hash}}var RH=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=n=>n(),this.update=n=>{var p;const s=this.options,r=this.basepath??(s==null?void 0:s.basepath)??"/",a=this.basepath===void 0,l=s==null?void 0:s.rewrite;if(this.options={...s,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=tH(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=CH()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let m;this.resolvePathCache=wd(1e3),m=this.buildRouteTree(),this.setRoutes(m)}if(!this.stores&&this.latestLocation){const m=this.getStoreConfig(this);this.batch=m.batch,this.stores=vH(TH(this.latestLocation),m),lH(this)}let u=!1;const d=this.options.basepath??"/",f=this.options.rewrite;if(a||r!==d||l!==f){this.basepath=d;const m=[],x=s$(d);x&&x!=="/"&&m.push(yH({basepath:d})),f&&m.push(f),this.rewrite=m.length===0?void 0:m.length===1?m[0]:xH(m),this.history&&this.updateLatestLocation(),u=!0}u&&this.stores&&this.stores.location.setState(()=>this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof((p=window.CSS)==null?void 0:p.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=Y7(this.routeTree,this.options.caseSensitive,(s,r)=>{s.init({originalIndex:r})});return this.options.routeMasks&&U7(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,s)=>{const r={eventType:n,fn:s};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=n=>{this.subscribers.forEach(s=>{s.eventType===n.type&&s.fn(n)})},this.parseLocation=(n,s)=>{const r=({pathname:d,search:f,hash:p,href:m,state:x})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(d)){const S=this.options.parseSearch(f),E=this.options.stringifySearch(S);return{href:d+E+p,publicHref:m,pathname:Lu(d).path,external:!1,searchStr:E,search:Ua(s==null?void 0:s.search,S),hash:Lu(p.slice(1)).path,state:sa(s==null?void 0:s.state,x)}}const y=new URL(m,this.origin),v=nN(this.rewrite,y),b=this.options.parseSearch(v.search),w=this.options.stringifySearch(b);return v.search=w,{href:v.href.replace(v.origin,""),publicHref:m,pathname:Lu(v.pathname).path,external:!!this.rewrite&&v.origin!==this.origin,searchStr:w,search:Ua(s==null?void 0:s.search,b),hash:Lu(v.hash.slice(1)).path,state:sa(s==null?void 0:s.state,x)}},a=r(n),{__tempLocation:l,__tempKey:u}=a.state;if(l&&(!u||u===this.tempLocationKey)){const d=r(l);return d.state.key=a.state.key,d.state.__TSR_key=a.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:a}}return a},this.resolvePathWithBase=(n,s)=>eH({base:n,to:x2(s),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,s,r)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:s},r):this.matchRoutesInternal(n,s),this.getMatchedRoutes=n=>IH({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const s=this.getMatch(n);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingMatchesId.state.forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.state.forEach(n=>{var r;if(this.stores.pendingMatchStoresById.has(n))return;const s=(r=this.stores.activeMatchStoresById.get(n))==null?void 0:r.state;s&&(s.status==="pending"||s.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const s=(a={})=>{var P,O;const l=a._fromLocation||this.pendingBuiltLocation||this.latestLocation,u=this.matchRoutesLightweight(l);a.from;const d=a.unsafeRelative==="path"?l.pathname:a.from??u.fullPath,f=this.resolvePathWithBase(d,"."),p=u.search,m=Object.assign(Object.create(null),u.params),x=a.to?this.resolvePathWithBase(f,`${a.to}`):this.resolvePathWithBase(f,"."),y=a.params===!1||a.params===null?Object.create(null):(a.params??!0)===!0?m:Object.assign(m,na(a.params,m)),v=this.getMatchedRoutes(x);let b=v.matchedRoutes;if((!v.foundRoute||v.foundRoute.path!=="/"&&v.routeParams["**"])&&this.options.notFoundRoute&&(b=[...b,this.options.notFoundRoute]),Object.keys(y).length>0)for(const B of b){const H=((P=B.options.params)==null?void 0:P.stringify)??B.options.stringifyParams;if(H)try{Object.assign(y,H(y))}catch{}}const w=n.leaveParams?x:Lu(KA({path:x,params:y,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let S=p;if(n._includeValidateSearch&&((O=this.options.search)!=null&&O.strict)){const B={};b.forEach(H=>{if(H.options.validateSearch)try{Object.assign(B,Kp(H.options.validateSearch,{...B,...S}))}catch{}}),S=B}S=MH({search:S,dest:a,destRoutes:b,_includeValidateSearch:n._includeValidateSearch}),S=Ua(p,S);const E=this.options.stringifySearch(S),k=a.hash===!0?l.hash:a.hash?na(a.hash,l.hash):void 0,_=k?`#${k}`:"";let R=a.state===!0?l.state:a.state?na(a.state,l.state):{};R=sa(l.state,R);const T=`${w}${E}${_}`;let A,M,L=!1;if(this.rewrite){const B=new URL(T,this.origin),H=r$(this.rewrite,B);A=B.href.replace(B.origin,""),H.origin!==this.origin?(M=H.href,L=!0):M=H.pathname+H.search+H.hash}else A=B7(T),M=A;return{publicHref:M,href:A,pathname:w,search:S,searchStr:E,state:R,hash:k??"",external:L,unmaskOnReload:a.unmaskOnReload}},r=(a={},l)=>{const u=s(a);let d=l?s(l):void 0;if(!d){const f=Object.create(null);if(this.options.routeMasks){const p=V7(u.pathname,this.processedTree);if(p){Object.assign(f,p.rawParams);const{from:m,params:x,...y}=p.route,v=x===!1||x===null?Object.create(null):(x??!0)===!0?f:Object.assign(f,na(x,f));l={from:n.from,...y,params:v},d=s(l)}}}return d&&(u.maskedLocation=d),u};return n.mask?r(n,{from:n.from,...n.mask}):r(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:s,...r})=>{const a=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(p=>{r.state[p]=this.latestLocation.state[p]});const f=mo(r.state,this.latestLocation.state);return d.forEach(p=>{delete r.state[p]}),f},l=aa(this.latestLocation.href)===aa(r.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=xc(()=>{u==null||u.resolve(),u=void 0}),l&&a())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...p}=r;d&&(p={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[r.replace?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:s})}return this.resetNextScroll=r.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:s,hashScrollIntoView:r,viewTransition:a,ignoreBlocker:l,href:u,...d}={})=>{if(u){const m=this.history.location.state.__TSR_index,x=pm(u,{__TSR_index:n?m:m+1}),y=new URL(x.pathname,this.origin);d.to=nN(this.rewrite,y).pathname,d.search=this.options.parseSearch(x.search),d.hash=x.hash.slice(1)}const f=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=f;const p=this.commitLocation({...f,viewTransition:a,replace:n,resetScroll:s,hashScrollIntoView:r,ignoreBlocker:l});return Promise.resolve().then(()=>{this.pendingBuiltLocation===f&&(this.pendingBuiltLocation=void 0)}),p},this.navigate=async({to:n,reloadDocument:s,href:r,publicHref:a,...l})=>{var d,f;let u=!1;if(r)try{new URL(`${r}`),u=!0}catch{}if(u&&!s&&(s=!0),s){if(n!==void 0||!r){const m=this.buildLocation({to:n,...l});r=r??m.publicHref,a=a??m.publicHref}const p=!u&&a?a:r;if(dm(p,this.protocolAllowlist))return Promise.resolve();if(!l.ignoreBlocker){const m=((f=(d=this.history).getBlockers)==null?void 0:f.call(d))??[];for(const x of m)if(x!=null&&x.blockerFn&&await x.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return l.replace?window.location.replace(p):window.location.href=p,Promise.resolve()}return this.buildAndCommitLocation({...l,href:r,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),s=this.stores.cachedMatchesSnapshot.state.filter(r=>!n.some(a=>a.id===r.id));this.batch(()=>{this.stores.status.setState(()=>"pending"),this.stores.statusCode.setState(()=>200),this.stores.isLoading.setState(()=>!0),this.stores.location.setState(()=>this.latestLocation),this.stores.setPendingMatches(n),this.stores.setCachedMatches(s)})},this.load=async n=>{let s,r,a;const l=this.stores.resolvedLocation.state??this.stores.location.state;for(a=new Promise(d=>{this.startTransition(async()=>{var f;try{this.beforeLoad();const p=this.latestLocation,m=this.stores.resolvedLocation.state,x=Wl(p,m);this.stores.redirect.state||this.emit({type:"onBeforeNavigate",...x}),this.emit({type:"onBeforeLoad",...x}),await ZA({router:this,sync:n==null?void 0:n.sync,forceStaleReload:l.href===p.href,matches:this.stores.pendingMatchesSnapshot.state,location:p,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{var S,E;let y=null,v=null,b=null,w=null;this.batch(()=>{const k=this.stores.pendingMatchesSnapshot.state,_=k.length,R=this.stores.activeMatchesSnapshot.state;y=_?R.filter(M=>!this.stores.pendingMatchStoresById.has(M.id)):null;const T=new Set;for(const M of this.stores.pendingMatchStoresById.values())M.routeId&&T.add(M.routeId);const A=new Set;for(const M of this.stores.activeMatchStoresById.values())M.routeId&&A.add(M.routeId);v=_?R.filter(M=>!T.has(M.routeId)):null,b=_?k.filter(M=>!A.has(M.routeId)):null,w=_?k.filter(M=>A.has(M.routeId)):R,this.stores.isLoading.setState(()=>!1),this.stores.loadedAt.setState(()=>Date.now()),_&&(this.stores.setActiveMatches(k),this.stores.setPendingMatches([]),this.stores.setCachedMatches([...this.stores.cachedMatchesSnapshot.state,...y.filter(M=>M.status!=="error"&&M.status!=="notFound"&&M.status!=="redirected")]),this.clearExpiredCache())});for(const[k,_]of[[v,"onLeave"],[b,"onEnter"],[w,"onStay"]])if(k)for(const R of k)(E=(S=this.looseRoutesById[R.routeId].options)[_])==null||E.call(S,R)})})}})}catch(p){Bn(p)?(s=p,this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):Cn(p)&&(r=p);const m=s?s.status:r?404:this.stores.activeMatchesSnapshot.state.some(x=>x.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.setState(()=>m),this.stores.redirect.setState(()=>s)})}this.latestLoadPromise===a&&((f=this.commitLocationPromise)==null||f.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),d()})}),this.latestLoadPromise=a,await a;this.latestLoadPromise&&a!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.stores.activeMatchesSnapshot.state.some(d=>d.status==="error")&&(u=500),u!==void 0&&this.stores.statusCode.setState(()=>u)},this.startViewTransition=n=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const a=this.latestLocation,l=this.stores.resolvedLocation.state,u=typeof s.types=="function"?s.types(Wl(a,l)):s.types;if(u===!1){n();return}r={update:n,types:u}}else r=n;document.startViewTransition(r)}else n()},this.updateMatch=(n,s)=>{this.startTransition(()=>{const r=this.stores.pendingMatchStoresById.get(n);if(r){r.setState(s);return}const a=this.stores.activeMatchStoresById.get(n);if(a){a.setState(s);return}const l=this.stores.cachedMatchStoresById.get(n);if(l){const u=s(l.state);u.status==="redirected"?this.stores.cachedMatchStoresById.delete(n)&&this.stores.cachedMatchesId.setState(d=>d.filter(f=>f!==n)):l.setState(()=>u)}})},this.getMatch=n=>{var s,r,a;return((s=this.stores.cachedMatchStoresById.get(n))==null?void 0:s.state)??((r=this.stores.pendingMatchStoresById.get(n))==null?void 0:r.state)??((a=this.stores.activeMatchStoresById.get(n))==null?void 0:a.state)},this.invalidate=n=>{const s=r=>{var a;return((a=n==null?void 0:n.filter)==null?void 0:a.call(n,r))??!0?{...r,invalid:!0,...n!=null&&n.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r};return this.batch(()=>{this.stores.setActiveMatches(this.stores.activeMatchesSnapshot.state.map(s)),this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.map(s)),this.stores.setPendingMatches(this.stores.pendingMatchesSnapshot.state.map(s))}),this.shouldViewTransition=!1,this.load({sync:n==null?void 0:n.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const s=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const r=n.options._builtLocation??this.buildLocation(n.options),a=this.getParsedLocationHref(r);n.options.href=a,n.headers.set("Location",a)}else if(s)try{const r=new URL(s);if(this.origin&&r.origin===this.origin){const a=r.pathname+r.search+r.hash;n.options.href=a,n.headers.set("Location",a)}}catch{}if(n.options.href&&!n.options._builtLocation&&dm(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const s=n==null?void 0:n.filter;s!==void 0?this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.filter(r=>!s(r))):this.stores.setCachedMatches([])},this.clearExpiredCache=()=>{const n=Date.now(),s=r=>{const a=this.looseRoutesById[r.routeId];if(!a.options.loader)return!0;const l=(r.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:n-r.updatedAt>=l};this.clearCache({filter:s})},this.loadRouteChunk=jd,this.preloadRoute=async n=>{const s=n._builtLocation??this.buildLocation(n);let r=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:n});const a=new Set([...this.stores.matchesId.state,...this.stores.pendingMatchesId.state]),l=new Set([...a,...this.stores.cachedMatchesId.state]),u=r.filter(d=>!l.has(d.id));if(u.length){const d=this.stores.cachedMatchesSnapshot.state;this.stores.setCachedMatches([...d,...u])}try{return r=await ZA({router:this,matches:r,location:s,preload:!0,updateMatch:(d,f)=>{a.has(d)?r=r.map(p=>p.id===d?f(p):p):this.updateMatch(d,f)}}),r}catch(d){if(Bn(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:s});Cn(d)||console.error(d);return}},this.matchRoute=(n,s)=>{const r={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},a=this.buildLocation(r);if(s!=null&&s.pending&&this.stores.status.state!=="pending")return!1;const l=((s==null?void 0:s.pending)===void 0?!this.stores.isLoading.state:s.pending)?this.latestLocation:this.stores.resolvedLocation.state||this.stores.location.state,u=G7(a.pathname,(s==null?void 0:s.caseSensitive)??!1,(s==null?void 0:s.fuzzy)??!1,l.pathname,this.processedTree);return!u||n.params&&!mo(u.rawParams,n.params,{partial:!0})?!1:(s==null?void 0:s.includeSearch)??!0?mo(l.search,a.search,{partial:!0})?u.rawParams:!1:u.rawParams},this.hasNotFoundMatch=()=>this.stores.activeMatchesSnapshot.state.some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??hH,parseSearch:e.parseSearch??fH,protocolAllowlist:e.protocolAllowlist??z7}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var m,x;const n=this.getMatchedRoutes(e.pathname),{foundRoute:s,routeParams:r,parsedParams:a}=n;let{matchedRoutes:l}=n,u=!1;(s?s.path!=="/"&&r["**"]:aa(e.pathname))&&(this.options.notFoundRoute?l=[...l,this.options.notFoundRoute]:u=!0);const d=u?LH(this.options.notFoundMode,l):void 0,f=new Array(l.length),p=new Map;for(const y of this.stores.activeMatchStoresById.values())y.routeId&&p.set(y.routeId,y.state);for(let y=0;y<l.length;y++){const v=l[y],b=f[y-1];let w,S,E;{const W=(b==null?void 0:b.search)??e.search,$=(b==null?void 0:b._strictSearch)??void 0;try{const F=Kp(v.options.validateSearch,{...W})??void 0;w={...W,...F},S={...$,...F},E=void 0}catch(F){let G=F;if(F instanceof mm||(G=new mm(F.message,{cause:F})),t!=null&&t.throwOnError)throw G;w=W,S={},E=G}}const k=((x=(m=v.options).loaderDeps)==null?void 0:x.call(m,{search:w}))??"",_=k?JSON.stringify(k):"",{interpolatedPath:R,usedParams:T}=KA({path:v.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),A=v.id+R+_,M=this.getMatch(A),L=p.get(v.id),P=(M==null?void 0:M._strictParams)??T;let O;if(!M)try{sT(v,T,a,P)}catch(W){if(Cn(W)||Bn(W)?O=W:O=new AH(W.message,{cause:W}),t!=null&&t.throwOnError)throw O}Object.assign(r,P);const B=L?"stay":"enter";let H;if(M)H={...M,cause:B,params:(L==null?void 0:L.params)??r,_strictParams:P,search:Ua(L?L.search:M.search,w),_strictSearch:S};else{const W=v.options.loader||v.options.beforeLoad||v.lazyFn||l$(v)?"pending":"success";H={id:A,ssr:v.options.ssr,index:y,routeId:v.id,params:(L==null?void 0:L.params)??r,_strictParams:P,pathname:R,updatedAt:Date.now(),search:L?Ua(L.search,w):w,_strictSearch:S,searchError:void 0,status:W,isFetching:!1,error:void 0,paramsError:O,__routeContext:void 0,_nonReactive:{loadPromise:xc()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:B,loaderDeps:L?sa(L.loaderDeps,k):k,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:v.options.staticData||{},fullPath:v.fullPath}}t!=null&&t.preload||(H.globalNotFound=d===v.id),H.searchError=E;const z=this.getParentContext(b);H.context={...z,...H.__routeContext,...H.__beforeLoadContext},f[y]=H}for(let y=0;y<f.length;y++){const v=f[y],b=this.looseRoutesById[v.routeId],w=this.getMatch(v.id),S=p.get(v.routeId);if(v.params=S?Ua(S.params,r):r,!w){const E=f[y-1],k=this.getParentContext(E);if(b.options.context){const _={deps:v.loaderDeps,params:v.params,context:k??{},location:e,navigate:R=>this.navigate({...R,_fromLocation:e}),buildLocation:this.buildLocation,cause:v.cause,abortController:v.abortController,preload:!!v.preload,matches:f,routeId:b.id};v.__routeContext=b.options.context(_)??void 0}v.context={...k,...v.__routeContext,...v.__beforeLoadContext}}}return f}matchRoutesLightweight(e){var p;const{matchedRoutes:t,routeParams:n,parsedParams:s}=this.getMatchedRoutes(e.pathname),r=vd(t),a={...e.search};for(const m of t)try{Object.assign(a,Kp(m.options.validateSearch,a))}catch{}const l=vd(this.stores.matchesId.state),u=l&&((p=this.stores.activeMatchStoresById.get(l))==null?void 0:p.state),d=u&&u.routeId===r.id&&u.pathname===e.pathname;let f;if(d)f=u.params;else{const m=Object.assign(Object.create(null),n);for(const x of t)try{sT(x,n,s??{},m)}catch{}f=m}return{matchedRoutes:t,fullPath:r.fullPath,search:a,params:f}}},mm=class extends Error{},AH=class extends Error{};function TH(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Kp(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new mm("Async validation not supported");if(n.issues)throw new mm(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function IH({pathname:e,routesById:t,processedTree:n}){const s=Object.create(null),r=aa(e);let a,l;const u=K7(r,n,!0);return u&&(a=u.route,Object.assign(s,u.rawParams),l=Object.assign(Object.create(null),u.parsedParams)),{matchedRoutes:(u==null?void 0:u.branch)||[t.__root__],routeParams:s,foundRoute:a,parsedParams:l}}function MH({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return OH(n)(e,t,s??!1)}function OH(e){var r;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const a of e){if("search"in a.options)(r=a.options.search)!=null&&r.middlewares&&t.middlewares.push(...a.options.search.middlewares);else if(a.options.preSearchFilters||a.options.postSearchFilters){const l=({search:u,next:d})=>{let f=u;"preSearchFilters"in a.options&&a.options.preSearchFilters&&(f=a.options.preSearchFilters.reduce((m,x)=>x(m),u));const p=d(f);return"postSearchFilters"in a.options&&a.options.postSearchFilters?a.options.postSearchFilters.reduce((m,x)=>x(m),p):p};t.middlewares.push(l)}if(a.options.validateSearch){const l=({search:u,next:d})=>{const f=d(u);if(!t._includeValidateSearch)return f;try{return{...f,...Kp(a.options.validateSearch,f)??void 0}}catch{return f}};t.middlewares.push(l)}}const n=({search:a})=>{const l=t.dest;return l.search?l.search===!0?a:na(l.search,a):{}};t.middlewares.push(n);const s=(a,l,u)=>{if(a>=u.length)return l;const d=u[a];return d({search:l,next:p=>s(a+1,p,u)})};return function(l,u,d){return t.dest=u,t._includeValidateSearch=d,s(0,l,t.middlewares)}}function LH(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.children)return s.id}return go}function sT(e,t,n,s){var a;const r=((a=e.options.params)==null?void 0:a.parse)??e.options.parseParams;if(r)if(e.options.skipRouteOnParseError)for(const l in t)l in n&&(s[l]=n[l]);else{const l=r(s);Object.assign(s,l)}}var PH="Error preloading route! ☝️",c$=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var d,f;this.originalIndex=t.originalIndex;const n=this.options,s=!(n!=null&&n.path)&&!(n!=null&&n.id);this.parentRoute=(f=(d=this.options).getParentRoute)==null?void 0:f.call(d),s?this._path=go:this.parentRoute||Wr();let r=s?go:n==null?void 0:n.path;r&&r!=="/"&&(r=n$(r));const a=(n==null?void 0:n.id)||r;let l=s?go:Vp([this.parentRoute.id==="__root__"?"":this.parentRoute.id,a]);r==="__root__"&&(r="/"),l!=="__root__"&&(l=Vp(["/",l]));const u=l==="__root__"?"/":Vp([this.parentRoute.fullPath,r]);this._path=r,this._id=l,this._fullPath=u,this._to=aa(u)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>gH({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},$H=class extends c${constructor(e){super(e)}};function v2(e){const t=e.errorComponent??b2;return i.jsx(DH,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?C.createElement(t,{error:n,reset:s}):e.children})}var DH=class extends C.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function b2({error:e}){const[t,n]=C.useState(!1);return i.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[i.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),i.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(s=>!s),children:t?"Hide Error":"Show Error"})]}),i.jsx("div",{style:{height:".25rem"}}),t?i.jsx("div",{children:i.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?i.jsx("code",{children:e.message}):null})}):null]})}function qH({children:e,fallback:t=null}){return u$()?i.jsx(wo.Fragment,{children:e}):i.jsx(wo.Fragment,{children:t})}function u$(){return wo.useSyncExternalStore(zH,()=>!0,()=>!1)}function zH(){return()=>{}}var d$=C.createContext(null);function Rn(e){return C.useContext(d$)}var Gm=C.createContext(void 0),BH=C.createContext(void 0),jt=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(jt||{});function f$({update:e,notify:t,unwatched:n}){return{link:s,unlink:r,propagate:a,checkDirty:l,shallowPropagate:u};function s(f,p,m){const x=p.depsTail;if(x!==void 0&&x.dep===f)return;const y=x!==void 0?x.nextDep:p.deps;if(y!==void 0&&y.dep===f){y.version=m,p.depsTail=y;return}const v=f.subsTail;if(v!==void 0&&v.version===m&&v.sub===p)return;const b=p.depsTail=f.subsTail={version:m,dep:f,sub:p,prevDep:x,nextDep:y,prevSub:v,nextSub:void 0};y!==void 0&&(y.prevDep=b),x!==void 0?x.nextDep=b:p.deps=b,v!==void 0?v.nextSub=b:f.subs=b}function r(f,p=f.sub){const m=f.dep,x=f.prevDep,y=f.nextDep,v=f.nextSub,b=f.prevSub;return y!==void 0?y.prevDep=x:p.depsTail=x,x!==void 0?x.nextDep=y:p.deps=y,v!==void 0?v.prevSub=b:m.subsTail=b,b!==void 0?b.nextSub=v:(m.subs=v)===void 0&&n(m),y}function a(f){let p=f.nextSub,m;e:do{const x=f.sub;let y=x.flags;if(y&60?y&12?y&4?!(y&48)&&d(f,x)?(x.flags=y|40,y&=1):y=0:x.flags=y&-9|32:y=0:x.flags=y|32,y&2&&t(x),y&1){const v=x.subs;if(v!==void 0){const b=(f=v).nextSub;b!==void 0&&(m={value:p,prev:m},p=b);continue}}if((f=p)!==void 0){p=f.nextSub;continue}for(;m!==void 0;)if(f=m.value,m=m.prev,f!==void 0){p=f.nextSub;continue e}break}while(!0)}function l(f,p){let m,x=0,y=!1;e:do{const v=f.dep,b=v.flags;if(p.flags&16)y=!0;else if((b&17)===17){if(e(v)){const w=v.subs;w.nextSub!==void 0&&u(w),y=!0}}else if((b&33)===33){(f.nextSub!==void 0||f.prevSub!==void 0)&&(m={value:f,prev:m}),f=v.deps,p=v,++x;continue}if(!y){const w=f.nextDep;if(w!==void 0){f=w;continue}}for(;x--;){const w=p.subs,S=w.nextSub!==void 0;if(S?(f=m.value,m=m.prev):f=w,y){if(e(p)){S&&u(w),p=f.sub;continue}y=!1}else p.flags&=-33;p=f.sub;const E=f.nextDep;if(E!==void 0){f=E;continue e}}return y}while(!0)}function u(f){do{const p=f.sub,m=p.flags;(m&48)===32&&(p.flags=m|16,(m&6)===2&&t(p))}while((f=f.nextSub)!==void 0)}function d(f,p){let m=p.depsTail;for(;m!==void 0;){if(m===f)return!0;m=m.prevDep}return!1}}let w2=0,Va=0,cd=0;const Vr=[],{link:Zye,unlink:h$,propagate:Jye,checkDirty:FH,shallowPropagate:eve}=f$({update(e){return e.depsTail!==void 0?GH(e):KH(e)},notify(e){var s;let t=cd,n=t;do if(Vr[t++]=e,e.flags&=-3,e=(s=e.subs)==null?void 0:s.sub,e===void 0||!(e.flags&2))break;while(!0);for(cd=t;n<--t;){const r=Vr[n];Vr[n++]=Vr[t],Vr[t]=r}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Km(e)):QH.call(e)}});function HH(){return w2}function UH(){++w2}function VH(){--w2||YH()}function GH(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,Km(e)}}function KH(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function WH(e){const t=e.flags;if(t&16||t&32&&FH(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,Km(e)}}else e.flags=2}function YH(){try{for(;Va<cd;){const e=Vr[Va];Vr[Va++]=void 0,WH(e)}}finally{for(;Va<cd;){const e=Vr[Va];Vr[Va++]=void 0,e.flags|=10}Va=0,cd=0}}function QH(){this.depsTail=void 0,this.flags=0,Km(this);const e=this.subs;e!==void 0&&h$(e)}function Km(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=h$(n,e)}function j2(e,t,n){var a,l,u;const s=typeof e=="object",r=s?e:void 0;return{next:(a=s?e.next:e)==null?void 0:a.bind(r),error:(l=s?e.error:t)==null?void 0:l.bind(r),complete:(u=s?e.complete:n)==null?void 0:u.bind(r)}}const rN=[];let Wp=0;const{link:rT,unlink:XH,propagate:ZH,checkDirty:p$,shallowPropagate:iT}=f$({update(e){return e._update()},notify(e){rN[iN++]=e,e.flags&=~jt.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=jt.Mutable|jt.Dirty,gm(e))}});let tp=0,iN=0,Js;function gm(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=XH(n,e)}function m$(){if(!(HH()>0)){for(;tp<iN;){const e=rN[tp];rN[tp++]=void 0,e.notify()}tp=0,iN=0}}function g$(e,t){const n=typeof e=="function",s=e,r={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?jt.None:jt.Mutable,get(){return Js!==void 0&&rT(r,Js,Wp),r._snapshot},subscribe(a){const l=j2(a),u={current:!1},d=JH(()=>{var f;r.get(),u.current?(f=l.next)==null||f.call(l,r._snapshot):u.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(a){const l=Js,u=Object.is;if(n)Js=r,++Wp,r.depsTail=void 0;else if(a===void 0)return!1;n&&(r.flags=jt.Mutable|jt.RecursedCheck);try{const d=r._snapshot,f=typeof a=="function"?a(d):a===void 0&&n?s(d):a;return d===void 0||!u(d,f)?(r._snapshot=f,!0):!1}finally{Js=l,n&&(r.flags&=~jt.RecursedCheck),gm(r)}}};return n?(r.flags=jt.Mutable|jt.Dirty,r.get=function(){const a=r.flags;if(a&jt.Dirty||a&jt.Pending&&p$(r.deps,r)){if(r._update()){const l=r.subs;l!==void 0&&iT(l)}}else a&jt.Pending&&(r.flags=a&~jt.Pending);return Js!==void 0&&rT(r,Js,Wp),r._snapshot}):r.set=function(a){if(r._update(a)){const l=r.subs;l!==void 0&&(ZH(l),iT(l),m$())}},r}function JH(e){const t=()=>{const s=Js;Js=n,++Wp,n.depsTail=void 0,n.flags=jt.Watching|jt.RecursedCheck;try{return e()}finally{Js=s,n.flags&=~jt.RecursedCheck,gm(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:jt.Watching|jt.RecursedCheck,notify(){const s=this.flags;s&jt.Dirty||s&jt.Pending&&p$(this.deps,this)?t():this.flags=jt.Watching},stop(){this.flags=jt.None,this.depsTail=void 0,gm(this)}};return t(),n}class eU{constructor(t){this.atom=g$(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(j2(t))}}class tU{constructor(t){this.atom=g$(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(j2(t))}}function aT(e){return typeof e=="function"?new tU(e):new eU(e)}function x$(e){try{UH(),e()}finally{VH(),m$()}}var qy={exports:{}},zy={},By={exports:{}},Fy={};/**
50
+ * @license React
51
+ * use-sync-external-store-shim.production.js
52
+ *
53
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */var oT;function nU(){if(oT)return Fy;oT=1;var e=ef();function t(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,a=e.useLayoutEffect,l=e.useDebugValue;function u(m,x){var y=x(),v=s({inst:{value:y,getSnapshot:x}}),b=v[0].inst,w=v[1];return a(function(){b.value=y,b.getSnapshot=x,d(b)&&w({inst:b})},[m,y,x]),r(function(){return d(b)&&w({inst:b}),m(function(){d(b)&&w({inst:b})})},[m]),l(y),y}function d(m){var x=m.getSnapshot;m=m.value;try{var y=x();return!n(m,y)}catch{return!0}}function f(m,x){return x()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return Fy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Fy}var lT;function sU(){return lT||(lT=1,By.exports=nU()),By.exports}/**
58
+ * @license React
59
+ * use-sync-external-store-shim/with-selector.production.js
60
+ *
61
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ */var cT;function rU(){if(cT)return zy;cT=1;var e=ef(),t=sU();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var s=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,a=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return zy.useSyncExternalStoreWithSelector=function(f,p,m,x,y){var v=a(null);if(v.current===null){var b={hasValue:!1,value:null};v.current=b}else b=v.current;v=u(function(){function S(T){if(!E){if(E=!0,k=T,T=x(T),y!==void 0&&b.hasValue){var A=b.value;if(y(A,T))return _=A}return _=T}if(A=_,s(k,T))return A;var M=x(T);return y!==void 0&&y(A,M)?(k=T,A):(k=T,_=M)}var E=!1,k,_,R=m===void 0?null:m;return[function(){return S(p())},R===null?void 0:function(){return S(R())}]},[p,m,x,y]);var w=r(f,v[0],v[1]);return l(function(){b.hasValue=!0,b.value=w},[w]),d(w),w},zy}var uT;function iU(){return uT||(uT=1,qy.exports=rU()),qy.exports}var y$=iU();const aU=Hm(y$);function oU(e,t){return e===t}function Vn(e,t,n=oU){const s=C.useCallback(l=>{if(!e)return()=>{};const{unsubscribe:u}=e.subscribe(l);return u},[e]),r=C.useCallback(()=>e==null?void 0:e.get(),[e]);return y$.useSyncExternalStoreWithSelector(s,r,r,t,n)}var lU={state:void 0,get:()=>{},subscribe:()=>()=>{}};function ya(e){const t=Rn(),n=C.useContext(e.from?BH:Gm),s=e.from??n,r=s?e.from?t.stores.getMatchStoreByRouteId(s):t.stores.activeMatchStoresById.get(s):void 0,a=C.useRef(void 0);return Vn(r??lU,l=>{if((e.shouldThrow??!0)&&!l&&Wr(),l===void 0)return;const u=e.select?e.select(l):l;if(e.structuralSharing??t.options.defaultStructuralSharing){const d=sa(a.current,u);return a.current=d,d}return u})}function S2(e){return ya({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function N2(e){const{select:t,...n}=e;return ya({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function dn(e){return ya({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function k2(e){return ya({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function It(e){const t=Rn();return C.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function Ro(e){const t=Rn(),n=It(),s=C.useRef(null);return ed(()=>{s.current!==e&&(n(e),s.current=e)},[t,e,n]),null}function _2(e){return ya({...e,select:t=>e.select?e.select(t.context):t.context})}var Wm=JP();const cU=Hm(Wm);function uU(e,t){const n=Rn(),s=O7(t),{activeProps:r,inactiveProps:a,activeOptions:l,to:u,preload:d,preloadDelay:f,hashScrollIntoView:p,replace:m,startTransition:x,resetScroll:y,viewTransition:v,children:b,target:w,disabled:S,style:E,className:k,onClick:_,onBlur:R,onFocus:T,onMouseEnter:A,onMouseLeave:M,onTouchStart:L,ignoreBlocker:P,params:O,search:B,hash:H,state:z,mask:W,reloadDocument:$,unsafeRelative:F,from:G,_fromLocation:X,...Z}=e,D=u$(),V=C.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ne=Vn(n.stores.location,Oe=>Oe,(Oe,mt)=>Oe.href===mt.href),U=C.useMemo(()=>{const Oe={_fromLocation:ne,...V};return n.buildLocation(Oe)},[n,ne,V]),Q=U.maskedLocation?U.maskedLocation.publicHref:U.publicHref,K=U.maskedLocation?U.maskedLocation.external:U.external,te=C.useMemo(()=>gU(Q,K,n.history,S),[S,K,Q,n.history]),re=C.useMemo(()=>{if(te!=null&&te.external)return dm(te.href,n.protocolAllowlist)?void 0:te.href;if(!xU(u)&&!(typeof u!="string"||u.indexOf(":")===-1))try{return new URL(u),dm(u,n.protocolAllowlist)?void 0:u}catch{}},[u,te,n.protocolAllowlist]),oe=C.useMemo(()=>{if(re)return!1;if(l!=null&&l.exact){if(!J7(ne.pathname,U.pathname,n.basepath))return!1}else{const Oe=fm(ne.pathname,n.basepath),mt=fm(U.pathname,n.basepath);if(!(Oe.startsWith(mt)&&(Oe.length===mt.length||Oe[mt.length]==="/")))return!1}return((l==null?void 0:l.includeSearch)??!0)&&!mo(ne.search,U.search,{partial:!(l!=null&&l.exact),ignoreUndefined:!(l!=null&&l.explicitUndefined)})?!1:l!=null&&l.includeHash?D&&ne.hash===U.hash:!0},[l==null?void 0:l.exact,l==null?void 0:l.explicitUndefined,l==null?void 0:l.includeHash,l==null?void 0:l.includeSearch,ne,re,D,U.hash,U.pathname,U.search,n.basepath]),pe=oe?na(r,{})??dU:Hy,ge=oe?Hy:na(a,{})??Hy,ve=[k,pe.className,ge.className].filter(Boolean).join(" "),xe=(E||pe.style||ge.style)&&{...E,...pe.style,...ge.style},[Ne,we]=C.useState(!1),De=C.useRef(!1),Ee=e.reloadDocument||re?!1:d??n.options.defaultPreload,Ct=f??n.options.defaultPreloadDelay??0,ut=C.useCallback(()=>{n.preloadRoute({...V,_builtLocation:U}).catch(Oe=>{console.warn(Oe),console.warn(PH)})},[n,V,U]);M7(s,C.useCallback(Oe=>{Oe!=null&&Oe.isIntersecting&&ut()},[ut]),mU,{disabled:!!S||Ee!=="viewport"}),C.useEffect(()=>{De.current||!S&&Ee==="render"&&(ut(),De.current=!0)},[S,ut,Ee]);const jn=Oe=>{const mt=Oe.currentTarget.getAttribute("target"),Kt=w!==void 0?w:mt;if(!S&&!yU(Oe)&&!Oe.defaultPrevented&&(!Kt||Kt==="_self")&&Oe.button===0){Oe.preventDefault(),Wm.flushSync(()=>{we(!0)});const Kn=n.subscribe("onResolved",()=>{Kn(),we(!1)});n.navigate({...V,replace:m,resetScroll:y,hashScrollIntoView:p,startTransition:x,viewTransition:v,ignoreBlocker:P})}};if(re)return{...Z,ref:s,href:re,...b&&{children:b},...w&&{target:w},...S&&{disabled:S},...E&&{style:E},...k&&{className:k},..._&&{onClick:_},...R&&{onBlur:R},...T&&{onFocus:T},...A&&{onMouseEnter:A},...M&&{onMouseLeave:M},...L&&{onTouchStart:L}};const tn=Oe=>{if(S||Ee!=="intent")return;if(!Ct){ut();return}const mt=Oe.currentTarget;if(Du.has(mt))return;const Kt=setTimeout(()=>{Du.delete(mt),ut()},Ct);Du.set(mt,Kt)},Xt=Oe=>{S||Ee!=="intent"||ut()},yt=Oe=>{if(S||!Ee||!Ct)return;const mt=Oe.currentTarget,Kt=Du.get(mt);Kt&&(clearTimeout(Kt),Du.delete(mt))};return{...Z,...pe,...ge,href:te==null?void 0:te.href,ref:s,onClick:_l([_,jn]),onBlur:_l([R,yt]),onFocus:_l([T,tn]),onMouseEnter:_l([A,tn]),onMouseLeave:_l([M,yt]),onTouchStart:_l([L,Xt]),disabled:!!S,target:w,...xe&&{style:xe},...ve&&{className:ve},...S&&fU,...oe&&hU,...D&&Ne&&pU}}var Hy={},dU={className:"active"},fU={role:"link","aria-disabled":!0},hU={"data-status":"active","aria-current":"page"},pU={"data-transitioning":"transitioning"},Du=new WeakMap,mU={rootMargin:"100px"},_l=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function gU(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function xU(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ve=C.forwardRef((e,t)=>{const{_asChild:n,...s}=e,{type:r,...a}=uU(s,t),l=typeof s.children=="function"?s.children({isActive:a["data-status"]==="active"}):s.children;if(!n){const{disabled:u,...d}=a;return C.createElement("a",d,l)}return C.createElement(n,a,l)});function yU(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var vU=class extends c${constructor(t){super(t),this.useMatch=n=>ya({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>_2({...n,from:this.id}),this.useSearch=n=>k2({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>dn({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>N2({...n,from:this.id}),this.useLoaderData=n=>S2({...n,from:this.id}),this.useNavigate=()=>It({from:this.fullPath}),this.Link=wo.forwardRef((n,s)=>i.jsx(Ve,{ref:s,from:this.fullPath,...n}))}};function Ie(e){return new vU(e)}var bU=class extends $H{constructor(e){super(e),this.useMatch=t=>ya({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>_2({...t,from:this.id}),this.useSearch=t=>k2({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>dn({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>N2({...t,from:this.id}),this.useLoaderData=t=>S2({...t,from:this.id}),this.useNavigate=()=>It({from:this.fullPath}),this.Link=wo.forwardRef((t,n)=>i.jsx(Ve,{ref:n,from:this.fullPath,...t}))}};function wU(e){return new bU(e)}function dT(e){return typeof e=="object"?new fT(e,{silent:!0}).createRoute(e):new fT(e,{silent:!0}).createRoute}var fT=class{constructor(e,t){this.path=e,this.createRoute=n=>{const s=Ie(n);return s.isRoot=!1,s},this.silent=t==null?void 0:t.silent}},hT=class{constructor(e){this.useMatch=t=>ya({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>_2({...t,from:this.options.id}),this.useSearch=t=>k2({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>dn({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>N2({...t,from:this.options.id}),this.useLoaderData=t=>S2({...t,from:this.options.id}),this.useNavigate=()=>It({from:Rn().routesById[this.options.id].fullPath}),this.options=e}};function pT(e){return typeof e=="object"?new hT(e):t=>new hT({id:e,...t})}function jU(e){const t=Rn(),n=`not-found-${Vn(t.stores.location,s=>s.pathname)}-${Vn(t.stores.status,s=>s)}`;return i.jsx(v2,{getResetKey:()=>n,onCatch:(s,r)=>{var a;if(Cn(s))(a=e.onCatch)==null||a.call(e,s,r);else throw s},errorComponent:({error:s})=>{var r;if(Cn(s))return(r=e.fallback)==null?void 0:r.call(e,s);throw s},children:e.children})}function SU(){return i.jsx("p",{children:"Not Found"})}function Dl(e){return i.jsx(i.Fragment,{children:e.children})}function v$(e,t,n){return t.options.notFoundComponent?i.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?i.jsx(e.options.defaultNotFoundComponent,{...n}):i.jsx(SU,{})}function NU(){return Rn().isScrollRestoring,null}var b$=C.memo(function({matchId:t}){const n=Rn(),s=n.stores.activeMatchStoresById.get(t);s||Wr();const r=Vn(n.stores.loadedAt,l=>l),a=Vn(s,l=>l);return i.jsx(kU,{router:n,matchId:t,resetKey:r,matchState:C.useMemo(()=>{var d;const l=a.routeId,u=(d=n.routesById[l].parentRoute)==null?void 0:d.id;return{routeId:l,ssr:a.ssr,_displayPending:a._displayPending,parentRouteId:u}},[a._displayPending,a.routeId,a.ssr,n.routesById])})});function kU({router:e,matchId:t,resetKey:n,matchState:s}){var v,b;const r=e.routesById[s.routeId],a=r.options.pendingComponent??e.options.defaultPendingComponent,l=a?i.jsx(a,{}):null,u=r.options.errorComponent??e.options.defaultErrorComponent,d=r.options.onCatch??e.options.defaultOnCatch,f=r.isRoot?r.options.notFoundComponent??((v=e.options.notFoundRoute)==null?void 0:v.options.component):r.options.notFoundComponent,p=s.ssr===!1||s.ssr==="data-only",m=(!r.isRoot||r.options.wrapInSuspense||p)&&(r.options.wrapInSuspense??a??(((b=r.options.errorComponent)==null?void 0:b.preload)||p))?C.Suspense:Dl,x=u?v2:Dl,y=f?jU:Dl;return i.jsxs(r.isRoot?r.options.shellComponent??Dl:Dl,{children:[i.jsx(Gm.Provider,{value:t,children:i.jsx(m,{fallback:l,children:i.jsx(x,{getResetKey:()=>n,errorComponent:u||b2,onCatch:(w,S)=>{if(Cn(w))throw w;d==null||d(w,S)},children:i.jsx(y,{fallback:w=>{if(!f||w.routeId&&w.routeId!==s.routeId||!w.routeId&&!r.isRoot)throw w;return C.createElement(f,w)},children:p||s._displayPending?i.jsx(qH,{fallback:l,children:i.jsx(mT,{matchId:t})}):i.jsx(mT,{matchId:t})})})})}),s.parentRouteId===go&&e.options.scrollRestoration?i.jsxs(i.Fragment,{children:[i.jsx(_U,{}),i.jsx(NU,{})]}):null]})}function _U(){const e=Rn(),t=C.useRef(void 0);return i.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...Wl(e.stores.location.state,e.stores.resolvedLocation.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var mT=C.memo(function({matchId:t}){var f,p,m,x;const n=Rn(),s=n.stores.activeMatchStoresById.get(t);s||Wr();const r=Vn(s,y=>y),a=r.routeId,l=n.routesById[a],u=C.useMemo(()=>{var v;const y=(v=n.routesById[a].options.remountDeps??n.options.defaultRemountDeps)==null?void 0:v({routeId:a,loaderDeps:r.loaderDeps,params:r._strictParams,search:r._strictSearch});return y?JSON.stringify(y):void 0},[a,r.loaderDeps,r._strictParams,r._strictSearch,n.options.defaultRemountDeps,n.routesById]),d=C.useMemo(()=>{const y=l.options.component??n.options.defaultComponent;return y?i.jsx(y,{},u):i.jsx(w$,{})},[u,l.options.component,n.options.defaultComponent]);if(r._displayPending)throw(f=n.getMatch(r.id))==null?void 0:f._nonReactive.displayPendingPromise;if(r._forcePending)throw(p=n.getMatch(r.id))==null?void 0:p._nonReactive.minPendingPromise;if(r.status==="pending"){const y=l.options.pendingMinMs??n.options.defaultPendingMinMs;if(y){const v=n.getMatch(r.id);if(v&&!v._nonReactive.minPendingPromise){const b=xc();v._nonReactive.minPendingPromise=b,setTimeout(()=>{b.resolve(),v._nonReactive.minPendingPromise=void 0},y)}}throw(m=n.getMatch(r.id))==null?void 0:m._nonReactive.loadPromise}if(r.status==="notFound")return Cn(r.error)||Wr(),v$(n,l,r.error);if(r.status==="redirected")throw Bn(r.error)||Wr(),(x=n.getMatch(r.id))==null?void 0:x._nonReactive.loadPromise;if(r.status==="error")throw r.error;return d}),w$=C.memo(function(){const t=Rn(),n=C.useContext(Gm);let s,r=!1,a;{const f=n?t.stores.activeMatchStoresById.get(n):void 0;[s,r]=Vn(f,p=>[p==null?void 0:p.routeId,(p==null?void 0:p.globalNotFound)??!1]),a=Vn(t.stores.matchesId,p=>p[p.findIndex(m=>m===n)+1])}const l=s?t.routesById[s]:void 0,u=t.options.defaultPendingComponent?i.jsx(t.options.defaultPendingComponent,{}):null;if(r)return l||Wr(),v$(t,l,void 0);if(!a)return null;const d=i.jsx(b$,{matchId:a});return s===go?i.jsx(C.Suspense,{fallback:u,children:d}):d});function CU(){const e=Rn(),t=C.useRef({router:e,mounted:!1}),[n,s]=C.useState(!1),r=Vn(e.stores.isLoading,m=>m),a=Vn(e.stores.hasPendingMatches,m=>m),l=Ty(r),u=r||n||a,d=Ty(u),f=r||a,p=Ty(f);return e.startTransition=m=>{s(!0),C.startTransition(()=>{m(),s(!1)})},C.useEffect(()=>{const m=e.history.subscribe(e.load),x=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return aa(e.latestLocation.publicHref)!==aa(x.publicHref)&&e.commitLocation({...x,replace:!0}),()=>{m()}},[e,e.history]),ed(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(x){console.error(x)}})()},[e]),ed(()=>{l&&!r&&e.emit({type:"onLoad",...Wl(e.stores.location.state,e.stores.resolvedLocation.state)})},[l,e,r]),ed(()=>{p&&!f&&e.emit({type:"onBeforeRouteMount",...Wl(e.stores.location.state,e.stores.resolvedLocation.state)})},[f,p,e]),ed(()=>{if(d&&!u){const m=Wl(e.stores.location.state,e.stores.resolvedLocation.state);e.emit({type:"onResolved",...m}),x$(()=>{e.stores.status.setState(()=>"idle"),e.stores.resolvedLocation.setState(()=>e.stores.location.state)}),m.hrefChanged&&cH(e)}},[u,d,e]),null}function EU(){const e=Rn(),t=e.routesById[go].options.pendingComponent??e.options.defaultPendingComponent,n=t?i.jsx(t,{}):null,s=i.jsxs(typeof document<"u"&&e.ssr?Dl:C.Suspense,{fallback:n,children:[i.jsx(CU,{}),i.jsx(RU,{})]});return e.options.InnerWrap?i.jsx(e.options.InnerWrap,{children:s}):s}function RU(){const e=Rn(),t=Vn(e.stores.firstMatchId,r=>r),n=Vn(e.stores.loadedAt,r=>r),s=t?i.jsx(b$,{matchId:t}):null;return i.jsx(Gm.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:i.jsx(v2,{getResetKey:()=>n,errorComponent:b2,onCatch:void 0,children:s})})}var AU=e=>({createMutableStore:aT,createReadonlyStore:aT,batch:x$}),TU=e=>new IU(e),IU=class extends RH{constructor(e){super(e,AU)}};typeof globalThis<"u"?(globalThis.createFileRoute=dT,globalThis.createLazyFileRoute=pT):typeof window<"u"&&(window.createFileRoute=dT,window.createLazyFileRoute=pT);function MU({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=i.jsx(d$.Provider,{value:e,children:t});return e.options.Wrap?i.jsx(e.options.Wrap,{children:s}):s}function OU({router:e,...t}){return i.jsx(MU,{router:e,...t,children:i.jsx(EU,{})})}function va(e){const t=Rn({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,s=C.useRef(void 0);return Vn(n.stores.__store,r=>{if(e!=null&&e.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const a=sa(s.current,e.select(r));return s.current=a,a}return e.select(r)}return r})}var Ao=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},io,Gi,nc,BP,LU=(BP=class extends Ao{constructor(){super();be(this,io);be(this,Gi);be(this,nc);me(this,nc,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Y(this,Gi)||this.setEventListener(Y(this,nc))}onUnsubscribe(){var t;this.hasListeners()||((t=Y(this,Gi))==null||t.call(this),me(this,Gi,void 0))}setEventListener(t){var n;me(this,nc,t),(n=Y(this,Gi))==null||n.call(this),me(this,Gi,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){Y(this,io)!==t&&(me(this,io,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof Y(this,io)=="boolean"?Y(this,io):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},io=new WeakMap,Gi=new WeakMap,nc=new WeakMap,BP),C2=new LU,PU={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ki,h2,FP,$U=(FP=class{constructor(){be(this,Ki,PU);be(this,h2,!1)}setTimeoutProvider(e){me(this,Ki,e)}setTimeout(e,t){return Y(this,Ki).setTimeout(e,t)}clearTimeout(e){Y(this,Ki).clearTimeout(e)}setInterval(e,t){return Y(this,Ki).setInterval(e,t)}clearInterval(e){Y(this,Ki).clearInterval(e)}},Ki=new WeakMap,h2=new WeakMap,FP),Za=new $U;function DU(e){setTimeout(e,0)}var qU=typeof window>"u"||"Deno"in globalThis;function yn(){}function zU(e,t){return typeof e=="function"?e(t):e}function aN(e){return typeof e=="number"&&e>=0&&e!==1/0}function j$(e,t){return Math.max(e+(t||0)-Date.now(),0)}function la(e,t){return typeof e=="function"?e(t):e}function ys(e,t){return typeof e=="function"?e(t):e}function gT(e,t){const{type:n="all",exact:s,fetchStatus:r,predicate:a,queryKey:l,stale:u}=e;if(l){if(s){if(t.queryHash!==E2(l,t.options))return!1}else if(!Sd(t.queryKey,l))return!1}if(n!=="all"){const d=t.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||r&&r!==t.state.fetchStatus||a&&!a(t))}function xT(e,t){const{exact:n,status:s,predicate:r,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(jo(t.options.mutationKey)!==jo(a))return!1}else if(!Sd(t.options.mutationKey,a))return!1}return!(s&&t.state.status!==s||r&&!r(t))}function E2(e,t){return((t==null?void 0:t.queryKeyHashFn)||jo)(e)}function jo(e){return JSON.stringify(e,(t,n)=>oN(n)?Object.keys(n).sort().reduce((s,r)=>(s[r]=n[r],s),{}):n)}function Sd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Sd(e[n],t[n])):!1}var BU=Object.prototype.hasOwnProperty;function R2(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=yT(e)&&yT(t);if(!s&&!(oN(e)&&oN(t)))return t;const a=(s?e:Object.keys(e)).length,l=s?t:Object.keys(t),u=l.length,d=s?new Array(u):{};let f=0;for(let p=0;p<u;p++){const m=s?p:l[p],x=e[m],y=t[m];if(x===y){d[m]=x,(s?p<a:BU.call(e,m))&&f++;continue}if(x===null||y===null||typeof x!="object"||typeof y!="object"){d[m]=y;continue}const v=R2(x,y,n+1);d[m]=v,v===x&&f++}return a===u&&f===a?e:d}function Nd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function yT(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function oN(e){if(!vT(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!vT(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vT(e){return Object.prototype.toString.call(e)==="[object Object]"}function FU(e){return new Promise(t=>{Za.setTimeout(t,e)})}function lN(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?R2(e,t):t}function HU(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function UU(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var A2=Symbol();function S$(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===A2?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function T2(e,t){return typeof e=="function"?e(...t):!!e}function VU(e,t,n){let s=!1,r;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(r??(r=t()),s||(s=!0,r.aborted?n():r.addEventListener("abort",n,{once:!0})),r)}),e}var kd=(()=>{let e=()=>qU;return{isServer(){return e()},setIsServer(t){e=t}}})();function cN(){let e,t;const n=new Promise((r,a)=>{e=r,t=a});n.status="pending",n.catch(()=>{});function s(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{s({status:"fulfilled",value:r}),e(r)},n.reject=r=>{s({status:"rejected",reason:r}),t(r)},n}var GU=DU;function KU(){let e=[],t=0,n=u=>{u()},s=u=>{u()},r=GU;const a=u=>{t?e.push(u):r(()=>{n(u)})},l=()=>{const u=e;e=[],u.length&&r(()=>{s(()=>{u.forEach(d=>{n(d)})})})};return{batch:u=>{let d;t++;try{d=u()}finally{t--,t||l()}return d},batchCalls:u=>(...d)=>{a(()=>{u(...d)})},schedule:a,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{s=u},setScheduler:u=>{r=u}}}var Tt=KU(),sc,Wi,rc,HP,WU=(HP=class extends Ao{constructor(){super();be(this,sc,!0);be(this,Wi);be(this,rc);me(this,rc,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){Y(this,Wi)||this.setEventListener(Y(this,rc))}onUnsubscribe(){var t;this.hasListeners()||((t=Y(this,Wi))==null||t.call(this),me(this,Wi,void 0))}setEventListener(t){var n;me(this,rc,t),(n=Y(this,Wi))==null||n.call(this),me(this,Wi,t(this.setOnline.bind(this)))}setOnline(t){Y(this,sc)!==t&&(me(this,sc,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return Y(this,sc)}},sc=new WeakMap,Wi=new WeakMap,rc=new WeakMap,HP),xm=new WU;function YU(e){return Math.min(1e3*2**e,3e4)}function N$(e){return(e??"online")==="online"?xm.isOnline():!0}var uN=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function k$(e){let t=!1,n=0,s;const r=cN(),a=()=>r.status!=="pending",l=b=>{var w;if(!a()){const S=new uN(b);x(S),(w=e.onCancel)==null||w.call(e,S)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>C2.isFocused()&&(e.networkMode==="always"||xm.isOnline())&&e.canRun(),p=()=>N$(e.networkMode)&&e.canRun(),m=b=>{a()||(s==null||s(),r.resolve(b))},x=b=>{a()||(s==null||s(),r.reject(b))},y=()=>new Promise(b=>{var w;s=S=>{(a()||f())&&b(S)},(w=e.onPause)==null||w.call(e)}).then(()=>{var b;s=void 0,a()||(b=e.onContinue)==null||b.call(e)}),v=()=>{if(a())return;let b;const w=n===0?e.initialPromise:void 0;try{b=w??e.fn()}catch(S){b=Promise.reject(S)}Promise.resolve(b).then(m).catch(S=>{var T;if(a())return;const E=e.retry??(kd.isServer()?0:3),k=e.retryDelay??YU,_=typeof k=="function"?k(n,S):k,R=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,S);if(t||!R){x(S);return}n++,(T=e.onFail)==null||T.call(e,n,S),FU(_).then(()=>f()?void 0:y()).then(()=>{t?x(S):v()})})};return{promise:r,status:()=>r.status,cancel:l,continue:()=>(s==null||s(),r),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?v():y().then(v),r)}}var ao,UP,_$=(UP=class{constructor(){be(this,ao)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),aN(this.gcTime)&&me(this,ao,Za.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(kd.isServer()?1/0:300*1e3))}clearGcTimeout(){Y(this,ao)&&(Za.clearTimeout(Y(this,ao)),me(this,ao,void 0))}},ao=new WeakMap,UP),oo,ic,gs,lo,Jt,Vd,co,ss,C$,qr,VP,QU=(VP=class extends _${constructor(t){super();be(this,ss);be(this,oo);be(this,ic);be(this,gs);be(this,lo);be(this,Jt);be(this,Vd);be(this,co);me(this,co,!1),me(this,Vd,t.defaultOptions),this.setOptions(t.options),this.observers=[],me(this,lo,t.client),me(this,gs,Y(this,lo).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,me(this,oo,wT(this.options)),this.state=t.state??Y(this,oo),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Y(this,Jt))==null?void 0:t.promise}setOptions(t){if(this.options={...Y(this,Vd),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=wT(this.options);n.data!==void 0&&(this.setState(bT(n.data,n.dataUpdatedAt)),me(this,oo,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Y(this,gs).remove(this)}setData(t,n){const s=lN(this.state.data,t,this.options);return Te(this,ss,qr).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){Te(this,ss,qr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,r;const n=(s=Y(this,Jt))==null?void 0:s.promise;return(r=Y(this,Jt))==null||r.cancel(t),n?n.then(yn).catch(yn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return Y(this,oo)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>ys(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A2||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>la(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!j$(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=Y(this,Jt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=Y(this,Jt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Y(this,gs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(Y(this,Jt)&&(Y(this,co)||Te(this,ss,C$).call(this)?Y(this,Jt).cancel({revert:!0}):Y(this,Jt).cancelRetry()),this.scheduleGc()),Y(this,gs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Te(this,ss,qr).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,p,m,x,y,v,b,w,S,E,k;if(this.state.fetchStatus!=="idle"&&((d=Y(this,Jt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Y(this,Jt))return Y(this,Jt).continueRetry(),Y(this,Jt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(R=>R.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,r=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(me(this,co,!0),s.signal)})},a=()=>{const _=S$(this.options,n),T=(()=>{const A={client:Y(this,lo),queryKey:this.queryKey,meta:this.meta};return r(A),A})();return me(this,co,!1),this.options.persister?this.options.persister(_,T,this):_(T)},u=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Y(this,lo),state:this.state,fetchFn:a};return r(_),_})();(f=this.options.behavior)==null||f.onFetch(u,this),me(this,ic,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=u.fetchOptions)==null?void 0:p.meta))&&Te(this,ss,qr).call(this,{type:"fetch",meta:(m=u.fetchOptions)==null?void 0:m.meta}),me(this,Jt,k$({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:_=>{_ instanceof uN&&_.revert&&this.setState({...Y(this,ic),fetchStatus:"idle"}),s.abort()},onFail:(_,R)=>{Te(this,ss,qr).call(this,{type:"failed",failureCount:_,error:R})},onPause:()=>{Te(this,ss,qr).call(this,{type:"pause"})},onContinue:()=>{Te(this,ss,qr).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const _=await Y(this,Jt).start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(y=(x=Y(this,gs).config).onSuccess)==null||y.call(x,_,this),(b=(v=Y(this,gs).config).onSettled)==null||b.call(v,_,this.state.error,this),_}catch(_){if(_ instanceof uN){if(_.silent)return Y(this,Jt).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw Te(this,ss,qr).call(this,{type:"error",error:_}),(S=(w=Y(this,gs).config).onError)==null||S.call(w,_,this),(k=(E=Y(this,gs).config).onSettled)==null||k.call(E,this.state.data,_,this),_}finally{this.scheduleGc()}}},oo=new WeakMap,ic=new WeakMap,gs=new WeakMap,lo=new WeakMap,Jt=new WeakMap,Vd=new WeakMap,co=new WeakMap,ss=new WeakSet,C$=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},qr=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...E$(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...bT(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return me(this,ic,t.manual?r:void 0),r;case"error":const a=t.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),Tt.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),Y(this,gs).notify({query:this,type:"updated",action:t})})},VP);function E$(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:N$(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function bT(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function wT(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var qn,Je,Gd,kn,uo,ac,Br,Yi,Kd,oc,lc,fo,ho,Qi,cc,ot,td,dN,fN,hN,pN,mN,gN,xN,R$,GP,I2=(GP=class extends Ao{constructor(t,n){super();be(this,ot);be(this,qn);be(this,Je);be(this,Gd);be(this,kn);be(this,uo);be(this,ac);be(this,Br);be(this,Yi);be(this,Kd);be(this,oc);be(this,lc);be(this,fo);be(this,ho);be(this,Qi);be(this,cc,new Set);this.options=n,me(this,qn,t),me(this,Yi,null),me(this,Br,cN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Y(this,Je).addObserver(this),jT(Y(this,Je),this.options)?Te(this,ot,td).call(this):this.updateResult(),Te(this,ot,pN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return yN(Y(this,Je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return yN(Y(this,Je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Te(this,ot,mN).call(this),Te(this,ot,gN).call(this),Y(this,Je).removeObserver(this)}setOptions(t){const n=this.options,s=Y(this,Je);if(this.options=Y(this,qn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ys(this.options.enabled,Y(this,Je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Te(this,ot,xN).call(this),Y(this,Je).setOptions(this.options),n._defaulted&&!Nd(this.options,n)&&Y(this,qn).getQueryCache().notify({type:"observerOptionsUpdated",query:Y(this,Je),observer:this});const r=this.hasListeners();r&&ST(Y(this,Je),s,this.options,n)&&Te(this,ot,td).call(this),this.updateResult(),r&&(Y(this,Je)!==s||ys(this.options.enabled,Y(this,Je))!==ys(n.enabled,Y(this,Je))||la(this.options.staleTime,Y(this,Je))!==la(n.staleTime,Y(this,Je)))&&Te(this,ot,dN).call(this);const a=Te(this,ot,fN).call(this);r&&(Y(this,Je)!==s||ys(this.options.enabled,Y(this,Je))!==ys(n.enabled,Y(this,Je))||a!==Y(this,Qi))&&Te(this,ot,hN).call(this,a)}getOptimisticResult(t){const n=Y(this,qn).getQueryCache().build(Y(this,qn),t),s=this.createResult(n,t);return ZU(this,s)&&(me(this,kn,s),me(this,ac,this.options),me(this,uo,Y(this,Je).state)),s}getCurrentResult(){return Y(this,kn)}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n==null||n(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&Y(this,Br).status==="pending"&&Y(this,Br).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){Y(this,cc).add(t)}getCurrentQuery(){return Y(this,Je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=Y(this,qn).defaultQueryOptions(t),s=Y(this,qn).getQueryCache().build(Y(this,qn),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return Te(this,ot,td).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Y(this,kn)))}createResult(t,n){var L;const s=Y(this,Je),r=this.options,a=Y(this,kn),l=Y(this,uo),u=Y(this,ac),f=t!==s?t.state:Y(this,Gd),{state:p}=t;let m={...p},x=!1,y;if(n._optimisticResults){const P=this.hasListeners(),O=!P&&jT(t,n),B=P&&ST(t,s,n,r);(O||B)&&(m={...m,...E$(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:v,errorUpdatedAt:b,status:w}=m;y=m.data;let S=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let P;a!=null&&a.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(P=a.data,S=!0):P=typeof n.placeholderData=="function"?n.placeholderData((L=Y(this,lc))==null?void 0:L.state.data,Y(this,lc)):n.placeholderData,P!==void 0&&(w="success",y=lN(a==null?void 0:a.data,P,n),x=!0)}if(n.select&&y!==void 0&&!S)if(a&&y===(l==null?void 0:l.data)&&n.select===Y(this,Kd))y=Y(this,oc);else try{me(this,Kd,n.select),y=n.select(y),y=lN(a==null?void 0:a.data,y,n),me(this,oc,y),me(this,Yi,null)}catch(P){me(this,Yi,P)}Y(this,Yi)&&(v=Y(this,Yi),y=Y(this,oc),b=Date.now(),w="error");const E=m.fetchStatus==="fetching",k=w==="pending",_=w==="error",R=k&&E,T=y!==void 0,M={status:w,fetchStatus:m.fetchStatus,isPending:k,isSuccess:w==="success",isError:_,isInitialLoading:R,isLoading:R,data:y,dataUpdatedAt:m.dataUpdatedAt,error:v,errorUpdatedAt:b,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:m.dataUpdateCount>f.dataUpdateCount||m.errorUpdateCount>f.errorUpdateCount,isFetching:E,isRefetching:E&&!k,isLoadingError:_&&!T,isPaused:m.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:_&&T,isStale:M2(t,n),refetch:this.refetch,promise:Y(this,Br),isEnabled:ys(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=M.data!==void 0,O=M.status==="error"&&!P,B=W=>{O?W.reject(M.error):P&&W.resolve(M.data)},H=()=>{const W=me(this,Br,M.promise=cN());B(W)},z=Y(this,Br);switch(z.status){case"pending":t.queryHash===s.queryHash&&B(z);break;case"fulfilled":(O||M.data!==z.value)&&H();break;case"rejected":(!O||M.error!==z.reason)&&H();break}}return M}updateResult(){const t=Y(this,kn),n=this.createResult(Y(this,Je),this.options);if(me(this,uo,Y(this,Je).state),me(this,ac,this.options),Y(this,uo).data!==void 0&&me(this,lc,Y(this,Je)),Nd(n,t))return;me(this,kn,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,a=typeof r=="function"?r():r;if(a==="all"||!a&&!Y(this,cc).size)return!0;const l=new Set(a??Y(this,cc));return this.options.throwOnError&&l.add("error"),Object.keys(Y(this,kn)).some(u=>{const d=u;return Y(this,kn)[d]!==t[d]&&l.has(d)})};Te(this,ot,R$).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Te(this,ot,pN).call(this)}},qn=new WeakMap,Je=new WeakMap,Gd=new WeakMap,kn=new WeakMap,uo=new WeakMap,ac=new WeakMap,Br=new WeakMap,Yi=new WeakMap,Kd=new WeakMap,oc=new WeakMap,lc=new WeakMap,fo=new WeakMap,ho=new WeakMap,Qi=new WeakMap,cc=new WeakMap,ot=new WeakSet,td=function(t){Te(this,ot,xN).call(this);let n=Y(this,Je).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(yn)),n},dN=function(){Te(this,ot,mN).call(this);const t=la(this.options.staleTime,Y(this,Je));if(kd.isServer()||Y(this,kn).isStale||!aN(t))return;const s=j$(Y(this,kn).dataUpdatedAt,t)+1;me(this,fo,Za.setTimeout(()=>{Y(this,kn).isStale||this.updateResult()},s))},fN=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Y(this,Je)):this.options.refetchInterval)??!1},hN=function(t){Te(this,ot,gN).call(this),me(this,Qi,t),!(kd.isServer()||ys(this.options.enabled,Y(this,Je))===!1||!aN(Y(this,Qi))||Y(this,Qi)===0)&&me(this,ho,Za.setInterval(()=>{(this.options.refetchIntervalInBackground||C2.isFocused())&&Te(this,ot,td).call(this)},Y(this,Qi)))},pN=function(){Te(this,ot,dN).call(this),Te(this,ot,hN).call(this,Te(this,ot,fN).call(this))},mN=function(){Y(this,fo)&&(Za.clearTimeout(Y(this,fo)),me(this,fo,void 0))},gN=function(){Y(this,ho)&&(Za.clearInterval(Y(this,ho)),me(this,ho,void 0))},xN=function(){const t=Y(this,qn).getQueryCache().build(Y(this,qn),this.options);if(t===Y(this,Je))return;const n=Y(this,Je);me(this,Je,t),me(this,Gd,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},R$=function(t){Tt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(Y(this,kn))}),Y(this,qn).getQueryCache().notify({query:Y(this,Je),type:"observerResultsUpdated"})})},GP);function XU(e,t){return ys(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function jT(e,t){return XU(e,t)||e.state.data!==void 0&&yN(e,t,t.refetchOnMount)}function yN(e,t,n){if(ys(t.enabled,e)!==!1&&la(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&M2(e,t)}return!1}function ST(e,t,n,s){return(e!==t||ys(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&M2(e,n)}function M2(e,t){return ys(t.enabled,e)!==!1&&e.isStaleByTime(la(t.staleTime,e))}function ZU(e,t){return!Nd(e.getCurrentResult(),t)}function NT(e){return{onFetch:(t,n)=>{var p,m,x,y,v;const s=t.options,r=(x=(m=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:m.fetchMore)==null?void 0:x.direction,a=((y=t.state.data)==null?void 0:y.pages)||[],l=((v=t.state.data)==null?void 0:v.pageParams)||[];let u={pages:[],pageParams:[]},d=0;const f=async()=>{let b=!1;const w=k=>{VU(k,()=>t.signal,()=>b=!0)},S=S$(t.options,t.fetchOptions),E=async(k,_,R)=>{if(b)return Promise.reject();if(_==null&&k.pages.length)return Promise.resolve(k);const A=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:_,direction:R?"backward":"forward",meta:t.options.meta};return w(O),O})(),M=await S(A),{maxPages:L}=t.options,P=R?UU:HU;return{pages:P(k.pages,M,L),pageParams:P(k.pageParams,_,L)}};if(r&&a.length){const k=r==="backward",_=k?JU:kT,R={pages:a,pageParams:l},T=_(s,R);u=await E(R,T,k)}else{const k=e??a.length;do{const _=d===0?l[0]??s.initialPageParam:kT(s,u);if(d>0&&_==null)break;u=await E(u,_),d++}while(d<k)}return u};t.options.persister?t.fetchFn=()=>{var b,w;return(w=(b=t.options).persister)==null?void 0:w.call(b,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function kT(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function JU(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var Wd,er,gn,po,tr,Bi,KP,eV=(KP=class extends _${constructor(t){super();be(this,tr);be(this,Wd);be(this,er);be(this,gn);be(this,po);me(this,Wd,t.client),this.mutationId=t.mutationId,me(this,gn,t.mutationCache),me(this,er,[]),this.state=t.state||A$(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Y(this,er).includes(t)||(Y(this,er).push(t),this.clearGcTimeout(),Y(this,gn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){me(this,er,Y(this,er).filter(n=>n!==t)),this.scheduleGc(),Y(this,gn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Y(this,er).length||(this.state.status==="pending"?this.scheduleGc():Y(this,gn).remove(this))}continue(){var t;return((t=Y(this,po))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,u,d,f,p,m,x,y,v,b,w,S,E,k,_,R,T,A;const n=()=>{Te(this,tr,Bi).call(this,{type:"continue"})},s={client:Y(this,Wd),meta:this.options.meta,mutationKey:this.options.mutationKey};me(this,po,k$({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(M,L)=>{Te(this,tr,Bi).call(this,{type:"failed",failureCount:M,error:L})},onPause:()=>{Te(this,tr,Bi).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Y(this,gn).canRun(this)}));const r=this.state.status==="pending",a=!Y(this,po).canStart();try{if(r)n();else{Te(this,tr,Bi).call(this,{type:"pending",variables:t,isPaused:a}),Y(this,gn).config.onMutate&&await Y(this,gn).config.onMutate(t,this,s);const L=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,s));L!==this.state.context&&Te(this,tr,Bi).call(this,{type:"pending",context:L,variables:t,isPaused:a})}const M=await Y(this,po).start();return await((f=(d=Y(this,gn).config).onSuccess)==null?void 0:f.call(d,M,t,this.state.context,this,s)),await((m=(p=this.options).onSuccess)==null?void 0:m.call(p,M,t,this.state.context,s)),await((y=(x=Y(this,gn).config).onSettled)==null?void 0:y.call(x,M,null,this.state.variables,this.state.context,this,s)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,M,null,t,this.state.context,s)),Te(this,tr,Bi).call(this,{type:"success",data:M}),M}catch(M){try{await((S=(w=Y(this,gn).config).onError)==null?void 0:S.call(w,M,t,this.state.context,this,s))}catch(L){Promise.reject(L)}try{await((k=(E=this.options).onError)==null?void 0:k.call(E,M,t,this.state.context,s))}catch(L){Promise.reject(L)}try{await((R=(_=Y(this,gn).config).onSettled)==null?void 0:R.call(_,void 0,M,this.state.variables,this.state.context,this,s))}catch(L){Promise.reject(L)}try{await((A=(T=this.options).onSettled)==null?void 0:A.call(T,void 0,M,t,this.state.context,s))}catch(L){Promise.reject(L)}throw Te(this,tr,Bi).call(this,{type:"error",error:M}),M}finally{Y(this,gn).runNext(this)}}},Wd=new WeakMap,er=new WeakMap,gn=new WeakMap,po=new WeakMap,tr=new WeakSet,Bi=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Tt.batch(()=>{Y(this,er).forEach(s=>{s.onMutationUpdate(t)}),Y(this,gn).notify({mutation:this,type:"updated",action:t})})},KP);function A$(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fr,Os,Yd,WP,tV=(WP=class extends Ao{constructor(t={}){super();be(this,Fr);be(this,Os);be(this,Yd);this.config=t,me(this,Fr,new Set),me(this,Os,new Map),me(this,Yd,0)}build(t,n,s){const r=new eV({client:t,mutationCache:this,mutationId:++Zh(this,Yd)._,options:t.defaultMutationOptions(n),state:s});return this.add(r),r}add(t){Y(this,Fr).add(t);const n=np(t);if(typeof n=="string"){const s=Y(this,Os).get(n);s?s.push(t):Y(this,Os).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Y(this,Fr).delete(t)){const n=np(t);if(typeof n=="string"){const s=Y(this,Os).get(n);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&Y(this,Os).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=np(t);if(typeof n=="string"){const s=Y(this,Os).get(n),r=s==null?void 0:s.find(a=>a.state.status==="pending");return!r||r===t}else return!0}runNext(t){var s;const n=np(t);if(typeof n=="string"){const r=(s=Y(this,Os).get(n))==null?void 0:s.find(a=>a!==t&&a.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Tt.batch(()=>{Y(this,Fr).forEach(t=>{this.notify({type:"removed",mutation:t})}),Y(this,Fr).clear(),Y(this,Os).clear()})}getAll(){return Array.from(Y(this,Fr))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>xT(n,s))}findAll(t={}){return this.getAll().filter(n=>xT(t,n))}notify(t){Tt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Tt.batch(()=>Promise.all(t.map(n=>n.continue().catch(yn))))}},Fr=new WeakMap,Os=new WeakMap,Yd=new WeakMap,WP);function np(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Hr,Xi,zn,Ur,Qr,Yp,vN,YP,nV=(YP=class extends Ao{constructor(n,s){super();be(this,Qr);be(this,Hr);be(this,Xi);be(this,zn);be(this,Ur);me(this,Hr,n),this.setOptions(s),this.bindMethods(),Te(this,Qr,Yp).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var r;const s=this.options;this.options=Y(this,Hr).defaultMutationOptions(n),Nd(this.options,s)||Y(this,Hr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Y(this,zn),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&jo(s.mutationKey)!==jo(this.options.mutationKey)?this.reset():((r=Y(this,zn))==null?void 0:r.state.status)==="pending"&&Y(this,zn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Y(this,zn))==null||n.removeObserver(this)}onMutationUpdate(n){Te(this,Qr,Yp).call(this),Te(this,Qr,vN).call(this,n)}getCurrentResult(){return Y(this,Xi)}reset(){var n;(n=Y(this,zn))==null||n.removeObserver(this),me(this,zn,void 0),Te(this,Qr,Yp).call(this),Te(this,Qr,vN).call(this)}mutate(n,s){var r;return me(this,Ur,s),(r=Y(this,zn))==null||r.removeObserver(this),me(this,zn,Y(this,Hr).getMutationCache().build(Y(this,Hr),this.options)),Y(this,zn).addObserver(this),Y(this,zn).execute(n)}},Hr=new WeakMap,Xi=new WeakMap,zn=new WeakMap,Ur=new WeakMap,Qr=new WeakSet,Yp=function(){var s;const n=((s=Y(this,zn))==null?void 0:s.state)??A$();me(this,Xi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},vN=function(n){Tt.batch(()=>{var s,r,a,l,u,d,f,p;if(Y(this,Ur)&&this.hasListeners()){const m=Y(this,Xi).variables,x=Y(this,Xi).context,y={client:Y(this,Hr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(r=(s=Y(this,Ur)).onSuccess)==null||r.call(s,n.data,m,x,y)}catch(v){Promise.reject(v)}try{(l=(a=Y(this,Ur)).onSettled)==null||l.call(a,n.data,null,m,x,y)}catch(v){Promise.reject(v)}}else if((n==null?void 0:n.type)==="error"){try{(d=(u=Y(this,Ur)).onError)==null||d.call(u,n.error,m,x,y)}catch(v){Promise.reject(v)}try{(p=(f=Y(this,Ur)).onSettled)==null||p.call(f,void 0,n.error,m,x,y)}catch(v){Promise.reject(v)}}}this.listeners.forEach(m=>{m(Y(this,Xi))})})},YP);function _T(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function sV(e,t,n){const s=e.slice(0);return s[t]=n,s}var uc,ns,dc,fc,xs,Zi,Qd,Xd,Zd,Jd,un,bN,wN,jN,SN,NN,QP,rV=(QP=class extends Ao{constructor(t,n,s){super();be(this,un);be(this,uc);be(this,ns);be(this,dc);be(this,fc);be(this,xs);be(this,Zi);be(this,Qd);be(this,Xd);be(this,Zd);be(this,Jd,[]);me(this,uc,t),me(this,fc,s),me(this,dc,[]),me(this,xs,[]),me(this,ns,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&Y(this,xs).forEach(t=>{t.subscribe(n=>{Te(this,un,SN).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,Y(this,xs).forEach(t=>{t.destroy()})}setQueries(t,n){me(this,dc,t),me(this,fc,n),Tt.batch(()=>{const s=Y(this,xs),r=Te(this,un,jN).call(this,Y(this,dc));r.forEach(m=>m.observer.setOptions(m.defaultedQueryOptions));const a=r.map(m=>m.observer),l=a.map(m=>m.getCurrentResult()),u=s.length!==a.length,d=a.some((m,x)=>m!==s[x]),f=u||d,p=f?!0:l.some((m,x)=>{const y=Y(this,ns)[x];return!y||!Nd(m,y)});!f&&!p||(f&&(me(this,Jd,r),me(this,xs,a)),me(this,ns,l),this.hasListeners()&&(f&&(_T(s,a).forEach(m=>{m.destroy()}),_T(a,s).forEach(m=>{m.subscribe(x=>{Te(this,un,SN).call(this,m,x)})})),Te(this,un,NN).call(this)))})}getCurrentResult(){return Y(this,ns)}getQueries(){return Y(this,xs).map(t=>t.getCurrentQuery())}getObservers(){return Y(this,xs)}getOptimisticResult(t,n){const s=Te(this,un,jN).call(this,t),r=s.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),a=s.map(l=>l.defaultedQueryOptions.queryHash);return[r,l=>Te(this,un,wN).call(this,l??r,n,a),()=>Te(this,un,bN).call(this,r,s)]}},uc=new WeakMap,ns=new WeakMap,dc=new WeakMap,fc=new WeakMap,xs=new WeakMap,Zi=new WeakMap,Qd=new WeakMap,Xd=new WeakMap,Zd=new WeakMap,Jd=new WeakMap,un=new WeakSet,bN=function(t,n){return n.map((s,r)=>{const a=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?a:s.observer.trackResult(a,l=>{n.forEach(u=>{u.observer.trackProp(l)})})})},wN=function(t,n,s){if(n){const r=Y(this,Zd),a=s!==void 0&&r!==void 0&&(r.length!==s.length||s.some((l,u)=>l!==r[u]));return(!Y(this,Zi)||Y(this,ns)!==Y(this,Xd)||a||n!==Y(this,Qd))&&(me(this,Qd,n),me(this,Xd,Y(this,ns)),s!==void 0&&me(this,Zd,s),me(this,Zi,R2(Y(this,Zi),n(t)))),Y(this,Zi)}return t},jN=function(t){const n=new Map;Y(this,xs).forEach(r=>{const a=r.options.queryHash;if(!a)return;const l=n.get(a);l?l.push(r):n.set(a,[r])});const s=[];return t.forEach(r=>{var d;const a=Y(this,uc).defaultQueryOptions(r),u=((d=n.get(a.queryHash))==null?void 0:d.shift())??new I2(Y(this,uc),a);s.push({defaultedQueryOptions:a,observer:u})}),s},SN=function(t,n){const s=Y(this,xs).indexOf(t);s!==-1&&(me(this,ns,sV(Y(this,ns),s,n)),Te(this,un,NN).call(this))},NN=function(){var t;if(this.hasListeners()){const n=Y(this,Zi),s=Te(this,un,bN).call(this,Y(this,ns),Y(this,Jd)),r=Te(this,un,wN).call(this,s,(t=Y(this,fc))==null?void 0:t.combine);n!==r&&Tt.batch(()=>{this.listeners.forEach(a=>{a(Y(this,ns))})})}},QP),nr,XP,iV=(XP=class extends Ao{constructor(t={}){super();be(this,nr);this.config=t,me(this,nr,new Map)}build(t,n,s){const r=n.queryKey,a=n.queryHash??E2(r,n);let l=this.get(a);return l||(l=new QU({client:t,queryKey:r,queryHash:a,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(l)),l}add(t){Y(this,nr).has(t.queryHash)||(Y(this,nr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=Y(this,nr).get(t.queryHash);n&&(t.destroy(),n===t&&Y(this,nr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Tt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Y(this,nr).get(t)}getAll(){return[...Y(this,nr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>gT(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>gT(t,s)):n}notify(t){Tt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Tt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Tt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nr=new WeakMap,XP),At,Ji,ea,hc,pc,ta,mc,gc,ZP,aV=(ZP=class{constructor(e={}){be(this,At);be(this,Ji);be(this,ea);be(this,hc);be(this,pc);be(this,ta);be(this,mc);be(this,gc);me(this,At,e.queryCache||new iV),me(this,Ji,e.mutationCache||new tV),me(this,ea,e.defaultOptions||{}),me(this,hc,new Map),me(this,pc,new Map),me(this,ta,0)}mount(){Zh(this,ta)._++,Y(this,ta)===1&&(me(this,mc,C2.subscribe(async e=>{e&&(await this.resumePausedMutations(),Y(this,At).onFocus())})),me(this,gc,xm.subscribe(async e=>{e&&(await this.resumePausedMutations(),Y(this,At).onOnline())})))}unmount(){var e,t;Zh(this,ta)._--,Y(this,ta)===0&&((e=Y(this,mc))==null||e.call(this),me(this,mc,void 0),(t=Y(this,gc))==null||t.call(this),me(this,gc,void 0))}isFetching(e){return Y(this,At).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Y(this,Ji).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Y(this,At).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=Y(this,At).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(la(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return Y(this,At).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),r=Y(this,At).get(s.queryHash),a=r==null?void 0:r.state.data,l=zU(t,a);if(l!==void 0)return Y(this,At).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return Tt.batch(()=>Y(this,At).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Y(this,At).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=Y(this,At);Tt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=Y(this,At);return Tt.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=Tt.batch(()=>Y(this,At).findAll(e).map(r=>r.cancel(n)));return Promise.all(s).then(yn).catch(yn)}invalidateQueries(e,t={}){return Tt.batch(()=>(Y(this,At).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=Tt.batch(()=>Y(this,At).findAll(e).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let a=r.fetch(void 0,n);return n.throwOnError||(a=a.catch(yn)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(yn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=Y(this,At).build(this,t);return n.isStaleByTime(la(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(yn).catch(yn)}fetchInfiniteQuery(e){return e.behavior=NT(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(yn).catch(yn)}ensureInfiniteQueryData(e){return e.behavior=NT(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xm.isOnline()?Y(this,Ji).resumePausedMutations():Promise.resolve()}getQueryCache(){return Y(this,At)}getMutationCache(){return Y(this,Ji)}getDefaultOptions(){return Y(this,ea)}setDefaultOptions(e){me(this,ea,e)}setQueryDefaults(e,t){Y(this,hc).set(jo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Y(this,hc).values()],n={};return t.forEach(s=>{Sd(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){Y(this,pc).set(jo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Y(this,pc).values()],n={};return t.forEach(s=>{Sd(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Y(this,ea).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=E2(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===A2&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Y(this,ea).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Y(this,At).clear(),Y(this,Ji).clear()}},At=new WeakMap,Ji=new WeakMap,ea=new WeakMap,hc=new WeakMap,pc=new WeakMap,ta=new WeakMap,mc=new WeakMap,gc=new WeakMap,ZP),T$=C.createContext(void 0),Mt=e=>{const t=C.useContext(T$);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},oV=({client:e,children:t})=>(C.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(T$.Provider,{value:e,children:t})),I$=C.createContext(!1),M$=()=>C.useContext(I$);I$.Provider;function lV(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var cV=C.createContext(lV()),O$=()=>C.useContext(cV),L$=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?T2(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},P$=e=>{C.useEffect(()=>{e.clearReset()},[e])},$$=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||T2(n,[e.error,s])),D$=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},uV=(e,t)=>e.isLoading&&e.isFetching&&!t,kN=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,_N=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function tf({queries:e,...t},n){const s=Mt(),r=M$(),a=O$(),l=C.useMemo(()=>e.map(b=>{const w=s.defaultQueryOptions(b);return w._optimisticResults=r?"isRestoring":"optimistic",w}),[e,s,r]);l.forEach(b=>{D$(b);const w=s.getQueryCache().get(b.queryHash);L$(b,a,w)}),P$(a);const[u]=C.useState(()=>new rV(s,l,t)),[d,f,p]=u.getOptimisticResult(l,t.combine),m=!r&&t.subscribed!==!1;C.useSyncExternalStore(C.useCallback(b=>m?u.subscribe(Tt.batchCalls(b)):yn,[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),C.useEffect(()=>{u.setQueries(l,t)},[l,t,u]);const y=d.some((b,w)=>kN(l[w],b))?d.flatMap((b,w)=>{const S=l[w];if(S&&kN(S,b)){const E=new I2(s,S);return _N(S,E,a)}return[]}):[];if(y.length>0)throw Promise.all(y);const v=d.find((b,w)=>{const S=l[w];return S&&$$({result:b,errorResetBoundary:a,throwOnError:S.throwOnError,query:s.getQueryCache().get(S.queryHash),suspense:S.suspense})});if(v!=null&&v.error)throw v.error;return f(p())}function dV(e,t,n){var x,y,v,b;const s=M$(),r=O$(),a=Mt(),l=a.defaultQueryOptions(e);(y=(x=a.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||y.call(x,l);const u=a.getQueryCache().get(l.queryHash);l._optimisticResults=s?"isRestoring":"optimistic",D$(l),L$(l,r,u),P$(r);const d=!a.getQueryCache().get(l.queryHash),[f]=C.useState(()=>new t(a,l)),p=f.getOptimisticResult(l),m=!s&&e.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(w=>{const S=m?f.subscribe(Tt.batchCalls(w)):yn;return f.updateResult(),S},[f,m]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),C.useEffect(()=>{f.setOptions(l)},[l,f]),kN(l,p))throw _N(l,f,r);if($$({result:p,errorResetBoundary:r,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw p.error;if((b=(v=a.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||b.call(v,l,p),l.experimental_prefetchInRender&&!kd.isServer()&&uV(p,s)){const w=d?_N(l,f,r):u==null?void 0:u.promise;w==null||w.catch(yn).finally(()=>{f.updateResult()})}return l.notifyOnChangeProps?p:f.trackResult(p)}function qe(e,t){return dV(e,I2)}function en(e,t){const n=Mt(),[s]=C.useState(()=>new nV(n,e));C.useEffect(()=>{s.setOptions(e)},[s,e]);const r=C.useSyncExternalStore(C.useCallback(l=>s.subscribe(Tt.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=C.useCallback((l,u)=>{s.mutate(l,u).catch(yn)},[s]);if(r.error&&T2(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const fV=new aV({defaultOptions:{queries:{staleTime:5e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});/**
66
+ * @license lucide-react v1.6.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const q$=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
71
+ * @license lucide-react v1.6.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const hV=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
76
+ * @license lucide-react v1.6.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const pV=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
81
+ * @license lucide-react v1.6.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const CT=e=>{const t=pV(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
86
+ * @license lucide-react v1.6.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */var Uy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
91
+ * @license lucide-react v1.6.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const mV=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},gV=C.createContext({}),xV=()=>C.useContext(gV),yV=C.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:a,iconNode:l,...u},d)=>{const{size:f=24,strokeWidth:p=2,absoluteStrokeWidth:m=!1,color:x="currentColor",className:y=""}=xV()??{},v=s??m?Number(n??p)*24/Number(t??f):n??p;return C.createElement("svg",{ref:d,...Uy,width:t??f??Uy.width,height:t??f??Uy.height,stroke:e??x,strokeWidth:v,className:q$("lucide",y,r),...!a&&!mV(u)&&{"aria-hidden":"true"},...u},[...l.map(([b,w])=>C.createElement(b,w)),...Array.isArray(a)?a:[a]])});/**
96
+ * @license lucide-react v1.6.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const ze=(e,t)=>{const n=C.forwardRef(({className:s,...r},a)=>C.createElement(yV,{ref:a,iconNode:t,className:q$(`lucide-${hV(CT(e))}`,`lucide-${e}`,s),...r}));return n.displayName=CT(e),n};/**
101
+ * @license lucide-react v1.6.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const vV=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],bV=ze("archive",vV);/**
106
+ * @license lucide-react v1.6.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const wV=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ym=ze("arrow-right",wV);/**
111
+ * @license lucide-react v1.6.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const jV=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],SV=ze("arrow-up-right",jV);/**
116
+ * @license lucide-react v1.6.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const NV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],z$=ze("ban",NV);/**
121
+ * @license lucide-react v1.6.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const kV=[["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"}]],_V=ze("bot",kV);/**
126
+ * @license lucide-react v1.6.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const CV=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],EV=ze("brain",CV);/**
131
+ * @license lucide-react v1.6.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const RV=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],O2=ze("calendar-days",RV);/**
136
+ * @license lucide-react v1.6.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const AV=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Xr=ze("chevron-down",AV);/**
141
+ * @license lucide-react v1.6.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const TV=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],IV=ze("chevron-left",TV);/**
146
+ * @license lucide-react v1.6.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const MV=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Bs=ze("chevron-right",MV);/**
151
+ * @license lucide-react v1.6.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const OV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ha=ze("circle-alert",OV);/**
156
+ * @license lucide-react v1.6.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const LV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_d=ze("circle-check",LV);/**
161
+ * @license lucide-react v1.6.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const PV=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$V=ze("circle-play",PV);/**
166
+ * @license lucide-react v1.6.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const DV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],B$=ze("circle-plus",DV);/**
171
+ * @license lucide-react v1.6.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const qV=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],CN=ze("clipboard-check",qV);/**
176
+ * @license lucide-react v1.6.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const zV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Cd=ze("clock",zV);/**
181
+ * @license lucide-react v1.6.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const BV=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],F$=ze("cog",BV);/**
186
+ * @license lucide-react v1.6.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const FV=[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],HV=ze("file-image",FV);/**
191
+ * @license lucide-react v1.6.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const UV=[["path",{d:"M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z",key:"ukzhwg"}],["path",{d:"M14.487 7.858A1 1 0 0 1 14 7V2",key:"1klhew"}],["path",{d:"M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516",key:"rxaxab"}],["path",{d:"M8 18h1",key:"13wk12"}]],VV=ze("file-pen-line",UV);/**
196
+ * @license lucide-react v1.6.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const GV=[["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 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],H$=ze("file-text",GV);/**
201
+ * @license lucide-react v1.6.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const KV=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],L2=ze("folder",KV);/**
206
+ * @license lucide-react v1.6.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const WV=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],YV=ze("git-branch",WV);/**
211
+ * @license lucide-react v1.6.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const QV=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],XV=ze("globe",QV);/**
216
+ * @license lucide-react v1.6.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const ZV=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Yl=ze("history",ZV);/**
221
+ * @license lucide-react v1.6.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const JV=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],U$=ze("inbox",JV);/**
226
+ * @license lucide-react v1.6.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const eG=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],tG=ze("layout-dashboard",eG);/**
231
+ * @license lucide-react v1.6.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const nG=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],sG=ze("maximize-2",nG);/**
236
+ * @license lucide-react v1.6.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const rG=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],Ym=ze("message-square-text",rG);/**
241
+ * @license lucide-react v1.6.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const iG=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],aG=ze("minimize-2",iG);/**
246
+ * @license lucide-react v1.6.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const oG=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],P2=ze("network",oG);/**
251
+ * @license lucide-react v1.6.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const lG=[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16 17 2 2 4-4",key:"uh5qu3"}],["path",{d:"M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753",key:"kpkbpo"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]],$2=ze("package-check",lG);/**
256
+ * @license lucide-react v1.6.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const cG=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],uG=ze("pause",cG);/**
261
+ * @license lucide-react v1.6.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const dG=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],fG=ze("refresh-cw",dG);/**
266
+ * @license lucide-react v1.6.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const hG=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],pG=ze("rotate-ccw",hG);/**
271
+ * @license lucide-react v1.6.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const mG=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],V$=ze("route",mG);/**
276
+ * @license lucide-react v1.6.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const gG=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],xG=ze("search",gG);/**
281
+ * @license lucide-react v1.6.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const yG=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Qm=ze("send",yG);/**
286
+ * @license lucide-react v1.6.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const vG=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],bG=ze("server-cog",vG);/**
291
+ * @license lucide-react v1.6.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const wG=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],jG=ze("shield-x",wG);/**
296
+ * @license lucide-react v1.6.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const SG=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],D2=ze("sparkles",SG);/**
301
+ * @license lucide-react v1.6.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const NG=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],kG=ze("trash-2",NG);/**
306
+ * @license lucide-react v1.6.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const _G=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],G$=ze("user-check",_G);/**
311
+ * @license lucide-react v1.6.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const CG=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],EG=ze("user-round",CG);/**
316
+ * @license lucide-react v1.6.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const RG=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],AG=ze("wrench",RG);/**
321
+ * @license lucide-react v1.6.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const TG=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],q2=ze("x",TG);async function IG(){const e=await fetch("/api/rigs/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function dr(){return qe({queryKey:["rigs","summary"],queryFn:IG})}async function MG(){const e=await fetch("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function Xm(){return qe({queryKey:["ps"],queryFn:MG,refetchInterval:3e3})}function K$(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=K$(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function W$(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=K$(e))&&(s&&(s+=" "),s+=t);return s}const OG=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},LG=(e,t)=>({classGroupId:e,validator:t}),Y$=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),vm="-",ET=[],PG="arbitrary..",$G=e=>{const t=qG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return DG(l);const u=l.split(vm),d=u[0]===""&&u.length>1?1:0;return Q$(u,d,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const d=s[l],f=n[l];return d?f?OG(f,d):d:f||ET}return n[l]||ET}}},Q$=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],a=n.nextPart.get(r);if(a){const f=Q$(e,t+1,a);if(f)return f}const l=n.validators;if(l===null)return;const u=t===0?e.join(vm):e.slice(t).join(vm),d=l.length;for(let f=0;f<d;f++){const p=l[f];if(p.validator(u))return p.classGroupId}},DG=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?PG+s:void 0})(),qG=e=>{const{theme:t,classGroups:n}=e;return zG(n,t)},zG=(e,t)=>{const n=Y$();for(const s in e){const r=e[s];z2(r,n,s,t)}return n},z2=(e,t,n,s)=>{const r=e.length;for(let a=0;a<r;a++){const l=e[a];BG(l,t,n,s)}},BG=(e,t,n,s)=>{if(typeof e=="string"){FG(e,t,n);return}if(typeof e=="function"){HG(e,t,n,s);return}UG(e,t,n,s)},FG=(e,t,n)=>{const s=e===""?t:X$(t,e);s.classGroupId=n},HG=(e,t,n,s)=>{if(VG(e)){z2(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(LG(n,e))},UG=(e,t,n,s)=>{const r=Object.entries(e),a=r.length;for(let l=0;l<a;l++){const[u,d]=r[l];z2(d,X$(t,u),n,s)}},X$=(e,t)=>{let n=e;const s=t.split(vm),r=s.length;for(let a=0;a<r;a++){const l=s[a];let u=n.nextPart.get(l);u||(u=Y$(),n.nextPart.set(l,u)),n=u}return n},VG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GG=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const r=(a,l)=>{n[a]=l,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=s[a])!==void 0)return r(a,l),l},set(a,l){a in n?n[a]=l:r(a,l)}}},EN="!",RT=":",KG=[],AT=(e,t,n,s,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:r}),WG=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=r=>{const a=[];let l=0,u=0,d=0,f;const p=r.length;for(let b=0;b<p;b++){const w=r[b];if(l===0&&u===0){if(w===RT){a.push(r.slice(d,b)),d=b+1;continue}if(w==="/"){f=b;continue}}w==="["?l++:w==="]"?l--:w==="("?u++:w===")"&&u--}const m=a.length===0?r:r.slice(d);let x=m,y=!1;m.endsWith(EN)?(x=m.slice(0,-1),y=!0):m.startsWith(EN)&&(x=m.slice(1),y=!0);const v=f&&f>d?f-d:void 0;return AT(a,y,x,v)};if(t){const r=t+RT,a=s;s=l=>l.startsWith(r)?a(l.slice(r.length)):AT(KG,!1,l,void 0,!0)}if(n){const r=s;s=a=>n({className:a,parseClassName:r})}return s},YG=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let r=[];for(let a=0;a<n.length;a++){const l=n[a],u=l[0]==="[",d=t.has(l);u||d?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(l)):r.push(l)}return r.length>0&&(r.sort(),s.push(...r)),s}},QG=e=>({cache:GG(e.cacheSize),parseClassName:WG(e),sortModifiers:YG(e),...$G(e)}),XG=/\s+/,ZG=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:a}=t,l=[],u=e.trim().split(XG);let d="";for(let f=u.length-1;f>=0;f-=1){const p=u[f],{isExternal:m,modifiers:x,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:b}=n(p);if(m){d=p+(d.length>0?" "+d:d);continue}let w=!!b,S=s(w?v.substring(0,b):v);if(!S){if(!w){d=p+(d.length>0?" "+d:d);continue}if(S=s(v),!S){d=p+(d.length>0?" "+d:d);continue}w=!1}const E=x.length===0?"":x.length===1?x[0]:a(x).join(":"),k=y?E+EN:E,_=k+S;if(l.indexOf(_)>-1)continue;l.push(_);const R=r(S,w);for(let T=0;T<R.length;++T){const A=R[T];l.push(k+A)}d=p+(d.length>0?" "+d:d)}return d},JG=(...e)=>{let t=0,n,s,r="";for(;t<e.length;)(n=e[t++])&&(s=Z$(n))&&(r&&(r+=" "),r+=s);return r},Z$=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Z$(e[s]))&&(n&&(n+=" "),n+=t);return n},eK=(e,...t)=>{let n,s,r,a;const l=d=>{const f=t.reduce((p,m)=>m(p),e());return n=QG(f),s=n.cache.get,r=n.cache.set,a=u,u(d)},u=d=>{const f=s(d);if(f)return f;const p=ZG(d,n);return r(d,p),p};return a=l,(...d)=>a(JG(...d))},tK=[],Qt=e=>{const t=n=>n[e]||tK;return t.isThemeGetter=!0,t},J$=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eD=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nK=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,sK=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,iK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oi=e=>nK.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),Li=e=>!!e&&Number.isInteger(Number(e)),Vy=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),Pr=e=>sK.test(e),tD=()=>!0,lK=e=>rK.test(e)&&!iK.test(e),B2=()=>!1,cK=e=>aK.test(e),uK=e=>oK.test(e),dK=e=>!Se(e)&&!ke(e),fK=e=>ba(e,rD,B2),Se=e=>J$.test(e),Ga=e=>ba(e,iD,lK),TT=e=>ba(e,bK,Ke),hK=e=>ba(e,oD,tD),pK=e=>ba(e,aD,B2),IT=e=>ba(e,nD,B2),mK=e=>ba(e,sD,uK),sp=e=>ba(e,lD,cK),ke=e=>eD.test(e),qu=e=>To(e,iD),gK=e=>To(e,aD),MT=e=>To(e,nD),xK=e=>To(e,rD),yK=e=>To(e,sD),rp=e=>To(e,lD,!0),vK=e=>To(e,oD,!0),ba=(e,t,n)=>{const s=J$.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},To=(e,t,n=!1)=>{const s=eD.exec(e);return s?s[1]?t(s[1]):n:!1},nD=e=>e==="position"||e==="percentage",sD=e=>e==="image"||e==="url",rD=e=>e==="length"||e==="size"||e==="bg-size",iD=e=>e==="length",bK=e=>e==="number",aD=e=>e==="family-name",oD=e=>e==="number"||e==="weight",lD=e=>e==="shadow",wK=()=>{const e=Qt("color"),t=Qt("font"),n=Qt("text"),s=Qt("font-weight"),r=Qt("tracking"),a=Qt("leading"),l=Qt("breakpoint"),u=Qt("container"),d=Qt("spacing"),f=Qt("radius"),p=Qt("shadow"),m=Qt("inset-shadow"),x=Qt("text-shadow"),y=Qt("drop-shadow"),v=Qt("blur"),b=Qt("perspective"),w=Qt("aspect"),S=Qt("ease"),E=Qt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[..._(),ke,Se],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],M=()=>[ke,Se,d],L=()=>[Oi,"full","auto",...M()],P=()=>[Li,"none","subgrid",ke,Se],O=()=>["auto",{span:["full",Li,ke,Se]},Li,ke,Se],B=()=>[Li,"auto",ke,Se],H=()=>["auto","min","max","fr",ke,Se],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...M()],F=()=>[Oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],G=()=>[Oi,"screen","full","dvw","lvw","svw","min","max","fit",...M()],X=()=>[Oi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],Z=()=>[e,ke,Se],D=()=>[..._(),MT,IT,{position:[ke,Se]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ne=()=>["auto","cover","contain",xK,fK,{size:[ke,Se]}],U=()=>[Vy,qu,Ga],Q=()=>["","none","full",f,ke,Se],K=()=>["",Ke,qu,Ga],te=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[Ke,Vy,MT,IT],pe=()=>["","none",v,ke,Se],ge=()=>["none",Ke,ke,Se],ve=()=>["none",Ke,ke,Se],xe=()=>[Ke,ke,Se],Ne=()=>[Oi,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pr],breakpoint:[Pr],color:[tD],container:[Pr],"drop-shadow":[Pr],ease:["in","out","in-out"],font:[dK],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pr],shadow:[Pr],spacing:["px",Ke],text:[Pr],"text-shadow":[Pr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oi,Se,ke,w]}],container:["container"],columns:[{columns:[Ke,Se,ke,u]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Li,"auto",ke,Se]}],basis:[{basis:[Oi,"full","auto",u,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,Oi,"auto","initial","none",Se]}],grow:[{grow:["",Ke,ke,Se]}],shrink:[{shrink:["",Ke,ke,Se]}],order:[{order:[Li,"first","last","none",ke,Se]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[u,"screen",...F()]}],"min-w":[{"min-w":[u,"screen","none",...F()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,qu,Ga]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,vK,hK]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Vy,Se]}],"font-family":[{font:[gK,pK,t]}],"font-features":[{"font-features":[Se]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ke,Se]}],"line-clamp":[{"line-clamp":[Ke,"none",ke,TT]}],leading:[{leading:[a,...M()]}],"list-image":[{"list-image":["none",ke,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",ke,Ga]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[Ke,"auto",ke,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Li,ke,Se],radial:["",ke,Se],conic:[Li,ke,Se]},yK,mK]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-bs":[{"border-bs":K()}],"border-w-be":[{"border-be":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,ke,Se]}],"outline-w":[{outline:["",Ke,qu,Ga]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",p,rp,sp]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",m,rp,sp]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[Ke,Ga]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",x,rp,sp]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[Ke,ke,Se]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[ke,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Se]}],filter:[{filter:["","none",ke,Se]}],blur:[{blur:pe()}],brightness:[{brightness:[Ke,ke,Se]}],contrast:[{contrast:[Ke,ke,Se]}],"drop-shadow":[{"drop-shadow":["","none",y,rp,sp]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",Ke,ke,Se]}],"hue-rotate":[{"hue-rotate":[Ke,ke,Se]}],invert:[{invert:["",Ke,ke,Se]}],saturate:[{saturate:[Ke,ke,Se]}],sepia:[{sepia:["",Ke,ke,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Se]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,ke,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,ke,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,ke,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,ke,Se]}],"backdrop-invert":[{"backdrop-invert":["",Ke,ke,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,ke,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,ke,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,ke,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",ke,Se]}],ease:[{ease:["linear","initial",S,ke,Se]}],delay:[{delay:[Ke,ke,Se]}],animate:[{animate:["none",E,ke,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,ke,Se]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[ke,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Se]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[Ke,qu,Ga,TT]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},jK=eK(wK);function he(...e){return jK(W$(e))}const SK={running:"running",needs_input:"needs input",idle:"idle",unknown:"unknown"},NK={running:"bg-emerald-500",needs_input:"bg-amber-500",idle:"bg-slate-400",unknown:"bg-stone-300"};function F2(e){return e?e.state:"unknown"}function H2(e){return SK[e]}function cD(e){return NK[e]}function uD(e){return e==="running"?"activity-pulse-running":""}const OT=30;function dD(e){if(!e)return!1;if(typeof e.staleness=="number")return e.staleness>OT;if(!e.sampledAt)return!1;const t=Date.parse(e.sampledAt);return Number.isNaN(t)?!1:(Date.now()-t)/1e3>OT}function kK(e){return e.length<=8?e:e.slice(-8)}async function _K(e,t){const n=new URLSearchParams({filter:e,refresh:"1"});t&&n.set("boundToWorkflow",`${t.specName}:${t.specVersion}`);const s=await fetch(`/api/slices?${n.toString()}`);if(s.status===503){const r=await s.json().catch(()=>({}));return{unavailable:!0,error:r.error??"slices_indexer_unavailable",hint:r.hint}}if(!s.ok)throw new Error(`HTTP ${s.status}`);return await s.json()}function Zm(e,t=null){return qe({queryKey:["slices","list",e,t?`${t.specName}:${t.specVersion}`:"all"],queryFn:()=>_K(e,t),staleTime:3e4,refetchOnWindowFocus:"always"})}function CK(){const e=Mt();return en({mutationFn:async()=>{const t=await fetch("/api/slices/refresh",{method:"POST"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["slices"]}),e.invalidateQueries({queryKey:["files"]})}})}async function fD(e){const t=await fetch(`/api/slices/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function EK(e){return qe({queryKey:["slices","detail",e],queryFn:()=>fD(e),enabled:!!e,staleTime:3e4})}function hD(e){const t=C.useMemo(()=>Array.from(new Set(e.filter(s=>s.length>0))).sort(),[e]),n=tf({queries:t.map(s=>({queryKey:["slices","detail",s],queryFn:()=>fD(s),staleTime:3e4}))});return C.useMemo(()=>{const s=new Map,r=[];return t.forEach((a,l)=>{var d,f;const u=(d=n[l])==null?void 0:d.data;u?s.set(a,u):(f=n[l])!=null&&f.isError&&r.push(a)}),{itemsByName:s,isFetching:n.some(a=>a.isFetching),missingNames:r}},[n,t])}async function RK(e,t){const n=await fetch(`/api/slices/${encodeURIComponent(e)}/doc/${encodeURI(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function AK(e,t){return qe({queryKey:["slices","doc",e,t],queryFn:()=>RK(e,t),enabled:!!e&&!!t,staleTime:6e4})}function ud(e,t){return`/api/slices/${encodeURIComponent(e)}/proof-asset/${encodeURI(t)}`}async function TK(e){const t=await fetch(`/api/queue/${encodeURIComponent(e)}`);if(t.status===404)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function U2(e){const t=C.useMemo(()=>Array.from(new Set(e.filter(s=>s.length>0))).sort(),[e]),n=tf({queries:t.map(s=>({queryKey:["queue","item",s],queryFn:()=>TK(s),staleTime:3e4}))});return C.useMemo(()=>{const s=new Map,r=[];return t.forEach((a,l)=>{var d,f;const u=(d=n[l])==null?void 0:d.data;u?s.set(a,u):((f=n[l])==null?void 0:f.status)==="success"&&r.push(a)}),{itemsById:s,isFetching:n.some(a=>a.isFetching),missingIds:r}},[n,t])}async function IK(){const e=await fetch("/api/config");if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error??`HTTP ${e.status}`)}return e.json()}function wa(){return qe({queryKey:["settings","all"],queryFn:IK,staleTime:0})}function V2(){const e=Mt();return en({mutationFn:async t=>{const n=await fetch(`/api/config/${encodeURIComponent(t.key)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t.value})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function MK(){const e=Mt();return en({mutationFn:async t=>{const n=await fetch(`/api/config/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function OK(){const e=Mt();return en({mutationFn:async t=>{const n=await fetch("/api/config/init-workspace",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]})}})}function LK(e){if(!e)return"";const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function G2(){const{data:e,isLoading:t,error:n}=wa();if(n||!e||!e.settings||typeof e.settings!="object")return{name:null,root:null,settingsAvailable:!1,isLoading:t};const s=e.settings["workspace.root"],r=s==null?void 0:s.value,a=typeof r=="string"&&r.length>0?r:null;return{name:a?LK(a):null,root:a,settingsAvailable:!0,isLoading:t}}async function PK(){const e=await fetch("/api/files/roots");if(e.status===503){const t=await e.json().catch(()=>({}));return{unavailable:!0,error:t.error??"files_routes_unavailable",hint:t.hint}}if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}function Jm(){return qe({queryKey:["files","roots"],queryFn:PK,staleTime:6e4})}async function $K(e,t){const n=await fetch(`/api/files/list?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function pD(e,t){return qe({queryKey:["files","list",e,t],queryFn:()=>$K(e,t??""),enabled:!!e,staleTime:15e3,refetchOnWindowFocus:"always"})}async function DK(e,t){const n=await fetch(`/api/files/read?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function eg(e,t){return qe({queryKey:["files","read",e,t],queryFn:()=>DK(e,t),enabled:!!e&&!!t,staleTime:0})}async function qK(e){const t=await fetch("/api/files/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.status===409){const n=await t.json();return{conflict:!0,currentMtime:n.currentMtime,currentContentHash:n.currentContentHash,message:n.message??"file changed externally"}}if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.message??n.error??`HTTP ${t.status}`)}return await t.json()}function zK(){const e=Mt();return en({mutationFn:qK,onSuccess:(t,n)=>{"conflict"in t||(e.invalidateQueries({queryKey:["files","read",n.root,n.path]}),e.invalidateQueries({queryKey:["files","list",n.root]}))}})}function RN(e,t){return`/api/files/asset?root=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function BK(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?!0:s.startsWith(n+"/")}function FK(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?"":s.startsWith(n+"/")?s.slice(n.length+1):s}function mD(){var f;const e=G2(),t=Jm(),n=t.data;let s=null;if(e.root&&n&&"roots"in n){const p=n.roots.find(m=>m.path===e.root);if(p)s=p;else{const x=n.roots.filter(y=>e.root&&BK(y.path,e.root)).sort((y,v)=>v.path.length-y.path.length)[0];x&&(s=x)}}const r=s&&e.root?(()=>{const p=FK(s.path,e.root);return p?`${p}/missions`:"missions"})():null,a=pD(s?s.name:null,r),l=e.isLoading||t.isLoading||s!==null&&a.isLoading;return!e.settingsAvailable&&!e.isLoading?{missions:[],unavailable:!0,isLoading:l,hint:"Daemon does not expose /api/config (likely v0.2.0). Upgrade to v0.3.0+ for live mission discovery."}:!e.root&&!e.isLoading?{missions:[],unavailable:!0,isLoading:l,hint:"Configure a workspace root: rig config set workspace.root <path>"}:!s&&!t.isLoading?{missions:[],unavailable:!0,isLoading:l,hint:`No allowlist root contains workspace.root (${e.root}). Set OPENRIG_FILES_ALLOWLIST=<name>:<path> to register.`}:a.isError?{missions:[],unavailable:!0,isLoading:l,hint:`Could not list ${r} under ${s==null?void 0:s.name}.`}:{missions:(((f=a.data)==null?void 0:f.entries)??[]).filter(p=>p.type==="dir").map(p=>({name:p.name,root:s.name,path:r?`${r}/${p.name}`:p.name})).sort((p,m)=>p.name.localeCompare(m.name)),unavailable:!1,isLoading:l,hint:null}}const HK={active:"border-success text-success",paused:"border-stone-400 text-stone-500",shipped:"border-secondary text-secondary",blocked:"border-warning text-warning",unknown:"border-stone-300 text-stone-400"},UK={active:"bg-success",paused:"bg-stone-400",shipped:"bg-secondary",blocked:"bg-warning",unknown:"bg-stone-300"};function VK({status:e,label:t,className:n,testId:s}){return i.jsxs("span",{"data-testid":s??`mission-status-${e}`,role:"status","aria-label":t??e,className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[9px] uppercase tracking-wide",HK[e],n),children:[i.jsx("span",{className:he("w-1.5 h-1.5 rounded-full",UK[e]),"aria-hidden":"true"}),t??e]})}function GK(e){var a;if(!e)return"unknown";const t=e.match(/^---\s*\n([\s\S]*?)\n---/),s=((t==null?void 0:t[1])??e).match(/^\s*status:\s*([a-z_-]+)\s*$/im),r=((a=s==null?void 0:s[1])==null?void 0:a.toLowerCase())??"";return r==="active"||r==="in_progress"||r==="in-progress"?"active":r==="paused"||r==="on_hold"||r==="on-hold"?"paused":r==="shipped"||r==="complete"||r==="completed"||r==="done"?"shipped":r==="blocked"||r==="stalled"?"blocked":"unknown"}function KK(e,t){const n=e&&t?`${t}/PROGRESS.md`:null,s=eg(e,n);return!e||!t?{status:"unknown",isLoading:!1,unavailable:!0,mtime:null}:s.isLoading?{status:"unknown",isLoading:!0,unavailable:!1,mtime:null}:s.isError||!s.data?{status:"unknown",isLoading:!1,unavailable:!0,mtime:null}:{status:GK(s.data.content),isLoading:!1,unavailable:!1,mtime:s.data.mtime??null}}const WK={"claude-code":{id:"claude-code",label:"Claude",shortLabel:"Claude",tone:"sand"},codex:{id:"codex",label:"Codex",shortLabel:"Codex",tone:"green"},terminal:{id:"terminal",label:"Terminal",shortLabel:"TTY",tone:"slate"},unknown:{id:"unknown",label:"Unknown",shortLabel:"Unknown",tone:"neutral"}};function tg(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="claude"||t==="claude-code"||t.includes("claude")?"claude-code":t==="codex"||t.includes("codex")||t.includes("openai")?"codex":t==="terminal"||t==="tmux"||t==="shell"?"terminal":"unknown"}function K2(e){return WK[tg(e)]}function gD(e,t){const n=K2(e);return n.id==="unknown"?t??"Runtime unknown":t?`${n.label} / ${t}`:n.label}const YK={cmux:{id:"cmux",label:"CMUX",shortLabel:"CMUX",actionLabel:"Open in CMUX",tone:"cyan"},tmux:{id:"tmux",label:"tmux",shortLabel:"tmux",actionLabel:"Attach tmux",tone:"green"},vscode:{id:"vscode",label:"VS Code",shortLabel:"VS Code",actionLabel:"Open in VS Code",tone:"blue"},terminal:{id:"terminal",label:"Terminal",shortLabel:"TTY",actionLabel:"Preview terminal",tone:"slate"},file:{id:"file",label:"File",shortLabel:"File",actionLabel:"Open file",tone:"neutral"},markdown:{id:"markdown",label:"Markdown",shortLabel:"MD",actionLabel:"Open markdown",tone:"neutral"},config:{id:"config",label:"Config",shortLabel:"YAML",actionLabel:"Open config",tone:"blue"},code:{id:"code",label:"Code",shortLabel:"Code",actionLabel:"Open code",tone:"slate"},screenshot:{id:"screenshot",label:"Screenshot",shortLabel:"Shot",actionLabel:"Open screenshot",tone:"amber"},proof:{id:"proof",label:"Proof",shortLabel:"Proof",actionLabel:"Open proof packet",tone:"green"},transcript:{id:"transcript",label:"Transcript",shortLabel:"Log",actionLabel:"Open transcript",tone:"slate"},commit:{id:"commit",label:"Commit",shortLabel:"Git",actionLabel:"Open commit",tone:"green"},folder:{id:"folder",label:"Folder",shortLabel:"Dir",actionLabel:"Open folder",tone:"neutral"},skill:{id:"skill",label:"Skill",shortLabel:"Skill",actionLabel:"Open skill",tone:"amber"},video:{id:"video",label:"Video",shortLabel:"Video",actionLabel:"Open video",tone:"blue"},trace:{id:"trace",label:"Trace",shortLabel:"Trace",actionLabel:"Open trace",tone:"neutral"},unknown:{id:"unknown",label:"Unknown tool",shortLabel:"Unknown",actionLabel:"Open",tone:"neutral"}};function xD(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="cmux"||t.includes("cmux")?"cmux":t==="tmux"||t.includes("tmux")?"tmux":t==="vscode"||t==="vs-code"||t==="vs code"||t.includes("visual studio code")?"vscode":t==="terminal"||t==="tty"||t==="shell"?"terminal":t==="screenshot"||t==="image"||t==="proof-image"||t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".webp")||t.endsWith(".svg")||t.includes("screenshot")?"screenshot":t==="proof"||t==="proof-packet"||t.includes("proof packet")||t.endsWith("proof.md")?"proof":t==="skill"||t==="skill-folder"||t==="skill.md"||t.endsWith("/skill.md")?"skill":t==="folder"||t==="directory"||t==="dir"?"folder":t==="commit"||t==="git"||t.includes("commit")||/^[a-f0-9]{7,40}$/.test(t)?"commit":t==="transcript"||t.includes("transcript")||t.endsWith(".log")?"transcript":t==="video"||t.endsWith(".mp4")||t.endsWith(".webm")||t.endsWith(".mov")?"video":t==="trace"||t.endsWith(".zip")||t.endsWith(".har")||t.endsWith(".trace")?"trace":t.endsWith(".md")||t.endsWith(".mdx")?"markdown":t.endsWith(".yaml")||t.endsWith(".yml")||t.endsWith(".json")||t.endsWith(".jsonl")||t.endsWith(".toml")?"config":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")||t.endsWith(".py")||t.endsWith(".rs")||t.endsWith(".go")||t.endsWith(".sh")?"code":t==="file"||t==="path"||t.includes("artifact")||t.endsWith(".txt")?"file":"unknown"}function yD(e){return YK[xD(e)]}const W2={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-9 w-9"},QK={xs:"gap-1 px-1 py-0.5 text-[8px]",sm:"gap-1.5 px-1.5 py-0.5 text-[9px]",md:"gap-2 px-2 py-1 text-[10px]",lg:"gap-2.5 px-2.5 py-1.5 text-[11px]"},XK={xs:"gap-1 text-[8px]",sm:"gap-1.5 text-[9px]",md:"gap-2 text-[10px]",lg:"gap-2.5 text-[11px]"},ZK={"claude-code":"border-[#9f5f4e]/40 bg-[#b06a57]/12 text-[#62392f]",codex:"border-stone-400/50 bg-white/75 text-stone-950",terminal:"border-stone-400/45 bg-stone-900/8 text-stone-800",unknown:"border-stone-300 bg-white/55 text-stone-600"},JK={"claude-code":"text-[#62392f]",codex:"text-stone-950",terminal:"text-stone-800",unknown:"text-stone-600"},LT="/graphics/operator-climber-monochrome.png";function Ut(e,t){return t?{"aria-hidden":!0}:{"aria-label":e,role:"img"}}function eW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,shapeRendering:"crispEdges",children:[i.jsx("rect",{x:"3",y:"2",width:"10",height:"8",fill:"#ad6755"}),i.jsx("rect",{x:"1",y:"5",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"13",y:"5",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"4",y:"10",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"7",y:"10",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"10",y:"10",width:"2",height:"3",fill:"#ad6755"}),i.jsx("rect",{x:"5",y:"4",width:"1",height:"2",fill:"#181818"}),i.jsx("rect",{x:"10",y:"4",width:"1",height:"2",fill:"#181818"})]})}function tW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("circle",{cx:"8",cy:"8",r:"5.7",fill:"#fafaf9",stroke:"#0c0a09",strokeWidth:"1.25"}),i.jsx("path",{d:"M5.8 6.35 7.25 8 5.8 9.65",fill:"none",stroke:"#0c0a09",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M8.65 9.65h2.25",fill:"none",stroke:"#0c0a09",strokeWidth:"1.25",strokeLinecap:"round"})]})}function Y2({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("rect",{x:"2",y:"3",width:"12",height:"10",fill:"#1c1917"}),i.jsx("path",{d:"M4 6 6 8 4 10",fill:"none",stroke:"#fafaf9",strokeWidth:"1.2",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M7.5 10h4",fill:"none",stroke:"#fafaf9",strokeWidth:"1.2",strokeLinecap:"square"})]})}function nW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"cmux-preview-mark",x1:"3",x2:"13",y1:"3",y2:"13",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#20d5f4"}),i.jsx("stop",{offset:"1",stopColor:"#4357ff"})]})}),i.jsx("path",{d:"M4.1 2.7 12.3 8l-8.2 5.3V9.9L7.8 8 4.1 6.1z",fill:"url(#cmux-preview-mark)"})]})}function sW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M2.1 3.5c0-.8.6-1.4 1.4-1.4h9c.8 0 1.4.6 1.4 1.4v9c0 .8-.6 1.4-1.4 1.4h-9c-.8 0-1.4-.6-1.4-1.4z",fill:"#3a3a39"}),i.jsx("path",{d:"M7.5 2.1v8.7M7.5 6.3h6.4",stroke:"#f8fafc",strokeWidth:"0.7"}),i.jsx("path",{d:"M2.1 11.1h11.8v1.4c0 .8-.6 1.4-1.4 1.4h-9c-.8 0-1.4-.6-1.4-1.4z",fill:"#14c21a"})]})}function rW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M12.5 2.4 6.8 6.7 3.9 4.5 2.4 5.7 5.2 8l-2.8 2.3 1.5 1.2 2.9-2.2 5.7 4.3 1.1-.5V2.9z",fill:"#007acc"}),i.jsx("path",{d:"M12.3 5.3 8.4 8l3.9 2.7z",fill:"#35a9ff",opacity:"0.9"})]})}function iW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M4 2.5h5.2L12 5.3v8.2H4z",fill:"#f5f5f4",stroke:"#78716c",strokeWidth:"1"}),i.jsx("path",{d:"M9.2 2.5v3h2.8",fill:"none",stroke:"#78716c",strokeWidth:"1"}),i.jsx("path",{d:"M5.8 8h4.4M5.8 10.1h3.5",fill:"none",stroke:"#57534e",strokeWidth:"0.8",strokeLinecap:"square"})]})}function aW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M3 2.5h10v11H3z",fill:"#fafaf9",stroke:"#57534e",strokeWidth:"0.9"}),i.jsx("path",{d:"M5 6v4M5 6l1.7 2.2L8.4 6v4M10 6v4M9.1 9.1 10 10l.9-.9",fill:"none",stroke:"#292524",strokeWidth:"0.85",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M4.6 4.2h6.8",stroke:"#a8a29e",strokeWidth:"0.65"})]})}function oW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M3 2.5h10v11H3z",fill:"#eff6ff",stroke:"#0369a1",strokeWidth:"0.9"}),i.jsx("path",{d:"M5.1 5.3h5.8M5.1 8h5.8M5.1 10.7h5.8",stroke:"#075985",strokeWidth:"0.75",strokeLinecap:"square"}),i.jsx("circle",{cx:"4.2",cy:"5.3",r:"0.45",fill:"#0284c7"}),i.jsx("circle",{cx:"4.2",cy:"8",r:"0.45",fill:"#0284c7"}),i.jsx("circle",{cx:"4.2",cy:"10.7",r:"0.45",fill:"#0284c7"})]})}function lW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"10",fill:"#fafaf9",stroke:"#292524",strokeWidth:"0.9"}),i.jsx("path",{d:"M6.2 6.2 4.6 8l1.6 1.8M9.8 6.2 11.4 8 9.8 9.8",fill:"none",stroke:"#292524",strokeWidth:"0.9",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M8.7 5.4 7.3 10.6",stroke:"#57534e",strokeWidth:"0.75",strokeLinecap:"square"})]})}function cW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("rect",{x:"2",y:"3",width:"12",height:"10",fill:"#fff7ed",stroke:"#9a3412",strokeWidth:"0.9"}),i.jsx("path",{d:"M2.4 5.2h11.2",stroke:"#9a3412",strokeWidth:"0.9"}),i.jsx("rect",{x:"3.8",y:"6.7",width:"3.1",height:"2.3",fill:"#fdba74"}),i.jsx("rect",{x:"7.7",y:"6.7",width:"4.5",height:"0.8",fill:"#fed7aa"}),i.jsx("rect",{x:"7.7",y:"8.4",width:"3.5",height:"0.8",fill:"#fed7aa"}),i.jsx("path",{d:"M4 11.5h7.8",stroke:"#ea580c",strokeWidth:"0.9",strokeLinecap:"square"}),i.jsx("circle",{cx:"4",cy:"4.1",r:"0.35",fill:"#9a3412"}),i.jsx("circle",{cx:"5.1",cy:"4.1",r:"0.35",fill:"#9a3412"})]})}function uW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M3 2.8h10v10.4H3z",fill:"#ecfdf5",stroke:"#047857",strokeWidth:"0.9"}),i.jsx("path",{d:"M5.1 8.1 7 10l4-4.3",fill:"none",stroke:"#059669",strokeWidth:"1.2",strokeLinecap:"square",strokeLinejoin:"miter"}),i.jsx("path",{d:"M4.7 4.7h6.6",stroke:"#6ee7b7",strokeWidth:"0.7"}),i.jsx("path",{d:"M4.7 11.6h6.6",stroke:"#6ee7b7",strokeWidth:"0.7"})]})}function dW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("rect",{x:"2.5",y:"3",width:"11",height:"10",fill:"#1c1917"}),i.jsx("path",{d:"M4.3 5.5h3.8M4.3 7.6h6.8M4.3 9.7h5.2",stroke:"#fafaf9",strokeWidth:"0.75",strokeLinecap:"square"}),i.jsx("rect",{x:"11.1",y:"5.1",width:"1",height:"5.6",fill:"#a8a29e"})]})}function fW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M2.4 8h11.2",stroke:"#064e3b",strokeWidth:"1",strokeLinecap:"square"}),i.jsx("circle",{cx:"8",cy:"8",r:"2.6",fill:"#ecfdf5",stroke:"#047857",strokeWidth:"1"}),i.jsx("circle",{cx:"8",cy:"8",r:"0.8",fill:"#10b981"})]})}function hW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M2.3 5.1h4l1-1.5h6.4v8.8H2.3z",fill:"#f5f5f4",stroke:"#78716c",strokeWidth:"0.9"}),i.jsx("path",{d:"M2.3 6.3h11.4",stroke:"#a8a29e",strokeWidth:"0.75"})]})}function pW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("path",{d:"M3.2 2.8h7.1L13 5.5v7.7H3.2z",fill:"#fffbeb",stroke:"#92400e",strokeWidth:"0.9"}),i.jsx("path",{d:"M10.3 2.8v2.8H13",fill:"none",stroke:"#92400e",strokeWidth:"0.8"}),i.jsx("path",{d:"M5.1 6.7h5.1M5.1 8.7h4.1",stroke:"#b45309",strokeWidth:"0.75",strokeLinecap:"square"}),i.jsx("path",{d:"M5.1 11.1h2.2",stroke:"#f59e0b",strokeWidth:"1",strokeLinecap:"square"})]})}function mW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("rect",{x:"2.5",y:"3.6",width:"8.4",height:"8.8",fill:"#eff6ff",stroke:"#0369a1",strokeWidth:"0.9"}),i.jsx("path",{d:"M10.9 6.3 13.7 4.9v6.2l-2.8-1.4z",fill:"#38bdf8",stroke:"#0369a1",strokeWidth:"0.75"}),i.jsx("path",{d:"M5.7 6.3v3.4L8.5 8z",fill:"#0284c7"})]})}function gW({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("rect",{x:"2.7",y:"2.7",width:"10.6",height:"10.6",fill:"#fafaf9",stroke:"#57534e",strokeWidth:"0.9"}),i.jsx("path",{d:"M4.7 10.2c1.1-4.8 2.3-4.8 3.4-.1s2.2 4.7 3.2-.2",fill:"none",stroke:"#44403c",strokeWidth:"0.9",strokeLinecap:"square"}),i.jsx("path",{d:"M4.4 5.2h2M9.6 5.2h2",stroke:"#a8a29e",strokeWidth:"0.7"})]})}function xW({className:e,title:t,decorative:n}){return i.jsx("span",{...Ut(t,n),title:t,className:he(e,"inline-block bg-current"),style:{WebkitMaskImage:`url(${LT})`,WebkitMaskPosition:"center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",maskImage:`url(${LT})`,maskPosition:"center",maskRepeat:"no-repeat",maskSize:"contain"}})}function vD({className:e,title:t,decorative:n}){return i.jsxs("svg",{viewBox:"0 0 16 16",...Ut(t,n),className:e,children:[i.jsx("rect",{x:"2",y:"2",width:"12",height:"12",fill:"#e7e5e4",stroke:"#78716c",strokeWidth:"1"}),i.jsx("path",{d:"M6.2 6.2c.2-1 1-1.7 2-1.7 1.2 0 2 .7 2 1.8 0 .7-.3 1.1-.9 1.5-.6.4-.8.7-.8 1.4",fill:"none",stroke:"#57534e",strokeWidth:"1.1"}),i.jsx("rect",{x:"7.6",y:"11",width:"1",height:"1",fill:"#57534e"})]})}function Q2({runtime:e,size:t="sm",className:n,title:s,decorative:r}){const a=tg(e),l=s??K2(e).label,u=he(W2[t],"shrink-0",n);return a==="claude-code"?i.jsx(eW,{className:u,title:l,decorative:r}):a==="codex"?i.jsx(tW,{className:u,title:l,decorative:r}):a==="terminal"?i.jsx(Y2,{className:u,title:l,decorative:r}):i.jsx(vD,{className:u,title:l,decorative:r})}function Gn({runtime:e,model:t,size:n="sm",className:s,compact:r=!1,variant:a="badge"}){const l=tg(e),u=K2(e),d=a==="inline";return i.jsxs("span",{className:he("inline-flex min-w-0 items-center font-mono uppercase tracking-[0.10em]",d?XK[n??"sm"]:QK[n??"sm"],d?JK[l]:he("border",ZK[l]),s),title:t?`${u.label} / ${t}`:u.label,children:[i.jsx(Q2,{runtime:e,size:n}),i.jsx("span",{className:"truncate",children:r?u.shortLabel:u.label}),t&&!r?i.jsx("span",{className:"truncate text-current/60",children:t}):null]})}function $e({tool:e,size:t="sm",className:n,title:s,decorative:r}){const a=xD(e),l=s??yD(e).label,u=he(W2[t],"shrink-0",n);return a==="cmux"?i.jsx(nW,{className:u,title:l,decorative:r}):a==="tmux"?i.jsx(sW,{className:u,title:l,decorative:r}):a==="vscode"?i.jsx(rW,{className:u,title:l,decorative:r}):a==="terminal"?i.jsx(Y2,{className:u,title:l,decorative:r}):a==="file"?i.jsx(iW,{className:u,title:l,decorative:r}):a==="markdown"?i.jsx(aW,{className:u,title:l,decorative:r}):a==="config"?i.jsx(oW,{className:u,title:l,decorative:r}):a==="code"?i.jsx(lW,{className:u,title:l,decorative:r}):a==="screenshot"?i.jsx(cW,{className:u,title:l,decorative:r}):a==="proof"?i.jsx(uW,{className:u,title:l,decorative:r}):a==="transcript"?i.jsx(dW,{className:u,title:l,decorative:r}):a==="commit"?i.jsx(fW,{className:u,title:l,decorative:r}):a==="folder"?i.jsx(hW,{className:u,title:l,decorative:r}):a==="skill"?i.jsx(pW,{className:u,title:l,decorative:r}):a==="video"?i.jsx(mW,{className:u,title:l,decorative:r}):a==="trace"?i.jsx(gW,{className:u,title:l,decorative:r}):i.jsx(vD,{className:u,title:l,decorative:r})}function bD(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t==="human"||t.includes("human@")||t.includes("human-")||t.includes("operator")||t.includes("host")}function bm({actor:e,size:t="sm",className:n,title:s,decorative:r}){const a=s??(e||"Operator"),l=he(W2[t],"shrink-0",n);return bD(e)?i.jsx(xW,{className:l,title:a,decorative:r}):tg(e)!=="unknown"?i.jsx(Q2,{runtime:e,size:t,className:n,title:s,decorative:r}):i.jsx(Y2,{className:l,title:a,decorative:r})}const yW={neutral:"border-stone-300 bg-white/55 text-stone-700",info:"border-sky-300 bg-sky-50/75 text-sky-800",success:"border-emerald-300 bg-emerald-50/75 text-emerald-800",warning:"border-amber-300 bg-amber-50/80 text-amber-800",danger:"border-rose-300 bg-rose-50/80 text-rose-800"},wD={neutral:"border-stone-400 bg-stone-300",info:"border-sky-400 bg-sky-200",success:"border-emerald-500 bg-emerald-400",warning:"border-amber-400 bg-amber-300",danger:"border-rose-400 bg-rose-300"};function X2(e){const t=e.toLowerCase();return t.includes("mission_control.action_executed")?{label:"Human decision",tone:"success",icon:CN}:t.includes("closure_overdue")||t.includes("overdue")?{label:"Overdue",tone:"danger",icon:ha}:t.includes("approval")?{label:"Needs approval",tone:"warning",icon:CN}:t.includes("human-gate")||t.includes("human")?{label:"Human action",tone:"danger",icon:ha}:t.includes("inbox.denied")?{label:"Inbox denied",tone:"danger",icon:z$}:t.includes("inbox.absorbed")?{label:"Inbox absorbed",tone:"success",icon:U$}:t.includes("shipped")?{label:"Shipped",tone:"success",icon:$2}:t.includes("transition.done")||t.includes("transition.complete")?{label:"Marked done",tone:"success",icon:_d}:t.includes("transition.in-progress")||t.includes("transition.claim")?{label:"In progress",tone:"info",icon:Cd}:t.includes("transition.pending")?{label:"Pending",tone:"warning",icon:Cd}:t.includes("transition")?{label:"State change",tone:"neutral",icon:Yl}:t.includes("ship")||t.includes("done")||t.includes("complete")?{label:"Completed",tone:"success",icon:_d}:t.includes("unclaim")?{label:"Released",tone:"neutral",icon:pG}:t.includes("claim")?{label:"Claimed",tone:"info",icon:G$}:t.includes("handoff")||t.includes("handed_off")||t.includes("routed")?{label:"Handoff",tone:"info",icon:Qm}:t.includes("created")?{label:"Created",tone:"info",icon:B$}:t.includes("queue.updated")||t.includes("queue.item.updated")?{label:"Queue update",tone:"neutral",icon:Yl}:t.includes("progress")?{label:"Progress",tone:"info",icon:Yl}:{label:Qp(e),tone:"neutral",icon:Ym}}function jD(e){const t=(e==null?void 0:e.toLowerCase().trim())??"";return t?t.includes("closeout-pending-ratify")?{label:"Awaiting approval",tone:"warning",icon:CN}:t.includes("human-gate")||t.includes("pending-approval")?{label:"Needs human",tone:"danger",icon:ha}:t.includes("blocked")||t.includes("failed")||t.includes("error")||t.includes("denied")?{label:Qp(e??""),tone:"danger",icon:ha}:t.includes("handed-off")||t.includes("routed")?{label:"Routed",tone:"info",icon:Qm}:t.includes("done")||t.includes("complete")||t.includes("closed")||t.includes("shipped")?{label:"Done",tone:"success",icon:_d}:t.includes("in-progress")||t.includes("running")||t.includes("claimed")?{label:"In progress",tone:"info",icon:G$}:t.includes("pending")||t.includes("open")||t.includes("queued")?{label:"Pending",tone:"warning",icon:Cd}:t.includes("canceled")||t.includes("cancelled")||t.includes("stopped")?{label:Qp(e??""),tone:"neutral",icon:z$}:{label:Qp(e??""),tone:"neutral",icon:Yl}:{label:"Unknown state",tone:"neutral",icon:Ym}}function Z2(e){return{label:"Slice",tone:"success",icon:Ym}}function ng(e){const t=(e==null?void 0:e.toLowerCase())??"";return t.includes("done")||t.includes("complete")||t.includes("closed")?"success":t.includes("fail")||t.includes("blocked")||t.includes("overdue")?"danger":t.includes("pending")||t.includes("human")||t.includes("approval")?"warning":t.includes("progress")||t.includes("claim")?"info":"neutral"}function nf(e){const t=(e==null?void 0:e.toLowerCase())??"";return t==="active"||t==="in-flight"?"info":ng(e)}function Qp(e){return e.replace(/[_./-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function SD(e){if(!e)return"unknown";if(e==="human@host")return"human@host";const[t,n]=e.split("@");return n?`${t}@${n}`:e}function J2(e){if(!e)return"unknown";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=new Date,s=t.toDateString()===n.toDateString(),r=new Date(n);r.setDate(n.getDate()-1);const a=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(t);return s?`Today ${a}`:t.toDateString()===r.toDateString()?`Yesterday ${a}`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t)}function Hn({token:e,compact:t=!1,testId:n,className:s}){const r=e.icon;return i.jsxs("span",{"data-testid":n,className:he("inline-flex items-center gap-1 border font-mono uppercase tracking-[0.10em]",t?"px-1.5 py-0.5 text-[8px]":"px-2 py-1 text-[9px]",yW[e.tone],s),children:[r?i.jsx(r,{className:t?"h-2.5 w-2.5":"h-3 w-3",strokeWidth:1.6}):null,e.label]})}function ek({kind:e,compact:t,testId:n}){return i.jsx(Hn,{token:X2(e),compact:t,testId:n})}function tk({state:e,compact:t,testId:n}){return i.jsx(Hn,{token:jD(e),compact:t,testId:n})}function nk({count:e,testId:t}){const n=`${e} qitem${e===1?"":"s"}`;return i.jsxs("span",{"data-testid":t,title:n,"aria-label":n,className:"inline-flex shrink-0 items-center gap-1 border border-stone-200 bg-white/45 px-1.5 py-0.5 font-mono text-[9px] tabular-nums text-stone-600",children:[i.jsx(U$,{className:"h-3 w-3",strokeWidth:1.5,"aria-hidden":"true"}),i.jsx("span",{children:e})]})}function sk({tone:e,label:t,testId:n}){return i.jsx("span",{"data-testid":n,"data-tone":e,title:t,"aria-label":t,role:"img",className:he("inline-block h-2.5 w-2.5 shrink-0 rounded-full border",wD[e])})}function pa({tag:e,compact:t=!0}){const n=/urgent|blocked|human/i.test(e)?"danger":/proof|pass|done|ship/i.test(e)?"success":/cycle|phase|qa|review/i.test(e)?"info":"neutral";return i.jsx(Hn,{token:{label:e,tone:n},compact:t})}function wm({session:e,muted:t}){return i.jsxs("span",{className:he("inline-flex min-w-0 items-center gap-1 border px-1.5 py-0.5 font-mono text-[9px]",t?"border-stone-200 bg-white/35 text-stone-500":"border-stone-300 bg-white/55 text-stone-800"),children:[i.jsx(bm,{actor:e,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:SD(e)})]})}function Ec({value:e}){return i.jsxs("time",{dateTime:e??void 0,className:"inline-flex items-center gap-1 border border-stone-200 bg-white/45 px-1.5 py-0.5 font-mono text-[9px] text-stone-600",children:[i.jsx(O2,{className:"h-3 w-3",strokeWidth:1.5}),J2(e)]})}function sg({source:e,destination:t,muted:n}){return!e&&!t?null:i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx(wm,{session:e??"unknown source",muted:n}),i.jsx(ym,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(wm,{session:t??"unresolved target",muted:n})]})}function ND({sliceName:e,screenshots:t,onSelect:n,max:s=4,testIdPrefix:r}){return t.length===0?null:i.jsx("div",{className:"grid grid-cols-2 gap-2",children:t.slice(0,s).map(a=>{const l=i.jsx("img",{"data-testid":r?`${r}-${a}`:void 0,src:ud(e,a),alt:a,className:"h-24 w-full border border-stone-200 bg-stone-100 object-cover",loading:"lazy"});return n?i.jsxs("button",{type:"button",onClick:()=>n(a),className:"group relative block w-full text-left focus:outline-none focus:ring-2 focus:ring-stone-900/20",children:[l,i.jsxs("span",{className:"absolute left-1.5 top-1.5 inline-flex items-center gap-1 border border-amber-400/45 bg-white/80 px-1.5 py-0.5 font-mono text-[8px] uppercase tracking-[0.10em] text-amber-950 backdrop-blur-sm",children:[i.jsx($e,{tool:a,size:"xs",decorative:!0}),"Proof image"]})]},a):i.jsx("div",{children:l},a)})})}function rg({title:e,badge:t}){return i.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:[i.jsxs("span",{className:"truncate inline-flex items-center gap-1",children:[i.jsx($e,{tool:"proof",size:"xs"}),e]}),i.jsx(Hn,{token:{label:t,tone:ng(t)},compact:!0})]})}const vW=2160*60*1e3;function kD(e){return{name:e.name,displayName:e.displayName,status:e.status,rawStatus:e.rawStatus,qitemCount:e.qitemCount,hasProofPacket:e.hasProofPacket,lastActivityAt:e.lastActivityAt,missionId:e.missionId,railItem:e.railItem}}function bW(e,t=Date.now()){if(!e)return!1;const n=Date.parse(e);return Number.isNaN(n)?!1:t-n<=vW}function Ed(e,t=Date.now()){return e.qitemCount>0||e.status==="blocked"?!0:e.status==="active"||e.status==="draft"?!e.lastActivityAt||bW(e.lastActivityAt,t):!1}function Xp(e){if(e.length===0)return"unknown";const t=Date.now();return e.some(n=>n.status==="blocked"&&Ed(n,t))?"blocked":e.some(n=>Ed(n,t))?"active":e.every(n=>n.status==="done")?"shipped":"unknown"}function wW(e){return e.slices.some(t=>Ed(t))||e.slices.length===0&&e.status!=="shipped"?"current":"archive"}function AN(e){return e.slices.reduce((t,n)=>{if(!n.lastActivityAt)return t;const s=Date.parse(n.lastActivityAt);return Number.isNaN(s)?t:Math.max(t,s)},0)}function PT(e,t){const n=AN(t)-AN(e);return n!==0?n:e.label.localeCompare(t.label)}function _D(e){const t=[],n=[];for(const s of e)wW(s)==="current"?t.push(s):n.push(s);return{current:t.sort(PT),archive:n.sort(PT)}}function rk(e){const t=[];e.qitemCount>0&&t.push(`${e.qitemCount} qitem${e.qitemCount===1?"":"s"}`);const n=(e.status==="active"||e.status==="draft")&&!Ed(e)?`stale ${e.status}`:e.status;return e.rawStatus&&e.rawStatus!==e.status?t.push(`${n} from ${e.rawStatus}`):t.push(n),e.hasProofPacket&&t.push("proof"),t.join(" · ")}function jW(){const e=CK();return i.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 border-b border-stone-200",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:"Project"}),i.jsxs("button",{type:"button","data-testid":"project-tree-refresh",title:"Refresh slice + file caches",onClick:()=>e.mutate(),disabled:e.isPending,className:"flex items-center gap-1 px-1 py-0.5 text-on-surface-variant hover:text-stone-900 disabled:opacity-50",children:[i.jsx(fG,{className:`h-3 w-3 ${e.isPending?"animate-spin":""}`,"aria-hidden":"true"}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wide",children:"refresh"})]})]})}function SW({mission:e}){const t=KK(e.fsRoot??null,e.fsPath??null),n=e.fsRoot&&!t.unavailable&&!t.isLoading?t.status:e.status;return i.jsx(VK,{status:n,testId:`project-mission-${e.id}-badge`})}function NW(){const{data:e}=Zm("all"),t=G2(),n=mD(),[s,r]=C.useState({workspace:!0}),a=y=>r(v=>({...v,[y]:!v[y]})),l=e&&"slices"in e?e.slices:[],u=C.useMemo(()=>{const y=new Map;for(const v of l){const b=v.missionId??v.railItem??"unsorted";y.has(b)||y.set(b,[]),y.get(b).push(kD(v))}return y},[l]),d=C.useMemo(()=>{if(!n.unavailable&&n.missions.length>0){const y=new Set,v=n.missions.map(b=>{const w=u.get(b.name)??[];return w.length>0&&y.add(b.name),{id:b.name,label:b.name,status:Xp(w),slices:w,fsRoot:b.root,fsPath:b.path}});for(const[b,w]of u.entries())y.has(b)||v.push({id:b,label:b==="unsorted"?"Unsorted":b,status:Xp(w),slices:w});return v}return Array.from(u.entries()).map(([y,v])=>({id:y,label:y==="unsorted"?"Unsorted":y,status:Xp(v),slices:v}))},[n.unavailable,n.missions,u]),f=C.useMemo(()=>_D(d),[d]);if(!t.isLoading&&t.name===null)return i.jsx("div",{"data-testid":"project-tree-view",className:"flex-1 overflow-y-auto py-3 px-3",children:i.jsxs("div",{"data-testid":"project-no-workspace",className:"border border-outline-variant bg-surface-low px-3 py-3 font-mono text-[10px]",children:[i.jsx("div",{className:"text-stone-900 uppercase tracking-wide font-bold mb-1",children:"No workspace connected"}),i.jsx("p",{className:"text-on-surface-variant mb-2",children:"Configure a workspace root to browse missions and slices."}),i.jsx(Ve,{to:"/settings","data-testid":"project-no-workspace-cta",className:"inline-flex items-center text-stone-900 hover:underline uppercase",children:"Open settings →"})]})});const p=t.name??"loading…",m=(y,v=!1)=>s[y]??v,x=(y,v)=>{const b=v==="current",w=m(`mission-${y.id}`,b);return i.jsxs("li",{"data-testid":`project-mission-${y.id}`,"data-mission-bucket":v,children:[i.jsxs("div",{className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[i.jsx("button",{type:"button","aria-label":`${w?"Collapse":"Expand"} ${y.label}`,onClick:()=>r(S=>({...S,[`mission-${y.id}`]:!w})),className:"flex h-4 w-4 items-center justify-center","data-testid":`project-mission-toggle-${y.id}`,children:w?i.jsx(Xr,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(Bs,{className:"h-3 w-3 text-on-surface-variant"})}),i.jsx(Ve,{to:"/project/mission/$missionId",params:{missionId:y.id},"data-testid":`project-mission-link-${y.id}`,className:"font-mono text-[11px] text-stone-900 flex-1 truncate hover:underline",children:y.label}),i.jsx(SW,{mission:y})]}),w?i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:y.slices.length===0?i.jsx("li",{className:"px-2 py-0.5 font-mono text-[10px] text-on-surface-variant italic",children:"No slices."}):y.slices.map(S=>{const E=Ed(S)?"current":"archive",k=rk(S);return i.jsx("li",{"data-slice-bucket":E,children:i.jsxs(Ve,{to:"/project/slice/$sliceId",params:{sliceId:S.name},"data-testid":`project-slice-${S.name}`,title:`${S.displayName} — ${k}`,"aria-label":`${S.displayName} (${k})`,className:"flex items-start gap-2 px-2 py-1 font-mono text-xs text-on-surface hover:text-stone-900 hover:bg-surface-low",children:[i.jsx("span",{className:"min-w-0 flex-1 whitespace-normal break-words leading-snug",children:S.displayName}),i.jsxs("span",{"data-testid":`project-slice-${S.name}-meta`,className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(nk,{count:S.qitemCount,testId:`project-slice-${S.name}-qitems`}),i.jsx(sk,{tone:nf(S.status),label:S.status,testId:`project-slice-${S.name}-status`})]})]})},S.name)})}):null]},y.id)};return i.jsxs("div",{"data-testid":"project-tree-view",className:"flex-1 overflow-y-auto py-2",children:[i.jsx(jW,{}),i.jsx("ul",{children:i.jsxs("li",{"data-testid":"project-workspace-node",children:[i.jsxs("button",{type:"button",onClick:()=>a("workspace"),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left","data-testid":"project-workspace-toggle",children:[s.workspace?i.jsx(Xr,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(Bs,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx("span",{"data-testid":"project-workspace-label",className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1",children:p}),i.jsx(Ve,{to:"/project","data-testid":"project-workspace-link",onClick:y=>y.stopPropagation(),className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant hover:text-stone-900",children:"open"})]}),m("workspace")?i.jsxs("ul",{className:"ml-4 border-l border-stone-200",children:[n.unavailable&&n.hint?i.jsx("li",{"data-testid":"project-discovery-degraded",className:"px-2 py-1 font-mono text-[9px] text-on-surface-variant italic",title:n.hint,children:"Workspace missions folder unavailable; showing indexed slice grouping. Expected workspace/missions/<mission>/slices/<slice>."}):null,d.length===0?i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No missions yet."}):i.jsxs(i.Fragment,{children:[i.jsxs("li",{"data-testid":"project-mission-section-current",className:"px-2 pt-2 pb-1 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:["Current Work · ",f.current.length]}),f.current.length>0?f.current.map(y=>x(y,"current")):i.jsx("li",{"data-testid":"project-mission-section-current-empty",className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No current work."}),i.jsxs("li",{"data-testid":"project-mission-section-archive",className:"px-2 pt-3 pb-1 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-500",children:["Archive · ",f.archive.length]}),f.archive.length>0?f.archive.map(y=>x(y,"archive")):i.jsx("li",{"data-testid":"project-mission-section-archive-empty",className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No archived work."})]})]}):null]})})]})}async function kW(e){const t=e?`/api/specs/library?kind=${e}`:"/api/specs/library",n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}async function _W(e){const t=await fetch(`/api/specs/library/${encodeURIComponent(e)}/review`);if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error??`HTTP ${t.status}`)}return t.json()}function Rc(e){return qe({queryKey:["spec-library",e??"all"],queryFn:()=>kW(e)})}function ik(e){return qe({queryKey:["spec-library","review",e],queryFn:()=>_W(e),enabled:!!e})}async function CW(){const e=await fetch("/api/specs/library/active-lens");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).activeLens??null}function EW(){return qe({queryKey:["spec-library","active-lens"],queryFn:CW,staleTime:0})}async function RW(e,t){const n=await fetch("/api/specs/library/active-lens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({specName:e,specVersion:t})});if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).activeLens??null}async function AW(){const e=await fetch("/api/specs/library/active-lens",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`)}async function TW(){const e=await fetch("/api/context-packs/library");if(!e.ok){if(e.status===503)return[];throw new Error(`HTTP ${e.status}`)}const t=await e.json().catch(()=>null);return Array.isArray(t)?t:[]}function ak(){return qe({queryKey:["context-packs","library"],queryFn:TW,staleTime:3e4})}async function IW(e){const t=await fetch(`/api/context-packs/library/${encodeURIComponent(e)}/preview`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function MW(e){return qe({queryKey:["context-packs","preview",e],queryFn:()=>IW(e),enabled:!!e,staleTime:3e4})}function OW(){const e=Mt();return en({mutationFn:async t=>{const n=await fetch(`/api/context-packs/library/${encodeURIComponent(t.id)}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinationSession:t.destinationSession,dryRun:t.dryRun??!1})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error??`HTTP ${n.status}`)}return n.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["context-packs"]})}})}async function LW(){const e=await fetch("/api/agent-images/library");if(!e.ok){if(e.status===503)return[];throw new Error(`HTTP ${e.status}`)}const t=await e.json().catch(()=>null);return Array.isArray(t)?t:[]}function ok(){return qe({queryKey:["agent-images","library"],queryFn:LW,staleTime:3e4})}async function PW(e){const t=await fetch(`/api/agent-images/library/${encodeURIComponent(e)}/preview`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function $W(e){return qe({queryKey:["agent-images","preview",e],queryFn:()=>PW(e),enabled:!!e,staleTime:3e4})}function DW(){const e=Mt();return en({mutationFn:async t=>{const n=t.pin?"pin":"unpin",s=await fetch(`/api/agent-images/library/${encodeURIComponent(t.id)}/${n}`,{method:"POST"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-images"]})}})}async function qW(){const e=await fetch("/api/skills/library");if(e.status===503)return[];if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}function ig(){return qe({queryKey:["skills","library"],queryFn:qW,staleTime:3e4})}function zW(e){const t=new URLSearchParams;e!=null&&e.runtime&&t.append("runtime",e.runtime),e!=null&&e.source&&t.append("source",e.source);const n=t.toString();return n.length===0?"/api/plugins":`/api/plugins?${n}`}async function BW(e){const t=await fetch(zW(e));if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function FW(e){const t=await fetch(`/api/plugins/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function HW(e){const t=await fetch(`/api/plugins/${encodeURIComponent(e)}/used-by`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function ag(e={}){return qe({queryKey:["plugins","list",e.runtime??"all",e.source??"all"],queryFn:()=>BW(e),staleTime:3e4})}function UW(e){return qe({queryKey:["plugins","detail",e],queryFn:()=>FW(e),enabled:e!==null,staleTime:3e4})}function VW(e){return qe({queryKey:["plugins","used-by",e],queryFn:()=>HW(e),enabled:e!==null,staleTime:3e4})}function GW(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return btoa(n).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function CD(e){try{const t=e.replaceAll("-","+").replaceAll("_","/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),s=atob(n),r=Uint8Array.from(s,a=>a.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function og(e){return GW(e)}function ED(e){return CD(e)}function RD(e){return CD(e)}function KW(e){return`/specs/skills/${og(e)}`}function WW(e){const t=e.match(/^\/specs\/skills\/([^/]+)(?:\/file\/([^/]+))?$/);if(!t)return null;const n=t[1];if(!n)return null;const s=ED(n);if(!s)return null;const r=t[2]?RD(t[2]):null;return{skillId:s,filePath:r}}function ip(e){return{id:e.id,name:e.name,entryId:e.id,meta:e.version}}function Pi(e){return e.meta?`${e.name} · ${e.meta}`:e.name}function ap({entry:e}){return i.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name})}function YW({def:e,expanded:t,onToggle:n,navigateTo:s,onNavigate:r}){const a=t?Xr:Bs;return i.jsxs("li",{"data-testid":`specs-section-${e.id}`,children:[s?i.jsxs("div",{className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[i.jsx("button",{type:"button",onClick:n,"data-testid":`specs-section-toggle-${e.id}`,"aria-label":`${t?"Collapse":"Expand"} ${e.label}`,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center text-stone-500 hover:text-stone-900",children:i.jsx(a,{className:"h-3 w-3"})}),i.jsx(Ve,{to:s,"data-testid":`specs-section-link-${e.id}`,onClick:r,className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1 hover:underline",children:e.label}),i.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:e.loading?"...":e.entries.length})]}):i.jsxs("button",{type:"button",onClick:n,"data-testid":`specs-section-toggle-${e.id}`,className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[i.jsx(a,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx("span",{className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1",children:e.label}),i.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:e.loading?"...":e.entries.length})]}),t?i.jsx("ul",{className:"ml-5 border-l border-stone-200",children:e.entries.length>0?e.entries.map(l=>i.jsx("li",{className:"px-2 py-0.5",children:l.entryId?i.jsx(Ve,{to:"/specs/library/$entryId",params:{entryId:l.entryId},"data-testid":`specs-leaf-${l.id}`,title:Pi(l),"aria-label":Pi(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:i.jsx(ap,{entry:l})}):l.skillId?i.jsx(Ve,{to:"/specs/skills/$skillToken",params:{skillToken:og(l.skillId)},"data-testid":`specs-leaf-${l.id}`,title:Pi(l),"aria-label":Pi(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:i.jsx(ap,{entry:l})}):l.pluginId?i.jsx(Ve,{to:"/plugins/$pluginId",params:{pluginId:l.pluginId},"data-testid":`specs-leaf-${l.id}`,title:Pi(l),"aria-label":Pi(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:i.jsx(ap,{entry:l})}):i.jsx("div",{"data-testid":`specs-leaf-${l.id}`,title:Pi(l),"aria-label":Pi(l),className:"flex min-w-0 items-center justify-between gap-2 truncate font-mono text-xs text-on-surface",children:i.jsx(ap,{entry:l})})},l.id)):i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:e.loading?"Loading...":`No ${e.label.toLowerCase()} yet.`})}):null]})}function QW(){const e=va(),{data:t=[],isLoading:n}=Rc(),{data:s=[],isLoading:r}=ak(),{data:a=[],isLoading:l}=ok(),{data:u=[],isLoading:d}=ig(),{data:f=[],isLoading:p}=ag(),m=WW(e.location.pathname),[x,y]=C.useState({"rig-specs":!0,"workspace-specs":!1,"workflow-specs":!1,"context-packs":!1,"agent-specs":!1,"agent-images":!1,applications:!1,skills:!1,plugins:!1}),[v,b]=C.useState({}),w=k=>y(_=>({..._,[k]:!_[k]})),S=k=>b(_=>({..._,[k]:!_[k]})),E=C.useMemo(()=>{const k=t.filter(A=>A.kind==="rig"&&!A.hasServices).map(ip),_=t.filter(A=>A.kind==="workflow").map(ip),R=t.filter(A=>A.kind==="agent").map(ip),T=t.filter(A=>A.kind==="rig"&&A.hasServices).map(ip);return[{id:"rig-specs",label:"Rig Specs",entries:k,loading:n},{id:"workspace-specs",label:"Workspace Specs",entries:[]},{id:"workflow-specs",label:"Workflow Specs",entries:_,loading:n},{id:"context-packs",label:"Context Packs",entries:s.map(A=>({id:A.id,name:A.name,entryId:A.id,meta:`${A.version} · ${A.sourceType}`})),loading:r},{id:"agent-specs",label:"Agent Specs",entries:R,loading:n},{id:"agent-images",label:"Agent Images",entries:a.map(A=>({id:A.id,name:A.name,entryId:A.id,meta:A.version,metaNode:i.jsx(Gn,{runtime:A.runtime,size:"xs",compact:!0,variant:"inline"})})),loading:l},{id:"applications",label:"Applications",entries:T,loading:n},{id:"plugins",label:"Plugins",entries:f.map(A=>({id:A.id,name:A.name,pluginId:A.id,meta:A.version})),loading:p},{id:"skills",label:"Skills",entries:u.map(A=>({id:A.id,name:A.name,skillId:A.id})),loading:d}]},[a,l,s,r,t,f,p,u,d,n]);return i.jsxs("div",{"data-testid":"specs-tree-view",className:"flex-1 overflow-y-auto py-2",children:[i.jsx("div",{className:"px-2 mb-2",children:i.jsxs(Ve,{to:"/specs","data-testid":"specs-tree-overview-link",className:"block font-mono text-[11px] uppercase tracking-wide text-stone-900 px-2 py-1 hover:bg-surface-low",children:["> ","Library"]})}),i.jsx("ul",{children:E.map(k=>{if(k.id!=="skills"){const T=k.id==="plugins"?"/specs/plugins":void 0;return i.jsx(YW,{def:k,expanded:!!x[k.id],onToggle:()=>w(k.id),navigateTo:T,onNavigate:T?()=>y(A=>({...A,[k.id]:!0})):void 0},k.id)}const _=x.skills||!!m,R=_?Xr:Bs;return i.jsxs("li",{"data-testid":"specs-section-skills",children:[i.jsxs("div",{className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[i.jsx("button",{type:"button",onClick:()=>w("skills"),"data-testid":"specs-section-toggle-skills","aria-label":`${_?"Collapse":"Expand"} Skills`,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center text-stone-500 hover:text-stone-900",children:i.jsx(R,{className:"h-3 w-3"})}),i.jsx(Ve,{to:"/specs/skills","data-testid":"specs-section-link-skills",onClick:()=>y(T=>({...T,skills:!0})),className:"font-mono text-[11px] uppercase tracking-wide text-stone-900 flex-1 hover:underline",children:"Skills"}),i.jsx("span",{className:"font-mono text-[10px] text-on-surface-variant",children:d?"...":u.length})]}),_?i.jsx(ZW,{skills:u,loading:d,activeSkillId:(m==null?void 0:m.skillId)??null,expandedCategories:v,onToggleCategory:S}):null]},k.id)})})]})}function XW(e){const t=e.replace(/^[^:]+:/,"");if(t.startsWith("workspace:")||e.startsWith("workspace:"))return"workspace";const n=t.indexOf("/");return n===-1?"(uncategorized)":t.slice(0,n)}function ZW({skills:e,loading:t,activeSkillId:n,expandedCategories:s,onToggleCategory:r}){if(t&&e.length===0)return i.jsx("ul",{className:"ml-5 border-l border-stone-200",children:i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"Loading..."})});if(e.length===0)return i.jsx("ul",{className:"ml-5 border-l border-stone-200",children:i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No skills yet."})});const a=new Map;for(const u of e){const d=XW(u.id),f=a.get(d)??[];f.push(u),a.set(d,f)}const l=Array.from(a.entries()).sort(([u],[d])=>u.localeCompare(d));return i.jsx("ul",{className:"ml-5 border-l border-stone-200","data-testid":"skills-category-tree",children:l.map(([u,d])=>{const f=`category:${u}`,p=!!s[f]||d.some(x=>x.id===n),m=p?Xr:Bs;return i.jsxs("li",{"data-testid":`skills-category-${u}`,children:[i.jsxs("button",{type:"button",onClick:()=>r(f),"data-testid":`skills-category-toggle-${u}`,className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[i.jsx(m,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide text-stone-700 flex-1",children:u}),i.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:d.length})]}),p&&i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:d.map(x=>i.jsx("li",{className:"px-2 py-0.5",children:i.jsxs(Ve,{to:"/specs/skills/$skillToken",params:{skillToken:og(x.id)},"data-testid":`specs-leaf-${x.id}`,className:"flex min-w-0 items-center gap-1.5 truncate font-mono text-xs text-on-surface hover:bg-surface-low hover:text-stone-900",children:[i.jsx($e,{tool:"skill",size:"xs",title:`${x.name} skill`,decorative:!0}),i.jsx("span",{className:"truncate",children:x.name})]})},x.id))})]},u)})})}const JW=[{id:"settings",label:"Settings",href:"/settings",isActive:e=>e==="/settings"},{id:"policies",label:"Policies",href:"/settings/policies",isActive:e=>e.startsWith("/settings/policies")},{id:"log",label:"Log",href:"/settings/log",isActive:e=>e.startsWith("/settings/log")},{id:"status",label:"Status",href:"/settings/status",isActive:e=>e.startsWith("/settings/status")}];function eY(){const t=va().location.pathname;return i.jsxs("div",{"data-testid":"settings-explorer",className:"flex-1 overflow-y-auto py-2",children:[i.jsx("div",{className:"px-2 mb-2",children:i.jsxs("span",{"data-testid":"settings-explorer-heading",className:"block font-mono text-[11px] uppercase tracking-wide text-stone-900 px-2 py-1",children:["> ","Settings"]})}),i.jsx("ul",{className:"px-2 space-y-0.5",children:JW.map(n=>{const s=n.isActive(t);return i.jsx("li",{children:i.jsx(Ve,{to:n.href,"data-testid":`settings-explorer-item-${n.id}`,"data-active":s,className:he("block font-mono text-[11px] uppercase tracking-wide px-2 py-1",s?"bg-stone-900 text-stone-50":"text-stone-700 hover:text-stone-900 hover:bg-surface-low"),children:n.label})},n.id)})})]})}async function tY(){const e=await fetch("/api/rigs/summary?archived=only");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function nY(e){return qe({queryKey:["rigs","summary","archived"],queryFn:tY,enabled:(e==null?void 0:e.enabled)??!0})}async function sY(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function lk(e){return qe({queryKey:["rig",e,"nodes"],queryFn:()=>sY(e),enabled:!!e,refetchInterval:3e4})}function ar(e){if(!e)return null;const t=e.split(".");return t.length<=1?e:t[0]??e}function Ql(e){return e&&e.length>0?e:"ungrouped"}function lg(e){if(!e)return"unknown";const t=e.split(".");return t.length<=1?e:t.at(-1)??e}function rY(){const e=va({select:r=>r.location.pathname}),t=e.match(/^\/topology\/seat\/([^/]+)\/(.+)$/);if(t){const r=decodeURIComponent(t[1]),a=decodeURIComponent(t[2]),l=ar(a)??"default";return{rigId:r,podName:l,logicalId:a}}const n=e.match(/^\/topology\/pod\/([^/]+)\/([^/]+)$/);if(n)return{rigId:decodeURIComponent(n[1]),podName:decodeURIComponent(n[2]),logicalId:null};const s=e.match(/^\/topology\/rig\/([^/]+)$/);return s?{rigId:decodeURIComponent(s[1]),podName:null,logicalId:null}:{rigId:null,podName:null,logicalId:null}}function iY({rigId:e,logicalId:t,label:n,runtime:s,isActive:r}){return i.jsx("li",{className:"px-2 py-0.5 hover:bg-surface-low",children:i.jsxs(Ve,{to:"/topology/seat/$rigId/$logicalId",params:{rigId:e,logicalId:encodeURIComponent(t)},"data-testid":`topology-seat-${e}-${t}`,"data-active":r,className:he("flex w-full min-w-0 items-center gap-1.5 font-mono text-xs",r?"text-stone-900 font-bold":"text-on-surface hover:text-stone-900"),children:[i.jsx(Q2,{runtime:s,size:"xs"}),i.jsx("span",{className:"truncate",children:n})]})})}function aY({rigId:e,podName:t,seats:n,activeRigId:s,activePodName:r,activeLogicalId:a}){const[l,u]=C.useState(!1),d=s===e&&r===t;return C.useEffect(()=>{d&&!l&&u(!0)},[d,l]),i.jsxs("li",{"data-testid":`topology-pod-${e}-${t}`,children:[i.jsxs("button",{type:"button",onClick:()=>u(f=>!f),className:"w-full flex items-center gap-1 px-2 py-0.5 hover:bg-surface-low text-left",children:[l?i.jsx(Xr,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(Bs,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(Ve,{to:"/topology/pod/$rigId/$podName",params:{rigId:e,podName:t},onClick:f=>f.stopPropagation(),className:"font-mono text-[11px] text-stone-900 flex-1 truncate hover:underline",children:Ql(t)}),i.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:n.length})]}),l?i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:n.map(f=>i.jsx(iY,{rigId:e,logicalId:f.logicalId,label:f.label,runtime:f.runtime,isActive:s===e&&a===f.logicalId},f.logicalId))}):null]})}function AD({rigId:e,rigName:t,activeRigId:n,activePodName:s,activeLogicalId:r}){const a=n===e,[l,u]=C.useState(!1);C.useEffect(()=>{a&&!l&&u(!0)},[a,l]);const d=l||a,{data:f}=lk(d?e:null),p=new Map;for(const x of f??[]){const y=ar(x.logicalId)??"default";p.has(y)||p.set(y,[]),p.get(y).push({logicalId:x.logicalId,label:x.canonicalSessionName??x.logicalId,runtime:x.runtime})}const m=Array.from(p.entries());return i.jsxs("li",{"data-testid":`topology-rig-${e}`,children:[i.jsxs("button",{type:"button",onClick:()=>u(x=>!x),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[l?i.jsx(Xr,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(Bs,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(Ve,{to:"/topology/rig/$rigId",params:{rigId:e},onClick:x=>x.stopPropagation(),className:"font-mono text-[11px] uppercase text-stone-900 flex-1 truncate hover:underline",children:t})]}),l?i.jsx("ul",{className:"ml-4 border-l border-stone-200",children:m.length===0?i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"Loading…"}):m.map(([x,y])=>i.jsx(aY,{rigId:e,podName:x,seats:y,activeRigId:n,activePodName:s,activeLogicalId:r},x))}):null]})}function oY({activeRigId:e,activePodName:t,activeLogicalId:n}){const[s,r]=C.useState(!1),{data:a}=nY({enabled:s}),l=(a==null?void 0:a.length)??0;return i.jsxs("li",{"data-testid":"topology-archive-section",children:[i.jsxs("button",{type:"button",onClick:()=>r(u=>!u),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[s?i.jsx(Xr,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(Bs,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(bV,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx("span",{className:"font-mono text-[11px] uppercase text-on-surface-variant flex-1",children:"Archive"}),s?i.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:l}):null]}),s?i.jsx("ul",{className:"ml-5",children:l===0?i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No archived rigs."}):a.map(u=>i.jsx(AD,{rigId:u.id,rigName:u.name,activeRigId:e,activePodName:t,activeLogicalId:n},u.id))}):null]})}function lY(){const{data:e}=dr(),[t,n]=C.useState(!0),{rigId:s,podName:r,logicalId:a}=rY();return i.jsx("div",{"data-testid":"topology-tree-view",className:"flex-1 overflow-y-auto py-2",children:i.jsx("ul",{children:i.jsxs("li",{"data-testid":"topology-host-localhost",children:[i.jsxs("button",{type:"button",onClick:()=>n(l=>!l),className:"w-full flex items-center gap-1 px-2 py-1 hover:bg-surface-low text-left",children:[t?i.jsx(Xr,{className:"h-3 w-3 text-on-surface-variant"}):i.jsx(Bs,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(XV,{className:"h-3 w-3 text-on-surface-variant"}),i.jsx(Ve,{to:"/topology",onClick:l=>l.stopPropagation(),className:"font-mono text-[11px] uppercase text-stone-900 flex-1 hover:underline",children:"localhost"}),i.jsx("span",{className:"font-mono text-[9px] text-on-surface-variant",children:(e==null?void 0:e.length)??0})]}),t?i.jsxs("ul",{className:"ml-5",children:[e&&e.length>0?e.map(l=>i.jsx(AD,{rigId:l.id,rigName:l.name,activeRigId:s,activePodName:r,activeLogicalId:a},l.id)):i.jsx("li",{className:"px-2 py-1 font-mono text-[10px] text-on-surface-variant italic",children:"No rigs."}),i.jsx(oY,{activeRigId:s,activePodName:r,activeLogicalId:a})]}):null]})})})}const cY={approvals:"feed.subscriptions.approvals",shipped:"feed.subscriptions.shipped",progress:"feed.subscriptions.progress",auditLog:"feed.subscriptions.audit_log"},Cl={actionRequired:!0,approvals:!0,shipped:!0,progress:!0,auditLog:!1};function zu(e,t){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1}return t}function TD(){var u,d,f,p,m;const{data:e,error:t}=wa(),n=V2(),s=e==null?void 0:e.settings,r=!!t||!s,a=r?Cl:{actionRequired:zu((u=s==null?void 0:s["feed.subscriptions.action_required"])==null?void 0:u.value,Cl.actionRequired),approvals:zu((d=s==null?void 0:s["feed.subscriptions.approvals"])==null?void 0:d.value,Cl.approvals),shipped:zu((f=s==null?void 0:s["feed.subscriptions.shipped"])==null?void 0:f.value,Cl.shipped),progress:zu((p=s==null?void 0:s["feed.subscriptions.progress"])==null?void 0:p.value,Cl.progress),auditLog:zu((m=s==null?void 0:s["feed.subscriptions.audit_log"])==null?void 0:m.value,Cl.auditLog)};return{state:a,toggle:x=>{const y=cY[x],v=a[x];n.mutate({key:y,value:v?"false":"true"})},isMutating:n.isPending,unavailable:r}}function uY(e,t){switch(e){case"action-required":return t.actionRequired;case"approval":return t.approvals;case"shipped":return t.shipped;case"progress":return t.progress;case"observation":return t.auditLog}}const dY=[{toggleKey:null,label:"Action required",description:"Items the human must act on",forced:!0,testId:"subscription-toggle-action-required"},{toggleKey:"approvals",label:"Approvals",description:"Closeout-pending-ratify items",testId:"subscription-toggle-approvals"},{toggleKey:"shipped",label:"Feature ships",description:"Slice / mission deliveries + git tag landings",testId:"subscription-toggle-shipped"},{toggleKey:"progress",label:"Slice progress",description:"Compact progress rollups",testId:"subscription-toggle-progress"},{toggleKey:"auditLog",label:"Audit log",description:"Verbose stream + watchdog observations",testId:"subscription-toggle-audit-log"}];function fY(){const{state:e,toggle:t,isMutating:n,unavailable:s}=TD();return i.jsxs("div",{"data-testid":"subscription-toggle-list",className:"font-mono text-xs",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant mb-2",children:"Subscriptions"}),i.jsx("ul",{className:"space-y-1",children:dY.map(r=>{const a=r.toggleKey===null?e.actionRequired:e[r.toggleKey],l=!r.forced&&!s;return i.jsxs("li",{"data-testid":r.testId,"data-on":a?"true":"false",className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-stone-900 truncate",children:r.label}),i.jsx("div",{className:"font-mono text-[9px] text-on-surface-variant truncate",children:r.description})]}),r.forced?i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-wide text-on-surface-variant shrink-0",children:"forced ON"}):i.jsx("button",{type:"button",role:"switch","aria-checked":a,disabled:!l||n,"data-testid":`${r.testId}-button`,onClick:()=>r.toggleKey&&t(r.toggleKey),className:"shrink-0 px-2 py-0.5 border font-mono text-[9px] uppercase tracking-wide "+(a?"border-success text-success":"border-stone-300 text-on-surface-variant")+(l?" hover:bg-stone-100/60":" opacity-60 cursor-not-allowed"),children:a?"on":"off"})]},r.testId)})}),s?i.jsxs("p",{"data-testid":"subscription-toggle-unavailable",className:"mt-3 font-mono text-[9px] text-on-surface-variant italic",children:["Settings endpoint unreachable (legacy daemon < v0.3.0). Toggles render the canonical defaults; configure via CLI:",i.jsx("code",{className:"ml-1 text-stone-700",children:"rig config set feed.subscriptions.<kind> true|false"})]}):null]})}function $T(e,t){return e==="topology"&&!t}function hY(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function pY({surface:e,rigs:t,psMap:n,selection:s,onSelect:r,onClose:a,currentRigId:l}){return e==="topology"?i.jsx(lY,{}):e==="project"?i.jsx(NW,{}):e==="specs"?i.jsx(QW,{}):e==="settings"?i.jsx(eY,{}):e==="for-you"?i.jsx("div",{"data-testid":"explorer-for-you-subscriptions",className:"flex-1 overflow-y-auto py-3 px-3",children:i.jsx(fY,{})}):null}function mY({open:e,onClose:t,selection:n,onSelect:s,desktopMode:r="full",surface:a="topology",onDesktopToggle:l=()=>{},overlayMode:u="opaque"}){const f=va().location.pathname,p=hY(f),{data:m}=dr(),{data:x}=Xm(),y=new Map((x??[]).map(w=>[w.rigId,w]));if(a==="none")return null;const v=u==="overlay";return r==="hidden"?i.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","data-explorer-collapsed":"true","aria-label":"Expand explorer",onClick:l,className:he("hidden lg:flex fixed top-[5.5rem] left-[3.5rem] z-30 h-8 w-8 items-center justify-center","rounded-full border border-outline-variant bg-background/90 text-stone-700","shadow-[0_2px_8px_rgba(41,37,36,0.08)] backdrop-blur-sm transition-colors","hover:bg-stone-100 hover:text-stone-900"),children:i.jsx(Bs,{className:"h-4 w-4",strokeWidth:1.5})}):i.jsx("aside",{"data-testid":"explorer","data-surface":a,"data-explorer-mode":u,"data-explorer-collapsed":"false",className:he("border-r border-outline-variant flex overflow-hidden",v?"vellum z-30 shadow-[6px_0_14px_rgba(46,52,46,0.06)]":"z-40 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[6px_0_14px_rgba(46,52,46,0.04)]","fixed top-14 bottom-0 left-0 transition-transform duration-200 ease-tactical w-72 max-w-[80vw]",e?"translate-x-0":"-translate-x-full","lg:absolute lg:top-0 lg:bottom-0 lg:left-12 lg:w-72 lg:max-w-none lg:translate-x-0"),children:i.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[i.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","aria-label":"Collapse explorer",onClick:l,className:he("hidden lg:flex absolute z-10 h-8 w-8 items-center justify-center rounded-full border border-outline-variant bg-background/90 text-stone-700","shadow-[0_2px_8px_rgba(41,37,36,0.08)] backdrop-blur-sm transition-colors hover:bg-stone-100 hover:text-stone-900","right-2 top-3"),children:i.jsx(IV,{className:"h-4 w-4",strokeWidth:1.5})}),i.jsx(pY,{surface:a,rigs:m,psMap:y,selection:n,onSelect:s,onClose:t,currentRigId:p})]})})}const gY="/api/events";class xY{constructor(){ts(this,"eventSource",null);ts(this,"eventListeners",new Set);ts(this,"statusListeners",new Set);ts(this,"replayEvents",[]);ts(this,"connected",!1);ts(this,"reconnecting",!1)}subscribe(t){this.eventListeners.add(t),this.ensureConnected();for(const n of this.replayEvents)t(n.event,n.rawData);return()=>{this.eventListeners.delete(t),this.closeIfIdle()}}subscribeStatus(t){return this.statusListeners.add(t),t(this.snapshot()),this.ensureConnected(),()=>{this.statusListeners.delete(t),this.closeIfIdle()}}snapshot(){return{connected:this.connected,reconnecting:this.reconnecting}}ensureConnected(){if(this.eventSource||typeof EventSource>"u")return;const t=new EventSource(gY);this.eventSource=t,t.addEventListener("open",()=>{this.connected=!0,this.reconnecting=!1,this.emitStatus()}),t.addEventListener("error",()=>{this.connected=!1,this.reconnecting=!0,this.emitStatus()}),t.addEventListener("message",n=>{const s=n.data;if(typeof s!="string")return;let r=null;try{r=JSON.parse(s)}catch{return}if(!r||typeof r!="object")return;const a=r;this.replayEvents=[...this.replayEvents,{event:a,rawData:s}].slice(-100);for(const l of[...this.eventListeners])l(a,s)})}closeIfIdle(){this.eventListeners.size>0||this.statusListeners.size>0||(this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.replayEvents=[],this.connected=!1,this.reconnecting=!1)}emitStatus(){const t=this.snapshot();for(const n of[...this.statusListeners])n(t)}}const ID=new xY;function cg(e){return ID.subscribe(e)}function MD(e){return ID.subscribeStatus(e)}const TN=100;function ck(){const e=Mt(),[t,n]=C.useState([]),[s,r]=C.useState(!1),[a,l]=C.useState(!1),u=C.useCallback(d=>{const f={seq:typeof d.seq=="number"?d.seq:Date.now(),type:d.type??"unknown",payload:d,createdAt:d.createdAt??new Date().toISOString(),receivedAt:Date.now()};if(n(p=>[f,...p].slice(0,TN)),(f.type==="package.installed"||f.type==="package.rolledback")&&e.invalidateQueries({queryKey:["packages"]}),(f.type==="bootstrap.completed"||f.type==="bootstrap.partial")&&e.invalidateQueries({queryKey:["rigs","summary"]}),(f.type==="session.discovered"||f.type==="session.vanished")&&e.invalidateQueries({queryKey:["discovery"]}),f.type==="mission_control.action_executed"){e.invalidateQueries({queryKey:["mission-control","audit"]}),e.invalidateQueries({queryKey:["slices"]});const p=f.payload.qitemId;p&&e.invalidateQueries({queryKey:["queue","item",p]})}if(f.type==="node.claimed"){e.invalidateQueries({queryKey:["discovery"]});const p=f.payload.rigId;p&&(e.invalidateQueries({queryKey:["rig",p,"graph"]}),e.invalidateQueries({queryKey:["rig",p,"nodes"]}),e.invalidateQueries({queryKey:["rig",p,"sessions"]}),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]}))}if(f.type==="session.detached"&&e.invalidateQueries({queryKey:["discovery"]}),f.type==="session.detached"||f.type==="node.removed"||f.type==="pod.deleted"||f.type==="rig.expanded"||f.type==="restore.completed"||f.type==="rig.deleted"){const p=f.payload.rigId;p&&(e.invalidateQueries({queryKey:["rig",p,"graph"]}),e.invalidateQueries({queryKey:["rig",p,"nodes"]}),e.invalidateQueries({queryKey:["rig",p,"sessions"]})),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]})}if(f.type.startsWith("queue.")||f.type.startsWith("qitem.")||f.type.startsWith("inbox.")){e.invalidateQueries({queryKey:["attention-items"]});const p=f.payload.qitemId??f.payload.qitem_id;p&&e.invalidateQueries({queryKey:["queue","item",p]})}},[e]);return C.useEffect(()=>{const d=cg(p=>u(p)),f=MD(p=>{r(p.connected)});return()=>{d(),f()}},[u]),{events:t,connected:s,feedOpen:a,setFeedOpen:l}}function Gy(e){return String(e).padStart(2,"0")}function op(e,t=6){return typeof e!="string"||e.length===0?null:e.slice(-t)}function lp(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g," ").trim();return t.length>0?t:null}function yY(e){const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"??:??:??":`${Gy(t.getHours())}:${Gy(t.getMinutes())}:${Gy(t.getSeconds())}`}function vY(e){return e==="bundle.created"||e.startsWith("bootstrap.")?"bg-accent":e.startsWith("package.")?"bg-primary":e.startsWith("rig.")?"bg-accent":e.startsWith("snapshot.")?"bg-primary":e.startsWith("restore.")?"bg-warning":e==="chat.message"?"bg-primary":e==="node.startup_ready"?"bg-green-500":e==="node.startup_pending"?"bg-amber-400":e==="node.startup_failed"||e==="session.detached"?"bg-destructive":e==="session.discovered"?"bg-accent":e==="session.vanished"?"bg-destructive":e==="node.claimed"||e==="node.launched"?"bg-primary":"bg-foreground-muted-on-dark"}function bY(e){var f;const t=e.payload,n=op(t.rigId),s=op(t.snapshotId),r=op(t.installId),a=op(t.nodeId),l=lp(t.logicalId),u=lp(t.sender),d=lp(t.body);switch(e.type){case"bootstrap.planned":return`bootstrap planned ${t.sourceRef}`;case"bootstrap.started":return`bootstrap started ${t.sourceRef}`;case"bootstrap.completed":return n?`bootstrap rig#${n} completed`:"bootstrap completed";case"bootstrap.partial":return`bootstrap partial ${t.completed} ok ${t.failed} failed`;case"bootstrap.failed":return`error bootstrap ${t.error}`;case"package.validated":return`package ${t.packageName} validated`;case"package.planned":return`package ${t.packageName} planned ${t.actionable} actionable ${t.deferred} deferred`;case"package.installed":return`package ${t.packageName}@${t.packageVersion} ${t.applied} applied ${t.deferred} deferred`;case"package.rolledback":return r?`rollback install#${r} restored ${t.restored}`:`rollback restored ${t.restored}`;case"package.install_failed":return`error package ${t.packageName} ${t.message}`;case"rig.created":return n?`rig rig#${n} created`:"rig created";case"rig.deleted":return n?`rig rig#${n} deleted`:"rig deleted";case"rig.imported":return n?`import ${t.specName} rig#${n} created`:`import ${t.specName} created`;case"snapshot.created":return n&&s?`snapshot rig#${n} ${t.kind} snap#${s}`:`snapshot ${t.kind}`;case"restore.started":return n?`restore rig#${n} started`:"restore started";case"restore.completed":{const p=Array.isArray(t.result)?t.result:((f=t.result)==null?void 0:f.nodes)??[];return n?`restore rig#${n} ${p.length} nodes restored`:`restore ${p.length} nodes restored`}case"node.launched":return`startup ${l??lp(t.nodeId)??"unknown"} launched`;case"node.startup_pending":return a?`startup node#${a} pending`:"startup pending";case"node.startup_ready":return a?`startup node#${a} ready`:"startup ready";case"node.startup_failed":return a?`error startup node#${a} ${t.error}`:`error startup ${t.error}`;case"session.detached":return`error session ${t.sessionName} lost`;case"bundle.created":return`bundle ${t.bundleName} v${t.bundleVersion} bundled`;case"session.discovered":return`discover ${t.tmuxSession}:${t.tmuxPane} ${t.runtimeHint}`;case"session.vanished":return`error ${t.tmuxSession}:${t.tmuxPane} vanished`;case"node.claimed":return n?`claim ${t.logicalId} rig#${n}`:`claim ${t.logicalId}`;case"chat.message":return`chat ${u??"unknown"}: ${d??""}`.trim();default:return e.type}}function wY(e){const n=e.payload.rigId;if(e.type==="session.discovered"||e.type==="session.vanished")return"/discovery";if(e.type==="node.claimed"){const s=e.payload.rigId;return s?`/rigs/${s}`:"/discovery"}return e.type.startsWith("bootstrap.")||e.type.startsWith("package.")?"/bootstrap":n?`/rigs/${n}`:null}function jY({events:e}){const t=It(),n=e.length>=TN;return i.jsxs("div",{"data-testid":"feed-scroll-region",className:"relative z-10 overflow-y-auto flex-1 min-h-0",children:[i.jsxs("div",{"data-testid":"feed-disclosure",className:"px-spacing-3 py-2 border-b border-stone-300/20 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-500",children:["Showing last ",TN," live events in this panel."]}),e.length===0?i.jsx("div",{"data-testid":"feed-empty",className:"px-spacing-3 py-spacing-4 font-mono text-[10px] text-stone-500 text-center",children:"No recent log entries"}):i.jsxs(i.Fragment,{children:[e.map(s=>{const r=wY(s),a=r!==null;return i.jsxs("div",{"data-testid":"feed-entry","data-event-type":s.type,role:a?"link":void 0,tabIndex:a?0:void 0,onClick:a?()=>t({to:r}):void 0,onKeyDown:a?l=>{l.key==="Enter"&&t({to:r})}:void 0,className:he("flex items-center gap-2 px-spacing-3 py-1.5 border-b border-stone-300/20 transition-colors duration-150 ease-tactical font-mono text-[10px] leading-4",a&&"cursor-pointer hover:bg-white/24"),children:[i.jsx("span",{"data-testid":"feed-dot",className:he("inline-block h-[6px] w-[6px] shrink-0",vY(s.type))}),i.jsx("span",{"data-testid":"feed-time",className:"shrink-0 text-[9px] text-stone-500 tabular-nums",children:yY(s.createdAt)}),i.jsx("span",{"data-testid":"feed-summary",className:"min-w-0 flex-1 truncate text-stone-900",children:bY(s)})]},s.seq)}),n?i.jsx("div",{"data-testid":"feed-end-of-history",className:"px-spacing-3 py-2 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-400 text-center",children:"Older events are not loaded in this panel yet."}):null]})]})}function ms({label:e,settingKey:t,resolved:n,testIdPrefix:s}){const[r,a]=C.useState(!1),[l,u]=C.useState(String(n.value??"")),[d,f]=C.useState(null),p=V2(),m=MK(),x=n.source!=="default",y=async()=>{f(null);try{await p.mutateAsync({key:t,value:l}),a(!1)}catch(b){f(b.message)}},v=async()=>{f(null);try{await m.mutateAsync(t)}catch(b){f(b.message)}};return i.jsxs("div",{"data-testid":`${s}-${t}`,className:"border border-stone-300/40 bg-white/8 px-3 py-2 space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"font-mono text-[10px] text-stone-700 truncate",children:e}),i.jsxs("span",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500 shrink-0",children:["source: ",n.source]})]}),r?i.jsxs("div",{className:"space-y-1",children:[i.jsx("input",{"data-testid":`${s}-${t}-input`,value:l,onChange:b=>u(b.target.value),className:"w-full border border-stone-300 bg-white/80 px-2 py-1 font-mono text-[10px]"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{"data-testid":`${s}-${t}-save`,onClick:()=>void y(),disabled:p.isPending,className:"font-mono text-[8px] uppercase border border-stone-300 px-2 py-0.5 hover:bg-stone-200 disabled:opacity-50",children:"Save"}),i.jsx("button",{onClick:()=>{a(!1),u(String(n.value??"")),f(null)},className:"font-mono text-[8px] uppercase text-stone-500 hover:text-stone-900",children:"Cancel"})]})]}):i.jsxs("div",{className:"space-y-0.5",children:[i.jsx("div",{className:"font-mono text-[10px] text-stone-800 break-all",children:String(n.value??"")}),i.jsxs("div",{className:"font-mono text-[8px] text-stone-500 break-all",children:["default: ",String(n.defaultValue??"")]}),i.jsxs("div",{className:"flex gap-1 pt-1",children:[i.jsx("button",{"data-testid":`${s}-${t}-edit`,onClick:()=>{a(!0),f(null)},className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200",children:"Edit"}),x&&i.jsx("button",{"data-testid":`${s}-${t}-reset`,onClick:()=>void v(),disabled:m.isPending,className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200 disabled:opacity-50",children:"Reset"})]})]}),d&&i.jsx("div",{"data-testid":`${s}-${t}-error`,className:"font-mono text-[9px] text-red-600",children:d})]})}function Bu({title:e,children:t}){return i.jsxs("section",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),i.jsx("div",{className:"space-y-1",children:t})]})}function OD(){const{data:e,isLoading:t,error:n}=wa(),s=OK(),[r,a]=C.useState(null),[l,u]=C.useState(null),d=async()=>{u(null),a(null);try{const p=await s.mutateAsync({});a(`Initialized at ${p.root} — created ${p.subdirs.filter(m=>m.created).length} subdir(s).`)}catch(p){u(p.message)}};if(t)return i.jsx("div",{"data-testid":"settings-loading",className:"px-4 py-3 font-mono text-[10px] text-stone-400",children:"Loading settings…"});if(n||!e){const p=(n==null?void 0:n.message)??"",m=p.includes("404");return i.jsx("div",{"data-testid":"settings-error",className:"px-4 py-6 font-mono text-xs text-on-surface-variant border border-outline-variant bg-surface-low",children:m?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-stone-900 font-bold uppercase tracking-wide text-[10px] mb-2",children:"Settings UI requires daemon ≥ v0.3.0"}),i.jsx("p",{className:"mb-2",children:"The shipped daemon doesn't expose the settings HTTP route yet. Until that lands, configure via the CLI:"}),i.jsx("pre",{className:"font-mono text-[10px] bg-stone-50 border border-outline-variant px-2 py-1 inline-block",children:"rig config get / set / reset"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-stone-900 font-bold uppercase tracking-wide text-[10px] mb-2",children:"Settings unavailable"}),i.jsx("p",{children:p||"Daemon is unreachable."})]})})}const f=e.settings;return i.jsxs("div",{"data-testid":"settings-tab",className:"flex-1 overflow-y-auto px-4 py-3 space-y-4",children:[i.jsxs(Bu,{title:"Workspace",children:[i.jsx(ms,{label:"Workspace root",settingKey:"workspace.root",resolved:f["workspace.root"],testIdPrefix:"setting"}),i.jsx(ms,{label:"Mission/slice root",settingKey:"workspace.slices_root",resolved:f["workspace.slices_root"],testIdPrefix:"setting"}),i.jsx(ms,{label:"Steering path",settingKey:"workspace.steering_path",resolved:f["workspace.steering_path"],testIdPrefix:"setting"}),i.jsx(ms,{label:"Field notes root",settingKey:"workspace.field_notes_root",resolved:f["workspace.field_notes_root"],testIdPrefix:"setting"}),i.jsx(ms,{label:"Specs root",settingKey:"workspace.specs_root",resolved:f["workspace.specs_root"],testIdPrefix:"setting"}),i.jsx("button",{"data-testid":"settings-init-workspace",onClick:()=>void d(),disabled:s.isPending,className:"mt-2 font-mono text-[9px] uppercase border border-stone-400 px-2 py-1 hover:bg-stone-200 disabled:opacity-50",children:s.isPending?"Initializing…":"Init Workspace"}),r&&i.jsx("div",{"data-testid":"settings-init-result",className:"font-mono text-[9px] text-stone-600",children:r}),l&&i.jsx("div",{"data-testid":"settings-init-error",className:"font-mono text-[9px] text-red-600",children:l})]}),i.jsx(Bu,{title:"Files (browser allowlist)",children:i.jsx(ms,{label:"Allowlist (name:/abs/path,...)",settingKey:"files.allowlist",resolved:f["files.allowlist"],testIdPrefix:"setting"})}),i.jsx(Bu,{title:"Progress",children:i.jsx(ms,{label:"Scan roots (name:/abs/path,...)",settingKey:"progress.scan_roots",resolved:f["progress.scan_roots"],testIdPrefix:"setting"})}),i.jsxs(Bu,{title:"Daemon (legacy)",children:[i.jsx(ms,{label:"Port",settingKey:"daemon.port",resolved:f["daemon.port"],testIdPrefix:"setting"}),i.jsx(ms,{label:"Host",settingKey:"daemon.host",resolved:f["daemon.host"],testIdPrefix:"setting"})]}),i.jsxs(Bu,{title:"Database / Transcripts (legacy)",children:[i.jsx(ms,{label:"DB path",settingKey:"db.path",resolved:f["db.path"],testIdPrefix:"setting"}),i.jsx(ms,{label:"Transcripts enabled",settingKey:"transcripts.enabled",resolved:f["transcripts.enabled"],testIdPrefix:"setting"}),i.jsx(ms,{label:"Transcripts path",settingKey:"transcripts.path",resolved:f["transcripts.path"],testIdPrefix:"setting"})]})]})}async function SY(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function NY(){const e=await fetch("/api/adapters/cmux/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function cp(e){return e===null?"text-stone-500":e?"text-green-600":"text-amber-600"}function DT(e,t,n,s="unknown"){return e===null?s:e?t:n}function kY({onClose:e,events:t,initialTab:n="log"}){var f;const[s,r]=C.useState(n);C.useEffect(()=>{r(n)},[n]);const a=qe({queryKey:["daemon","health"],queryFn:SY,refetchInterval:1e4,retry:!1}),l=qe({queryKey:["daemon","cmux"],queryFn:NY,refetchInterval:3e4,retry:!1}),u=a.isSuccess,d=u?((f=l.data)==null?void 0:f.available)??null:null;return i.jsxs("aside",{"data-testid":"system-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[i.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"system"}),i.jsx("button",{"data-testid":"system-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),i.jsxs("div",{className:"flex border-b border-stone-300/35 shrink-0","data-testid":"system-tabs",children:[i.jsx("button",{"data-testid":"system-tab-log",onClick:()=>r("log"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="log"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Recent Log"}),i.jsx("button",{"data-testid":"system-tab-status",onClick:()=>r("status"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="status"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Status"}),i.jsx("button",{"data-testid":"system-tab-settings",onClick:()=>r("settings"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${s==="settings"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Settings"})]}),s==="log"&&i.jsx("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden","data-testid":"system-log-tab",children:i.jsx(jY,{events:t})}),s==="status"&&i.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4","data-testid":"system-status-tab",children:i.jsxs("section",{className:"border border-stone-300/28 bg-white/12 px-3 py-3",children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-3",children:"Runtime"}),i.jsxs("div",{className:"space-y-3 font-mono text-[10px]",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(bG,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 ${cp(u)}`}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-stone-900",children:"Daemon"}),i.jsx("div",{"data-testid":"system-daemon-status",className:cp(u),children:DT(u,"connected","unavailable")}),i.jsx("div",{className:"text-stone-500",children:"Controls the local OpenRig daemon connection."})]})]}),i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx($e,{tool:"cmux",size:"sm",className:`mt-[1px] ${cp(d)}`}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-stone-900",children:"cmux control"}),i.jsx("div",{"data-testid":"system-cmux-status",className:cp(d),children:DT(d,"available","unavailable")}),i.jsx("div",{className:"text-stone-500",children:"OpenRig can control cmux surfaces for node open-or-focus."})]})]})]})]})}),s==="settings"&&i.jsx(OD,{})]})}function qT(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ug(...e){return t=>{let n=!1;const s=e.map(r=>{const a=qT(r,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let r=0;r<s.length;r++){const a=s[r];typeof a=="function"?a():qT(e[r],null)}}}}function Io(...e){return C.useCallback(ug(...e),e)}var _Y=Symbol.for("react.lazy"),jm=p2[" use ".trim().toString()];function CY(e){return typeof e=="object"&&e!==null&&"then"in e}function LD(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===_Y&&"_payload"in e&&CY(e._payload)}function EY(e){const t=AY(e),n=C.forwardRef((s,r)=>{let{children:a,...l}=s;LD(a)&&typeof jm=="function"&&(a=jm(a._payload));const u=C.Children.toArray(a),d=u.find(IY);if(d){const f=d.props.children,p=u.map(m=>m===d?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return i.jsx(t,{...l,ref:r,children:C.isValidElement(f)?C.cloneElement(f,void 0,p):null})}return i.jsx(t,{...l,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}var RY=EY("Slot");function AY(e){const t=C.forwardRef((n,s)=>{let{children:r,...a}=n;if(LD(r)&&typeof jm=="function"&&(r=jm(r._payload)),C.isValidElement(r)){const l=OY(r),u=MY(a,r.props);return r.type!==C.Fragment&&(u.ref=s?ug(s,l):l),C.cloneElement(r,u)}return C.Children.count(r)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var TY=Symbol("radix.slottable");function IY(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===TY}function MY(e,t){const n={...t};for(const s in t){const r=e[s],a=t[s];/^on[A-Z]/.test(s)?r&&a?n[s]=(...u)=>{const d=a(...u);return r(...u),d}:r&&(n[s]=r):s==="style"?n[s]={...r,...a}:s==="className"&&(n[s]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function OY(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const zT=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,BT=W$,PD=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return BT(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:a}=t,l=Object.keys(r).map(f=>{const p=n==null?void 0:n[f],m=a==null?void 0:a[f];if(p===null)return null;const x=zT(p)||zT(m);return r[f][x]}),u=n&&Object.entries(n).reduce((f,p)=>{let[m,x]=p;return x===void 0||(f[m]=x),f},{}),d=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((f,p)=>{let{class:m,className:x,...y}=p;return Object.entries(y).every(v=>{let[b,w]=v;return Array.isArray(w)?w.includes({...a,...u}[b]):{...a,...u}[b]===w})?[...f,m,x]:f},[]);return BT(e,l,d,n==null?void 0:n.class,n==null?void 0:n.className)},LY=PD("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors duration-150 ease-tactical focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-stone-900 text-white font-headline font-bold uppercase tracking-widest hover:bg-stone-800",destructive:"bg-tertiary text-white font-bold hover:bg-tertiary/90",outline:"border border-outline bg-transparent hover:bg-stone-100 text-on-surface",secondary:"border border-stone-900 bg-transparent text-stone-900 font-mono text-[10px] uppercase hover:bg-stone-900 hover:text-white",ghost:"text-on-surface-variant hover:bg-stone-100 hover:text-on-surface",link:"text-secondary underline-offset-4 hover:underline",tactical:"border border-outline font-mono text-[10px] text-secondary uppercase tracking-widest hover:border-stone-900 hover:text-stone-900"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),_e=C.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,children:r,...a},l)=>{const u=s?RY:"button";return i.jsx(u,{className:he(LY({variant:t,size:n,className:e})),ref:l,...a,children:r})});_e.displayName="Button";async function Zr(e){var n,s;try{if((s=(n=globalThis.navigator)==null?void 0:n.clipboard)!=null&&s.writeText)return await globalThis.navigator.clipboard.writeText(e),!0}catch{}if(!globalThis.document)return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}catch{return!1}finally{t.remove()}}function uk(e,t=6){return e.length<=t?e:e.slice(-t)}function $D(){const e=Mt();return en({mutationFn:async()=>{const t=await fetch("/api/discovery/scan",{method:"POST"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["discovery"]})}})}function PY(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.runtimeHint&&e.runtimeHint.length>0&&t.set("runtimeHint",e.runtimeHint.join(",")),e!=null&&e.minConfidence&&t.set("minConfidence",e.minConfidence);const n=t.toString();return n?`/api/discovery?${n}`:"/api/discovery"}function dk(e,t=!0){var r;const n=PY(e),s=["discovery",(e==null?void 0:e.status)??"all",((r=e==null?void 0:e.runtimeHint)==null?void 0:r.join(","))??"any",(e==null?void 0:e.minConfidence)??"any"];return qe({queryKey:s,queryFn:async()=>{const a=await fetch(n);if(!a.ok)throw new Error(`HTTP ${a.status}`);const l=await a.json();return Array.isArray(l)?l:[]},enabled:t})}function $Y(e){const{data:t}=dk({status:"active"},e);return t??[]}function DY(){const e=Mt();return en({mutationFn:async({discoveredId:t,rigId:n,logicalId:s})=>{const r=await fetch(`/api/discovery/${encodeURIComponent(t)}/bind`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:n,logicalId:s})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error??`HTTP ${r.status}`)}return r.json()},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",n.rigId,"graph"]})}})}function qY(){const e=Mt();return en({mutationFn:async({discoveredId:t,rigId:n,target:s})=>{const r=await fetch(`/api/discovery/${encodeURIComponent(t)}/adopt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:n,target:s})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error??`HTTP ${r.status}`)}return r.json()},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",n.rigId,"graph"]})}})}function zY(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function BY(e){return`'${e.replace(/'/g,"'\\''")}'`}function FY(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${BY(t)}`}function HY(e){const t=e.split(/[@:]/)[0]??e;return(t.split(/[-_.]/).filter(Boolean).at(-1)??t).toLowerCase().replace(/[^a-z0-9_-]/g,"")||"member"}function FT(e){return e.includes(".")?lg(e):e.length>12?uk(e):e}function HT(e){return e.podLabel??e.podNamespace??uk(e.podId)}function UT({label:e,activeLabel:t,onClick:n,testId:s,tool:r}){const[a,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const d=async()=>{await n()&&(l(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{l(!1),u.current=null},900))};return i.jsxs("button",{type:"button","data-testid":s,"aria-label":e,onClick:()=>{d()},className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors",a?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:[r?i.jsx($e,{tool:r,size:"xs"}):null,i.jsx("span",{children:a?t:e})]})}function UY({onClose:e,selectedDiscoveredId:t,onSelectDiscoveredId:n,placementTarget:s,onClearPlacement:r}){const a=va({select:b=>b.location.pathname}),l=zY(a),{data:u=[]}=dk({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),d=$D(),f=qY(),p=u.find(b=>b.id===t)??null,[m,x]=C.useState("");C.useEffect(()=>{if(p&&(s==null?void 0:s.kind)==="pod"){x(b=>b||HY(p.tmuxSession));return}(!p||!s||s.kind!=="pod")&&x("")},[p,s]);const y=C.useMemo(()=>p?l?s?s.eligible?s.kind==="node"?`Bind ${p.tmuxSession} to ${FT(s.logicalId)}.`:`Add ${p.tmuxSession} to ${HT(s)} pod.`:s.reason??"That target cannot receive the selected session.":`Selected ${p.tmuxSession}. Click an available node to bind it, or click a pod to add it there.`:"Select a rig in the explorer to place the selected session.":null,[l,s,p]),v=()=>{if(!p||!l||!s||!s.eligible)return;let b;if(s.kind==="node")b={kind:"node",logicalId:s.logicalId};else{if(!s.podNamespace)return;b={kind:"pod",podId:s.podId,podNamespace:s.podNamespace,memberName:m.trim()}}f.mutate({discoveredId:p.id,rigId:l,target:b},{onSuccess:()=>{n(null),r()}})};return i.jsxs("aside",{"data-testid":"discovery-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[i.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"discovery"}),i.jsx("button",{"data-testid":"discovery-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),i.jsxs("div",{className:"border-b border-stone-300/35 px-4 py-3 shrink-0 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Inventory"}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"discovery-scan-now",disabled:d.isPending,onClick:()=>d.mutate(),children:d.isPending?"SCANNING...":"SCAN NOW"})]}),i.jsx(Ve,{to:"/discovery/inventory","data-testid":"discovery-open-inventory",onClick:e,className:"inline-flex items-center border border-stone-300 bg-white px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-700 transition-colors hover:bg-stone-100 hover:text-stone-900",children:"Legacy Inventory Page"})]}),i.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:u.length===0?i.jsx("div",{"data-testid":"discovery-empty",className:"font-mono text-[10px] text-stone-500",children:"No running Claude or Codex sessions are currently visible."}):u.map(b=>{const w=b.id===t;return i.jsxs("div",{"data-testid":`discovery-session-${b.id}`,className:he("border border-stone-200 bg-white/60 px-3 py-3",w&&"border-emerald-500 shadow-[0_10px_24px_rgba(34,197,94,0.16)]"),children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx(Gn,{runtime:b.runtimeHint,size:"xs",compact:!0,className:"bg-white/45"}),i.jsx("div",{className:"font-mono text-[10px] text-stone-900 truncate",title:b.tmuxSession,children:b.tmuxSession})]}),b.cwd?i.jsx("div",{className:"mt-1 font-mono text-[9px] text-stone-500 truncate",title:b.cwd,children:b.cwd}):null]}),i.jsx(_e,{variant:w?"tactical":"ghost",size:"sm","data-testid":`discovery-select-${b.id}`,onClick:()=>n(w?null:b.id),children:w?"SELECTED":"SELECT"})]}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[i.jsx(UT,{label:"copy tmux",activeLabel:"copied",testId:`discovery-copy-tmux-${b.id}`,tool:"tmux",onClick:async()=>Zr(FY(b))}),b.cwd?i.jsx(UT,{label:"copy cwd",activeLabel:"copied",testId:`discovery-copy-cwd-${b.id}`,onClick:async()=>Zr(b.cwd??"")}):null]}),w?i.jsxs("div",{className:"mt-3 space-y-2 border-t border-emerald-200/80 pt-3",children:[y?i.jsx("div",{"data-testid":"discovery-selected-session-status",className:"border border-emerald-300/80 bg-white/70 px-2.5 py-2 font-mono text-[10px] leading-5 text-stone-900",children:y}):null,s&&!s.eligible?i.jsx("div",{"data-testid":"discovery-target-error",className:"border border-red-200 bg-red-50/80 px-2.5 py-2 font-mono text-[9px] text-red-700",children:s.reason??"That destination is not available."}):null,s!=null&&s.eligible?i.jsxs("div",{className:"space-y-2 border border-emerald-300/80 bg-white/70 px-3 py-2","data-testid":"discovery-target-card",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",children:"Target"}),i.jsx("div",{"data-testid":"discovery-target-summary",className:"font-mono text-[10px] text-stone-900",children:s.kind==="node"?`${FT(s.logicalId)} selected`:`${HT(s)} pod selected`}),s.kind==="pod"?i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",htmlFor:"discovery-member-name",children:"Member name"}),i.jsx("input",{id:"discovery-member-name","data-testid":"discovery-member-name-input",value:m,onChange:S=>x(S.target.value),className:"w-full bg-transparent border-b border-emerald-300 py-1 font-mono text-[10px] text-stone-900 focus:outline-none focus:border-emerald-700"})]}):null,f.isError?i.jsx("div",{"data-testid":"discovery-adopt-error",className:"font-mono text-[9px] text-red-600",children:f.error.message}):null,i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"discovery-confirm-adopt",disabled:f.isPending||s.kind==="pod"&&!m.trim(),onClick:v,children:f.isPending?"ADOPTING...":"ADOPT"}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"discovery-clear-target",onClick:r,children:"CLEAR"})]})]}):null]}):null]},b.id)})})]})}function dg({testIdPrefix:e,className:t}){const n=s=>e?`${e}-reg-${s}`:void 0;return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:he("reg-tl",t),"data-testid":n("tl"),"aria-hidden":"true"}),i.jsx("span",{className:he("reg-tr",t),"data-testid":n("tr"),"aria-hidden":"true"}),i.jsx("span",{className:he("reg-bl",t),"data-testid":n("bl"),"aria-hidden":"true"}),i.jsx("span",{className:he("reg-br",t),"data-testid":n("br"),"aria-hidden":"true"})]})}const VY={wide:"w-full lg:w-[38rem] lg:max-w-[80vw]",narrow:"w-full lg:w-[22rem] lg:max-w-[60vw]"},GY={left:"border-r border-outline-variant",right:"border-l border-outline-variant"};function KY({children:e,edge:t="right",width:n="wide",onClose:s,className:r,testId:a,...l}){return i.jsxs("div",{className:he("vellum-heavy relative flex flex-col h-full shadow-[0_0_24px_rgba(0,0,0,0.08)]",VY[n],GY[t],r),"data-testid":a,role:"dialog","aria-modal":"false",...l,children:[s?i.jsx("button",{type:"button",onClick:s,"aria-label":"Close sheet",className:"absolute top-2 right-2 z-10 px-2 py-0.5 border border-stone-900 bg-white font-mono text-[10px] hover:bg-stone-100","data-testid":a?`${a}-close`:void 0,children:"×"}):null,i.jsx("div",{className:"flex-1 overflow-auto",children:e}),i.jsx(dg,{testIdPrefix:a})]})}const WY={default:"text-stone-900",muted:"text-on-surface-variant",strong:"text-stone-900 font-bold",alert:"text-tertiary"};function it({children:e,right:t,tone:n="default",as:s="header",className:r,...a}){const l=he("font-mono text-[10px] uppercase tracking-[0.18em] flex items-baseline justify-between gap-2",WY[n],r),u=i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"flex-1",children:e}),t?i.jsx("span",{className:"ml-auto flex items-center gap-2",children:t}):null]});return s==="div"?i.jsx("div",{className:l,...a,children:u}):s==="section"?i.jsx("section",{className:l,...a,children:u}):i.jsx("header",{className:l,...a,children:u})}const YY={primary:"bg-white border border-stone-900",ghost:"bg-transparent border border-stone-300"},QY={elevated:"hard-shadow",flat:""};function Sm({children:e,header:t,registrationMarks:n=!0,elevation:s="elevated",variant:r="primary",accentClass:a,href:l,as:u="div",className:d,testId:f,onClick:p,...m}){const x=!!(l||p),y=he(YY[r],QY[s],"flex flex-col relative",x&&"focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",a,d),v=i.jsxs(i.Fragment,{children:[t?i.jsx("div",{className:"bg-stone-900 text-white px-4 py-1.5 font-mono text-[10px]",children:t}):null,i.jsx("div",{className:"flex flex-col flex-1",children:e}),n?i.jsx(dg,{testIdPrefix:f}):null]});return l?i.jsx("a",{href:l,className:y,"data-testid":f,onClick:p,...m,children:v}):u==="article"?i.jsx("article",{className:y,"data-testid":f,onClick:p,...m,children:v}):u==="section"?i.jsx("section",{className:y,"data-testid":f,onClick:p,...m,children:v}):i.jsx("div",{className:y,"data-testid":f,onClick:p,...m,children:v})}function XY({action:e,testId:t}){const n="inline-flex items-center px-3 py-1 border border-stone-900 bg-white font-mono text-[10px] uppercase hover:bg-stone-100";return e.href?i.jsx("a",{href:e.href,className:n,"data-testid":t?`${t}-action`:void 0,children:e.label}):i.jsx("button",{type:"button",onClick:e.onClick,className:n,"data-testid":t?`${t}-action`:void 0,children:e.label})}function Ge({icon:e,label:t,description:n,action:s,variant:r="minimal",className:a,testId:l}){const u=i.jsxs("div",{className:he("flex flex-col items-center justify-center text-center p-6 gap-2",a),"data-testid":l,children:[e?i.jsx("div",{className:"text-on-surface-variant","aria-hidden":"true",children:typeof e=="string"?i.jsx("span",{className:"text-2xl",children:e}):e}):null,i.jsx("div",{className:"font-headline font-bold uppercase text-stone-900 text-sm tracking-tight",children:t}),n?i.jsx("div",{className:"text-xs text-on-surface-variant max-w-prose",children:n}):null,s?i.jsx("div",{className:"pt-2",children:i.jsx(XY,{action:s,testId:l})}):null]});return r==="card"?i.jsx(Sm,{variant:"ghost",elevation:"flat",registrationMarks:!1,children:u}):u}const VT=30;function ZY({qitemId:e,source:t,destination:n,state:s,tags:r,createdAt:a,body:l,related:u}){const[d,f]=C.useState(!1),p=l?l.split(`
326
+ `):[],m=d?p:p.slice(0,VT);return e?i.jsxs("div",{"data-testid":"queue-item-viewer",className:"flex flex-col h-full",children:[i.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[i.jsx(it,{tone:"muted",children:"Queue item"}),i.jsx("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:e})]}),i.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant space-y-2 font-mono text-xs",children:[t||n?i.jsx(El,{label:"Route",children:i.jsx(sg,{source:t,destination:n,muted:!0})}):null,t?i.jsx(El,{label:"Source",children:i.jsx(wm,{session:t,muted:!0})}):null,n?i.jsx(El,{label:"Dest",children:i.jsx(wm,{session:n,muted:!0})}):null,s?i.jsx(El,{label:"State",children:i.jsx(tk,{state:s,testId:"qitem-state"})}):null,r&&r.length>0?i.jsx(El,{label:"Tags",children:i.jsx("span",{className:"flex min-w-0 flex-wrap justify-end gap-1",children:r.map(x=>i.jsx(pa,{tag:x},x))})}):null,a?i.jsx(El,{label:"Created",children:i.jsx(Ec,{value:a})}):null]}),i.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant flex-1 min-h-0 overflow-y-auto",children:[i.jsx(it,{tone:"muted",children:"Body"}),l?i.jsx("pre",{"data-testid":"qitem-body",className:"mt-2 whitespace-pre-wrap font-mono text-xs text-stone-900",children:m.join(`
327
+ `)}):i.jsx("p",{className:"mt-2 font-mono text-xs text-on-surface-variant italic",children:"No body."}),l&&p.length>VT?i.jsx("button",{type:"button",onClick:()=>f(x=>!x),"data-testid":"qitem-body-toggle",className:"mt-2 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:text-stone-900 underline",children:d?"Show less":`Show full body (${p.length} lines)`}):null]}),u&&u.length>0?i.jsxs("div",{className:"px-4 py-3",children:[i.jsx(it,{tone:"muted",children:"Related"}),i.jsx("ul",{className:"mt-2 space-y-1 font-mono text-xs",children:u.map((x,y)=>i.jsxs("li",{className:"flex items-baseline gap-2",children:[i.jsxs("span",{className:"inline-flex w-12 shrink-0 items-center gap-1 text-on-surface-variant text-[10px] uppercase tracking-wide",children:[i.jsx(JY,{kind:x.kind,label:x.label}),x.kind]}),x.href?i.jsx("a",{href:x.href,className:"text-stone-900 hover:underline truncate",children:x.label}):i.jsx("span",{className:"text-stone-900 truncate",children:x.label})]},`${x.kind}-${y}`))})]}):null]}):i.jsx(Ge,{label:"NO QITEM",description:"No queue item selected.",variant:"card",testId:"queue-item-viewer-empty"})}function JY({kind:e,label:t}){return e==="file"?i.jsx($e,{tool:t,size:"xs"}):e==="commit"?i.jsx($e,{tool:"commit",size:"xs",decorative:!0}):e==="slice"?i.jsx($e,{tool:"folder",size:"xs",decorative:!0}):i.jsx($e,{tool:"terminal",size:"xs",decorative:!0})}function El({label:e,children:t}){return i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsx("span",{className:"shrink-0 text-on-surface-variant",children:e}),i.jsx("span",{className:"min-w-0 text-stone-900",children:t})]})}function fg({code:e,language:t}){const n=tQ(t),s=C.useMemo(()=>sQ(e,n),[e,n]);return i.jsx("pre",{"data-testid":"syntax-highlight-block","data-language":n,className:"overflow-x-auto bg-stone-900 p-3 font-mono text-[10px] leading-relaxed text-stone-100",children:i.jsx("code",{children:s.map((r,a)=>i.jsx("span",{className:r.className,"data-token-kind":r.kind,children:r.text},a))})})}const eQ={plain:"",keyword:"text-violet-300",string:"text-emerald-300",comment:"text-stone-500 italic",number:"text-amber-300",tag:"text-sky-300",punctuation:"text-stone-400"};function gt(e,t){return{kind:e,text:t,className:eQ[e]}}function tQ(e){if(!e)return"";const t=e.toLowerCase().trim();return t==="javascript"?"js":t==="typescript"?"ts":t==="shell"?"sh":t}const nQ={ts:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","implements","interface","type","enum","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","static","public","private","protected","readonly","abstract","true","false","null","undefined","void","string","number","boolean","any","unknown","never"]),tsx:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","implements","interface","type","enum","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","static","public","private","protected","readonly","abstract","true","false","null","undefined","void","string","number","boolean","any","unknown","never"]),js:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","true","false","null","undefined"]),jsx:new Set(["const","let","var","function","return","if","else","for","while","switch","case","break","continue","default","class","extends","import","export","from","as","new","this","super","async","await","throw","try","catch","finally","true","false","null","undefined"]),py:new Set(["def","class","if","elif","else","for","while","return","import","from","as","with","try","except","finally","raise","lambda","yield","pass","break","continue","global","nonlocal","True","False","None","and","or","not","in","is","async","await"]),python:new Set(["def","class","if","elif","else","for","while","return","import","from","as","with","try","except","finally","raise","lambda","yield","pass","break","continue","global","nonlocal","True","False","None","and","or","not","in","is","async","await"]),bash:new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","export","local","readonly","echo","printf","exit","set","unset","shift","true","false"]),sh:new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","export","local","readonly","echo","printf","exit","set","unset","shift","true","false"]),sql:new Set(["select","from","where","and","or","not","null","is","in","like","between","join","left","right","inner","outer","on","group","by","order","having","limit","offset","insert","into","values","update","set","delete","create","table","drop","alter","index","primary","key","foreign","references","constraint","unique","default","as","case","when","then","else","end"])};function sQ(e,t){return t===""||t==="text"||t==="plain"?[gt("plain",e)]:t==="json"?iQ(e):t==="yaml"||t==="yml"?rQ(e):t==="md"||t==="markdown"?aQ(e):t==="py"||t==="python"||t==="sh"||t==="bash"?up(e,t,"#"):t==="ts"||t==="tsx"||t==="js"||t==="jsx"?up(e,t,"//","/*","*/"):t==="sql"?up(e,t,"--"):[gt("plain",e)]}function up(e,t,n,s,r){const a=nQ[t]??new Set,l=[];let u=0;for(;u<e.length;){const d=e.slice(u);if(s&&d.startsWith(s)){const x=r?d.indexOf(r,s.length):-1,y=x===-1?d.length:x+((r==null?void 0:r.length)??0);l.push(gt("comment",d.slice(0,y))),u+=y;continue}if(d.startsWith(n)){const x=d.indexOf(`
328
+ `),y=x===-1?d.length:x;l.push(gt("comment",d.slice(0,y))),u+=y;continue}const f=d[0];if(f==='"'||f==="'"||f==="`"){let x=1;for(;x<d.length&&d[x]!==f;)d[x]==="\\"&&x+1<d.length?x+=2:x++;const y=x<d.length?x+1:x;l.push(gt("string",d.slice(0,y))),u+=y;continue}const p=d.match(/^-?\d+(\.\d+)?/);if(p&&(u===0||!/[a-zA-Z_]/.test(e[u-1]??""))){l.push(gt("number",p[0])),u+=p[0].length;continue}const m=d.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(m){a.has(m[0])?l.push(gt("keyword",m[0])):l.push(gt("plain",m[0])),u+=m[0].length;continue}l.push(gt("plain",e[u]??"")),u++}return fk(l)}function rQ(e){const t=[];for(const n of e.split(/(\n)/)){if(n===`
329
+ `){t.push(gt("plain",`
330
+ `));continue}const s=n.indexOf("#");if(s!==-1){const r=n.slice(0,s);t.push(...GT(r)),t.push(gt("comment",n.slice(s)))}else t.push(...GT(n))}return fk(t)}function GT(e){const t=e.match(/^(\s*)([\w.-]+)(:)(\s*)(.*)$/);if(t){const n=[];n.push(gt("plain",t[1])),n.push(gt("tag",t[2])),n.push(gt("punctuation",t[3])),n.push(gt("plain",t[4]));const s=t[5];return s.startsWith('"')||s.startsWith("'")?n.push(gt("string",s)):/^\d+(\.\d+)?$/.test(s)?n.push(gt("number",s)):n.push(gt("plain",s)),n}return[gt("plain",e)]}function iQ(e){const t=[];let n=0;for(;n<e.length;){const s=e[n];if(s==='"'){let l=1;for(;l<e.length-n&&e[n+l]!=='"';)e[n+l]==="\\"?l+=2:l++;t.push(gt("string",e.slice(n,n+l+1))),n+=l+1;continue}if(s==="{"||s==="}"||s==="["||s==="]"||s===","||s===":"){t.push(gt("punctuation",s)),n++;continue}const r=e.slice(n).match(/^-?\d+(\.\d+)?/);if(r){t.push(gt("number",r[0])),n+=r[0].length;continue}const a=e.slice(n).match(/^(true|false|null)\b/);if(a){t.push(gt("keyword",a[0])),n+=a[0].length;continue}t.push(gt("plain",s??"")),n++}return fk(t)}function aQ(e){return[gt("plain",e)]}function fk(e){const t=[];for(const n of e){const s=t[t.length-1];s&&s.kind==="plain"&&n.kind==="plain"?t[t.length-1]=gt("plain",s.text+n.text):t.push(n)}return t}const hk=Symbol.for("yaml.alias"),IN=Symbol.for("yaml.document"),ca=Symbol.for("yaml.map"),DD=Symbol.for("yaml.pair"),cr=Symbol.for("yaml.scalar"),Ac=Symbol.for("yaml.seq"),Ns=Symbol.for("yaml.node.type"),Mo=e=>!!e&&typeof e=="object"&&e[Ns]===hk,hg=e=>!!e&&typeof e=="object"&&e[Ns]===IN,sf=e=>!!e&&typeof e=="object"&&e[Ns]===ca,Dt=e=>!!e&&typeof e=="object"&&e[Ns]===DD,xt=e=>!!e&&typeof e=="object"&&e[Ns]===cr,rf=e=>!!e&&typeof e=="object"&&e[Ns]===Ac;function Pt(e){if(e&&typeof e=="object")switch(e[Ns]){case ca:case Ac:return!0}return!1}function $t(e){if(e&&typeof e=="object")switch(e[Ns]){case hk:case ca:case cr:case Ac:return!0}return!1}const qD=e=>(xt(e)||Pt(e))&&!!e.anchor,Wa=Symbol("break visit"),oQ=Symbol("skip children"),dd=Symbol("remove node");function Tc(e,t){const n=lQ(t);hg(e)?Fl(null,e.contents,n,Object.freeze([e]))===dd&&(e.contents=null):Fl(null,e,n,Object.freeze([]))}Tc.BREAK=Wa;Tc.SKIP=oQ;Tc.REMOVE=dd;function Fl(e,t,n,s){const r=cQ(e,t,n,s);if($t(r)||Dt(r))return uQ(e,s,r),Fl(e,r,n,s);if(typeof r!="symbol"){if(Pt(t)){s=Object.freeze(s.concat(t));for(let a=0;a<t.items.length;++a){const l=Fl(a,t.items[a],n,s);if(typeof l=="number")a=l-1;else{if(l===Wa)return Wa;l===dd&&(t.items.splice(a,1),a-=1)}}}else if(Dt(t)){s=Object.freeze(s.concat(t));const a=Fl("key",t.key,n,s);if(a===Wa)return Wa;a===dd&&(t.key=null);const l=Fl("value",t.value,n,s);if(l===Wa)return Wa;l===dd&&(t.value=null)}}return r}function lQ(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function cQ(e,t,n,s){var r,a,l,u,d;if(typeof n=="function")return n(e,t,s);if(sf(t))return(r=n.Map)==null?void 0:r.call(n,e,t,s);if(rf(t))return(a=n.Seq)==null?void 0:a.call(n,e,t,s);if(Dt(t))return(l=n.Pair)==null?void 0:l.call(n,e,t,s);if(xt(t))return(u=n.Scalar)==null?void 0:u.call(n,e,t,s);if(Mo(t))return(d=n.Alias)==null?void 0:d.call(n,e,t,s)}function uQ(e,t,n){const s=t[t.length-1];if(Pt(s))s.items[e]=n;else if(Dt(s))e==="key"?s.key=n:s.value=n;else if(hg(s))s.contents=n;else{const r=Mo(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}const dQ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},fQ=e=>e.replace(/[!,[\]{}]/g,t=>dQ[t]);class _n{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},_n.defaultYaml,t),this.tags=Object.assign({},_n.defaultTags,n)}clone(){const t=new _n(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new _n(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:_n.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},_n.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:_n.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},_n.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),r=s.shift();switch(r){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[a,l]=s;return this.tags[a]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[a]=s;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;{const l=/^\d+\.\d+$/.test(a);return n(6,`Unsupported YAML version ${a}`,l),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const l=t.slice(2,-1);return l==="!"||l==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),l)}const[,s,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);const a=this.tags[s];if(a)try{return a+decodeURIComponent(r)}catch(l){return n(String(l)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+fQ(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let r;if(t&&s.length>0&&$t(t.contents)){const a={};Tc(t.contents,(l,u)=>{$t(u)&&u.tag&&(a[u.tag]=!0)}),r=Object.keys(a)}else r=[];for(const[a,l]of s)a==="!!"&&l==="tag:yaml.org,2002:"||(!t||r.some(u=>u.startsWith(l)))&&n.push(`%TAG ${a} ${l}`);return n.join(`
331
+ `)}}_n.defaultYaml={explicit:!1,version:"1.2"};_n.defaultTags={"!!":"tag:yaml.org,2002:"};function zD(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function BD(e){const t=new Set;return Tc(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function FD(e,t){for(let n=1;;++n){const s=`${e}${n}`;if(!t.has(s))return s}}function hQ(e,t){const n=[],s=new Map;let r=null;return{onAnchor:a=>{n.push(a),r??(r=BD(e));const l=FD(t,r);return r.add(l),l},setAnchors:()=>{for(const a of n){const l=s.get(a);if(typeof l=="object"&&l.anchor&&(xt(l.node)||Pt(l.node)))l.node.anchor=l.anchor;else{const u=new Error("Failed to resolve repeated object (this should not happen)");throw u.source=a,u}}},sourceObjects:s}}function Hl(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let r=0,a=s.length;r<a;++r){const l=s[r],u=Hl(e,s,String(r),l);u===void 0?delete s[r]:u!==l&&(s[r]=u)}else if(s instanceof Map)for(const r of Array.from(s.keys())){const a=s.get(r),l=Hl(e,s,r,a);l===void 0?s.delete(r):l!==a&&s.set(r,l)}else if(s instanceof Set)for(const r of Array.from(s)){const a=Hl(e,s,r,r);a===void 0?s.delete(r):a!==r&&(s.delete(r),s.add(a))}else for(const[r,a]of Object.entries(s)){const l=Hl(e,s,r,a);l===void 0?delete s[r]:l!==a&&(s[r]=l)}return e.call(t,n,s)}function Ss(e,t,n){if(Array.isArray(e))return e.map((s,r)=>Ss(s,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!qD(e))return e.toJSON(t,n);const s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=a=>{s.res=a,delete n.onCreate};const r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class pk{constructor(t){Object.defineProperty(this,Ns,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:s,onAnchor:r,reviver:a}={}){if(!hg(t))throw new TypeError("A document argument is required");const l={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},u=Ss(this,"",l);if(typeof r=="function")for(const{count:d,res:f}of l.anchors.values())r(f,d);return typeof a=="function"?Hl(a,{"":u},"",u):u}}class mk extends pk{constructor(t){super(hk),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){let s;n!=null&&n.aliasResolveCache?s=n.aliasResolveCache:(s=[],Tc(t,{Node:(a,l)=>{(Mo(l)||qD(l))&&s.push(l)}}),n&&(n.aliasResolveCache=s));let r;for(const a of s){if(a===this)break;a.anchor===this.source&&(r=a)}return r}toJSON(t,n){if(!n)return{source:this.source};const{anchors:s,doc:r,maxAliasCount:a}=n,l=this.resolve(r,n);if(!l){const d=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(d)}let u=s.get(l);if(u||(Ss(l,null,n),u=s.get(l)),(u==null?void 0:u.res)===void 0){const d="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(d)}if(a>=0&&(u.count+=1,u.aliasCount===0&&(u.aliasCount=Zp(r,l,s)),u.count*u.aliasCount>a)){const d="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(d)}return u.res}toString(t,n,s){const r=`*${this.source}`;if(t){if(zD(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(t.implicitKey)return`${r} `}return r}}function Zp(e,t,n){if(Mo(t)){const s=t.resolve(e),r=n&&s&&n.get(s);return r?r.count*r.aliasCount:0}else if(Pt(t)){let s=0;for(const r of t.items){const a=Zp(e,r,n);a>s&&(s=a)}return s}else if(Dt(t)){const s=Zp(e,t.key,n),r=Zp(e,t.value,n);return Math.max(s,r)}return 1}const HD=e=>!e||typeof e!="function"&&typeof e!="object";class Fe extends pk{constructor(t){super(cr),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Ss(this.value,t,n)}toString(){return String(this.value)}}Fe.BLOCK_FOLDED="BLOCK_FOLDED";Fe.BLOCK_LITERAL="BLOCK_LITERAL";Fe.PLAIN="PLAIN";Fe.QUOTE_DOUBLE="QUOTE_DOUBLE";Fe.QUOTE_SINGLE="QUOTE_SINGLE";const pQ="tag:yaml.org,2002:";function mQ(e,t,n){if(t){const s=n.filter(a=>a.tag===t),r=s.find(a=>!a.format)??s[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(s=>{var r;return((r=s.identify)==null?void 0:r.call(s,e))&&!s.format})}function Rd(e,t,n){var m,x,y;if(hg(e)&&(e=e.contents),$t(e))return e;if(Dt(e)){const v=(x=(m=n.schema[ca]).createNode)==null?void 0:x.call(m,n.schema,null,n);return v.items.push(e),v}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:s,onAnchor:r,onTagObj:a,schema:l,sourceObjects:u}=n;let d;if(s&&e&&typeof e=="object"){if(d=u.get(e),d)return d.anchor??(d.anchor=r(e)),new mk(d.anchor);d={anchor:null,node:null},u.set(e,d)}t!=null&&t.startsWith("!!")&&(t=pQ+t.slice(2));let f=mQ(e,t,l.tags);if(!f){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const v=new Fe(e);return d&&(d.node=v),v}f=e instanceof Map?l[ca]:Symbol.iterator in Object(e)?l[Ac]:l[ca]}a&&(a(f),delete n.onTagObj);const p=f!=null&&f.createNode?f.createNode(n.schema,e,n):typeof((y=f==null?void 0:f.nodeClass)==null?void 0:y.from)=="function"?f.nodeClass.from(n.schema,e,n):new Fe(e);return t?p.tag=t:f.default||(p.tag=f.tag),d&&(d.node=p),p}function Nm(e,t,n){let s=n;for(let r=t.length-1;r>=0;--r){const a=t[r];if(typeof a=="number"&&Number.isInteger(a)&&a>=0){const l=[];l[a]=s,s=l}else s=new Map([[a,s]])}return Rd(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const nd=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class UD extends pk{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(s=>$t(s)||Dt(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(nd(t))this.add(n);else{const[s,...r]=t,a=this.get(s,!0);if(Pt(a))a.addIn(r,n);else if(a===void 0&&this.schema)this.set(s,Nm(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}deleteIn(t){const[n,...s]=t;if(s.length===0)return this.delete(n);const r=this.get(n,!0);if(Pt(r))return r.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){const[s,...r]=t,a=this.get(s,!0);return r.length===0?!n&&xt(a)?a.value:a:Pt(a)?a.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Dt(n))return!1;const s=n.value;return s==null||t&&xt(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){const[n,...s]=t;if(s.length===0)return this.has(n);const r=this.get(n,!0);return Pt(r)?r.hasIn(s):!1}setIn(t,n){const[s,...r]=t;if(r.length===0)this.set(s,n);else{const a=this.get(s,!0);if(Pt(a))a.setIn(r,n);else if(a===void 0&&this.schema)this.set(s,Nm(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}}const gQ=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Gr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Ja=(e,t,n)=>e.endsWith(`
332
+ `)?Gr(n,t):n.includes(`
333
+ `)?`
334
+ `+Gr(n,t):(e.endsWith(" ")?"":" ")+n,VD="flow",MN="block",Jp="quoted";function pg(e,t,n="flow",{indentAtStart:s,lineWidth:r=80,minContentWidth:a=20,onFold:l,onOverflow:u}={}){if(!r||r<0)return e;r<a&&(a=0);const d=Math.max(1+a,1+r-t.length);if(e.length<=d)return e;const f=[],p={};let m=r-t.length;typeof s=="number"&&(s>r-Math.max(2,a)?f.push(0):m=r-s);let x,y,v=!1,b=-1,w=-1,S=-1;n===MN&&(b=KT(e,b,t.length),b!==-1&&(m=b+d));for(let k;k=e[b+=1];){if(n===Jp&&k==="\\"){switch(w=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}S=b}if(k===`
335
+ `)n===MN&&(b=KT(e,b,t.length)),m=b+t.length+d,x=void 0;else{if(k===" "&&y&&y!==" "&&y!==`
336
+ `&&y!==" "){const _=e[b+1];_&&_!==" "&&_!==`
337
+ `&&_!==" "&&(x=b)}if(b>=m)if(x)f.push(x),m=x+d,x=void 0;else if(n===Jp){for(;y===" "||y===" ";)y=k,k=e[b+=1],v=!0;const _=b>S+1?b-2:w-1;if(p[_])return e;f.push(_),p[_]=!0,m=_+d,x=void 0}else v=!0}y=k}if(v&&u&&u(),f.length===0)return e;l&&l();let E=e.slice(0,f[0]);for(let k=0;k<f.length;++k){const _=f[k],R=f[k+1]||e.length;_===0?E=`
338
+ ${t}${e.slice(0,R)}`:(n===Jp&&p[_]&&(E+=`${e[_]}\\`),E+=`
339
+ ${t}${e.slice(_+1,R)}`)}return E}function KT(e,t,n){let s=t,r=t+1,a=e[r];for(;a===" "||a===" ";)if(t<r+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
340
+ `);s=t,r=t+1,a=e[r]}return s}const mg=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),gg=e=>/^(%|---|\.\.\.)/m.test(e);function xQ(e,t,n){if(!t||t<0)return!1;const s=t-n,r=e.length;if(r<=s)return!1;for(let a=0,l=0;a<r;++a)if(e[a]===`
341
+ `){if(a-l>s)return!0;if(l=a+1,r-l<=s)return!1}return!0}function fd(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:s}=t,r=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(gg(e)?" ":"");let l="",u=0;for(let d=0,f=n[d];f;f=n[++d])if(f===" "&&n[d+1]==="\\"&&n[d+2]==="n"&&(l+=n.slice(u,d)+"\\ ",d+=1,u=d,f="\\"),f==="\\")switch(n[d+1]){case"u":{l+=n.slice(u,d);const p=n.substr(d+2,4);switch(p){case"0000":l+="\\0";break;case"0007":l+="\\a";break;case"000b":l+="\\v";break;case"001b":l+="\\e";break;case"0085":l+="\\N";break;case"00a0":l+="\\_";break;case"2028":l+="\\L";break;case"2029":l+="\\P";break;default:p.substr(0,2)==="00"?l+="\\x"+p.substr(2):l+=n.substr(d,6)}d+=5,u=d+1}break;case"n":if(s||n[d+2]==='"'||n.length<r)d+=1;else{for(l+=n.slice(u,d)+`
342
+
343
+ `;n[d+2]==="\\"&&n[d+3]==="n"&&n[d+4]!=='"';)l+=`
344
+ `,d+=2;l+=a,n[d+2]===" "&&(l+="\\"),d+=1,u=d+1}break;default:d+=1}return l=u?l+n.slice(u):n,s?l:pg(l,a,Jp,mg(t,!1))}function ON(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
345
+ `)||/[ \t]\n|\n[ \t]/.test(e))return fd(e,t);const n=t.indent||(gg(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
346
+ ${n}`)+"'";return t.implicitKey?s:pg(s,n,VD,mg(t,!1))}function Ul(e,t){const{singleQuote:n}=t.options;let s;if(n===!1)s=fd;else{const r=e.includes('"'),a=e.includes("'");r&&!a?s=ON:a&&!r?s=fd:s=n?ON:fd}return s(e,t)}let LN;try{LN=new RegExp(`(^|(?<!
347
+ ))
348
+ +(?!
349
+ |$)`,"g")}catch{LN=/\n+(?!\n|$)/g}function em({comment:e,type:t,value:n},s,r,a){const{blockQuote:l,commentString:u,lineWidth:d}=s.options;if(!l||/\n[\t ]+$/.test(n))return Ul(n,s);const f=s.indent||(s.forceBlockIndent||gg(n)?" ":""),p=l==="literal"?!0:l==="folded"||t===Fe.BLOCK_FOLDED?!1:t===Fe.BLOCK_LITERAL?!0:!xQ(n,d,f.length);if(!n)return p?`|
350
+ `:`>
351
+ `;let m,x;for(x=n.length;x>0;--x){const R=n[x-1];if(R!==`
352
+ `&&R!==" "&&R!==" ")break}let y=n.substring(x);const v=y.indexOf(`
353
+ `);v===-1?m="-":n===y||v!==y.length-1?(m="+",a&&a()):m="",y&&(n=n.slice(0,-y.length),y[y.length-1]===`
354
+ `&&(y=y.slice(0,-1)),y=y.replace(LN,`$&${f}`));let b=!1,w,S=-1;for(w=0;w<n.length;++w){const R=n[w];if(R===" ")b=!0;else if(R===`
355
+ `)S=w;else break}let E=n.substring(0,S<w?S+1:w);E&&(n=n.substring(E.length),E=E.replace(/\n+/g,`$&${f}`));let _=(b?f?"2":"1":"")+m;if(e&&(_+=" "+u(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!p){const R=n.replace(/\n+/g,`
356
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${f}`);let T=!1;const A=mg(s,!0);l!=="folded"&&t!==Fe.BLOCK_FOLDED&&(A.onOverflow=()=>{T=!0});const M=pg(`${E}${R}${y}`,f,MN,A);if(!T)return`>${_}
357
+ ${f}${M}`}return n=n.replace(/\n+/g,`$&${f}`),`|${_}
358
+ ${f}${E}${n}${y}`}function yQ(e,t,n,s){const{type:r,value:a}=e,{actualString:l,implicitKey:u,indent:d,indentStep:f,inFlow:p}=t;if(u&&a.includes(`
359
+ `)||p&&/[[\]{},]/.test(a))return Ul(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return u||p||!a.includes(`
360
+ `)?Ul(a,t):em(e,t,n,s);if(!u&&!p&&r!==Fe.PLAIN&&a.includes(`
361
+ `))return em(e,t,n,s);if(gg(a)){if(d==="")return t.forceBlockIndent=!0,em(e,t,n,s);if(u&&d===f)return Ul(a,t)}const m=a.replace(/\n+/g,`$&
362
+ ${d}`);if(l){const x=b=>{var w;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((w=b.test)==null?void 0:w.test(m))},{compat:y,tags:v}=t.doc.schema;if(v.some(x)||y!=null&&y.some(x))return Ul(a,t)}return u?m:pg(m,d,VD,mg(t,!1))}function gk(e,t,n,s){const{implicitKey:r,inFlow:a}=t,l=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:u}=e;u!==Fe.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(l.value)&&(u=Fe.QUOTE_DOUBLE);const d=p=>{switch(p){case Fe.BLOCK_FOLDED:case Fe.BLOCK_LITERAL:return r||a?Ul(l.value,t):em(l,t,n,s);case Fe.QUOTE_DOUBLE:return fd(l.value,t);case Fe.QUOTE_SINGLE:return ON(l.value,t);case Fe.PLAIN:return yQ(l,t,n,s);default:return null}};let f=d(u);if(f===null){const{defaultKeyType:p,defaultStringType:m}=t.options,x=r&&p||m;if(f=d(x),f===null)throw new Error(`Unsupported default string type ${x}`)}return f}function GD(e,t){const n=Object.assign({blockQuote:!0,commentString:gQ,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function vQ(e,t){var r;if(t.tag){const a=e.filter(l=>l.tag===t.tag);if(a.length>0)return a.find(l=>l.format===t.format)??a[0]}let n,s;if(xt(t)){s=t.value;let a=e.filter(l=>{var u;return(u=l.identify)==null?void 0:u.call(l,s)});if(a.length>1){const l=a.filter(u=>u.test);l.length>0&&(a=l)}n=a.find(l=>l.format===t.format)??a.find(l=>!l.format)}else s=t,n=e.find(a=>a.nodeClass&&s instanceof a.nodeClass);if(!n){const a=((r=s==null?void 0:s.constructor)==null?void 0:r.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${a} value`)}return n}function bQ(e,t,{anchors:n,doc:s}){if(!s.directives)return"";const r=[],a=(xt(e)||Pt(e))&&e.anchor;a&&zD(a)&&(n.add(a),r.push(`&${a}`));const l=e.tag??(t.default?null:t.tag);return l&&r.push(s.directives.tagString(l)),r.join(" ")}function yc(e,t,n,s){var d;if(Dt(e))return e.toString(t,n,s);if(Mo(e)){if(t.doc.directives)return e.toString(t);if((d=t.resolvedAliases)!=null&&d.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r;const a=$t(e)?e:t.doc.createNode(e,{onTagObj:f=>r=f});r??(r=vQ(t.doc.schema.tags,a));const l=bQ(a,r,t);l.length>0&&(t.indentAtStart=(t.indentAtStart??0)+l.length+1);const u=typeof r.stringify=="function"?r.stringify(a,t,n,s):xt(a)?gk(a,t,n,s):a.toString(t,n,s);return l?xt(a)||u[0]==="{"||u[0]==="["?`${l} ${u}`:`${l}
363
+ ${t.indent}${u}`:u}function wQ({key:e,value:t},n,s,r){const{allNullValues:a,doc:l,indent:u,indentStep:d,options:{commentString:f,indentSeq:p,simpleKeys:m}}=n;let x=$t(e)&&e.comment||null;if(m){if(x)throw new Error("With simple keys, key nodes cannot have comments");if(Pt(e)||!$t(e)&&typeof e=="object"){const A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let y=!m&&(!e||x&&t==null&&!n.inFlow||Pt(e)||(xt(e)?e.type===Fe.BLOCK_FOLDED||e.type===Fe.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!y&&(m||!a),indent:u+d});let v=!1,b=!1,w=yc(e,n,()=>v=!0,()=>b=!0);if(!y&&!n.inFlow&&w.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(n.inFlow){if(a||t==null)return v&&s&&s(),w===""?"?":y?`? ${w}`:w}else if(a&&!m||t==null&&y)return w=`? ${w}`,x&&!v?w+=Ja(w,n.indent,f(x)):b&&r&&r(),w;v&&(x=null),y?(x&&(w+=Ja(w,n.indent,f(x))),w=`? ${w}
364
+ ${u}:`):(w=`${w}:`,x&&(w+=Ja(w,n.indent,f(x))));let S,E,k;$t(t)?(S=!!t.spaceBefore,E=t.commentBefore,k=t.comment):(S=!1,E=null,k=null,t&&typeof t=="object"&&(t=l.createNode(t))),n.implicitKey=!1,!y&&!x&&xt(t)&&(n.indentAtStart=w.length+1),b=!1,!p&&d.length>=2&&!n.inFlow&&!y&&rf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const R=yc(t,n,()=>_=!0,()=>b=!0);let T=" ";if(x||S||E){if(T=S?`
365
+ `:"",E){const A=f(E);T+=`
366
+ ${Gr(A,n.indent)}`}R===""&&!n.inFlow?T===`
367
+ `&&k&&(T=`
368
+
369
+ `):T+=`
370
+ ${n.indent}`}else if(!y&&Pt(t)){const A=R[0],M=R.indexOf(`
371
+ `),L=M!==-1,P=n.inFlow??t.flow??t.items.length===0;if(L||!P){let O=!1;if(L&&(A==="&"||A==="!")){let B=R.indexOf(" ");A==="&"&&B!==-1&&B<M&&R[B+1]==="!"&&(B=R.indexOf(" ",B+1)),(B===-1||M<B)&&(O=!0)}O||(T=`
372
+ ${n.indent}`)}}else(R===""||R[0]===`
373
+ `)&&(T="");return w+=T+R,n.inFlow?_&&s&&s():k&&!_?w+=Ja(w,n.indent,f(k)):b&&r&&r(),w}function KD(e,t){(e==="debug"||e==="warn")&&console.warn(t)}const dp="<<",Yr={identify:e=>e===dp||typeof e=="symbol"&&e.description===dp,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Fe(Symbol(dp)),{addToJSMap:WD}),stringify:()=>dp},jQ=(e,t)=>(Yr.identify(t)||xt(t)&&(!t.type||t.type===Fe.PLAIN)&&Yr.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Yr.tag&&n.default));function WD(e,t,n){if(n=e&&Mo(n)?n.resolve(e.doc):n,rf(n))for(const s of n.items)Ky(e,t,s);else if(Array.isArray(n))for(const s of n)Ky(e,t,s);else Ky(e,t,n)}function Ky(e,t,n){const s=e&&Mo(n)?n.resolve(e.doc):n;if(!sf(s))throw new Error("Merge sources must be maps or map aliases");const r=s.toJSON(null,e,Map);for(const[a,l]of r)t instanceof Map?t.has(a)||t.set(a,l):t instanceof Set?t.add(a):Object.prototype.hasOwnProperty.call(t,a)||Object.defineProperty(t,a,{value:l,writable:!0,enumerable:!0,configurable:!0});return t}function YD(e,t,{key:n,value:s}){if($t(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(jQ(e,n))WD(e,t,s);else{const r=Ss(n,"",e);if(t instanceof Map)t.set(r,Ss(s,r,e));else if(t instanceof Set)t.add(r);else{const a=SQ(n,r,e),l=Ss(s,a,e);a in t?Object.defineProperty(t,a,{value:l,writable:!0,enumerable:!0,configurable:!0}):t[a]=l}}return t}function SQ(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if($t(e)&&(n!=null&&n.doc)){const s=GD(n.doc,{});s.anchors=new Set;for(const a of n.anchors.keys())s.anchors.add(a.anchor);s.inFlow=!0,s.inStringifyKey=!0;const r=e.toString(s);if(!n.mapKeyWarned){let a=JSON.stringify(r);a.length>40&&(a=a.substring(0,36)+'..."'),KD(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function xk(e,t,n){const s=Rd(e,void 0,n),r=Rd(t,void 0,n);return new En(s,r)}class En{constructor(t,n=null){Object.defineProperty(this,Ns,{value:DD}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return $t(n)&&(n=n.clone(t)),$t(s)&&(s=s.clone(t)),new En(n,s)}toJSON(t,n){const s=n!=null&&n.mapAsMap?new Map:{};return YD(n,s,this)}toString(t,n,s){return t!=null&&t.doc?wQ(this,t,n,s):JSON.stringify(this)}}function QD(e,t,n){return(t.inFlow??e.flow?kQ:NQ)(e,t,n)}function NQ({comment:e,items:t},n,{blockItemPrefix:s,flowChars:r,itemIndent:a,onChompKeep:l,onComment:u}){const{indent:d,options:{commentString:f}}=n,p=Object.assign({},n,{indent:a,type:null});let m=!1;const x=[];for(let v=0;v<t.length;++v){const b=t[v];let w=null;if($t(b))!m&&b.spaceBefore&&x.push(""),km(n,x,b.commentBefore,m),b.comment&&(w=b.comment);else if(Dt(b)){const E=$t(b.key)?b.key:null;E&&(!m&&E.spaceBefore&&x.push(""),km(n,x,E.commentBefore,m))}m=!1;let S=yc(b,p,()=>w=null,()=>m=!0);w&&(S+=Ja(S,a,f(w))),m&&w&&(m=!1),x.push(s+S)}let y;if(x.length===0)y=r.start+r.end;else{y=x[0];for(let v=1;v<x.length;++v){const b=x[v];y+=b?`
374
+ ${d}${b}`:`
375
+ `}}return e?(y+=`
376
+ `+Gr(f(e),d),u&&u()):m&&l&&l(),y}function kQ({items:e},t,{flowChars:n,itemIndent:s}){const{indent:r,indentStep:a,flowCollectionPadding:l,options:{commentString:u}}=t;s+=a;const d=Object.assign({},t,{indent:s,inFlow:!0,type:null});let f=!1,p=0;const m=[];for(let v=0;v<e.length;++v){const b=e[v];let w=null;if($t(b))b.spaceBefore&&m.push(""),km(t,m,b.commentBefore,!1),b.comment&&(w=b.comment);else if(Dt(b)){const E=$t(b.key)?b.key:null;E&&(E.spaceBefore&&m.push(""),km(t,m,E.commentBefore,!1),E.comment&&(f=!0));const k=$t(b.value)?b.value:null;k?(k.comment&&(w=k.comment),k.commentBefore&&(f=!0)):b.value==null&&(E!=null&&E.comment)&&(w=E.comment)}w&&(f=!0);let S=yc(b,d,()=>w=null);f||(f=m.length>p||S.includes(`
377
+ `)),v<e.length-1?S+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(f||(f=m.reduce((E,k)=>E+k.length+2,2)+(S.length+2)>t.options.lineWidth)),f&&(S+=",")),w&&(S+=Ja(S,s,u(w))),m.push(S),p=m.length}const{start:x,end:y}=n;if(m.length===0)return x+y;if(!f){const v=m.reduce((b,w)=>b+w.length+2,2);f=t.options.lineWidth>0&&v>t.options.lineWidth}if(f){let v=x;for(const b of m)v+=b?`
378
+ ${a}${r}${b}`:`
379
+ `;return`${v}
380
+ ${r}${y}`}else return`${x}${l}${m.join(" ")}${l}${y}`}function km({indent:e,options:{commentString:t}},n,s,r){if(s&&r&&(s=s.replace(/^\n+/,"")),s){const a=Gr(t(s),e);n.push(a.trimStart())}}function eo(e,t){const n=xt(t)?t.value:t;for(const s of e)if(Dt(s)&&(s.key===t||s.key===n||xt(s.key)&&s.key.value===n))return s}class vs extends UD{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(ca,t),this.items=[]}static from(t,n,s){const{keepUndefined:r,replacer:a}=s,l=new this(t),u=(d,f)=>{if(typeof a=="function")f=a.call(n,d,f);else if(Array.isArray(a)&&!a.includes(d))return;(f!==void 0||r)&&l.items.push(xk(d,f,s))};if(n instanceof Map)for(const[d,f]of n)u(d,f);else if(n&&typeof n=="object")for(const d of Object.keys(n))u(d,n[d]);return typeof t.sortMapEntries=="function"&&l.items.sort(t.sortMapEntries),l}add(t,n){var l;let s;Dt(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new En(t,t==null?void 0:t.value):s=new En(t.key,t.value);const r=eo(this.items,s.key),a=(l=this.schema)==null?void 0:l.sortMapEntries;if(r){if(!n)throw new Error(`Key ${s.key} already set`);xt(r.value)&&HD(s.value)?r.value.value=s.value:r.value=s.value}else if(a){const u=this.items.findIndex(d=>a(s,d)<0);u===-1?this.items.push(s):this.items.splice(u,0,s)}else this.items.push(s)}delete(t){const n=eo(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const s=eo(this.items,t),r=s==null?void 0:s.value;return(!n&&xt(r)?r.value:r)??void 0}has(t){return!!eo(this.items,t)}set(t,n){this.add(new En(t,n),!0)}toJSON(t,n,s){const r=s?new s:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(r);for(const a of this.items)YD(n,r,a);return r}toString(t,n,s){if(!t)return JSON.stringify(this);for(const r of this.items)if(!Dt(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),QD(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}}const Ic={collection:"map",default:!0,nodeClass:vs,tag:"tag:yaml.org,2002:map",resolve(e,t){return sf(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>vs.from(e,t,n)};class So extends UD{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ac,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=fp(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const s=fp(t);if(typeof s!="number")return;const r=this.items[s];return!n&&xt(r)?r.value:r}has(t){const n=fp(t);return typeof n=="number"&&n<this.items.length}set(t,n){const s=fp(t);if(typeof s!="number")throw new Error(`Expected a valid index, not ${t}.`);const r=this.items[s];xt(r)&&HD(n)?r.value=n:this.items[s]=n}toJSON(t,n){const s=[];n!=null&&n.onCreate&&n.onCreate(s);let r=0;for(const a of this.items)s.push(Ss(a,String(r++),n));return s}toString(t,n,s){return t?QD(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(t,n,s){const{replacer:r}=s,a=new this(t);if(n&&Symbol.iterator in Object(n)){let l=0;for(let u of n){if(typeof r=="function"){const d=n instanceof Set?u:String(l++);u=r.call(n,d,u)}a.items.push(Rd(u,void 0,s))}}return a}}function fp(e){let t=xt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}const Mc={collection:"seq",default:!0,nodeClass:So,tag:"tag:yaml.org,2002:seq",resolve(e,t){return rf(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>So.from(e,t,n)},xg={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),gk(e,t,n,s)}},yg={identify:e=>e==null,createNode:()=>new Fe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Fe(null),stringify:({source:e},t)=>typeof e=="string"&&yg.test.test(e)?e:t.options.nullStr},yk={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Fe(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&yk.test.test(e)){const s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function Hs({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);const r=typeof s=="number"?s:Number(s);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let a=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(a)){let l=a.indexOf(".");l<0&&(l=a.length,a+=".");let u=t-(a.length-l-1);for(;u-- >0;)a+="0"}return a}const XD={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Hs},ZD={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Hs(e)}},JD={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Fe(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Hs},vg=e=>typeof e=="bigint"||Number.isInteger(e),vk=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function e6(e,t,n){const{value:s}=e;return vg(s)&&s>=0?n+s.toString(t):Hs(e)}const t6={identify:e=>vg(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>vk(e,2,8,n),stringify:e=>e6(e,8,"0o")},n6={identify:vg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>vk(e,0,10,n),stringify:Hs},s6={identify:e=>vg(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>vk(e,2,16,n),stringify:e=>e6(e,16,"0x")},_Q=[Ic,Mc,xg,yg,yk,t6,n6,s6,XD,ZD,JD];function WT(e){return typeof e=="bigint"||Number.isInteger(e)}const hp=({value:e})=>JSON.stringify(e),CQ=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:hp},{identify:e=>e==null,createNode:()=>new Fe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:hp},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:hp},{identify:WT,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>WT(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:hp}],EQ={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},RQ=[Ic,Mc].concat(CQ,EQ),bk={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let r=0;r<n.length;++r)s[r]=n.charCodeAt(r);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,r,a){if(!n)return"";const l=n;let u;if(typeof btoa=="function"){let d="";for(let f=0;f<l.length;++f)d+=String.fromCharCode(l[f]);u=btoa(d)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Fe.BLOCK_LITERAL),t!==Fe.QUOTE_DOUBLE){const d=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),f=Math.ceil(u.length/d),p=new Array(f);for(let m=0,x=0;m<f;++m,x+=d)p[m]=u.substr(x,d);u=p.join(t===Fe.BLOCK_LITERAL?`
381
+ `:" ")}return gk({comment:e,type:t,value:u},s,r,a)}};function r6(e,t){if(rf(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!Dt(s)){if(sf(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");const r=s.items[0]||new En(new Fe(null));if(s.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${s.commentBefore}
382
+ ${r.key.commentBefore}`:s.commentBefore),s.comment){const a=r.value??r.key;a.comment=a.comment?`${s.comment}
383
+ ${a.comment}`:s.comment}s=r}e.items[n]=Dt(s)?s:new En(s)}}else t("Expected a sequence for this tag");return e}function i6(e,t,n){const{replacer:s}=n,r=new So(e);r.tag="tag:yaml.org,2002:pairs";let a=0;if(t&&Symbol.iterator in Object(t))for(let l of t){typeof s=="function"&&(l=s.call(t,String(a++),l));let u,d;if(Array.isArray(l))if(l.length===2)u=l[0],d=l[1];else throw new TypeError(`Expected [key, value] tuple: ${l}`);else if(l&&l instanceof Object){const f=Object.keys(l);if(f.length===1)u=f[0],d=l[u];else throw new TypeError(`Expected tuple with one key, not ${f.length} keys`)}else u=l;r.items.push(xk(u,d,n))}return r}const wk={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:r6,createNode:i6};class Xl extends So{constructor(){super(),this.add=vs.prototype.add.bind(this),this.delete=vs.prototype.delete.bind(this),this.get=vs.prototype.get.bind(this),this.has=vs.prototype.has.bind(this),this.set=vs.prototype.set.bind(this),this.tag=Xl.tag}toJSON(t,n){if(!n)return super.toJSON(t);const s=new Map;n!=null&&n.onCreate&&n.onCreate(s);for(const r of this.items){let a,l;if(Dt(r)?(a=Ss(r.key,"",n),l=Ss(r.value,a,n)):a=Ss(r,"",n),s.has(a))throw new Error("Ordered maps must not include duplicate keys");s.set(a,l)}return s}static from(t,n,s){const r=i6(t,n,s),a=new this;return a.items=r.items,a}}Xl.tag="tag:yaml.org,2002:omap";const jk={collection:"seq",identify:e=>e instanceof Map,nodeClass:Xl,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=r6(e,t),s=[];for(const{key:r}of n.items)xt(r)&&(s.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new Xl,n)},createNode:(e,t,n)=>Xl.from(e,t,n)};function a6({value:e,source:t},n){return t&&(e?o6:l6).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const o6={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Fe(!0),stringify:a6},l6={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Fe(!1),stringify:a6},AQ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Hs},TQ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Hs(e)}},IQ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Fe(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Hs},af=e=>typeof e=="bigint"||Number.isInteger(e);function bg(e,t,n,{intAsBigInt:s}){const r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const l=BigInt(e);return r==="-"?BigInt(-1)*l:l}const a=parseInt(e,n);return r==="-"?-1*a:a}function Sk(e,t,n){const{value:s}=e;if(af(s)){const r=s.toString(t);return s<0?"-"+n+r.substr(1):n+r}return Hs(e)}const MQ={identify:af,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>bg(e,2,2,n),stringify:e=>Sk(e,2,"0b")},OQ={identify:af,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>bg(e,1,8,n),stringify:e=>Sk(e,8,"0")},LQ={identify:af,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>bg(e,0,10,n),stringify:Hs},PQ={identify:af,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>bg(e,2,16,n),stringify:e=>Sk(e,16,"0x")};class Zl extends vs{constructor(t){super(t),this.tag=Zl.tag}add(t){let n;Dt(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new En(t.key,null):n=new En(t,null),eo(this.items,n.key)||this.items.push(n)}get(t,n){const s=eo(this.items,t);return!n&&Dt(s)?xt(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const s=eo(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new En(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){const{replacer:r}=s,a=new this(t);if(n&&Symbol.iterator in Object(n))for(let l of n)typeof r=="function"&&(l=r.call(n,l,l)),a.items.push(xk(l,null,s));return a}}Zl.tag="tag:yaml.org,2002:set";const Nk={collection:"map",identify:e=>e instanceof Set,nodeClass:Zl,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Zl.from(e,t,n),resolve(e,t){if(sf(e)){if(e.hasAllNullValues(!0))return Object.assign(new Zl,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function kk(e,t){const n=e[0],s=n==="-"||n==="+"?e.substring(1):e,r=l=>t?BigInt(l):Number(l),a=s.replace(/_/g,"").split(":").reduce((l,u)=>l*r(60)+r(u),r(0));return n==="-"?r(-1)*a:a}function c6(e){let{value:t}=e,n=l=>l;if(typeof t=="bigint")n=l=>BigInt(l);else if(isNaN(t)||!isFinite(t))return Hs(e);let s="";t<0&&(s="-",t*=n(-1));const r=n(60),a=[t%r];return t<60?a.unshift(0):(t=(t-a[0])/r,a.unshift(t%r),t>=60&&(t=(t-a[0])/r,a.unshift(t))),s+a.map(l=>String(l).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const u6={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>kk(e,n),stringify:c6},d6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>kk(e,!1),stringify:c6},wg={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(wg.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,s,r,a,l,u]=t.map(Number),d=t[7]?Number((t[7]+"00").substr(1,3)):0;let f=Date.UTC(n,s-1,r,a||0,l||0,u||0,d);const p=t[8];if(p&&p!=="Z"){let m=kk(p,!1);Math.abs(m)<30&&(m*=60),f-=6e4*m}return new Date(f)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},YT=[Ic,Mc,xg,yg,o6,l6,MQ,OQ,LQ,PQ,AQ,TQ,IQ,bk,Yr,jk,wk,Nk,u6,d6,wg],QT=new Map([["core",_Q],["failsafe",[Ic,Mc,xg]],["json",RQ],["yaml11",YT],["yaml-1.1",YT]]),XT={binary:bk,bool:yk,float:JD,floatExp:ZD,floatNaN:XD,floatTime:d6,int:n6,intHex:s6,intOct:t6,intTime:u6,map:Ic,merge:Yr,null:yg,omap:jk,pairs:wk,seq:Mc,set:Nk,timestamp:wg},$Q={"tag:yaml.org,2002:binary":bk,"tag:yaml.org,2002:merge":Yr,"tag:yaml.org,2002:omap":jk,"tag:yaml.org,2002:pairs":wk,"tag:yaml.org,2002:set":Nk,"tag:yaml.org,2002:timestamp":wg};function Wy(e,t,n){const s=QT.get(t);if(s&&!e)return n&&!s.includes(Yr)?s.concat(Yr):s.slice();let r=s;if(!r)if(Array.isArray(e))r=[];else{const a=Array.from(QT.keys()).filter(l=>l!=="yaml11").map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${a} or define customTags array`)}if(Array.isArray(e))for(const a of e)r=r.concat(a);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Yr)),r.reduce((a,l)=>{const u=typeof l=="string"?XT[l]:l;if(!u){const d=JSON.stringify(l),f=Object.keys(XT).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${d}; use one of ${f}`)}return a.includes(u)||a.push(u),a},[])}const DQ=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class _k{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:r,schema:a,sortMapEntries:l,toStringDefaults:u}){this.compat=Array.isArray(t)?Wy(t,"compat"):t?Wy(null,t):null,this.name=typeof a=="string"&&a||"core",this.knownTags=r?$Q:{},this.tags=Wy(n,this.name,s),this.toStringOptions=u??null,Object.defineProperty(this,ca,{value:Ic}),Object.defineProperty(this,cr,{value:xg}),Object.defineProperty(this,Ac,{value:Mc}),this.sortMapEntries=typeof l=="function"?l:l===!0?DQ:null}clone(){const t=Object.create(_k.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function qQ(e,t){var d;const n=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const f=e.directives.toString(e);f?(n.push(f),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");const r=GD(e,t),{commentString:a}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");const f=a(e.commentBefore);n.unshift(Gr(f,""))}let l=!1,u=null;if(e.contents){if($t(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){const m=a(e.contents.commentBefore);n.push(Gr(m,""))}r.forceBlockIndent=!!e.comment,u=e.contents.comment}const f=u?void 0:()=>l=!0;let p=yc(e.contents,r,()=>u=null,f);u&&(p+=Ja(p,"",a(u))),(p[0]==="|"||p[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${p}`:n.push(p)}else n.push(yc(e.contents,r));if((d=e.directives)!=null&&d.docEnd)if(e.comment){const f=a(e.comment);f.includes(`
384
+ `)?(n.push("..."),n.push(Gr(f,""))):n.push(`... ${f}`)}else n.push("...");else{let f=e.comment;f&&l&&(f=f.replace(/^\n+/,"")),f&&((!l||u)&&n[n.length-1]!==""&&n.push(""),n.push(Gr(a(f),"")))}return n.join(`
385
+ `)+`
386
+ `}class jg{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Ns,{value:IN});let r=null;typeof n=="function"||Array.isArray(n)?r=n:s===void 0&&n&&(s=n,n=void 0);const a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=a;let{version:l}=a;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(l=this.directives.yaml.version)):this.directives=new _n({version:l}),this.setSchema(l,s),this.contents=t===void 0?null:this.createNode(t,r,s)}clone(){const t=Object.create(jg.prototype,{[Ns]:{value:IN}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=$t(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Rl(this.contents)&&this.contents.add(t)}addIn(t,n){Rl(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const s=BD(this);t.anchor=!n||s.has(n)?FD(n||"a",s):n}return new mk(t.anchor)}createNode(t,n,s){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){const w=E=>typeof E=="number"||E instanceof String||E instanceof Number,S=n.filter(w).map(String);S.length>0&&(n=n.concat(S)),r=n}else s===void 0&&n&&(s=n,n=void 0);const{aliasDuplicateObjects:a,anchorPrefix:l,flow:u,keepUndefined:d,onTagObj:f,tag:p}=s??{},{onAnchor:m,setAnchors:x,sourceObjects:y}=hQ(this,l||"a"),v={aliasDuplicateObjects:a??!0,keepUndefined:d??!1,onAnchor:m,onTagObj:f,replacer:r,schema:this.schema,sourceObjects:y},b=Rd(t,p,v);return u&&Pt(b)&&(b.flow=!0),x(),b}createPair(t,n,s={}){const r=this.createNode(t,null,s),a=this.createNode(n,null,s);return new En(r,a)}delete(t){return Rl(this.contents)?this.contents.delete(t):!1}deleteIn(t){return nd(t)?this.contents==null?!1:(this.contents=null,!0):Rl(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Pt(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return nd(t)?!n&&xt(this.contents)?this.contents.value:this.contents:Pt(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Pt(this.contents)?this.contents.has(t):!1}hasIn(t){return nd(t)?this.contents!==void 0:Pt(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Nm(this.schema,[t],n):Rl(this.contents)&&this.contents.set(t,n)}setIn(t,n){nd(t)?this.contents=n:this.contents==null?this.contents=Nm(this.schema,Array.from(t),n):Rl(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _n({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new _n({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new _k(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:r,onAnchor:a,reviver:l}={}){const u={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},d=Ss(this.contents,n??"",u);if(typeof a=="function")for(const{count:f,res:p}of u.anchors.values())a(p,f);return typeof l=="function"?Hl(l,{"":d},"",d):d}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return qQ(this,t)}}function Rl(e){if(Pt(e))return!0;throw new Error("Expected a YAML collection as document contents")}class f6 extends Error{constructor(t,n,s,r){super(),this.name=t,this.code=s,this.message=r,this.pos=n}}class sd extends f6{constructor(t,n,s){super("YAMLParseError",t,n,s)}}class zQ extends f6{constructor(t,n,s){super("YAMLWarning",t,n,s)}}const ZT=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(u=>t.linePos(u));const{line:s,col:r}=n.linePos[0];n.message+=` at line ${s}, column ${r}`;let a=r-1,l=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(a>=60&&l.length>80){const u=Math.min(a-39,l.length-79);l="…"+l.substring(u),a-=u-1}if(l.length>80&&(l=l.substring(0,79)+"…"),s>1&&/^ *$/.test(l.substring(0,a))){let u=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);u.length>80&&(u=u.substring(0,79)+`…
387
+ `),l=u+l}if(/[^ ]/.test(l)){let u=1;const d=n.linePos[1];(d==null?void 0:d.line)===s&&d.col>r&&(u=Math.max(1,Math.min(d.col-r,80-a)));const f=" ".repeat(a)+"^".repeat(u);n.message+=`:
388
+
389
+ ${l}
390
+ ${f}
391
+ `}};function vc(e,{flow:t,indicator:n,next:s,offset:r,onError:a,parentIndent:l,startOnNewline:u}){let d=!1,f=u,p=u,m="",x="",y=!1,v=!1,b=null,w=null,S=null,E=null,k=null,_=null,R=null;for(const M of e)switch(v&&(M.type!=="space"&&M.type!=="newline"&&M.type!=="comma"&&a(M.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),b&&(f&&M.type!=="comment"&&M.type!=="newline"&&a(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),M.type){case"space":!t&&(n!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&M.source.includes(" ")&&(b=M),p=!0;break;case"comment":{p||a(M,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const L=M.source.substring(1)||" ";m?m+=x+L:m=L,x="",f=!1;break}case"newline":f?m?m+=M.source:(!_||n!=="seq-item-ind")&&(d=!0):x+=M.source,f=!0,y=!0,(w||S)&&(E=M),p=!0;break;case"anchor":w&&a(M,"MULTIPLE_ANCHORS","A node can have at most one anchor"),M.source.endsWith(":")&&a(M.offset+M.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),w=M,R??(R=M.offset),f=!1,p=!1,v=!0;break;case"tag":{S&&a(M,"MULTIPLE_TAGS","A node can have at most one tag"),S=M,R??(R=M.offset),f=!1,p=!1,v=!0;break}case n:(w||S)&&a(M,"BAD_PROP_ORDER",`Anchors and tags must be after the ${M.source} indicator`),_&&a(M,"UNEXPECTED_TOKEN",`Unexpected ${M.source} in ${t??"collection"}`),_=M,f=n==="seq-item-ind"||n==="explicit-key-ind",p=!1;break;case"comma":if(t){k&&a(M,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),k=M,f=!1,p=!1;break}default:a(M,"UNEXPECTED_TOKEN",`Unexpected ${M.type} token`),f=!1,p=!1}const T=e[e.length-1],A=T?T.offset+T.source.length:r;return v&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&a(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(f&&b.indent<=l||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&a(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:_,spaceBefore:d,comment:m,hasNewline:y,anchor:w,tag:S,newlineAfterProp:E,end:A,start:R??A}}function Ad(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
392
+ `))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(Ad(t.key)||Ad(t.value))return!0}return!1;default:return!0}}function PN(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&Ad(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function h6(e,t,n){const{uniqueKeys:s}=e.options;if(s===!1)return!1;const r=typeof s=="function"?s:(a,l)=>a===l||xt(a)&&xt(l)&&a.value===l.value;return t.some(a=>r(a.key,n))}const JT="All mapping items must start at the same column";function BQ({composeNode:e,composeEmptyNode:t},n,s,r,a){var p;const l=(a==null?void 0:a.nodeClass)??vs,u=new l(n.schema);n.atRoot&&(n.atRoot=!1);let d=s.offset,f=null;for(const m of s.items){const{start:x,key:y,sep:v,value:b}=m,w=vc(x,{indicator:"explicit-key-ind",next:y??(v==null?void 0:v[0]),offset:d,onError:r,parentIndent:s.indent,startOnNewline:!0}),S=!w.found;if(S){if(y&&(y.type==="block-seq"?r(d,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in y&&y.indent!==s.indent&&r(d,"BAD_INDENT",JT)),!w.anchor&&!w.tag&&!v){f=w.end,w.comment&&(u.comment?u.comment+=`
393
+ `+w.comment:u.comment=w.comment);continue}(w.newlineAfterProp||Ad(y))&&r(y??x[x.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((p=w.found)==null?void 0:p.indent)!==s.indent&&r(d,"BAD_INDENT",JT);n.atKey=!0;const E=w.end,k=y?e(n,y,w,r):t(n,E,x,null,w,r);n.schema.compat&&PN(s.indent,y,r),n.atKey=!1,h6(n,u.items,k)&&r(E,"DUPLICATE_KEY","Map keys must be unique");const _=vc(v??[],{indicator:"map-value-ind",next:b,offset:k.range[2],onError:r,parentIndent:s.indent,startOnNewline:!y||y.type==="block-scalar"});if(d=_.end,_.found){S&&((b==null?void 0:b.type)==="block-map"&&!_.hasNewline&&r(d,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&w.start<_.found.offset-1024&&r(k.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const R=b?e(n,b,_,r):t(n,d,v,null,_,r);n.schema.compat&&PN(s.indent,b,r),d=R.range[2];const T=new En(k,R);n.options.keepSourceTokens&&(T.srcToken=m),u.items.push(T)}else{S&&r(k.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(k.comment?k.comment+=`
394
+ `+_.comment:k.comment=_.comment);const R=new En(k);n.options.keepSourceTokens&&(R.srcToken=m),u.items.push(R)}}return f&&f<d&&r(f,"IMPOSSIBLE","Map comment with trailing content"),u.range=[s.offset,d,f??d],u}function FQ({composeNode:e,composeEmptyNode:t},n,s,r,a){const l=(a==null?void 0:a.nodeClass)??So,u=new l(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let d=s.offset,f=null;for(const{start:p,value:m}of s.items){const x=vc(p,{indicator:"seq-item-ind",next:m,offset:d,onError:r,parentIndent:s.indent,startOnNewline:!0});if(!x.found)if(x.anchor||x.tag||m)(m==null?void 0:m.type)==="block-seq"?r(x.end,"BAD_INDENT","All sequence items must start at the same column"):r(d,"MISSING_CHAR","Sequence item without - indicator");else{f=x.end,x.comment&&(u.comment=x.comment);continue}const y=m?e(n,m,x,r):t(n,x.end,p,null,x,r);n.schema.compat&&PN(s.indent,m,r),d=y.range[2],u.items.push(y)}return u.range=[s.offset,d,f??d],u}function of(e,t,n,s){let r="";if(e){let a=!1,l="";for(const u of e){const{source:d,type:f}=u;switch(f){case"space":a=!0;break;case"comment":{n&&!a&&s(u,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const p=d.substring(1)||" ";r?r+=l+p:r=p,l="";break}case"newline":r&&(l+=d),a=!0;break;default:s(u,"UNEXPECTED_TOKEN",`Unexpected ${f} at node end`)}t+=d.length}}return{comment:r,offset:t}}const Yy="Block collections are not allowed within flow collections",Qy=e=>e&&(e.type==="block-map"||e.type==="block-seq");function HQ({composeNode:e,composeEmptyNode:t},n,s,r,a){var w;const l=s.start.source==="{",u=l?"flow map":"flow sequence",d=(a==null?void 0:a.nodeClass)??(l?vs:So),f=new d(n.schema);f.flow=!0;const p=n.atRoot;p&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let m=s.offset+s.start.source.length;for(let S=0;S<s.items.length;++S){const E=s.items[S],{start:k,key:_,sep:R,value:T}=E,A=vc(k,{flow:u,indicator:"explicit-key-ind",next:_??(R==null?void 0:R[0]),offset:m,onError:r,parentIndent:s.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!R&&!T){S===0&&A.comma?r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`):S<s.items.length-1&&r(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${u}`),A.comment&&(f.comment?f.comment+=`
395
+ `+A.comment:f.comment=A.comment),m=A.end;continue}!l&&n.options.strict&&Ad(_)&&r(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(S===0)A.comma&&r(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`);else if(A.comma||r(A.start,"MISSING_CHAR",`Missing , between ${u} items`),A.comment){let M="";e:for(const L of k)switch(L.type){case"comma":case"space":break;case"comment":M=L.source.substring(1);break e;default:break e}if(M){let L=f.items[f.items.length-1];Dt(L)&&(L=L.value??L.key),L.comment?L.comment+=`
396
+ `+M:L.comment=M,A.comment=A.comment.substring(M.length+1)}}if(!l&&!R&&!A.found){const M=T?e(n,T,A,r):t(n,A.end,R,null,A,r);f.items.push(M),m=M.range[2],Qy(T)&&r(M.range,"BLOCK_IN_FLOW",Yy)}else{n.atKey=!0;const M=A.end,L=_?e(n,_,A,r):t(n,M,k,null,A,r);Qy(_)&&r(L.range,"BLOCK_IN_FLOW",Yy),n.atKey=!1;const P=vc(R??[],{flow:u,indicator:"map-value-ind",next:T,offset:L.range[2],onError:r,parentIndent:s.indent,startOnNewline:!1});if(P.found){if(!l&&!A.found&&n.options.strict){if(R)for(const H of R){if(H===P.found)break;if(H.type==="newline"){r(H,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<P.found.offset-1024&&r(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else T&&("source"in T&&((w=T.source)==null?void 0:w[0])===":"?r(T,"MISSING_CHAR",`Missing space after : in ${u}`):r(P.start,"MISSING_CHAR",`Missing , or : between ${u} items`));const O=T?e(n,T,P,r):P.found?t(n,P.end,R,null,P,r):null;O?Qy(T)&&r(O.range,"BLOCK_IN_FLOW",Yy):P.comment&&(L.comment?L.comment+=`
397
+ `+P.comment:L.comment=P.comment);const B=new En(L,O);if(n.options.keepSourceTokens&&(B.srcToken=E),l){const H=f;h6(n,H.items,L)&&r(M,"DUPLICATE_KEY","Map keys must be unique"),H.items.push(B)}else{const H=new vs(n.schema);H.flow=!0,H.items.push(B);const z=(O??L).range;H.range=[L.range[0],z[1],z[2]],f.items.push(H)}m=O?O.range[2]:P.end}}const x=l?"}":"]",[y,...v]=s.end;let b=m;if((y==null?void 0:y.source)===x)b=y.offset+y.source.length;else{const S=u[0].toUpperCase()+u.substring(1),E=p?`${S} must end with a ${x}`:`${S} in block collection must be sufficiently indented and end with a ${x}`;r(m,p?"MISSING_CHAR":"BAD_INDENT",E),y&&y.source.length!==1&&v.unshift(y)}if(v.length>0){const S=of(v,b,n.options.strict,r);S.comment&&(f.comment?f.comment+=`
398
+ `+S.comment:f.comment=S.comment),f.range=[s.offset,b,S.offset]}else f.range=[s.offset,b,b];return f}function Xy(e,t,n,s,r,a){const l=n.type==="block-map"?BQ(e,t,n,s,a):n.type==="block-seq"?FQ(e,t,n,s,a):HQ(e,t,n,s,a),u=l.constructor;return r==="!"||r===u.tagName?(l.tag=u.tagName,l):(r&&(l.tag=r),l)}function UQ(e,t,n,s,r){var x;const a=s.tag,l=a?t.directives.tagName(a.source,y=>r(a,"TAG_RESOLVE_FAILED",y)):null;if(n.type==="block-seq"){const{anchor:y,newlineAfterProp:v}=s,b=y&&a?y.offset>a.offset?y:a:y??a;b&&(!v||v.offset<b.offset)&&r(b,"MISSING_CHAR","Missing newline after block sequence props")}const u=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!a||!l||l==="!"||l===vs.tagName&&u==="map"||l===So.tagName&&u==="seq")return Xy(e,t,n,r,l);let d=t.schema.tags.find(y=>y.tag===l&&y.collection===u);if(!d){const y=t.schema.knownTags[l];if((y==null?void 0:y.collection)===u)t.schema.tags.push(Object.assign({},y,{default:!1})),d=y;else return y?r(a,"BAD_COLLECTION_TYPE",`${y.tag} used for ${u} collection, but expects ${y.collection??"scalar"}`,!0):r(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${l}`,!0),Xy(e,t,n,r,l)}const f=Xy(e,t,n,r,l,d),p=((x=d.resolve)==null?void 0:x.call(d,f,y=>r(a,"TAG_RESOLVE_FAILED",y),t.options))??f,m=$t(p)?p:new Fe(p);return m.range=f.range,m.tag=l,d!=null&&d.format&&(m.format=d.format),m}function VQ(e,t,n){const s=t.offset,r=GQ(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[s,s,s]};const a=r.mode===">"?Fe.BLOCK_FOLDED:Fe.BLOCK_LITERAL,l=t.source?KQ(t.source):[];let u=l.length;for(let b=l.length-1;b>=0;--b){const w=l[b][1];if(w===""||w==="\r")u=b;else break}if(u===0){const b=r.chomp==="+"&&l.length>0?`
399
+ `.repeat(Math.max(1,l.length-1)):"";let w=s+r.length;return t.source&&(w+=t.source.length),{value:b,type:a,comment:r.comment,range:[s,w,w]}}let d=t.indent+r.indent,f=t.offset+r.length,p=0;for(let b=0;b<u;++b){const[w,S]=l[b];if(S===""||S==="\r")r.indent===0&&w.length>d&&(d=w.length);else{w.length<d&&n(f+w.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(d=w.length),p=b,d===0&&!e.atRoot&&n(f,"BAD_INDENT","Block scalar values in collections must be indented");break}f+=w.length+S.length+1}for(let b=l.length-1;b>=u;--b)l[b][0].length>d&&(u=b+1);let m="",x="",y=!1;for(let b=0;b<p;++b)m+=l[b][0].slice(d)+`
400
+ `;for(let b=p;b<u;++b){let[w,S]=l[b];f+=w.length+S.length+1;const E=S[S.length-1]==="\r";if(E&&(S=S.slice(0,-1)),S&&w.length<d){const _=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(f-S.length-(E?2:1),"BAD_INDENT",_),w=""}a===Fe.BLOCK_LITERAL?(m+=x+w.slice(d)+S,x=`
401
+ `):w.length>d||S[0]===" "?(x===" "?x=`
402
+ `:!y&&x===`
403
+ `&&(x=`
404
+
405
+ `),m+=x+w.slice(d)+S,x=`
406
+ `,y=!0):S===""?x===`
407
+ `?m+=`
408
+ `:x=`
409
+ `:(m+=x+S,x=" ",y=!1)}switch(r.chomp){case"-":break;case"+":for(let b=u;b<l.length;++b)m+=`
410
+ `+l[b][0].slice(d);m[m.length-1]!==`
411
+ `&&(m+=`
412
+ `);break;default:m+=`
413
+ `}const v=s+r.length+t.source.length;return{value:m,type:a,comment:r.comment,range:[s,v,v]}}function GQ({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:r}=t[0],a=r[0];let l=0,u="",d=-1;for(let x=1;x<r.length;++x){const y=r[x];if(!u&&(y==="-"||y==="+"))u=y;else{const v=Number(y);!l&&v?l=v:d===-1&&(d=e+x)}}d!==-1&&s(d,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let f=!1,p="",m=r.length;for(let x=1;x<t.length;++x){const y=t[x];switch(y.type){case"space":f=!0;case"newline":m+=y.source.length;break;case"comment":n&&!f&&s(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=y.source.length,p=y.source.substring(1);break;case"error":s(y,"UNEXPECTED_TOKEN",y.message),m+=y.source.length;break;default:{const v=`Unexpected token in block scalar header: ${y.type}`;s(y,"UNEXPECTED_TOKEN",v);const b=y.source;b&&typeof b=="string"&&(m+=b.length)}}}return{mode:a,indent:l,chomp:u,comment:p,length:m}}function KQ(e){const t=e.split(/\n( *)/),n=t[0],s=n.match(/^( *)/),a=[s!=null&&s[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let l=1;l<t.length;l+=2)a.push([t[l],t[l+1]]);return a}function WQ(e,t,n){const{offset:s,type:r,source:a,end:l}=e;let u,d;const f=(x,y,v)=>n(s+x,y,v);switch(r){case"scalar":u=Fe.PLAIN,d=YQ(a,f);break;case"single-quoted-scalar":u=Fe.QUOTE_SINGLE,d=QQ(a,f);break;case"double-quoted-scalar":u=Fe.QUOTE_DOUBLE,d=XQ(a,f);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[s,s+a.length,s+a.length]}}const p=s+a.length,m=of(l,p,t,n);return{value:d,type:u,comment:m.comment,range:[s,p,m.offset]}}function YQ(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),p6(e)}function QQ(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),p6(e.slice(1,-1)).replace(/''/g,"'")}function p6(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
414
+ `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
415
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=t.exec(e);if(!s)return e;let r=s[1],a=" ",l=t.lastIndex;for(n.lastIndex=l;s=n.exec(e);)s[1]===""?a===`
416
+ `?r+=a:a=`
417
+ `:(r+=a+s[1],a=" "),l=n.lastIndex;const u=/[ \t]*(.*)/sy;return u.lastIndex=l,s=u.exec(e),r+a+((s==null?void 0:s[1])??"")}function XQ(e,t){let n="";for(let s=1;s<e.length-1;++s){const r=e[s];if(!(r==="\r"&&e[s+1]===`
418
+ `))if(r===`
419
+ `){const{fold:a,offset:l}=ZQ(e,s);n+=a,s=l}else if(r==="\\"){let a=e[++s];const l=JQ[a];if(l)n+=l;else if(a===`
420
+ `)for(a=e[s+1];a===" "||a===" ";)a=e[++s+1];else if(a==="\r"&&e[s+1]===`
421
+ `)for(a=e[++s+1];a===" "||a===" ";)a=e[++s+1];else if(a==="x"||a==="u"||a==="U"){const u={x:2,u:4,U:8}[a];n+=eX(e,s+1,u,t),s+=u}else{const u=e.substr(s-1,2);t(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),n+=u}}else if(r===" "||r===" "){const a=s;let l=e[s+1];for(;l===" "||l===" ";)l=e[++s+1];l!==`
422
+ `&&!(l==="\r"&&e[s+2]===`
423
+ `)&&(n+=s>a?e.slice(a,s+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function ZQ(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===`
424
+ `||s==="\r")&&!(s==="\r"&&e[t+2]!==`
425
+ `);)s===`
426
+ `&&(n+=`
427
+ `),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}const JQ={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
428
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function eX(e,t,n,s){const r=e.substr(t,n),l=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(l)){const u=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),u}return String.fromCodePoint(l)}function m6(e,t,n,s){const{value:r,type:a,comment:l,range:u}=t.type==="block-scalar"?VQ(e,t,s):WQ(t,e.options.strict,s),d=n?e.directives.tagName(n.source,m=>s(n,"TAG_RESOLVE_FAILED",m)):null;let f;e.options.stringKeys&&e.atKey?f=e.schema[cr]:d?f=tX(e.schema,r,d,n,s):t.type==="scalar"?f=nX(e,r,t,s):f=e.schema[cr];let p;try{const m=f.resolve(r,x=>s(n??t,"TAG_RESOLVE_FAILED",x),e.options);p=xt(m)?m:new Fe(m)}catch(m){const x=m instanceof Error?m.message:String(m);s(n??t,"TAG_RESOLVE_FAILED",x),p=new Fe(r)}return p.range=u,p.source=r,a&&(p.type=a),d&&(p.tag=d),f.format&&(p.format=f.format),l&&(p.comment=l),p}function tX(e,t,n,s,r){var u;if(n==="!")return e[cr];const a=[];for(const d of e.tags)if(!d.collection&&d.tag===n)if(d.default&&d.test)a.push(d);else return d;for(const d of a)if((u=d.test)!=null&&u.test(t))return d;const l=e.knownTags[n];return l&&!l.collection?(e.tags.push(Object.assign({},l,{default:!1,test:void 0})),l):(r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[cr])}function nX({atKey:e,directives:t,schema:n},s,r,a){const l=n.tags.find(u=>{var d;return(u.default===!0||e&&u.default==="key")&&((d=u.test)==null?void 0:d.test(s))})||n[cr];if(n.compat){const u=n.compat.find(d=>{var f;return d.default&&((f=d.test)==null?void 0:f.test(s))})??n[cr];if(l.tag!==u.tag){const d=t.tagString(l.tag),f=t.tagString(u.tag),p=`Value may be parsed as either ${d} or ${f}`;a(r,"TAG_RESOLVE_FAILED",p,!0)}}return l}function sX(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let r=t[s];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++s];(r==null?void 0:r.type)==="space";)e+=r.source.length,r=t[++s];break}}return e}const rX={composeNode:g6,composeEmptyNode:Ck};function g6(e,t,n,s){const r=e.atKey,{spaceBefore:a,comment:l,anchor:u,tag:d}=n;let f,p=!0;switch(t.type){case"alias":f=iX(e,t,s),(u||d)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":f=m6(e,t,d,s),u&&(f.anchor=u.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{f=UQ(rX,e,t,n,s),u&&(f.anchor=u.source.substring(1))}catch(m){const x=m instanceof Error?m.message:String(m);s(t,"RESOURCE_EXHAUSTION",x)}break;default:{const m=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",m),p=!1}}return f??(f=Ck(e,t.offset,void 0,null,n,s)),u&&f.anchor===""&&s(u,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!xt(f)||typeof f.value!="string"||f.tag&&f.tag!=="tag:yaml.org,2002:str")&&s(d??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(f.spaceBefore=!0),l&&(t.type==="scalar"&&t.source===""?f.comment=l:f.commentBefore=l),e.options.keepSourceTokens&&p&&(f.srcToken=t),f}function Ck(e,t,n,s,{spaceBefore:r,comment:a,anchor:l,tag:u,end:d},f){const p={type:"scalar",offset:sX(t,n,s),indent:-1,source:""},m=m6(e,p,u,f);return l&&(m.anchor=l.source.substring(1),m.anchor===""&&f(l,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(m.spaceBefore=!0),a&&(m.comment=a,m.range[2]=d),m}function iX({options:e},{offset:t,source:n,end:s},r){const a=new mk(n.substring(1));a.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const l=t+n.length,u=of(s,l,e.strict,r);return a.range=[t,l,u.offset],u.comment&&(a.comment=u.comment),a}function aX(e,t,{offset:n,start:s,value:r,end:a},l){const u=Object.assign({_directives:t},e),d=new jg(void 0,u),f={atKey:!1,atRoot:!0,directives:d.directives,options:d.options,schema:d.schema},p=vc(s,{indicator:"doc-start",next:r??(a==null?void 0:a[0]),offset:n,onError:l,parentIndent:0,startOnNewline:!0});p.found&&(d.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!p.hasNewline&&l(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),d.contents=r?g6(f,r,p,l):Ck(f,p.end,s,null,p,l);const m=d.contents.range[2],x=of(a,m,!1,l);return x.comment&&(d.comment=x.comment),d.range=[n,m,x.offset],d}function Fu(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function eI(e){var r;let t="",n=!1,s=!1;for(let a=0;a<e.length;++a){const l=e[a];switch(l[0]){case"#":t+=(t===""?"":s?`
429
+
430
+ `:`
431
+ `)+(l.substring(1)||" "),n=!0,s=!1;break;case"%":((r=e[a+1])==null?void 0:r[0])!=="#"&&(a+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}class oX{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,r,a)=>{const l=Fu(n);a?this.warnings.push(new zQ(l,s,r)):this.errors.push(new sd(l,s,r))},this.directives=new _n({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:s,afterEmptyLine:r}=eI(this.prelude);if(s){const a=t.contents;if(n)t.comment=t.comment?`${t.comment}
432
+ ${s}`:s;else if(r||t.directives.docStart||!a)t.commentBefore=s;else if(Pt(a)&&!a.flow&&a.items.length>0){let l=a.items[0];Dt(l)&&(l=l.key);const u=l.commentBefore;l.commentBefore=u?`${s}
433
+ ${u}`:s}else{const l=a.commentBefore;a.commentBefore=l?`${s}
434
+ ${l}`:s}}n?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:eI(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,s=-1){for(const r of t)yield*this.next(r);yield*this.end(n,s)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(n,s,r)=>{const a=Fu(t);a[0]+=n,this.onError(a,"BAD_DIRECTIVE",s,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=aX(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new sd(Fu(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new sd(Fu(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const n=of(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const s=this.doc.comment;this.doc.comment=s?`${s}
435
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new sd(Fu(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const s=Object.assign({_directives:this.directives},this.options),r=new jg(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}}const x6="\uFEFF",y6="",v6="",$N="";function lX(e){switch(e){case x6:return"byte-order-mark";case y6:return"doc-mode";case v6:return"flow-error-end";case $N:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
436
+ `:case`\r
437
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Ts(e){switch(e){case void 0:case" ":case`
438
+ `:case"\r":case" ":return!0;default:return!1}}const tI=new Set("0123456789ABCDEFabcdef"),cX=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),pp=new Set(",[]{}"),uX=new Set(` ,[]{}
439
+ \r `),Zy=e=>!e||uX.has(e);class dX{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
440
+ `?!0:n==="\r"?this.buffer[t+1]===`
441
+ `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+t];if(n==="\r"){const r=this.buffer[s+t+1];if(r===`
442
+ `||!r&&!this.atEnd)return t+s+1}return n===`
443
+ `||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){const s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&Ts(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
444
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===x6&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,s=t.indexOf("#");for(;s!==-1;){const a=t[s-1];if(a===" "||a===" "){n=s-1;break}else s=t.indexOf("#",s+1)}for(;;){const a=t[n-1];if(a===" "||a===" ")n-=1;else break}const r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){const n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield y6,yield*this.parseLineStart()}*parseLineStart(){const t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const n=this.peek(3);if((n==="---"||n==="...")&&Ts(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ts(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ts(n)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Zy),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const r=this.getLine();if(r===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&r[0]!=="#"||s===0&&(r.startsWith("---")||r.startsWith("..."))&&Ts(r[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield v6,yield*this.parseLineStart();let a=0;for(;r[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),r[a]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Zy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const l=this.charAt(1);if(this.flowKey||Ts(l)||l===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const t=this.charAt(0);let n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let a=0;for(;this.buffer[n-1-a]==="\\";)a+=1;if(a%2===0)break;n=this.buffer.indexOf('"',n+1)}const s=this.buffer.substring(0,n);let r=s.indexOf(`
445
+ `,this.pos);if(r!==-1){for(;r!==-1;){const a=this.continueScalar(r+1);if(a===-1)break;r=s.indexOf(`
446
+ `,a)}r!==-1&&(n=r-(s[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){const n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Ts(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let a=this.pos;s=this.buffer[a];++a)switch(s){case" ":n+=1;break;case`
447
+ `:t=a,n=0;break;case"\r":{const l=this.buffer[a+1];if(!l&&!this.atEnd)return this.setNext("block-scalar");if(l===`
448
+ `)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const a=this.continueScalar(t+1);if(a===-1)break;t=this.buffer.indexOf(`
449
+ `,a)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(s=this.buffer[r];s===" ";)s=this.buffer[++r];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
450
+ `;)s=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let a=t-1,l=this.buffer[a];l==="\r"&&(l=this.buffer[--a]);const u=a;for(;l===" ";)l=this.buffer[--a];if(l===`
451
+ `&&a>=this.pos&&a+1+n>u)t=a;else break}while(!0);return yield $N,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){const a=this.buffer[s+1];if(Ts(a)||t&&pp.has(a))break;n=s}else if(Ts(r)){let a=this.buffer[s+1];if(r==="\r"&&(a===`
452
+ `?(s+=1,r=`
453
+ `,a=this.buffer[s+1]):n=s),a==="#"||t&&pp.has(a))break;if(r===`
454
+ `){const l=this.continueScalar(s+1);if(l===-1)break;s=Math.max(s,l-2)}}else{if(t&&pp.has(r))break;n=s}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield $N,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Zy))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const t=this.flowLevel>0,n=this.charAt(1);if(Ts(n)||t&&pp.has(n))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Ts(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(cX.has(n))n=this.buffer[++t];else if(n==="%"&&tI.has(this.buffer[t+1])&&tI.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===`
455
+ `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
456
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");const r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class fX{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n<s;){const a=n+s>>1;this.lineStarts[a]<t?n=a+1:s=a}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};const r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}}function Ui(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function nI(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function b6(e){switch(e==null?void 0:e.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function mp(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Al(e){var n;if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function sI(e){if(e.start.type==="flow-seq-start")for(const t of e.items)t.sep&&!t.value&&!Ui(t.start,"explicit-key-ind")&&!Ui(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,b6(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class hX{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new dX,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const s of this.lexer.lex(t,n))yield*this.next(s);n||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}const n=lX(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{const s=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&sI(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{const r=s.items[s.items.length-1];if(r.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{const r=s.items[s.items.length-1];r.value?s.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{const r=s.items[s.items.length-1];!r||r.value?s.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&nI(r.start)===-1&&(n.indent===0||r.start.every(a=>a.type!=="comment"||a.indent<n.indent))&&(s.type==="document"?s.end=r.start:s.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{nI(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}const n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){const n=mp(this.peek(2)),s=Al(n);let r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];const a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
457
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
458
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const r="end"in n.value?n.value.end:void 0,a=Array.isArray(r)?r[r.length-1]:void 0;(a==null?void 0:a.type)==="comment"?r==null||r.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const r=t.items[t.items.length-2],a=(s=r==null?void 0:r.value)==null?void 0:s.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const r=!this.onKeyLine&&this.indent===t.indent,a=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let l=[];if(a&&n.sep&&!n.value){const u=[];for(let d=0;d<n.sep.length;++d){const f=n.sep[d];switch(f.type){case"newline":u.push(d);break;case"space":break;case"comment":f.indent>t.indent&&(u.length=0);break;default:u.length=0}}u.length>=2&&(l=n.sep.splice(u[1]))}switch(this.type){case"anchor":case"tag":a||n.value?(l.push(this.sourceToken),t.items.push({start:l}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):a||n.value?(l.push(this.sourceToken),t.items.push({start:l,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ui(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]});else if(b6(n.key)&&!Ui(n.sep,"newline")){const u=Al(n.start),d=n.key,f=n.sep;f.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:d,sep:f}]})}else l.length>0?n.sep=n.sep.concat(l,this.sourceToken):n.sep.push(this.sourceToken);else if(Ui(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const u=Al(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||a?t.items.push({start:l,key:null,sep:[this.sourceToken]}):Ui(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const u=this.flowScalar(this.type);a||n.value?(t.items.push({start:l,key:u,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(u):(Object.assign(n,{key:u,sep:[]}),this.onKeyLine=!0);return}default:{const u=this.startBlockValue(t);if(u){if(u.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ui(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:l});this.stack.push(u);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const r="end"in n.value?n.value.end:void 0,a=Array.isArray(r)?r[r.length-1]:void 0;(a==null?void 0:a.type)==="comment"?r==null||r.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const r=t.items[t.items.length-2],a=(s=r==null?void 0:r.value)==null?void 0:s.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Ui(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while((s==null?void 0:s.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const r=mp(s),a=Al(r);sI(t);const l=t.end.splice(1,t.end.length);l.push(this.sourceToken);const u={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:l}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=u}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
459
+ `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
460
+ `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=mp(t),s=Al(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=mp(t),s=Al(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function pX(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new fX||null,prettyErrors:t}}function mX(e,t={}){const{lineCounter:n,prettyErrors:s}=pX(t),r=new hX(n==null?void 0:n.addNewLine),a=new oX(t);let l=null;for(const u of a.compose(r.parse(e),!0,e.length))if(!l)l=u;else if(l.options.logLevel!=="silent"){l.errors.push(new sd(u.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(l.errors.forEach(ZT(e,n)),l.warnings.forEach(ZT(e,n))),l}function Sg(e,t,n){let s;const r=mX(e,n);if(!r)return null;if(r.warnings.forEach(a=>KD(r.options.logLevel,a)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:s},n))}const gX=["incident-timeline","progress","feature-shipped","implementation-plan","concept-explainer","pr-writeup","post-mortem"],xX=new Set(gX);function yX(e){if(!e)return null;const t=e.kind;return t&&xX.has(t)?t:null}const vX=["timeline","stats","risk-table","compare","slate"],bX=new Set(vX);function wX(e){return typeof e=="string"&&bX.has(e)}const jX=new Set(["success","warning","danger","info","muted"]);function SX(e){let t;try{t=Sg(e)}catch(s){return{ok:!1,reason:`YAML parse error: ${s instanceof Error?s.message:String(s)}`}}if(!Array.isArray(t))return{ok:!1,reason:"expected a YAML list of entries"};const n=[];for(const s of t){if(!s||typeof s!="object"||Array.isArray(s))continue;const r=s;n.push({time:or(r.time),status:jX.has(r.status)?r.status:"info",title:or(r.title),body:or(r.body)})}return{ok:!0,entries:n}}const NX=new Set(["up","flat","down"]);function kX(e){let t;try{t=Sg(e)}catch(s){return{ok:!1,reason:`YAML parse error: ${s instanceof Error?s.message:String(s)}`}}if(!Array.isArray(t))return{ok:!1,reason:"expected a YAML list of entries"};const n=[];for(const s of t){if(!s||typeof s!="object"||Array.isArray(s))continue;const r=s,a=r.trend;n.push({label:or(r.label),value:or(r.value),...NX.has(a)?{trend:a}:{}})}return{ok:!0,entries:n}}const rI=new Set(["low","med","high"]);function _X(e){let t;try{t=Sg(e)}catch(s){return{ok:!1,reason:`YAML parse error: ${s instanceof Error?s.message:String(s)}`}}if(!Array.isArray(t))return{ok:!1,reason:"expected a YAML list of entries"};const n=[];for(const s of t){if(!s||typeof s!="object"||Array.isArray(s))continue;const r=s;n.push({risk:or(r.risk),probability:rI.has(r.probability)?r.probability:"med",impact:rI.has(r.impact)?r.impact:"med",mitigation:or(r.mitigation)})}return{ok:!0,entries:n}}function CX(e){let t;try{t=Sg(e)}catch(l){return{ok:!1,reason:`YAML parse error: ${l instanceof Error?l.message:String(l)}`}}if(!t||typeof t!="object"||Array.isArray(t))return{ok:!1,reason:"expected a YAML mapping with columns + rows"};const n=t;if(!Array.isArray(n.columns))return{ok:!1,reason:"missing columns array"};const s=n.columns.map(or),r=Array.isArray(n.rows)?n.rows:[],a=[];for(const l of r){if(!l||typeof l!="object"||Array.isArray(l))continue;const u=l;a.push({label:or(u.label),values:Array.isArray(u.values)?u.values.map(or):[]})}return{ok:!0,columns:s,rows:a}}function EX(e){const t=e.trim();return t.length===0?{ok:!1,reason:"empty slate body"}:{ok:!0,text:t}}function or(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):""}const RX={success:{dot:"bg-emerald-600",ink:"text-emerald-800",label:"SUCCESS"},warning:{dot:"bg-amber-500",ink:"text-amber-800",label:"WARNING"},danger:{dot:"bg-red-600",ink:"text-red-800",label:"DANGER"},info:{dot:"bg-sky-600",ink:"text-sky-800",label:"INFO"},muted:{dot:"bg-stone-500",ink:"text-stone-700",label:"MUTED"}},iI={low:{ink:"text-emerald-800",label:"LOW"},med:{ink:"text-amber-800",label:"MED"},high:{ink:"text-red-800",label:"HIGH"}};function w6({children:e,testId:t="primitive-tldr-slate"}){return i.jsxs("div",{"data-testid":t,className:"my-4 border border-stone-900 bg-stone-900 px-4 py-3 text-[12px] leading-relaxed text-stone-50 hard-shadow",children:[i.jsx("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.18em] text-stone-400",children:"TL;DR"}),i.jsx("div",{children:e})]})}function AX({entries:e,testId:t="primitive-dot-timeline"}){return e.length===0?null:i.jsx("ol",{"data-testid":t,className:"my-4 list-none space-y-0 border-l border-outline-variant pl-0",children:e.map((n,s)=>{const r=RX[n.status],a=s===e.length-1;return i.jsxs("li",{className:"relative pl-9 pb-4","data-testid":`primitive-dot-timeline-entry-${s}`,children:[!a&&i.jsx("div",{className:"absolute left-[13px] top-6 bottom-0 w-px bg-outline-variant","aria-hidden":"true"}),i.jsx("div",{className:`absolute left-[7px] top-2 h-3 w-3 rounded-full border border-outline-variant ${r.dot}`,"data-status":n.status,"aria-hidden":"true"}),i.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0",children:[i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:n.time}),i.jsx("span",{className:`font-mono text-[8px] uppercase tracking-[0.12em] ${r.ink}`,children:r.label})]}),i.jsx("div",{className:"mt-1 text-[12px] font-semibold text-stone-900",children:n.title}),n.body&&i.jsx("div",{className:"mt-1 text-[11px] leading-relaxed text-stone-700",children:n.body})]},s)})})}const TX={up:"↑",flat:"—",down:"↓"},IX={up:"text-emerald-700",flat:"text-stone-500",down:"text-red-700"};function MX({entries:e,testId:t="primitive-stat-card-band"}){return e.length===0?null:i.jsx("div",{"data-testid":t,className:"my-4 grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4",children:e.map((n,s)=>i.jsxs("div",{"data-testid":`primitive-stat-card-${s}`,className:"border border-outline-variant bg-white/45 px-3 py-2 hard-shadow",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:n.label}),i.jsxs("div",{className:"mt-1 flex items-baseline gap-2",children:[i.jsx("span",{className:"text-[18px] font-bold text-stone-900",children:n.value}),n.trend&&i.jsx("span",{className:`font-mono text-[10px] ${IX[n.trend]}`,"data-trend":n.trend,children:TX[n.trend]})]})]},s))})}function OX({entries:e,testId:t="primitive-risk-table-grid"}){return e.length===0?null:i.jsx("div",{"data-testid":t,className:"my-4 overflow-x-auto",children:i.jsxs("table",{className:"w-full border-collapse border border-outline-variant text-[11px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-stone-50",children:[i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Risk"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Prob"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Impact"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Mitigation"})]})}),i.jsx("tbody",{children:e.map((n,s)=>{const r=iI[n.probability],a=iI[n.impact];return i.jsxs("tr",{"data-testid":`primitive-risk-row-${s}`,children:[i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-900",children:n.risk}),i.jsx("td",{className:`border border-outline-variant px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] ${r.ink}`,children:r.label}),i.jsx("td",{className:`border border-outline-variant px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] ${a.ink}`,children:a.label}),i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-700",children:n.mitigation})]},s)})})]})})}function LX({columns:e,rows:t,testId:n="primitive-compare-table"}){return e.length===0?null:i.jsx("div",{"data-testid":n,className:"my-4 overflow-x-auto",children:i.jsxs("table",{className:"w-full border-collapse border border-outline-variant text-[11px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-stone-50",children:[i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600"}),e.map((s,r)=>i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:s},r))]})}),i.jsx("tbody",{children:t.map((s,r)=>i.jsxs("tr",{"data-testid":`primitive-compare-row-${r}`,children:[i.jsx("td",{className:"border border-outline-variant px-2 py-1 font-mono text-[10px] font-semibold text-stone-700",children:s.label}),e.map((a,l)=>i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-800",children:s.values[l]??""},l))]},r))})]})})}function PX({label:e,body:t,testId:n="primitive-summary-strip"}){return i.jsxs("div",{"data-testid":n,className:"my-3 border-l-4 border-emerald-600 bg-emerald-50/60 px-3 py-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.18em] text-emerald-800",children:e}),i.jsx("div",{className:"mt-1 text-[12px] text-stone-900",children:t})]})}function $X({language:e,text:t}){if(e==="timeline"){const n=SX(t);return n.ok?i.jsx(AX,{entries:n.entries,testId:`fenced-block-${e}`}):i.jsx(Hu,{language:e,text:t,reason:n.reason})}if(e==="stats"){const n=kX(t);return n.ok?i.jsx(MX,{entries:n.entries,testId:`fenced-block-${e}`}):i.jsx(Hu,{language:e,text:t,reason:n.reason})}if(e==="risk-table"){const n=_X(t);return n.ok?i.jsx(OX,{entries:n.entries,testId:`fenced-block-${e}`}):i.jsx(Hu,{language:e,text:t,reason:n.reason})}if(e==="compare"){const n=CX(t);return n.ok?i.jsx(LX,{columns:n.columns,rows:n.rows,testId:`fenced-block-${e}`}):i.jsx(Hu,{language:e,text:t,reason:n.reason})}if(e==="slate"){const n=EX(t);return n.ok?i.jsx(w6,{testId:`fenced-block-${e}`,children:n.text}):i.jsx(Hu,{language:e,text:t,reason:n.reason})}return null}function Hu({language:e,text:t,reason:n}){return i.jsxs("div",{"data-testid":`fenced-block-${e}-fallback`,className:"my-3 border border-amber-300 bg-amber-50/60 p-3",children:[i.jsxs("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-amber-700",children:[e," block (fallback: ",n,")"]}),i.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:t})]})}const DX={"incident-timeline":{ink:"text-red-800",pill:"bg-red-50 border-red-300",label:"INCIDENT TIMELINE"},progress:{ink:"text-sky-800",pill:"bg-sky-50 border-sky-300",label:"PROGRESS"},"feature-shipped":{ink:"text-emerald-800",pill:"bg-emerald-50 border-emerald-300",label:"FEATURE SHIPPED"},"implementation-plan":{ink:"text-violet-800",pill:"bg-violet-50 border-violet-300",label:"IMPLEMENTATION PLAN"},"concept-explainer":{ink:"text-amber-800",pill:"bg-amber-50 border-amber-300",label:"CONCEPT EXPLAINER"},"pr-writeup":{ink:"text-stone-800",pill:"bg-stone-50 border-stone-300",label:"PR WRITEUP"},"post-mortem":{ink:"text-stone-900",pill:"bg-stone-100 border-stone-400",label:"POST-MORTEM"}};function qX({kind:e,frontmatter:t,children:n}){const s=DX[e],r=t.title,a=t.status,l=t.author,u=t.authored||t.date,d=t.tldr,f=t.summary;return i.jsxs("section",{"data-testid":`kind-frame-${e}`,"data-kind":e,className:"my-2",children:[i.jsxs("header",{className:"mb-3 border-b border-outline-variant pb-2",children:[i.jsx("div",{"data-testid":`kind-badge-${e}`,className:`inline-block border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.18em] ${s.pill} ${s.ink}`,children:s.label}),r&&i.jsx("h1",{"data-testid":"kind-frame-title",className:"mt-2 text-[16px] font-bold text-stone-900",children:r}),(a||l||u)&&i.jsxs("div",{"data-testid":"kind-frame-meta",className:"mt-1 flex flex-wrap items-center gap-3 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:[a&&i.jsxs("span",{"data-testid":"kind-frame-meta-status",children:["status: ",a]}),l&&i.jsx("span",{"data-testid":"kind-frame-meta-author",children:l}),u&&i.jsx("span",{"data-testid":"kind-frame-meta-date",children:u})]})]}),d&&i.jsx(w6,{testId:"kind-frame-tldr",children:d}),e==="feature-shipped"&&f&&i.jsx(PX,{label:"SHIPPED",body:f,testId:"kind-frame-summary"}),i.jsx("div",{"data-testid":"kind-frame-body",children:n})]})}function Jr({content:e,assetBasePath:t,hideFrontmatter:n=!1,hideRawToggle:s=!1}){const r=C.useMemo(()=>BX(e),[e]),[a,l]=C.useState("rendered");return i.jsxs("article",{"data-testid":"markdown-viewer","data-mode":a,className:"prose-tactical max-w-none",children:[!s&&i.jsxs("div",{"data-testid":"markdown-viewer-mode-toggle",className:"mb-2 flex items-center gap-1",children:[i.jsx("button",{type:"button","data-testid":"markdown-viewer-mode-rendered","data-active":a==="rendered",onClick:()=>l("rendered"),className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${a==="rendered"?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:"rendered"}),i.jsx("button",{type:"button","data-testid":"markdown-viewer-mode-raw","data-active":a==="raw",onClick:()=>l("raw"),className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${a==="raw"?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:"raw"})]}),!n&&r.frontmatter&&i.jsx(HX,{frontmatter:r.frontmatter}),a==="raw"?i.jsx("pre",{"data-testid":"markdown-viewer-raw",className:"overflow-x-auto whitespace-pre-wrap break-words bg-stone-50 p-3 font-mono text-[10px] text-stone-800",children:e}):i.jsx(zX,{parsed:r,assetBasePath:t})]})}function zX({parsed:e,assetBasePath:t}){const n=yX(e.frontmatter),s=i.jsx("div",{className:"space-y-3","data-testid":"markdown-viewer-rendered",children:e.blocks.map((r,a)=>i.jsx(UX,{block:r,assetBasePath:t},a))});return n&&e.frontmatter?i.jsx(qX,{kind:n,frontmatter:e.frontmatter,children:s}):s}function BX(e){var l;const{frontmatter:t,body:n}=FX(e),s=n.split(`
461
+ `),r=[];let a=0;for(;a<s.length;){const u=s[a],d=u.match(/^```([\w-]*)\s*$/);if(d){const m=d[1]||null,x=(m==null?void 0:m.toLowerCase())==="mermaid",y=a+1;let v=y;for(;v<s.length&&!s[v].match(/^```\s*$/);)v++;const b=s.slice(y,v).join(`
462
+ `);r.push({type:"code",language:m,text:b,isMermaid:x}),a=v+1;continue}const f=u.match(/^(#{1,4})\s+(.+?)\s*$/);if(f){r.push({type:"heading",level:f[1].length,text:f[2]}),a++;continue}if(u.match(/^\s*([-*]|\d+\.)\s+/)){const m=[],x=!!u.match(/^\s*\d+\./);for(;a<s.length&&s[a].match(/^\s*([-*]|\d+\.)\s+/);){const y=s[a].match(/^(\s*)([-*]|\d+\.)\s+(.+)$/);if(!y)break;const v=Math.floor((((l=y[1])==null?void 0:l.length)??0)/2);m.push({depth:v,text:y[3]}),a++}r.push({type:"list",ordered:x,items:m});continue}if(u.match(/^\s*\|.*\|\s*$/)&&a+1<s.length&&s[a+1].match(/^\s*\|[\s\-:|]+\|\s*$/)){const m=aI(u);a+=2;const x=[];for(;a<s.length&&s[a].match(/^\s*\|.*\|\s*$/);)x.push(aI(s[a])),a++;r.push({type:"table",headers:m,rows:x});continue}if(u.trim()===""){r.push({type:"blank"}),a++;continue}const p=[u];for(a++;a<s.length;){const m=s[a];if(m.trim()===""||m.match(/^```/)||m.match(/^#{1,4}\s/)||m.match(/^\s*([-*]|\d+\.)\s/)||m.match(/^\s*\|.*\|\s*$/))break;p.push(m),a++}r.push({type:"paragraph",text:p.join(" ")})}return{frontmatter:t,blocks:r}}function FX(e){if(!e.startsWith(`---
463
+ `)&&!e.startsWith(`---\r
464
+ `))return{frontmatter:null,body:e};const t=e.slice(e.indexOf(`
465
+ `)+1),n=t.match(/(^|\n)---(\n|$)/);if(!n||n.index===void 0)return{frontmatter:null,body:e};const s=t.slice(0,n.index),r=t.slice(n.index+n[0].length),a={};for(const l of s.split(`
466
+ `)){const u=l.match(/^([\w.-]+):\s*(.+?)\s*$/);if(u){let d=u[2];(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'"))&&(d=d.slice(1,-1)),a[u[1]]=d}}return{frontmatter:a,body:r}}function aI(e){return e.trim().replace(/^\||\|$/g,"").split("|").map(t=>t.trim())}function HX({frontmatter:e}){const t=Object.entries(e);return t.length===0?null:i.jsxs("section",{"data-testid":"markdown-frontmatter",className:"mb-4 border border-stone-300 bg-stone-50 p-3",children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:"Frontmatter"}),i.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1",children:t.map(([n,s])=>i.jsxs(C.Fragment,{children:[i.jsx("dt",{className:"font-mono text-[10px] font-bold text-stone-700",children:n}),i.jsx("dd",{className:"font-mono text-[10px] text-stone-800 break-all",children:s})]},n))})]})}function UX({block:e,assetBasePath:t}){if(e.type==="blank")return null;if(e.type==="heading"){const n={1:"text-lg font-bold",2:"text-base font-bold",3:"text-sm font-bold",4:"text-xs font-bold"},s=`h${e.level}`;return i.jsx(s,{"data-testid":`md-heading-${e.level}`,className:`${n[e.level]} mt-4 text-stone-900`,children:Uu(e.text,t)})}if(e.type==="paragraph")return i.jsx("p",{"data-testid":"md-paragraph",className:"text-[12px] leading-relaxed text-stone-800",children:Uu(e.text,t)});if(e.type==="code")return wX(e.language)?i.jsx($X,{language:e.language,text:e.text}):e.isMermaid?i.jsxs("div",{"data-testid":"md-mermaid-placeholder",className:"border border-amber-300 bg-amber-50 p-3",children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-[0.18em] text-amber-700",children:"mermaid diagram (v0+1 trigger: render-on-click flow)"}),i.jsx("pre",{className:"overflow-x-auto bg-stone-900 p-2 font-mono text-[10px] text-stone-100",children:i.jsx("code",{children:e.text})}),i.jsx("button",{type:"button","data-testid":"md-mermaid-render-btn",disabled:!0,title:"Mermaid rendering not bundled at v0 (named v0+1 trigger). Inspect the source above.",className:"mt-2 cursor-not-allowed border border-amber-400 bg-amber-100 px-2 py-1 font-mono text-[9px] uppercase tracking-[0.10em] text-amber-800",children:"[render mermaid] (v0+1)"})]}):i.jsx(fg,{code:e.text,language:e.language});if(e.type==="list"){const n=e.ordered?"ol":"ul";return i.jsx(n,{"data-testid":`md-list-${e.ordered?"ol":"ul"}`,className:`${e.ordered?"list-decimal":"list-disc"} ml-5 space-y-1 text-[12px] text-stone-800`,children:e.items.map((s,r)=>i.jsx("li",{style:{marginLeft:`${s.depth*1}rem`},children:Uu(s.text,t)},r))})}return e.type==="table"?i.jsx("div",{"data-testid":"md-table-wrapper",className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full border-collapse border border-stone-300 text-[10px]",children:[i.jsx("thead",{className:"bg-stone-100",children:i.jsx("tr",{children:e.headers.map((n,s)=>i.jsx("th",{className:"border border-stone-300 px-2 py-1 text-left font-bold text-stone-900",children:Uu(n,t)},s))})}),i.jsx("tbody",{children:e.rows.map((n,s)=>i.jsx("tr",{className:s%2===0?"bg-white":"bg-stone-50",children:n.map((r,a)=>i.jsx("td",{className:"border border-stone-300 px-2 py-1 text-stone-800",children:Uu(r,t)},a))},s))})]})}):null}function Uu(e,t){const n=[];let s=0,r=0;const a=(u,d)=>{d>u&&n.push(e.slice(u,d))};let l=0;for(;s<e.length;){const u=e.slice(s),d=u.match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(d){a(l,s);const p=VX(d[2],t);n.push(i.jsx("img",{"data-testid":"md-inline-image",src:p,alt:d[1]??"",loading:"lazy",className:"my-2 inline-block max-w-full border border-stone-200"},r++)),s+=d[0].length,l=s;continue}const f=u.match(/^\[([^\]]+)\]\(([^)]+)\)/);if(f){a(l,s),n.push(i.jsx("a",{"data-testid":"md-inline-link",href:f[2],target:"_blank",rel:"noopener noreferrer",className:"text-blue-700 underline hover:text-blue-900",children:f[1]},r++)),s+=f[0].length,l=s;continue}if(u.startsWith("`")){const p=u.indexOf("`",1);if(p!==-1){a(l,s),n.push(i.jsx("code",{"data-testid":"md-inline-code",className:"bg-stone-100 px-1 font-mono text-[10px] text-stone-900",children:u.slice(1,p)},r++)),s+=p+1,l=s;continue}}if(u.startsWith("**")){const p=u.indexOf("**",2);if(p!==-1){a(l,s),n.push(i.jsx("strong",{className:"font-bold",children:u.slice(2,p)},r++)),s+=p+2,l=s;continue}}if(u.startsWith("*")&&!u.startsWith("**")){const p=u.indexOf("*",1);if(p!==-1&&p>1){a(l,s),n.push(i.jsx("em",{className:"italic",children:u.slice(1,p)},r++)),s+=p+1,l=s;continue}}s++}return a(l,e.length),n}function VX(e,t){if(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("/")||!t)return e;const n=t.endsWith("/")?"":"/";return`${t}${n}${e}`}function j6(e){const t=e.toLowerCase();return t.endsWith(".md")||t.endsWith(".mdx")?"markdown":t.endsWith(".yaml")||t.endsWith(".yml")?"yaml":t.endsWith(".json")?"json":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".webp")||t.endsWith(".svg")?"image":(t.endsWith(".log")||t.endsWith(".txt"),"text")}function oI(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function GX(e,t){if(!e||!t)return null;const n=oI(t),s=[...e].sort((r,a)=>a.path.length-r.path.length);for(const r of s){const a=oI(r.path);if(n===a)return null;const l=`${a}/`;if(!n.startsWith(l))continue;const u=n.slice(l.length);return!u||u.includes("../")?null:{root:r.name,path:u}}return null}function KX(e){const t=e.root?{root:e.root,path:e.readPath??e.path}:null,n=!t&&!!e.absolutePath,s=Jm(),r=C.useMemo(()=>{if(!n)return null;const a=s.data;return!a||"unavailable"in a?null:GX(a.roots,e.absolutePath)},[e.absolutePath,n,s.data]);return{rootsLoading:n&&s.isLoading,target:t??r,hasFetchIntent:!!t||!!e.absolutePath}}function S6({path:e,resolvedKind:t,content:n,imageUrl:s,target:r}){return!n&&!s&&t!=="binary"?i.jsx(Ge,{label:"NO CONTENT",description:`Loading ${e}...`,variant:"card",testId:"file-viewer-empty"}):i.jsxs("div",{"data-testid":"file-viewer","data-file-kind":t,className:"flex flex-col h-full",children:[i.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[i.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[i.jsx($e,{tool:e,size:"sm",decorative:!0}),i.jsx(it,{tone:"muted",children:yD(e).label})]}),i.jsx("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:e}),r&&i.jsxs("div",{"data-testid":"file-viewer-root-path",className:"mt-1 font-mono text-[9px] text-stone-500 break-all",children:[r.root,"/",r.path]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[t==="markdown"&&n?i.jsx("div",{className:"px-4 py-3",children:i.jsx(Jr,{content:n})}):null,t==="yaml"||t==="json"?i.jsx("pre",{className:"px-4 py-3 font-mono text-xs text-stone-900 whitespace-pre-wrap",children:n}):null,t==="text"?i.jsx("pre",{className:"px-4 py-3 font-mono text-xs text-stone-900 whitespace-pre",children:n}):null,t==="image"&&s?i.jsx("div",{className:"px-4 py-3 flex justify-center",children:i.jsx("img",{src:s,alt:e,className:"max-w-full h-auto"})}):null,t==="binary"?i.jsx("div",{className:"px-4 py-6",children:i.jsx(Ge,{label:"BINARY",description:"Cannot preview; download instead.",variant:"card",testId:"file-viewer-binary"})}):null]})]})}function WX(e){var v,b;const{path:t,kind:n,content:s,imageUrl:r}=e,a=n??j6(t),{rootsLoading:l,target:u,hasFetchIntent:d}=KX(e),f=eg((u==null?void 0:u.root)??null,(u==null?void 0:u.path)??null),p=(v=f.data)==null?void 0:v.content,m=u&&a==="image"?RN(u.root,u.path):void 0,x=s??p,y=r??m;return!s&&!r&&d&&(l||f.isLoading)?i.jsx(Ge,{label:"LOADING",description:`Loading ${t}...`,variant:"card",testId:"file-viewer-empty"}):!s&&!r&&d&&!u?i.jsx(Ge,{label:"FILE UNAVAILABLE",description:`No configured file root contains ${t}.`,variant:"card",testId:"file-viewer-error"}):!s&&!r&&f.isError?i.jsx(Ge,{label:"FILE UNAVAILABLE",description:((b=f.error)==null?void 0:b.message)??`Could not load ${t}.`,variant:"card",testId:"file-viewer-error"}):i.jsx(S6,{path:t,resolvedKind:a,content:x,imageUrl:y,target:u})}function YX(e){return!e.root&&!e.absolutePath?i.jsx(S6,{path:e.path,resolvedKind:e.kind??j6(e.path),content:e.content,imageUrl:e.imageUrl}):i.jsx(WX,{...e})}function QX({specKind:e,specName:t,version:n,source:s,manifestExcerpt:r,entryId:a}){return i.jsxs("div",{"data-testid":"sub-spec-preview",className:"flex flex-col h-full",children:[i.jsxs("header",{className:"px-4 py-3 border-b border-outline-variant",children:[i.jsx(it,{tone:"muted",children:"Referenced spec"}),i.jsxs("h3",{className:"mt-1 font-mono text-xs text-stone-900 break-all",children:[e,": ",t]})]}),i.jsxs("div",{className:"px-4 py-3 border-b border-outline-variant space-y-1.5 font-mono text-xs",children:[i.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Kind"}),i.jsx("span",{className:"text-stone-900",children:e})]}),n?i.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Version"}),i.jsx("span",{className:"text-stone-900",children:n})]}):null,s?i.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Source"}),i.jsx("span",{className:"text-stone-900 uppercase",children:s.replace("_"," ")})]}):null]}),i.jsxs("div",{className:"px-4 py-3 flex-1 min-h-0 overflow-y-auto",children:[i.jsx(it,{tone:"muted",children:"Manifest excerpt"}),r?i.jsx("pre",{className:"mt-2 whitespace-pre-wrap font-mono text-xs text-stone-900",children:r}):i.jsx("p",{className:"mt-2 font-mono text-xs text-on-surface-variant italic",children:"No excerpt available."})]}),a?i.jsx("div",{className:"px-4 py-3 border-t border-outline-variant",children:i.jsx(Ve,{to:"/specs/library/$entryId",params:{entryId:a},"data-testid":"sub-spec-open-center",className:"inline-flex items-center px-3 py-1 border border-outline-variant bg-white font-mono text-[10px] uppercase tracking-wide text-stone-900 hover:bg-stone-100",children:"Open in center →"})}):null]})}function XX({selection:e,onClose:t,events:n,selectedDiscoveredId:s,onSelectDiscoveredId:r,placementTarget:a,onClearPlacement:l}){if(!e)return null;const u=e.type==="system"?i.jsx(kY,{onClose:t,events:n,initialTab:e.tab??"log"}):e.type==="discovery"?i.jsx(UY,{onClose:t,selectedDiscoveredId:s,onSelectDiscoveredId:r,placementTarget:a,onClearPlacement:l}):e.type==="qitem"?i.jsx(ZY,{...e.data}):e.type==="file"?i.jsx(YX,{...e.data}):e.type==="sub-spec"?i.jsx(QX,{...e.data}):null;return i.jsxs("div",{"data-testid":"shared-detail-drawer-layer",className:"fixed top-14 right-0 bottom-0 left-0 z-30 pointer-events-none",children:[i.jsx("button",{type:"button","aria-label":"Close drawer","data-testid":"shared-detail-drawer-outside",className:"absolute inset-0 cursor-default pointer-events-auto",onPointerDown:t}),i.jsx(KY,{edge:"right",width:"wide",onClose:t,testId:"shared-detail-drawer",className:"absolute top-0 right-0 bottom-0 z-10 pointer-events-auto",children:u})]})}async function ZX(e,t,n){const s=`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/preview?lines=${n}`,r=await fetch(s);if(r.status===404)return{unavailable:!0,reason:(await r.json().catch(()=>({}))).error??"preview_unavailable"};if(r.status===409){const a=await r.json().catch(()=>({}));return{unavailable:!0,reason:a.error??"session_unbound",hint:a.hint}}if(r.status===502){const a=await r.json().catch(()=>({}));return{unavailable:!0,reason:a.error??"capture_failed",hint:a.hint}}if(r.status===503){const a=await r.json().catch(()=>({}));return{unavailable:!0,reason:a.error??"preview_unavailable",hint:a.hint}}if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}function JX(e){var l,u,d,f;const{data:t}=wa(),n=(u=(l=t==null?void 0:t.settings)==null?void 0:l["ui.preview.refresh_interval_seconds"])==null?void 0:u.value,s=(f=(d=t==null?void 0:t.settings)==null?void 0:d["ui.preview.default_lines"])==null?void 0:f.value,r=e.lines??s??50,a=e.paused?!1:(n??3)*1e3;return qe({queryKey:["node-preview",e.rigId,e.logicalId,r],queryFn:()=>ZX(e.rigId,e.logicalId,r),enabled:!!e.rigId&&!!e.logicalId&&!e.paused,refetchInterval:a,refetchIntervalInBackground:!1,staleTime:0})}function to(e){return!!(e&&"unavailable"in e)}async function eZ(e,t){const n=`/api/sessions/${encodeURIComponent(e)}/preview?lines=${t}`,s=await fetch(n);if(s.status===404)return{unavailable:!0,reason:(await s.json().catch(()=>({}))).error??"preview_unavailable"};if(s.status===502||s.status===503){const r=await s.json().catch(()=>({}));return{unavailable:!0,reason:r.error??"preview_unavailable",hint:r.hint}}if(!s.ok)throw new Error(`HTTP ${s.status}`);return await s.json()}function tZ(e){var l,u,d,f;const{data:t}=wa(),n=(u=(l=t==null?void 0:t.settings)==null?void 0:l["ui.preview.refresh_interval_seconds"])==null?void 0:u.value,s=(f=(d=t==null?void 0:t.settings)==null?void 0:d["ui.preview.default_lines"])==null?void 0:f.value,r=e.lines??s??50,a=e.paused?!1:(n??3)*1e3;return qe({queryKey:["session-preview",e.sessionName,r],queryFn:()=>eZ(e.sessionName,r),enabled:!!e.sessionName&&!e.paused,refetchInterval:a,refetchIntervalInBackground:!1,staleTime:0})}class nZ{constructor(){ts(this,"pins",[]);ts(this,"listeners",new Set);ts(this,"maxPins",4)}setMaxPins(t){this.maxPins=Math.max(1,Math.floor(t)),this.pins.length>this.maxPins&&(this.pins=this.pins.slice(0,this.maxPins),this.notify())}getMaxPins(){return this.maxPins}list(){return this.pins}isPinned(t,n){return this.pins.some(s=>s.rigId===t&&s.logicalId===n)}pin(t){return this.isPinned(t.rigId,t.logicalId)?!0:this.pins.length>=this.maxPins?!1:(this.pins=[...this.pins,t],this.notify(),!0)}unpin(t,n){const s=this.pins.filter(r=>!(r.rigId===t&&r.logicalId===n));s.length!==this.pins.length&&(this.pins=s,this.notify())}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(const t of this.listeners)t(this.pins)}}const $i=new nZ;function N6(){var s,r;const{data:e}=wa(),t=(r=(s=e==null?void 0:e.settings)==null?void 0:s["ui.preview.max_pins"])==null?void 0:r.value;return C.useEffect(()=>{typeof t=="number"&&$i.setMaxPins(t)},[t]),{pins:C.useSyncExternalStore(a=>$i.subscribe(a),()=>$i.list(),()=>$i.list()),maxPins:$i.getMaxPins(),pin:a=>$i.pin(a),unpin:(a,l)=>$i.unpin(a,l),isPinned:(a,l)=>$i.isPinned(a,l)}}function sZ({rigId:e,rigName:t,logicalId:n,lines:s,paused:r,hidePinButton:a,compact:l,testIdPrefix:u="preview"}){var b;const d=JX({rigId:e,logicalId:n,lines:s,paused:r}),{isPinned:f,pin:p,unpin:m}=N6(),x=f(e,n),y=()=>{var w;if(x)m(e,n);else{const S=to(d.data)?"":((w=d.data)==null?void 0:w.sessionName)??"";p({rigId:e,rigName:t??e,logicalId:n,sessionName:S})}},v=l?"max-h-32":"max-h-64";return i.jsxs("div",{"data-testid":`${u}-pane`,"data-rig-id":e,"data-logical-id":n,"data-paused":r?"true":"false",className:"border border-stone-300/40 bg-white/8 px-3 py-2 space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 truncate",children:["live preview · ",n]}),!a&&i.jsx("button",{type:"button","data-testid":`${u}-pin-toggle`,"data-pinned":x?"true":"false",onClick:y,className:"font-mono text-[8px] uppercase border border-stone-300 px-1 py-0.5 hover:bg-stone-200 shrink-0",children:x?"Unpin":"Pin"})]}),d.isLoading&&i.jsx("div",{"data-testid":`${u}-loading`,className:"font-mono text-[9px] text-stone-400",children:"Loading…"}),d.isError&&i.jsx("div",{"data-testid":`${u}-error`,className:"font-mono text-[9px] text-red-600",children:((b=d.error)==null?void 0:b.message)??"Preview failed."}),to(d.data)&&i.jsxs("div",{"data-testid":`${u}-unavailable`,className:"font-mono text-[9px] text-stone-500 space-y-0.5",children:[i.jsxs("div",{children:["Preview unavailable: ",d.data.reason,"."]}),d.data.hint&&i.jsx("div",{className:"text-stone-400",children:d.data.hint}),i.jsxs("div",{className:"text-stone-400",children:["Use ",i.jsxs("code",{children:["rig capture ",n]})," from terminal as a fallback."]})]}),!to(d.data)&&d.data&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{"data-testid":`${u}-content`,className:`font-mono text-[9px] text-stone-800 bg-stone-50 px-2 py-1 ${v} overflow-y-auto whitespace-pre-wrap break-all`,children:d.data.content||"(empty pane)"}),i.jsxs("div",{className:"font-mono text-[8px] text-stone-400 flex justify-between",children:[i.jsxs("span",{children:["captured ",new Date(d.data.capturedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]}),i.jsxs("span",{children:[d.data.lines," lines"]})]})]})]})}function rZ({testIdPrefix:e="preview-stack"}){const{pins:t}=N6();return t.length===0?null:i.jsxs("aside",{"data-testid":e,className:"absolute inset-y-0 right-0 z-10 w-72 border-l border-stone-300/25 bg-[rgba(250,249,245,0.04)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.02)] backdrop-blur-[12px] shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-y-auto pointer-events-auto",children:[i.jsxs("header",{className:"px-3 py-2 border-b border-stone-300/35 shrink-0",children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-700",children:"Pinned previews"}),i.jsxs("span",{className:"ml-2 font-mono text-[9px] text-stone-500",children:[t.length," pinned"]})]}),i.jsx("div",{className:"flex-1 px-2 py-2 space-y-2",children:t.map(n=>i.jsx(sZ,{rigId:n.rigId,rigName:n.rigName,logicalId:n.logicalId,compact:!0,testIdPrefix:`pinned-preview-${n.logicalId}`},`${n.rigId}:${n.logicalId}`))})]})}const Ms={currentRigDraft:"openrig.specs.current-rig-draft",currentAgentDraft:"openrig.specs.current-agent-draft",recentRigDrafts:"openrig.specs.recent-rig-drafts",recentAgentDrafts:"openrig.specs.recent-agent-drafts",bootstrapSourceRef:"openrig.specs.bootstrap-source-ref"},iZ={currentRigDraft:"rigged.specs.current-rig-draft",currentAgentDraft:"rigged.specs.current-agent-draft",recentRigDrafts:"rigged.specs.recent-rig-drafts",recentAgentDrafts:"rigged.specs.recent-agent-drafts",bootstrapSourceRef:"rigged.specs.bootstrap-source-ref"},aZ={activeTask:null,currentRigDraft:null,currentAgentDraft:null,recentRigDrafts:[],recentAgentDrafts:[],selectedRigDraft:null,selectedAgentDraft:null,bootstrapSourceRef:"",saveRigDraft:()=>{},rememberRigDraft:()=>{},selectRigDraft:()=>{},clearSelectedRigDraft:()=>{},saveAgentDraft:()=>{},rememberAgentDraft:()=>{},selectAgentDraft:()=>{},clearSelectedAgentDraft:()=>{},setBootstrapSourceRef:()=>{}},k6=C.createContext(aZ);function Vu(e,t){var n;if(typeof window>"u")return t;try{const s=window.localStorage.getItem(e);if(s)return JSON.parse(s);const r=((n=Object.entries(Ms).find(([,d])=>d===e))==null?void 0:n[0])??null;if(!r)return t;const a=iZ[r];if(!a)return t;const l=window.localStorage.getItem(a);if(!l)return t;const u=JSON.parse(l);return window.localStorage.setItem(e,JSON.stringify(u)),window.localStorage.removeItem(a),u}catch{return t}}function Gu(e,t){if(!(typeof window>"u"))try{if(t===""||t===null){window.localStorage.removeItem(e);return}window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function gp(e,t,n){return{id:`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,kind:e,label:n??(e==="rig"?"Untitled RigSpec":"Untitled AgentSpec"),yaml:t,updatedAt:Date.now()}}function xp(e,t){var s;const n=e.match(/^\s*name:\s*["']?([^"'\n#]+)["']?/m);return((s=n==null?void 0:n[1])==null?void 0:s.trim())||t}function lI(e,t){return[t,...e.filter(n=>n.id!==t.id&&n.yaml!==t.yaml)].slice(0,5)}function oZ(e,t,n,s){if(e==="/import")return t?{id:"import",label:"Import RigSpec",route:"/import",summary:t.label}:null;if(e==="/bootstrap"){const r=s.trim();return r?{id:"bootstrap",label:"Bootstrap",route:"/bootstrap",summary:r}:null}return e==="/agents/validate"&&n?{id:"validate-agent",label:"Validate AgentSpec",route:"/agents/validate",summary:n.label}:null}function lZ({children:e}){const t=va({select:L=>L.location.pathname}),[n,s]=C.useState(()=>Vu(Ms.currentRigDraft,null)),[r,a]=C.useState(()=>Vu(Ms.currentAgentDraft,null)),[l,u]=C.useState(()=>Vu(Ms.recentRigDrafts,[])),[d,f]=C.useState(()=>Vu(Ms.recentAgentDrafts,[])),[p,m]=C.useState(null),[x,y]=C.useState(null),[v,b]=C.useState(()=>Vu(Ms.bootstrapSourceRef,""));C.useEffect(()=>{Gu(Ms.currentRigDraft,n)},[n]),C.useEffect(()=>{Gu(Ms.currentAgentDraft,r)},[r]),C.useEffect(()=>{Gu(Ms.recentRigDrafts,l)},[l]),C.useEffect(()=>{Gu(Ms.recentAgentDrafts,d)},[d]),C.useEffect(()=>{Gu(Ms.bootstrapSourceRef,v.trim())},[v]);const w=C.useMemo(()=>l.find(L=>L.id===p)??((n==null?void 0:n.id)===p?n:null),[n,l,p]),S=C.useMemo(()=>d.find(L=>L.id===x)??((r==null?void 0:r.id)===x?r:null),[r,d,x]),E=C.useCallback((L,P)=>{if(!L.trim()){s(null);return}s(O=>({id:(O==null?void 0:O.id)??gp("rig",L,P).id,kind:"rig",label:P??xp(L,(O==null?void 0:O.label)??"Untitled RigSpec"),yaml:L,updatedAt:Date.now()}))},[]),k=C.useCallback((L,P)=>{if(!L.trim())return;const O=gp("rig",L,P??xp(L,"Untitled RigSpec"));s(O),u(B=>lI(B,O)),m(O.id)},[]),_=C.useCallback((L,P)=>{if(!L.trim()){a(null);return}a(O=>({id:(O==null?void 0:O.id)??gp("agent",L,P).id,kind:"agent",label:P??xp(L,(O==null?void 0:O.label)??"Untitled AgentSpec"),yaml:L,updatedAt:Date.now()}))},[]),R=C.useCallback((L,P)=>{if(!L.trim())return;const O=gp("agent",L,P??xp(L,"Untitled AgentSpec"));a(O),f(B=>lI(B,O)),y(O.id)},[]),T=C.useCallback(L=>{m(L);const P=l.find(O=>O.id===L)??((n==null?void 0:n.id)===L?n:null);P&&s(P)},[n,l]),A=C.useCallback(L=>{y(L);const P=d.find(O=>O.id===L)??((r==null?void 0:r.id)===L?r:null);P&&a(P)},[r,d]),M=C.useMemo(()=>({activeTask:oZ(t,n,r,v),currentRigDraft:n,currentAgentDraft:r,recentRigDrafts:l,recentAgentDrafts:d,selectedRigDraft:w,selectedAgentDraft:S,bootstrapSourceRef:v,saveRigDraft:E,rememberRigDraft:k,selectRigDraft:T,clearSelectedRigDraft:()=>m(null),saveAgentDraft:_,rememberAgentDraft:R,selectAgentDraft:A,clearSelectedAgentDraft:()=>y(null),setBootstrapSourceRef:b}),[t,n,r,l,d,w,S,v,E,k,T,_,R,A]);return i.jsx(k6.Provider,{value:M,children:e})}function lf(){return C.useContext(k6)}const _6=C.createContext({mode:"opaque",setMode:()=>{},expandedRigs:new Map,setRigExpanded:()=>{},toggleRig:()=>{}});function cZ(e){const t=e.match(/^\/topology\/seat\/([^/]+)\//);if(t)return decodeURIComponent(t[1]);const n=e.match(/^\/topology\/pod\/([^/]+)\//);if(n)return decodeURIComponent(n[1]);const s=e.match(/^\/topology\/rig\/([^/]+)$/);return s?decodeURIComponent(s[1]):null}function uZ({children:e}){const[t,n]=C.useState("opaque"),s=C.useCallback(p=>{n(p)},[]),[r,a]=C.useState(()=>new Map),l=C.useCallback((p,m)=>{a(x=>{if(x.has(p)&&x.get(p)===m)return x;const y=new Map(x);return y.set(p,m),y})},[]),u=C.useCallback(p=>{a(m=>{const x=new Map(m);return x.set(p,!(m.get(p)??!1)),x})},[]),d=va({select:p=>p.location.pathname});C.useEffect(()=>{const p=cZ(d);p&&l(p,!0)},[d,l]);const f=C.useMemo(()=>({mode:t,setMode:s,expandedRigs:r,setRigExpanded:l,toggleRig:u}),[t,s,r,l,u]);return i.jsx(_6.Provider,{value:f,children:e})}function Ek(){return C.useContext(_6)}function dZ(){const e=Mt(),t=C.useRef(null);C.useEffect(()=>{const n=new Set,s=cg(r=>{const{type:a,rigId:l}=r;a&&(a.startsWith("node.startup_")&&l&&n.add(`rig:${l}:nodes`),(a==="rig.created"||a==="rig.deleted"||a==="rig.stopped"||a==="rig.imported"||a==="bootstrap.completed"||a==="bootstrap.partial")&&(n.add("rigs:summary"),n.add("ps")),a==="restore.completed"&&l&&(n.add("rigs:summary"),n.add("ps"),n.add(`rig:${l}:nodes`)),(a==="rig.archived"||a==="rig.unarchived")&&(n.add("rigs:summary"),n.add("rigs:summary:archived"),n.add("ps"),l&&n.add(`rig:${l}:nodes`)),!t.current&&(t.current=setTimeout(()=>{t.current=null;for(const u of n)if(u==="rigs:summary")e.invalidateQueries({queryKey:["rigs","summary"]});else if(u==="rigs:summary:archived")e.invalidateQueries({queryKey:["rigs","summary","archived"]});else if(u==="ps")e.invalidateQueries({queryKey:["ps"]});else if(u.startsWith("rig:")){const d=u.split(":");e.invalidateQueries({queryKey:["rig",d[1],d[2]]})}n.clear()},150)))});return()=>{s(),t.current&&(clearTimeout(t.current),t.current=null)}},[e])}const C6=C.createContext({selection:null,setSelection:()=>{}}),E6=C.createContext({selectedDiscoveredId:null,setSelectedDiscoveredId:()=>{},placementTarget:null,setPlacementTarget:()=>{},clearPlacement:()=>{}});function Ng(){return C.useContext(C6)}function fZ(){return C.useContext(E6)}const cI=[{id:"dashboard",label:"Dashboard",to:"/",icon:tG,activeWhen:e=>e==="/",testId:"rail-dashboard",group:"destination"},{id:"topology",label:"Topology",to:"/topology",icon:P2,activeWhen:e=>e.startsWith("/topology")||e.startsWith("/rigs/"),testId:"rail-topology",group:"destination"},{id:"for-you",label:"For You",to:"/for-you",icon:D2,activeWhen:e=>e.startsWith("/for-you"),testId:"rail-for-you",group:"destination"},{id:"project",label:"Project",to:"/project",icon:L2,activeWhen:e=>e.startsWith("/project"),testId:"rail-project",group:"destination"},{id:"specs",label:"Library",to:"/specs",icon:H$,activeWhen:e=>e.startsWith("/specs")||e.startsWith("/plugins"),testId:"rail-specs",group:"destination"},{id:"settings",label:"Settings",to:"/settings",icon:F$,activeWhen:e=>e.startsWith("/settings"),testId:"rail-settings",group:"destination"},{id:"advisor",label:"Advisor",to:"/settings#agents-advisor-session",icon:EV,activeWhen:()=>!1,testId:"rail-advisor",group:"chat"},{id:"operator",label:"Operator",to:"/settings#agents-operator-session",icon:AG,activeWhen:()=>!1,testId:"rail-operator",group:"chat"}];function uI(e,t){var s;if(!e||!e.settings)return"";const n=(s=e.settings[t])==null?void 0:s.value;return typeof n=="string"?n:""}function dI(e,t){if(!e)return`/settings#agents-${t}-session`;const n=e.indexOf("@");if(n===-1)return`/settings#agents-${t}-session`;const s=e.slice(0,n),r=e.slice(n+1);return!r||!s?`/settings#agents-${t}-session`:`/topology/seat/${encodeURIComponent(r)}/${encodeURIComponent(s)}`}function hZ(e){return e.startsWith("/topology")||e.startsWith("/rigs/")?"topology":e.startsWith("/project")?"project":e.startsWith("/specs")||e.startsWith("/plugins")?"specs":e.startsWith("/for-you")?"for-you":e.startsWith("/settings")?"settings":"none"}function fI({pathname:e,onMobileClose:t,vertical:n}){const s=cI.filter(f=>f.group==="destination"),{data:r}=wa(),a=uI(r,"agents.advisor_session"),l=uI(r,"agents.operator_session"),u=cI.filter(f=>f.group==="chat").map(f=>f.id==="advisor"?{...f,to:dI(a,"advisor")}:f.id==="operator"?{...f,to:dI(l,"operator")}:f),d=f=>{const p=f.icon,m=f.activeWhen(e);return i.jsxs(Ve,{to:f.to,"data-testid":f.testId,"data-active":m,"aria-label":f.label,title:f.label,onClick:t,className:he("relative flex h-11 w-11 items-center justify-center transition-colors lg:h-10 lg:w-10","focus-visible:outline focus-visible:outline-2 focus-visible:outline-stone-900 focus-visible:outline-offset-2",m?"bg-stone-900 text-stone-50":"text-stone-700 hover:bg-stone-200/60 hover:text-stone-900"),children:[i.jsx(p,{className:"h-5 w-5",strokeWidth:1.25}),m&&i.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1 bottom-1 w-[2px] bg-tertiary"})]},f.id)};return i.jsxs("nav",{"data-testid":"app-rail","aria-label":"Primary navigation",className:he("vellum border-outline-variant flex shrink-0",n?"w-12 flex-col items-center border-r py-2 gap-1":"w-full flex-row items-center border-b px-2 gap-1 overflow-x-auto"),children:[i.jsx("div",{className:he("flex",n?"flex-col gap-1 items-center":"flex-row gap-1 items-center"),children:s.map(d)}),i.jsx("div",{className:he(n?"flex-1":"flex-1 hidden lg:block")}),i.jsx("div",{className:he("flex",n?"flex-col gap-1 items-center pb-1":"flex-row gap-1 items-center"),children:u.map(d)})]})}const hI=1024;function pZ({children:e}){return i.jsx(lZ,{children:i.jsx(uZ,{children:i.jsx(mZ,{children:e})})})}function mZ({children:e}){const n=va().location.pathname,s=hZ(n),{mode:r}=Ek(),[a,l]=C.useState(!1),[u,d]=C.useState(!0),[f,p]=C.useState(()=>typeof window>"u"?!0:window.innerWidth>=hI),[m,x]=C.useState(null),[y,v]=C.useState(null),[b,w]=C.useState(null),{events:S}=ck(),E=C.useCallback(z=>{x(z),!f&&z&&l(!1)},[f]),k=C.useCallback(()=>{v(null),w(null)},[]),_=C.useCallback(z=>{v(z),w(null)},[]);C.useEffect(()=>{const z=()=>{p(window.innerWidth>=hI)};return z(),window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)},[]),C.useEffect(()=>{(m==null?void 0:m.type)!=="discovery"&&k()},[m,k]),C.useEffect(()=>{f||(x(null),l(!1))},[f,n]),dZ();const R=s!=="none",T=R&&!$T(s,f),A=!!m,M=r==="overlay"&&s==="topology",L=f&&R&&u?"21rem":"3rem",H={"--workspace-left-offset":f?M?"0rem":L:"0rem","--workspace-right-offset":f&&A?"38rem":"0rem","--explorer-anchor-left":L,"--header-anchor-offset":f&&M?L:"0rem"};return i.jsx(C6.Provider,{value:{selection:m,setSelection:E},children:i.jsx(E6.Provider,{value:{selectedDiscoveredId:y,setSelectedDiscoveredId:_,placementTarget:b,setPlacementTarget:w,clearPlacement:k},children:i.jsxs("div",{className:"h-screen flex flex-col",children:[i.jsxs("header",{"data-testid":"app-topbar",className:"h-14 flex items-center justify-between px-4 bg-background border-b border-outline-variant shrink-0 relative z-30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[!$T(s,f)&&i.jsxs("button",{type:"button","data-testid":"mobile-menu-toggle",onClick:()=>l(z=>!z),"aria-label":"Toggle navigation",className:"flex flex-col gap-[3px] p-2 lg:hidden",children:[i.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),i.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),i.jsx("span",{className:"block w-3 h-[1.5px] bg-stone-900"})]}),i.jsx(Ve,{to:"/","data-testid":"brand-home-link",className:"inline-flex items-center bg-stone-950 px-3 py-1 font-mono text-sm font-bold uppercase tracking-[0.08em] text-stone-50 hover:bg-stone-800",children:"OPENRIG"})]}),i.jsx("div",{"data-testid":"topbar-right-slot",className:"hidden sm:flex items-center gap-2",children:i.jsx("span",{"data-testid":"topbar-env-indicator",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant",children:"localhost"})})]}),i.jsxs("div",{className:"flex flex-1 min-h-0 relative",children:[i.jsx("div",{className:"hidden lg:flex",children:i.jsx(fI,{pathname:n,vertical:!0})}),!f&&i.jsxs(i.Fragment,{children:[a&&i.jsx("div",{className:"fixed inset-0 bg-black/20 z-20 lg:hidden",onClick:()=>l(!1)}),i.jsx("div",{"data-testid":"mobile-rail-tray",className:he("fixed top-14 left-0 bottom-0 z-30 bg-background border-r border-outline-variant transition-transform duration-200 ease-tactical lg:hidden","w-72 max-w-[85vw] flex flex-col",a?"translate-x-0":"-translate-x-full"),children:i.jsx(fI,{pathname:n,vertical:!0,onMobileClose:()=>l(!1)})})]}),T&&i.jsx(mY,{open:a,onClose:()=>l(!1),selection:m,onSelect:E,desktopMode:u?"full":"hidden",surface:s,onDesktopToggle:()=>d(z=>!z),overlayMode:M?"overlay":"opaque"}),i.jsx("main",{"data-testid":"content-area","data-explorer-mode":M?"overlay":"opaque",className:"flex-1 flex flex-col overflow-auto relative",style:{...H,paddingLeft:"var(--workspace-left-offset, 0px)"},children:i.jsx("div",{className:"relative z-10 route-enter flex-1 flex flex-col pb-14 lg:pb-0",style:{"--workspace-left-offset":"0px","--workspace-right-offset":"0px"},children:e},n)}),i.jsx(XX,{selection:m,onClose:()=>E(null),events:S,selectedDiscoveredId:y,onSelectDiscoveredId:_,placementTarget:b,onClearPlacement:k}),i.jsx(rZ,{}),i.jsx(gZ,{pathname:n})]})]})})})}function gZ({pathname:e}){const t=[{id:"for-you",label:"For You",to:"/for-you",activeWhen:n=>n.startsWith("/for-you"),icon:D2},{id:"project",label:"Project",to:"/project",activeWhen:n=>n.startsWith("/project"),icon:L2},{id:"topology",label:"Topology",to:"/topology",activeWhen:n=>n.startsWith("/topology")||n.startsWith("/rigs/"),icon:P2}];return i.jsx("nav",{"data-testid":"mobile-bottom-nav","aria-label":"Mobile bottom navigation",className:"fixed bottom-0 left-0 right-0 z-40 lg:hidden vellum border-t border-outline-variant flex",children:t.map(n=>{const s=n.activeWhen(e);return i.jsxs(Ve,{to:n.to,"data-testid":`mobile-nav-${n.id}`,"data-active":s,className:he("flex-1 flex flex-col items-center justify-center gap-0.5 py-2 font-mono text-[9px] uppercase tracking-wide",s?"text-stone-900":"text-on-surface-variant hover:text-stone-900"),children:[i.jsx(n.icon,{className:"h-5 w-5",strokeWidth:1.25,"aria-hidden":"true"}),i.jsx("span",{children:n.label})]},n.id)})})}function Vt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=Vt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var xZ={value:()=>{}};function kg(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new tm(n)}function tm(e){this._=e}function yZ(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",r=n.indexOf(".");if(r>=0&&(s=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}tm.prototype=kg.prototype={constructor:tm,on:function(e,t){var n=this._,s=yZ(e+"",n),r,a=-1,l=s.length;if(arguments.length<2){for(;++a<l;)if((r=(e=s[a]).type)&&(r=vZ(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<l;)if(r=(e=s[a]).type)n[r]=pI(n[r],e.name,t);else if(t==null)for(r in n)n[r]=pI(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new tm(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),s=0,r,a;s<r;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,r=a.length;s<r;++s)a[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],r=0,a=s.length;r<a;++r)s[r].value.apply(t,n)}};function vZ(e,t){for(var n=0,s=e.length,r;n<s;++n)if((r=e[n]).name===t)return r.value}function pI(e,t,n){for(var s=0,r=e.length;s<r;++s)if(e[s].name===t){e[s]=xZ,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var DN="http://www.w3.org/1999/xhtml";const mI={svg:"http://www.w3.org/2000/svg",xhtml:DN,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function _g(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),mI.hasOwnProperty(t)?{space:mI[t],local:e}:e}function bZ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===DN&&t.documentElement.namespaceURI===DN?t.createElement(e):t.createElementNS(n,e)}}function wZ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function R6(e){var t=_g(e);return(t.local?wZ:bZ)(t)}function jZ(){}function Rk(e){return e==null?jZ:function(){return this.querySelector(e)}}function SZ(e){typeof e!="function"&&(e=Rk(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var a=t[r],l=a.length,u=s[r]=new Array(l),d,f,p=0;p<l;++p)(d=a[p])&&(f=e.call(d,d.__data__,p,a))&&("__data__"in d&&(f.__data__=d.__data__),u[p]=f);return new is(s,this._parents)}function NZ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function kZ(){return[]}function A6(e){return e==null?kZ:function(){return this.querySelectorAll(e)}}function _Z(e){return function(){return NZ(e.apply(this,arguments))}}function CZ(e){typeof e=="function"?e=_Z(e):e=A6(e);for(var t=this._groups,n=t.length,s=[],r=[],a=0;a<n;++a)for(var l=t[a],u=l.length,d,f=0;f<u;++f)(d=l[f])&&(s.push(e.call(d,d.__data__,f,l)),r.push(d));return new is(s,r)}function T6(e){return function(){return this.matches(e)}}function I6(e){return function(t){return t.matches(e)}}var EZ=Array.prototype.find;function RZ(e){return function(){return EZ.call(this.children,e)}}function AZ(){return this.firstElementChild}function TZ(e){return this.select(e==null?AZ:RZ(typeof e=="function"?e:I6(e)))}var IZ=Array.prototype.filter;function MZ(){return Array.from(this.children)}function OZ(e){return function(){return IZ.call(this.children,e)}}function LZ(e){return this.selectAll(e==null?MZ:OZ(typeof e=="function"?e:I6(e)))}function PZ(e){typeof e!="function"&&(e=T6(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var a=t[r],l=a.length,u=s[r]=[],d,f=0;f<l;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&u.push(d);return new is(s,this._parents)}function M6(e){return new Array(e.length)}function $Z(){return new is(this._enter||this._groups.map(M6),this._parents)}function _m(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_m.prototype={constructor:_m,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function DZ(e){return function(){return e}}function qZ(e,t,n,s,r,a){for(var l=0,u,d=t.length,f=a.length;l<f;++l)(u=t[l])?(u.__data__=a[l],s[l]=u):n[l]=new _m(e,a[l]);for(;l<d;++l)(u=t[l])&&(r[l]=u)}function zZ(e,t,n,s,r,a,l){var u,d,f=new Map,p=t.length,m=a.length,x=new Array(p),y;for(u=0;u<p;++u)(d=t[u])&&(x[u]=y=l.call(d,d.__data__,u,t)+"",f.has(y)?r[u]=d:f.set(y,d));for(u=0;u<m;++u)y=l.call(e,a[u],u,a)+"",(d=f.get(y))?(s[u]=d,d.__data__=a[u],f.delete(y)):n[u]=new _m(e,a[u]);for(u=0;u<p;++u)(d=t[u])&&f.get(x[u])===d&&(r[u]=d)}function BZ(e){return e.__data__}function FZ(e,t){if(!arguments.length)return Array.from(this,BZ);var n=t?zZ:qZ,s=this._parents,r=this._groups;typeof e!="function"&&(e=DZ(e));for(var a=r.length,l=new Array(a),u=new Array(a),d=new Array(a),f=0;f<a;++f){var p=s[f],m=r[f],x=m.length,y=HZ(e.call(p,p&&p.__data__,f,s)),v=y.length,b=u[f]=new Array(v),w=l[f]=new Array(v),S=d[f]=new Array(x);n(p,m,b,w,S,y,t);for(var E=0,k=0,_,R;E<v;++E)if(_=b[E]){for(E>=k&&(k=E+1);!(R=w[k])&&++k<v;);_._next=R||null}}return l=new is(l,s),l._enter=u,l._exit=d,l}function HZ(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UZ(){return new is(this._exit||this._groups.map(M6),this._parents)}function VZ(e,t,n){var s=this.enter(),r=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?a.remove():n(a),s&&r?s.merge(r).order():r}function GZ(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,r=n.length,a=s.length,l=Math.min(r,a),u=new Array(r),d=0;d<l;++d)for(var f=n[d],p=s[d],m=f.length,x=u[d]=new Array(m),y,v=0;v<m;++v)(y=f[v]||p[v])&&(x[v]=y);for(;d<r;++d)u[d]=n[d];return new is(u,this._parents)}function KZ(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],r=s.length-1,a=s[r],l;--r>=0;)(l=s[r])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function WZ(e){e||(e=YZ);function t(m,x){return m&&x?e(m.__data__,x.__data__):!m-!x}for(var n=this._groups,s=n.length,r=new Array(s),a=0;a<s;++a){for(var l=n[a],u=l.length,d=r[a]=new Array(u),f,p=0;p<u;++p)(f=l[p])&&(d[p]=f);d.sort(t)}return new is(r,this._parents).order()}function YZ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function QZ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XZ(){return Array.from(this)}function ZZ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],r=0,a=s.length;r<a;++r){var l=s[r];if(l)return l}return null}function JZ(){let e=0;for(const t of this)++e;return e}function eJ(){return!this.node()}function tJ(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var r=t[n],a=0,l=r.length,u;a<l;++a)(u=r[a])&&e.call(u,u.__data__,a,r);return this}function nJ(e){return function(){this.removeAttribute(e)}}function sJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rJ(e,t){return function(){this.setAttribute(e,t)}}function iJ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function aJ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function oJ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function lJ(e,t){var n=_g(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?sJ:nJ:typeof t=="function"?n.local?oJ:aJ:n.local?iJ:rJ)(n,t))}function O6(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cJ(e){return function(){this.style.removeProperty(e)}}function uJ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dJ(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function fJ(e,t,n){return arguments.length>1?this.each((t==null?cJ:typeof t=="function"?dJ:uJ)(e,t,n??"")):bc(this.node(),e)}function bc(e,t){return e.style.getPropertyValue(t)||O6(e).getComputedStyle(e,null).getPropertyValue(t)}function hJ(e){return function(){delete this[e]}}function pJ(e,t){return function(){this[e]=t}}function mJ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function gJ(e,t){return arguments.length>1?this.each((t==null?hJ:typeof t=="function"?mJ:pJ)(e,t)):this.node()[e]}function L6(e){return e.trim().split(/^|\s+/)}function Ak(e){return e.classList||new P6(e)}function P6(e){this._node=e,this._names=L6(e.getAttribute("class")||"")}P6.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function $6(e,t){for(var n=Ak(e),s=-1,r=t.length;++s<r;)n.add(t[s])}function D6(e,t){for(var n=Ak(e),s=-1,r=t.length;++s<r;)n.remove(t[s])}function xJ(e){return function(){$6(this,e)}}function yJ(e){return function(){D6(this,e)}}function vJ(e,t){return function(){(t.apply(this,arguments)?$6:D6)(this,e)}}function bJ(e,t){var n=L6(e+"");if(arguments.length<2){for(var s=Ak(this.node()),r=-1,a=n.length;++r<a;)if(!s.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?vJ:t?xJ:yJ)(n,t))}function wJ(){this.textContent=""}function jJ(e){return function(){this.textContent=e}}function SJ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function NJ(e){return arguments.length?this.each(e==null?wJ:(typeof e=="function"?SJ:jJ)(e)):this.node().textContent}function kJ(){this.innerHTML=""}function _J(e){return function(){this.innerHTML=e}}function CJ(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function EJ(e){return arguments.length?this.each(e==null?kJ:(typeof e=="function"?CJ:_J)(e)):this.node().innerHTML}function RJ(){this.nextSibling&&this.parentNode.appendChild(this)}function AJ(){return this.each(RJ)}function TJ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function IJ(){return this.each(TJ)}function MJ(e){var t=typeof e=="function"?e:R6(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function OJ(){return null}function LJ(e,t){var n=typeof e=="function"?e:R6(e),s=t==null?OJ:typeof t=="function"?t:Rk(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function PJ(){var e=this.parentNode;e&&e.removeChild(this)}function $J(){return this.each(PJ)}function DJ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qJ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zJ(e){return this.select(e?qJ:DJ)}function BJ(e){return arguments.length?this.property("__data__",e):this.node().__data__}function FJ(e){return function(t){e.call(this,t,this.__data__)}}function HJ(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function UJ(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,r=t.length,a;n<r;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function VJ(e,t,n){return function(){var s=this.__on,r,a=FJ(t);if(s){for(var l=0,u=s.length;l<u;++l)if((r=s[l]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),r.value=t;return}}this.addEventListener(e.type,a,n),r={type:e.type,name:e.name,value:t,listener:a,options:n},s?s.push(r):this.__on=[r]}}function GJ(e,t,n){var s=HJ(e+""),r,a=s.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,f=u.length,p;d<f;++d)for(r=0,p=u[d];r<a;++r)if((l=s[r]).type===p.type&&l.name===p.name)return p.value}return}for(u=t?VJ:UJ,r=0;r<a;++r)this.each(u(s[r],t,n));return this}function q6(e,t,n){var s=O6(e),r=s.CustomEvent;typeof r=="function"?r=new r(t,n):(r=s.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function KJ(e,t){return function(){return q6(this,e,t)}}function WJ(e,t){return function(){return q6(this,e,t.apply(this,arguments))}}function YJ(e,t){return this.each((typeof t=="function"?WJ:KJ)(e,t))}function*QJ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],r=0,a=s.length,l;r<a;++r)(l=s[r])&&(yield l)}var z6=[null];function is(e,t){this._groups=e,this._parents=t}function cf(){return new is([[document.documentElement]],z6)}function XJ(){return this}is.prototype=cf.prototype={constructor:is,select:SZ,selectAll:CZ,selectChild:TZ,selectChildren:LZ,filter:PZ,data:FZ,enter:$Z,exit:UZ,join:VZ,merge:GZ,selection:XJ,order:KZ,sort:WZ,call:QZ,nodes:XZ,node:ZZ,size:JZ,empty:eJ,each:tJ,attr:lJ,style:fJ,property:gJ,classed:bJ,text:NJ,html:EJ,raise:AJ,lower:IJ,append:MJ,insert:LJ,remove:$J,clone:zJ,datum:BJ,on:GJ,dispatch:YJ,[Symbol.iterator]:QJ};function rs(e){return typeof e=="string"?new is([[document.querySelector(e)]],[document.documentElement]):new is([[e]],z6)}function ZJ(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ls(e,t){if(e=ZJ(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const JJ={passive:!1},Td={capture:!0,passive:!1};function Jy(e){e.stopImmediatePropagation()}function Jl(e){e.preventDefault(),e.stopImmediatePropagation()}function B6(e){var t=e.document.documentElement,n=rs(e).on("dragstart.drag",Jl,Td);"onselectstart"in t?n.on("selectstart.drag",Jl,Td):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function F6(e,t){var n=e.document.documentElement,s=rs(e).on("dragstart.drag",null);t&&(s.on("click.drag",Jl,Td),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const yp=e=>()=>e;function qN(e,{sourceEvent:t,subject:n,target:s,identifier:r,active:a,x:l,y:u,dx:d,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}qN.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function eee(e){return!e.ctrlKey&&!e.button}function tee(){return this.parentNode}function nee(e,t){return t??{x:e.x,y:e.y}}function see(){return navigator.maxTouchPoints||"ontouchstart"in this}function H6(){var e=eee,t=tee,n=nee,s=see,r={},a=kg("start","drag","end"),l=0,u,d,f,p,m=0;function x(_){_.on("mousedown.drag",y).filter(s).on("touchstart.drag",w).on("touchmove.drag",S,JJ).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(_,R){if(!(p||!e.call(this,_,R))){var T=k(this,t.call(this,_,R),_,R,"mouse");T&&(rs(_.view).on("mousemove.drag",v,Td).on("mouseup.drag",b,Td),B6(_.view),Jy(_),f=!1,u=_.clientX,d=_.clientY,T("start",_))}}function v(_){if(Jl(_),!f){var R=_.clientX-u,T=_.clientY-d;f=R*R+T*T>m}r.mouse("drag",_)}function b(_){rs(_.view).on("mousemove.drag mouseup.drag",null),F6(_.view,f),Jl(_),r.mouse("end",_)}function w(_,R){if(e.call(this,_,R)){var T=_.changedTouches,A=t.call(this,_,R),M=T.length,L,P;for(L=0;L<M;++L)(P=k(this,A,_,R,T[L].identifier,T[L]))&&(Jy(_),P("start",_,T[L]))}}function S(_){var R=_.changedTouches,T=R.length,A,M;for(A=0;A<T;++A)(M=r[R[A].identifier])&&(Jl(_),M("drag",_,R[A]))}function E(_){var R=_.changedTouches,T=R.length,A,M;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),A=0;A<T;++A)(M=r[R[A].identifier])&&(Jy(_),M("end",_,R[A]))}function k(_,R,T,A,M,L){var P=a.copy(),O=Ls(L||T,R),B,H,z;if((z=n.call(_,new qN("beforestart",{sourceEvent:T,target:x,identifier:M,active:l,x:O[0],y:O[1],dx:0,dy:0,dispatch:P}),A))!=null)return B=z.x-O[0]||0,H=z.y-O[1]||0,function W($,F,G){var X=O,Z;switch($){case"start":r[M]=W,Z=l++;break;case"end":delete r[M],--l;case"drag":O=Ls(G||F,R),Z=l;break}P.call($,_,new qN($,{sourceEvent:F,subject:z,target:x,identifier:M,active:Z,x:O[0]+B,y:O[1]+H,dx:O[0]-X[0],dy:O[1]-X[1],dispatch:P}),A)}}return x.filter=function(_){return arguments.length?(e=typeof _=="function"?_:yp(!!_),x):e},x.container=function(_){return arguments.length?(t=typeof _=="function"?_:yp(_),x):t},x.subject=function(_){return arguments.length?(n=typeof _=="function"?_:yp(_),x):n},x.touchable=function(_){return arguments.length?(s=typeof _=="function"?_:yp(!!_),x):s},x.on=function(){var _=a.on.apply(a,arguments);return _===a?x:_},x.clickDistance=function(_){return arguments.length?(m=(_=+_)*_,x):Math.sqrt(m)},x}function Tk(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function U6(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function uf(){}var Id=.7,Cm=1/Id,ec="\\s*([+-]?\\d+)\\s*",Md="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",lr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ree=/^#([0-9a-f]{3,8})$/,iee=new RegExp(`^rgb\\(${ec},${ec},${ec}\\)$`),aee=new RegExp(`^rgb\\(${lr},${lr},${lr}\\)$`),oee=new RegExp(`^rgba\\(${ec},${ec},${ec},${Md}\\)$`),lee=new RegExp(`^rgba\\(${lr},${lr},${lr},${Md}\\)$`),cee=new RegExp(`^hsl\\(${Md},${lr},${lr}\\)$`),uee=new RegExp(`^hsla\\(${Md},${lr},${lr},${Md}\\)$`),gI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Tk(uf,No,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:xI,formatHex:xI,formatHex8:dee,formatHsl:fee,formatRgb:yI,toString:yI});function xI(){return this.rgb().formatHex()}function dee(){return this.rgb().formatHex8()}function fee(){return V6(this).formatHsl()}function yI(){return this.rgb().formatRgb()}function No(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ree.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?vI(t):n===3?new Fn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?vp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?vp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=iee.exec(e))?new Fn(t[1],t[2],t[3],1):(t=aee.exec(e))?new Fn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=oee.exec(e))?vp(t[1],t[2],t[3],t[4]):(t=lee.exec(e))?vp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cee.exec(e))?jI(t[1],t[2]/100,t[3]/100,1):(t=uee.exec(e))?jI(t[1],t[2]/100,t[3]/100,t[4]):gI.hasOwnProperty(e)?vI(gI[e]):e==="transparent"?new Fn(NaN,NaN,NaN,0):null}function vI(e){return new Fn(e>>16&255,e>>8&255,e&255,1)}function vp(e,t,n,s){return s<=0&&(e=t=n=NaN),new Fn(e,t,n,s)}function hee(e){return e instanceof uf||(e=No(e)),e?(e=e.rgb(),new Fn(e.r,e.g,e.b,e.opacity)):new Fn}function zN(e,t,n,s){return arguments.length===1?hee(e):new Fn(e,t,n,s??1)}function Fn(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Tk(Fn,zN,U6(uf,{brighter(e){return e=e==null?Cm:Math.pow(Cm,e),new Fn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Id:Math.pow(Id,e),new Fn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Fn(yo(this.r),yo(this.g),yo(this.b),Em(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:bI,formatHex:bI,formatHex8:pee,formatRgb:wI,toString:wI}));function bI(){return`#${no(this.r)}${no(this.g)}${no(this.b)}`}function pee(){return`#${no(this.r)}${no(this.g)}${no(this.b)}${no((isNaN(this.opacity)?1:this.opacity)*255)}`}function wI(){const e=Em(this.opacity);return`${e===1?"rgb(":"rgba("}${yo(this.r)}, ${yo(this.g)}, ${yo(this.b)}${e===1?")":`, ${e})`}`}function Em(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function no(e){return e=yo(e),(e<16?"0":"")+e.toString(16)}function jI(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $s(e,t,n,s)}function V6(e){if(e instanceof $s)return new $s(e.h,e.s,e.l,e.opacity);if(e instanceof uf||(e=No(e)),!e)return new $s;if(e instanceof $s)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,r=Math.min(t,n,s),a=Math.max(t,n,s),l=NaN,u=a-r,d=(a+r)/2;return u?(t===a?l=(n-s)/u+(n<s)*6:n===a?l=(s-t)/u+2:l=(t-n)/u+4,u/=d<.5?a+r:2-a-r,l*=60):u=d>0&&d<1?0:l,new $s(l,u,d,e.opacity)}function mee(e,t,n,s){return arguments.length===1?V6(e):new $s(e,t,n,s??1)}function $s(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Tk($s,mee,U6(uf,{brighter(e){return e=e==null?Cm:Math.pow(Cm,e),new $s(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Id:Math.pow(Id,e),new $s(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,r=2*n-s;return new Fn(ev(e>=240?e-240:e+120,r,s),ev(e,r,s),ev(e<120?e+240:e-120,r,s),this.opacity)},clamp(){return new $s(SI(this.h),bp(this.s),bp(this.l),Em(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Em(this.opacity);return`${e===1?"hsl(":"hsla("}${SI(this.h)}, ${bp(this.s)*100}%, ${bp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function SI(e){return e=(e||0)%360,e<0?e+360:e}function bp(e){return Math.max(0,Math.min(1,e||0))}function ev(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ik=e=>()=>e;function gee(e,t){return function(n){return e+n*t}}function xee(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function yee(e){return(e=+e)==1?G6:function(t,n){return n-t?xee(t,n,e):Ik(isNaN(t)?n:t)}}function G6(e,t){var n=t-e;return n?gee(e,n):Ik(isNaN(e)?t:e)}const Rm=(function e(t){var n=yee(t);function s(r,a){var l=n((r=zN(r)).r,(a=zN(a)).r),u=n(r.g,a.g),d=n(r.b,a.b),f=G6(r.opacity,a.opacity);return function(p){return r.r=l(p),r.g=u(p),r.b=d(p),r.opacity=f(p),r+""}}return s.gamma=e,s})(1);function vee(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),r;return function(a){for(r=0;r<n;++r)s[r]=e[r]*(1-a)+t[r]*a;return s}}function bee(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wee(e,t){var n=t?t.length:0,s=e?Math.min(n,e.length):0,r=new Array(s),a=new Array(n),l;for(l=0;l<s;++l)r[l]=hd(e[l],t[l]);for(;l<n;++l)a[l]=t[l];return function(u){for(l=0;l<s;++l)a[l]=r[l](u);return a}}function jee(e,t){var n=new Date;return e=+e,t=+t,function(s){return n.setTime(e*(1-s)+t*s),n}}function sr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function See(e,t){var n={},s={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=hd(e[r],t[r]):s[r]=t[r];return function(a){for(r in n)s[r]=n[r](a);return s}}var BN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tv=new RegExp(BN.source,"g");function Nee(e){return function(){return e}}function kee(e){return function(t){return e(t)+""}}function K6(e,t){var n=BN.lastIndex=tv.lastIndex=0,s,r,a,l=-1,u=[],d=[];for(e=e+"",t=t+"";(s=BN.exec(e))&&(r=tv.exec(t));)(a=r.index)>n&&(a=t.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(s=s[0])===(r=r[0])?u[l]?u[l]+=r:u[++l]=r:(u[++l]=null,d.push({i:l,x:sr(s,r)})),n=tv.lastIndex;return n<t.length&&(a=t.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?d[0]?kee(d[0].x):Nee(t):(t=d.length,function(f){for(var p=0,m;p<t;++p)u[(m=d[p]).i]=m.x(f);return u.join("")})}function hd(e,t){var n=typeof t,s;return t==null||n==="boolean"?Ik(t):(n==="number"?sr:n==="string"?(s=No(t))?(t=s,Rm):K6:t instanceof No?Rm:t instanceof Date?jee:bee(t)?vee:Array.isArray(t)?wee:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?See:sr)(e,t)}var NI=180/Math.PI,FN={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function W6(e,t,n,s,r,a){var l,u,d;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(d=e*n+t*s)&&(n-=e*d,s-=t*d),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,d/=u),e*s<t*n&&(e=-e,t=-t,d=-d,l=-l),{translateX:r,translateY:a,rotate:Math.atan2(t,e)*NI,skewX:Math.atan(d)*NI,scaleX:l,scaleY:u}}var wp;function _ee(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?FN:W6(t.a,t.b,t.c,t.d,t.e,t.f)}function Cee(e){return e==null||(wp||(wp=document.createElementNS("http://www.w3.org/2000/svg","g")),wp.setAttribute("transform",e),!(e=wp.transform.baseVal.consolidate()))?FN:(e=e.matrix,W6(e.a,e.b,e.c,e.d,e.e,e.f))}function Y6(e,t,n,s){function r(f){return f.length?f.pop()+" ":""}function a(f,p,m,x,y,v){if(f!==m||p!==x){var b=y.push("translate(",null,t,null,n);v.push({i:b-4,x:sr(f,m)},{i:b-2,x:sr(p,x)})}else(m||x)&&y.push("translate("+m+t+x+n)}function l(f,p,m,x){f!==p?(f-p>180?p+=360:p-f>180&&(f+=360),x.push({i:m.push(r(m)+"rotate(",null,s)-2,x:sr(f,p)})):p&&m.push(r(m)+"rotate("+p+s)}function u(f,p,m,x){f!==p?x.push({i:m.push(r(m)+"skewX(",null,s)-2,x:sr(f,p)}):p&&m.push(r(m)+"skewX("+p+s)}function d(f,p,m,x,y,v){if(f!==m||p!==x){var b=y.push(r(y)+"scale(",null,",",null,")");v.push({i:b-4,x:sr(f,m)},{i:b-2,x:sr(p,x)})}else(m!==1||x!==1)&&y.push(r(y)+"scale("+m+","+x+")")}return function(f,p){var m=[],x=[];return f=e(f),p=e(p),a(f.translateX,f.translateY,p.translateX,p.translateY,m,x),l(f.rotate,p.rotate,m,x),u(f.skewX,p.skewX,m,x),d(f.scaleX,f.scaleY,p.scaleX,p.scaleY,m,x),f=p=null,function(y){for(var v=-1,b=x.length,w;++v<b;)m[(w=x[v]).i]=w.x(y);return m.join("")}}}var Eee=Y6(_ee,"px, ","px)","deg)"),Ree=Y6(Cee,", ",")",")"),Aee=1e-12;function kI(e){return((e=Math.exp(e))+1/e)/2}function Tee(e){return((e=Math.exp(e))-1/e)/2}function Iee(e){return((e=Math.exp(2*e))-1)/(e+1)}const nm=(function e(t,n,s){function r(a,l){var u=a[0],d=a[1],f=a[2],p=l[0],m=l[1],x=l[2],y=p-u,v=m-d,b=y*y+v*v,w,S;if(b<Aee)S=Math.log(x/f)/t,w=function(A){return[u+A*y,d+A*v,f*Math.exp(t*A*S)]};else{var E=Math.sqrt(b),k=(x*x-f*f+s*b)/(2*f*n*E),_=(x*x-f*f-s*b)/(2*x*n*E),R=Math.log(Math.sqrt(k*k+1)-k),T=Math.log(Math.sqrt(_*_+1)-_);S=(T-R)/t,w=function(A){var M=A*S,L=kI(R),P=f/(n*E)*(L*Iee(t*M+R)-Tee(R));return[u+P*y,d+P*v,f*L/kI(t*M+R)]}}return w.duration=S*1e3*t/Math.SQRT2,w}return r.rho=function(a){var l=Math.max(.001,+a),u=l*l,d=u*u;return e(l,u,d)},r})(Math.SQRT2,2,4);var wc=0,rd=0,Ku=0,Q6=1e3,Am,id,Tm=0,ko=0,Cg=0,Od=typeof performance=="object"&&performance.now?performance:Date,X6=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Mk(){return ko||(X6(Mee),ko=Od.now()+Cg)}function Mee(){ko=0}function Im(){this._call=this._time=this._next=null}Im.prototype=Z6.prototype={constructor:Im,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Mk():+n)+(t==null?0:+t),!this._next&&id!==this&&(id?id._next=this:Am=this,id=this),this._call=e,this._time=n,HN()},stop:function(){this._call&&(this._call=null,this._time=1/0,HN())}};function Z6(e,t,n){var s=new Im;return s.restart(e,t,n),s}function Oee(){Mk(),++wc;for(var e=Am,t;e;)(t=ko-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wc}function _I(){ko=(Tm=Od.now())+Cg,wc=rd=0;try{Oee()}finally{wc=0,Pee(),ko=0}}function Lee(){var e=Od.now(),t=e-Tm;t>Q6&&(Cg-=t,Tm=e)}function Pee(){for(var e,t=Am,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Am=n);id=e,HN(s)}function HN(e){if(!wc){rd&&(rd=clearTimeout(rd));var t=e-ko;t>24?(e<1/0&&(rd=setTimeout(_I,e-Od.now()-Cg)),Ku&&(Ku=clearInterval(Ku))):(Ku||(Tm=Od.now(),Ku=setInterval(Lee,Q6)),wc=1,X6(_I))}}function CI(e,t,n){var s=new Im;return t=t==null?0:+t,s.restart(r=>{s.stop(),e(r+t)},t,n),s}var $ee=kg("start","end","cancel","interrupt"),Dee=[],J6=0,EI=1,UN=2,sm=3,RI=4,VN=5,rm=6;function Eg(e,t,n,s,r,a){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;qee(e,n,{name:t,index:s,group:r,on:$ee,tween:Dee,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:J6})}function Ok(e,t){var n=Us(e,t);if(n.state>J6)throw new Error("too late; already scheduled");return n}function fr(e,t){var n=Us(e,t);if(n.state>sm)throw new Error("too late; already running");return n}function Us(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function qee(e,t,n){var s=e.__transition,r;s[t]=n,n.timer=Z6(a,0,n.time);function a(f){n.state=EI,n.timer.restart(l,n.delay,n.time),n.delay<=f&&l(f-n.delay)}function l(f){var p,m,x,y;if(n.state!==EI)return d();for(p in s)if(y=s[p],y.name===n.name){if(y.state===sm)return CI(l);y.state===RI?(y.state=rm,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete s[p]):+p<t&&(y.state=rm,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete s[p])}if(CI(function(){n.state===sm&&(n.state=RI,n.timer.restart(u,n.delay,n.time),u(f))}),n.state=UN,n.on.call("start",e,e.__data__,n.index,n.group),n.state===UN){for(n.state=sm,r=new Array(x=n.tween.length),p=0,m=-1;p<x;++p)(y=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(r[++m]=y);r.length=m+1}}function u(f){for(var p=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(d),n.state=VN,1),m=-1,x=r.length;++m<x;)r[m].call(e,p);n.state===VN&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=rm,n.timer.stop(),delete s[t];for(var f in s)return;delete e.__transition}}function im(e,t){var n=e.__transition,s,r,a=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((s=n[l]).name!==t){a=!1;continue}r=s.state>UN&&s.state<VN,s.state=rm,s.timer.stop(),s.on.call(r?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[l]}a&&delete e.__transition}}function zee(e){return this.each(function(){im(this,e)})}function Bee(e,t){var n,s;return function(){var r=fr(this,e),a=r.tween;if(a!==n){s=n=a;for(var l=0,u=s.length;l<u;++l)if(s[l].name===t){s=s.slice(),s.splice(l,1);break}}r.tween=s}}function Fee(e,t,n){var s,r;if(typeof n!="function")throw new Error;return function(){var a=fr(this,e),l=a.tween;if(l!==s){r=(s=l).slice();for(var u={name:t,value:n},d=0,f=r.length;d<f;++d)if(r[d].name===t){r[d]=u;break}d===f&&r.push(u)}a.tween=r}}function Hee(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=Us(this.node(),n).tween,r=0,a=s.length,l;r<a;++r)if((l=s[r]).name===e)return l.value;return null}return this.each((t==null?Bee:Fee)(n,e,t))}function Lk(e,t,n){var s=e._id;return e.each(function(){var r=fr(this,s);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Us(r,s).value[t]}}function e8(e,t){var n;return(typeof t=="number"?sr:t instanceof No?Rm:(n=No(t))?(t=n,Rm):K6)(e,t)}function Uee(e){return function(){this.removeAttribute(e)}}function Vee(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Gee(e,t,n){var s,r=n+"",a;return function(){var l=this.getAttribute(e);return l===r?null:l===s?a:a=t(s=l,n)}}function Kee(e,t,n){var s,r=n+"",a;return function(){var l=this.getAttributeNS(e.space,e.local);return l===r?null:l===s?a:a=t(s=l,n)}}function Wee(e,t,n){var s,r,a;return function(){var l,u=n(this),d;return u==null?void this.removeAttribute(e):(l=this.getAttribute(e),d=u+"",l===d?null:l===s&&d===r?a:(r=d,a=t(s=l,u)))}}function Yee(e,t,n){var s,r,a;return function(){var l,u=n(this),d;return u==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),d=u+"",l===d?null:l===s&&d===r?a:(r=d,a=t(s=l,u)))}}function Qee(e,t){var n=_g(e),s=n==="transform"?Ree:e8;return this.attrTween(e,typeof t=="function"?(n.local?Yee:Wee)(n,s,Lk(this,"attr."+e,t)):t==null?(n.local?Vee:Uee)(n):(n.local?Kee:Gee)(n,s,t))}function Xee(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Zee(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Jee(e,t){var n,s;function r(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&Zee(e,a)),n}return r._value=t,r}function ete(e,t){var n,s;function r(){var a=t.apply(this,arguments);return a!==s&&(n=(s=a)&&Xee(e,a)),n}return r._value=t,r}function tte(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=_g(e);return this.tween(n,(s.local?Jee:ete)(s,t))}function nte(e,t){return function(){Ok(this,e).delay=+t.apply(this,arguments)}}function ste(e,t){return t=+t,function(){Ok(this,e).delay=t}}function rte(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nte:ste)(t,e)):Us(this.node(),t).delay}function ite(e,t){return function(){fr(this,e).duration=+t.apply(this,arguments)}}function ate(e,t){return t=+t,function(){fr(this,e).duration=t}}function ote(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ite:ate)(t,e)):Us(this.node(),t).duration}function lte(e,t){if(typeof t!="function")throw new Error;return function(){fr(this,e).ease=t}}function cte(e){var t=this._id;return arguments.length?this.each(lte(t,e)):Us(this.node(),t).ease}function ute(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fr(this,e).ease=n}}function dte(e){if(typeof e!="function")throw new Error;return this.each(ute(this._id,e))}function fte(e){typeof e!="function"&&(e=T6(e));for(var t=this._groups,n=t.length,s=new Array(n),r=0;r<n;++r)for(var a=t[r],l=a.length,u=s[r]=[],d,f=0;f<l;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&u.push(d);return new ei(s,this._parents,this._name,this._id)}function hte(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,r=n.length,a=Math.min(s,r),l=new Array(s),u=0;u<a;++u)for(var d=t[u],f=n[u],p=d.length,m=l[u]=new Array(p),x,y=0;y<p;++y)(x=d[y]||f[y])&&(m[y]=x);for(;u<s;++u)l[u]=t[u];return new ei(l,this._parents,this._name,this._id)}function pte(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function mte(e,t,n){var s,r,a=pte(t)?Ok:fr;return function(){var l=a(this,e),u=l.on;u!==s&&(r=(s=u).copy()).on(t,n),l.on=r}}function gte(e,t){var n=this._id;return arguments.length<2?Us(this.node(),n).on.on(e):this.each(mte(n,e,t))}function xte(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function yte(){return this.on("end.remove",xte(this._id))}function vte(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Rk(e));for(var s=this._groups,r=s.length,a=new Array(r),l=0;l<r;++l)for(var u=s[l],d=u.length,f=a[l]=new Array(d),p,m,x=0;x<d;++x)(p=u[x])&&(m=e.call(p,p.__data__,x,u))&&("__data__"in p&&(m.__data__=p.__data__),f[x]=m,Eg(f[x],t,n,x,f,Us(p,n)));return new ei(a,this._parents,t,n)}function bte(e){var t=this._name,n=this._id;typeof e!="function"&&(e=A6(e));for(var s=this._groups,r=s.length,a=[],l=[],u=0;u<r;++u)for(var d=s[u],f=d.length,p,m=0;m<f;++m)if(p=d[m]){for(var x=e.call(p,p.__data__,m,d),y,v=Us(p,n),b=0,w=x.length;b<w;++b)(y=x[b])&&Eg(y,t,n,b,x,v);a.push(x),l.push(p)}return new ei(a,l,t,n)}var wte=cf.prototype.constructor;function jte(){return new wte(this._groups,this._parents)}function Ste(e,t){var n,s,r;return function(){var a=bc(this,e),l=(this.style.removeProperty(e),bc(this,e));return a===l?null:a===n&&l===s?r:r=t(n=a,s=l)}}function t8(e){return function(){this.style.removeProperty(e)}}function Nte(e,t,n){var s,r=n+"",a;return function(){var l=bc(this,e);return l===r?null:l===s?a:a=t(s=l,n)}}function kte(e,t,n){var s,r,a;return function(){var l=bc(this,e),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(e),bc(this,e))),l===d?null:l===s&&d===r?a:(r=d,a=t(s=l,u))}}function _te(e,t){var n,s,r,a="style."+t,l="end."+a,u;return function(){var d=fr(this,e),f=d.on,p=d.value[a]==null?u||(u=t8(t)):void 0;(f!==n||r!==p)&&(s=(n=f).copy()).on(l,r=p),d.on=s}}function Cte(e,t,n){var s=(e+="")=="transform"?Eee:e8;return t==null?this.styleTween(e,Ste(e,s)).on("end.style."+e,t8(e)):typeof t=="function"?this.styleTween(e,kte(e,s,Lk(this,"style."+e,t))).each(_te(this._id,e)):this.styleTween(e,Nte(e,s,t),n).on("end.style."+e,null)}function Ete(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function Rte(e,t,n){var s,r;function a(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&Ete(e,l,n)),s}return a._value=t,a}function Ate(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,Rte(e,t,n??""))}function Tte(e){return function(){this.textContent=e}}function Ite(e){return function(){var t=e(this);this.textContent=t??""}}function Mte(e){return this.tween("text",typeof e=="function"?Ite(Lk(this,"text",e)):Tte(e==null?"":e+""))}function Ote(e){return function(t){this.textContent=e.call(this,t)}}function Lte(e){var t,n;function s(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Ote(r)),t}return s._value=e,s}function Pte(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Lte(e))}function $te(){for(var e=this._name,t=this._id,n=n8(),s=this._groups,r=s.length,a=0;a<r;++a)for(var l=s[a],u=l.length,d,f=0;f<u;++f)if(d=l[f]){var p=Us(d,t);Eg(d,e,n,f,l,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new ei(s,this._parents,e,n)}function Dte(){var e,t,n=this,s=n._id,r=n.size();return new Promise(function(a,l){var u={value:l},d={value:function(){--r===0&&a()}};n.each(function(){var f=fr(this,s),p=f.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(d)),f.on=t}),r===0&&a()})}var qte=0;function ei(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function n8(){return++qte}var $r=cf.prototype;ei.prototype={constructor:ei,select:vte,selectAll:bte,selectChild:$r.selectChild,selectChildren:$r.selectChildren,filter:fte,merge:hte,selection:jte,transition:$te,call:$r.call,nodes:$r.nodes,node:$r.node,size:$r.size,empty:$r.empty,each:$r.each,on:gte,attr:Qee,attrTween:tte,style:Cte,styleTween:Ate,text:Mte,textTween:Pte,remove:yte,tween:Hee,delay:rte,duration:ote,ease:cte,easeVarying:dte,end:Dte,[Symbol.iterator]:$r[Symbol.iterator]};function zte(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bte={time:null,delay:0,duration:250,ease:zte};function Fte(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Hte(e){var t,n;e instanceof ei?(t=e._id,e=e._name):(t=n8(),(n=Bte).time=Mk(),e=e==null?null:e+"");for(var s=this._groups,r=s.length,a=0;a<r;++a)for(var l=s[a],u=l.length,d,f=0;f<u;++f)(d=l[f])&&Eg(d,e,t,f,l,n||Fte(d,t));return new ei(s,this._parents,e,t)}cf.prototype.interrupt=zee;cf.prototype.transition=Hte;const jp=e=>()=>e;function Ute(e,{sourceEvent:t,target:n,transform:s,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:r}})}function Kr(e,t,n){this.k=e,this.x=t,this.y=n}Kr.prototype={constructor:Kr,scale:function(e){return e===1?this:new Kr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Kr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Rg=new Kr(1,0,0);s8.prototype=Kr.prototype;function s8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rg;return e.__zoom}function nv(e){e.stopImmediatePropagation()}function Wu(e){e.preventDefault(),e.stopImmediatePropagation()}function Vte(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Gte(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function AI(){return this.__zoom||Rg}function Kte(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Wte(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yte(e,t,n){var s=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(r>s?(s+r)/2:Math.min(0,s)||Math.max(0,r),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function r8(){var e=Vte,t=Gte,n=Yte,s=Kte,r=Wte,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,d=nm,f=kg("start","zoom","end"),p,m,x,y=500,v=150,b=0,w=10;function S(z){z.property("__zoom",AI).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",P).filter(r).on("touchstart.zoom",O).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(z,W,$,F){var G=z.selection?z.selection():z;G.property("__zoom",AI),z!==G?R(z,W,$,F):G.interrupt().each(function(){T(this,arguments).event(F).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},S.scaleBy=function(z,W,$,F){S.scaleTo(z,function(){var G=this.__zoom.k,X=typeof W=="function"?W.apply(this,arguments):W;return G*X},$,F)},S.scaleTo=function(z,W,$,F){S.transform(z,function(){var G=t.apply(this,arguments),X=this.__zoom,Z=$==null?_(G):typeof $=="function"?$.apply(this,arguments):$,D=X.invert(Z),V=typeof W=="function"?W.apply(this,arguments):W;return n(k(E(X,V),Z,D),G,l)},$,F)},S.translateBy=function(z,W,$,F){S.transform(z,function(){return n(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),l)},null,F)},S.translateTo=function(z,W,$,F,G){S.transform(z,function(){var X=t.apply(this,arguments),Z=this.__zoom,D=F==null?_(X):typeof F=="function"?F.apply(this,arguments):F;return n(Rg.translate(D[0],D[1]).scale(Z.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof $=="function"?-$.apply(this,arguments):-$),X,l)},F,G)};function E(z,W){return W=Math.max(a[0],Math.min(a[1],W)),W===z.k?z:new Kr(W,z.x,z.y)}function k(z,W,$){var F=W[0]-$[0]*z.k,G=W[1]-$[1]*z.k;return F===z.x&&G===z.y?z:new Kr(z.k,F,G)}function _(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function R(z,W,$,F){z.on("start.zoom",function(){T(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(F).end()}).tween("zoom",function(){var G=this,X=arguments,Z=T(G,X).event(F),D=t.apply(G,X),V=$==null?_(D):typeof $=="function"?$.apply(G,X):$,ne=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),U=G.__zoom,Q=typeof W=="function"?W.apply(G,X):W,K=d(U.invert(V).concat(ne/U.k),Q.invert(V).concat(ne/Q.k));return function(te){if(te===1)te=Q;else{var re=K(te),oe=ne/re[2];te=new Kr(oe,V[0]-re[0]*oe,V[1]-re[1]*oe)}Z.zoom(null,te)}})}function T(z,W,$){return!$&&z.__zooming||new A(z,W)}function A(z,W){this.that=z,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,W),this.taps=0}A.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,W){return this.mouse&&z!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var W=rs(this.that).datum();f.call(z,this.that,new Ute(z,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:f}),W)}};function M(z,...W){if(!e.apply(this,arguments))return;var $=T(this,W).event(z),F=this.__zoom,G=Math.max(a[0],Math.min(a[1],F.k*Math.pow(2,s.apply(this,arguments)))),X=Ls(z);if($.wheel)($.mouse[0][0]!==X[0]||$.mouse[0][1]!==X[1])&&($.mouse[1]=F.invert($.mouse[0]=X)),clearTimeout($.wheel);else{if(F.k===G)return;$.mouse=[X,F.invert(X)],im(this),$.start()}Wu(z),$.wheel=setTimeout(Z,v),$.zoom("mouse",n(k(E(F,G),$.mouse[0],$.mouse[1]),$.extent,l));function Z(){$.wheel=null,$.end()}}function L(z,...W){if(x||!e.apply(this,arguments))return;var $=z.currentTarget,F=T(this,W,!0).event(z),G=rs(z.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",ne,!0),X=Ls(z,$),Z=z.clientX,D=z.clientY;B6(z.view),nv(z),F.mouse=[X,this.__zoom.invert(X)],im(this),F.start();function V(U){if(Wu(U),!F.moved){var Q=U.clientX-Z,K=U.clientY-D;F.moved=Q*Q+K*K>b}F.event(U).zoom("mouse",n(k(F.that.__zoom,F.mouse[0]=Ls(U,$),F.mouse[1]),F.extent,l))}function ne(U){G.on("mousemove.zoom mouseup.zoom",null),F6(U.view,F.moved),Wu(U),F.event(U).end()}}function P(z,...W){if(e.apply(this,arguments)){var $=this.__zoom,F=Ls(z.changedTouches?z.changedTouches[0]:z,this),G=$.invert(F),X=$.k*(z.shiftKey?.5:2),Z=n(k(E($,X),F,G),t.apply(this,W),l);Wu(z),u>0?rs(this).transition().duration(u).call(R,Z,F,z):rs(this).call(S.transform,Z,F,z)}}function O(z,...W){if(e.apply(this,arguments)){var $=z.touches,F=$.length,G=T(this,W,z.changedTouches.length===F).event(z),X,Z,D,V;for(nv(z),Z=0;Z<F;++Z)D=$[Z],V=Ls(D,this),V=[V,this.__zoom.invert(V),D.identifier],G.touch0?!G.touch1&&G.touch0[2]!==V[2]&&(G.touch1=V,G.taps=0):(G.touch0=V,X=!0,G.taps=1+!!p);p&&(p=clearTimeout(p)),X&&(G.taps<2&&(m=V[0],p=setTimeout(function(){p=null},y)),im(this),G.start())}}function B(z,...W){if(this.__zooming){var $=T(this,W).event(z),F=z.changedTouches,G=F.length,X,Z,D,V;for(Wu(z),X=0;X<G;++X)Z=F[X],D=Ls(Z,this),$.touch0&&$.touch0[2]===Z.identifier?$.touch0[0]=D:$.touch1&&$.touch1[2]===Z.identifier&&($.touch1[0]=D);if(Z=$.that.__zoom,$.touch1){var ne=$.touch0[0],U=$.touch0[1],Q=$.touch1[0],K=$.touch1[1],te=(te=Q[0]-ne[0])*te+(te=Q[1]-ne[1])*te,re=(re=K[0]-U[0])*re+(re=K[1]-U[1])*re;Z=E(Z,Math.sqrt(te/re)),D=[(ne[0]+Q[0])/2,(ne[1]+Q[1])/2],V=[(U[0]+K[0])/2,(U[1]+K[1])/2]}else if($.touch0)D=$.touch0[0],V=$.touch0[1];else return;$.zoom("touch",n(k(Z,D,V),$.extent,l))}}function H(z,...W){if(this.__zooming){var $=T(this,W).event(z),F=z.changedTouches,G=F.length,X,Z;for(nv(z),x&&clearTimeout(x),x=setTimeout(function(){x=null},y),X=0;X<G;++X)Z=F[X],$.touch0&&$.touch0[2]===Z.identifier?delete $.touch0:$.touch1&&$.touch1[2]===Z.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(Z=Ls(Z,this),Math.hypot(m[0]-Z[0],m[1]-Z[1])<w)){var D=rs(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return S.wheelDelta=function(z){return arguments.length?(s=typeof z=="function"?z:jp(+z),S):s},S.filter=function(z){return arguments.length?(e=typeof z=="function"?z:jp(!!z),S):e},S.touchable=function(z){return arguments.length?(r=typeof z=="function"?z:jp(!!z),S):r},S.extent=function(z){return arguments.length?(t=typeof z=="function"?z:jp([[+z[0][0],+z[0][1]],[+z[1][0],+z[1][1]]]),S):t},S.scaleExtent=function(z){return arguments.length?(a[0]=+z[0],a[1]=+z[1],S):[a[0],a[1]]},S.translateExtent=function(z){return arguments.length?(l[0][0]=+z[0][0],l[1][0]=+z[1][0],l[0][1]=+z[0][1],l[1][1]=+z[1][1],S):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},S.constrain=function(z){return arguments.length?(n=z,S):n},S.duration=function(z){return arguments.length?(u=+z,S):u},S.interpolate=function(z){return arguments.length?(d=z,S):d},S.on=function(){var z=f.on.apply(f,arguments);return z===f?S:z},S.clickDistance=function(z){return arguments.length?(b=(z=+z)*z,S):Math.sqrt(b)},S.tapDistance=function(z){return arguments.length?(w=+z,S):w},S}const ur={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Ld=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],i8=["Enter"," ","Escape"],a8={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var jc;(function(e){e.Strict="strict",e.Loose="loose"})(jc||(jc={}));var vo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(vo||(vo={}));var Pd;(function(e){e.Partial="partial",e.Full="full"})(Pd||(Pd={}));const o8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Vi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Vi||(Vi={}));var Sc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Sc||(Sc={}));var ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ye||(ye={}));const TI={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};function l8(e){return e===null?null:e?"valid":"invalid"}const c8=e=>"id"in e&&"source"in e&&"target"in e,Qte=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),df=(e,t=[0,0])=>{const{width:n,height:s}=ti(e),r=e.origin??t,a=n*r[0],l=s*r[1];return{x:e.position.x-a,y:e.position.y-l}},Xte=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,r)=>{const a=typeof r=="string";let l=!t.nodeLookup&&!a?r:void 0;t.nodeLookup&&(l=a?t.nodeLookup.get(r):Pk(r)?r:t.nodeLookup.get(r.id));const u=l?Mm(l,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ag(s,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Tg(n)},ff=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Ag(n,Mm(r)),s=!0)}),s?Tg(n):{x:0,y:0,width:0,height:0}},$k=(e,t,[n,s,r]=[0,0,1],a=!1,l=!1)=>{const u={...pf(t,[n,s,r]),width:t.width/r,height:t.height/r},d=[];for(const f of e.values()){const{measured:p,selectable:m=!0,hidden:x=!1}=f;if(l&&!m||x)continue;const y=p.width??f.width??f.initialWidth??null,v=p.height??f.height??f.initialHeight??null,b=$d(u,kc(f)),w=(y??0)*(v??0),S=a&&b>0;(!f.internals.handleBounds||S||b>=w||f.dragging)&&d.push(f)}return d},Zte=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function Jte(e,t){const n=new Map,s=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!s||s.has(r.id))&&n.set(r.id,r)}),n}async function ene({nodes:e,width:t,height:n,panZoom:s,minZoom:r,maxZoom:a},l){if(e.size===0)return Promise.resolve(!0);const u=Jte(e,l),d=ff(u),f=Dk(d,t,n,(l==null?void 0:l.minZoom)??r,(l==null?void 0:l.maxZoom)??a,(l==null?void 0:l.padding)??.1);return await s.setViewport(f,{duration:l==null?void 0:l.duration,ease:l==null?void 0:l.ease,interpolate:l==null?void 0:l.interpolate}),Promise.resolve(!0)}function u8({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:r,onError:a}){const l=n.get(e),u=l.parentId?n.get(l.parentId):void 0,{x:d,y:f}=u?u.internals.positionAbsolute:{x:0,y:0},p=l.origin??s;let m=l.extent||r;if(l.extent==="parent"&&!l.expandParent)if(!u)a==null||a("005",ur.error005());else{const y=u.measured.width,v=u.measured.height;y&&v&&(m=[[d,f],[d+y,f+v]])}else u&&_c(l.extent)&&(m=[[l.extent[0][0]+d,l.extent[0][1]+f],[l.extent[1][0]+d,l.extent[1][1]+f]]);const x=_c(m)?_o(t,m,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&(a==null||a("015",ur.error015())),{position:{x:x.x-d+(l.measured.width??0)*p[0],y:x.y-f+(l.measured.height??0)*p[1]},positionAbsolute:x}}async function tne({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:r}){const a=new Set(e.map(x=>x.id)),l=[];for(const x of n){if(x.deletable===!1)continue;const y=a.has(x.id),v=!y&&x.parentId&&l.find(b=>b.id===x.parentId);(y||v)&&l.push(x)}const u=new Set(t.map(x=>x.id)),d=s.filter(x=>x.deletable!==!1),p=Zte(l,d);for(const x of d)u.has(x.id)&&!p.find(v=>v.id===x.id)&&p.push(x);if(!r)return{edges:p,nodes:l};const m=await r({nodes:l,edges:p});return typeof m=="boolean"?m?{edges:p,nodes:l}:{edges:[],nodes:[]}:m}const Nc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),_o=(e={x:0,y:0},t,n)=>({x:Nc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Nc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function d8(e,t,n){const{width:s,height:r}=ti(n),{x:a,y:l}=n.internals.positionAbsolute;return _o(e,[[a,l],[a+s,l+r]],t)}const II=(e,t,n)=>e<t?Nc(Math.abs(e-t),1,t)/t:e>n?-Nc(Math.abs(e-n),1,t)/t:0,f8=(e,t,n=15,s=40)=>{const r=II(e.x,s,t.width-s)*n,a=II(e.y,s,t.height-s)*n;return[r,a]},Ag=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),GN=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Tg=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),kc=(e,t=[0,0])=>{var r,a;const{x:n,y:s}=Pk(e)?e.internals.positionAbsolute:df(e,t);return{x:n,y:s,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Mm=(e,t=[0,0])=>{var r,a;const{x:n,y:s}=Pk(e)?e.internals.positionAbsolute:df(e,t);return{x:n,y:s,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:s+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},h8=(e,t)=>Tg(Ag(GN(e),GN(t))),$d=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},MI=e=>Ds(e.width)&&Ds(e.height)&&Ds(e.x)&&Ds(e.y),Ds=e=>!isNaN(e)&&isFinite(e),nne=(e,t)=>{},hf=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),pf=({x:e,y:t},[n,s,r],a=!1,l=[1,1])=>{const u={x:(e-n)/r,y:(t-s)/r};return a?hf(u,l):u},Om=({x:e,y:t},[n,s,r])=>({x:e*r+n,y:t*r+s});function Tl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function sne(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=Tl(e,n),r=Tl(e,t);return{top:s,right:r,bottom:s,left:r,x:r*2,y:s*2}}if(typeof e=="object"){const s=Tl(e.top??e.y??0,n),r=Tl(e.bottom??e.y??0,n),a=Tl(e.left??e.x??0,t),l=Tl(e.right??e.x??0,t);return{top:s,right:l,bottom:r,left:a,x:a+l,y:s+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function rne(e,t,n,s,r,a){const{x:l,y:u}=Om(e,[t,n,s]),{x:d,y:f}=Om({x:e.x+e.width,y:e.y+e.height},[t,n,s]),p=r-d,m=a-f;return{left:Math.floor(l),top:Math.floor(u),right:Math.floor(p),bottom:Math.floor(m)}}const Dk=(e,t,n,s,r,a)=>{const l=sne(a,t,n),u=(t-l.x)/e.width,d=(n-l.y)/e.height,f=Math.min(u,d),p=Nc(f,s,r),m=e.x+e.width/2,x=e.y+e.height/2,y=t/2-m*p,v=n/2-x*p,b=rne(e,y,v,p,t,n),w={left:Math.min(b.left-l.left,0),top:Math.min(b.top-l.top,0),right:Math.min(b.right-l.right,0),bottom:Math.min(b.bottom-l.bottom,0)};return{x:y-w.left+w.right,y:v-w.top+w.bottom,zoom:p}},Dd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function _c(e){return e!=null&&e!=="parent"}function ti(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function p8(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function m8(e,t={width:0,height:0},n,s,r){const a={...e},l=s.get(n);if(l){const u=l.origin||r;a.x+=l.internals.positionAbsolute.x-(t.width??0)*u[0],a.y+=l.internals.positionAbsolute.y-(t.height??0)*u[1]}return a}function OI(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ine(){let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}}function ane(e){return{...a8,...e||{}}}function pd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:r}){const{x:a,y:l}=qs(e),u=pf({x:a-((r==null?void 0:r.left)??0),y:l-((r==null?void 0:r.top)??0)},s),{x:d,y:f}=n?hf(u,t):u;return{xSnapped:d,ySnapped:f,...u}}const qk=e=>({width:e.offsetWidth,height:e.offsetHeight}),g8=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},one=["INPUT","SELECT","TEXTAREA"];function x8(e){var s,r;const t=((r=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:one.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const y8=e=>"clientX"in e,qs=(e,t)=>{var a,l;const n=y8(e),s=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,r=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},LI=(e,t,n,s,r)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:r,position:l.getAttribute("data-handlepos"),x:(u.left-n.left)/s,y:(u.top-n.top)/s,...qk(l)}})};function v8({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:r,sourceControlY:a,targetControlX:l,targetControlY:u}){const d=e*.125+r*.375+l*.375+n*.125,f=t*.125+a*.375+u*.375+s*.125,p=Math.abs(d-e),m=Math.abs(f-t);return[d,f,p,m]}function Sp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function PI({pos:e,x1:t,y1:n,x2:s,y2:r,c:a}){switch(e){case ye.Left:return[t-Sp(t-s,a),n];case ye.Right:return[t+Sp(s-t,a),n];case ye.Top:return[t,n-Sp(n-r,a)];case ye.Bottom:return[t,n+Sp(r-n,a)]}}function zk({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:s,targetY:r,targetPosition:a=ye.Top,curvature:l=.25}){const[u,d]=PI({pos:n,x1:e,y1:t,x2:s,y2:r,c:l}),[f,p]=PI({pos:a,x1:s,y1:r,x2:e,y2:t,c:l}),[m,x,y,v]=v8({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:u,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${u},${d} ${f},${p} ${s},${r}`,m,x,y,v]}function b8({sourceX:e,sourceY:t,targetX:n,targetY:s}){const r=Math.abs(n-e)/2,a=n<e?n+r:n-r,l=Math.abs(s-t)/2,u=s<t?s+l:s-l;return[a,u,r,l]}function lne({sourceNode:e,targetNode:t,selected:n=!1,zIndex:s=0,elevateOnSelect:r=!1,zIndexMode:a="basic"}){if(a==="manual")return s;const l=r&&n?s+1e3:s,u=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return l+u}function cne({sourceNode:e,targetNode:t,width:n,height:s,transform:r}){const a=Ag(Mm(e),Mm(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const l={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:s/r[2]};return $d(l,Tg(a))>0}const une=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,dne=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),fne=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||une;let r;return c8(e)?r={...e}:r={...e,id:s(e)},dne(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function w8({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[r,a,l,u]=b8({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,r,a,l,u]}const $I={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},hne=({source:e,sourcePosition:t=ye.Bottom,target:n})=>t===ye.Left||t===ye.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},DI=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function pne({source:e,sourcePosition:t=ye.Bottom,target:n,targetPosition:s=ye.Top,center:r,offset:a,stepPosition:l}){const u=$I[t],d=$I[s],f={x:e.x+u.x*a,y:e.y+u.y*a},p={x:n.x+d.x*a,y:n.y+d.y*a},m=hne({source:f,sourcePosition:t,target:p}),x=m.x!==0?"x":"y",y=m[x];let v=[],b,w;const S={x:0,y:0},E={x:0,y:0},[,,k,_]=b8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(u[x]*d[x]===-1){x==="x"?(b=r.x??f.x+(p.x-f.x)*l,w=r.y??(f.y+p.y)/2):(b=r.x??(f.x+p.x)/2,w=r.y??f.y+(p.y-f.y)*l);const T=[{x:b,y:f.y},{x:b,y:p.y}],A=[{x:f.x,y:w},{x:p.x,y:w}];u[x]===y?v=x==="x"?T:A:v=x==="x"?A:T}else{const T=[{x:f.x,y:p.y}],A=[{x:p.x,y:f.y}];if(x==="x"?v=u.x===y?A:T:v=u.y===y?T:A,t===s){const B=Math.abs(e[x]-n[x]);if(B<=a){const H=Math.min(a-1,a-B);u[x]===y?S[x]=(f[x]>e[x]?-1:1)*H:E[x]=(p[x]>n[x]?-1:1)*H}}if(t!==s){const B=x==="x"?"y":"x",H=u[x]===d[B],z=f[B]>p[B],W=f[B]<p[B];(u[x]===1&&(!H&&z||H&&W)||u[x]!==1&&(!H&&W||H&&z))&&(v=x==="x"?T:A)}const M={x:f.x+S.x,y:f.y+S.y},L={x:p.x+E.x,y:p.y+E.y},P=Math.max(Math.abs(M.x-v[0].x),Math.abs(L.x-v[0].x)),O=Math.max(Math.abs(M.y-v[0].y),Math.abs(L.y-v[0].y));P>=O?(b=(M.x+L.x)/2,w=v[0].y):(b=v[0].x,w=(M.y+L.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...v,{x:p.x+E.x,y:p.y+E.y},n],b,w,k,_]}function mne(e,t,n,s){const r=Math.min(DI(e,t)/2,DI(t,n)/2,s),{x:a,y:l}=t;if(e.x===a&&a===n.x||e.y===l&&l===n.y)return`L${a} ${l}`;if(e.y===l){const f=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${a+r*f},${l}Q ${a},${l} ${a},${l+r*p}`}const u=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${a},${l+r*d}Q ${a},${l} ${a+r*u},${l}`}function KN({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:s,targetY:r,targetPosition:a=ye.Top,borderRadius:l=5,centerX:u,centerY:d,offset:f=20,stepPosition:p=.5}){const[m,x,y,v,b]=pne({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:r},targetPosition:a,center:{x:u,y:d},offset:f,stepPosition:p});return[m.reduce((S,E,k)=>{let _="";return k>0&&k<m.length-1?_=mne(m[k-1],E,m[k+1],l):_=`${k===0?"M":"L"}${E.x} ${E.y}`,S+=_,S},""),x,y,v,b]}function qI(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function gne(e){var m;const{sourceNode:t,targetNode:n}=e;if(!qI(t)||!qI(n))return null;const s=t.internals.handleBounds||zI(t.handles),r=n.internals.handleBounds||zI(n.handles),a=BI((s==null?void 0:s.source)??[],e.sourceHandle),l=BI(e.connectionMode===jc.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),e.targetHandle);if(!a||!l)return(m=e.onError)==null||m.call(e,"008",ur.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const u=(a==null?void 0:a.position)||ye.Bottom,d=(l==null?void 0:l.position)||ye.Top,f=Co(t,a,u),p=Co(n,l,d);return{sourceX:f.x,sourceY:f.y,targetX:p.x,targetY:p.y,sourcePosition:u,targetPosition:d}}function zI(e){if(!e)return null;const t=[],n=[];for(const s of e)s.width=s.width??1,s.height=s.height??1,s.type==="source"?t.push(s):s.type==="target"&&n.push(s);return{source:t,target:n}}function Co(e,t,n=ye.Left,s=!1){const r=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,a=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:l,height:u}=t??ti(e);if(s)return{x:r+l/2,y:a+u/2};switch((t==null?void 0:t.position)??n){case ye.Top:return{x:r+l/2,y:a};case ye.Right:return{x:r+l,y:a+u/2};case ye.Bottom:return{x:r+l/2,y:a+u};case ye.Left:return{x:r,y:a+u/2}}}function BI(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function WN(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function xne(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:r}){const a=new Set;return e.reduce((l,u)=>([u.markerStart||s,u.markerEnd||r].forEach(d=>{if(d&&typeof d=="object"){const f=WN(d,t);a.has(f)||(l.push({id:f,color:d.color||n,...d}),a.add(f))}}),l),[]).sort((l,u)=>l.id.localeCompare(u.id))}const j8=1e3,yne=10,Bk={nodeOrigin:[0,0],nodeExtent:Ld,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},vne={...Bk,checkEquality:!0};function Fk(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function bne(e,t,n){const s=Fk(Bk,n);for(const r of e.values())if(r.parentId)Uk(r,e,t,s);else{const a=df(r,s.nodeOrigin),l=_c(r.extent)?r.extent:s.nodeExtent,u=_o(a,l,ti(r));r.internals.positionAbsolute=u}}function wne(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],s=[];for(const r of e.handles){const a={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(a):r.type==="target"&&s.push(a)}return{source:n,target:s}}function Hk(e){return e==="manual"}function YN(e,t,n,s={}){var f,p;const r=Fk(vne,s),a={i:0},l=new Map(t),u=r!=null&&r.elevateNodesOnSelect&&!Hk(r.zIndexMode)?j8:0;let d=e.length>0;t.clear(),n.clear();for(const m of e){let x=l.get(m.id);if(r.checkEquality&&m===(x==null?void 0:x.internals.userNode))t.set(m.id,x);else{const y=df(m,r.nodeOrigin),v=_c(m.extent)?m.extent:r.nodeExtent,b=_o(y,v,ti(m));x={...r.defaults,...m,measured:{width:(f=m.measured)==null?void 0:f.width,height:(p=m.measured)==null?void 0:p.height},internals:{positionAbsolute:b,handleBounds:wne(m,x),z:S8(m,u,r.zIndexMode),userNode:m}},t.set(m.id,x)}(x.measured===void 0||x.measured.width===void 0||x.measured.height===void 0)&&!x.hidden&&(d=!1),m.parentId&&Uk(x,t,n,s,a)}return d}function jne(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Uk(e,t,n,s,r){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u,zIndexMode:d}=Fk(Bk,s),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}jne(e,n),r&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++r.i,p.internals.z=p.internals.z+r.i*yne),r&&p.internals.rootParentIndex!==void 0&&(r.i=p.internals.rootParentIndex);const m=a&&!Hk(d)?j8:0,{x,y,z:v}=Sne(e,p,l,u,m,d),{positionAbsolute:b}=e.internals,w=x!==b.x||y!==b.y;(w||v!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x,y}:b,z:v}})}function S8(e,t,n){const s=Ds(e.zIndex)?e.zIndex:0;return Hk(n)?s:s+(e.selected?t:0)}function Sne(e,t,n,s,r,a){const{x:l,y:u}=t.internals.positionAbsolute,d=ti(e),f=df(e,n),p=_c(e.extent)?_o(f,e.extent,d):f;let m=_o({x:l+p.x,y:u+p.y},s,d);e.extent==="parent"&&(m=d8(m,d,t));const x=S8(e,r,a),y=t.internals.z??0;return{x:m.x,y:m.y,z:y>=x?y+1:x}}function Vk(e,t,n,s=[0,0]){var l;const r=[],a=new Map;for(const u of e){const d=t.get(u.parentId);if(!d)continue;const f=((l=a.get(u.parentId))==null?void 0:l.expandedRect)??kc(d),p=h8(f,u.rect);a.set(u.parentId,{expandedRect:p,parent:d})}return a.size>0&&a.forEach(({expandedRect:u,parent:d},f)=>{var k;const p=d.internals.positionAbsolute,m=ti(d),x=d.origin??s,y=u.x<p.x?Math.round(Math.abs(p.x-u.x)):0,v=u.y<p.y?Math.round(Math.abs(p.y-u.y)):0,b=Math.max(m.width,Math.round(u.width)),w=Math.max(m.height,Math.round(u.height)),S=(b-m.width)*x[0],E=(w-m.height)*x[1];(y>0||v>0||S||E)&&(r.push({id:f,type:"position",position:{x:d.position.x-y+S,y:d.position.y-v+E}}),(k=n.get(f))==null||k.forEach(_=>{e.some(R=>R.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+y,y:_.position.y+v}})})),(m.width<u.width||m.height<u.height||y||v)&&r.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:b+(y?x[0]*y-S:0),height:w+(v?x[1]*v-E:0)}})}),r}function Nne(e,t,n,s,r,a,l){const u=s==null?void 0:s.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const f=[],p=window.getComputedStyle(u),{m22:m}=new window.DOMMatrixReadOnly(p.transform),x=[];for(const y of e.values()){const v=t.get(y.id);if(!v)continue;if(v.hidden){t.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),d=!0;continue}const b=qk(y.nodeElement),w=v.measured.width!==b.width||v.measured.height!==b.height;if(!!(b.width&&b.height&&(w||!v.internals.handleBounds||y.force))){const E=y.nodeElement.getBoundingClientRect(),k=_c(v.extent)?v.extent:a;let{positionAbsolute:_}=v.internals;v.parentId&&v.extent==="parent"?_=d8(_,b,t.get(v.parentId)):k&&(_=_o(_,k,b));const R={...v,measured:b,internals:{...v.internals,positionAbsolute:_,handleBounds:{source:LI("source",y.nodeElement,E,m,v.id),target:LI("target",y.nodeElement,E,m,v.id)}}};t.set(v.id,R),v.parentId&&Uk(R,t,n,{nodeOrigin:r,zIndexMode:l}),d=!0,w&&(f.push({id:v.id,type:"dimensions",dimensions:b}),v.expandParent&&v.parentId&&x.push({id:v.id,parentId:v.parentId,rect:kc(R,r)}))}}if(x.length>0){const y=Vk(x,t,n,r);f.push(...y)}return{changes:f,updatedInternals:d}}async function kne({delta:e,panZoom:t,transform:n,translateExtent:s,width:r,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,a]],s),u=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(u)}function FI(e,t,n,s,r,a){let l=r;const u=s.get(l)||new Map;s.set(l,u.set(n,t)),l=`${r}-${e}`;const d=s.get(l)||new Map;if(s.set(l,d.set(n,t)),a){l=`${r}-${e}-${a}`;const f=s.get(l)||new Map;s.set(l,f.set(n,t))}}function N8(e,t,n){e.clear(),t.clear();for(const s of n){const{source:r,target:a,sourceHandle:l=null,targetHandle:u=null}=s,d={edgeId:s.id,source:r,target:a,sourceHandle:l,targetHandle:u},f=`${r}-${l}--${a}-${u}`,p=`${a}-${u}--${r}-${l}`;FI("source",d,p,e,r,l),FI("target",d,f,e,a,u),t.set(s.id,s)}}function k8(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:k8(n,t):!1}function HI(e,t,n){var r;let s=e;do{if((r=s==null?void 0:s.matches)!=null&&r.call(s,t))return!0;if(s===n)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function _ne(e,t,n,s){const r=new Map;for(const[a,l]of e)if((l.selected||l.id===s)&&(!l.parentId||!k8(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const u=e.get(a);u&&r.set(a,{id:a,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return r}function sv({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){var l,u,d;const r=[];for(const[f,p]of t){const m=(l=n.get(f))==null?void 0:l.internals.userNode;m&&r.push({...m,position:p.position,dragging:s})}if(!e)return[r[0],r];const a=(u=n.get(e))==null?void 0:u.internals.userNode;return[a?{...a,position:((d=t.get(e))==null?void 0:d.position)||a.position,dragging:s}:r[0],r]}function Cne({dragItems:e,snapGrid:t,x:n,y:s}){const r=e.values().next().value;if(!r)return null;const a={x:n-r.distance.x,y:s-r.distance.y},l=hf(a,t);return{x:l.x-a.x,y:l.y-a.y}}function Ene({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:r}){let a={x:null,y:null},l=0,u=new Map,d=!1,f={x:0,y:0},p=null,m=!1,x=null,y=!1,v=!1,b=null;function w({noDragClassName:E,handleSelector:k,domNode:_,isSelectable:R,nodeId:T,nodeClickDistance:A=0}){x=rs(_);function M({x:B,y:H}){const{nodeLookup:z,nodeExtent:W,snapGrid:$,snapToGrid:F,nodeOrigin:G,onNodeDrag:X,onSelectionDrag:Z,onError:D,updateNodePositions:V}=t();a={x:B,y:H};let ne=!1;const U=u.size>1,Q=U&&W?GN(ff(u)):null,K=U&&F?Cne({dragItems:u,snapGrid:$,x:B,y:H}):null;for(const[te,re]of u){if(!z.has(te))continue;let oe={x:B-re.distance.x,y:H-re.distance.y};F&&(oe=K?{x:Math.round(oe.x+K.x),y:Math.round(oe.y+K.y)}:hf(oe,$));let pe=null;if(U&&W&&!re.extent&&Q){const{positionAbsolute:xe}=re.internals,Ne=xe.x-Q.x+W[0][0],we=xe.x+re.measured.width-Q.x2+W[1][0],De=xe.y-Q.y+W[0][1],Ee=xe.y+re.measured.height-Q.y2+W[1][1];pe=[[Ne,De],[we,Ee]]}const{position:ge,positionAbsolute:ve}=u8({nodeId:te,nextPosition:oe,nodeLookup:z,nodeExtent:pe||W,nodeOrigin:G,onError:D});ne=ne||re.position.x!==ge.x||re.position.y!==ge.y,re.position=ge,re.internals.positionAbsolute=ve}if(v=v||ne,!!ne&&(V(u,!0),b&&(s||X||!T&&Z))){const[te,re]=sv({nodeId:T,dragItems:u,nodeLookup:z});s==null||s(b,u,te,re),X==null||X(b,te,re),T||Z==null||Z(b,re)}}async function L(){if(!p)return;const{transform:B,panBy:H,autoPanSpeed:z,autoPanOnNodeDrag:W}=t();if(!W){d=!1,cancelAnimationFrame(l);return}const[$,F]=f8(f,p,z);($!==0||F!==0)&&(a.x=(a.x??0)-$/B[2],a.y=(a.y??0)-F/B[2],await H({x:$,y:F})&&M(a)),l=requestAnimationFrame(L)}function P(B){var U;const{nodeLookup:H,multiSelectionActive:z,nodesDraggable:W,transform:$,snapGrid:F,snapToGrid:G,selectNodesOnDrag:X,onNodeDragStart:Z,onSelectionDragStart:D,unselectNodesAndEdges:V}=t();m=!0,(!X||!R)&&!z&&T&&((U=H.get(T))!=null&&U.selected||V()),R&&X&&T&&(e==null||e(T));const ne=pd(B.sourceEvent,{transform:$,snapGrid:F,snapToGrid:G,containerBounds:p});if(a=ne,u=_ne(H,W,ne,T),u.size>0&&(n||Z||!T&&D)){const[Q,K]=sv({nodeId:T,dragItems:u,nodeLookup:H});n==null||n(B.sourceEvent,u,Q,K),Z==null||Z(B.sourceEvent,Q,K),T||D==null||D(B.sourceEvent,K)}}const O=H6().clickDistance(A).on("start",B=>{const{domNode:H,nodeDragThreshold:z,transform:W,snapGrid:$,snapToGrid:F}=t();p=(H==null?void 0:H.getBoundingClientRect())||null,y=!1,v=!1,b=B.sourceEvent,z===0&&P(B),a=pd(B.sourceEvent,{transform:W,snapGrid:$,snapToGrid:F,containerBounds:p}),f=qs(B.sourceEvent,p)}).on("drag",B=>{const{autoPanOnNodeDrag:H,transform:z,snapGrid:W,snapToGrid:$,nodeDragThreshold:F,nodeLookup:G}=t(),X=pd(B.sourceEvent,{transform:z,snapGrid:W,snapToGrid:$,containerBounds:p});if(b=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||T&&!G.has(T))&&(y=!0),!y){if(!d&&H&&m&&(d=!0,L()),!m){const Z=qs(B.sourceEvent,p),D=Z.x-f.x,V=Z.y-f.y;Math.sqrt(D*D+V*V)>F&&P(B)}(a.x!==X.xSnapped||a.y!==X.ySnapped)&&u&&m&&(f=qs(B.sourceEvent,p),M(X))}}).on("end",B=>{if(!(!m||y)&&(d=!1,m=!1,cancelAnimationFrame(l),u.size>0)){const{nodeLookup:H,updateNodePositions:z,onNodeDragStop:W,onSelectionDragStop:$}=t();if(v&&(z(u,!1),v=!1),r||W||!T&&$){const[F,G]=sv({nodeId:T,dragItems:u,nodeLookup:H,dragging:!1});r==null||r(B.sourceEvent,u,F,G),W==null||W(B.sourceEvent,F,G),T||$==null||$(B.sourceEvent,G)}}}).filter(B=>{const H=B.target;return!B.button&&(!E||!HI(H,`.${E}`,_))&&(!k||HI(H,k,_))});x.call(O)}function S(){x==null||x.on(".drag",null)}return{update:w,destroy:S}}function Rne(e,t,n){const s=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())$d(r,kc(a))>0&&s.push(a);return s}const Ane=250;function Tne(e,t,n,s){var u,d;let r=[],a=1/0;const l=Rne(e,n,t+Ane);for(const f of l){const p=[...((u=f.internals.handleBounds)==null?void 0:u.source)??[],...((d=f.internals.handleBounds)==null?void 0:d.target)??[]];for(const m of p){if(s.nodeId===m.nodeId&&s.type===m.type&&s.id===m.id)continue;const{x,y}=Co(f,m,m.position,!0),v=Math.sqrt(Math.pow(x-e.x,2)+Math.pow(y-e.y,2));v>t||(v<a?(r=[{...m,x,y}],a=v):v===a&&r.push({...m,x,y}))}}if(!r.length)return null;if(r.length>1){const f=s.type==="source"?"target":"source";return r.find(p=>p.type===f)??r[0]}return r[0]}function _8(e,t,n,s,r,a=!1){var f,p,m;const l=s.get(e);if(!l)return null;const u=r==="strict"?(f=l.internals.handleBounds)==null?void 0:f[t]:[...((p=l.internals.handleBounds)==null?void 0:p.source)??[],...((m=l.internals.handleBounds)==null?void 0:m.target)??[]],d=(n?u==null?void 0:u.find(x=>x.id===n):u==null?void 0:u[0])??null;return d&&a?{...d,...Co(l,d,d.position,!0)}:d}function C8(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ine(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const E8=()=>!0;function Mne(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:r,edgeUpdaterType:a,isTarget:l,domNode:u,nodeLookup:d,lib:f,autoPanOnConnect:p,flowId:m,panBy:x,cancelConnection:y,onConnectStart:v,onConnect:b,onConnectEnd:w,isValidConnection:S=E8,onReconnectEnd:E,updateConnection:k,getTransform:_,getFromHandle:R,autoPanSpeed:T,dragThreshold:A=1,handleDomNode:M}){const L=g8(e.target);let P=0,O;const{x:B,y:H}=qs(e),z=C8(a,M),W=u==null?void 0:u.getBoundingClientRect();let $=!1;if(!W||!z)return;const F=_8(r,z,s,d,t);if(!F)return;let G=qs(e,W),X=!1,Z=null,D=!1,V=null;function ne(){if(!p||!W)return;const[ge,ve]=f8(G,W,T);x({x:ge,y:ve}),P=requestAnimationFrame(ne)}const U={...F,nodeId:r,type:z,position:F.position},Q=d.get(r);let te={inProgress:!0,isValid:null,from:Co(Q,U,ye.Left,!0),fromHandle:U,fromPosition:U.position,fromNode:Q,to:G,toHandle:null,toPosition:TI[U.position],toNode:null,pointer:G};function re(){$=!0,k(te),v==null||v(e,{nodeId:r,handleId:s,handleType:z})}A===0&&re();function oe(ge){if(!$){const{x:Ee,y:Ct}=qs(ge),ut=Ee-B,jn=Ct-H;if(!(ut*ut+jn*jn>A*A))return;re()}if(!R()||!U){pe(ge);return}const ve=_();G=qs(ge,W),O=Tne(pf(G,ve,!1,[1,1]),n,d,U),X||(ne(),X=!0);const xe=R8(ge,{handle:O,connectionMode:t,fromNodeId:r,fromHandleId:s,fromType:l?"target":"source",isValidConnection:S,doc:L,lib:f,flowId:m,nodeLookup:d});V=xe.handleDomNode,Z=xe.connection,D=Ine(!!O,xe.isValid);const Ne=d.get(r),we=Ne?Co(Ne,U,ye.Left,!0):te.from,De={...te,from:we,isValid:D,to:xe.toHandle&&D?Om({x:xe.toHandle.x,y:xe.toHandle.y},ve):G,toHandle:xe.toHandle,toPosition:D&&xe.toHandle?xe.toHandle.position:TI[U.position],toNode:xe.toHandle?d.get(xe.toHandle.nodeId):null,pointer:G};k(De),te=De}function pe(ge){if(!("touches"in ge&&ge.touches.length>0)){if($){(O||V)&&Z&&D&&(b==null||b(Z));const{inProgress:ve,...xe}=te,Ne={...xe,toPosition:te.toHandle?te.toPosition:null};w==null||w(ge,Ne),a&&(E==null||E(ge,Ne))}y(),cancelAnimationFrame(P),X=!1,D=!1,Z=null,V=null,L.removeEventListener("mousemove",oe),L.removeEventListener("mouseup",pe),L.removeEventListener("touchmove",oe),L.removeEventListener("touchend",pe)}}L.addEventListener("mousemove",oe),L.addEventListener("mouseup",pe),L.addEventListener("touchmove",oe),L.addEventListener("touchend",pe)}function R8(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:r,fromType:a,doc:l,lib:u,flowId:d,isValidConnection:f=E8,nodeLookup:p}){const m=a==="target",x=t?l.querySelector(`.${u}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:v}=qs(e),b=l.elementFromPoint(y,v),w=b!=null&&b.classList.contains(`${u}-flow__handle`)?b:x,S={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const E=C8(void 0,w),k=w.getAttribute("data-nodeid"),_=w.getAttribute("data-handleid"),R=w.classList.contains("connectable"),T=w.classList.contains("connectableend");if(!k||!E)return S;const A={source:m?k:s,sourceHandle:m?_:r,target:m?s:k,targetHandle:m?r:_};S.connection=A;const L=R&&T&&(n===jc.Strict?m&&E==="source"||!m&&E==="target":k!==s||_!==r);S.isValid=L&&f(A),S.toHandle=_8(k,E,_,p,n,!0)}return S}const QN={onPointerDown:Mne,isValid:R8};function One({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const r=rs(e);function a({translateExtent:u,width:d,height:f,zoomStep:p=1,pannable:m=!0,zoomable:x=!0,inversePan:y=!1}){const v=k=>{if(k.sourceEvent.type!=="wheel"||!t)return;const _=n(),R=k.sourceEvent.ctrlKey&&Dd()?10:1,T=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*p,A=_[2]*Math.pow(2,T*R);t.scaleTo(A)};let b=[0,0];const w=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(b=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},S=k=>{const _=n();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!t)return;const R=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],T=[R[0]-b[0],R[1]-b[1]];b=R;const A=s()*Math.max(_[2],Math.log(_[2]))*(y?-1:1),M={x:_[0]-T[0]*A,y:_[1]-T[1]*A},L=[[0,0],[d,f]];t.setViewportConstrained({x:M.x,y:M.y,zoom:_[2]},L,u)},E=r8().on("start",w).on("zoom",m?S:null).on("zoom.wheel",x?v:null);r.call(E,{})}function l(){r.on("zoom",null)}return{update:a,destroy:l,pointer:Ls}}const Ig=e=>({x:e.x,y:e.y,zoom:e.k}),rv=({x:e,y:t,zoom:n})=>Rg.translate(e,t).scale(n),Vl=(e,t)=>e.target.closest(`.${t}`),A8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Lne=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,iv=(e,t=0,n=Lne,s=()=>{})=>{const r=typeof t=="number"&&t>0;return r||s(),r?e.transition().duration(t).ease(n).on("end",s):e},T8=e=>{const t=e.ctrlKey&&Dd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Pne({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:r,panOnScrollSpeed:a,zoomOnPinch:l,onPanZoomStart:u,onPanZoom:d,onPanZoomEnd:f}){return p=>{if(Vl(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const m=n.property("__zoom").k||1;if(p.ctrlKey&&l){const w=Ls(p),S=T8(p),E=m*Math.pow(2,S);s.scaleTo(n,E,w,p);return}const x=p.deltaMode===1?20:1;let y=r===vo.Vertical?0:p.deltaX*x,v=r===vo.Horizontal?0:p.deltaY*x;!Dd()&&p.shiftKey&&r!==vo.Vertical&&(y=p.deltaY*x,v=0),s.translateBy(n,-(y/m)*a,-(v/m)*a,{internal:!0});const b=Ig(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(p,b),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,u==null||u(p,b))}}function $ne({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,r){const a=s.type==="wheel",l=!t&&a&&!s.ctrlKey,u=Vl(s,e);if(s.ctrlKey&&a&&u&&s.preventDefault(),l||u)return null;s.preventDefault(),n.call(this,s,r)}}function Dne({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{var a,l,u;if((a=s.sourceEvent)!=null&&a.internal)return;const r=Ig(s.transform);e.mouseButton=((l=s.sourceEvent)==null?void 0:l.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((u=s.sourceEvent)==null?void 0:u.type)==="mousedown"&&t(!0),n&&(n==null||n(s.sourceEvent,r))}}function qne({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:r}){return a=>{var l,u;e.usedRightMouseButton=!!(n&&A8(t,e.mouseButton??0)),(l=a.sourceEvent)!=null&&l.sync||s([a.transform.x,a.transform.y,a.transform.k]),r&&!((u=a.sourceEvent)!=null&&u.internal)&&(r==null||r(a.sourceEvent,Ig(a.transform)))}}function zne({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:r,onPaneContextMenu:a}){return l=>{var u;if(!((u=l.sourceEvent)!=null&&u.internal)&&(e.isZoomingOrPanning=!1,a&&A8(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&a(l.sourceEvent),e.usedRightMouseButton=!1,s(!1),r)){const d=Ig(l.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(l.sourceEvent,d)},n?150:0)}}}function Bne({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:r,zoomOnDoubleClick:a,userSelectionActive:l,noWheelClassName:u,noPanClassName:d,lib:f,connectionInProgress:p}){return m=>{var w;const x=e||t,y=n&&m.ctrlKey,v=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(Vl(m,`${f}-flow__node`)||Vl(m,`${f}-flow__edge`)))return!0;if(!s&&!x&&!r&&!a&&!n||l||p&&!v||Vl(m,u)&&v||Vl(m,d)&&(!v||r&&v&&!e)||!n&&m.ctrlKey&&v)return!1;if(!n&&m.type==="touchstart"&&((w=m.touches)==null?void 0:w.length)>1)return m.preventDefault(),!1;if(!x&&!r&&!y&&v||!s&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(s)&&!s.includes(m.button)&&m.type==="mousedown")return!1;const b=Array.isArray(s)&&s.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||v)&&b}}function Fne({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:r,onPanZoom:a,onPanZoomStart:l,onPanZoomEnd:u,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),m=r8().scaleExtent([t,n]).translateExtent(s),x=rs(e).call(m);E({x:r.x,y:r.y,zoom:Nc(r.zoom,t,n)},[[0,0],[p.width,p.height]],s);const y=x.on("wheel.zoom"),v=x.on("dblclick.zoom");m.wheelDelta(T8);function b(O,B){return x?new Promise(H=>{m==null||m.interpolate((B==null?void 0:B.interpolate)==="linear"?hd:nm).transform(iv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),O)}):Promise.resolve(!1)}function w({noWheelClassName:O,noPanClassName:B,onPaneContextMenu:H,userSelectionActive:z,panOnScroll:W,panOnDrag:$,panOnScrollMode:F,panOnScrollSpeed:G,preventScrolling:X,zoomOnPinch:Z,zoomOnScroll:D,zoomOnDoubleClick:V,zoomActivationKeyPressed:ne,lib:U,onTransformChange:Q,connectionInProgress:K,paneClickDistance:te,selectionOnDrag:re}){z&&!f.isZoomingOrPanning&&S();const oe=W&&!ne&&!z;m.clickDistance(re?1/0:!Ds(te)||te<0?0:te);const pe=oe?Pne({zoomPanValues:f,noWheelClassName:O,d3Selection:x,d3Zoom:m,panOnScrollMode:F,panOnScrollSpeed:G,zoomOnPinch:Z,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:u}):$ne({noWheelClassName:O,preventScrolling:X,d3ZoomHandler:y});if(x.on("wheel.zoom",pe,{passive:!1}),!z){const ve=Dne({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:l});m.on("start",ve);const xe=qne({zoomPanValues:f,panOnDrag:$,onPaneContextMenu:!!H,onPanZoom:a,onTransformChange:Q});m.on("zoom",xe);const Ne=zne({zoomPanValues:f,panOnDrag:$,panOnScroll:W,onPaneContextMenu:H,onPanZoomEnd:u,onDraggingChange:d});m.on("end",Ne)}const ge=Bne({zoomActivationKeyPressed:ne,panOnDrag:$,zoomOnScroll:D,panOnScroll:W,zoomOnDoubleClick:V,zoomOnPinch:Z,userSelectionActive:z,noPanClassName:B,noWheelClassName:O,lib:U,connectionInProgress:K});m.filter(ge),V?x.on("dblclick.zoom",v):x.on("dblclick.zoom",null)}function S(){m.on("zoom",null)}async function E(O,B,H){const z=rv(O),W=m==null?void 0:m.constrain()(z,B,H);return W&&await b(W),new Promise($=>$(W))}async function k(O,B){const H=rv(O);return await b(H,B),new Promise(z=>z(H))}function _(O){if(x){const B=rv(O),H=x.property("__zoom");(H.k!==O.zoom||H.x!==O.x||H.y!==O.y)&&(m==null||m.transform(x,B,null,{sync:!0}))}}function R(){const O=x?s8(x.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}function T(O,B){return x?new Promise(H=>{m==null||m.interpolate((B==null?void 0:B.interpolate)==="linear"?hd:nm).scaleTo(iv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),O)}):Promise.resolve(!1)}function A(O,B){return x?new Promise(H=>{m==null||m.interpolate((B==null?void 0:B.interpolate)==="linear"?hd:nm).scaleBy(iv(x,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),O)}):Promise.resolve(!1)}function M(O){m==null||m.scaleExtent(O)}function L(O){m==null||m.translateExtent(O)}function P(O){const B=!Ds(O)||O<0?0:O;m==null||m.clickDistance(B)}return{update:w,destroy:S,setViewport:k,setViewportConstrained:E,getViewport:R,scaleTo:T,scaleBy:A,setScaleExtent:M,setTranslateExtent:L,syncViewport:_,setClickDistance:P}}var Cc;(function(e){e.Line="line",e.Handle="handle"})(Cc||(Cc={}));function Hne({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:r,affectsY:a}){const l=e-t,u=n-s,d=[l>0?1:l<0?-1:0,u>0?1:u<0?-1:0];return l&&r&&(d[0]=d[0]*-1),u&&a&&(d[1]=d[1]*-1),d}function UI(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:r}}function Di(e,t){return Math.max(0,t-e)}function qi(e,t){return Math.max(0,e-t)}function Np(e,t,n){return Math.max(0,t-e,e-n)}function VI(e,t){return e?!t:t}function Une(e,t,n,s,r,a,l,u){let{affectsX:d,affectsY:f}=t;const{isHorizontal:p,isVertical:m}=t,x=p&&m,{xSnapped:y,ySnapped:v}=n,{minWidth:b,maxWidth:w,minHeight:S,maxHeight:E}=s,{x:k,y:_,width:R,height:T,aspectRatio:A}=e;let M=Math.floor(p?y-e.pointerX:0),L=Math.floor(m?v-e.pointerY:0);const P=R+(d?-M:M),O=T+(f?-L:L),B=-a[0]*R,H=-a[1]*T;let z=Np(P,b,w),W=Np(O,S,E);if(l){let G=0,X=0;d&&M<0?G=Di(k+M+B,l[0][0]):!d&&M>0&&(G=qi(k+P+B,l[1][0])),f&&L<0?X=Di(_+L+H,l[0][1]):!f&&L>0&&(X=qi(_+O+H,l[1][1])),z=Math.max(z,G),W=Math.max(W,X)}if(u){let G=0,X=0;d&&M>0?G=qi(k+M,u[0][0]):!d&&M<0&&(G=Di(k+P,u[1][0])),f&&L>0?X=qi(_+L,u[0][1]):!f&&L<0&&(X=Di(_+O,u[1][1])),z=Math.max(z,G),W=Math.max(W,X)}if(r){if(p){const G=Np(P/A,S,E)*A;if(z=Math.max(z,G),l){let X=0;!d&&!f||d&&!f&&x?X=qi(_+H+P/A,l[1][1])*A:X=Di(_+H+(d?M:-M)/A,l[0][1])*A,z=Math.max(z,X)}if(u){let X=0;!d&&!f||d&&!f&&x?X=Di(_+P/A,u[1][1])*A:X=qi(_+(d?M:-M)/A,u[0][1])*A,z=Math.max(z,X)}}if(m){const G=Np(O*A,b,w)/A;if(W=Math.max(W,G),l){let X=0;!d&&!f||f&&!d&&x?X=qi(k+O*A+B,l[1][0])/A:X=Di(k+(f?L:-L)*A+B,l[0][0])/A,W=Math.max(W,X)}if(u){let X=0;!d&&!f||f&&!d&&x?X=Di(k+O*A,u[1][0])/A:X=qi(k+(f?L:-L)*A,u[0][0])/A,W=Math.max(W,X)}}}L=L+(L<0?W:-W),M=M+(M<0?z:-z),r&&(x?P>O*A?L=(VI(d,f)?-M:M)/A:M=(VI(d,f)?-L:L)*A:p?(L=M/A,f=d):(M=L*A,d=f));const $=d?k+M:k,F=f?_+L:_;return{width:R+(d?-M:M),height:T+(f?-L:L),x:a[0]*M*(d?-1:1)+$,y:a[1]*L*(f?-1:1)+F}}const I8={width:0,height:0,x:0,y:0},Vne={...I8,pointerX:0,pointerY:0,aspectRatio:1};function Gne(e){return[[0,0],[e.measured.width,e.measured.height]]}function Kne(e,t,n){const s=t.position.x+e.position.x,r=t.position.y+e.position.y,a=e.measured.width??0,l=e.measured.height??0,u=n[0]*a,d=n[1]*l;return[[s-u,r-d],[s+a-u,r+l-d]]}function Wne({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:r}){const a=rs(e);let l={controlDirection:UI("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:f,boundaries:p,keepAspectRatio:m,resizeDirection:x,onResizeStart:y,onResize:v,onResizeEnd:b,shouldResize:w}){let S={...I8},E={...Vne};l={boundaries:p,resizeDirection:x,keepAspectRatio:m,controlDirection:UI(f)};let k,_=null,R=[],T,A,M,L=!1;const P=H6().on("start",O=>{const{nodeLookup:B,transform:H,snapGrid:z,snapToGrid:W,nodeOrigin:$,paneDomNode:F}=n();if(k=B.get(t),!k)return;_=(F==null?void 0:F.getBoundingClientRect())??null;const{xSnapped:G,ySnapped:X}=pd(O.sourceEvent,{transform:H,snapGrid:z,snapToGrid:W,containerBounds:_});S={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},E={...S,pointerX:G,pointerY:X,aspectRatio:S.width/S.height},T=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(T=B.get(k.parentId),A=T&&k.extent==="parent"?Gne(T):void 0),R=[],M=void 0;for(const[Z,D]of B)if(D.parentId===t&&(R.push({id:Z,position:{...D.position},extent:D.extent}),D.extent==="parent"||D.expandParent)){const V=Kne(D,k,D.origin??$);M?M=[[Math.min(V[0][0],M[0][0]),Math.min(V[0][1],M[0][1])],[Math.max(V[1][0],M[1][0]),Math.max(V[1][1],M[1][1])]]:M=V}y==null||y(O,{...S})}).on("drag",O=>{const{transform:B,snapGrid:H,snapToGrid:z,nodeOrigin:W}=n(),$=pd(O.sourceEvent,{transform:B,snapGrid:H,snapToGrid:z,containerBounds:_}),F=[];if(!k)return;const{x:G,y:X,width:Z,height:D}=S,V={},ne=k.origin??W,{width:U,height:Q,x:K,y:te}=Une(E,l.controlDirection,$,l.boundaries,l.keepAspectRatio,ne,A,M),re=U!==Z,oe=Q!==D,pe=K!==G&&re,ge=te!==X&&oe;if(!pe&&!ge&&!re&&!oe)return;if((pe||ge||ne[0]===1||ne[1]===1)&&(V.x=pe?K:S.x,V.y=ge?te:S.y,S.x=V.x,S.y=V.y,R.length>0)){const we=K-G,De=te-X;for(const Ee of R)Ee.position={x:Ee.position.x-we+ne[0]*(U-Z),y:Ee.position.y-De+ne[1]*(Q-D)},F.push(Ee)}if((re||oe)&&(V.width=re&&(!l.resizeDirection||l.resizeDirection==="horizontal")?U:S.width,V.height=oe&&(!l.resizeDirection||l.resizeDirection==="vertical")?Q:S.height,S.width=V.width,S.height=V.height),T&&k.expandParent){const we=ne[0]*(V.width??0);V.x&&V.x<we&&(S.x=we,E.x=E.x-(V.x-we));const De=ne[1]*(V.height??0);V.y&&V.y<De&&(S.y=De,E.y=E.y-(V.y-De))}const ve=Hne({width:S.width,prevWidth:Z,height:S.height,prevHeight:D,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),xe={...S,direction:ve};(w==null?void 0:w(O,xe))!==!1&&(L=!0,v==null||v(O,xe),s(V,F))}).on("end",O=>{L&&(b==null||b(O,{...S}),r==null||r({...S}),L=!1)});a.call(P)}function d(){a.on(".drag",null)}return{update:u,destroy:d}}const Yne={},GI=e=>{let t;const n=new Set,s=(p,m)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const y=t;t=m??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(v=>v(t,y))}},r=()=>t,d={setState:s,getState:r,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Yne?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(s,r,d);return d},Qne=e=>e?GI(e):GI,{useDebugValue:Xne}=wo,{useSyncExternalStoreWithSelector:Zne}=aU,Jne=e=>e;function M8(e,t=Jne,n){const s=Zne(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Xne(s),s}const KI=(e,t)=>{const n=Qne(e),s=(r,a=t)=>M8(n,r,a);return Object.assign(s,n),s},ese=(e,t)=>e?KI(e,t):KI;function St(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,r]of e)if(!Object.is(r,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const Mg=C.createContext(null),tse=Mg.Provider,O8=ur.error001();function et(e,t){const n=C.useContext(Mg);if(n===null)throw new Error(O8);return M8(n,e,t)}function Nt(){const e=C.useContext(Mg);if(e===null)throw new Error(O8);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const WI={display:"none"},nse={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},L8="react-flow__node-desc",P8="react-flow__edge-desc",sse="react-flow__aria-live",rse=e=>e.ariaLiveMessage,ise=e=>e.ariaLabelConfig;function ase({rfId:e}){const t=et(rse);return i.jsx("div",{id:`${sse}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:nse,children:t})}function ose({rfId:e,disableKeyboardA11y:t}){const n=et(ise);return i.jsxs(i.Fragment,{children:[i.jsx("div",{id:`${L8}-${e}`,style:WI,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),i.jsx("div",{id:`${P8}-${e}`,style:WI,children:n["edge.a11yDescription.default"]}),!t&&i.jsx(ase,{rfId:e})]})}const mf=C.forwardRef(({position:e="top-left",children:t,className:n,style:s,...r},a)=>{const l=`${e}`.split("-");return i.jsx("div",{className:Vt(["react-flow__panel",n,...l]),style:s,ref:a,...r,children:t})});mf.displayName="Panel";function lse({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:i.jsx(mf,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:i.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const cse=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},kp=e=>e.id;function use(e,t){return St(e.selectedNodes.map(kp),t.selectedNodes.map(kp))&&St(e.selectedEdges.map(kp),t.selectedEdges.map(kp))}function dse({onSelectionChange:e}){const t=Nt(),{selectedNodes:n,selectedEdges:s}=et(cse,use);return C.useEffect(()=>{const r={nodes:n,edges:s};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(a=>a(r))},[n,s,e]),null}const fse=e=>!!e.onSelectionChangeHandlers;function hse({onSelectionChange:e}){const t=et(fse);return e||t?i.jsx(dse,{onSelectionChange:e}):null}const $8=[0,0],pse={x:0,y:0,zoom:1},mse=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],YI=[...mse,"rfId"],gse=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),QI={translateExtent:Ld,nodeOrigin:$8,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function xse(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:r,setTranslateExtent:a,setNodeExtent:l,reset:u,setDefaultNodesAndEdges:d}=et(gse,St),f=Nt();C.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{p.current=QI,u()}),[]);const p=C.useRef(QI);return C.useEffect(()=>{for(const m of YI){const x=e[m],y=p.current[m];x!==y&&(typeof e[m]>"u"||(m==="nodes"?t(x):m==="edges"?n(x):m==="minZoom"?s(x):m==="maxZoom"?r(x):m==="translateExtent"?a(x):m==="nodeExtent"?l(x):m==="ariaLabelConfig"?f.setState({ariaLabelConfig:ane(x)}):m==="fitView"?f.setState({fitViewQueued:x}):m==="fitViewOptions"?f.setState({fitViewOptions:x}):f.setState({[m]:x})))}p.current=e},YI.map(m=>e[m])),null}function XI(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function yse(e){var s;const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const r=XI(),a=()=>n(r!=null&&r.matches?"dark":"light");return a(),r==null||r.addEventListener("change",a),()=>{r==null||r.removeEventListener("change",a)}},[e]),t!==null?t:(s=XI())!=null&&s.matches?"dark":"light"}const ZI=typeof document<"u"?document:null;function qd(e=null,t={target:ZI,actInsideInputWithModifier:!0}){const[n,s]=C.useState(!1),r=C.useRef(!1),a=C.useRef(new Set([])),[l,u]=C.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.replace("+",`
467
+ `).replace(`
468
+
469
+ `,`
470
+ +`).split(`
471
+ `)),p=f.reduce((m,x)=>m.concat(...x),[]);return[f,p]}return[[],[]]},[e]);return C.useEffect(()=>{const d=(t==null?void 0:t.target)??ZI,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=y=>{var w,S;if(r.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!r.current||r.current&&!f)&&x8(y))return!1;const b=eM(y.code,u);if(a.current.add(y[b]),JI(l,a.current,!1)){const E=((S=(w=y.composedPath)==null?void 0:w.call(y))==null?void 0:S[0])||y.target,k=(E==null?void 0:E.nodeName)==="BUTTON"||(E==null?void 0:E.nodeName)==="A";t.preventDefault!==!1&&(r.current||!k)&&y.preventDefault(),s(!0)}},m=y=>{const v=eM(y.code,u);JI(l,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(y[v]),y.key==="Meta"&&a.current.clear(),r.current=!1},x=()=>{a.current.clear(),s(!1)};return d==null||d.addEventListener("keydown",p),d==null||d.addEventListener("keyup",m),window.addEventListener("blur",x),window.addEventListener("contextmenu",x),()=>{d==null||d.removeEventListener("keydown",p),d==null||d.removeEventListener("keyup",m),window.removeEventListener("blur",x),window.removeEventListener("contextmenu",x)}}},[e,s]),n}function JI(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(r=>t.has(r)))}function eM(e,t){return t.includes(e)?"code":"key"}const vse=()=>{const e=Nt();return C.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:s}=e.getState();return s?s.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[s,r,a],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??s,y:t.y??r,zoom:t.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,s]=e.getState().transform;return{x:t,y:n,zoom:s}},setCenter:async(t,n,s)=>e.getState().setCenter(t,n,s),fitBounds:async(t,n)=>{const{width:s,height:r,minZoom:a,maxZoom:l,panZoom:u}=e.getState(),d=Dk(t,s,r,a,l,(n==null?void 0:n.padding)??.1);return u?(await u.setViewport(d,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:s,snapGrid:r,snapToGrid:a,domNode:l}=e.getState();if(!l)return t;const{x:u,y:d}=l.getBoundingClientRect(),f={x:t.x-u,y:t.y-d},p=n.snapGrid??r,m=n.snapToGrid??a;return pf(f,s,m,p)},flowToScreenPosition:t=>{const{transform:n,domNode:s}=e.getState();if(!s)return t;const{x:r,y:a}=s.getBoundingClientRect(),l=Om(t,n);return{x:l.x+r,y:l.y+a}}}),[])};function D8(e,t){const n=[],s=new Map,r=[];for(const a of e)if(a.type==="add"){r.push(a);continue}else if(a.type==="remove"||a.type==="replace")s.set(a.id,[a]);else{const l=s.get(a.id);l?l.push(a):s.set(a.id,[a])}for(const a of t){const l=s.get(a.id);if(!l){n.push(a);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const u={...a};for(const d of l)bse(d,u);n.push(u)}return r.length&&r.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function bse(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function wse(e,t){return D8(e,t)}function jse(e,t){return D8(e,t)}function Ya(e,t){return{id:e,type:"select",selected:t}}function Gl(e,t=new Set,n=!1){const s=[];for(const[r,a]of e){const l=t.has(r);!(a.selected===void 0&&!l)&&a.selected!==l&&(n&&(a.selected=l),s.push(Ya(a.id,l)))}return s}function tM({items:e=[],lookup:t}){var r;const n=[],s=new Map(e.map(a=>[a.id,a]));for(const[a,l]of e.entries()){const u=t.get(l.id),d=((r=u==null?void 0:u.internals)==null?void 0:r.userNode)??u;d!==void 0&&d!==l&&n.push({id:l.id,item:l,type:"replace"}),d===void 0&&n.push({item:l,type:"add",index:a})}for(const[a]of t)s.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function nM(e){return{id:e.id,type:"remove"}}const sM=e=>Qte(e),Sse=e=>c8(e);function q8(e){return C.forwardRef(e)}const Nse=typeof window<"u"?C.useLayoutEffect:C.useEffect;function rM(e){const[t,n]=C.useState(BigInt(0)),[s]=C.useState(()=>kse(()=>n(r=>r+BigInt(1))));return Nse(()=>{const r=s.get();r.length&&(e(r),s.reset())},[t]),s}function kse(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const z8=C.createContext(null);function _se({children:e}){const t=Nt(),n=C.useCallback(u=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:p,onNodesChange:m,nodeLookup:x,fitViewQueued:y,onNodesChangeMiddlewareMap:v}=t.getState();let b=d;for(const S of u)b=typeof S=="function"?S(b):S;let w=tM({items:b,lookup:x});for(const S of v.values())w=S(w);p&&f(b),w.length>0?m==null||m(w):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:E,setNodes:k}=t.getState();S&&k(E)})},[]),s=rM(n),r=C.useCallback(u=>{const{edges:d=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:m,edgeLookup:x}=t.getState();let y=d;for(const v of u)y=typeof v=="function"?v(y):v;p?f(y):m&&m(tM({items:y,lookup:x}))},[]),a=rM(r),l=C.useMemo(()=>({nodeQueue:s,edgeQueue:a}),[]);return i.jsx(z8.Provider,{value:l,children:e})}function Cse(){const e=C.useContext(z8);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Ese=e=>!!e.panZoom;function Og(){const e=vse(),t=Nt(),n=Cse(),s=et(Ese),r=C.useMemo(()=>{const a=m=>t.getState().nodeLookup.get(m),l=m=>{n.nodeQueue.push(m)},u=m=>{n.edgeQueue.push(m)},d=m=>{var S,E;const{nodeLookup:x,nodeOrigin:y}=t.getState(),v=sM(m)?m:x.get(m.id),b=v.parentId?m8(v.position,v.measured,v.parentId,x,y):v.position,w={...v,position:b,width:((S=v.measured)==null?void 0:S.width)??v.width,height:((E=v.measured)==null?void 0:E.height)??v.height};return kc(w)},f=(m,x,y={replace:!1})=>{l(v=>v.map(b=>{if(b.id===m){const w=typeof x=="function"?x(b):x;return y.replace&&sM(w)?w:{...b,...w}}return b}))},p=(m,x,y={replace:!1})=>{u(v=>v.map(b=>{if(b.id===m){const w=typeof x=="function"?x(b):x;return y.replace&&Sse(w)?w:{...b,...w}}return b}))};return{getNodes:()=>t.getState().nodes.map(m=>({...m})),getNode:m=>{var x;return(x=a(m))==null?void 0:x.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:m=[]}=t.getState();return m.map(x=>({...x}))},getEdge:m=>t.getState().edgeLookup.get(m),setNodes:l,setEdges:u,addNodes:m=>{const x=Array.isArray(m)?m:[m];n.nodeQueue.push(y=>[...y,...x])},addEdges:m=>{const x=Array.isArray(m)?m:[m];n.edgeQueue.push(y=>[...y,...x])},toObject:()=>{const{nodes:m=[],edges:x=[],transform:y}=t.getState(),[v,b,w]=y;return{nodes:m.map(S=>({...S})),edges:x.map(S=>({...S})),viewport:{x:v,y:b,zoom:w}}},deleteElements:async({nodes:m=[],edges:x=[]})=>{const{nodes:y,edges:v,onNodesDelete:b,onEdgesDelete:w,triggerNodeChanges:S,triggerEdgeChanges:E,onDelete:k,onBeforeDelete:_}=t.getState(),{nodes:R,edges:T}=await tne({nodesToRemove:m,edgesToRemove:x,nodes:y,edges:v,onBeforeDelete:_}),A=T.length>0,M=R.length>0;if(A){const L=T.map(nM);w==null||w(T),E(L)}if(M){const L=R.map(nM);b==null||b(R),S(L)}return(M||A)&&(k==null||k({nodes:R,edges:T})),{deletedNodes:R,deletedEdges:T}},getIntersectingNodes:(m,x=!0,y)=>{const v=MI(m),b=v?m:d(m),w=y!==void 0;return b?(y||t.getState().nodes).filter(S=>{const E=t.getState().nodeLookup.get(S.id);if(E&&!v&&(S.id===m.id||!E.internals.positionAbsolute))return!1;const k=kc(w?S:E),_=$d(k,b);return x&&_>0||_>=k.width*k.height||_>=b.width*b.height}):[]},isNodeIntersecting:(m,x,y=!0)=>{const b=MI(m)?m:d(m);if(!b)return!1;const w=$d(b,x);return y&&w>0||w>=x.width*x.height||w>=b.width*b.height},updateNode:f,updateNodeData:(m,x,y={replace:!1})=>{f(m,v=>{const b=typeof x=="function"?x(v):x;return y.replace?{...v,data:b}:{...v,data:{...v.data,...b}}},y)},updateEdge:p,updateEdgeData:(m,x,y={replace:!1})=>{p(m,v=>{const b=typeof x=="function"?x(v):x;return y.replace?{...v,data:b}:{...v,data:{...v.data,...b}}},y)},getNodesBounds:m=>{const{nodeLookup:x,nodeOrigin:y}=t.getState();return Xte(m,{nodeLookup:x,nodeOrigin:y})},getHandleConnections:({type:m,id:x,nodeId:y})=>{var v;return Array.from(((v=t.getState().connectionLookup.get(`${y}-${m}${x?`-${x}`:""}`))==null?void 0:v.values())??[])},getNodeConnections:({type:m,handleId:x,nodeId:y})=>{var v;return Array.from(((v=t.getState().connectionLookup.get(`${y}${m?x?`-${m}-${x}`:`-${m}`:""}`))==null?void 0:v.values())??[])},fitView:async m=>{const x=t.getState().fitViewResolver??ine();return t.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:x}),n.nodeQueue.push(y=>[...y]),x.promise}}},[]);return C.useMemo(()=>({...r,...e,viewportInitialized:s}),[s])}const iM=e=>e.selected,Rse=typeof window<"u"?window:void 0;function Ase({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Nt(),{deleteElements:s}=Og(),r=qd(e,{actInsideInputWithModifier:!1}),a=qd(t,{target:Rse});C.useEffect(()=>{if(r){const{edges:l,nodes:u}=n.getState();s({nodes:u.filter(iM),edges:l.filter(iM)}),n.setState({nodesSelectionActive:!1})}},[r]),C.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function Tse(e){const t=Nt();C.useEffect(()=>{const n=()=>{var r,a,l,u;if(!e.current||!(((a=(r=e.current).checkVisibility)==null?void 0:a.call(r))??!0))return!1;const s=qk(e.current);(s.height===0||s.width===0)&&((u=(l=t.getState()).onError)==null||u.call(l,"004",ur.error004())),t.setState({width:s.width||500,height:s.height||500})};if(e.current){n(),window.addEventListener("resize",n);const s=new ResizeObserver(()=>n());return s.observe(e.current),()=>{window.removeEventListener("resize",n),s&&e.current&&s.unobserve(e.current)}}},[])}const Lg={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ise=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Mse({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:s=!1,panOnScrollSpeed:r=.5,panOnScrollMode:a=vo.Free,zoomOnDoubleClick:l=!0,panOnDrag:u=!0,defaultViewport:d,translateExtent:f,minZoom:p,maxZoom:m,zoomActivationKeyCode:x,preventScrolling:y=!0,children:v,noWheelClassName:b,noPanClassName:w,onViewportChange:S,isControlledViewport:E,paneClickDistance:k,selectionOnDrag:_}){const R=Nt(),T=C.useRef(null),{userSelectionActive:A,lib:M,connectionInProgress:L}=et(Ise,St),P=qd(x),O=C.useRef();Tse(T);const B=C.useCallback(H=>{S==null||S({x:H[0],y:H[1],zoom:H[2]}),E||R.setState({transform:H})},[S,E]);return C.useEffect(()=>{if(T.current){O.current=Fne({domNode:T.current,minZoom:p,maxZoom:m,translateExtent:f,viewport:d,onDraggingChange:$=>R.setState(F=>F.paneDragging===$?F:{paneDragging:$}),onPanZoomStart:($,F)=>{const{onViewportChangeStart:G,onMoveStart:X}=R.getState();X==null||X($,F),G==null||G(F)},onPanZoom:($,F)=>{const{onViewportChange:G,onMove:X}=R.getState();X==null||X($,F),G==null||G(F)},onPanZoomEnd:($,F)=>{const{onViewportChangeEnd:G,onMoveEnd:X}=R.getState();X==null||X($,F),G==null||G(F)}});const{x:H,y:z,zoom:W}=O.current.getViewport();return R.setState({panZoom:O.current,transform:[H,z,W],domNode:T.current.closest(".react-flow")}),()=>{var $;($=O.current)==null||$.destroy()}}},[]),C.useEffect(()=>{var H;(H=O.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:s,panOnScrollSpeed:r,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:u,zoomActivationKeyPressed:P,preventScrolling:y,noPanClassName:w,userSelectionActive:A,noWheelClassName:b,lib:M,onTransformChange:B,connectionInProgress:L,selectionOnDrag:_,paneClickDistance:k})},[e,t,n,s,r,a,l,u,P,y,w,A,b,M,B,L,_,k]),i.jsx("div",{className:"react-flow__renderer",ref:T,style:Lg,children:v})}const Ose=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Lse(){const{userSelectionActive:e,userSelectionRect:t}=et(Ose,St);return e&&t?i.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const av=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Pse=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function $se({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Pd.Full,panOnDrag:s,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:f,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:x,onPaneMouseLeave:y,children:v}){const b=Nt(),{userSelectionActive:w,elementsSelectable:S,dragging:E,connectionInProgress:k}=et(Pse,St),_=S&&(e||w),R=C.useRef(null),T=C.useRef(),A=C.useRef(new Set),M=C.useRef(new Set),L=C.useRef(!1),P=G=>{if(L.current||k){L.current=!1;return}d==null||d(G),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},O=G=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){G.preventDefault();return}f==null||f(G)},B=p?G=>p(G):void 0,H=G=>{L.current&&(G.stopPropagation(),L.current=!1)},z=G=>{var Q,K;const{domNode:X}=b.getState();if(T.current=X==null?void 0:X.getBoundingClientRect(),!T.current)return;const Z=G.target===R.current;if(!Z&&!!G.target.closest(".nokey")||!e||!(a&&Z||t)||G.button!==0||!G.isPrimary)return;(K=(Q=G.target)==null?void 0:Q.setPointerCapture)==null||K.call(Q,G.pointerId),L.current=!1;const{x:ne,y:U}=qs(G.nativeEvent,T.current);b.setState({userSelectionRect:{width:0,height:0,startX:ne,startY:U,x:ne,y:U}}),Z||(G.stopPropagation(),G.preventDefault())},W=G=>{const{userSelectionRect:X,transform:Z,nodeLookup:D,edgeLookup:V,connectionLookup:ne,triggerNodeChanges:U,triggerEdgeChanges:Q,defaultEdgeOptions:K,resetSelectedElements:te}=b.getState();if(!T.current||!X)return;const{x:re,y:oe}=qs(G.nativeEvent,T.current),{startX:pe,startY:ge}=X;if(!L.current){const De=t?0:r;if(Math.hypot(re-pe,oe-ge)<=De)return;te(),l==null||l(G)}L.current=!0;const ve={startX:pe,startY:ge,x:re<pe?re:pe,y:oe<ge?oe:ge,width:Math.abs(re-pe),height:Math.abs(oe-ge)},xe=A.current,Ne=M.current;A.current=new Set($k(D,ve,Z,n===Pd.Partial,!0).map(De=>De.id)),M.current=new Set;const we=(K==null?void 0:K.selectable)??!0;for(const De of A.current){const Ee=ne.get(De);if(Ee)for(const{edgeId:Ct}of Ee.values()){const ut=V.get(Ct);ut&&(ut.selectable??we)&&M.current.add(Ct)}}if(!OI(xe,A.current)){const De=Gl(D,A.current,!0);U(De)}if(!OI(Ne,M.current)){const De=Gl(V,M.current);Q(De)}b.setState({userSelectionRect:ve,userSelectionActive:!0,nodesSelectionActive:!1})},$=G=>{var X,Z;G.button===0&&((Z=(X=G.target)==null?void 0:X.releasePointerCapture)==null||Z.call(X,G.pointerId),!w&&G.target===R.current&&b.getState().userSelectionRect&&(P==null||P(G)),b.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(u==null||u(G),b.setState({nodesSelectionActive:A.current.size>0})))},F=s===!0||Array.isArray(s)&&s.includes(0);return i.jsxs("div",{className:Vt(["react-flow__pane",{draggable:F,dragging:E,selection:e}]),onClick:_?void 0:av(P,R),onContextMenu:av(O,R),onWheel:av(B,R),onPointerEnter:_?void 0:m,onPointerMove:_?W:x,onPointerUp:_?$:void 0,onPointerDownCapture:_?z:void 0,onClickCapture:_?H:void 0,onPointerLeave:y,ref:R,style:Lg,children:[v,i.jsx(Lse,{})]})}function XN({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:r,unselectNodesAndEdges:a,multiSelectionActive:l,nodeLookup:u,onError:d}=t.getState(),f=u.get(e);if(!f){d==null||d("012",ur.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&l)&&(a({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=s==null?void 0:s.current)==null?void 0:p.blur()})):r([e])}function B8({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:r,isSelectable:a,nodeClickDistance:l}){const u=Nt(),[d,f]=C.useState(!1),p=C.useRef();return C.useEffect(()=>{p.current=Ene({getStoreItems:()=>u.getState(),onNodeMouseDown:m=>{XN({id:m,store:u,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),C.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:s,domNode:e.current,isSelectable:a,nodeId:r,nodeClickDistance:l}),()=>{var m;(m=p.current)==null||m.destroy()}},[n,s,t,a,e,r,l]),d}const Dse=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function F8(){const e=Nt();return C.useCallback(n=>{const{nodeExtent:s,snapToGrid:r,snapGrid:a,nodesDraggable:l,onError:u,updateNodePositions:d,nodeLookup:f,nodeOrigin:p}=e.getState(),m=new Map,x=Dse(l),y=r?a[0]:5,v=r?a[1]:5,b=n.direction.x*y*n.factor,w=n.direction.y*v*n.factor;for(const[,S]of f){if(!x(S))continue;let E={x:S.internals.positionAbsolute.x+b,y:S.internals.positionAbsolute.y+w};r&&(E=hf(E,a));const{position:k,positionAbsolute:_}=u8({nodeId:S.id,nextPosition:E,nodeLookup:f,nodeExtent:s,nodeOrigin:p,onError:u});S.position=k,S.internals.positionAbsolute=_,m.set(S.id,S)}d(m)},[])}const Gk=C.createContext(null),qse=Gk.Provider;Gk.Consumer;const H8=()=>C.useContext(Gk),zse=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Bse=(e,t,n)=>s=>{const{connectionClickStartHandle:r,connectionMode:a,connection:l}=s,{fromHandle:u,toHandle:d,isValid:f}=l,p=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.type)===n;return{connectingFrom:(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n,connectingTo:p,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:a===jc.Strict?(u==null?void 0:u.type)!==n:e!==(u==null?void 0:u.nodeId)||t!==(u==null?void 0:u.id),connectionInProcess:!!u,clickConnectionInProcess:!!r,valid:p&&f}};function Fse({type:e="source",position:t=ye.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:r=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:d,className:f,onMouseDown:p,onTouchStart:m,...x},y){var W,$;const v=l||null,b=e==="target",w=Nt(),S=H8(),{connectOnClick:E,noPanClassName:k,rfId:_}=et(zse,St),{connectingFrom:R,connectingTo:T,clickConnecting:A,isPossibleEndHandle:M,connectionInProcess:L,clickConnectionInProcess:P,valid:O}=et(Bse(S,v,e),St);S||($=(W=w.getState()).onError)==null||$.call(W,"010",ur.error010());const B=F=>{const{defaultEdgeOptions:G,onConnect:X,hasDefaultEdges:Z}=w.getState(),D={...G,...F};if(Z){const{edges:V,setEdges:ne}=w.getState();ne(fne(D,V))}X==null||X(D),u==null||u(D)},H=F=>{if(!S)return;const G=y8(F.nativeEvent);if(r&&(G&&F.button===0||!G)){const X=w.getState();QN.onPointerDown(F.nativeEvent,{handleDomNode:F.currentTarget,autoPanOnConnect:X.autoPanOnConnect,connectionMode:X.connectionMode,connectionRadius:X.connectionRadius,domNode:X.domNode,nodeLookup:X.nodeLookup,lib:X.lib,isTarget:b,handleId:v,nodeId:S,flowId:X.rfId,panBy:X.panBy,cancelConnection:X.cancelConnection,onConnectStart:X.onConnectStart,onConnectEnd:(...Z)=>{var D,V;return(V=(D=w.getState()).onConnectEnd)==null?void 0:V.call(D,...Z)},updateConnection:X.updateConnection,onConnect:B,isValidConnection:n||((...Z)=>{var D,V;return((V=(D=w.getState()).isValidConnection)==null?void 0:V.call(D,...Z))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:X.autoPanSpeed,dragThreshold:X.connectionDragThreshold})}G?p==null||p(F):m==null||m(F)},z=F=>{const{onClickConnectStart:G,onClickConnectEnd:X,connectionClickStartHandle:Z,connectionMode:D,isValidConnection:V,lib:ne,rfId:U,nodeLookup:Q,connection:K}=w.getState();if(!S||!Z&&!r)return;if(!Z){G==null||G(F.nativeEvent,{nodeId:S,handleId:v,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:S,type:e,id:v}});return}const te=g8(F.target),re=n||V,{connection:oe,isValid:pe}=QN.isValid(F.nativeEvent,{handle:{nodeId:S,id:v,type:e},connectionMode:D,fromNodeId:Z.nodeId,fromHandleId:Z.id||null,fromType:Z.type,isValidConnection:re,flowId:U,doc:te,lib:ne,nodeLookup:Q});pe&&oe&&B(oe);const ge=structuredClone(K);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,X==null||X(F,ge),w.setState({connectionClickStartHandle:null})};return i.jsx("div",{"data-handleid":v,"data-nodeid":S,"data-handlepos":t,"data-id":`${_}-${S}-${v}-${e}`,className:Vt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",k,f,{source:!b,target:b,connectable:s,connectablestart:r,connectableend:a,clickconnecting:A,connectingfrom:R,connectingto:T,valid:O,connectionindicator:s&&(!L||M)&&(L||P?a:r)}]),onMouseDown:H,onTouchStart:H,onClick:E?z:void 0,ref:y,...x,children:d})}const bn=C.memo(q8(Fse));function Hse({data:e,isConnectable:t,sourcePosition:n=ye.Bottom}){return i.jsxs(i.Fragment,{children:[e==null?void 0:e.label,i.jsx(bn,{type:"source",position:n,isConnectable:t})]})}function Use({data:e,isConnectable:t,targetPosition:n=ye.Top,sourcePosition:s=ye.Bottom}){return i.jsxs(i.Fragment,{children:[i.jsx(bn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,i.jsx(bn,{type:"source",position:s,isConnectable:t})]})}function Vse(){return null}function Gse({data:e,isConnectable:t,targetPosition:n=ye.Top}){return i.jsxs(i.Fragment,{children:[i.jsx(bn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Lm={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aM={input:Hse,default:Use,output:Gse,group:Vse};function Kse(e){var t,n,s,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((s=e.style)==null?void 0:s.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const Wse=e=>{const{width:t,height:n,x:s,y:r}=ff(e.nodeLookup,{filter:a=>!!a.selected});return{width:Ds(t)?t:null,height:Ds(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${r}px)`}};function Yse({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=Nt(),{width:r,height:a,transformString:l,userSelectionActive:u}=et(Wse,St),d=F8(),f=C.useRef(null);C.useEffect(()=>{var y;n||(y=f.current)==null||y.focus({preventScroll:!0})},[n]);const p=!u&&r!==null&&a!==null;if(B8({nodeRef:f,disabled:!p}),!p)return null;const m=e?y=>{const v=s.getState().nodes.filter(b=>b.selected);e(y,v)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(Lm,y.key)&&(y.preventDefault(),d({direction:Lm[y.key],factor:y.shiftKey?4:1}))};return i.jsx("div",{className:Vt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:i.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:r,height:a}})})}const oM=typeof window<"u"?window:void 0,Qse=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function U8({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:u,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:p,selectionMode:m,onSelectionStart:x,onSelectionEnd:y,multiSelectionKeyCode:v,panActivationKeyCode:b,zoomActivationKeyCode:w,elementsSelectable:S,zoomOnScroll:E,zoomOnPinch:k,panOnScroll:_,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:A,panOnDrag:M,defaultViewport:L,translateExtent:P,minZoom:O,maxZoom:B,preventScrolling:H,onSelectionContextMenu:z,noWheelClassName:W,noPanClassName:$,disableKeyboardA11y:F,onViewportChange:G,isControlledViewport:X}){const{nodesSelectionActive:Z,userSelectionActive:D}=et(Qse,St),V=qd(f,{target:oM}),ne=qd(b,{target:oM}),U=ne||M,Q=ne||_,K=p&&U!==!0,te=V||D||K;return Ase({deleteKeyCode:d,multiSelectionKeyCode:v}),i.jsx(Mse,{onPaneContextMenu:a,elementsSelectable:S,zoomOnScroll:E,zoomOnPinch:k,panOnScroll:Q,panOnScrollSpeed:R,panOnScrollMode:T,zoomOnDoubleClick:A,panOnDrag:!V&&U,defaultViewport:L,translateExtent:P,minZoom:O,maxZoom:B,zoomActivationKeyCode:w,preventScrolling:H,noWheelClassName:W,noPanClassName:$,onViewportChange:G,isControlledViewport:X,paneClickDistance:u,selectionOnDrag:K,children:i.jsxs($se,{onSelectionStart:x,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:r,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:U,isSelecting:!!te,selectionMode:m,selectionKeyPressed:V,paneClickDistance:u,selectionOnDrag:K,children:[e,Z&&i.jsx(Yse,{onSelectionContextMenu:z,noPanClassName:$,disableKeyboardA11y:F})]})})}U8.displayName="FlowRenderer";const Xse=C.memo(U8),Zse=e=>t=>e?$k(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Jse(e){return et(C.useCallback(Zse(e),[e]),St)}const ere=e=>e.updateNodeInternals;function tre(){const e=et(ere),[t]=C.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const s=new Map;n.forEach(r=>{const a=r.target.getAttribute("data-id");s.set(a,{id:a,nodeElement:r.target,force:!0})}),e(s)}));return C.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function nre({node:e,nodeType:t,hasDimensions:n,resizeObserver:s}){const r=Nt(),a=C.useRef(null),l=C.useRef(null),u=C.useRef(e.sourcePosition),d=C.useRef(e.targetPosition),f=C.useRef(t),p=n&&!!e.internals.handleBounds;return C.useEffect(()=>{a.current&&!e.hidden&&(!p||l.current!==a.current)&&(l.current&&(s==null||s.unobserve(l.current)),s==null||s.observe(a.current),l.current=a.current)},[p,e.hidden]),C.useEffect(()=>()=>{l.current&&(s==null||s.unobserve(l.current),l.current=null)},[]),C.useEffect(()=>{if(a.current){const m=f.current!==t,x=u.current!==e.sourcePosition,y=d.current!==e.targetPosition;(m||x||y)&&(f.current=t,u.current=e.sourcePosition,d.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function sre({id:e,onClick:t,onMouseEnter:n,onMouseMove:s,onMouseLeave:r,onContextMenu:a,onDoubleClick:l,nodesDraggable:u,elementsSelectable:d,nodesConnectable:f,nodesFocusable:p,resizeObserver:m,noDragClassName:x,noPanClassName:y,disableKeyboardA11y:v,rfId:b,nodeTypes:w,nodeClickDistance:S,onError:E}){const{node:k,internals:_,isParent:R}=et(re=>{const oe=re.nodeLookup.get(e),pe=re.parentLookup.has(e);return{node:oe,internals:oe.internals,isParent:pe}},St);let T=k.type||"default",A=(w==null?void 0:w[T])||aM[T];A===void 0&&(E==null||E("003",ur.error003(T)),T="default",A=(w==null?void 0:w.default)||aM.default);const M=!!(k.draggable||u&&typeof k.draggable>"u"),L=!!(k.selectable||d&&typeof k.selectable>"u"),P=!!(k.connectable||f&&typeof k.connectable>"u"),O=!!(k.focusable||p&&typeof k.focusable>"u"),B=Nt(),H=p8(k),z=nre({node:k,nodeType:T,hasDimensions:H,resizeObserver:m}),W=B8({nodeRef:z,disabled:k.hidden||!M,noDragClassName:x,handleSelector:k.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:S}),$=F8();if(k.hidden)return null;const F=ti(k),G=Kse(k),X=L||M||t||n||s||r,Z=n?re=>n(re,{..._.userNode}):void 0,D=s?re=>s(re,{..._.userNode}):void 0,V=r?re=>r(re,{..._.userNode}):void 0,ne=a?re=>a(re,{..._.userNode}):void 0,U=l?re=>l(re,{..._.userNode}):void 0,Q=re=>{const{selectNodesOnDrag:oe,nodeDragThreshold:pe}=B.getState();L&&(!oe||!M||pe>0)&&XN({id:e,store:B,nodeRef:z}),t&&t(re,{..._.userNode})},K=re=>{if(!(x8(re.nativeEvent)||v)){if(i8.includes(re.key)&&L){const oe=re.key==="Escape";XN({id:e,store:B,unselect:oe,nodeRef:z})}else if(M&&k.selected&&Object.prototype.hasOwnProperty.call(Lm,re.key)){re.preventDefault();const{ariaLabelConfig:oe}=B.getState();B.setState({ariaLiveMessage:oe["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),$({direction:Lm[re.key],factor:re.shiftKey?4:1})}}},te=()=>{var Ne;if(v||!((Ne=z.current)!=null&&Ne.matches(":focus-visible")))return;const{transform:re,width:oe,height:pe,autoPanOnNodeFocus:ge,setCenter:ve}=B.getState();if(!ge)return;$k(new Map([[e,k]]),{x:0,y:0,width:oe,height:pe},re,!0).length>0||ve(k.position.x+F.width/2,k.position.y+F.height/2,{zoom:re[2]})};return i.jsx("div",{className:Vt(["react-flow__node",`react-flow__node-${T}`,{[y]:M},k.className,{selected:k.selected,selectable:L,parent:R,draggable:M,dragging:W}]),ref:z,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:X?"all":"none",visibility:H?"visible":"hidden",...k.style,...G},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Z,onMouseMove:D,onMouseLeave:V,onContextMenu:ne,onClick:Q,onDoubleClick:U,onKeyDown:O?K:void 0,tabIndex:O?0:void 0,onFocus:O?te:void 0,role:k.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":v?void 0:`${L8}-${b}`,"aria-label":k.ariaLabel,...k.domAttributes,children:i.jsx(qse,{value:e,children:i.jsx(A,{id:e,data:k.data,type:T,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:k.selected??!1,selectable:L,draggable:M,deletable:k.deletable??!0,isConnectable:P,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:W,dragHandle:k.dragHandle,zIndex:_.z,parentId:k.parentId,...F})})})}var rre=C.memo(sre);const ire=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function V8(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:r,onError:a}=et(ire,St),l=Jse(e.onlyRenderVisibleElements),u=tre();return i.jsx("div",{className:"react-flow__nodes",style:Lg,children:l.map(d=>i.jsx(rre,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:u,nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},d))})}V8.displayName="NodeRenderer";const are=C.memo(V8);function ore(e){return et(C.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const s=[];if(n.width&&n.height)for(const r of n.edges){const a=n.nodeLookup.get(r.source),l=n.nodeLookup.get(r.target);a&&l&&cne({sourceNode:a,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&s.push(r.id)}return s},[e]),St)}const lre=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return i.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},cre=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return i.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},lM={[Sc.Arrow]:lre,[Sc.ArrowClosed]:cre};function ure(e){const t=Nt();return C.useMemo(()=>{var r,a;return Object.prototype.hasOwnProperty.call(lM,e)?lM[e]:((a=(r=t.getState()).onError)==null||a.call(r,"009",ur.error009(e)),null)},[e])}const dre=({id:e,type:t,color:n,width:s=12.5,height:r=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const d=ure(t);return d?i.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0",children:i.jsx(d,{color:n,strokeWidth:l})}):null},G8=({defaultColor:e,rfId:t})=>{const n=et(a=>a.edges),s=et(a=>a.defaultEdgeOptions),r=C.useMemo(()=>xne(n,{id:t,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[n,s,t,e]);return r.length?i.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:i.jsx("defs",{children:r.map(a=>i.jsx(dre,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};G8.displayName="MarkerDefinitions";var fre=C.memo(G8);function K8({x:e,y:t,label:n,labelStyle:s,labelShowBg:r=!0,labelBgStyle:a,labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:d,className:f,...p}){const[m,x]=C.useState({x:1,y:0,width:0,height:0}),y=Vt(["react-flow__edge-textwrapper",f]),v=C.useRef(null);return C.useEffect(()=>{if(v.current){const b=v.current.getBBox();x({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?i.jsxs("g",{transform:`translate(${e-m.width/2} ${t-m.height/2})`,className:y,visibility:m.width?"visible":"hidden",...p,children:[r&&i.jsx("rect",{width:m.width+2*l[0],x:-l[0],y:-l[1],height:m.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),i.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:v,style:s,children:n}),d]}):null}K8.displayName="EdgeText";const hre=C.memo(K8);function gf({path:e,labelX:t,labelY:n,label:s,labelStyle:r,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,interactionWidth:f=20,...p}){return i.jsxs(i.Fragment,{children:[i.jsx("path",{...p,d:e,fill:"none",className:Vt(["react-flow__edge-path",p.className])}),f?i.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,s&&Ds(t)&&Ds(n)?i.jsx(hre,{x:t,y:n,label:s,labelStyle:r,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function cM({pos:e,x1:t,y1:n,x2:s,y2:r}){return e===ye.Left||e===ye.Right?[.5*(t+s),n]:[t,.5*(n+r)]}function W8({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:s,targetY:r,targetPosition:a=ye.Top}){const[l,u]=cM({pos:n,x1:e,y1:t,x2:s,y2:r}),[d,f]=cM({pos:a,x1:s,y1:r,x2:e,y2:t}),[p,m,x,y]=v8({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${u} ${d},${f} ${s},${r}`,p,m,x,y]}function Y8(e){return C.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,sourcePosition:l,targetPosition:u,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,markerEnd:b,markerStart:w,interactionWidth:S})=>{const[E,k,_]=W8({sourceX:n,sourceY:s,sourcePosition:l,targetX:r,targetY:a,targetPosition:u}),R=e.isInternal?void 0:t;return i.jsx(gf,{id:R,path:E,labelX:k,labelY:_,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,markerEnd:b,markerStart:w,interactionWidth:S})})}const pre=Y8({isInternal:!1}),Q8=Y8({isInternal:!0});pre.displayName="SimpleBezierEdge";Q8.displayName="SimpleBezierEdgeInternal";function X8(e){return C.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:x,sourcePosition:y=ye.Bottom,targetPosition:v=ye.Top,markerEnd:b,markerStart:w,pathOptions:S,interactionWidth:E})=>{const[k,_,R]=KN({sourceX:n,sourceY:s,sourcePosition:y,targetX:r,targetY:a,targetPosition:v,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),T=e.isInternal?void 0:t;return i.jsx(gf,{id:T,path:k,labelX:_,labelY:R,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:b,markerStart:w,interactionWidth:E})})}const Z8=X8({isInternal:!1}),J8=X8({isInternal:!0});Z8.displayName="SmoothStepEdge";J8.displayName="SmoothStepEdgeInternal";function eq(e){return C.memo(({id:t,...n})=>{var r;const s=e.isInternal?void 0:t;return i.jsx(Z8,{...n,id:s,pathOptions:C.useMemo(()=>{var a;return{borderRadius:0,offset:(a=n.pathOptions)==null?void 0:a.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const mre=eq({isInternal:!1}),tq=eq({isInternal:!0});mre.displayName="StepEdge";tq.displayName="StepEdgeInternal";function nq(e){return C.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:y,markerStart:v,interactionWidth:b})=>{const[w,S,E]=w8({sourceX:n,sourceY:s,targetX:r,targetY:a}),k=e.isInternal?void 0:t;return i.jsx(gf,{id:k,path:w,labelX:S,labelY:E,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:y,markerStart:v,interactionWidth:b})})}const gre=nq({isInternal:!1}),sq=nq({isInternal:!0});gre.displayName="StraightEdge";sq.displayName="StraightEdgeInternal";function rq(e){return C.memo(({id:t,sourceX:n,sourceY:s,targetX:r,targetY:a,sourcePosition:l=ye.Bottom,targetPosition:u=ye.Top,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,markerEnd:b,markerStart:w,pathOptions:S,interactionWidth:E})=>{const[k,_,R]=zk({sourceX:n,sourceY:s,sourcePosition:l,targetX:r,targetY:a,targetPosition:u,curvature:S==null?void 0:S.curvature}),T=e.isInternal?void 0:t;return i.jsx(gf,{id:T,path:k,labelX:_,labelY:R,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,markerEnd:b,markerStart:w,interactionWidth:E})})}const xre=rq({isInternal:!1}),iq=rq({isInternal:!0});xre.displayName="BezierEdge";iq.displayName="BezierEdgeInternal";const uM={default:iq,straight:sq,step:tq,smoothstep:J8,simplebezier:Q8},dM={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},yre=(e,t,n)=>n===ye.Left?e-t:n===ye.Right?e+t:e,vre=(e,t,n)=>n===ye.Top?e-t:n===ye.Bottom?e+t:e,fM="react-flow__edgeupdater";function hM({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:r,onMouseEnter:a,onMouseOut:l,type:u}){return i.jsx("circle",{onMouseDown:r,onMouseEnter:a,onMouseOut:l,className:Vt([fM,`${fM}-${u}`]),cx:yre(t,s,e),cy:vre(n,s,e),r:s,stroke:"transparent",fill:"transparent"})}function bre({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:s,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,setReconnecting:x,setUpdateHover:y}){const v=Nt(),b=(_,R)=>{if(_.button!==0)return;const{autoPanOnConnect:T,domNode:A,connectionMode:M,connectionRadius:L,lib:P,onConnectStart:O,cancelConnection:B,nodeLookup:H,rfId:z,panBy:W,updateConnection:$}=v.getState(),F=R.type==="target",G=(D,V)=>{x(!1),m==null||m(D,n,R.type,V)},X=D=>f==null?void 0:f(n,D),Z=(D,V)=>{x(!0),p==null||p(_,n,R.type),O==null||O(D,V)};QN.onPointerDown(_.nativeEvent,{autoPanOnConnect:T,connectionMode:M,connectionRadius:L,domNode:A,handleId:R.id,nodeId:R.nodeId,nodeLookup:H,isTarget:F,edgeUpdaterType:R.type,lib:P,flowId:z,cancelConnection:B,panBy:W,isValidConnection:(...D)=>{var V,ne;return((ne=(V=v.getState()).isValidConnection)==null?void 0:ne.call(V,...D))??!0},onConnect:X,onConnectStart:Z,onConnectEnd:(...D)=>{var V,ne;return(ne=(V=v.getState()).onConnectEnd)==null?void 0:ne.call(V,...D)},onReconnectEnd:G,updateConnection:$,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,dragThreshold:v.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},w=_=>b(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=_=>b(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>y(!0),k=()=>y(!1);return i.jsxs(i.Fragment,{children:[(e===!0||e==="source")&&i.jsx(hM,{position:u,centerX:s,centerY:r,radius:t,onMouseDown:w,onMouseEnter:E,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&i.jsx(hM,{position:d,centerX:a,centerY:l,radius:t,onMouseDown:S,onMouseEnter:E,onMouseOut:k,type:"target"})]})}function wre({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:s,onClick:r,onDoubleClick:a,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,reconnectRadius:p,onReconnect:m,onReconnectStart:x,onReconnectEnd:y,rfId:v,edgeTypes:b,noPanClassName:w,onError:S,disableKeyboardA11y:E}){let k=et(ve=>ve.edgeLookup.get(e));const _=et(ve=>ve.defaultEdgeOptions);k=_?{..._,...k}:k;let R=k.type||"default",T=(b==null?void 0:b[R])||uM[R];T===void 0&&(S==null||S("011",ur.error011(R)),R="default",T=(b==null?void 0:b.default)||uM.default);const A=!!(k.focusable||t&&typeof k.focusable>"u"),M=typeof m<"u"&&(k.reconnectable||n&&typeof k.reconnectable>"u"),L=!!(k.selectable||s&&typeof k.selectable>"u"),P=C.useRef(null),[O,B]=C.useState(!1),[H,z]=C.useState(!1),W=Nt(),{zIndex:$,sourceX:F,sourceY:G,targetX:X,targetY:Z,sourcePosition:D,targetPosition:V}=et(C.useCallback(ve=>{const xe=ve.nodeLookup.get(k.source),Ne=ve.nodeLookup.get(k.target);if(!xe||!Ne)return{zIndex:k.zIndex,...dM};const we=gne({id:e,sourceNode:xe,targetNode:Ne,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ve.connectionMode,onError:S});return{zIndex:lne({selected:k.selected,zIndex:k.zIndex,sourceNode:xe,targetNode:Ne,elevateOnSelect:ve.elevateEdgesOnSelect,zIndexMode:ve.zIndexMode}),...we||dM}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),St),ne=C.useMemo(()=>k.markerStart?`url('#${WN(k.markerStart,v)}')`:void 0,[k.markerStart,v]),U=C.useMemo(()=>k.markerEnd?`url('#${WN(k.markerEnd,v)}')`:void 0,[k.markerEnd,v]);if(k.hidden||F===null||G===null||X===null||Z===null)return null;const Q=ve=>{var De;const{addSelectedEdges:xe,unselectNodesAndEdges:Ne,multiSelectionActive:we}=W.getState();L&&(W.setState({nodesSelectionActive:!1}),k.selected&&we?(Ne({nodes:[],edges:[k]}),(De=P.current)==null||De.blur()):xe([e])),r&&r(ve,k)},K=a?ve=>{a(ve,{...k})}:void 0,te=l?ve=>{l(ve,{...k})}:void 0,re=u?ve=>{u(ve,{...k})}:void 0,oe=d?ve=>{d(ve,{...k})}:void 0,pe=f?ve=>{f(ve,{...k})}:void 0,ge=ve=>{var xe;if(!E&&i8.includes(ve.key)&&L){const{unselectNodesAndEdges:Ne,addSelectedEdges:we}=W.getState();ve.key==="Escape"?((xe=P.current)==null||xe.blur(),Ne({edges:[k]})):we([e])}};return i.jsx("svg",{style:{zIndex:$},children:i.jsxs("g",{className:Vt(["react-flow__edge",`react-flow__edge-${R}`,k.className,w,{selected:k.selected,animated:k.animated,inactive:!L&&!r,updating:O,selectable:L}]),onClick:Q,onDoubleClick:K,onContextMenu:te,onMouseEnter:re,onMouseMove:oe,onMouseLeave:pe,onKeyDown:A?ge:void 0,tabIndex:A?0:void 0,role:k.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":A?`${P8}-${v}`:void 0,ref:P,...k.domAttributes,children:[!H&&i.jsx(T,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:L,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:F,sourceY:G,targetX:X,targetY:Z,sourcePosition:D,targetPosition:V,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:ne,markerEnd:U,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),M&&i.jsx(bre,{edge:k,isReconnectable:M,reconnectRadius:p,onReconnect:m,onReconnectStart:x,onReconnectEnd:y,sourceX:F,sourceY:G,targetX:X,targetY:Z,sourcePosition:D,targetPosition:V,setUpdateHover:B,setReconnecting:z})]})})}var jre=C.memo(wre);const Sre=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function aq({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:s,noPanClassName:r,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:m,onEdgeDoubleClick:x,onReconnectStart:y,onReconnectEnd:v,disableKeyboardA11y:b}){const{edgesFocusable:w,edgesReconnectable:S,elementsSelectable:E,onError:k}=et(Sre,St),_=ore(t);return i.jsxs("div",{className:"react-flow__edges",children:[i.jsx(fre,{defaultColor:e,rfId:n}),_.map(R=>i.jsx(jre,{id:R,edgesFocusable:w,edgesReconnectable:S,elementsSelectable:E,noPanClassName:r,onReconnect:a,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onClick:p,reconnectRadius:m,onDoubleClick:x,onReconnectStart:y,onReconnectEnd:v,rfId:n,onError:k,edgeTypes:s,disableKeyboardA11y:b},R))]})}aq.displayName="EdgeRenderer";const Nre=C.memo(aq),kre=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function _re({children:e}){const t=et(kre);return i.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Cre(e){const t=Og(),n=C.useRef(!1);C.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Ere=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Rre(e){const t=et(Ere),n=Nt();return C.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Are(e){return e.connection.inProgress?{...e.connection,to:pf(e.connection.to,e.transform)}:{...e.connection}}function Tre(e){return Are}function Ire(e){const t=Tre();return et(t,St)}const Mre=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ore({containerStyle:e,style:t,type:n,component:s}){const{nodesConnectable:r,width:a,height:l,isValid:u,inProgress:d}=et(Mre,St);return!(a&&r&&d)?null:i.jsx("svg",{style:e,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:i.jsx("g",{className:Vt(["react-flow__connection",l8(u)]),children:i.jsx(oq,{style:t,type:n,CustomComponent:s,isValid:u})})})}const oq=({style:e,type:t=Vi.Bezier,CustomComponent:n,isValid:s})=>{const{inProgress:r,from:a,fromNode:l,fromHandle:u,fromPosition:d,to:f,toNode:p,toHandle:m,toPosition:x,pointer:y}=Ire();if(!r)return;if(n)return i.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:u,fromX:a.x,fromY:a.y,toX:f.x,toY:f.y,fromPosition:d,toPosition:x,connectionStatus:l8(s),toNode:p,toHandle:m,pointer:y});let v="";const b={sourceX:a.x,sourceY:a.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:x};switch(t){case Vi.Bezier:[v]=zk(b);break;case Vi.SimpleBezier:[v]=W8(b);break;case Vi.Step:[v]=KN({...b,borderRadius:0});break;case Vi.SmoothStep:[v]=KN(b);break;default:[v]=w8(b)}return i.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:e})};oq.displayName="ConnectionLine";const Lre={};function pM(e=Lre){C.useRef(e),Nt(),C.useEffect(()=>{},[e])}function Pre(){Nt(),C.useRef(!1),C.useEffect(()=>{},[])}function lq({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:s,onEdgeClick:r,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:x,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:S,selectionKeyCode:E,selectionOnDrag:k,selectionMode:_,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:A,deleteKeyCode:M,onlyRenderVisibleElements:L,elementsSelectable:P,defaultViewport:O,translateExtent:B,minZoom:H,maxZoom:z,preventScrolling:W,defaultMarkerColor:$,zoomOnScroll:F,zoomOnPinch:G,panOnScroll:X,panOnScrollSpeed:Z,panOnScrollMode:D,zoomOnDoubleClick:V,panOnDrag:ne,onPaneClick:U,onPaneMouseEnter:Q,onPaneMouseMove:K,onPaneMouseLeave:te,onPaneScroll:re,onPaneContextMenu:oe,paneClickDistance:pe,nodeClickDistance:ge,onEdgeContextMenu:ve,onEdgeMouseEnter:xe,onEdgeMouseMove:Ne,onEdgeMouseLeave:we,reconnectRadius:De,onReconnect:Ee,onReconnectStart:Ct,onReconnectEnd:ut,noDragClassName:jn,noWheelClassName:tn,noPanClassName:Xt,disableKeyboardA11y:yt,nodeExtent:Oe,rfId:mt,viewport:Kt,onViewportChange:Kn}){return pM(e),pM(t),Pre(),Cre(n),Rre(Kt),i.jsx(Xse,{onPaneClick:U,onPaneMouseEnter:Q,onPaneMouseMove:K,onPaneMouseLeave:te,onPaneContextMenu:oe,onPaneScroll:re,paneClickDistance:pe,deleteKeyCode:M,selectionKeyCode:E,selectionOnDrag:k,selectionMode:_,onSelectionStart:x,onSelectionEnd:y,multiSelectionKeyCode:R,panActivationKeyCode:T,zoomActivationKeyCode:A,elementsSelectable:P,zoomOnScroll:F,zoomOnPinch:G,zoomOnDoubleClick:V,panOnScroll:X,panOnScrollSpeed:Z,panOnScrollMode:D,panOnDrag:ne,defaultViewport:O,translateExtent:B,minZoom:H,maxZoom:z,onSelectionContextMenu:m,preventScrolling:W,noDragClassName:jn,noWheelClassName:tn,noPanClassName:Xt,disableKeyboardA11y:yt,onViewportChange:Kn,isControlledViewport:!!Kt,children:i.jsxs(_re,{children:[i.jsx(Nre,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:l,onReconnect:Ee,onReconnectStart:Ct,onReconnectEnd:ut,onlyRenderVisibleElements:L,onEdgeContextMenu:ve,onEdgeMouseEnter:xe,onEdgeMouseMove:Ne,onEdgeMouseLeave:we,reconnectRadius:De,defaultMarkerColor:$,noPanClassName:Xt,disableKeyboardA11y:yt,rfId:mt}),i.jsx(Ore,{style:b,type:v,component:w,containerStyle:S}),i.jsx("div",{className:"react-flow__edgelabel-renderer"}),i.jsx(are,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:ge,onlyRenderVisibleElements:L,noPanClassName:Xt,noDragClassName:jn,disableKeyboardA11y:yt,nodeExtent:Oe,rfId:mt}),i.jsx("div",{className:"react-flow__viewport-portal"})]})})}lq.displayName="GraphView";const $re=C.memo(lq),mM=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:a,fitView:l,fitViewOptions:u,minZoom:d=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:m,zIndexMode:x="basic"}={})=>{const y=new Map,v=new Map,b=new Map,w=new Map,S=s??t??[],E=n??e??[],k=p??[0,0],_=m??Ld;N8(b,w,S);const R=YN(E,y,v,{nodeOrigin:k,nodeExtent:_,zIndexMode:x});let T=[0,0,1];if(l&&r&&a){const A=ff(y,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:M,y:L,zoom:P}=Dk(A,r,a,d,f,(u==null?void 0:u.padding)??.1);T=[M,L,P]}return{rfId:"1",width:r??0,height:a??0,transform:T,nodes:E,nodesInitialized:R,nodeLookup:y,parentLookup:v,edges:S,edgeLookup:w,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:Ld,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:jc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:u,fitViewResolver:null,connection:{...o8},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:nne,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:a8,zIndexMode:x,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Dre=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:m,zIndexMode:x})=>ese((y,v)=>{async function b(){const{nodeLookup:w,panZoom:S,fitViewOptions:E,fitViewResolver:k,width:_,height:R,minZoom:T,maxZoom:A}=v();S&&(await ene({nodes:w,width:_,height:R,panZoom:S,minZoom:T,maxZoom:A},E),k==null||k.resolve(!0),y({fitViewResolver:null}))}return{...mM({nodes:e,edges:t,width:r,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:m,defaultNodes:n,defaultEdges:s,zIndexMode:x}),setNodes:w=>{const{nodeLookup:S,parentLookup:E,nodeOrigin:k,elevateNodesOnSelect:_,fitViewQueued:R,zIndexMode:T}=v(),A=YN(w,S,E,{nodeOrigin:k,nodeExtent:m,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:T});R&&A?(b(),y({nodes:w,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0})):y({nodes:w,nodesInitialized:A})},setEdges:w=>{const{connectionLookup:S,edgeLookup:E}=v();N8(S,E,w),y({edges:w})},setDefaultNodesAndEdges:(w,S)=>{if(w){const{setNodes:E}=v();E(w),y({hasDefaultNodes:!0})}if(S){const{setEdges:E}=v();E(S),y({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:S,nodeLookup:E,parentLookup:k,domNode:_,nodeOrigin:R,nodeExtent:T,debug:A,fitViewQueued:M,zIndexMode:L}=v(),{changes:P,updatedInternals:O}=Nne(w,E,k,_,R,T,L);O&&(bne(E,k,{nodeOrigin:R,nodeExtent:T,zIndexMode:L}),M?(b(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(P==null?void 0:P.length)>0&&(A&&console.log("React Flow: trigger node changes",P),S==null||S(P)))},updateNodePositions:(w,S=!1)=>{const E=[];let k=[];const{nodeLookup:_,triggerNodeChanges:R,connection:T,updateConnection:A,onNodesChangeMiddlewareMap:M}=v();for(const[L,P]of w){const O=_.get(L),B=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&(P!=null&&P.position)),H={id:L,type:"position",position:B?{x:Math.max(0,P.position.x),y:Math.max(0,P.position.y)}:P.position,dragging:S};if(O&&T.inProgress&&T.fromNode.id===O.id){const z=Co(O,T.fromHandle,ye.Left,!0);A({...T,from:z})}B&&O.parentId&&E.push({id:L,parentId:O.parentId,rect:{...P.internals.positionAbsolute,width:P.measured.width??0,height:P.measured.height??0}}),k.push(H)}if(E.length>0){const{parentLookup:L,nodeOrigin:P}=v(),O=Vk(E,_,L,P);k.push(...O)}for(const L of M.values())k=L(k);R(k)},triggerNodeChanges:w=>{const{onNodesChange:S,setNodes:E,nodes:k,hasDefaultNodes:_,debug:R}=v();if(w!=null&&w.length){if(_){const T=wse(w,k);E(T)}R&&console.log("React Flow: trigger node changes",w),S==null||S(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:S,setEdges:E,edges:k,hasDefaultEdges:_,debug:R}=v();if(w!=null&&w.length){if(_){const T=jse(w,k);E(T)}R&&console.log("React Flow: trigger edge changes",w),S==null||S(w)}},addSelectedNodes:w=>{const{multiSelectionActive:S,edgeLookup:E,nodeLookup:k,triggerNodeChanges:_,triggerEdgeChanges:R}=v();if(S){const T=w.map(A=>Ya(A,!0));_(T);return}_(Gl(k,new Set([...w]),!0)),R(Gl(E))},addSelectedEdges:w=>{const{multiSelectionActive:S,edgeLookup:E,nodeLookup:k,triggerNodeChanges:_,triggerEdgeChanges:R}=v();if(S){const T=w.map(A=>Ya(A,!0));R(T);return}R(Gl(E,new Set([...w]))),_(Gl(k,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:S}={})=>{const{edges:E,nodes:k,nodeLookup:_,triggerNodeChanges:R,triggerEdgeChanges:T}=v(),A=w||k,M=S||E,L=[];for(const O of A){if(!O.selected)continue;const B=_.get(O.id);B&&(B.selected=!1),L.push(Ya(O.id,!1))}const P=[];for(const O of M)O.selected&&P.push(Ya(O.id,!1));R(L),T(P)},setMinZoom:w=>{const{panZoom:S,maxZoom:E}=v();S==null||S.setScaleExtent([w,E]),y({minZoom:w})},setMaxZoom:w=>{const{panZoom:S,minZoom:E}=v();S==null||S.setScaleExtent([E,w]),y({maxZoom:w})},setTranslateExtent:w=>{var S;(S=v().panZoom)==null||S.setTranslateExtent(w),y({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:S,triggerNodeChanges:E,triggerEdgeChanges:k,elementsSelectable:_}=v();if(!_)return;const R=S.reduce((A,M)=>M.selected?[...A,Ya(M.id,!1)]:A,[]),T=w.reduce((A,M)=>M.selected?[...A,Ya(M.id,!1)]:A,[]);E(R),k(T)},setNodeExtent:w=>{const{nodes:S,nodeLookup:E,parentLookup:k,nodeOrigin:_,elevateNodesOnSelect:R,nodeExtent:T,zIndexMode:A}=v();w[0][0]===T[0][0]&&w[0][1]===T[0][1]&&w[1][0]===T[1][0]&&w[1][1]===T[1][1]||(YN(S,E,k,{nodeOrigin:_,nodeExtent:w,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:A}),y({nodeExtent:w}))},panBy:w=>{const{transform:S,width:E,height:k,panZoom:_,translateExtent:R}=v();return kne({delta:w,panZoom:_,transform:S,translateExtent:R,width:E,height:k})},setCenter:async(w,S,E)=>{const{width:k,height:_,maxZoom:R,panZoom:T}=v();if(!T)return Promise.resolve(!1);const A=typeof(E==null?void 0:E.zoom)<"u"?E.zoom:R;return await T.setViewport({x:k/2-w*A,y:_/2-S*A,zoom:A},{duration:E==null?void 0:E.duration,ease:E==null?void 0:E.ease,interpolate:E==null?void 0:E.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{y({connection:{...o8}})},updateConnection:w=>{y({connection:w})},reset:()=>y({...mM()})}},Object.is);function qre({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:s,initialWidth:r,initialHeight:a,initialMinZoom:l,initialMaxZoom:u,initialFitViewOptions:d,fitView:f,nodeOrigin:p,nodeExtent:m,zIndexMode:x,children:y}){const[v]=C.useState(()=>Dre({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:r,height:a,fitView:f,minZoom:l,maxZoom:u,fitViewOptions:d,nodeOrigin:p,nodeExtent:m,zIndexMode:x}));return i.jsx(tse,{value:v,children:i.jsx(_se,{children:y})})}function zre({children:e,nodes:t,edges:n,defaultNodes:s,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:f,maxZoom:p,nodeOrigin:m,nodeExtent:x,zIndexMode:y}){return C.useContext(Mg)?i.jsx(i.Fragment,{children:e}):i.jsx(qre,{initialNodes:t,initialEdges:n,defaultNodes:s,defaultEdges:r,initialWidth:a,initialHeight:l,fitView:u,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:m,nodeExtent:x,zIndexMode:y,children:e})}const Bre={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Fre({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:r,nodeTypes:a,edgeTypes:l,onNodeClick:u,onEdgeClick:d,onInit:f,onMove:p,onMoveStart:m,onMoveEnd:x,onConnect:y,onConnectStart:v,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:S,onNodeMouseEnter:E,onNodeMouseMove:k,onNodeMouseLeave:_,onNodeContextMenu:R,onNodeDoubleClick:T,onNodeDragStart:A,onNodeDrag:M,onNodeDragStop:L,onNodesDelete:P,onEdgesDelete:O,onDelete:B,onSelectionChange:H,onSelectionDragStart:z,onSelectionDrag:W,onSelectionDragStop:$,onSelectionContextMenu:F,onSelectionStart:G,onSelectionEnd:X,onBeforeDelete:Z,connectionMode:D,connectionLineType:V=Vi.Bezier,connectionLineStyle:ne,connectionLineComponent:U,connectionLineContainerStyle:Q,deleteKeyCode:K="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:re=!1,selectionMode:oe=Pd.Full,panActivationKeyCode:pe="Space",multiSelectionKeyCode:ge=Dd()?"Meta":"Control",zoomActivationKeyCode:ve=Dd()?"Meta":"Control",snapToGrid:xe,snapGrid:Ne,onlyRenderVisibleElements:we=!1,selectNodesOnDrag:De,nodesDraggable:Ee,autoPanOnNodeFocus:Ct,nodesConnectable:ut,nodesFocusable:jn,nodeOrigin:tn=$8,edgesFocusable:Xt,edgesReconnectable:yt,elementsSelectable:Oe=!0,defaultViewport:mt=pse,minZoom:Kt=.5,maxZoom:Kn=2,translateExtent:An=Ld,preventScrolling:qo=!0,nodeExtent:pr,defaultMarkerColor:qc="#b1b1b7",zoomOnScroll:zo=!0,zoomOnPinch:fn=!0,panOnScroll:_t=!1,panOnScrollSpeed:Ks=.5,panOnScrollMode:Sn=vo.Free,zoomOnDoubleClick:ux=!0,panOnDrag:dx=!0,onPaneClick:fx,onPaneMouseEnter:Bo,onPaneMouseMove:Fo,onPaneMouseLeave:Ho,onPaneScroll:mr,onPaneContextMenu:Uo,paneClickDistance:Sa=1,nodeClickDistance:hx=0,children:Rf,onReconnect:zc,onReconnectStart:Na,onReconnectEnd:px,onEdgeContextMenu:Af,onEdgeDoubleClick:Tf,onEdgeMouseEnter:If,onEdgeMouseMove:Bc,onEdgeMouseLeave:Fc,reconnectRadius:Mf=10,onNodesChange:Of,onEdgesChange:Ws,noDragClassName:Wt="nodrag",noWheelClassName:hn="nowheel",noPanClassName:gr="nopan",fitView:Vo,fitViewOptions:Lf,connectOnClick:mx,attributionPosition:Pf,proOptions:ka,defaultEdgeOptions:Hc,elevateNodesOnSelect:ii=!0,elevateEdgesOnSelect:ai=!1,disableKeyboardA11y:oi=!1,autoPanOnConnect:li,autoPanOnNodeDrag:qt,autoPanSpeed:$f,connectionRadius:Df,isValidConnection:xr,onError:ci,style:gx,id:Uc,nodeDragThreshold:qf,connectionDragThreshold:xx,viewport:Go,onViewportChange:Ko,width:Cs,height:Tn,colorMode:zf="light",debug:yx,onScroll:ui,ariaLabelConfig:Bf,zIndexMode:_a="basic",...vx},In){const Ca=Uc||"1",Ff=yse(zf),Vc=C.useCallback(yr=>{yr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ui==null||ui(yr)},[ui]);return i.jsx("div",{"data-testid":"rf__wrapper",...vx,onScroll:Vc,style:{...gx,...Bre},ref:In,className:Vt(["react-flow",r,Ff]),id:Uc,role:"application",children:i.jsxs(zre,{nodes:e,edges:t,width:Cs,height:Tn,fitView:Vo,fitViewOptions:Lf,minZoom:Kt,maxZoom:Kn,nodeOrigin:tn,nodeExtent:pr,zIndexMode:_a,children:[i.jsx($re,{onInit:f,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:E,onNodeMouseMove:k,onNodeMouseLeave:_,onNodeContextMenu:R,onNodeDoubleClick:T,nodeTypes:a,edgeTypes:l,connectionLineType:V,connectionLineStyle:ne,connectionLineComponent:U,connectionLineContainerStyle:Q,selectionKeyCode:te,selectionOnDrag:re,selectionMode:oe,deleteKeyCode:K,multiSelectionKeyCode:ge,panActivationKeyCode:pe,zoomActivationKeyCode:ve,onlyRenderVisibleElements:we,defaultViewport:mt,translateExtent:An,minZoom:Kt,maxZoom:Kn,preventScrolling:qo,zoomOnScroll:zo,zoomOnPinch:fn,zoomOnDoubleClick:ux,panOnScroll:_t,panOnScrollSpeed:Ks,panOnScrollMode:Sn,panOnDrag:dx,onPaneClick:fx,onPaneMouseEnter:Bo,onPaneMouseMove:Fo,onPaneMouseLeave:Ho,onPaneScroll:mr,onPaneContextMenu:Uo,paneClickDistance:Sa,nodeClickDistance:hx,onSelectionContextMenu:F,onSelectionStart:G,onSelectionEnd:X,onReconnect:zc,onReconnectStart:Na,onReconnectEnd:px,onEdgeContextMenu:Af,onEdgeDoubleClick:Tf,onEdgeMouseEnter:If,onEdgeMouseMove:Bc,onEdgeMouseLeave:Fc,reconnectRadius:Mf,defaultMarkerColor:qc,noDragClassName:Wt,noWheelClassName:hn,noPanClassName:gr,rfId:Ca,disableKeyboardA11y:oi,nodeExtent:pr,viewport:Go,onViewportChange:Ko}),i.jsx(xse,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:y,onConnectStart:v,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:S,nodesDraggable:Ee,autoPanOnNodeFocus:Ct,nodesConnectable:ut,nodesFocusable:jn,edgesFocusable:Xt,edgesReconnectable:yt,elementsSelectable:Oe,elevateNodesOnSelect:ii,elevateEdgesOnSelect:ai,minZoom:Kt,maxZoom:Kn,nodeExtent:pr,onNodesChange:Of,onEdgesChange:Ws,snapToGrid:xe,snapGrid:Ne,connectionMode:D,translateExtent:An,connectOnClick:mx,defaultEdgeOptions:Hc,fitView:Vo,fitViewOptions:Lf,onNodesDelete:P,onEdgesDelete:O,onDelete:B,onNodeDragStart:A,onNodeDrag:M,onNodeDragStop:L,onSelectionDrag:W,onSelectionDragStart:z,onSelectionDragStop:$,onMove:p,onMoveStart:m,onMoveEnd:x,noPanClassName:gr,nodeOrigin:tn,rfId:Ca,autoPanOnConnect:li,autoPanOnNodeDrag:qt,autoPanSpeed:$f,onError:ci,connectionRadius:Df,isValidConnection:xr,selectNodesOnDrag:De,nodeDragThreshold:qf,connectionDragThreshold:xx,onBeforeDelete:Z,debug:yx,ariaLabelConfig:Bf,zIndexMode:_a}),i.jsx(hse,{onSelectionChange:H}),Rf,i.jsx(lse,{proOptions:ka,position:Pf}),i.jsx(ose,{rfId:Ca,disableKeyboardA11y:oi})]})})}var xf=q8(Fre);function Hre({dimensions:e,lineWidth:t,variant:n,className:s}){return i.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Vt(["react-flow__background-pattern",n,s])})}function Ure({radius:e,className:t}){return i.jsx("circle",{cx:e,cy:e,r:e,className:Vt(["react-flow__background-pattern","dots",t])})}var ua;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ua||(ua={}));const Vre={[ua.Dots]:1,[ua.Lines]:1,[ua.Cross]:6},Gre=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cq({id:e,variant:t=ua.Dots,gap:n=20,size:s,lineWidth:r=1,offset:a=0,color:l,bgColor:u,style:d,className:f,patternClassName:p}){const m=C.useRef(null),{transform:x,patternId:y}=et(Gre,St),v=s||Vre[t],b=t===ua.Dots,w=t===ua.Cross,S=Array.isArray(n)?n:[n,n],E=[S[0]*x[2]||1,S[1]*x[2]||1],k=v*x[2],_=Array.isArray(a)?a:[a,a],R=w?[k,k]:E,T=[_[0]*x[2]||1+R[0]/2,_[1]*x[2]||1+R[1]/2],A=`${y}${e||""}`;return i.jsxs("svg",{className:Vt(["react-flow__background",f]),style:{...d,...Lg,"--xy-background-color-props":u,"--xy-background-pattern-color-props":l},ref:m,"data-testid":"rf__background",children:[i.jsx("pattern",{id:A,x:x[0]%E[0],y:x[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:b?i.jsx(Ure,{radius:k/2,className:p}):i.jsx(Hre,{dimensions:R,lineWidth:r,variant:t,className:p})}),i.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}cq.displayName="Background";const Kk=C.memo(cq);function Kre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Wre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:i.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Yre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:i.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Qre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Xre(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function _p({children:e,className:t,...n}){return i.jsx("button",{type:"button",className:Vt(["react-flow__controls-button",t]),...n,children:e})}const Zre=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function uq({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:r,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:d,className:f,children:p,position:m="bottom-left",orientation:x="vertical","aria-label":y}){const v=Nt(),{isInteractive:b,minZoomReached:w,maxZoomReached:S,ariaLabelConfig:E}=et(Zre,St),{zoomIn:k,zoomOut:_,fitView:R}=Og(),T=()=>{k(),a==null||a()},A=()=>{_(),l==null||l()},M=()=>{R(r),u==null||u()},L=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)},P=x==="horizontal"?"horizontal":"vertical";return i.jsxs(mf,{className:Vt(["react-flow__controls",P,f]),position:m,style:e,"data-testid":"rf__controls","aria-label":y??E["controls.ariaLabel"],children:[t&&i.jsxs(i.Fragment,{children:[i.jsx(_p,{onClick:T,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:S,children:i.jsx(Kre,{})}),i.jsx(_p,{onClick:A,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:w,children:i.jsx(Wre,{})})]}),n&&i.jsx(_p,{className:"react-flow__controls-fitview",onClick:M,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:i.jsx(Yre,{})}),s&&i.jsx(_p,{className:"react-flow__controls-interactive",onClick:L,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:b?i.jsx(Xre,{}):i.jsx(Qre,{})}),p]})}uq.displayName="Controls";const yf=C.memo(uq);function Jre({id:e,x:t,y:n,width:s,height:r,style:a,color:l,strokeColor:u,strokeWidth:d,className:f,borderRadius:p,shapeRendering:m,selected:x,onClick:y}){const{background:v,backgroundColor:b}=a||{},w=l||v||b;return i.jsx("rect",{className:Vt(["react-flow__minimap-node",{selected:x},f]),x:t,y:n,rx:p,ry:p,width:s,height:r,style:{fill:w,stroke:u,strokeWidth:d},shapeRendering:m,onClick:y?S=>y(S,e):void 0})}const eie=C.memo(Jre),tie=e=>e.nodes.map(t=>t.id),ov=e=>e instanceof Function?e:()=>e;function nie({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:r,nodeComponent:a=eie,onClick:l}){const u=et(tie,St),d=ov(t),f=ov(e),p=ov(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:u.map(x=>i.jsx(rie,{id:x,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:s,nodeStrokeWidth:r,NodeComponent:a,onClick:l,shapeRendering:m},x))})}function sie({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:s,nodeBorderRadius:r,nodeStrokeWidth:a,shapeRendering:l,NodeComponent:u,onClick:d}){const{node:f,x:p,y:m,width:x,height:y}=et(v=>{const b=v.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const w=b.internals.userNode,{x:S,y:E}=b.internals.positionAbsolute,{width:k,height:_}=ti(w);return{node:w,x:S,y:E,width:k,height:_}},St);return!f||f.hidden||!p8(f)?null:i.jsx(u,{x:p,y:m,width:x,height:y,style:f.style,selected:!!f.selected,className:s(f),color:t(f),borderRadius:r,strokeColor:n(f),strokeWidth:a,shapeRendering:l,onClick:d,id:f.id})}const rie=C.memo(sie);var iie=C.memo(nie);const aie=200,oie=150,lie=e=>!e.hidden,cie=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?h8(ff(e.nodeLookup,{filter:lie}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},uie="react-flow__minimap-desc";function dq({style:e,className:t,nodeStrokeColor:n,nodeColor:s,nodeClassName:r="",nodeBorderRadius:a=5,nodeStrokeWidth:l,nodeComponent:u,bgColor:d,maskColor:f,maskStrokeColor:p,maskStrokeWidth:m,position:x="bottom-right",onClick:y,onNodeClick:v,pannable:b=!1,zoomable:w=!1,ariaLabel:S,inversePan:E,zoomStep:k=1,offsetScale:_=5}){const R=Nt(),T=C.useRef(null),{boundingRect:A,viewBB:M,rfId:L,panZoom:P,translateExtent:O,flowWidth:B,flowHeight:H,ariaLabelConfig:z}=et(cie,St),W=(e==null?void 0:e.width)??aie,$=(e==null?void 0:e.height)??oie,F=A.width/W,G=A.height/$,X=Math.max(F,G),Z=X*W,D=X*$,V=_*X,ne=A.x-(Z-A.width)/2-V,U=A.y-(D-A.height)/2-V,Q=Z+V*2,K=D+V*2,te=`${uie}-${L}`,re=C.useRef(0),oe=C.useRef();re.current=X,C.useEffect(()=>{if(T.current&&P)return oe.current=One({domNode:T.current,panZoom:P,getTransform:()=>R.getState().transform,getViewScale:()=>re.current}),()=>{var xe;(xe=oe.current)==null||xe.destroy()}},[P]),C.useEffect(()=>{var xe;(xe=oe.current)==null||xe.update({translateExtent:O,width:B,height:H,inversePan:E,pannable:b,zoomStep:k,zoomable:w})},[b,w,E,k,O,B,H]);const pe=y?xe=>{var De;const[Ne,we]=((De=oe.current)==null?void 0:De.pointer(xe))||[0,0];y(xe,{x:Ne,y:we})}:void 0,ge=v?C.useCallback((xe,Ne)=>{const we=R.getState().nodeLookup.get(Ne).internals.userNode;v(xe,we)},[]):void 0,ve=S??z["minimap.ariaLabel"];return i.jsx(mf,{position:x,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*X:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:Vt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:W,height:$,viewBox:`${ne} ${U} ${Q} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":te,ref:T,onClick:pe,children:[ve&&i.jsx("title",{id:te,children:ve}),i.jsx(iie,{onClick:ge,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:r,nodeStrokeWidth:l,nodeComponent:u}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${ne-V},${U-V}h${Q+V*2}v${K+V*2}h${-Q-V*2}z
472
+ M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}dq.displayName="MiniMap";C.memo(dq);const die=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,fie={[Cc.Line]:"right",[Cc.Handle]:"bottom-right"};function hie({nodeId:e,position:t,variant:n=Cc.Handle,className:s,style:r=void 0,children:a,color:l,minWidth:u=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:x,autoScale:y=!0,shouldResize:v,onResizeStart:b,onResize:w,onResizeEnd:S}){const E=H8(),k=typeof e=="string"?e:E,_=Nt(),R=C.useRef(null),T=n===Cc.Handle,A=et(C.useCallback(die(T&&y),[T,y]),St),M=C.useRef(null),L=t??fie[n];C.useEffect(()=>{if(!(!R.current||!k))return M.current||(M.current=Wne({domNode:R.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:O,transform:B,snapGrid:H,snapToGrid:z,nodeOrigin:W,domNode:$}=_.getState();return{nodeLookup:O,transform:B,snapGrid:H,snapToGrid:z,nodeOrigin:W,paneDomNode:$}},onChange:(O,B)=>{const{triggerNodeChanges:H,nodeLookup:z,parentLookup:W,nodeOrigin:$}=_.getState(),F=[],G={x:O.x,y:O.y},X=z.get(k);if(X&&X.expandParent&&X.parentId){const Z=X.origin??$,D=O.width??X.measured.width??0,V=O.height??X.measured.height??0,ne={id:X.id,parentId:X.parentId,rect:{width:D,height:V,...m8({x:O.x??X.position.x,y:O.y??X.position.y},{width:D,height:V},X.parentId,z,Z)}},U=Vk([ne],z,W,$);F.push(...U),G.x=O.x?Math.max(Z[0]*D,O.x):void 0,G.y=O.y?Math.max(Z[1]*V,O.y):void 0}if(G.x!==void 0&&G.y!==void 0){const Z={id:k,type:"position",position:{...G}};F.push(Z)}if(O.width!==void 0&&O.height!==void 0){const D={id:k,type:"dimensions",resizing:!0,setAttributes:x?x==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};F.push(D)}for(const Z of B){const D={...Z,type:"position"};F.push(D)}H(F)},onEnd:({width:O,height:B})=>{const H={id:k,type:"dimensions",resizing:!1,dimensions:{width:O,height:B}};_.getState().triggerNodeChanges([H])}})),M.current.update({controlPosition:L,boundaries:{minWidth:u,minHeight:d,maxWidth:f,maxHeight:p},keepAspectRatio:m,resizeDirection:x,onResizeStart:b,onResize:w,onResizeEnd:S,shouldResize:v}),()=>{var O;(O=M.current)==null||O.destroy()}},[L,u,d,f,p,m,b,w,S,v]);const P=L.split("-");return i.jsx("div",{className:Vt(["react-flow__resize-control","nodrag",...P,n,s]),ref:R,style:{...r,scale:A,...l&&{[T?"backgroundColor":"borderColor"]:l}},children:a})}C.memo(hie);async function pie(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function mie(e){return qe({queryKey:["rig",e,"graph"],queryFn:()=>pie(e),enabled:!!e,refetchInterval:3e4})}const gie=100;function xie(e){const t=Mt(),[n,s]=C.useState(!1),[r,a]=C.useState(!1),l=C.useRef(!1),u=C.useRef(null),d=C.useCallback(()=>{e&&(u.current||(u.current=setTimeout(()=>{u.current=null,t.invalidateQueries({queryKey:["rig",e,"graph"]})},gie)))},[e,t]);return C.useEffect(()=>{if(!e){s(!1),a(!1);return}l.current=!1,s(!1),a(!1);const f=MD(m=>{if(s(m.connected),a(m.reconnecting),m.reconnecting){l.current=!0;return}m.connected&&l.current&&(l.current=!1,d())}),p=cg(m=>{m.rigId===e&&d()});return()=>{p(),f(),u.current&&(clearTimeout(u.current),u.current=null)}},[e,d]),{connected:n,reconnecting:r}}const ql="#546073",Yu={type:Sc.ArrowClosed,color:ql,width:12,height:12};function yie(e){switch(e){case"delegates_to":return{style:{stroke:ql,strokeWidth:1.5},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Yu,label:void 0};case"spawned_by":return{style:{stroke:ql,strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Yu,label:void 0};case"can_observe":return{style:{stroke:ql,strokeWidth:1,strokeDasharray:"4 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Yu,label:void 0};case"uses":return{style:{stroke:ql,strokeWidth:1,strokeDasharray:"2 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Yu,label:void 0};default:return{style:{stroke:ql,strokeWidth:1},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:Yu,label:void 0}}}function gM(e){return e.type==="group"||e.type==="podGroup"}const md=240,gd=160,Pm=3,fq=36,hq=32,pq=28,mq=44,vie=28,bie=120,wie=0,jie=new Set(["delegates_to","spawned_by"]);function Sie(e,t){if(e.length<=1)return e;const n=new Set(e.filter(f=>gM(f)).map(f=>f.id)),s=new Map;for(const f of e)typeof f.parentId!="string"||!n.has(f.parentId)||(s.has(f.parentId)||s.set(f.parentId,[]),s.get(f.parentId).push(f));const r=[],a=new Map;for(const f of e){if(gM(f)){const p=s.get(f.id)??[],{width:m,height:x}=kie(p.length);r.push({id:f.id,kind:"group",node:f,width:m,height:x,members:p}),a.set(f.id,f.id);for(const y of p)a.set(y.id,f.id);continue}typeof f.parentId=="string"&&n.has(f.parentId)||(r.push({id:f.id,kind:"standalone",node:f,width:md,height:gd,members:[]}),a.set(f.id,f.id))}if(r.length===0)return e;const l=Nie(t,a),u=Eie(r,l),d=new Map;for(const f of e)d.set(f.id,{...f});for(const f of r){const p=u.get(f.id);if(!p)continue;if(f.kind==="standalone"){const x=d.get(f.node.id);x.position={x:p.x,y:p.y},x.initialWidth=md,x.initialHeight=gd;continue}const m=d.get(f.node.id);m.position={x:p.x,y:p.y},m.initialWidth=f.width,m.initialHeight=f.height,m.style={...m.style??{},width:f.width,height:f.height,background:"linear-gradient(180deg, rgba(84, 96, 115, 0.08) 0px, rgba(84, 96, 115, 0.08) 32px, rgba(255, 255, 255, 0.22) 32px, rgba(255, 255, 255, 0.22) 100%)",border:"1px dashed rgba(84, 96, 115, 0.45)",boxShadow:"0 0 0 1px rgba(84, 96, 115, 0.10)"};for(let x=0;x<f.members.length;x+=1){const y=f.members[x],v=d.get(y.id);v.position=_ie(x),v.initialWidth=md,v.initialHeight=gd}}return e.map(f=>d.get(f.id)??f)}function Nie(e,t){const n=xM(e.filter(s=>jie.has(Cie(s))),t);return n.length>0?n:xM(e,t)}function xM(e,t){const n=new Map;for(const s of e){const r=t.get(s.source),a=t.get(s.target);if(!r||!a||r===a)continue;const l=`${r}->${a}`;n.has(l)||n.set(l,{source:r,target:a})}return Array.from(n.values())}function kie(e){const t=Math.max(e,1),n=Math.min(t,Pm),s=Math.ceil(t/Pm),r=n*md+Math.max(n-1,0)*fq,a=s*gd+Math.max(s-1,0)*hq;return{width:r+pq*2,height:a+mq+vie}}function _ie(e){const t=e%Pm,n=Math.floor(e/Pm);return{x:pq+t*(md+fq),y:mq+n*(gd+hq)}}function Cie(e){var t;return((t=e.data)==null?void 0:t.kind)??e.label??""}function Eie(e,t){const n=new Map(e.map(y=>[y.id,y])),s=new Map,r=new Map,a=[],l=new Set;for(const y of e)s.set(y.id,new Set),r.set(y.id,0);for(const y of t)!n.has(y.source)||!n.has(y.target)||s.get(y.source).has(y.target)||(s.get(y.source).add(y.target),r.set(y.target,(r.get(y.target)??0)+1));const u=e.filter(y=>{var v;return(r.get(y.id)??0)===0&&(((v=s.get(y.id))==null?void 0:v.size)??0)>0}).map(y=>y.id).sort((y,v)=>Cp(y,v,s,e)),d=e.filter(y=>{var v;return(r.get(y.id)??0)===0&&(((v=s.get(y.id))==null?void 0:v.size)??0)===0}).map(y=>y.id).sort((y,v)=>Cp(y,v,s,e)),f=y=>{const v=new Map(r),b=[...y],w=new Set(b);for(;b.length>0;){const S=b.shift();if(l.has(S))continue;l.add(S),a.push(S);const E=Array.from(s.get(S)??[]).sort((_,R)=>Cp(_,R,s,e));for(const _ of E)v.set(_,(v.get(_)??1)-1);const k=E.filter(_=>(v.get(_)??0)===0&&!l.has(_)&&!w.has(_));for(const _ of k)b.push(_),w.add(_)}};f(u),f(d);const p=e.map(y=>y.id).filter(y=>!l.has(y)).sort((y,v)=>Cp(y,v,s,e));a.push(...p);const m=new Map;let x=0;for(const y of a){const v=n.get(y);v&&(m.set(v.id,{x:wie,y:x}),x+=v.height+bie)}return m}function Cp(e,t,n,s){var l,u;const r=((l=n.get(e))==null?void 0:l.size)??0,a=((u=n.get(t))==null?void 0:u.size)??0;return r!==a?a-r:s.findIndex(d=>d.id===e)-s.findIndex(d=>d.id===t)}function gq(e,t){return t!=="known"||typeof e!="number"?"unknown":e>=80?"critical":e>=60?"warning":"low"}const Rie={critical:"border-red-500",warning:"border-amber-500",low:"border-emerald-500",unknown:"border-stone-400 border-dotted"},Aie={critical:"text-red-600",warning:"text-amber-600",low:"text-green-700",unknown:"text-stone-300"};function xq(e,t,n){const s=gq(e,n??void 0);return`${Aie[s]}${s!=="unknown"&&t===!1?" opacity-50":""}`}function Tie({percent:e,fresh:t,availability:n,testIdSuffix:s}){const r=gq(e,n),a=[];r==="unknown"?a.push("context: unknown"):typeof e=="number"&&a.push(`context: ${e}% (${r})`),r!=="unknown"&&t===!1&&a.push("stale sample");const l=a.join(" · ");return i.jsx("span",{"data-testid":s?`context-ring-${s}`:"context-ring","data-context-tier":r,className:`inline-block h-2.5 w-2.5 rounded-full border-2 bg-transparent ${Rie[r]}${r!=="unknown"&&t===!1?" opacity-50":""}`,"aria-label":l||"context usage",title:l||"context usage"})}const Iie={active:"border-emerald-500/70 shadow-[0_0_0_1px_rgba(16,185,129,0.10)]",needs_input:"border-amber-500/80 shadow-[0_0_0_1px_rgba(245,158,11,0.15)]",blocked:"border-red-600/80 shadow-[0_0_0_1px_rgba(220,38,38,0.16)]"},Mie={active:"activity-ring-active",needs_input:"activity-ring-needs-input",blocked:"activity-ring-blocked"};function Wk({as:e="div",state:t,flash:n=null,reducedMotion:s=!1,children:r,className:a,ringClassName:l,testId:u}){const d=e;return i.jsxs(d,{className:he("relative",e==="span"?"inline-flex":"block",a),children:[t!=="idle"?i.jsx("span",{"aria-hidden":"true","data-testid":u,"data-activity-ring-state":t,"data-activity-flash":n??"none","data-reduced-motion":s?"true":"false",className:he("pointer-events-none absolute -inset-1 rounded-[inherit] border",Iie[t],!s&&Mie[t],n==="source"&&"activity-ring-source-flash",n==="target"&&"activity-ring-target-flash",l)}):null,r]})}function Oie(e){return e==="running"?"active":e==="needs_input"?"needs_input":"idle"}function yq(e){var t,n;return{state:((t=e.activityRing)==null?void 0:t.state)??Oie(e.activityState),flash:((n=e.activityRing)==null?void 0:n.flash)??null}}function vq(e){return he("activity-card-surface",e.state==="active"&&"activity-card-active",e.state==="needs_input"&&"activity-card-needs-input",e.state==="blocked"&&"activity-card-blocked",e.flash==="source"&&"activity-card-source-flash",e.flash==="target"&&"activity-card-target-flash",e.reducedMotion&&"activity-card-reduced-motion")}function Lie(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=4}function Pg({sessionName:e,lines:t,paused:n,testIdPrefix:s="session-preview",variant:r="default"}){var m,x;const a=tZ({sessionName:e,lines:t,paused:n}),l=C.useRef(null),u=C.useRef(!0),d=to(a.data)||(m=a.data)==null?void 0:m.content,f=r==="compact-terminal";C.useLayoutEffect(()=>{const y=l.current;!y||!a.data||to(a.data)||u.current&&(y.scrollTop=y.scrollHeight)},[d,a.data]);const p=()=>{const y=l.current;y&&(u.current=Lie(y))};return i.jsxs("div",{"data-testid":`${s}-pane`,"data-session-name":e,"data-variant":r,className:he("space-y-1",f?"border-0 bg-transparent p-0 text-stone-50":"border border-stone-300/40 bg-white/8 px-3 py-2"),children:[!f&&i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 truncate",children:["live preview · ",e]}),a.isLoading&&i.jsx("div",{"data-testid":`${s}-loading`,className:"font-mono text-[9px] text-stone-400",children:"Loading…"}),a.isError&&i.jsx("div",{"data-testid":`${s}-error`,className:he("font-mono text-[9px]",f?"text-red-200":"text-red-600"),children:((x=a.error)==null?void 0:x.message)??"Preview failed."}),to(a.data)&&i.jsx("div",{"data-testid":`${s}-unavailable`,className:he("font-mono space-y-0.5",f?"text-[10px] text-stone-50":"text-[9px] text-stone-500"),children:f?i.jsxs(i.Fragment,{children:[i.jsx("div",{children:"Preview unavailable."}),i.jsx("div",{className:"text-stone-400",children:"$ waiting for terminal output"})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:["Preview unavailable: ",a.data.reason,"."]}),a.data.hint&&i.jsx("div",{className:"text-stone-400",children:a.data.hint}),i.jsxs("div",{className:"text-stone-400",children:["Use ",i.jsxs("code",{children:["rig capture ",e]})," from terminal as a fallback."]})]})}),!to(a.data)&&a.data&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{ref:l,"data-testid":`${s}-content`,onScroll:p,className:he("font-mono",f?"scrollbar-none max-h-72 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words bg-transparent px-1 py-0.5 text-[8px] leading-[1.2] text-stone-50":"max-h-32 overflow-y-auto whitespace-pre-wrap break-all bg-stone-50 px-2 py-1 text-[9px] text-stone-800"),children:a.data.content||"(empty pane)"}),!f&&i.jsxs("div",{className:"font-mono text-[8px] text-stone-400 flex justify-between",children:[i.jsxs("span",{children:["captured"," ",new Date(a.data.capturedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})]}),i.jsxs("span",{children:[a.data.lines," lines"]})]})]})]})}const lv="openrig:topology-terminal-preview",cv=8,xn=8,yM=408,vM=240;function bM(e){const t=e==null?void 0:e.getBoundingClientRect();return{left:(t==null?void 0:t.left)??xn,right:(t==null?void 0:t.right)??xn,top:(t==null?void 0:t.top)??xn,bottom:(t==null?void 0:t.bottom)??xn}}function wM(e,t,n){return Math.min(Math.max(e,t),n)}function jM(e,t,n,s){const r=typeof window>"u"?t+xn*2:window.innerWidth,a=typeof window>"u"?n+xn*2:window.innerHeight,l=e.right+cv,u=e.left-t-cv,d=l+t<=r-xn?l:u,f=e.top,p=e.top-n-cv,m=f+n<=a-xn?f:p>=xn?p:a-n-xn;return{left:wM(d,xn,Math.max(xn,r-t-xn)),top:wM(m,xn,Math.max(xn,a-n-xn))}}function vf({rigId:e,logicalId:t,sessionName:n,reducedMotion:s,wrapperClassName:r,buttonClassName:a,popoverClassName:l,testIdPrefix:u,renderTrigger:d=!0}){const f=`${e??"unknown"}:${t}`,p=C.useRef(null),m=C.useRef(null),[x,y]=C.useState(!1),[v,b]=C.useState(null),w=C.useCallback(()=>{var T,A;if(!x)return;const k=bM(p.current),_=((T=m.current)==null?void 0:T.offsetWidth)||yM,R=((A=m.current)==null?void 0:A.offsetHeight)||vM;b(jM(k,_,R))},[x]);if(C.useEffect(()=>{const k=_=>{const R=_.detail,T=(R==null?void 0:R.key)===f;if(y(T),T){const A=bM(p.current);b(jM(A,yM,vM))}};return window.addEventListener(lv,k),()=>window.removeEventListener(lv,k)},[f]),C.useLayoutEffect(()=>{if(!x||!m.current)return;w();const k=window.requestAnimationFrame(w);return()=>window.cancelAnimationFrame(k)},[x,w]),C.useEffect(()=>{if(!x)return;const k=()=>w(),_=typeof ResizeObserver>"u"||!m.current?null:new ResizeObserver(k);return m.current&&(_==null||_.observe(m.current)),window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),()=>{_==null||_.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[x,w]),C.useEffect(()=>{if(!x)return;const k=_=>{var T,A;const R=_.target;R instanceof Node&&((T=p.current)!=null&&T.contains(R)||(A=m.current)!=null&&A.contains(R)||y(!1))};return document.addEventListener("pointerdown",k),()=>document.removeEventListener("pointerdown",k)},[x]),!n)return null;const S=k=>{k.stopPropagation(),window.dispatchEvent(new CustomEvent(lv,{detail:{key:f}}))},E=x&&v?Wm.createPortal(i.jsx("div",{ref:m,"data-testid":`${u}-terminal-popover`,"data-reduced-motion":s?"true":"false",className:he("nodrag nopan fixed z-[1000] max-h-[calc(100vh-1rem)] w-[calc(80ch+24px)] max-w-[calc(100vw-1rem)] overflow-hidden bg-stone-950/65 p-1.5 backdrop-blur-sm","cursor-default select-text font-mono text-[8px] text-stone-50",l),style:{left:v.left,top:v.top},onClick:k=>k.stopPropagation(),onPointerDown:k=>k.stopPropagation(),children:i.jsx(Pg,{sessionName:n,lines:80,testIdPrefix:`${u}-terminal-preview`,variant:"compact-terminal"})}),document.body):null;return i.jsxs("div",{ref:p,className:he("relative inline-flex",r),children:[d?i.jsx("button",{type:"button","data-testid":`${u}-terminal-open`,"aria-label":`View ${t} terminal`,title:"View terminal",onClick:S,className:a,children:i.jsx($e,{tool:"terminal",size:"sm"})}):null,E]})}function zd(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.round(e)}function SM(e){const n=Math.abs(e)<10?Math.round(e*10)/10:Math.round(e);return String(n).replace(/\.0$/,"")}function ma(e,t){const n=zd(e),s=zd(t);return n===null&&s===null?null:(n??0)+(s??0)}function bf(e){const t=zd(e);return t===null?null:t>=999500?`${SM(t/1e6)}m`:t>=1e3?`${SM(t/1e3)}k`:t.toLocaleString("en-US")}function $g(e,t){const n=zd(e),s=zd(t),r=ma(n,s);if(r===null)return null;const a=[`Tokens: ${r.toLocaleString("en-US")}`];return n!==null&&a.push(`Input: ${n.toLocaleString("en-US")}`),s!==null&&a.push(`Output: ${s.toLocaleString("en-US")}`),a.join(`
473
+ `)}function Pie(e){return e==="architect"||e==="lead"||e==="orchestrator"}function $ie({data:e}){var W,$,F;const t=C.useRef(e.startupStatus),n=C.useRef(null),[s,r]=C.useState(!1),[a,l]=C.useState(null),u=Pie(e.role),d=e.nodeKind==="infrastructure";C.useEffect(()=>{if(t.current!==e.startupStatus&&t.current!==null){r(!0);const G=setTimeout(()=>r(!1),600);return t.current=e.startupStatus,()=>clearTimeout(G)}t.current=e.startupStatus},[e.startupStatus]),C.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]);const f=e.runtime||e.model?gD(e.runtime,e.model):null,p=lg(e.logicalId),m=F2(e.agentActivity),x=H2(m),y=cD(m),v=uD(m),b=dD(e.agentActivity),w=yq({activityRing:e.activityRing,activityState:m}),S=ma(e.contextTotalInputTokens,e.contextTotalOutputTokens),E=bf(S),k=$g(e.contextTotalInputTokens,e.contextTotalOutputTokens),_=e.placementState==="selected"?"target":e.placementState==="available"?"avail":null,R=e.currentQitems??[],T=R.length>0?R.map(G=>`On: ${kK(G.qitemId)} — ${G.bodyExcerpt}`):[],A=[`Activity: ${x}${b?" (stale sample)":""}`,e.canonicalSessionName?`Session: ${e.canonicalSessionName}`:null,f?`Runtime: ${f}`:null,e.resolvedSpecName?`Spec: ${e.resolvedSpecName}`:null,e.profile?`Profile: ${e.profile}`:null,typeof e.edgeCount=="number"?`Edges: ${e.edgeCount}`:null,k,...T].filter(G=>!!G),M=A.join(`
474
+ `),L=G=>{n.current&&clearTimeout(n.current),l(G),n.current=setTimeout(()=>{l(X=>X===G?null:X),n.current=null},900)},P=async G=>{if(G.stopPropagation(),!!e.rigId)try{(await fetch(`/api/rigs/${encodeURIComponent(e.rigId)}/nodes/${encodeURIComponent(e.logicalId)}/open-cmux`,{method:"POST"})).ok&&L("cmux")}catch{}},O=G=>`inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors ${a===G?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"}`,B="border font-mono text-[7px] uppercase transition-colors bg-white text-stone-900 border-stone-300 hover:bg-stone-100 inline-flex h-6 w-6 items-center justify-center px-0 py-0",H=e.canonicalSessionName??((W=e.binding)==null?void 0:W.tmuxSession)??null,z=i.jsxs("div",{className:he("group relative min-w-[200px] border hard-shadow transition-[background-color,border-color,box-shadow] duration-300",vq({state:w.state,flash:w.flash,reducedMotion:e.reducedMotion}),e.placementState==="selected"?"border-emerald-600 ring-2 ring-emerald-400/70 shadow-[0_0_0_3px_rgba(52,211,153,0.12)]":e.placementState==="available"?"border-emerald-500 ring-1 ring-emerald-300/70":"border-stone-900"),"data-activity-card-state":w.state,"data-activity-card-flash":w.flash??"none","data-testid":"rig-node",title:M||void 0,children:[i.jsx(bn,{type:"target",position:ye.Top}),i.jsxs("div",{className:`px-3 py-1 font-mono text-[10px] flex justify-between items-center ${d?"bg-stone-500 text-white border-b border-stone-900":u?"bg-stone-900 text-white":"bg-stone-200 text-stone-900 border-b border-stone-900"}`,children:[i.jsx("span",{className:"font-bold truncate",children:p}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[b&&i.jsx("span",{"data-testid":`activity-staleness-${e.logicalId}`,className:"font-mono text-[7px] uppercase tracking-[0.10em] text-stone-300",title:"Activity sample is older than threshold; daemon may not be probing this seat",children:"stale"}),i.jsx("span",{className:`inline-flex h-2.5 w-2.5 rounded-full border border-white/50 ${y} ${v} ${s?"status-changed":""}`,"data-testid":`activity-dot-${e.logicalId}`,"data-activity-state":m,"aria-label":`activity: ${x}`,title:`activity: ${x}`}),i.jsx(Tie,{percent:e.contextUsedPercentage,fresh:e.contextFresh,availability:e.contextAvailability,testIdSuffix:e.logicalId})]})]}),i.jsxs("div",{className:"space-y-1 px-2 py-1.5",children:[i.jsx("div",{className:"truncate font-mono text-[8px] leading-tight text-stone-500",children:e.canonicalSessionName??e.logicalId}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(Gn,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}),!f&&e.profile?i.jsx("span",{className:"ml-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-400",children:e.profile}):null]}),e.resolvedSpecName&&i.jsxs("div",{className:"font-mono text-[8px] text-stone-400","data-testid":"spec-hint",children:[e.resolvedSpecName,e.profile?` · ${e.profile}`:""]}),i.jsxs("div",{className:"flex items-end justify-between gap-3 pt-0.5",children:[e.contextAvailability==="known"&&typeof e.contextUsedPercentage=="number"?i.jsxs("div",{className:`font-mono text-base font-bold leading-none ${e.contextUsedPercentage>=80?"text-red-600":e.contextUsedPercentage>=60?"text-amber-600":"text-green-700"}${e.contextFresh?"":" opacity-50"}`,"data-testid":"context-badge",title:e.contextFresh?"Context usage (fresh)":"Context usage (stale sample)",children:[e.contextUsedPercentage,"%"]}):i.jsx("div",{className:"font-mono text-xs text-stone-400","data-testid":"context-badge-unknown",children:"?"}),i.jsx("div",{className:`font-mono text-base font-bold leading-none tracking-[0.02em] ${E?"text-stone-500":"text-stone-300"}`,"data-testid":"token-total",title:k??"Token sample unavailable",children:E??"--"})]}),e.restoreOutcome&&e.restoreOutcome!=="n-a"&&i.jsxs("div",{className:"font-mono text-[8px] text-stone-500",children:["RESTORE: ",e.restoreOutcome]}),e.packageRefs&&e.packageRefs.length>0&&i.jsxs("div",{"data-testid":"package-badge",title:e.packageRefs.join(", "),className:"font-mono text-[8px] text-stone-400",onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation(),children:["PKG ",e.packageRefs.length]}),e.startupStatus==="attention_required"&&i.jsxs("div",{className:"stamp-badge",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"}),i.jsx("span",{className:"text-orange-600",children:"ATTN"})]}),e.startupStatus==="failed"&&i.jsxs("div",{className:"stamp-badge",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsx("span",{className:"text-red-600",children:"FAILED"})]}),(H??e.rigId)&&i.jsxs("div",{"data-testid":"node-toolbar",className:"absolute right-2 top-8 z-20 flex flex-wrap justify-end gap-1 opacity-0 transition-opacity group-hover:!opacity-100 group-hover:opacity-100 group-focus-within:!opacity-100 group-focus-within:opacity-100",onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation(),children:[e.rigId&&i.jsxs("button",{onClick:P,"data-testid":"toolbar-cmux-open",className:`${O("cmux")} inline-flex h-6 w-6 items-center justify-center px-0 py-0`,"aria-label":"Open in cmux",title:"Open in cmux",children:[i.jsx($e,{tool:"cmux",size:"sm"}),i.jsx("span",{className:"sr-only",children:a==="cmux"?"opened":"cmux"})]}),e.rigId&&H&&i.jsx(vf,{rigId:e.rigId,logicalId:e.logicalId,sessionName:H,reducedMotion:e.reducedMotion,testIdPrefix:`rig-node-${e.logicalId}`,buttonClassName:B})]}),_&&i.jsx("div",{className:"pt-1",children:i.jsx("span",{"data-testid":`placement-chip-${e.logicalId}`,className:`inline-flex items-center border px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] ${e.placementState==="selected"?"border-emerald-700 bg-emerald-700 text-white":"border-emerald-300 bg-emerald-50 text-emerald-800"}`,children:_})})]}),A.length>0&&i.jsx("div",{"data-testid":"node-hover-hint",className:"pointer-events-none absolute left-2 top-full z-20 mt-2 hidden min-w-[180px] border border-stone-900 bg-white px-2 py-1 font-mono text-[8px] text-stone-700 shadow-[4px_4px_0_rgba(28,25,23,0.14)] group-hover:block",children:A.map(G=>i.jsx("div",{children:G},G))}),i.jsx(bn,{type:"source",position:ye.Bottom})]});return i.jsx(Wk,{state:(($=e.activityRing)==null?void 0:$.state)??"idle",flash:((F=e.activityRing)==null?void 0:F.flash)??null,reducedMotion:e.reducedMotion,testId:`rig-node-activity-ring-${e.logicalId}`,className:"rounded-none",children:z})}function bq({id:e,sourceX:t,sourceY:n,targetX:s,targetY:r,sourcePosition:a,targetPosition:l,style:u,markerEnd:d,data:f}){const[p]=zk({sourceX:t,sourceY:n,sourcePosition:a,targetX:s,targetY:r,targetPosition:l}),m=f??{},x=m.hotPotatoPacket??null,y=m.hotPotatoCrossRig??!1,v=m.hotPotatoReducedMotion??!1,b=x?y?1.25:2.25:u==null?void 0:u.strokeWidth;return i.jsxs(i.Fragment,{children:[i.jsx(gf,{id:e,path:p,markerEnd:d,style:{...u,strokeWidth:b,filter:x?"drop-shadow(0 0 3px rgba(16,185,129,0.22))":u==null?void 0:u.filter}}),x?v?i.jsx("circle",{"data-testid":`hot-potato-packet-${x.id}`,"data-reduced-motion":"true",cx:s,cy:r,r:y?5:6.5,stroke:"rgba(255,255,255,0.88)",strokeWidth:y?1.75:2.25,vectorEffect:"non-scaling-stroke",className:y?"fill-stone-500":"fill-emerald-600"}):i.jsx("circle",{"data-testid":`hot-potato-packet-${x.id}`,"data-reduced-motion":"false",r:y?5:6.5,stroke:"rgba(255,255,255,0.88)",strokeWidth:y?1.75:2.25,vectorEffect:"non-scaling-stroke",className:y?"fill-stone-500 hot-potato-packet-cross":"fill-emerald-600 hot-potato-packet",children:i.jsx("animateMotion",{dur:`${x.durationMs}ms`,path:p,fill:"freeze",calcMode:"spline",keySplines:"0.2 0 0 1",keyTimes:"0;1"})},x.id):null]})}const Die=PD("relative w-full p-4 bg-surface-low border-l-2 border-l-stone-900 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-on-surface",{variants:{variant:{default:"bg-background text-foreground",destructive:"text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),vn=C.forwardRef(({className:e,variant:t,...n},s)=>i.jsx("div",{ref:s,role:"alert",className:he(Die({variant:t}),e),...n}));vn.displayName="Alert";const wq=C.forwardRef(({className:e,...t},n)=>i.jsx("h5",{ref:n,className:he("mb-1 font-medium leading-none tracking-tight",e),...t}));wq.displayName="AlertTitle";const cn=C.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:he("text-sm [&_p]:leading-relaxed",e),...t}));cn.displayName="AlertDescription";function Yk(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var uv,NM;function qie(){if(NM)return uv;NM=1;function e(){this.__data__=[],this.size=0}return uv=e,uv}var dv,kM;function Oc(){if(kM)return dv;kM=1;function e(t,n){return t===n||t!==t&&n!==n}return dv=e,dv}var fv,_M;function Dg(){if(_M)return fv;_M=1;var e=Oc();function t(n,s){for(var r=n.length;r--;)if(e(n[r][0],s))return r;return-1}return fv=t,fv}var hv,CM;function zie(){if(CM)return hv;CM=1;var e=Dg(),t=Array.prototype,n=t.splice;function s(r){var a=this.__data__,l=e(a,r);if(l<0)return!1;var u=a.length-1;return l==u?a.pop():n.call(a,l,1),--this.size,!0}return hv=s,hv}var pv,EM;function Bie(){if(EM)return pv;EM=1;var e=Dg();function t(n){var s=this.__data__,r=e(s,n);return r<0?void 0:s[r][1]}return pv=t,pv}var mv,RM;function Fie(){if(RM)return mv;RM=1;var e=Dg();function t(n){return e(this.__data__,n)>-1}return mv=t,mv}var gv,AM;function Hie(){if(AM)return gv;AM=1;var e=Dg();function t(n,s){var r=this.__data__,a=e(r,n);return a<0?(++this.size,r.push([n,s])):r[a][1]=s,this}return gv=t,gv}var xv,TM;function qg(){if(TM)return xv;TM=1;var e=qie(),t=zie(),n=Bie(),s=Fie(),r=Hie();function a(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=r,xv=a,xv}var yv,IM;function Uie(){if(IM)return yv;IM=1;var e=qg();function t(){this.__data__=new e,this.size=0}return yv=t,yv}var vv,MM;function Vie(){if(MM)return vv;MM=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return vv=e,vv}var bv,OM;function Gie(){if(OM)return bv;OM=1;function e(t){return this.__data__.get(t)}return bv=e,bv}var wv,LM;function Kie(){if(LM)return wv;LM=1;function e(t){return this.__data__.has(t)}return wv=e,wv}var jv,PM;function jq(){if(PM)return jv;PM=1;var e=typeof Jh=="object"&&Jh&&Jh.Object===Object&&Jh;return jv=e,jv}var Sv,$M;function Vs(){if($M)return Sv;$M=1;var e=jq(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Sv=n,Sv}var Nv,DM;function Lc(){if(DM)return Nv;DM=1;var e=Vs(),t=e.Symbol;return Nv=t,Nv}var kv,qM;function Wie(){if(qM)return kv;qM=1;var e=Lc(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,r=e?e.toStringTag:void 0;function a(l){var u=n.call(l,r),d=l[r];try{l[r]=void 0;var f=!0}catch{}var p=s.call(l);return f&&(u?l[r]=d:delete l[r]),p}return kv=a,kv}var _v,zM;function Yie(){if(zM)return _v;zM=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return _v=n,_v}var Cv,BM;function Oo(){if(BM)return Cv;BM=1;var e=Lc(),t=Wie(),n=Yie(),s="[object Null]",r="[object Undefined]",a=e?e.toStringTag:void 0;function l(u){return u==null?u===void 0?r:s:a&&a in Object(u)?t(u):n(u)}return Cv=l,Cv}var Ev,FM;function ks(){if(FM)return Ev;FM=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Ev=e,Ev}var Rv,HM;function wf(){if(HM)return Rv;HM=1;var e=Oo(),t=ks(),n="[object AsyncFunction]",s="[object Function]",r="[object GeneratorFunction]",a="[object Proxy]";function l(u){if(!t(u))return!1;var d=e(u);return d==s||d==r||d==n||d==a}return Rv=l,Rv}var Av,UM;function Qie(){if(UM)return Av;UM=1;var e=Vs(),t=e["__core-js_shared__"];return Av=t,Av}var Tv,VM;function Xie(){if(VM)return Tv;VM=1;var e=Qie(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return Tv=n,Tv}var Iv,GM;function Sq(){if(GM)return Iv;GM=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return Iv=n,Iv}var Mv,KM;function Zie(){if(KM)return Mv;KM=1;var e=wf(),t=Xie(),n=ks(),s=Sq(),r=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,p=RegExp("^"+d.call(f).replace(r,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(x){if(!n(x)||t(x))return!1;var y=e(x)?p:a;return y.test(s(x))}return Mv=m,Mv}var Ov,WM;function Jie(){if(WM)return Ov;WM=1;function e(t,n){return t==null?void 0:t[n]}return Ov=e,Ov}var Lv,YM;function Lo(){if(YM)return Lv;YM=1;var e=Zie(),t=Jie();function n(s,r){var a=t(s,r);return e(a)?a:void 0}return Lv=n,Lv}var Pv,QM;function Qk(){if(QM)return Pv;QM=1;var e=Lo(),t=Vs(),n=e(t,"Map");return Pv=n,Pv}var $v,XM;function zg(){if(XM)return $v;XM=1;var e=Lo(),t=e(Object,"create");return $v=t,$v}var Dv,ZM;function eae(){if(ZM)return Dv;ZM=1;var e=zg();function t(){this.__data__=e?e(null):{},this.size=0}return Dv=t,Dv}var qv,JM;function tae(){if(JM)return qv;JM=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return qv=e,qv}var zv,e3;function nae(){if(e3)return zv;e3=1;var e=zg(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function r(a){var l=this.__data__;if(e){var u=l[a];return u===t?void 0:u}return s.call(l,a)?l[a]:void 0}return zv=r,zv}var Bv,t3;function sae(){if(t3)return Bv;t3=1;var e=zg(),t=Object.prototype,n=t.hasOwnProperty;function s(r){var a=this.__data__;return e?a[r]!==void 0:n.call(a,r)}return Bv=s,Bv}var Fv,n3;function rae(){if(n3)return Fv;n3=1;var e=zg(),t="__lodash_hash_undefined__";function n(s,r){var a=this.__data__;return this.size+=this.has(s)?0:1,a[s]=e&&r===void 0?t:r,this}return Fv=n,Fv}var Hv,s3;function iae(){if(s3)return Hv;s3=1;var e=eae(),t=tae(),n=nae(),s=sae(),r=rae();function a(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=r,Hv=a,Hv}var Uv,r3;function aae(){if(r3)return Uv;r3=1;var e=iae(),t=qg(),n=Qk();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Uv=s,Uv}var Vv,i3;function oae(){if(i3)return Vv;i3=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Vv=e,Vv}var Gv,a3;function Bg(){if(a3)return Gv;a3=1;var e=oae();function t(n,s){var r=n.__data__;return e(s)?r[typeof s=="string"?"string":"hash"]:r.map}return Gv=t,Gv}var Kv,o3;function lae(){if(o3)return Kv;o3=1;var e=Bg();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return Kv=t,Kv}var Wv,l3;function cae(){if(l3)return Wv;l3=1;var e=Bg();function t(n){return e(this,n).get(n)}return Wv=t,Wv}var Yv,c3;function uae(){if(c3)return Yv;c3=1;var e=Bg();function t(n){return e(this,n).has(n)}return Yv=t,Yv}var Qv,u3;function dae(){if(u3)return Qv;u3=1;var e=Bg();function t(n,s){var r=e(this,n),a=r.size;return r.set(n,s),this.size+=r.size==a?0:1,this}return Qv=t,Qv}var Xv,d3;function Xk(){if(d3)return Xv;d3=1;var e=aae(),t=lae(),n=cae(),s=uae(),r=dae();function a(l){var u=-1,d=l==null?0:l.length;for(this.clear();++u<d;){var f=l[u];this.set(f[0],f[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=s,a.prototype.set=r,Xv=a,Xv}var Zv,f3;function fae(){if(f3)return Zv;f3=1;var e=qg(),t=Qk(),n=Xk(),s=200;function r(a,l){var u=this.__data__;if(u instanceof e){var d=u.__data__;if(!t||d.length<s-1)return d.push([a,l]),this.size=++u.size,this;u=this.__data__=new n(d)}return u.set(a,l),this.size=u.size,this}return Zv=r,Zv}var Jv,h3;function Fg(){if(h3)return Jv;h3=1;var e=qg(),t=Uie(),n=Vie(),s=Gie(),r=Kie(),a=fae();function l(u){var d=this.__data__=new e(u);this.size=d.size}return l.prototype.clear=t,l.prototype.delete=n,l.prototype.get=s,l.prototype.has=r,l.prototype.set=a,Jv=l,Jv}var eb,p3;function Zk(){if(p3)return eb;p3=1;function e(t,n){for(var s=-1,r=t==null?0:t.length;++s<r&&n(t[s],s,t)!==!1;);return t}return eb=e,eb}var tb,m3;function Nq(){if(m3)return tb;m3=1;var e=Lo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return tb=t,tb}var nb,g3;function Hg(){if(g3)return nb;g3=1;var e=Nq();function t(n,s,r){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[s]=r}return nb=t,nb}var sb,x3;function Ug(){if(x3)return sb;x3=1;var e=Hg(),t=Oc(),n=Object.prototype,s=n.hasOwnProperty;function r(a,l,u){var d=a[l];(!(s.call(a,l)&&t(d,u))||u===void 0&&!(l in a))&&e(a,l,u)}return sb=r,sb}var rb,y3;function jf(){if(y3)return rb;y3=1;var e=Ug(),t=Hg();function n(s,r,a,l){var u=!a;a||(a={});for(var d=-1,f=r.length;++d<f;){var p=r[d],m=l?l(a[p],s[p],p,a,s):void 0;m===void 0&&(m=s[p]),u?t(a,p,m):e(a,p,m)}return a}return rb=n,rb}var ib,v3;function hae(){if(v3)return ib;v3=1;function e(t,n){for(var s=-1,r=Array(t);++s<t;)r[s]=n(s);return r}return ib=e,ib}var ab,b3;function hr(){if(b3)return ab;b3=1;function e(t){return t!=null&&typeof t=="object"}return ab=e,ab}var ob,w3;function pae(){if(w3)return ob;w3=1;var e=Oo(),t=hr(),n="[object Arguments]";function s(r){return t(r)&&e(r)==n}return ob=s,ob}var lb,j3;function Sf(){if(j3)return lb;j3=1;var e=pae(),t=hr(),n=Object.prototype,s=n.hasOwnProperty,r=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(l){return t(l)&&s.call(l,"callee")&&!r.call(l,"callee")};return lb=a,lb}var cb,S3;function Gt(){if(S3)return cb;S3=1;var e=Array.isArray;return cb=e,cb}var ad={exports:{}},ub,N3;function mae(){if(N3)return ub;N3=1;function e(){return!1}return ub=e,ub}ad.exports;var k3;function Pc(){return k3||(k3=1,(function(e,t){var n=Vs(),s=mae(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,l=a&&a.exports===r,u=l?n.Buffer:void 0,d=u?u.isBuffer:void 0,f=d||s;e.exports=f})(ad,ad.exports)),ad.exports}var db,_3;function Vg(){if(_3)return db;_3=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,r){var a=typeof s;return r=r??e,!!r&&(a=="number"||a!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<r}return db=n,db}var fb,C3;function Jk(){if(C3)return fb;C3=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return fb=t,fb}var hb,E3;function gae(){if(E3)return hb;E3=1;var e=Oo(),t=Jk(),n=hr(),s="[object Arguments]",r="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",d="[object Function]",f="[object Map]",p="[object Number]",m="[object Object]",x="[object RegExp]",y="[object Set]",v="[object String]",b="[object WeakMap]",w="[object ArrayBuffer]",S="[object DataView]",E="[object Float32Array]",k="[object Float64Array]",_="[object Int8Array]",R="[object Int16Array]",T="[object Int32Array]",A="[object Uint8Array]",M="[object Uint8ClampedArray]",L="[object Uint16Array]",P="[object Uint32Array]",O={};O[E]=O[k]=O[_]=O[R]=O[T]=O[A]=O[M]=O[L]=O[P]=!0,O[s]=O[r]=O[w]=O[a]=O[S]=O[l]=O[u]=O[d]=O[f]=O[p]=O[m]=O[x]=O[y]=O[v]=O[b]=!1;function B(H){return n(H)&&t(H.length)&&!!O[e(H)]}return hb=B,hb}var pb,R3;function Gg(){if(R3)return pb;R3=1;function e(t){return function(n){return t(n)}}return pb=e,pb}var od={exports:{}};od.exports;var A3;function e_(){return A3||(A3=1,(function(e,t){var n=jq(),s=t&&!t.nodeType&&t,r=s&&!0&&e&&!e.nodeType&&e,a=r&&r.exports===s,l=a&&n.process,u=(function(){try{var d=r&&r.require&&r.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=u})(od,od.exports)),od.exports}var mb,T3;function Nf(){if(T3)return mb;T3=1;var e=gae(),t=Gg(),n=e_(),s=n&&n.isTypedArray,r=s?t(s):e;return mb=r,mb}var gb,I3;function kq(){if(I3)return gb;I3=1;var e=hae(),t=Sf(),n=Gt(),s=Pc(),r=Vg(),a=Nf(),l=Object.prototype,u=l.hasOwnProperty;function d(f,p){var m=n(f),x=!m&&t(f),y=!m&&!x&&s(f),v=!m&&!x&&!y&&a(f),b=m||x||y||v,w=b?e(f.length,String):[],S=w.length;for(var E in f)(p||u.call(f,E))&&!(b&&(E=="length"||y&&(E=="offset"||E=="parent")||v&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||r(E,S)))&&w.push(E);return w}return gb=d,gb}var xb,M3;function Kg(){if(M3)return xb;M3=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,r=typeof s=="function"&&s.prototype||e;return n===r}return xb=t,xb}var yb,O3;function _q(){if(O3)return yb;O3=1;function e(t,n){return function(s){return t(n(s))}}return yb=e,yb}var vb,L3;function xae(){if(L3)return vb;L3=1;var e=_q(),t=e(Object.keys,Object);return vb=t,vb}var bb,P3;function t_(){if(P3)return bb;P3=1;var e=Kg(),t=xae(),n=Object.prototype,s=n.hasOwnProperty;function r(a){if(!e(a))return t(a);var l=[];for(var u in Object(a))s.call(a,u)&&u!="constructor"&&l.push(u);return l}return bb=r,bb}var wb,$3;function ni(){if($3)return wb;$3=1;var e=wf(),t=Jk();function n(s){return s!=null&&t(s.length)&&!e(s)}return wb=n,wb}var jb,D3;function ja(){if(D3)return jb;D3=1;var e=kq(),t=t_(),n=ni();function s(r){return n(r)?e(r):t(r)}return jb=s,jb}var Sb,q3;function yae(){if(q3)return Sb;q3=1;var e=jf(),t=ja();function n(s,r){return s&&e(r,t(r),s)}return Sb=n,Sb}var Nb,z3;function vae(){if(z3)return Nb;z3=1;function e(t){var n=[];if(t!=null)for(var s in Object(t))n.push(s);return n}return Nb=e,Nb}var kb,B3;function bae(){if(B3)return kb;B3=1;var e=ks(),t=Kg(),n=vae(),s=Object.prototype,r=s.hasOwnProperty;function a(l){if(!e(l))return n(l);var u=t(l),d=[];for(var f in l)f=="constructor"&&(u||!r.call(l,f))||d.push(f);return d}return kb=a,kb}var _b,F3;function Po(){if(F3)return _b;F3=1;var e=kq(),t=bae(),n=ni();function s(r){return n(r)?e(r,!0):t(r)}return _b=s,_b}var Cb,H3;function wae(){if(H3)return Cb;H3=1;var e=jf(),t=Po();function n(s,r){return s&&e(r,t(r),s)}return Cb=n,Cb}var ld={exports:{}};ld.exports;var U3;function Cq(){return U3||(U3=1,(function(e,t){var n=Vs(),s=t&&!t.nodeType&&t,r=s&&!0&&e&&!e.nodeType&&e,a=r&&r.exports===s,l=a?n.Buffer:void 0,u=l?l.allocUnsafe:void 0;function d(f,p){if(p)return f.slice();var m=f.length,x=u?u(m):new f.constructor(m);return f.copy(x),x}e.exports=d})(ld,ld.exports)),ld.exports}var Eb,V3;function Eq(){if(V3)return Eb;V3=1;function e(t,n){var s=-1,r=t.length;for(n||(n=Array(r));++s<r;)n[s]=t[s];return n}return Eb=e,Eb}var Rb,G3;function Rq(){if(G3)return Rb;G3=1;function e(t,n){for(var s=-1,r=t==null?0:t.length,a=0,l=[];++s<r;){var u=t[s];n(u,s,t)&&(l[a++]=u)}return l}return Rb=e,Rb}var Ab,K3;function Aq(){if(K3)return Ab;K3=1;function e(){return[]}return Ab=e,Ab}var Tb,W3;function n_(){if(W3)return Tb;W3=1;var e=Rq(),t=Aq(),n=Object.prototype,s=n.propertyIsEnumerable,r=Object.getOwnPropertySymbols,a=r?function(l){return l==null?[]:(l=Object(l),e(r(l),function(u){return s.call(l,u)}))}:t;return Tb=a,Tb}var Ib,Y3;function jae(){if(Y3)return Ib;Y3=1;var e=jf(),t=n_();function n(s,r){return e(s,t(s),r)}return Ib=n,Ib}var Mb,Q3;function s_(){if(Q3)return Mb;Q3=1;function e(t,n){for(var s=-1,r=n.length,a=t.length;++s<r;)t[a+s]=n[s];return t}return Mb=e,Mb}var Ob,X3;function Wg(){if(X3)return Ob;X3=1;var e=_q(),t=e(Object.getPrototypeOf,Object);return Ob=t,Ob}var Lb,Z3;function Tq(){if(Z3)return Lb;Z3=1;var e=s_(),t=Wg(),n=n_(),s=Aq(),r=Object.getOwnPropertySymbols,a=r?function(l){for(var u=[];l;)e(u,n(l)),l=t(l);return u}:s;return Lb=a,Lb}var Pb,J3;function Sae(){if(J3)return Pb;J3=1;var e=jf(),t=Tq();function n(s,r){return e(s,t(s),r)}return Pb=n,Pb}var $b,e4;function Iq(){if(e4)return $b;e4=1;var e=s_(),t=Gt();function n(s,r,a){var l=r(s);return t(s)?l:e(l,a(s))}return $b=n,$b}var Db,t4;function Mq(){if(t4)return Db;t4=1;var e=Iq(),t=n_(),n=ja();function s(r){return e(r,n,t)}return Db=s,Db}var qb,n4;function Nae(){if(n4)return qb;n4=1;var e=Iq(),t=Tq(),n=Po();function s(r){return e(r,n,t)}return qb=s,qb}var zb,s4;function kae(){if(s4)return zb;s4=1;var e=Lo(),t=Vs(),n=e(t,"DataView");return zb=n,zb}var Bb,r4;function _ae(){if(r4)return Bb;r4=1;var e=Lo(),t=Vs(),n=e(t,"Promise");return Bb=n,Bb}var Fb,i4;function Oq(){if(i4)return Fb;i4=1;var e=Lo(),t=Vs(),n=e(t,"Set");return Fb=n,Fb}var Hb,a4;function Cae(){if(a4)return Hb;a4=1;var e=Lo(),t=Vs(),n=e(t,"WeakMap");return Hb=n,Hb}var Ub,o4;function $c(){if(o4)return Ub;o4=1;var e=kae(),t=Qk(),n=_ae(),s=Oq(),r=Cae(),a=Oo(),l=Sq(),u="[object Map]",d="[object Object]",f="[object Promise]",p="[object Set]",m="[object WeakMap]",x="[object DataView]",y=l(e),v=l(t),b=l(n),w=l(s),S=l(r),E=a;return(e&&E(new e(new ArrayBuffer(1)))!=x||t&&E(new t)!=u||n&&E(n.resolve())!=f||s&&E(new s)!=p||r&&E(new r)!=m)&&(E=function(k){var _=a(k),R=_==d?k.constructor:void 0,T=R?l(R):"";if(T)switch(T){case y:return x;case v:return u;case b:return f;case w:return p;case S:return m}return _}),Ub=E,Ub}var Vb,l4;function Eae(){if(l4)return Vb;l4=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s){var r=s.length,a=new s.constructor(r);return r&&typeof s[0]=="string"&&t.call(s,"index")&&(a.index=s.index,a.input=s.input),a}return Vb=n,Vb}var Gb,c4;function Lq(){if(c4)return Gb;c4=1;var e=Vs(),t=e.Uint8Array;return Gb=t,Gb}var Kb,u4;function r_(){if(u4)return Kb;u4=1;var e=Lq();function t(n){var s=new n.constructor(n.byteLength);return new e(s).set(new e(n)),s}return Kb=t,Kb}var Wb,d4;function Rae(){if(d4)return Wb;d4=1;var e=r_();function t(n,s){var r=s?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}return Wb=t,Wb}var Yb,f4;function Aae(){if(f4)return Yb;f4=1;var e=/\w*$/;function t(n){var s=new n.constructor(n.source,e.exec(n));return s.lastIndex=n.lastIndex,s}return Yb=t,Yb}var Qb,h4;function Tae(){if(h4)return Qb;h4=1;var e=Lc(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function s(r){return n?Object(n.call(r)):{}}return Qb=s,Qb}var Xb,p4;function Pq(){if(p4)return Xb;p4=1;var e=r_();function t(n,s){var r=s?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}return Xb=t,Xb}var Zb,m4;function Iae(){if(m4)return Zb;m4=1;var e=r_(),t=Rae(),n=Aae(),s=Tae(),r=Pq(),a="[object Boolean]",l="[object Date]",u="[object Map]",d="[object Number]",f="[object RegExp]",p="[object Set]",m="[object String]",x="[object Symbol]",y="[object ArrayBuffer]",v="[object DataView]",b="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",_="[object Uint8Array]",R="[object Uint8ClampedArray]",T="[object Uint16Array]",A="[object Uint32Array]";function M(L,P,O){var B=L.constructor;switch(P){case y:return e(L);case a:case l:return new B(+L);case v:return t(L,O);case b:case w:case S:case E:case k:case _:case R:case T:case A:return r(L,O);case u:return new B;case d:case m:return new B(L);case f:return n(L);case p:return new B;case x:return s(L)}}return Zb=M,Zb}var Jb,g4;function $q(){if(g4)return Jb;g4=1;var e=ks(),t=Object.create,n=(function(){function s(){}return function(r){if(!e(r))return{};if(t)return t(r);s.prototype=r;var a=new s;return s.prototype=void 0,a}})();return Jb=n,Jb}var ew,x4;function Dq(){if(x4)return ew;x4=1;var e=$q(),t=Wg(),n=Kg();function s(r){return typeof r.constructor=="function"&&!n(r)?e(t(r)):{}}return ew=s,ew}var tw,y4;function Mae(){if(y4)return tw;y4=1;var e=$c(),t=hr(),n="[object Map]";function s(r){return t(r)&&e(r)==n}return tw=s,tw}var nw,v4;function Oae(){if(v4)return nw;v4=1;var e=Mae(),t=Gg(),n=e_(),s=n&&n.isMap,r=s?t(s):e;return nw=r,nw}var sw,b4;function Lae(){if(b4)return sw;b4=1;var e=$c(),t=hr(),n="[object Set]";function s(r){return t(r)&&e(r)==n}return sw=s,sw}var rw,w4;function Pae(){if(w4)return rw;w4=1;var e=Lae(),t=Gg(),n=e_(),s=n&&n.isSet,r=s?t(s):e;return rw=r,rw}var iw,j4;function qq(){if(j4)return iw;j4=1;var e=Fg(),t=Zk(),n=Ug(),s=yae(),r=wae(),a=Cq(),l=Eq(),u=jae(),d=Sae(),f=Mq(),p=Nae(),m=$c(),x=Eae(),y=Iae(),v=Dq(),b=Gt(),w=Pc(),S=Oae(),E=ks(),k=Pae(),_=ja(),R=Po(),T=1,A=2,M=4,L="[object Arguments]",P="[object Array]",O="[object Boolean]",B="[object Date]",H="[object Error]",z="[object Function]",W="[object GeneratorFunction]",$="[object Map]",F="[object Number]",G="[object Object]",X="[object RegExp]",Z="[object Set]",D="[object String]",V="[object Symbol]",ne="[object WeakMap]",U="[object ArrayBuffer]",Q="[object DataView]",K="[object Float32Array]",te="[object Float64Array]",re="[object Int8Array]",oe="[object Int16Array]",pe="[object Int32Array]",ge="[object Uint8Array]",ve="[object Uint8ClampedArray]",xe="[object Uint16Array]",Ne="[object Uint32Array]",we={};we[L]=we[P]=we[U]=we[Q]=we[O]=we[B]=we[K]=we[te]=we[re]=we[oe]=we[pe]=we[$]=we[F]=we[G]=we[X]=we[Z]=we[D]=we[V]=we[ge]=we[ve]=we[xe]=we[Ne]=!0,we[H]=we[z]=we[ne]=!1;function De(Ee,Ct,ut,jn,tn,Xt){var yt,Oe=Ct&T,mt=Ct&A,Kt=Ct&M;if(ut&&(yt=tn?ut(Ee,jn,tn,Xt):ut(Ee)),yt!==void 0)return yt;if(!E(Ee))return Ee;var Kn=b(Ee);if(Kn){if(yt=x(Ee),!Oe)return l(Ee,yt)}else{var An=m(Ee),qo=An==z||An==W;if(w(Ee))return a(Ee,Oe);if(An==G||An==L||qo&&!tn){if(yt=mt||qo?{}:v(Ee),!Oe)return mt?d(Ee,r(yt,Ee)):u(Ee,s(yt,Ee))}else{if(!we[An])return tn?Ee:{};yt=y(Ee,An,Oe)}}Xt||(Xt=new e);var pr=Xt.get(Ee);if(pr)return pr;Xt.set(Ee,yt),k(Ee)?Ee.forEach(function(fn){yt.add(De(fn,Ct,ut,fn,Ee,Xt))}):S(Ee)&&Ee.forEach(function(fn,_t){yt.set(_t,De(fn,Ct,ut,_t,Ee,Xt))});var qc=Kt?mt?p:f:mt?R:_,zo=Kn?void 0:qc(Ee);return t(zo||Ee,function(fn,_t){zo&&(_t=fn,fn=Ee[_t]),n(yt,_t,De(fn,Ct,ut,_t,Ee,Xt))}),yt}return iw=De,iw}var aw,S4;function $ae(){if(S4)return aw;S4=1;var e=qq(),t=4;function n(s){return e(s,t)}return aw=n,aw}var ow,N4;function i_(){if(N4)return ow;N4=1;function e(t){return function(){return t}}return ow=e,ow}var lw,k4;function Dae(){if(k4)return lw;k4=1;function e(t){return function(n,s,r){for(var a=-1,l=Object(n),u=r(n),d=u.length;d--;){var f=u[t?d:++a];if(s(l[f],f,l)===!1)break}return n}}return lw=e,lw}var cw,_4;function a_(){if(_4)return cw;_4=1;var e=Dae(),t=e();return cw=t,cw}var uw,C4;function o_(){if(C4)return uw;C4=1;var e=a_(),t=ja();function n(s,r){return s&&e(s,r,t)}return uw=n,uw}var dw,E4;function qae(){if(E4)return dw;E4=1;var e=ni();function t(n,s){return function(r,a){if(r==null)return r;if(!e(r))return n(r,a);for(var l=r.length,u=s?l:-1,d=Object(r);(s?u--:++u<l)&&a(d[u],u,d)!==!1;);return r}}return dw=t,dw}var fw,R4;function Yg(){if(R4)return fw;R4=1;var e=o_(),t=qae(),n=t(e);return fw=n,fw}var hw,A4;function $o(){if(A4)return hw;A4=1;function e(t){return t}return hw=e,hw}var pw,T4;function zq(){if(T4)return pw;T4=1;var e=$o();function t(n){return typeof n=="function"?n:e}return pw=t,pw}var mw,I4;function Bq(){if(I4)return mw;I4=1;var e=Zk(),t=Yg(),n=zq(),s=Gt();function r(a,l){var u=s(a)?e:t;return u(a,n(l))}return mw=r,mw}var gw,M4;function Fq(){return M4||(M4=1,gw=Bq()),gw}var xw,O4;function zae(){if(O4)return xw;O4=1;var e=Yg();function t(n,s){var r=[];return e(n,function(a,l,u){s(a,l,u)&&r.push(a)}),r}return xw=t,xw}var yw,L4;function Bae(){if(L4)return yw;L4=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return yw=t,yw}var vw,P4;function Fae(){if(P4)return vw;P4=1;function e(t){return this.__data__.has(t)}return vw=e,vw}var bw,$4;function Hq(){if($4)return bw;$4=1;var e=Xk(),t=Bae(),n=Fae();function s(r){var a=-1,l=r==null?0:r.length;for(this.__data__=new e;++a<l;)this.add(r[a])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,bw=s,bw}var ww,D4;function Hae(){if(D4)return ww;D4=1;function e(t,n){for(var s=-1,r=t==null?0:t.length;++s<r;)if(n(t[s],s,t))return!0;return!1}return ww=e,ww}var jw,q4;function Uq(){if(q4)return jw;q4=1;function e(t,n){return t.has(n)}return jw=e,jw}var Sw,z4;function Vq(){if(z4)return Sw;z4=1;var e=Hq(),t=Hae(),n=Uq(),s=1,r=2;function a(l,u,d,f,p,m){var x=d&s,y=l.length,v=u.length;if(y!=v&&!(x&&v>y))return!1;var b=m.get(l),w=m.get(u);if(b&&w)return b==u&&w==l;var S=-1,E=!0,k=d&r?new e:void 0;for(m.set(l,u),m.set(u,l);++S<y;){var _=l[S],R=u[S];if(f)var T=x?f(R,_,S,u,l,m):f(_,R,S,l,u,m);if(T!==void 0){if(T)continue;E=!1;break}if(k){if(!t(u,function(A,M){if(!n(k,M)&&(_===A||p(_,A,d,f,m)))return k.push(M)})){E=!1;break}}else if(!(_===R||p(_,R,d,f,m))){E=!1;break}}return m.delete(l),m.delete(u),E}return Sw=a,Sw}var Nw,B4;function Uae(){if(B4)return Nw;B4=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(r,a){s[++n]=[a,r]}),s}return Nw=e,Nw}var kw,F4;function l_(){if(F4)return kw;F4=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(r){s[++n]=r}),s}return kw=e,kw}var _w,H4;function Vae(){if(H4)return _w;H4=1;var e=Lc(),t=Lq(),n=Oc(),s=Vq(),r=Uae(),a=l_(),l=1,u=2,d="[object Boolean]",f="[object Date]",p="[object Error]",m="[object Map]",x="[object Number]",y="[object RegExp]",v="[object Set]",b="[object String]",w="[object Symbol]",S="[object ArrayBuffer]",E="[object DataView]",k=e?e.prototype:void 0,_=k?k.valueOf:void 0;function R(T,A,M,L,P,O,B){switch(M){case E:if(T.byteLength!=A.byteLength||T.byteOffset!=A.byteOffset)return!1;T=T.buffer,A=A.buffer;case S:return!(T.byteLength!=A.byteLength||!O(new t(T),new t(A)));case d:case f:case x:return n(+T,+A);case p:return T.name==A.name&&T.message==A.message;case y:case b:return T==A+"";case m:var H=r;case v:var z=L&l;if(H||(H=a),T.size!=A.size&&!z)return!1;var W=B.get(T);if(W)return W==A;L|=u,B.set(T,A);var $=s(H(T),H(A),L,P,O,B);return B.delete(T),$;case w:if(_)return _.call(T)==_.call(A)}return!1}return _w=R,_w}var Cw,U4;function Gae(){if(U4)return Cw;U4=1;var e=Mq(),t=1,n=Object.prototype,s=n.hasOwnProperty;function r(a,l,u,d,f,p){var m=u&t,x=e(a),y=x.length,v=e(l),b=v.length;if(y!=b&&!m)return!1;for(var w=y;w--;){var S=x[w];if(!(m?S in l:s.call(l,S)))return!1}var E=p.get(a),k=p.get(l);if(E&&k)return E==l&&k==a;var _=!0;p.set(a,l),p.set(l,a);for(var R=m;++w<y;){S=x[w];var T=a[S],A=l[S];if(d)var M=m?d(A,T,S,l,a,p):d(T,A,S,a,l,p);if(!(M===void 0?T===A||f(T,A,u,d,p):M)){_=!1;break}R||(R=S=="constructor")}if(_&&!R){var L=a.constructor,P=l.constructor;L!=P&&"constructor"in a&&"constructor"in l&&!(typeof L=="function"&&L instanceof L&&typeof P=="function"&&P instanceof P)&&(_=!1)}return p.delete(a),p.delete(l),_}return Cw=r,Cw}var Ew,V4;function Kae(){if(V4)return Ew;V4=1;var e=Fg(),t=Vq(),n=Vae(),s=Gae(),r=$c(),a=Gt(),l=Pc(),u=Nf(),d=1,f="[object Arguments]",p="[object Array]",m="[object Object]",x=Object.prototype,y=x.hasOwnProperty;function v(b,w,S,E,k,_){var R=a(b),T=a(w),A=R?p:r(b),M=T?p:r(w);A=A==f?m:A,M=M==f?m:M;var L=A==m,P=M==m,O=A==M;if(O&&l(b)){if(!l(w))return!1;R=!0,L=!1}if(O&&!L)return _||(_=new e),R||u(b)?t(b,w,S,E,k,_):n(b,w,A,S,E,k,_);if(!(S&d)){var B=L&&y.call(b,"__wrapped__"),H=P&&y.call(w,"__wrapped__");if(B||H){var z=B?b.value():b,W=H?w.value():w;return _||(_=new e),k(z,W,S,E,_)}}return O?(_||(_=new e),s(b,w,S,E,k,_)):!1}return Ew=v,Ew}var Rw,G4;function Gq(){if(G4)return Rw;G4=1;var e=Kae(),t=hr();function n(s,r,a,l,u){return s===r?!0:s==null||r==null||!t(s)&&!t(r)?s!==s&&r!==r:e(s,r,a,l,n,u)}return Rw=n,Rw}var Aw,K4;function Wae(){if(K4)return Aw;K4=1;var e=Fg(),t=Gq(),n=1,s=2;function r(a,l,u,d){var f=u.length,p=f,m=!d;if(a==null)return!p;for(a=Object(a);f--;){var x=u[f];if(m&&x[2]?x[1]!==a[x[0]]:!(x[0]in a))return!1}for(;++f<p;){x=u[f];var y=x[0],v=a[y],b=x[1];if(m&&x[2]){if(v===void 0&&!(y in a))return!1}else{var w=new e;if(d)var S=d(v,b,y,a,l,w);if(!(S===void 0?t(b,v,n|s,d,w):S))return!1}}return!0}return Aw=r,Aw}var Tw,W4;function Kq(){if(W4)return Tw;W4=1;var e=ks();function t(n){return n===n&&!e(n)}return Tw=t,Tw}var Iw,Y4;function Yae(){if(Y4)return Iw;Y4=1;var e=Kq(),t=ja();function n(s){for(var r=t(s),a=r.length;a--;){var l=r[a],u=s[l];r[a]=[l,u,e(u)]}return r}return Iw=n,Iw}var Mw,Q4;function Wq(){if(Q4)return Mw;Q4=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return Mw=e,Mw}var Ow,X4;function Qae(){if(X4)return Ow;X4=1;var e=Wae(),t=Yae(),n=Wq();function s(r){var a=t(r);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(l){return l===r||e(l,r,a)}}return Ow=s,Ow}var Lw,Z4;function Dc(){if(Z4)return Lw;Z4=1;var e=Oo(),t=hr(),n="[object Symbol]";function s(r){return typeof r=="symbol"||t(r)&&e(r)==n}return Lw=s,Lw}var Pw,J4;function c_(){if(J4)return Pw;J4=1;var e=Gt(),t=Dc(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function r(a,l){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:s.test(a)||!n.test(a)||l!=null&&a in Object(l)}return Pw=r,Pw}var $w,eO;function Xae(){if(eO)return $w;eO=1;var e=Xk(),t="Expected a function";function n(s,r){if(typeof s!="function"||r!=null&&typeof r!="function")throw new TypeError(t);var a=function(){var l=arguments,u=r?r.apply(this,l):l[0],d=a.cache;if(d.has(u))return d.get(u);var f=s.apply(this,l);return a.cache=d.set(u,f)||d,f};return a.cache=new(n.Cache||e),a}return n.Cache=e,$w=n,$w}var Dw,tO;function Zae(){if(tO)return Dw;tO=1;var e=Xae(),t=500;function n(s){var r=e(s,function(l){return a.size===t&&a.clear(),l}),a=r.cache;return r}return Dw=n,Dw}var qw,nO;function Jae(){if(nO)return qw;nO=1;var e=Zae(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(r){var a=[];return r.charCodeAt(0)===46&&a.push(""),r.replace(t,function(l,u,d,f){a.push(d?f.replace(n,"$1"):u||l)}),a});return qw=s,qw}var zw,sO;function Qg(){if(sO)return zw;sO=1;function e(t,n){for(var s=-1,r=t==null?0:t.length,a=Array(r);++s<r;)a[s]=n(t[s],s,t);return a}return zw=e,zw}var Bw,rO;function eoe(){if(rO)return Bw;rO=1;var e=Lc(),t=Qg(),n=Gt(),s=Dc(),r=e?e.prototype:void 0,a=r?r.toString:void 0;function l(u){if(typeof u=="string")return u;if(n(u))return t(u,l)+"";if(s(u))return a?a.call(u):"";var d=u+"";return d=="0"&&1/u==-1/0?"-0":d}return Bw=l,Bw}var Fw,iO;function Yq(){if(iO)return Fw;iO=1;var e=eoe();function t(n){return n==null?"":e(n)}return Fw=t,Fw}var Hw,aO;function Xg(){if(aO)return Hw;aO=1;var e=Gt(),t=c_(),n=Jae(),s=Yq();function r(a,l){return e(a)?a:t(a,l)?[a]:n(s(a))}return Hw=r,Hw}var Uw,oO;function kf(){if(oO)return Uw;oO=1;var e=Dc();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return Uw=t,Uw}var Vw,lO;function Zg(){if(lO)return Vw;lO=1;var e=Xg(),t=kf();function n(s,r){r=e(r,s);for(var a=0,l=r.length;s!=null&&a<l;)s=s[t(r[a++])];return a&&a==l?s:void 0}return Vw=n,Vw}var Gw,cO;function toe(){if(cO)return Gw;cO=1;var e=Zg();function t(n,s,r){var a=n==null?void 0:e(n,s);return a===void 0?r:a}return Gw=t,Gw}var Kw,uO;function noe(){if(uO)return Kw;uO=1;function e(t,n){return t!=null&&n in Object(t)}return Kw=e,Kw}var Ww,dO;function Qq(){if(dO)return Ww;dO=1;var e=Xg(),t=Sf(),n=Gt(),s=Vg(),r=Jk(),a=kf();function l(u,d,f){d=e(d,u);for(var p=-1,m=d.length,x=!1;++p<m;){var y=a(d[p]);if(!(x=u!=null&&f(u,y)))break;u=u[y]}return x||++p!=m?x:(m=u==null?0:u.length,!!m&&r(m)&&s(y,m)&&(n(u)||t(u)))}return Ww=l,Ww}var Yw,fO;function Xq(){if(fO)return Yw;fO=1;var e=noe(),t=Qq();function n(s,r){return s!=null&&t(s,r,e)}return Yw=n,Yw}var Qw,hO;function soe(){if(hO)return Qw;hO=1;var e=Gq(),t=toe(),n=Xq(),s=c_(),r=Kq(),a=Wq(),l=kf(),u=1,d=2;function f(p,m){return s(p)&&r(m)?a(l(p),m):function(x){var y=t(x,p);return y===void 0&&y===m?n(x,p):e(m,y,u|d)}}return Qw=f,Qw}var Xw,pO;function Zq(){if(pO)return Xw;pO=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Xw=e,Xw}var Zw,mO;function roe(){if(mO)return Zw;mO=1;var e=Zg();function t(n){return function(s){return e(s,n)}}return Zw=t,Zw}var Jw,gO;function ioe(){if(gO)return Jw;gO=1;var e=Zq(),t=roe(),n=c_(),s=kf();function r(a){return n(a)?e(s(a)):t(a)}return Jw=r,Jw}var e1,xO;function si(){if(xO)return e1;xO=1;var e=Qae(),t=soe(),n=$o(),s=Gt(),r=ioe();function a(l){return typeof l=="function"?l:l==null?n:typeof l=="object"?s(l)?t(l[0],l[1]):e(l):r(l)}return e1=a,e1}var t1,yO;function Jq(){if(yO)return t1;yO=1;var e=Rq(),t=zae(),n=si(),s=Gt();function r(a,l){var u=s(a)?e:t;return u(a,n(l,3))}return t1=r,t1}var n1,vO;function aoe(){if(vO)return n1;vO=1;var e=Object.prototype,t=e.hasOwnProperty;function n(s,r){return s!=null&&t.call(s,r)}return n1=n,n1}var s1,bO;function e9(){if(bO)return s1;bO=1;var e=aoe(),t=Qq();function n(s,r){return s!=null&&t(s,r,e)}return s1=n,s1}var r1,wO;function ooe(){if(wO)return r1;wO=1;var e=t_(),t=$c(),n=Sf(),s=Gt(),r=ni(),a=Pc(),l=Kg(),u=Nf(),d="[object Map]",f="[object Set]",p=Object.prototype,m=p.hasOwnProperty;function x(y){if(y==null)return!0;if(r(y)&&(s(y)||typeof y=="string"||typeof y.splice=="function"||a(y)||u(y)||n(y)))return!y.length;var v=t(y);if(v==d||v==f)return!y.size;if(l(y))return!e(y).length;for(var b in y)if(m.call(y,b))return!1;return!0}return r1=x,r1}var i1,jO;function t9(){if(jO)return i1;jO=1;function e(t){return t===void 0}return i1=e,i1}var a1,SO;function n9(){if(SO)return a1;SO=1;var e=Yg(),t=ni();function n(s,r){var a=-1,l=t(s)?Array(s.length):[];return e(s,function(u,d,f){l[++a]=r(u,d,f)}),l}return a1=n,a1}var o1,NO;function s9(){if(NO)return o1;NO=1;var e=Qg(),t=si(),n=n9(),s=Gt();function r(a,l){var u=s(a)?e:n;return u(a,t(l,3))}return o1=r,o1}var l1,kO;function loe(){if(kO)return l1;kO=1;function e(t,n,s,r){var a=-1,l=t==null?0:t.length;for(r&&l&&(s=t[++a]);++a<l;)s=n(s,t[a],a,t);return s}return l1=e,l1}var c1,_O;function coe(){if(_O)return c1;_O=1;function e(t,n,s,r,a){return a(t,function(l,u,d){s=r?(r=!1,l):n(s,l,u,d)}),s}return c1=e,c1}var u1,CO;function r9(){if(CO)return u1;CO=1;var e=loe(),t=Yg(),n=si(),s=coe(),r=Gt();function a(l,u,d){var f=r(l)?e:s,p=arguments.length<3;return f(l,n(u,4),d,p,t)}return u1=a,u1}var d1,EO;function uoe(){if(EO)return d1;EO=1;var e=Oo(),t=Gt(),n=hr(),s="[object String]";function r(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==s}return d1=r,d1}var f1,RO;function doe(){if(RO)return f1;RO=1;var e=Zq(),t=e("length");return f1=t,f1}var h1,AO;function foe(){if(AO)return h1;AO=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",r=t+n+s,a="\\ufe0e\\ufe0f",l="\\u200d",u=RegExp("["+l+e+r+a+"]");function d(f){return u.test(f)}return h1=d,h1}var p1,TO;function hoe(){if(TO)return p1;TO=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",r=t+n+s,a="\\ufe0e\\ufe0f",l="["+e+"]",u="["+r+"]",d="\\ud83c[\\udffb-\\udfff]",f="(?:"+u+"|"+d+")",p="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",x="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",v=f+"?",b="["+a+"]?",w="(?:"+y+"(?:"+[p,m,x].join("|")+")"+b+v+")*",S=b+v+w,E="(?:"+[p+u+"?",u,m,x,l].join("|")+")",k=RegExp(d+"(?="+d+")|"+E+S,"g");function _(R){for(var T=k.lastIndex=0;k.test(R);)++T;return T}return p1=_,p1}var m1,IO;function poe(){if(IO)return m1;IO=1;var e=doe(),t=foe(),n=hoe();function s(r){return t(r)?n(r):e(r)}return m1=s,m1}var g1,MO;function moe(){if(MO)return g1;MO=1;var e=t_(),t=$c(),n=ni(),s=uoe(),r=poe(),a="[object Map]",l="[object Set]";function u(d){if(d==null)return 0;if(n(d))return s(d)?r(d):d.length;var f=t(d);return f==a||f==l?d.size:e(d).length}return g1=u,g1}var x1,OO;function goe(){if(OO)return x1;OO=1;var e=Zk(),t=$q(),n=o_(),s=si(),r=Wg(),a=Gt(),l=Pc(),u=wf(),d=ks(),f=Nf();function p(m,x,y){var v=a(m),b=v||l(m)||f(m);if(x=s(x,4),y==null){var w=m&&m.constructor;b?y=v?new w:[]:d(m)?y=u(w)?t(r(m)):{}:y={}}return(b?e:n)(m,function(S,E,k){return x(y,S,E,k)}),y}return x1=p,x1}var y1,LO;function xoe(){if(LO)return y1;LO=1;var e=Lc(),t=Sf(),n=Gt(),s=e?e.isConcatSpreadable:void 0;function r(a){return n(a)||t(a)||!!(s&&a&&a[s])}return y1=r,y1}var v1,PO;function u_(){if(PO)return v1;PO=1;var e=s_(),t=xoe();function n(s,r,a,l,u){var d=-1,f=s.length;for(a||(a=t),u||(u=[]);++d<f;){var p=s[d];r>0&&a(p)?r>1?n(p,r-1,a,l,u):e(u,p):l||(u[u.length]=p)}return u}return v1=n,v1}var b1,$O;function yoe(){if($O)return b1;$O=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return b1=e,b1}var w1,DO;function i9(){if(DO)return w1;DO=1;var e=yoe(),t=Math.max;function n(s,r,a){return r=t(r===void 0?s.length-1:r,0),function(){for(var l=arguments,u=-1,d=t(l.length-r,0),f=Array(d);++u<d;)f[u]=l[r+u];u=-1;for(var p=Array(r+1);++u<r;)p[u]=l[u];return p[r]=a(f),e(s,this,p)}}return w1=n,w1}var j1,qO;function voe(){if(qO)return j1;qO=1;var e=i_(),t=Nq(),n=$o(),s=t?function(r,a){return t(r,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return j1=s,j1}var S1,zO;function boe(){if(zO)return S1;zO=1;var e=800,t=16,n=Date.now;function s(r){var a=0,l=0;return function(){var u=n(),d=t-(u-l);if(l=u,d>0){if(++a>=e)return arguments[0]}else a=0;return r.apply(void 0,arguments)}}return S1=s,S1}var N1,BO;function a9(){if(BO)return N1;BO=1;var e=voe(),t=boe(),n=t(e);return N1=n,N1}var k1,FO;function Jg(){if(FO)return k1;FO=1;var e=$o(),t=i9(),n=a9();function s(r,a){return n(t(r,a,e),r+"")}return k1=s,k1}var _1,HO;function o9(){if(HO)return _1;HO=1;function e(t,n,s,r){for(var a=t.length,l=s+(r?1:-1);r?l--:++l<a;)if(n(t[l],l,t))return l;return-1}return _1=e,_1}var C1,UO;function woe(){if(UO)return C1;UO=1;function e(t){return t!==t}return C1=e,C1}var E1,VO;function joe(){if(VO)return E1;VO=1;function e(t,n,s){for(var r=s-1,a=t.length;++r<a;)if(t[r]===n)return r;return-1}return E1=e,E1}var R1,GO;function Soe(){if(GO)return R1;GO=1;var e=o9(),t=woe(),n=joe();function s(r,a,l){return a===a?n(r,a,l):e(r,t,l)}return R1=s,R1}var A1,KO;function Noe(){if(KO)return A1;KO=1;var e=Soe();function t(n,s){var r=n==null?0:n.length;return!!r&&e(n,s,0)>-1}return A1=t,A1}var T1,WO;function koe(){if(WO)return T1;WO=1;function e(t,n,s){for(var r=-1,a=t==null?0:t.length;++r<a;)if(s(n,t[r]))return!0;return!1}return T1=e,T1}var I1,YO;function _oe(){if(YO)return I1;YO=1;function e(){}return I1=e,I1}var M1,QO;function Coe(){if(QO)return M1;QO=1;var e=Oq(),t=_oe(),n=l_(),s=1/0,r=e&&1/n(new e([,-0]))[1]==s?function(a){return new e(a)}:t;return M1=r,M1}var O1,XO;function Eoe(){if(XO)return O1;XO=1;var e=Hq(),t=Noe(),n=koe(),s=Uq(),r=Coe(),a=l_(),l=200;function u(d,f,p){var m=-1,x=t,y=d.length,v=!0,b=[],w=b;if(p)v=!1,x=n;else if(y>=l){var S=f?null:r(d);if(S)return a(S);v=!1,x=s,w=new e}else w=f?[]:b;e:for(;++m<y;){var E=d[m],k=f?f(E):E;if(E=p||E!==0?E:0,v&&k===k){for(var _=w.length;_--;)if(w[_]===k)continue e;f&&w.push(k),b.push(E)}else x(w,k,p)||(w!==b&&w.push(k),b.push(E))}return b}return O1=u,O1}var L1,ZO;function l9(){if(ZO)return L1;ZO=1;var e=ni(),t=hr();function n(s){return t(s)&&e(s)}return L1=n,L1}var P1,JO;function Roe(){if(JO)return P1;JO=1;var e=u_(),t=Jg(),n=Eoe(),s=l9(),r=t(function(a){return n(e(a,1,s,!0))});return P1=r,P1}var $1,e5;function Aoe(){if(e5)return $1;e5=1;var e=Qg();function t(n,s){return e(s,function(r){return n[r]})}return $1=t,$1}var D1,t5;function c9(){if(t5)return D1;t5=1;var e=Aoe(),t=ja();function n(s){return s==null?[]:e(s,t(s))}return D1=n,D1}var q1,n5;function _s(){if(n5)return q1;n5=1;var e;if(typeof Yk=="function")try{e={clone:$ae(),constant:i_(),each:Fq(),filter:Jq(),has:e9(),isArray:Gt(),isEmpty:ooe(),isFunction:wf(),isUndefined:t9(),keys:ja(),map:s9(),reduce:r9(),size:moe(),transform:goe(),union:Roe(),values:c9()}}catch{}return e||(e=window._),q1=e,q1}var z1,s5;function d_(){if(s5)return z1;s5=1;var e=_s();z1=r;var t="\0",n="\0",s="";function r(p){this._isDirected=e.has(p,"directed")?p.directed:!0,this._isMultigraph=e.has(p,"multigraph")?p.multigraph:!1,this._isCompound=e.has(p,"compound")?p.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(p){return this._label=p,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultNodeLabelFn=p,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return e.keys(this._nodes)},r.prototype.sources=function(){var p=this;return e.filter(this.nodes(),function(m){return e.isEmpty(p._in[m])})},r.prototype.sinks=function(){var p=this;return e.filter(this.nodes(),function(m){return e.isEmpty(p._out[m])})},r.prototype.setNodes=function(p,m){var x=arguments,y=this;return e.each(p,function(v){x.length>1?y.setNode(v,m):y.setNode(v)}),this},r.prototype.setNode=function(p,m){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=m),this):(this._nodes[p]=arguments.length>1?m:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=n,this._children[p]={},this._children[n][p]=!0),this._in[p]={},this._preds[p]={},this._out[p]={},this._sucs[p]={},++this._nodeCount,this)},r.prototype.node=function(p){return this._nodes[p]},r.prototype.hasNode=function(p){return e.has(this._nodes,p)},r.prototype.removeNode=function(p){var m=this;if(e.has(this._nodes,p)){var x=function(y){m.removeEdge(m._edgeObjs[y])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(y){m.setParent(y)}),delete this._children[p]),e.each(e.keys(this._in[p]),x),delete this._in[p],delete this._preds[p],e.each(e.keys(this._out[p]),x),delete this._out[p],delete this._sucs[p],--this._nodeCount}return this},r.prototype.setParent=function(p,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(m))m=n;else{m+="";for(var x=m;!e.isUndefined(x);x=this.parent(x))if(x===p)throw new Error("Setting "+m+" as parent of "+p+" would create a cycle");this.setNode(m)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=m,this._children[m][p]=!0,this},r.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},r.prototype.parent=function(p){if(this._isCompound){var m=this._parent[p];if(m!==n)return m}},r.prototype.children=function(p){if(e.isUndefined(p)&&(p=n),this._isCompound){var m=this._children[p];if(m)return e.keys(m)}else{if(p===n)return this.nodes();if(this.hasNode(p))return[]}},r.prototype.predecessors=function(p){var m=this._preds[p];if(m)return e.keys(m)},r.prototype.successors=function(p){var m=this._sucs[p];if(m)return e.keys(m)},r.prototype.neighbors=function(p){var m=this.predecessors(p);if(m)return e.union(m,this.successors(p))},r.prototype.isLeaf=function(p){var m;return this.isDirected()?m=this.successors(p):m=this.neighbors(p),m.length===0},r.prototype.filterNodes=function(p){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var x=this;e.each(this._nodes,function(b,w){p(w)&&m.setNode(w,b)}),e.each(this._edgeObjs,function(b){m.hasNode(b.v)&&m.hasNode(b.w)&&m.setEdge(b,x.edge(b))});var y={};function v(b){var w=x.parent(b);return w===void 0||m.hasNode(w)?(y[b]=w,w):w in y?y[w]:v(w)}return this._isCompound&&e.each(m.nodes(),function(b){m.setParent(b,v(b))}),m},r.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return e.values(this._edgeObjs)},r.prototype.setPath=function(p,m){var x=this,y=arguments;return e.reduce(p,function(v,b){return y.length>1?x.setEdge(v,b,m):x.setEdge(v,b),b}),this},r.prototype.setEdge=function(){var p,m,x,y,v=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(p=b.v,m=b.w,x=b.name,arguments.length===2&&(y=arguments[1],v=!0)):(p=b,m=arguments[1],x=arguments[3],arguments.length>2&&(y=arguments[2],v=!0)),p=""+p,m=""+m,e.isUndefined(x)||(x=""+x);var w=u(this._isDirected,p,m,x);if(e.has(this._edgeLabels,w))return v&&(this._edgeLabels[w]=y),this;if(!e.isUndefined(x)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(p),this.setNode(m),this._edgeLabels[w]=v?y:this._defaultEdgeLabelFn(p,m,x);var S=d(this._isDirected,p,m,x);return p=S.v,m=S.w,Object.freeze(S),this._edgeObjs[w]=S,a(this._preds[m],p),a(this._sucs[p],m),this._in[m][w]=S,this._out[p][w]=S,this._edgeCount++,this},r.prototype.edge=function(p,m,x){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,m,x);return this._edgeLabels[y]},r.prototype.hasEdge=function(p,m,x){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,m,x);return e.has(this._edgeLabels,y)},r.prototype.removeEdge=function(p,m,x){var y=arguments.length===1?f(this._isDirected,arguments[0]):u(this._isDirected,p,m,x),v=this._edgeObjs[y];return v&&(p=v.v,m=v.w,delete this._edgeLabels[y],delete this._edgeObjs[y],l(this._preds[m],p),l(this._sucs[p],m),delete this._in[m][y],delete this._out[p][y],this._edgeCount--),this},r.prototype.inEdges=function(p,m){var x=this._in[p];if(x){var y=e.values(x);return m?e.filter(y,function(v){return v.v===m}):y}},r.prototype.outEdges=function(p,m){var x=this._out[p];if(x){var y=e.values(x);return m?e.filter(y,function(v){return v.w===m}):y}},r.prototype.nodeEdges=function(p,m){var x=this.inEdges(p,m);if(x)return x.concat(this.outEdges(p,m))};function a(p,m){p[m]?p[m]++:p[m]=1}function l(p,m){--p[m]||delete p[m]}function u(p,m,x,y){var v=""+m,b=""+x;if(!p&&v>b){var w=v;v=b,b=w}return v+s+b+s+(e.isUndefined(y)?t:y)}function d(p,m,x,y){var v=""+m,b=""+x;if(!p&&v>b){var w=v;v=b,b=w}var S={v,w:b};return y&&(S.name=y),S}function f(p,m){return u(p,m.v,m.w,m.name)}return z1}var B1,r5;function Toe(){return r5||(r5=1,B1="2.1.8"),B1}var F1,i5;function Ioe(){return i5||(i5=1,F1={Graph:d_(),version:Toe()}),F1}var H1,a5;function Moe(){if(a5)return H1;a5=1;var e=_s(),t=d_();H1={write:n,read:a};function n(l){var u={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:s(l),edges:r(l)};return e.isUndefined(l.graph())||(u.value=e.clone(l.graph())),u}function s(l){return e.map(l.nodes(),function(u){var d=l.node(u),f=l.parent(u),p={v:u};return e.isUndefined(d)||(p.value=d),e.isUndefined(f)||(p.parent=f),p})}function r(l){return e.map(l.edges(),function(u){var d=l.edge(u),f={v:u.v,w:u.w};return e.isUndefined(u.name)||(f.name=u.name),e.isUndefined(d)||(f.value=d),f})}function a(l){var u=new t(l.options).setGraph(l.value);return e.each(l.nodes,function(d){u.setNode(d.v,d.value),d.parent&&u.setParent(d.v,d.parent)}),e.each(l.edges,function(d){u.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),u}return H1}var U1,o5;function Ooe(){if(o5)return U1;o5=1;var e=_s();U1=t;function t(n){var s={},r=[],a;function l(u){e.has(s,u)||(s[u]=!0,a.push(u),e.each(n.successors(u),l),e.each(n.predecessors(u),l))}return e.each(n.nodes(),function(u){a=[],l(u),a.length&&r.push(a)}),r}return U1}var V1,l5;function u9(){if(l5)return V1;l5=1;var e=_s();V1=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var s=this._keyIndices[n];if(s!==void 0)return this._arr[s].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,s){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var a=this._arr,l=a.length;return r[n]=l,a.push({key:n,priority:s}),this._decrease(l),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,s){var r=this._keyIndices[n];if(s>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[r].priority+" New: "+s);this._arr[r].priority=s,this._decrease(r)},t.prototype._heapify=function(n){var s=this._arr,r=2*n,a=r+1,l=n;r<s.length&&(l=s[r].priority<s[l].priority?r:l,a<s.length&&(l=s[a].priority<s[l].priority?a:l),l!==n&&(this._swap(n,l),this._heapify(l)))},t.prototype._decrease=function(n){for(var s=this._arr,r=s[n].priority,a;n!==0&&(a=n>>1,!(s[a].priority<r));)this._swap(n,a),n=a},t.prototype._swap=function(n,s){var r=this._arr,a=this._keyIndices,l=r[n],u=r[s];r[n]=u,r[s]=l,a[u.key]=n,a[l.key]=s},V1}var G1,c5;function d9(){if(c5)return G1;c5=1;var e=_s(),t=u9();G1=s;var n=e.constant(1);function s(a,l,u,d){return r(a,String(l),u||n,d||function(f){return a.outEdges(f)})}function r(a,l,u,d){var f={},p=new t,m,x,y=function(v){var b=v.v!==m?v.v:v.w,w=f[b],S=u(v),E=x.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+S);E<w.distance&&(w.distance=E,w.predecessor=m,p.decrease(b,E))};for(a.nodes().forEach(function(v){var b=v===l?0:Number.POSITIVE_INFINITY;f[v]={distance:b},p.add(v,b)});p.size()>0&&(m=p.removeMin(),x=f[m],x.distance!==Number.POSITIVE_INFINITY);)d(m).forEach(y);return f}return G1}var K1,u5;function Loe(){if(u5)return K1;u5=1;var e=d9(),t=_s();K1=n;function n(s,r,a){return t.transform(s.nodes(),function(l,u){l[u]=e(s,u,r,a)},{})}return K1}var W1,d5;function f9(){if(d5)return W1;d5=1;var e=_s();W1=t;function t(n){var s=0,r=[],a={},l=[];function u(d){var f=a[d]={onStack:!0,lowlink:s,index:s++};if(r.push(d),n.successors(d).forEach(function(x){e.has(a,x)?a[x].onStack&&(f.lowlink=Math.min(f.lowlink,a[x].index)):(u(x),f.lowlink=Math.min(f.lowlink,a[x].lowlink))}),f.lowlink===f.index){var p=[],m;do m=r.pop(),a[m].onStack=!1,p.push(m);while(d!==m);l.push(p)}}return n.nodes().forEach(function(d){e.has(a,d)||u(d)}),l}return W1}var Y1,f5;function Poe(){if(f5)return Y1;f5=1;var e=_s(),t=f9();Y1=n;function n(s){return e.filter(t(s),function(r){return r.length>1||r.length===1&&s.hasEdge(r[0],r[0])})}return Y1}var Q1,h5;function $oe(){if(h5)return Q1;h5=1;var e=_s();Q1=n;var t=e.constant(1);function n(r,a,l){return s(r,a||t,l||function(u){return r.outEdges(u)})}function s(r,a,l){var u={},d=r.nodes();return d.forEach(function(f){u[f]={},u[f][f]={distance:0},d.forEach(function(p){f!==p&&(u[f][p]={distance:Number.POSITIVE_INFINITY})}),l(f).forEach(function(p){var m=p.v===f?p.w:p.v,x=a(p);u[f][m]={distance:x,predecessor:f}})}),d.forEach(function(f){var p=u[f];d.forEach(function(m){var x=u[m];d.forEach(function(y){var v=x[f],b=p[y],w=x[y],S=v.distance+b.distance;S<w.distance&&(w.distance=S,w.predecessor=b.predecessor)})})}),u}return Q1}var X1,p5;function h9(){if(p5)return X1;p5=1;var e=_s();X1=t,t.CycleException=n;function t(s){var r={},a={},l=[];function u(d){if(e.has(a,d))throw new n;e.has(r,d)||(a[d]=!0,r[d]=!0,e.each(s.predecessors(d),u),delete a[d],l.push(d))}if(e.each(s.sinks(),u),e.size(r)!==s.nodeCount())throw new n;return l}function n(){}return n.prototype=new Error,X1}var Z1,m5;function Doe(){if(m5)return Z1;m5=1;var e=h9();Z1=t;function t(n){try{e(n)}catch(s){if(s instanceof e.CycleException)return!1;throw s}return!0}return Z1}var J1,g5;function p9(){if(g5)return J1;g5=1;var e=_s();J1=t;function t(s,r,a){e.isArray(r)||(r=[r]);var l=(s.isDirected()?s.successors:s.neighbors).bind(s),u=[],d={};return e.each(r,function(f){if(!s.hasNode(f))throw new Error("Graph does not have node: "+f);n(s,f,a==="post",d,l,u)}),u}function n(s,r,a,l,u,d){e.has(l,r)||(l[r]=!0,a||d.push(r),e.each(u(r),function(f){n(s,f,a,l,u,d)}),a&&d.push(r))}return J1}var ej,x5;function qoe(){if(x5)return ej;x5=1;var e=p9();ej=t;function t(n,s){return e(n,s,"post")}return ej}var tj,y5;function zoe(){if(y5)return tj;y5=1;var e=p9();tj=t;function t(n,s){return e(n,s,"pre")}return tj}var nj,v5;function Boe(){if(v5)return nj;v5=1;var e=_s(),t=d_(),n=u9();nj=s;function s(r,a){var l=new t,u={},d=new n,f;function p(x){var y=x.v===f?x.w:x.v,v=d.priority(y);if(v!==void 0){var b=a(x);b<v&&(u[y]=f,d.decrease(y,b))}}if(r.nodeCount()===0)return l;e.each(r.nodes(),function(x){d.add(x,Number.POSITIVE_INFINITY),l.setNode(x)}),d.decrease(r.nodes()[0],0);for(var m=!1;d.size()>0;){if(f=d.removeMin(),e.has(u,f))l.setEdge(f,u[f]);else{if(m)throw new Error("Input graph is not connected: "+r);m=!0}r.nodeEdges(f).forEach(p)}return l}return nj}var sj,b5;function Foe(){return b5||(b5=1,sj={components:Ooe(),dijkstra:d9(),dijkstraAll:Loe(),findCycles:Poe(),floydWarshall:$oe(),isAcyclic:Doe(),postorder:qoe(),preorder:zoe(),prim:Boe(),tarjan:f9(),topsort:h9()}),sj}var rj,w5;function Hoe(){if(w5)return rj;w5=1;var e=Ioe();return rj={Graph:e.Graph,json:Moe(),alg:Foe(),version:e.version},rj}var ij,j5;function Fs(){if(j5)return ij;j5=1;var e;if(typeof Yk=="function")try{e=Hoe()}catch{}return e||(e=window.graphlib),ij=e,ij}var aj,S5;function Uoe(){if(S5)return aj;S5=1;var e=qq(),t=1,n=4;function s(r){return e(r,t|n)}return aj=s,aj}var oj,N5;function ex(){if(N5)return oj;N5=1;var e=Oc(),t=ni(),n=Vg(),s=ks();function r(a,l,u){if(!s(u))return!1;var d=typeof l;return(d=="number"?t(u)&&n(l,u.length):d=="string"&&l in u)?e(u[l],a):!1}return oj=r,oj}var lj,k5;function Voe(){if(k5)return lj;k5=1;var e=Jg(),t=Oc(),n=ex(),s=Po(),r=Object.prototype,a=r.hasOwnProperty,l=e(function(u,d){u=Object(u);var f=-1,p=d.length,m=p>2?d[2]:void 0;for(m&&n(d[0],d[1],m)&&(p=1);++f<p;)for(var x=d[f],y=s(x),v=-1,b=y.length;++v<b;){var w=y[v],S=u[w];(S===void 0||t(S,r[w])&&!a.call(u,w))&&(u[w]=x[w])}return u});return lj=l,lj}var cj,_5;function Goe(){if(_5)return cj;_5=1;var e=si(),t=ni(),n=ja();function s(r){return function(a,l,u){var d=Object(a);if(!t(a)){var f=e(l,3);a=n(a),l=function(m){return f(d[m],m,d)}}var p=r(a,l,u);return p>-1?d[f?a[p]:p]:void 0}}return cj=s,cj}var uj,C5;function Koe(){if(C5)return uj;C5=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return uj=t,uj}var dj,E5;function Woe(){if(E5)return dj;E5=1;var e=Koe(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return dj=n,dj}var fj,R5;function Yoe(){if(R5)return fj;R5=1;var e=Woe(),t=ks(),n=Dc(),s=NaN,r=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;function d(f){if(typeof f=="number")return f;if(n(f))return s;if(t(f)){var p=typeof f.valueOf=="function"?f.valueOf():f;f=t(p)?p+"":p}if(typeof f!="string")return f===0?f:+f;f=e(f);var m=a.test(f);return m||l.test(f)?u(f.slice(2),m?2:8):r.test(f)?s:+f}return fj=d,fj}var hj,A5;function m9(){if(A5)return hj;A5=1;var e=Yoe(),t=1/0,n=17976931348623157e292;function s(r){if(!r)return r===0?r:0;if(r=e(r),r===t||r===-t){var a=r<0?-1:1;return a*n}return r===r?r:0}return hj=s,hj}var pj,T5;function Qoe(){if(T5)return pj;T5=1;var e=m9();function t(n){var s=e(n),r=s%1;return s===s?r?s-r:s:0}return pj=t,pj}var mj,I5;function Xoe(){if(I5)return mj;I5=1;var e=o9(),t=si(),n=Qoe(),s=Math.max;function r(a,l,u){var d=a==null?0:a.length;if(!d)return-1;var f=u==null?0:n(u);return f<0&&(f=s(d+f,0)),e(a,t(l,3),f)}return mj=r,mj}var gj,M5;function Zoe(){if(M5)return gj;M5=1;var e=Goe(),t=Xoe(),n=e(t);return gj=n,gj}var xj,O5;function g9(){if(O5)return xj;O5=1;var e=u_();function t(n){var s=n==null?0:n.length;return s?e(n,1):[]}return xj=t,xj}var yj,L5;function Joe(){if(L5)return yj;L5=1;var e=a_(),t=zq(),n=Po();function s(r,a){return r==null?r:e(r,t(a),n)}return yj=s,yj}var vj,P5;function ele(){if(P5)return vj;P5=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return vj=e,vj}var bj,$5;function tle(){if($5)return bj;$5=1;var e=Hg(),t=o_(),n=si();function s(r,a){var l={};return a=n(a,3),t(r,function(u,d,f){e(l,d,a(u,d,f))}),l}return bj=s,bj}var wj,D5;function f_(){if(D5)return wj;D5=1;var e=Dc();function t(n,s,r){for(var a=-1,l=n.length;++a<l;){var u=n[a],d=s(u);if(d!=null&&(f===void 0?d===d&&!e(d):r(d,f)))var f=d,p=u}return p}return wj=t,wj}var jj,q5;function nle(){if(q5)return jj;q5=1;function e(t,n){return t>n}return jj=e,jj}var Sj,z5;function sle(){if(z5)return Sj;z5=1;var e=f_(),t=nle(),n=$o();function s(r){return r&&r.length?e(r,n,t):void 0}return Sj=s,Sj}var Nj,B5;function x9(){if(B5)return Nj;B5=1;var e=Hg(),t=Oc();function n(s,r,a){(a!==void 0&&!t(s[r],a)||a===void 0&&!(r in s))&&e(s,r,a)}return Nj=n,Nj}var kj,F5;function rle(){if(F5)return kj;F5=1;var e=Oo(),t=Wg(),n=hr(),s="[object Object]",r=Function.prototype,a=Object.prototype,l=r.toString,u=a.hasOwnProperty,d=l.call(Object);function f(p){if(!n(p)||e(p)!=s)return!1;var m=t(p);if(m===null)return!0;var x=u.call(m,"constructor")&&m.constructor;return typeof x=="function"&&x instanceof x&&l.call(x)==d}return kj=f,kj}var _j,H5;function y9(){if(H5)return _j;H5=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return _j=e,_j}var Cj,U5;function ile(){if(U5)return Cj;U5=1;var e=jf(),t=Po();function n(s){return e(s,t(s))}return Cj=n,Cj}var Ej,V5;function ale(){if(V5)return Ej;V5=1;var e=x9(),t=Cq(),n=Pq(),s=Eq(),r=Dq(),a=Sf(),l=Gt(),u=l9(),d=Pc(),f=wf(),p=ks(),m=rle(),x=Nf(),y=y9(),v=ile();function b(w,S,E,k,_,R,T){var A=y(w,E),M=y(S,E),L=T.get(M);if(L){e(w,E,L);return}var P=R?R(A,M,E+"",w,S,T):void 0,O=P===void 0;if(O){var B=l(M),H=!B&&d(M),z=!B&&!H&&x(M);P=M,B||H||z?l(A)?P=A:u(A)?P=s(A):H?(O=!1,P=t(M,!0)):z?(O=!1,P=n(M,!0)):P=[]:m(M)||a(M)?(P=A,a(A)?P=v(A):(!p(A)||f(A))&&(P=r(M))):O=!1}O&&(T.set(M,P),_(P,M,k,R,T),T.delete(M)),e(w,E,P)}return Ej=b,Ej}var Rj,G5;function ole(){if(G5)return Rj;G5=1;var e=Fg(),t=x9(),n=a_(),s=ale(),r=ks(),a=Po(),l=y9();function u(d,f,p,m,x){d!==f&&n(f,function(y,v){if(x||(x=new e),r(y))s(d,f,v,p,u,m,x);else{var b=m?m(l(d,v),y,v+"",d,f,x):void 0;b===void 0&&(b=y),t(d,v,b)}},a)}return Rj=u,Rj}var Aj,K5;function lle(){if(K5)return Aj;K5=1;var e=Jg(),t=ex();function n(s){return e(function(r,a){var l=-1,u=a.length,d=u>1?a[u-1]:void 0,f=u>2?a[2]:void 0;for(d=s.length>3&&typeof d=="function"?(u--,d):void 0,f&&t(a[0],a[1],f)&&(d=u<3?void 0:d,u=1),r=Object(r);++l<u;){var p=a[l];p&&s(r,p,l,d)}return r})}return Aj=n,Aj}var Tj,W5;function cle(){if(W5)return Tj;W5=1;var e=ole(),t=lle(),n=t(function(s,r,a){e(s,r,a)});return Tj=n,Tj}var Ij,Y5;function v9(){if(Y5)return Ij;Y5=1;function e(t,n){return t<n}return Ij=e,Ij}var Mj,Q5;function ule(){if(Q5)return Mj;Q5=1;var e=f_(),t=v9(),n=$o();function s(r){return r&&r.length?e(r,n,t):void 0}return Mj=s,Mj}var Oj,X5;function dle(){if(X5)return Oj;X5=1;var e=f_(),t=si(),n=v9();function s(r,a){return r&&r.length?e(r,t(a,2),n):void 0}return Oj=s,Oj}var Lj,Z5;function fle(){if(Z5)return Lj;Z5=1;var e=Vs(),t=function(){return e.Date.now()};return Lj=t,Lj}var Pj,J5;function hle(){if(J5)return Pj;J5=1;var e=Ug(),t=Xg(),n=Vg(),s=ks(),r=kf();function a(l,u,d,f){if(!s(l))return l;u=t(u,l);for(var p=-1,m=u.length,x=m-1,y=l;y!=null&&++p<m;){var v=r(u[p]),b=d;if(v==="__proto__"||v==="constructor"||v==="prototype")return l;if(p!=x){var w=y[v];b=f?f(w,v,y):void 0,b===void 0&&(b=s(w)?w:n(u[p+1])?[]:{})}e(y,v,b),y=y[v]}return l}return Pj=a,Pj}var $j,eL;function ple(){if(eL)return $j;eL=1;var e=Zg(),t=hle(),n=Xg();function s(r,a,l){for(var u=-1,d=a.length,f={};++u<d;){var p=a[u],m=e(r,p);l(m,p)&&t(f,n(p,r),m)}return f}return $j=s,$j}var Dj,tL;function mle(){if(tL)return Dj;tL=1;var e=ple(),t=Xq();function n(s,r){return e(s,r,function(a,l){return t(s,l)})}return Dj=n,Dj}var qj,nL;function gle(){if(nL)return qj;nL=1;var e=g9(),t=i9(),n=a9();function s(r){return n(t(r,void 0,e),r+"")}return qj=s,qj}var zj,sL;function xle(){if(sL)return zj;sL=1;var e=mle(),t=gle(),n=t(function(s,r){return s==null?{}:e(s,r)});return zj=n,zj}var Bj,rL;function yle(){if(rL)return Bj;rL=1;var e=Math.ceil,t=Math.max;function n(s,r,a,l){for(var u=-1,d=t(e((r-s)/(a||1)),0),f=Array(d);d--;)f[l?d:++u]=s,s+=a;return f}return Bj=n,Bj}var Fj,iL;function vle(){if(iL)return Fj;iL=1;var e=yle(),t=ex(),n=m9();function s(r){return function(a,l,u){return u&&typeof u!="number"&&t(a,l,u)&&(l=u=void 0),a=n(a),l===void 0?(l=a,a=0):l=n(l),u=u===void 0?a<l?1:-1:n(u),e(a,l,u,r)}}return Fj=s,Fj}var Hj,aL;function ble(){if(aL)return Hj;aL=1;var e=vle(),t=e();return Hj=t,Hj}var Uj,oL;function wle(){if(oL)return Uj;oL=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return Uj=e,Uj}var Vj,lL;function jle(){if(lL)return Vj;lL=1;var e=Dc();function t(n,s){if(n!==s){var r=n!==void 0,a=n===null,l=n===n,u=e(n),d=s!==void 0,f=s===null,p=s===s,m=e(s);if(!f&&!m&&!u&&n>s||u&&d&&p&&!f&&!m||a&&d&&p||!r&&p||!l)return 1;if(!a&&!u&&!m&&n<s||m&&r&&l&&!a&&!u||f&&r&&l||!d&&l||!p)return-1}return 0}return Vj=t,Vj}var Gj,cL;function Sle(){if(cL)return Gj;cL=1;var e=jle();function t(n,s,r){for(var a=-1,l=n.criteria,u=s.criteria,d=l.length,f=r.length;++a<d;){var p=e(l[a],u[a]);if(p){if(a>=f)return p;var m=r[a];return p*(m=="desc"?-1:1)}}return n.index-s.index}return Gj=t,Gj}var Kj,uL;function Nle(){if(uL)return Kj;uL=1;var e=Qg(),t=Zg(),n=si(),s=n9(),r=wle(),a=Gg(),l=Sle(),u=$o(),d=Gt();function f(p,m,x){m.length?m=e(m,function(b){return d(b)?function(w){return t(w,b.length===1?b[0]:b)}:b}):m=[u];var y=-1;m=e(m,a(n));var v=s(p,function(b,w,S){var E=e(m,function(k){return k(b)});return{criteria:E,index:++y,value:b}});return r(v,function(b,w){return l(b,w,x)})}return Kj=f,Kj}var Wj,dL;function kle(){if(dL)return Wj;dL=1;var e=u_(),t=Nle(),n=Jg(),s=ex(),r=n(function(a,l){if(a==null)return[];var u=l.length;return u>1&&s(a,l[0],l[1])?l=[]:u>2&&s(l[0],l[1],l[2])&&(l=[l[0]]),t(a,e(l,1),[])});return Wj=r,Wj}var Yj,fL;function _le(){if(fL)return Yj;fL=1;var e=Yq(),t=0;function n(s){var r=++t;return e(s)+r}return Yj=n,Yj}var Qj,hL;function Cle(){if(hL)return Qj;hL=1;function e(t,n,s){for(var r=-1,a=t.length,l=n.length,u={};++r<a;){var d=r<l?n[r]:void 0;s(u,t[r],d)}return u}return Qj=e,Qj}var Xj,pL;function Ele(){if(pL)return Xj;pL=1;var e=Ug(),t=Cle();function n(s,r){return t(s||[],r||[],e)}return Xj=n,Xj}var Zj,mL;function kt(){if(mL)return Zj;mL=1;var e;if(typeof Yk=="function")try{e={cloneDeep:Uoe(),constant:i_(),defaults:Voe(),each:Fq(),filter:Jq(),find:Zoe(),flatten:g9(),forEach:Bq(),forIn:Joe(),has:e9(),isUndefined:t9(),last:ele(),map:s9(),mapValues:tle(),max:sle(),merge:cle(),min:ule(),minBy:dle(),now:fle(),pick:xle(),range:ble(),reduce:r9(),sortBy:kle(),uniqueId:_le(),values:c9(),zipObject:Ele()}}catch{}return e||(e=window._),Zj=e,Zj}var Jj,gL;function Rle(){if(gL)return Jj;gL=1,Jj=e;function e(){var s={};s._next=s._prev=s,this._sentinel=s}e.prototype.dequeue=function(){var s=this._sentinel,r=s._prev;if(r!==s)return t(r),r},e.prototype.enqueue=function(s){var r=this._sentinel;s._prev&&s._next&&t(s),s._next=r._next,r._next._prev=s,r._next=s,s._prev=r},e.prototype.toString=function(){for(var s=[],r=this._sentinel,a=r._prev;a!==r;)s.push(JSON.stringify(a,n)),a=a._prev;return"["+s.join(", ")+"]"};function t(s){s._prev._next=s._next,s._next._prev=s._prev,delete s._next,delete s._prev}function n(s,r){if(s!=="_next"&&s!=="_prev")return r}return Jj}var eS,xL;function Ale(){if(xL)return eS;xL=1;var e=kt(),t=Fs().Graph,n=Rle();eS=r;var s=e.constant(1);function r(f,p){if(f.nodeCount()<=1)return[];var m=u(f,p||s),x=a(m.graph,m.buckets,m.zeroIdx);return e.flatten(e.map(x,function(y){return f.outEdges(y.v,y.w)}),!0)}function a(f,p,m){for(var x=[],y=p[p.length-1],v=p[0],b;f.nodeCount();){for(;b=v.dequeue();)l(f,p,m,b);for(;b=y.dequeue();)l(f,p,m,b);if(f.nodeCount()){for(var w=p.length-2;w>0;--w)if(b=p[w].dequeue(),b){x=x.concat(l(f,p,m,b,!0));break}}}return x}function l(f,p,m,x,y){var v=y?[]:void 0;return e.forEach(f.inEdges(x.v),function(b){var w=f.edge(b),S=f.node(b.v);y&&v.push({v:b.v,w:b.w}),S.out-=w,d(p,m,S)}),e.forEach(f.outEdges(x.v),function(b){var w=f.edge(b),S=b.w,E=f.node(S);E.in-=w,d(p,m,E)}),f.removeNode(x.v),v}function u(f,p){var m=new t,x=0,y=0;e.forEach(f.nodes(),function(w){m.setNode(w,{v:w,in:0,out:0})}),e.forEach(f.edges(),function(w){var S=m.edge(w.v,w.w)||0,E=p(w),k=S+E;m.setEdge(w.v,w.w,k),y=Math.max(y,m.node(w.v).out+=E),x=Math.max(x,m.node(w.w).in+=E)});var v=e.range(y+x+3).map(function(){return new n}),b=x+1;return e.forEach(m.nodes(),function(w){d(v,b,m.node(w))}),{graph:m,buckets:v,zeroIdx:b}}function d(f,p,m){m.out?m.in?f[m.out-m.in+p].enqueue(m):f[f.length-1].enqueue(m):f[0].enqueue(m)}return eS}var tS,yL;function Tle(){if(yL)return tS;yL=1;var e=kt(),t=Ale();tS={run:n,undo:r};function n(a){var l=a.graph().acyclicer==="greedy"?t(a,u(a)):s(a);e.forEach(l,function(d){var f=a.edge(d);a.removeEdge(d),f.forwardName=d.name,f.reversed=!0,a.setEdge(d.w,d.v,f,e.uniqueId("rev"))});function u(d){return function(f){return d.edge(f).weight}}}function s(a){var l=[],u={},d={};function f(p){e.has(d,p)||(d[p]=!0,u[p]=!0,e.forEach(a.outEdges(p),function(m){e.has(u,m.w)?l.push(m):f(m.w)}),delete u[p])}return e.forEach(a.nodes(),f),l}function r(a){e.forEach(a.edges(),function(l){var u=a.edge(l);if(u.reversed){a.removeEdge(l);var d=u.forwardName;delete u.reversed,delete u.forwardName,a.setEdge(l.w,l.v,u,d)}})}return tS}var nS,vL;function Un(){if(vL)return nS;vL=1;var e=kt(),t=Fs().Graph;nS={addDummyNode:n,simplify:s,asNonCompoundGraph:r,successorWeights:a,predecessorWeights:l,intersectRect:u,buildLayerMatrix:d,normalizeRanks:f,removeEmptyRanks:p,addBorderNode:m,maxRank:x,partition:y,time:v,notime:b};function n(w,S,E,k){var _;do _=e.uniqueId(k);while(w.hasNode(_));return E.dummy=S,w.setNode(_,E),_}function s(w){var S=new t().setGraph(w.graph());return e.forEach(w.nodes(),function(E){S.setNode(E,w.node(E))}),e.forEach(w.edges(),function(E){var k=S.edge(E.v,E.w)||{weight:0,minlen:1},_=w.edge(E);S.setEdge(E.v,E.w,{weight:k.weight+_.weight,minlen:Math.max(k.minlen,_.minlen)})}),S}function r(w){var S=new t({multigraph:w.isMultigraph()}).setGraph(w.graph());return e.forEach(w.nodes(),function(E){w.children(E).length||S.setNode(E,w.node(E))}),e.forEach(w.edges(),function(E){S.setEdge(E,w.edge(E))}),S}function a(w){var S=e.map(w.nodes(),function(E){var k={};return e.forEach(w.outEdges(E),function(_){k[_.w]=(k[_.w]||0)+w.edge(_).weight}),k});return e.zipObject(w.nodes(),S)}function l(w){var S=e.map(w.nodes(),function(E){var k={};return e.forEach(w.inEdges(E),function(_){k[_.v]=(k[_.v]||0)+w.edge(_).weight}),k});return e.zipObject(w.nodes(),S)}function u(w,S){var E=w.x,k=w.y,_=S.x-E,R=S.y-k,T=w.width/2,A=w.height/2;if(!_&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var M,L;return Math.abs(R)*T>Math.abs(_)*A?(R<0&&(A=-A),M=A*_/R,L=A):(_<0&&(T=-T),M=T,L=T*R/_),{x:E+M,y:k+L}}function d(w){var S=e.map(e.range(x(w)+1),function(){return[]});return e.forEach(w.nodes(),function(E){var k=w.node(E),_=k.rank;e.isUndefined(_)||(S[_][k.order]=E)}),S}function f(w){var S=e.min(e.map(w.nodes(),function(E){return w.node(E).rank}));e.forEach(w.nodes(),function(E){var k=w.node(E);e.has(k,"rank")&&(k.rank-=S)})}function p(w){var S=e.min(e.map(w.nodes(),function(R){return w.node(R).rank})),E=[];e.forEach(w.nodes(),function(R){var T=w.node(R).rank-S;E[T]||(E[T]=[]),E[T].push(R)});var k=0,_=w.graph().nodeRankFactor;e.forEach(E,function(R,T){e.isUndefined(R)&&T%_!==0?--k:k&&e.forEach(R,function(A){w.node(A).rank+=k})})}function m(w,S,E,k){var _={width:0,height:0};return arguments.length>=4&&(_.rank=E,_.order=k),n(w,"border",_,S)}function x(w){return e.max(e.map(w.nodes(),function(S){var E=w.node(S).rank;if(!e.isUndefined(E))return E}))}function y(w,S){var E={lhs:[],rhs:[]};return e.forEach(w,function(k){S(k)?E.lhs.push(k):E.rhs.push(k)}),E}function v(w,S){var E=e.now();try{return S()}finally{console.log(w+" time: "+(e.now()-E)+"ms")}}function b(w,S){return S()}return nS}var sS,bL;function Ile(){if(bL)return sS;bL=1;var e=kt(),t=Un();sS={run:n,undo:r};function n(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(l){s(a,l)})}function s(a,l){var u=l.v,d=a.node(u).rank,f=l.w,p=a.node(f).rank,m=l.name,x=a.edge(l),y=x.labelRank;if(p!==d+1){a.removeEdge(l);var v,b,w;for(w=0,++d;d<p;++w,++d)x.points=[],b={width:0,height:0,edgeLabel:x,edgeObj:l,rank:d},v=t.addDummyNode(a,"edge",b,"_d"),d===y&&(b.width=x.width,b.height=x.height,b.dummy="edge-label",b.labelpos=x.labelpos),a.setEdge(u,v,{weight:x.weight},m),w===0&&a.graph().dummyChains.push(v),u=v;a.setEdge(u,f,{weight:x.weight},m)}}function r(a){e.forEach(a.graph().dummyChains,function(l){var u=a.node(l),d=u.edgeLabel,f;for(a.setEdge(u.edgeObj,d);u.dummy;)f=a.successors(l)[0],a.removeNode(l),d.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(d.x=u.x,d.y=u.y,d.width=u.width,d.height=u.height),l=f,u=a.node(l)})}return sS}var rS,wL;function $m(){if(wL)return rS;wL=1;var e=kt();rS={longestPath:t,slack:n};function t(s){var r={};function a(l){var u=s.node(l);if(e.has(r,l))return u.rank;r[l]=!0;var d=e.min(e.map(s.outEdges(l),function(f){return a(f.w)-s.edge(f).minlen}));return(d===Number.POSITIVE_INFINITY||d===void 0||d===null)&&(d=0),u.rank=d}e.forEach(s.sources(),a)}function n(s,r){return s.node(r.w).rank-s.node(r.v).rank-s.edge(r).minlen}return rS}var iS,jL;function b9(){if(jL)return iS;jL=1;var e=kt(),t=Fs().Graph,n=$m().slack;iS=s;function s(u){var d=new t({directed:!1}),f=u.nodes()[0],p=u.nodeCount();d.setNode(f,{});for(var m,x;r(d,u)<p;)m=a(d,u),x=d.hasNode(m.v)?n(u,m):-n(u,m),l(d,u,x);return d}function r(u,d){function f(p){e.forEach(d.nodeEdges(p),function(m){var x=m.v,y=p===x?m.w:x;!u.hasNode(y)&&!n(d,m)&&(u.setNode(y,{}),u.setEdge(p,y,{}),f(y))})}return e.forEach(u.nodes(),f),u.nodeCount()}function a(u,d){return e.minBy(d.edges(),function(f){if(u.hasNode(f.v)!==u.hasNode(f.w))return n(d,f)})}function l(u,d,f){e.forEach(u.nodes(),function(p){d.node(p).rank+=f})}return iS}var aS,SL;function Mle(){if(SL)return aS;SL=1;var e=kt(),t=b9(),n=$m().slack,s=$m().longestPath,r=Fs().alg.preorder,a=Fs().alg.postorder,l=Un().simplify;aS=u,u.initLowLimValues=m,u.initCutValues=d,u.calcCutValue=p,u.leaveEdge=y,u.enterEdge=v,u.exchangeEdges=b;function u(k){k=l(k),s(k);var _=t(k);m(_),d(_,k);for(var R,T;R=y(_);)T=v(_,k,R),b(_,k,R,T)}function d(k,_){var R=a(k,k.nodes());R=R.slice(0,R.length-1),e.forEach(R,function(T){f(k,_,T)})}function f(k,_,R){var T=k.node(R),A=T.parent;k.edge(R,A).cutvalue=p(k,_,R)}function p(k,_,R){var T=k.node(R),A=T.parent,M=!0,L=_.edge(R,A),P=0;return L||(M=!1,L=_.edge(A,R)),P=L.weight,e.forEach(_.nodeEdges(R),function(O){var B=O.v===R,H=B?O.w:O.v;if(H!==A){var z=B===M,W=_.edge(O).weight;if(P+=z?W:-W,S(k,R,H)){var $=k.edge(R,H).cutvalue;P+=z?-$:$}}}),P}function m(k,_){arguments.length<2&&(_=k.nodes()[0]),x(k,{},1,_)}function x(k,_,R,T,A){var M=R,L=k.node(T);return _[T]=!0,e.forEach(k.neighbors(T),function(P){e.has(_,P)||(R=x(k,_,R,P,T))}),L.low=M,L.lim=R++,A?L.parent=A:delete L.parent,R}function y(k){return e.find(k.edges(),function(_){return k.edge(_).cutvalue<0})}function v(k,_,R){var T=R.v,A=R.w;_.hasEdge(T,A)||(T=R.w,A=R.v);var M=k.node(T),L=k.node(A),P=M,O=!1;M.lim>L.lim&&(P=L,O=!0);var B=e.filter(_.edges(),function(H){return O===E(k,k.node(H.v),P)&&O!==E(k,k.node(H.w),P)});return e.minBy(B,function(H){return n(_,H)})}function b(k,_,R,T){var A=R.v,M=R.w;k.removeEdge(A,M),k.setEdge(T.v,T.w,{}),m(k),d(k,_),w(k,_)}function w(k,_){var R=e.find(k.nodes(),function(A){return!_.node(A).parent}),T=r(k,R);T=T.slice(1),e.forEach(T,function(A){var M=k.node(A).parent,L=_.edge(A,M),P=!1;L||(L=_.edge(M,A),P=!0),_.node(A).rank=_.node(M).rank+(P?L.minlen:-L.minlen)})}function S(k,_,R){return k.hasEdge(_,R)}function E(k,_,R){return R.low<=_.lim&&_.lim<=R.lim}return aS}var oS,NL;function Ole(){if(NL)return oS;NL=1;var e=$m(),t=e.longestPath,n=b9(),s=Mle();oS=r;function r(d){switch(d.graph().ranker){case"network-simplex":u(d);break;case"tight-tree":l(d);break;case"longest-path":a(d);break;default:u(d)}}var a=t;function l(d){t(d),n(d)}function u(d){s(d)}return oS}var lS,kL;function Lle(){if(kL)return lS;kL=1;var e=kt();lS=t;function t(r){var a=s(r);e.forEach(r.graph().dummyChains,function(l){for(var u=r.node(l),d=u.edgeObj,f=n(r,a,d.v,d.w),p=f.path,m=f.lca,x=0,y=p[x],v=!0;l!==d.w;){if(u=r.node(l),v){for(;(y=p[x])!==m&&r.node(y).maxRank<u.rank;)x++;y===m&&(v=!1)}if(!v){for(;x<p.length-1&&r.node(y=p[x+1]).minRank<=u.rank;)x++;y=p[x]}r.setParent(l,y),l=r.successors(l)[0]}})}function n(r,a,l,u){var d=[],f=[],p=Math.min(a[l].low,a[u].low),m=Math.max(a[l].lim,a[u].lim),x,y;x=l;do x=r.parent(x),d.push(x);while(x&&(a[x].low>p||m>a[x].lim));for(y=x,x=u;(x=r.parent(x))!==y;)f.push(x);return{path:d.concat(f.reverse()),lca:y}}function s(r){var a={},l=0;function u(d){var f=l;e.forEach(r.children(d),u),a[d]={low:f,lim:l++}}return e.forEach(r.children(),u),a}return lS}var cS,_L;function Ple(){if(_L)return cS;_L=1;var e=kt(),t=Un();cS={run:n,cleanup:l};function n(u){var d=t.addDummyNode(u,"root",{},"_root"),f=r(u),p=e.max(e.values(f))-1,m=2*p+1;u.graph().nestingRoot=d,e.forEach(u.edges(),function(y){u.edge(y).minlen*=m});var x=a(u)+1;e.forEach(u.children(),function(y){s(u,d,m,x,p,f,y)}),u.graph().nodeRankFactor=m}function s(u,d,f,p,m,x,y){var v=u.children(y);if(!v.length){y!==d&&u.setEdge(d,y,{weight:0,minlen:f});return}var b=t.addBorderNode(u,"_bt"),w=t.addBorderNode(u,"_bb"),S=u.node(y);u.setParent(b,y),S.borderTop=b,u.setParent(w,y),S.borderBottom=w,e.forEach(v,function(E){s(u,d,f,p,m,x,E);var k=u.node(E),_=k.borderTop?k.borderTop:E,R=k.borderBottom?k.borderBottom:E,T=k.borderTop?p:2*p,A=_!==R?1:m-x[y]+1;u.setEdge(b,_,{weight:T,minlen:A,nestingEdge:!0}),u.setEdge(R,w,{weight:T,minlen:A,nestingEdge:!0})}),u.parent(y)||u.setEdge(d,b,{weight:0,minlen:m+x[y]})}function r(u){var d={};function f(p,m){var x=u.children(p);x&&x.length&&e.forEach(x,function(y){f(y,m+1)}),d[p]=m}return e.forEach(u.children(),function(p){f(p,1)}),d}function a(u){return e.reduce(u.edges(),function(d,f){return d+u.edge(f).weight},0)}function l(u){var d=u.graph();u.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(u.edges(),function(f){var p=u.edge(f);p.nestingEdge&&u.removeEdge(f)})}return cS}var uS,CL;function $le(){if(CL)return uS;CL=1;var e=kt(),t=Un();uS=n;function n(r){function a(l){var u=r.children(l),d=r.node(l);if(u.length&&e.forEach(u,a),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var f=d.minRank,p=d.maxRank+1;f<p;++f)s(r,"borderLeft","_bl",l,d,f),s(r,"borderRight","_br",l,d,f)}}e.forEach(r.children(),a)}function s(r,a,l,u,d,f){var p={width:0,height:0,rank:f,borderType:a},m=d[a][f-1],x=t.addDummyNode(r,"border",p,l);d[a][f]=x,r.setParent(x,u),m&&r.setEdge(m,x,{weight:1})}return uS}var dS,EL;function Dle(){if(EL)return dS;EL=1;var e=kt();dS={adjust:t,undo:n};function t(f){var p=f.graph().rankdir.toLowerCase();(p==="lr"||p==="rl")&&s(f)}function n(f){var p=f.graph().rankdir.toLowerCase();(p==="bt"||p==="rl")&&a(f),(p==="lr"||p==="rl")&&(u(f),s(f))}function s(f){e.forEach(f.nodes(),function(p){r(f.node(p))}),e.forEach(f.edges(),function(p){r(f.edge(p))})}function r(f){var p=f.width;f.width=f.height,f.height=p}function a(f){e.forEach(f.nodes(),function(p){l(f.node(p))}),e.forEach(f.edges(),function(p){var m=f.edge(p);e.forEach(m.points,l),e.has(m,"y")&&l(m)})}function l(f){f.y=-f.y}function u(f){e.forEach(f.nodes(),function(p){d(f.node(p))}),e.forEach(f.edges(),function(p){var m=f.edge(p);e.forEach(m.points,d),e.has(m,"x")&&d(m)})}function d(f){var p=f.x;f.x=f.y,f.y=p}return dS}var fS,RL;function qle(){if(RL)return fS;RL=1;var e=kt();fS=t;function t(n){var s={},r=e.filter(n.nodes(),function(f){return!n.children(f).length}),a=e.max(e.map(r,function(f){return n.node(f).rank})),l=e.map(e.range(a+1),function(){return[]});function u(f){if(!e.has(s,f)){s[f]=!0;var p=n.node(f);l[p.rank].push(f),e.forEach(n.successors(f),u)}}var d=e.sortBy(r,function(f){return n.node(f).rank});return e.forEach(d,u),l}return fS}var hS,AL;function zle(){if(AL)return hS;AL=1;var e=kt();hS=t;function t(s,r){for(var a=0,l=1;l<r.length;++l)a+=n(s,r[l-1],r[l]);return a}function n(s,r,a){for(var l=e.zipObject(a,e.map(a,function(x,y){return y})),u=e.flatten(e.map(r,function(x){return e.sortBy(e.map(s.outEdges(x),function(y){return{pos:l[y.w],weight:s.edge(y).weight}}),"pos")}),!0),d=1;d<a.length;)d<<=1;var f=2*d-1;d-=1;var p=e.map(new Array(f),function(){return 0}),m=0;return e.forEach(u.forEach(function(x){var y=x.pos+d;p[y]+=x.weight;for(var v=0;y>0;)y%2&&(v+=p[y+1]),y=y-1>>1,p[y]+=x.weight;m+=x.weight*v})),m}return hS}var pS,TL;function Ble(){if(TL)return pS;TL=1;var e=kt();pS=t;function t(n,s){return e.map(s,function(r){var a=n.inEdges(r);if(a.length){var l=e.reduce(a,function(u,d){var f=n.edge(d),p=n.node(d.v);return{sum:u.sum+f.weight*p.order,weight:u.weight+f.weight}},{sum:0,weight:0});return{v:r,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:r}})}return pS}var mS,IL;function Fle(){if(IL)return mS;IL=1;var e=kt();mS=t;function t(r,a){var l={};e.forEach(r,function(d,f){var p=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:f};e.isUndefined(d.barycenter)||(p.barycenter=d.barycenter,p.weight=d.weight)}),e.forEach(a.edges(),function(d){var f=l[d.v],p=l[d.w];!e.isUndefined(f)&&!e.isUndefined(p)&&(p.indegree++,f.out.push(l[d.w]))});var u=e.filter(l,function(d){return!d.indegree});return n(u)}function n(r){var a=[];function l(f){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(f.barycenter)||p.barycenter>=f.barycenter)&&s(f,p)}}function u(f){return function(p){p.in.push(f),--p.indegree===0&&r.push(p)}}for(;r.length;){var d=r.pop();a.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,u(d))}return e.map(e.filter(a,function(f){return!f.merged}),function(f){return e.pick(f,["vs","i","barycenter","weight"])})}function s(r,a){var l=0,u=0;r.weight&&(l+=r.barycenter*r.weight,u+=r.weight),a.weight&&(l+=a.barycenter*a.weight,u+=a.weight),r.vs=a.vs.concat(r.vs),r.barycenter=l/u,r.weight=u,r.i=Math.min(a.i,r.i),a.merged=!0}return mS}var gS,ML;function Hle(){if(ML)return gS;ML=1;var e=kt(),t=Un();gS=n;function n(a,l){var u=t.partition(a,function(b){return e.has(b,"barycenter")}),d=u.lhs,f=e.sortBy(u.rhs,function(b){return-b.i}),p=[],m=0,x=0,y=0;d.sort(r(!!l)),y=s(p,f,y),e.forEach(d,function(b){y+=b.vs.length,p.push(b.vs),m+=b.barycenter*b.weight,x+=b.weight,y=s(p,f,y)});var v={vs:e.flatten(p,!0)};return x&&(v.barycenter=m/x,v.weight=x),v}function s(a,l,u){for(var d;l.length&&(d=e.last(l)).i<=u;)l.pop(),a.push(d.vs),u++;return u}function r(a){return function(l,u){return l.barycenter<u.barycenter?-1:l.barycenter>u.barycenter?1:a?u.i-l.i:l.i-u.i}}return gS}var xS,OL;function Ule(){if(OL)return xS;OL=1;var e=kt(),t=Ble(),n=Fle(),s=Hle();xS=r;function r(u,d,f,p){var m=u.children(d),x=u.node(d),y=x?x.borderLeft:void 0,v=x?x.borderRight:void 0,b={};y&&(m=e.filter(m,function(R){return R!==y&&R!==v}));var w=t(u,m);e.forEach(w,function(R){if(u.children(R.v).length){var T=r(u,R.v,f,p);b[R.v]=T,e.has(T,"barycenter")&&l(R,T)}});var S=n(w,f);a(S,b);var E=s(S,p);if(y&&(E.vs=e.flatten([y,E.vs,v],!0),u.predecessors(y).length)){var k=u.node(u.predecessors(y)[0]),_=u.node(u.predecessors(v)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+k.order+_.order)/(E.weight+2),E.weight+=2}return E}function a(u,d){e.forEach(u,function(f){f.vs=e.flatten(f.vs.map(function(p){return d[p]?d[p].vs:p}),!0)})}function l(u,d){e.isUndefined(u.barycenter)?(u.barycenter=d.barycenter,u.weight=d.weight):(u.barycenter=(u.barycenter*u.weight+d.barycenter*d.weight)/(u.weight+d.weight),u.weight+=d.weight)}return xS}var yS,LL;function Vle(){if(LL)return yS;LL=1;var e=kt(),t=Fs().Graph;yS=n;function n(r,a,l){var u=s(r),d=new t({compound:!0}).setGraph({root:u}).setDefaultNodeLabel(function(f){return r.node(f)});return e.forEach(r.nodes(),function(f){var p=r.node(f),m=r.parent(f);(p.rank===a||p.minRank<=a&&a<=p.maxRank)&&(d.setNode(f),d.setParent(f,m||u),e.forEach(r[l](f),function(x){var y=x.v===f?x.w:x.v,v=d.edge(y,f),b=e.isUndefined(v)?0:v.weight;d.setEdge(y,f,{weight:r.edge(x).weight+b})}),e.has(p,"minRank")&&d.setNode(f,{borderLeft:p.borderLeft[a],borderRight:p.borderRight[a]}))}),d}function s(r){for(var a;r.hasNode(a=e.uniqueId("_root")););return a}return yS}var vS,PL;function Gle(){if(PL)return vS;PL=1;var e=kt();vS=t;function t(n,s,r){var a={},l;e.forEach(r,function(u){for(var d=n.parent(u),f,p;d;){if(f=n.parent(d),f?(p=a[f],a[f]=d):(p=l,l=d),p&&p!==d){s.setEdge(p,d);return}d=f}})}return vS}var bS,$L;function Kle(){if($L)return bS;$L=1;var e=kt(),t=qle(),n=zle(),s=Ule(),r=Vle(),a=Gle(),l=Fs().Graph,u=Un();bS=d;function d(x){var y=u.maxRank(x),v=f(x,e.range(1,y+1),"inEdges"),b=f(x,e.range(y-1,-1,-1),"outEdges"),w=t(x);m(x,w);for(var S=Number.POSITIVE_INFINITY,E,k=0,_=0;_<4;++k,++_){p(k%2?v:b,k%4>=2),w=u.buildLayerMatrix(x);var R=n(x,w);R<S&&(_=0,E=e.cloneDeep(w),S=R)}m(x,E)}function f(x,y,v){return e.map(y,function(b){return r(x,b,v)})}function p(x,y){var v=new l;e.forEach(x,function(b){var w=b.graph().root,S=s(b,w,v,y);e.forEach(S.vs,function(E,k){b.node(E).order=k}),a(b,v,S.vs)})}function m(x,y){e.forEach(y,function(v){e.forEach(v,function(b,w){x.node(b).order=w})})}return bS}var wS,DL;function Wle(){if(DL)return wS;DL=1;var e=kt(),t=Fs().Graph,n=Un();wS={positionX:v,findType1Conflicts:s,findType2Conflicts:r,addConflict:l,hasConflict:u,verticalAlignment:d,horizontalCompaction:f,alignCoordinates:x,findSmallestWidthAlignment:m,balance:y};function s(S,E){var k={};function _(R,T){var A=0,M=0,L=R.length,P=e.last(T);return e.forEach(T,function(O,B){var H=a(S,O),z=H?S.node(H).order:L;(H||O===P)&&(e.forEach(T.slice(M,B+1),function(W){e.forEach(S.predecessors(W),function($){var F=S.node($),G=F.order;(G<A||z<G)&&!(F.dummy&&S.node(W).dummy)&&l(k,$,W)})}),M=B+1,A=z)}),T}return e.reduce(E,_),k}function r(S,E){var k={};function _(T,A,M,L,P){var O;e.forEach(e.range(A,M),function(B){O=T[B],S.node(O).dummy&&e.forEach(S.predecessors(O),function(H){var z=S.node(H);z.dummy&&(z.order<L||z.order>P)&&l(k,H,O)})})}function R(T,A){var M=-1,L,P=0;return e.forEach(A,function(O,B){if(S.node(O).dummy==="border"){var H=S.predecessors(O);H.length&&(L=S.node(H[0]).order,_(A,P,B,M,L),P=B,M=L)}_(A,P,A.length,L,T.length)}),A}return e.reduce(E,R),k}function a(S,E){if(S.node(E).dummy)return e.find(S.predecessors(E),function(k){return S.node(k).dummy})}function l(S,E,k){if(E>k){var _=E;E=k,k=_}var R=S[E];R||(S[E]=R={}),R[k]=!0}function u(S,E,k){if(E>k){var _=E;E=k,k=_}return e.has(S[E],k)}function d(S,E,k,_){var R={},T={},A={};return e.forEach(E,function(M){e.forEach(M,function(L,P){R[L]=L,T[L]=L,A[L]=P})}),e.forEach(E,function(M){var L=-1;e.forEach(M,function(P){var O=_(P);if(O.length){O=e.sortBy(O,function($){return A[$]});for(var B=(O.length-1)/2,H=Math.floor(B),z=Math.ceil(B);H<=z;++H){var W=O[H];T[P]===P&&L<A[W]&&!u(k,P,W)&&(T[W]=P,T[P]=R[P]=R[W],L=A[W])}}})}),{root:R,align:T}}function f(S,E,k,_,R){var T={},A=p(S,E,k,R),M=R?"borderLeft":"borderRight";function L(B,H){for(var z=A.nodes(),W=z.pop(),$={};W;)$[W]?B(W):($[W]=!0,z.push(W),z=z.concat(H(W))),W=z.pop()}function P(B){T[B]=A.inEdges(B).reduce(function(H,z){return Math.max(H,T[z.v]+A.edge(z))},0)}function O(B){var H=A.outEdges(B).reduce(function(W,$){return Math.min(W,T[$.w]-A.edge($))},Number.POSITIVE_INFINITY),z=S.node(B);H!==Number.POSITIVE_INFINITY&&z.borderType!==M&&(T[B]=Math.max(T[B],H))}return L(P,A.predecessors.bind(A)),L(O,A.successors.bind(A)),e.forEach(_,function(B){T[B]=T[k[B]]}),T}function p(S,E,k,_){var R=new t,T=S.graph(),A=b(T.nodesep,T.edgesep,_);return e.forEach(E,function(M){var L;e.forEach(M,function(P){var O=k[P];if(R.setNode(O),L){var B=k[L],H=R.edge(B,O);R.setEdge(B,O,Math.max(A(S,P,L),H||0))}L=P})}),R}function m(S,E){return e.minBy(e.values(E),function(k){var _=Number.NEGATIVE_INFINITY,R=Number.POSITIVE_INFINITY;return e.forIn(k,function(T,A){var M=w(S,A)/2;_=Math.max(T+M,_),R=Math.min(T-M,R)}),_-R})}function x(S,E){var k=e.values(E),_=e.min(k),R=e.max(k);e.forEach(["u","d"],function(T){e.forEach(["l","r"],function(A){var M=T+A,L=S[M],P;if(L!==E){var O=e.values(L);P=A==="l"?_-e.min(O):R-e.max(O),P&&(S[M]=e.mapValues(L,function(B){return B+P}))}})})}function y(S,E){return e.mapValues(S.ul,function(k,_){if(E)return S[E.toLowerCase()][_];var R=e.sortBy(e.map(S,_));return(R[1]+R[2])/2})}function v(S){var E=n.buildLayerMatrix(S),k=e.merge(s(S,E),r(S,E)),_={},R;e.forEach(["u","d"],function(A){R=A==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(M){M==="r"&&(R=e.map(R,function(B){return e.values(B).reverse()}));var L=(A==="u"?S.predecessors:S.successors).bind(S),P=d(S,R,k,L),O=f(S,R,P.root,P.align,M==="r");M==="r"&&(O=e.mapValues(O,function(B){return-B})),_[A+M]=O})});var T=m(S,_);return x(_,T),y(_,S.graph().align)}function b(S,E,k){return function(_,R,T){var A=_.node(R),M=_.node(T),L=0,P;if(L+=A.width/2,e.has(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":P=-A.width/2;break;case"r":P=A.width/2;break}if(P&&(L+=k?P:-P),P=0,L+=(A.dummy?E:S)/2,L+=(M.dummy?E:S)/2,L+=M.width/2,e.has(M,"labelpos"))switch(M.labelpos.toLowerCase()){case"l":P=M.width/2;break;case"r":P=-M.width/2;break}return P&&(L+=k?P:-P),P=0,L}}function w(S,E){return S.node(E).width}return wS}var jS,qL;function Yle(){if(qL)return jS;qL=1;var e=kt(),t=Un(),n=Wle().positionX;jS=s;function s(a){a=t.asNonCompoundGraph(a),r(a),e.forEach(n(a),function(l,u){a.node(u).x=l})}function r(a){var l=t.buildLayerMatrix(a),u=a.graph().ranksep,d=0;e.forEach(l,function(f){var p=e.max(e.map(f,function(m){return a.node(m).height}));e.forEach(f,function(m){a.node(m).y=d+p/2}),d+=p+u})}return jS}var SS,zL;function Qle(){if(zL)return SS;zL=1;var e=kt(),t=Tle(),n=Ile(),s=Ole(),r=Un().normalizeRanks,a=Lle(),l=Un().removeEmptyRanks,u=Ple(),d=$le(),f=Dle(),p=Kle(),m=Yle(),x=Un(),y=Fs().Graph;SS=v;function v(U,Q){var K=Q&&Q.debugTiming?x.time:x.notime;K("layout",function(){var te=K(" buildLayoutGraph",function(){return L(U)});K(" runLayout",function(){b(te,K)}),K(" updateInputGraph",function(){w(U,te)})})}function b(U,Q){Q(" makeSpaceForEdgeLabels",function(){P(U)}),Q(" removeSelfEdges",function(){X(U)}),Q(" acyclic",function(){t.run(U)}),Q(" nestingGraph.run",function(){u.run(U)}),Q(" rank",function(){s(x.asNonCompoundGraph(U))}),Q(" injectEdgeLabelProxies",function(){O(U)}),Q(" removeEmptyRanks",function(){l(U)}),Q(" nestingGraph.cleanup",function(){u.cleanup(U)}),Q(" normalizeRanks",function(){r(U)}),Q(" assignRankMinMax",function(){B(U)}),Q(" removeEdgeLabelProxies",function(){H(U)}),Q(" normalize.run",function(){n.run(U)}),Q(" parentDummyChains",function(){a(U)}),Q(" addBorderSegments",function(){d(U)}),Q(" order",function(){p(U)}),Q(" insertSelfEdges",function(){Z(U)}),Q(" adjustCoordinateSystem",function(){f.adjust(U)}),Q(" position",function(){m(U)}),Q(" positionSelfEdges",function(){D(U)}),Q(" removeBorderNodes",function(){G(U)}),Q(" normalize.undo",function(){n.undo(U)}),Q(" fixupEdgeLabelCoords",function(){$(U)}),Q(" undoCoordinateSystem",function(){f.undo(U)}),Q(" translateGraph",function(){z(U)}),Q(" assignNodeIntersects",function(){W(U)}),Q(" reversePoints",function(){F(U)}),Q(" acyclic.undo",function(){t.undo(U)})}function w(U,Q){e.forEach(U.nodes(),function(K){var te=U.node(K),re=Q.node(K);te&&(te.x=re.x,te.y=re.y,Q.children(K).length&&(te.width=re.width,te.height=re.height))}),e.forEach(U.edges(),function(K){var te=U.edge(K),re=Q.edge(K);te.points=re.points,e.has(re,"x")&&(te.x=re.x,te.y=re.y)}),U.graph().width=Q.graph().width,U.graph().height=Q.graph().height}var S=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},k=["acyclicer","ranker","rankdir","align"],_=["width","height"],R={width:0,height:0},T=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function L(U){var Q=new y({multigraph:!0,compound:!0}),K=ne(U.graph());return Q.setGraph(e.merge({},E,V(K,S),e.pick(K,k))),e.forEach(U.nodes(),function(te){var re=ne(U.node(te));Q.setNode(te,e.defaults(V(re,_),R)),Q.setParent(te,U.parent(te))}),e.forEach(U.edges(),function(te){var re=ne(U.edge(te));Q.setEdge(te,e.merge({},A,V(re,T),e.pick(re,M)))}),Q}function P(U){var Q=U.graph();Q.ranksep/=2,e.forEach(U.edges(),function(K){var te=U.edge(K);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(Q.rankdir==="TB"||Q.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function O(U){e.forEach(U.edges(),function(Q){var K=U.edge(Q);if(K.width&&K.height){var te=U.node(Q.v),re=U.node(Q.w),oe={rank:(re.rank-te.rank)/2+te.rank,e:Q};x.addDummyNode(U,"edge-proxy",oe,"_ep")}})}function B(U){var Q=0;e.forEach(U.nodes(),function(K){var te=U.node(K);te.borderTop&&(te.minRank=U.node(te.borderTop).rank,te.maxRank=U.node(te.borderBottom).rank,Q=e.max(Q,te.maxRank))}),U.graph().maxRank=Q}function H(U){e.forEach(U.nodes(),function(Q){var K=U.node(Q);K.dummy==="edge-proxy"&&(U.edge(K.e).labelRank=K.rank,U.removeNode(Q))})}function z(U){var Q=Number.POSITIVE_INFINITY,K=0,te=Number.POSITIVE_INFINITY,re=0,oe=U.graph(),pe=oe.marginx||0,ge=oe.marginy||0;function ve(xe){var Ne=xe.x,we=xe.y,De=xe.width,Ee=xe.height;Q=Math.min(Q,Ne-De/2),K=Math.max(K,Ne+De/2),te=Math.min(te,we-Ee/2),re=Math.max(re,we+Ee/2)}e.forEach(U.nodes(),function(xe){ve(U.node(xe))}),e.forEach(U.edges(),function(xe){var Ne=U.edge(xe);e.has(Ne,"x")&&ve(Ne)}),Q-=pe,te-=ge,e.forEach(U.nodes(),function(xe){var Ne=U.node(xe);Ne.x-=Q,Ne.y-=te}),e.forEach(U.edges(),function(xe){var Ne=U.edge(xe);e.forEach(Ne.points,function(we){we.x-=Q,we.y-=te}),e.has(Ne,"x")&&(Ne.x-=Q),e.has(Ne,"y")&&(Ne.y-=te)}),oe.width=K-Q+pe,oe.height=re-te+ge}function W(U){e.forEach(U.edges(),function(Q){var K=U.edge(Q),te=U.node(Q.v),re=U.node(Q.w),oe,pe;K.points?(oe=K.points[0],pe=K.points[K.points.length-1]):(K.points=[],oe=re,pe=te),K.points.unshift(x.intersectRect(te,oe)),K.points.push(x.intersectRect(re,pe))})}function $(U){e.forEach(U.edges(),function(Q){var K=U.edge(Q);if(e.has(K,"x"))switch((K.labelpos==="l"||K.labelpos==="r")&&(K.width-=K.labeloffset),K.labelpos){case"l":K.x-=K.width/2+K.labeloffset;break;case"r":K.x+=K.width/2+K.labeloffset;break}})}function F(U){e.forEach(U.edges(),function(Q){var K=U.edge(Q);K.reversed&&K.points.reverse()})}function G(U){e.forEach(U.nodes(),function(Q){if(U.children(Q).length){var K=U.node(Q),te=U.node(K.borderTop),re=U.node(K.borderBottom),oe=U.node(e.last(K.borderLeft)),pe=U.node(e.last(K.borderRight));K.width=Math.abs(pe.x-oe.x),K.height=Math.abs(re.y-te.y),K.x=oe.x+K.width/2,K.y=te.y+K.height/2}}),e.forEach(U.nodes(),function(Q){U.node(Q).dummy==="border"&&U.removeNode(Q)})}function X(U){e.forEach(U.edges(),function(Q){if(Q.v===Q.w){var K=U.node(Q.v);K.selfEdges||(K.selfEdges=[]),K.selfEdges.push({e:Q,label:U.edge(Q)}),U.removeEdge(Q)}})}function Z(U){var Q=x.buildLayerMatrix(U);e.forEach(Q,function(K){var te=0;e.forEach(K,function(re,oe){var pe=U.node(re);pe.order=oe+te,e.forEach(pe.selfEdges,function(ge){x.addDummyNode(U,"selfedge",{width:ge.label.width,height:ge.label.height,rank:pe.rank,order:oe+ ++te,e:ge.e,label:ge.label},"_se")}),delete pe.selfEdges})})}function D(U){e.forEach(U.nodes(),function(Q){var K=U.node(Q);if(K.dummy==="selfedge"){var te=U.node(K.e.v),re=te.x+te.width/2,oe=te.y,pe=K.x-re,ge=te.height/2;U.setEdge(K.e,K.label),U.removeNode(Q),K.label.points=[{x:re+2*pe/3,y:oe-ge},{x:re+5*pe/6,y:oe-ge},{x:re+pe,y:oe},{x:re+5*pe/6,y:oe+ge},{x:re+2*pe/3,y:oe+ge}],K.label.x=K.x,K.label.y=K.y}})}function V(U,Q){return e.mapValues(e.pick(U,Q),Number)}function ne(U){var Q={};return e.forEach(U,function(K,te){Q[te.toLowerCase()]=K}),Q}return SS}var NS,BL;function Xle(){if(BL)return NS;BL=1;var e=kt(),t=Un(),n=Fs().Graph;NS={debugOrdering:s};function s(r){var a=t.buildLayerMatrix(r),l=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(r.nodes(),function(u){l.setNode(u,{label:u}),l.setParent(u,"layer"+r.node(u).rank)}),e.forEach(r.edges(),function(u){l.setEdge(u.v,u.w,{},u.name)}),e.forEach(a,function(u,d){var f="layer"+d;l.setNode(f,{rank:"same"}),e.reduce(u,function(p,m){return l.setEdge(p,m,{style:"invis"}),m})}),l}return NS}var kS,FL;function Zle(){return FL||(FL=1,kS="0.8.5"),kS}var _S,HL;function Jle(){return HL||(HL=1,_S={graphlib:Fs(),layout:Qle(),debug:Xle(),util:{time:Un().time,notime:Un().notime},version:Zle()}),_S}var ece=Jle();const Dm=Hm(ece),tce="::",zl=166,Bl=94,Ep=38,CS=28,UL=22,nce=188,Rp=78,Ap=42,sce=40,rce=320,w9=280,ZN=118,Tp=96,ice=3,h_="6 7";function Il(e,t){return`${e}${tce}${t}`}function ES(e){return e.type==="podGroup"||e.type==="group"}function ace(e,t=!1){return t?{stroke:"#a8a29e",strokeWidth:1,strokeDasharray:h_}:e==="pod-internal"||e==="contains"||e==="member"?{stroke:"#44403c",strokeWidth:1.5}:{stroke:"#78716c",strokeWidth:1.5}}function oce(e){if(e.collapsed)return{nodes:[],edges:[],width:w9,height:ZN,podCount:0};const t=new Set(e.nodes.filter(ES).map(w=>w.id)),n=new Map,s=[];for(const w of e.nodes)if(!ES(w)){if(typeof w.parentId=="string"&&t.has(w.parentId)){n.has(w.parentId)||n.set(w.parentId,[]),n.get(w.parentId).push(w);continue}s.push(w)}const r=e.nodes.filter(ES).map(w=>cce(w,n.get(w.id)??[],e.edges)),a=s.map(w=>({node:w,width:w.initialWidth??zl,height:w.initialHeight??Bl,position:{x:0,y:0}})),l=[...r.map(w=>({id:w.node.id,width:w.width,height:w.height})),...a.map(w=>({id:w.node.id,width:w.width,height:w.height}))],u=uce(r,a),d=dce(e.edges.map(w=>{const S=u.get(w.source),E=u.get(w.target);return!S||!E||S===E?null:{source:S,target:E}}).filter(w=>!!w)),f=p_(l,d,"LR",{nodesep:34,ranksep:34}),p=m_(l,f,{x:Ap,y:Rp});for(const w of r)w.position=p.positions.get(w.node.id)??{x:Ap,y:Rp};for(const w of a)w.position=p.positions.get(w.node.id)??{x:Ap,y:Rp};const m=Math.max(rce,p.width+Ap*2),x=Math.max(ZN,p.height+Rp+sce),y=`rig-${e.rigId}`,v=[];for(const w of r){const S=Il(e.rigId,w.node.id);v.push({...w.node,id:S,type:"podGroup",parentId:y,extent:"parent",position:w.position,data:{...w.node.data??{},rigId:e.rigId,rigName:e.rigName??null,agentCount:w.members.length},style:{...w.node.style??{},width:w.width,height:w.height},draggable:!1,zIndex:1});for(const E of w.members)v.push({...E.node,id:Il(e.rigId,E.node.id),type:"rigNode",parentId:S,extent:"parent",position:E.position,data:{...E.node.data??{},rigId:e.rigId,rigName:e.rigName??null},style:{...E.node.style??{},width:zl,height:Bl},initialWidth:zl,initialHeight:Bl,sourcePosition:ye.Right,targetPosition:ye.Left,draggable:!1,zIndex:2})}for(const w of a)v.push({...w.node,id:Il(e.rigId,w.node.id),type:"rigNode",parentId:y,extent:"parent",position:w.position,data:{...w.node.data??{},rigId:e.rigId,rigName:e.rigName??null},style:{...w.node.style??{},width:zl,height:Bl},initialWidth:zl,initialHeight:Bl,sourcePosition:ye.Right,targetPosition:ye.Left,draggable:!1,zIndex:2});const b=e.edges.map(w=>{var A;const S=e.rigId,E=e.rigId,k=w.id||`${w.source}->${w.target}`,_=typeof((A=w.data)==null?void 0:A.kind)=="string"?w.data.kind:typeof w.label=="string"?w.label:null,{label:R,...T}=w;return{...T,id:Il(e.rigId,k),source:Il(S,w.source),target:Il(E,w.target),label:typeof R=="string"?R:void 0,type:w.type??"default",selectable:!1,focusable:!1,interactionWidth:w.interactionWidth??10,style:{...ace(_),...w.style??{}},data:{...w.data??{},kind:_}}});return{nodes:v,edges:b,width:m,height:x,podCount:r.length}}function lce(e){const t=e.map(l=>({id:l.rigId,width:l.width,height:l.height})),n=Array.from({length:ice},()=>[]);e.forEach((l,u)=>{n[u%n.length].push(l.rigId)});const s=[];for(const l of n)for(let u=0;u<l.length-1;u+=1)s.push({source:l[u],target:l[u+1]});const r=p_(t,s,"TB",{nodesep:68,ranksep:62}),a=m_(t,r,{x:Tp,y:Tp});return e.map(l=>({...l,position:a.positions.get(l.rigId)??{x:Tp,y:Tp}}))}function cce(e,t,n){const s=t.map(p=>({id:p.id,width:zl,height:Bl})),r=new Set(t.map(p=>p.id)),a=n.filter(p=>r.has(p.source)&&r.has(p.target)),l=p_(s,a,"TB",{nodesep:16,ranksep:16}),u=m_(s,l,{x:CS,y:Ep}),d=Math.max(nce,u.width+CS*2),f=Math.max(Ep+UL,u.height+Ep+UL);return{node:e,width:d,height:f,position:{x:0,y:0},members:t.map(p=>({node:p,position:u.positions.get(p.id)??{x:CS,y:Ep}}))}}function uce(e,t){const n=new Map;for(const s of e){n.set(s.node.id,s.node.id);for(const r of s.members)n.set(r.node.id,s.node.id)}for(const s of t)n.set(s.node.id,s.node.id);return n}function dce(e){const t=new Set,n=[];for(const s of e){const r=`${s.source}->${s.target}`;t.has(r)||(t.add(r),n.push(s))}return n}function p_(e,t,n,s){const r=new Dm.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:n,nodesep:s.nodesep,ranksep:s.ranksep,marginx:0,marginy:0});for(const u of e)r.setNode(u.id,{width:u.width,height:u.height});const a=new Set(e.map(u=>u.id));for(const u of t)!a.has(u.source)||!a.has(u.target)||u.source===u.target||r.setEdge(u.source,u.target);Dm.layout(r);const l=new Map;for(const u of e){const d=r.node(u.id);l.set(u.id,d??{x:0,y:0})}return l}function m_(e,t,n){let s=1/0,r=1/0,a=-1/0,l=-1/0;for(const d of e){const f=t.get(d.id)??{x:0,y:0};s=Math.min(s,f.x-d.width/2),r=Math.min(r,f.y-d.height/2),a=Math.max(a,f.x+d.width/2),l=Math.max(l,f.y+d.height/2)}if(!Number.isFinite(s)||!Number.isFinite(r))return{positions:new Map,width:0,height:0};const u=new Map;for(const d of e){const f=t.get(d.id)??{x:0,y:0};u.set(d.id,{x:n.x+f.x-d.width/2-s,y:n.y+f.y-d.height/2-r})}return{positions:u,width:a-s,height:l-r}}const fce="\0",g_=1e4,j9=4e3,hce=1100,pce=1600,mce=3e3,gce=650,xce=900;function tx(e){var r;const t=new Map,n=new Map,s=(a,l)=>{const u=a==null?void 0:a.trim();if(u)for(const d of[u,u.toLowerCase()]){const f=n.get(d);f&&f.nodeId!==l.nodeId?n.set(d,null):n.has(d)||n.set(d,l)}};for(const a of e){t.set(a.nodeId,a);const l=JN(a.nodeId);s(a.nodeId,a),s(l,a),s(a.logicalId,a),s(a.canonicalSessionName,a);for(const u of[a.rigName,a.rigId])if(u&&(s(`${a.logicalId??l}@${u}`,a),(r=a.canonicalSessionName)!=null&&r.includes("@"))){const[d]=a.canonicalSessionName.split("@");s(`${d}@${u}`,a)}}return{byNodeId:t,bySession:n}}function RS(e,t){var u;const n=t==null?void 0:t.trim();if(!n)return null;const s=e.bySession.get(n)??e.bySession.get(n.toLowerCase());if(s)return{...s,session:n};if(s===null)return null;const r=n.lastIndexOf("@");if(r<0)return null;const a=n.slice(0,r),l=n.slice(r+1);for(const d of e.byNodeId.values()){const f=d.logicalId??JN(d.nodeId),p=((u=d.canonicalSessionName)==null?void 0:u.split("@")[0])??null,m=f===a||p===a||JN(d.nodeId)===a,x=d.rigName===l||d.rigId===l;if(m&&x)return{...d,session:n}}return null}function yce(e){var t,n;return e?e.startupStatus==="failed"?"blocked":e.startupStatus==="attention_required"||((t=e.agentActivity)==null?void 0:t.state)==="needs_input"?"needs_input":e.terminalActive===!0?"active":e.terminalActive===!1?"idle":((n=e.agentActivity)==null?void 0:n.state)==="running"?"active":"idle":"idle"}function vce(e){const t=yce(e.baseline),n=e.recent,s=n&&e.nowMs-n.lastActiveAt<=g_?n:null,r=s?Sce(t,s.state):t,a=(s==null?void 0:s.sourceFlashAt)&&e.nowMs-s.sourceFlashAt<=gce,l=(s==null?void 0:s.targetFlashAt)&&e.nowMs-s.targetFlashAt<=xce;return{state:r,flash:l?"target":a?"source":null,recent:!!s}}function bce(e,t){return typeof e=="number"&&t-e<=j9}function wce(e){if(!e||typeof e!="object")return null;const t=e,n=on(t,"type");if(!n)return null;const s=on(t,"qitemId"),r=(a,l="active",u=null)=>a?{session:a,state:l,flash:u}:null;if(n==="agent.activity"){const a=on(t,"sessionName"),l=t.activity&&typeof t.activity=="object"?t.activity:null,u=(l==null?void 0:l.state)==="needs_input"?"needs_input":(l==null?void 0:l.state)==="running"?"active":"idle";return{type:n,qitemId:s,sessions:[r(a,u)].filter(Dr)}}if(n==="queue.created"){const a=on(t,"sourceSession"),l=on(t,"destinationSession");return!a||!l?null:{type:n,qitemId:s,packet:{sourceSession:a,targetSession:l},sessions:[r(a,"active","source"),r(l,"active","target")].filter(Dr)}}if(n==="queue.handed_off"){const a=on(t,"fromSession"),l=on(t,"toSession");return!a||!l?null:{type:n,qitemId:s,packet:{sourceSession:a,targetSession:l},sessions:[r(a,"active","source"),r(l,"active","target")].filter(Dr)}}if(n==="queue.claimed"){const a=on(t,"destinationSession");return{type:n,qitemId:s,sessions:[r(a,"active","target")].filter(Dr)}}if(n==="queue.updated"){const a=on(t,"actorSession"),l=on(t,"closureTarget"),d=on(t,"toState")==="blocked"?"blocked":"active";return{type:n,qitemId:s,packet:a&&l?{sourceSession:a,targetSession:l}:void 0,sessions:[r(a,d,"source"),r(l,d,"target")].filter(Dr)}}return n==="queue.unclaimed"?{type:n,qitemId:s,sessions:[r(on(t,"destinationSession"),"active")].filter(Dr)}:n==="qitem.fallback_routed"?{type:n,qitemId:s,sessions:[r(on(t,"originalDestination"),"active","source"),r(on(t,"rerouteDestination"),"active","target")].filter(Dr)}:n==="qitem.closure_overdue"?{type:n,qitemId:s,sessions:[r(on(t,"destinationSession"),"blocked","target")].filter(Dr)}:n==="inbox.absorbed"||n==="inbox.denied"?{type:n,qitemId:s,sessions:[r(on(t,"senderSession"),"active","source"),r(on(t,"destinationSession"),"needs_input","target")].filter(Dr)}:null}function AS(e,t){return`${e}${fce}${t}`}function jce(e){const t=!!(e.sourceSession.rigId&&e.targetSession.rigId&&e.sourceSession.rigId!==e.targetSession.rigId);return{id:`${e.createdAt}-${e.sequence}-${e.sourceSession.nodeId}-${e.targetSession.nodeId}`,eventType:e.eventType,qitemId:e.qitemId??null,sourceSession:e.sourceSession.session,targetSession:e.targetSession.session,sourceNodeId:e.sourceSession.nodeId,targetNodeId:e.targetSession.nodeId,sourceRigId:e.sourceSession.rigId,targetRigId:e.targetSession.rigId,crossRig:t,createdAt:e.createdAt,durationMs:t?pce:hce}}function S9(e,t,n){const s=new Map;for(const l of t)s.set(AS(l.sourceNodeId,l.targetNodeId),l);const r=new Set,a=e.map(l=>{const u=AS(l.source,l.target),d=s.get(u)??null;return d&&r.add(u),VL(l,d,n.reducedMotion)});for(const l of t){const u=AS(l.sourceNodeId,l.targetNodeId);r.has(u)||a.push(VL({id:`hot-potato-${l.id}`,source:l.sourceNodeId,target:l.targetNodeId,type:"hotPotato",selectable:!1,focusable:!1,interactionWidth:8,style:N9(l.crossRig),data:{}},l,n.reducedMotion))}return a}function VL(e,t,n){var a;const s=(t==null?void 0:t.crossRig)||((a=e.style)==null?void 0:a.strokeDasharray)===h_,r={...e.data??{},hotPotatoPacket:t,hotPotatoRecent:!!t,hotPotatoCrossRig:s,hotPotatoReducedMotion:n};return{...e,type:"hotPotato",className:[e.className,t?"hot-potato-edge-active":""].filter(Boolean).join(" ")||void 0,data:r,style:{...e.style??{},...t?N9(t.crossRig):{}}}}function N9(e){return{stroke:e?"#a8a29e":"#047857",strokeWidth:e?1.25:2.25,strokeDasharray:e?h_:void 0}}function Sce(e,t){return GL(t)>GL(e)?t:e}function GL(e){return e==="blocked"?3:e==="needs_input"?2:e==="active"?1:0}function JN(e){const t=e.indexOf("::");return t<0?e:e.slice(t+2)}function on(e,t){const n=e[t];return typeof n=="string"&&n.trim()?n:null}function Dr(e){return e!==null}function Nce(){return{nodeActivity:new Map,rigActivity:new Map,packets:[],unresolvedCount:0,sequence:0}}let kce=Nce();function TS(e,t,n,s,r){const a=e.nodeActivity.get(t),l=a&&s-a.lastActiveAt<=g_?a:void 0,u={state:_ce((l==null?void 0:l.state)??"idle",n),lastActiveAt:s,sourceFlashAt:r==="source"?s:l==null?void 0:l.sourceFlashAt,targetFlashAt:r==="target"?s:l==null?void 0:l.targetFlashAt};e.nodeActivity.set(t,u)}function _ce(e,t){const n=s=>s==="blocked"?3:s==="needs_input"?2:s==="active"?1:0;return n(t)>n(e)?t:e}function KL(e,t){let n=!1;const s=e.packets.length;e.packets=e.packets.filter(r=>t-r.createdAt<=mce),n||(n=e.packets.length!==s);for(const[r,a]of e.nodeActivity.entries())t-a.lastActiveAt>g_&&(e.nodeActivity.delete(r),n=!0);for(const[r,a]of e.rigActivity.entries())t-a>j9&&(e.rigActivity.delete(r),n=!0);return n}function nx(e){const[t,n]=C.useState(0),s=C.useRef(e),r=C.useRef(kce);s.current=e;const a=C.useCallback(()=>{n(l=>l+1)},[]);return C.useEffect(()=>cg(u=>{const d=wce(u);if(!d)return;const f=Date.now(),p=r.current,m=s.current;let x=!1;for(const y of d.sessions){const v=RS(m,y.session);if(!v){p.unresolvedCount+=1,x=!0;continue}TS(p,v.nodeId,y.state,f,y.flash??null),v.rigId&&p.rigActivity.set(v.rigId,f),x=!0}if(d.packet){const y=RS(m,d.packet.sourceSession),v=RS(m,d.packet.targetSession);y&&v?(p.sequence+=1,p.packets.push(jce({eventType:d.type,qitemId:d.qitemId,sourceSession:y,targetSession:v,createdAt:f,sequence:p.sequence})),TS(p,y.nodeId,"active",f,"source"),TS(p,v.nodeId,"active",f,"target"),y.rigId&&p.rigActivity.set(y.rigId,f),v.rigId&&p.rigActivity.set(v.rigId,f),x=!0):(p.unresolvedCount+=1,x=!0)}x||(x=KL(p,f)),x&&a()}),[a]),C.useEffect(()=>{const l=window.setInterval(()=>{const u=Date.now(),d=r.current;KL(d,u)&&a()},1e3);return()=>window.clearInterval(l)},[a]),C.useMemo(()=>{const l=r.current,u=Date.now();return{version:t,unresolvedCount:l.unresolvedCount,packets:[...l.packets],getNodeActivity(d,f){return vce({baseline:f,recent:l.nodeActivity.get(d)??null,nowMs:u})},isRigRecentlyActive(d){return d?bce(l.rigActivity.get(d),u):!1}}},[t])}const WL="(prefers-reduced-motion: reduce)";function x_(){const[e,t]=C.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(WL).matches);return C.useEffect(()=>{var r;if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(WL);t(n.matches);const s=()=>t(n.matches);return(r=n.addEventListener)==null||r.call(n,"change",s),()=>{var a;return(a=n.removeEventListener)==null?void 0:a.call(n,"change",s)}},[]),e}function Cce({data:e}){const t=e.podDisplayName??e.podNamespace??ar(e.logicalId)??Ql(e.podId??e.logicalId);return i.jsx("div",{"data-testid":"pod-group-node",className:`w-full h-full relative pointer-events-auto ${e.placementState==="selected"?"ring-2 ring-emerald-500/80 shadow-[0_0_0_4px_rgba(52,211,153,0.12)]":e.placementState==="available"?"ring-1 ring-emerald-300/80":""}`,children:i.jsx("div",{className:"absolute left-4 top-3 inline-flex items-center font-mono text-[12px] font-bold leading-none tracking-[0.08em] text-stone-800",children:`${t} pod`})})}function Ece({data:e}){const t=e.session;return i.jsxs("div",{"data-testid":"discovered-graph-node",className:"border-dashed border-2 border-foreground/30 bg-surface-low/50 p-spacing-3 min-w-[180px]",children:[i.jsx(bn,{type:"target",position:ye.Top,className:"opacity-0"}),i.jsxs("div",{className:"text-label-sm font-mono uppercase mb-spacing-1",children:[t.tmuxSession,":",t.tmuxPane]}),i.jsxs("div",{className:"flex gap-spacing-2 items-center mb-spacing-1",children:[i.jsx("span",{className:"text-label-sm uppercase text-foreground-muted",children:t.runtimeHint}),i.jsx("span",{className:"text-label-sm text-foreground-muted",children:t.confidence})]}),t.cwd&&i.jsx("div",{className:"text-label-sm font-mono text-foreground-muted truncate",children:t.cwd}),i.jsx(bn,{type:"source",position:ye.Bottom,className:"opacity-0"})]})}const Rce={rigNode:$ie,discoveredNode:Ece,podGroup:Cce},Ace={hotPotato:bq};function Tce(){return i.jsxs("div",{className:"flex flex-col items-center justify-center h-full relative text-foreground-muted","data-testid":"empty-topology",children:[i.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 400 300",fill:"none",style:{opacity:.08},children:[i.jsx("rect",{x:"160",y:"60",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),i.jsx("rect",{x:"60",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),i.jsx("rect",{x:"260",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),i.jsx("line",{x1:"200",y1:"100",x2:"100",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"}),i.jsx("line",{x1:"200",y1:"100",x2:"300",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"})]}),i.jsx("div",{className:"relative z-10 text-center",children:i.jsx("h2",{className:"text-headline-md uppercase",children:"EMPTY TOPOLOGY"})})]})}function y_({rigId:e,rigName:t=null,showDiscovered:n=!0,podScope:s}){const{data:r,isPending:a,error:l}=mie(e??""),u=$Y(n),d=(r==null?void 0:r.nodes)??[],f=(r==null?void 0:r.edges)??[],{rawNodes:p,rawEdges:m}=C.useMemo(()=>{if(!s)return{rawNodes:d,rawEdges:f};const D=new Set,V=d.filter(U=>{var te,re,oe,pe,ge;if(U.type==="podGroup"||U.type==="group"){const ve=(((te=U.data)==null?void 0:te.podNamespace)??((re=U.data)==null?void 0:re.podId))===s;return ve&&D.add(U.id),ve}const K=(((oe=U.data)==null?void 0:oe.podNamespace)??((pe=U.data)==null?void 0:pe.podId)??ar(((ge=U.data)==null?void 0:ge.logicalId)??null))===s;return K&&D.add(U.id),K}),ne=f.filter(U=>D.has(U.source)&&D.has(U.target));return{rawNodes:V,rawEdges:ne}},[d,f,s]),x=(l==null?void 0:l.message)??null,{reconnecting:y}=xie(e),v=x_(),[b,w]=C.useState(null),S=C.useRef(null),E=C.useRef(null),k=e!==null&&E.current!==e;C.useEffect(()=>{e&&p.length>0&&E.current!==e&&(E.current=e)},[e,p.length]);const _=C.useCallback(D=>{S.current&&clearTimeout(S.current),w(D),S.current=setTimeout(()=>{w(null),S.current=null},3e3)},[]);C.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const R=C.useMemo(()=>tx(p.filter(D=>D.type==="rigNode").map(D=>{const V=D.data;return{nodeId:D.id,rigId:e,rigName:t,logicalId:(V==null?void 0:V.logicalId)??null,canonicalSessionName:(V==null?void 0:V.canonicalSessionName)??null,agentActivity:(V==null?void 0:V.agentActivity)??null,currentQitems:(V==null?void 0:V.currentQitems)??null,startupStatus:(V==null?void 0:V.startupStatus)??null,terminalActive:V==null?void 0:V.terminalActive,hasAssignedWork:(V==null?void 0:V.hasAssignedWork)??!1,pendingWorkCount:(V==null?void 0:V.pendingWorkCount)??0}})),[p,e,t]),T=nx(R),A=C.useMemo(()=>m.map(D=>{var U;const V=((U=D.data)==null?void 0:U.kind)??D.label??"delegates_to",ne=yie(V);return{...D,...ne,className:k?"edge-draw-in":void 0,style:{...ne.style,animationDelay:k?`${Math.min(p.length*50+100,2e3)}ms`:void 0}}}),[m,k,p.length]),M=C.useMemo(()=>{const D=new Map;for(const V of p){const ne=V.data;if((V.type==="podGroup"||V.type==="group")&&(ne!=null&&ne.podId)){D.set(ne.podId,{displayName:ne.podLabel??ne.podNamespace??ar(ne.logicalId)??Ql(ne.podId),namespace:ne.podNamespace??ne.logicalId??null});continue}const U=(ne==null?void 0:ne.podId)??null;if(!U)continue;const Q=(ne==null?void 0:ne.podNamespace)??ar(ne==null?void 0:ne.logicalId)??null,K=(ne==null?void 0:ne.podLabel)??Q??Ql(U);D.has(U)||D.set(U,{displayName:K,namespace:Q})}return D},[p]),{selection:L,setSelection:P}=Ng(),{selectedDiscoveredId:O,placementTarget:B,setPlacementTarget:H}=fZ(),z=(L==null?void 0:L.type)==="discovery"&&!!O,W=C.useMemo(()=>{const D=new Map;for(const K of p){if(!K.parentId)continue;const te=typeof K.data=="object"&&K.data!==null&&"logicalId"in K.data?K.data.logicalId:null,re=typeof K.data=="object"&&K.data!==null&&"podId"in K.data?K.data.podId:null,oe=ar(te)??Ql(re);oe&&!D.has(K.parentId)&&D.set(K.parentId,oe)}const ne=Sie(p,m).map((K,te)=>({...K,data:(()=>{if(K.type==="podGroup"||K.type==="group"){const re=K.data,oe=(re==null?void 0:re.podId)??null,pe=(B==null?void 0:B.kind)==="pod"&&oe!==null&&B.podId===oe;return{...K.data??{},podDisplayName:D.get(K.id)??null,placementState:z?pe?"selected":"available":null}}if(K.type==="rigNode"){const re=K.data,oe=!(re!=null&&re.binding)&&!(re!=null&&re.canonicalSessionName),pe=(B==null?void 0:B.kind)==="node"&&(re==null?void 0:re.logicalId)!==void 0&&B.logicalId===re.logicalId;return{...K.data??{},placementState:z?pe?"selected":oe?"available":null:null}}return K.data})(),className:k?"node-enter":void 0,style:{...K.style??{},animationDelay:k?`${Math.min(te*50,2e3)}ms`:void 0}})),U=ne.reduce((K,te)=>{var re;return Math.max(K,((re=te.position)==null?void 0:re.y)??0)},0),Q=u.map((K,te)=>({id:`discovered-${K.id}`,type:"discoveredNode",position:{x:300,y:U+200+te*150},data:{session:K}}));return[...ne,...Q]},[p,m,k,u,z,B]),$=C.useMemo(()=>W.map(D=>{if(D.type!=="rigNode")return D;const V=D.data;return{...D,data:{...D.data??{},activityRing:T.getNodeActivity(D.id,V),reducedMotion:v}}}),[W,T,v]),F=C.useMemo(()=>S9(A,T.packets,{reducedMotion:v}),[A,T.packets,v]),G=It(),X=t!=null&&t.trim()?t:e?uk(e):null,Z=C.useCallback(async(D,V)=>{var U;if(!e)return;if(z){if(V.type==="podGroup"||V.type==="group"){const Q=V.data,K=(Q==null?void 0:Q.podId)??null,te=K?M.get(K):null,re=!!(K&&(te!=null&&te.namespace));H({kind:"pod",rigId:e,podId:K??"",podNamespace:(te==null?void 0:te.namespace)??null,podLabel:(te==null?void 0:te.displayName)??null,eligible:re,...re?{}:{reason:"This pod cannot receive a new node yet."}});return}if(V.type==="rigNode"){const Q=V.data,K=!Q.binding&&!Q.canonicalSessionName;H({kind:"node",rigId:e,logicalId:Q.logicalId,eligible:K,...K?{}:{reason:"This node is already claimed."}});return}}if(V.type==="podGroup"||V.type==="group")return;const ne=V.data;if(G({to:"/topology/seat/$rigId/$logicalId",params:{rigId:e,logicalId:encodeURIComponent(ne.logicalId)}}),!((U=ne.binding)!=null&&U.cmuxSurface)){_({text:"Not bound to cmux surface",type:"info"});return}try{const Q=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(ne.logicalId)}/focus`,{method:"POST"});if(!Q.ok){_({text:"Focus failed",type:"error"});return}const K=await Q.json();K.ok===!1&&K.code==="unavailable"?_({text:"cmux not connected",type:"error"}):K.ok?_({text:"Focused",type:"success"}):_({text:"Focus failed",type:"error"})}catch{_({text:"Focus failed",type:"error"})}},[z,M,e,H,G,P,_]);return e===null?i.jsx("div",{className:"p-spacing-6 text-foreground-muted",children:"No rig selected"}):a?i.jsxs("div",{className:"p-spacing-6","data-testid":"graph-loading",children:[i.jsx("div",{className:"h-8 w-48 animate-pulse-tactical mb-spacing-4"}),i.jsx("div",{className:"h-64 animate-pulse-tactical"})]}):x?i.jsx("div",{className:"p-spacing-6",children:i.jsx(vn,{"data-testid":"graph-error",children:i.jsxs(cn,{children:["Error: ",x]})})}):$.length===0?i.jsx(Tce,{}):i.jsxs("div",{className:"w-full h-full relative","data-testid":"graph-view","data-animated":k?"true":"false",children:[i.jsx("div",{className:"absolute top-4 left-4 w-3 h-3 reg-mark",children:i.jsx("div",{className:"reg-tl"})}),i.jsx("div",{className:"absolute top-4 right-4 w-3 h-3",children:i.jsx("div",{className:"reg-tr"})}),i.jsx("div",{className:"absolute bottom-4 left-4 w-3 h-3",children:i.jsx("div",{className:"reg-bl"})}),i.jsx("div",{className:"absolute bottom-4 right-4 w-3 h-3",children:i.jsx("div",{className:"reg-br"})}),X&&i.jsx("div",{"data-testid":"rig-stamp-watermark",className:"stamp-watermark text-3xl left-[20%] top-[35%]",children:X}),y&&i.jsx("div",{className:"absolute top-spacing-4 right-spacing-4 z-20",children:i.jsx(vn,{children:i.jsx(cn,{className:"text-warning",children:"Live updates disconnected from daemon - reconnecting..."})})}),b&&i.jsx("div",{className:`absolute top-spacing-4 left-spacing-4 z-20 px-spacing-4 py-spacing-2 font-mono text-[10px] border ${b.type==="success"?"bg-white border-stone-900 text-stone-900":b.type==="error"?"bg-tertiary/10 border-tertiary text-tertiary":"bg-white border-stone-300 text-stone-600"}`,children:b.text}),z&&i.jsx("div",{"data-testid":"graph-placement-banner",className:"absolute top-spacing-4 left-1/2 z-20 -translate-x-1/2 border border-emerald-300/90 bg-[rgba(236,253,245,0.92)] px-3.5 py-2 font-mono text-[10px] text-emerald-950 shadow-[0_12px_28px_rgba(34,197,94,0.14)] backdrop-blur-sm",children:"PLACEMENT MODE / click an available node to bind, or click a pod to add a new node."}),i.jsx(xf,{nodes:$,edges:F,nodeTypes:Rce,edgeTypes:Ace,onNodeClick:Z,nodesDraggable:!1,selectionOnDrag:!1,panOnDrag:!0,fitView:!0,fitViewOptions:{padding:.16,maxZoom:1.15},className:"relative z-10",proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:1.5,children:i.jsx(yf,{})})]})}class e2 extends Error{constructor(n){var r;const s=((r=n.errors)==null?void 0:r.join(", "))??n.message??"Import failed";super(s);ts(this,"errors");ts(this,"warnings");ts(this,"code");this.name="ImportError",this.code=n.code??"unknown",this.errors=n.errors??(n.message?[n.message]:["Import failed"]),this.warnings=n.warnings??[]}}function Ice(){const e=Mt();return en({mutationFn:async({yaml:t,rigRoot:n})=>{const s={"Content-Type":"text/yaml"};n&&(s["X-Rig-Root"]=n);const r=await fetch("/api/rigs/import",{method:"POST",headers:s,body:t});if(!r.ok){const a=await r.json().catch(()=>({}));throw a.code==="cycle_error"?new e2({...a,errors:a.errors??["Cycle detected in rig topology"]}):new e2(a)}return r.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}function Mce(e){switch(e){case"launched":return"text-success";case"failed":return"text-destructive";default:return"text-foreground-muted"}}const v_=C.forwardRef(({className:e,type:t,...n},s)=>i.jsx("input",{type:t,className:he("flex h-11 w-full border border-stone-300/55 bg-white/85 px-4 py-2 text-base text-foreground placeholder:text-foreground-muted/60 transition-colors duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));v_.displayName="Input";const b_=C.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{className:he("flex min-h-[80px] w-full border border-stone-300/55 bg-white/85 px-4 py-3 text-base text-on-surface font-mono placeholder:text-stone-400 transition-all duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));b_.displayName="Textarea";function at({children:e,className:t,innerClassName:n}){return i.jsx("div",{"data-testid":"workspace-page",className:he("w-full flex-1 overflow-y-auto lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",t),children:i.jsx("div",{"data-testid":"workspace-page-inner",className:he("mx-auto w-full max-w-[960px] px-4 py-6 sm:px-6 sm:py-8 md:px-8 lg:px-10",n),children:e})})}const w_=C.forwardRef(({className:e,...t},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:he("w-full caption-bottom text-sm",e),...t})}));w_.displayName="Table";const j_=C.forwardRef(({className:e,...t},n)=>i.jsx("thead",{ref:n,className:he("bg-surface-low [&_tr]:border-b [&_tr]:border-stone-300",e),...t}));j_.displayName="TableHeader";const S_=C.forwardRef(({className:e,...t},n)=>i.jsx("tbody",{ref:n,className:he("[&_tr:last-child]:border-0",e),...t}));S_.displayName="TableBody";const Oce=C.forwardRef(({className:e,...t},n)=>i.jsx("tfoot",{ref:n,className:he("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Oce.displayName="TableFooter";const Bd=C.forwardRef(({className:e,...t},n)=>i.jsx("tr",{ref:n,className:he("border-b border-stone-200 transition-colors duration-150 hover:bg-surface-low data-[state=selected]:bg-surface-mid odd:bg-surface-low/50",e),...t}));Bd.displayName="TableRow";const so=C.forwardRef(({className:e,...t},n)=>i.jsx("th",{ref:n,className:he("h-12 px-4 text-left align-middle font-medium text-foreground-muted uppercase text-label-md tracking-[0.04em] [&:has([role=checkbox])]:pr-0",e),...t}));so.displayName="TableHead";const ro=C.forwardRef(({className:e,...t},n)=>i.jsx("td",{ref:n,className:he("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));ro.displayName="TableCell";const Lce=C.forwardRef(({className:e,...t},n)=>i.jsx("caption",{ref:n,className:he("mt-4 text-sm text-foreground-muted",e),...t}));Lce.displayName="TableCaption";function wn({eyebrow:e,title:t,description:n,actions:s}){return i.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),i.jsx("h2",{className:"text-2xl font-bold uppercase tracking-[0.04em] text-stone-900 sm:text-3xl",children:t}),n&&i.jsx("p",{className:"max-w-2xl text-base leading-8 text-stone-600",children:n})]}),s?i.jsx("div",{className:"flex flex-wrap gap-2",children:s}):null]})}function k9({steps:e,currentStep:t,errorAtStep:n=0,"data-testid":s}){const r=n||t;return i.jsx("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3","data-testid":s,children:e.map((a,l)=>{const u=r>a.num,d=r===a.num,f=r<a.num,p=u?"done":d?"active":"upcoming";return i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[i.jsxs("div",{"data-testid":`step-${a.num}`,"data-step-state":p,className:he("inline-flex min-h-0 items-center gap-2 border-b-2 px-1 py-1 font-mono text-[10px] uppercase tracking-[0.16em] transition-colors",u&&"border-primary/35 text-foreground-muted",d&&"border-stone-900 text-foreground",f&&"border-transparent text-foreground-muted/35"),children:[i.jsxs("span",{className:"text-[9px] tracking-[0.22em]",children:[u?"✓ ":"",String(a.num).padStart(2,"0")]}),i.jsx("span",{className:"text-[10px] leading-none tracking-[0.2em]",children:a.label})]}),l<e.length-1?i.jsx("div",{"aria-hidden":"true",className:he("h-px w-4 shrink-0 sm:w-6",u?"bg-primary/35":"bg-stone-300/45")}):null]},a.num)})})}function bs({title:e,description:t,children:n,className:s}){return i.jsxs("section",{className:he("space-y-4 border border-stone-300/45 bg-[rgba(255,255,255,0.62)] p-5 shadow-[0_1px_0_rgba(255,255,255,0.95)_inset,0_10px_26px_rgba(34,34,24,0.035)] sm:p-6",s),children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),t?i.jsx("p",{className:"text-base leading-8 text-stone-600",children:t}):null]}),n]})}function Do({children:e}){return i.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:e})}function st({label:e,value:t,testId:n}){return i.jsxs("div",{className:"border border-stone-300/35 bg-white/10 px-4 py-4",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),i.jsx("div",{"data-testid":n,className:"mt-2 text-2xl font-semibold uppercase tracking-[0.04em] text-stone-900",children:t})]})}function _9({title:e,testId:t,children:n}){return i.jsx(bs,{title:e,children:i.jsx("pre",{"data-testid":t,className:"overflow-x-auto border border-stone-300/45 bg-white/75 p-4 text-xs leading-6 text-stone-800",children:n})})}const Pce=[{num:1,label:"VALIDATE RIGSPEC"},{num:2,label:"PREFLIGHT"},{num:3,label:"INSTANTIATE"}];function $ce(e){switch(e){case"input":case"validating":return 1;case"valid":case"preflight":return 2;case"preflight_done":case"instantiating":case"done":return 3;case"error":return 0}}function Dce({onBack:e}={}){const t=Ice(),{currentRigDraft:n,selectedRigDraft:s,saveRigDraft:r,rememberRigDraft:a,clearSelectedRigDraft:l}=lf(),[u,d]=C.useState(()=>(s==null?void 0:s.yaml)??(n==null?void 0:n.yaml)??""),[f,p]=C.useState(""),[m,x]=C.useState("input"),[y,v]=C.useState(0),[b,w]=C.useState([]),[S,E]=C.useState([]),[k,_]=C.useState(null);C.useEffect(()=>{r(u)},[r,u]),C.useEffect(()=>{s&&(d(s.yaml),l())},[l,s]);const R=async()=>{a(u),x("validating"),w([]);try{const L=await(await fetch("/api/rigs/import/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:u})).json();L.valid?x("valid"):(w(L.errors??["Validation failed"]),v(1),x("error"))}catch{w(["Validation request failed"]),v(1),x("error")}},T=async()=>{x("preflight"),w([]),E([]);try{const M={"Content-Type":"text/yaml"};f&&(M["X-Rig-Root"]=f);const P=await(await fetch("/api/rigs/import/preflight",{method:"POST",headers:M,body:u})).json();E(P.warnings??[]),P.errors&&P.errors.length>0?(w(P.errors),v(2),x("error")):x("preflight_done")}catch{w(["Preflight request failed"]),v(2),x("error")}},A=async()=>{x("instantiating"),w([]);try{const M=await t.mutateAsync({yaml:u,rigRoot:f.trim()||void 0});_(M),x("done")}catch(M){M instanceof e2?(M.code==="cycle_error"?w(["Cycle detected in rig topology"]):w(M.errors),E(M.warnings)):w([M instanceof Error?M.message:"Instantiate request failed"]),v(3),x("error")}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"import-flow",className:"space-y-8",children:[i.jsx(wn,{eyebrow:"Rig Import",title:"Import Rig",description:"Validate a RigSpec, run preflight checks, then instantiate a topology from YAML."}),i.jsx(k9,{"data-testid":"step-indicator",steps:Pce,currentStep:$ce(m),errorAtStep:m==="error"?y:0}),m==="input"&&i.jsxs(bs,{title:"Rig YAML",description:"Paste a rig spec and optionally provide a rig root to anchor relative references during import.",children:[i.jsx(b_,{"data-testid":"yaml-input",value:u,onChange:M=>d(M.target.value),placeholder:"Paste YAML rig spec here...",rows:14,className:"font-mono text-body-sm mb-spacing-4"}),i.jsxs("div",{className:"mb-spacing-4",children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RIG ROOT (OPTIONAL)"}),i.jsx(v_,{"data-testid":"rig-root-input",type:"text",value:f,onChange:M=>p(M.target.value),placeholder:"/path/to/rig/root",className:"font-mono text-body-sm"})]}),i.jsx(_e,{variant:"tactical","data-testid":"validate-btn",onClick:R,disabled:!u.trim(),children:"VALIDATE RIGSPEC"})]}),m==="validating"&&i.jsx("div",{className:"text-label-md text-foreground-muted",children:"Validating..."}),m==="valid"&&i.jsxs(bs,{title:"Validation Passed",description:"The RigSpec is valid. Run preflight checks before you instantiate it.",children:[i.jsx(vn,{className:"mb-spacing-4","data-testid":"valid-message",children:i.jsx(cn,{className:"text-primary",children:"RigSpec valid. Run preflight checks?"})}),i.jsx(_e,{variant:"tactical","data-testid":"preflight-btn",onClick:T,children:"RUN PREFLIGHT"})]}),m==="preflight"&&i.jsx("div",{className:"text-label-md text-foreground-muted",children:"Running preflight..."}),m==="preflight_done"&&i.jsxs(bs,{title:"Preflight Results",description:"Review warnings before you instantiate the rig into live runtime sessions.",children:[S.length>0&&i.jsx(vn,{className:"mb-spacing-4","data-testid":"preflight-warnings",children:i.jsxs(cn,{className:"text-warning",children:[i.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),S.map((M,L)=>i.jsxs("div",{children:["— ",M]},L))]})}),i.jsx(vn,{className:"mb-spacing-4","data-testid":"preflight-ready",children:i.jsx(cn,{className:"text-primary",children:"Preflight passed. Ready to instantiate."})}),i.jsx(_e,{variant:"tactical","data-testid":"instantiate-btn",onClick:A,children:"INSTANTIATE"})]}),m==="instantiating"&&i.jsx("div",{className:"text-label-md text-foreground-muted",children:"Instantiating..."}),m==="done"&&k&&i.jsx(bs,{title:"Instantiate Result",description:"The daemon returned per-node launch status for the imported topology.",className:"space-y-4",children:i.jsxs("div",{"data-testid":"import-result",children:[i.jsx(vn,{className:"mb-spacing-4",children:i.jsxs(cn,{children:[i.jsx("span",{className:"text-primary font-mono",children:k.specName}),i.jsxs("span",{className:"text-foreground-muted",children:[" (",k.rigId,")"]})]})}),i.jsxs(w_,{children:[i.jsx(j_,{children:i.jsxs(Bd,{children:[i.jsx(so,{children:"NODE"}),i.jsx(so,{children:"STATUS"})]})}),i.jsx(S_,{children:k.nodes.map(M=>i.jsxs(Bd,{children:[i.jsx(ro,{className:"font-mono",children:M.logicalId}),i.jsx(ro,{children:i.jsx("span",{className:`font-mono ${Mce(M.status)}`,"data-testid":`inst-status-${M.logicalId}`,children:M.status})})]},M.logicalId))})]}),e?i.jsx("div",{className:"mt-spacing-6",children:i.jsx(_e,{variant:"ghost",onClick:e,children:"Close"})}):null]})}),m==="error"&&i.jsx(bs,{title:"Import Errors",description:"Fix the reported issues, then retry the import flow.",children:i.jsxs("div",{"data-testid":"import-errors",children:[S.length>0&&i.jsx(vn,{className:"mb-spacing-2","data-testid":"error-warnings",children:i.jsxs(cn,{className:"text-warning",children:[i.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),S.map((M,L)=>i.jsxs("div",{children:["— ",M]},L))]})}),b.map((M,L)=>i.jsx(vn,{className:"mb-spacing-2",children:i.jsx(cn,{className:"text-destructive",children:M})},L)),i.jsx(_e,{variant:"tactical",className:"mt-spacing-4",onClick:()=>{x("input"),w([]),E([]),_(null),v(0),p("")},children:"TRY AGAIN"})]})})]})})}async function qce(){const e=await fetch("/api/packages/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function zce(){return qe({queryKey:["packages"],queryFn:qce})}function Bce(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted-on-dark"}}function Fce(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return"NONE"}}function Hce({pkg:e,onSelect:t}){return i.jsxs("div",{"data-testid":"package-card",role:"link",tabIndex:0,className:"card-dark p-spacing-6 mb-spacing-3 cursor-pointer",onClick:()=>t(e.id),onKeyDown:n=>{n.key==="Enter"&&t(e.id)},children:[i.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[i.jsx("h3",{className:"text-headline-md uppercase",children:e.name}),i.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",e.version]})]}),e.summary&&i.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-4",children:e.summary}),i.jsx("div",{className:"flex items-center gap-spacing-4 text-label-sm",children:i.jsxs("span",{className:"text-foreground-muted-on-dark",children:["SOURCE ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:e.sourceRef})]})}),i.jsxs("div",{className:"flex items-center gap-spacing-4 mt-spacing-3 text-label-sm",children:[i.jsxs("span",{className:"text-foreground-muted-on-dark",children:["INSTALLS ",i.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"install-count",children:e.installCount})]}),i.jsxs("span",{className:"flex items-center gap-spacing-1",children:[i.jsx("span",{className:he("inline-block w-[6px] h-[6px]",Bce(e.latestInstallStatus))}),i.jsx("span",{className:"text-foreground-muted-on-dark","data-testid":"install-status",children:Fce(e.latestInstallStatus)})]})]})]})}function Uce(){const e=It(),{data:t,isPending:n,error:s}=zce(),r=t?[...t].sort((a,l)=>l.createdAt.localeCompare(a.createdAt)):[];return n?i.jsx(at,{children:i.jsxs("div",{"data-testid":"packages-loading",children:[i.jsxs("div",{className:"flex justify-between mb-spacing-6",children:[i.jsx("div",{className:"h-8 w-32 shimmer"}),i.jsx("div",{className:"h-8 w-28 shimmer"})]}),[1,2].map(a=>i.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-3",children:[i.jsx("div",{className:"h-6 w-48 shimmer-dark mb-spacing-4"}),i.jsx("div",{className:"h-12 shimmer-dark mb-spacing-4"}),i.jsx("div",{className:"h-4 w-64 shimmer-dark"})]},a))]})}):s?i.jsx(at,{children:i.jsx("div",{children:i.jsx(vn,{"data-testid":"packages-error",children:i.jsx(cn,{children:s.message})})})}):r.length===0?i.jsx(at,{children:i.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh]","data-testid":"packages-empty",children:[i.jsx("h2",{className:"text-display-lg text-foreground mb-spacing-4",children:"NO LEGACY PACKAGE INSTALLS"}),i.jsx("p",{className:"text-body-md text-foreground-muted mb-spacing-8",children:"Legacy package tools remain available for bootstrap internals while Library becomes the main authoring surface."}),i.jsxs("div",{className:"flex flex-col items-center gap-spacing-3",children:[i.jsx(_e,{variant:"default",size:"lg","data-testid":"empty-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),i.jsx(_e,{variant:"ghost",size:"lg","data-testid":"empty-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]})}):i.jsx(at,{children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-baseline mb-spacing-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-headline-lg uppercase",children:"LEGACY PACKAGE TOOLS"}),i.jsxs("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:[r.length," legacy package install",r.length!==1?"s":""," retained for bootstrap internals"]})]}),i.jsxs("div",{className:"flex flex-col items-end gap-spacing-2",children:[i.jsx(_e,{variant:"default",size:"sm","data-testid":"header-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"header-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]}),r.map(a=>i.jsx(Hce,{pkg:a,onSelect:l=>e({to:"/packages/$packageId",params:{packageId:l}})},a.id))]})})}const Vce=[{num:1,label:"ENTER"},{num:2,label:"VALIDATE"},{num:3,label:"CONFIGURE"},{num:4,label:"PLAN"},{num:5,label:"APPLY"}];function Gce(e){switch(e){case"enter":return 1;case"validating":case"validated":return 2;case"configure":return 3;case"planning":case"planned":return 4;case"applying":case"done":return 5;case"error":return 0}}function Kce({currentStep:e,errorAtStep:t}){const n=e==="error"?t:Gce(e);return i.jsx("div",{className:"flex items-center gap-spacing-2 mb-spacing-8 p-spacing-4 inset-light flex-wrap","data-testid":"step-indicator",children:Vce.map((s,r)=>{const a=n>s.num,l=n===s.num;return i.jsxs("div",{className:"flex items-center gap-spacing-2",children:[r>0&&i.jsx("div",{className:`w-6 h-px mx-spacing-1 ${a?"bg-primary/40":"bg-foreground-muted/20"}`}),i.jsxs("span",{"data-testid":`step-${s.num}`,className:he("text-label-sm uppercase tracking-[0.04em] font-mono px-spacing-2 py-spacing-1 transition-colors whitespace-nowrap",a?"text-foreground-muted":l?"text-foreground bg-foreground/10":"text-foreground-muted/30"),children:[a?"✓":""," [ ",s.num," ",s.label," ]"]})]},s.num)})})}function Wce(e){switch(e){case"approved":return"text-success";case"rejected":return"text-warning";case"deferred":return"text-foreground-muted";case"conflict":return"text-destructive";case"noop":return"text-foreground-muted/50";default:return""}}function Yce(e){switch(e){case"approved":return"bg-success/8";case"rejected":return"bg-warning/8";case"deferred":return"bg-foreground-muted/4";case"conflict":return"bg-destructive/8";default:return""}}function Qce(){const e=It(),[t,n]=C.useState(""),[s,r]=C.useState("enter"),[a,l]=C.useState(0),[u,d]=C.useState([]),[f,p]=C.useState(null),[m,x]=C.useState("claude-code"),[y,v]=C.useState("."),[b,w]=C.useState(""),[S,E]=C.useState(!1),[k,_]=C.useState(null),[R,T]=C.useState(null),A=async()=>{r("validating"),d([]);try{const B=await(await fetch("/api/packages/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t})})).json();B.valid?(p(B.manifest),r("validated")):(d(B.errors??[B.error??"Validation failed"]),l(2),r("error"))}catch{d(["Validation request failed"]),l(2),r("error")}},M=async()=>{r("planning"),d([]);try{const O=await fetch("/api/packages/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:y,runtime:m,roleName:b||void 0,allowMerge:S})});if(!O.ok){const H=await O.json();d(H.errors??[H.error??"Plan failed"]),l(4),r("error");return}const B=await O.json();_(B),r("planned")}catch{d(["Plan request failed"]),l(4),r("error")}},L=async()=>{r("applying"),d([]);try{const O=await fetch("/api/packages/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:y,runtime:m,roleName:b||void 0,allowMerge:S})}),B=await O.json();if(O.status>=400){d(B.errors??[B.error??"Install failed"]),l(5),r("error");return}T(B),r("done")}catch{d(["Install request failed"]),l(5),r("error")}},P=((k==null?void 0:k.conflicts)??0)>0;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"install-flow",children:[i.jsx("div",{className:"mb-spacing-8",children:i.jsxs("div",{children:[i.jsx("h2",{className:"text-headline-lg uppercase tracking-[0.06em]",children:"INSTALL PACKAGE (Legacy)"}),i.jsx("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:"Validate, configure, and apply an agent package"})]})}),i.jsx(Kce,{currentStep:s,errorAtStep:a}),s==="enter"&&i.jsxs("div",{children:[i.jsx("label",{className:"text-label-md text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-2",children:"PACKAGE PATH"}),i.jsx("input",{"data-testid":"source-path-input",type:"text",value:t,onChange:O=>n(O.target.value),placeholder:"/path/to/package",className:"w-full bg-transparent border-b border-foreground/20 focus:border-foreground px-0 py-spacing-2 text-body-md font-mono outline-none transition-colors"}),i.jsx(_e,{variant:"tactical","data-testid":"validate-btn",onClick:A,disabled:!t.trim(),className:"mt-spacing-4",children:"VALIDATE"})]}),s==="validating"&&i.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"validating-indicator",children:"Validating..."}),s==="validated"&&f&&i.jsxs("div",{"data-testid":"manifest-summary",children:[i.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4",children:[i.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[i.jsx("span",{className:"text-headline-md uppercase",children:f.name}),i.jsxs("span",{className:"font-mono text-foreground-muted-on-dark",children:["v",f.version]})]}),i.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-3",children:f.summary}),i.jsxs("div",{className:"flex flex-wrap gap-spacing-3 text-label-sm",children:[i.jsxs("span",{children:["Skills: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:f.exportCounts.skills})]}),i.jsxs("span",{children:["Guidance: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:f.exportCounts.guidance})]}),i.jsxs("span",{children:["Agents: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:f.exportCounts.agents})]}),i.jsxs("span",{children:["Hooks: ",i.jsx("span",{className:"font-mono text-foreground-on-dark",children:f.exportCounts.hooks})]}),i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[i.jsx("span",{children:"Runtimes:"}),i.jsx("span",{className:"inline-flex min-w-0 flex-wrap items-center gap-1",children:f.runtimes.map(O=>i.jsx(Gn,{runtime:O,size:"xs",compact:!0,className:"border-white/20 bg-white/10 text-foreground-on-dark"},O))})]})]})]}),i.jsx(_e,{variant:"tactical","data-testid":"configure-btn",onClick:()=>r("configure"),children:"CONFIGURE"})]}),s==="configure"&&f&&i.jsxs("div",{"data-testid":"configure-step",children:[i.jsxs("div",{className:"space-y-spacing-4 mb-spacing-6",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RUNTIME"}),i.jsx("select",{"data-testid":"runtime-select",value:m,onChange:O=>x(O.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:f.runtimes.map(O=>i.jsx("option",{value:O,children:O},O))})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"TARGET ROOT"}),i.jsx("input",{"data-testid":"target-root-input",type:"text",value:y,onChange:O=>v(O.target.value),className:"w-full bg-transparent border-b border-foreground/20 px-0 py-spacing-1 text-body-md font-mono outline-none"})]}),f.roles.length>0&&i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"ROLE"}),i.jsxs("select",{"data-testid":"role-select",value:b,onChange:O=>w(O.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:[i.jsx("option",{value:"",children:"All exports"}),f.roles.map(O=>i.jsxs("option",{value:O.name,children:[O.name,O.description?` — ${O.description}`:""]},O.name))]})]}),i.jsxs("div",{className:"flex items-center gap-spacing-2",children:[i.jsx("input",{"data-testid":"allow-merge-toggle",type:"checkbox",checked:S,onChange:O=>E(O.target.checked),className:"accent-primary"}),i.jsx("label",{className:"text-label-sm text-foreground-muted",children:"Allow managed block merges into existing files"})]}),(f.requirements.cliTools.length>0||f.requirements.systemPackages.length>0)&&i.jsxs("div",{"data-testid":"requirements-section",className:"p-spacing-3 bg-foreground/4",children:[i.jsx("span",{className:"text-label-sm text-foreground-muted uppercase block mb-spacing-1",children:"REQUIREMENTS"}),f.requirements.cliTools.map(O=>i.jsxs("div",{className:"text-body-sm font-mono",children:["CLI: ",O.name]},O.name)),f.requirements.systemPackages.map(O=>i.jsxs("div",{className:"text-body-sm font-mono",children:["System: ",O.name]},O.name))]})]}),i.jsx(_e,{variant:"tactical","data-testid":"plan-btn",onClick:M,children:"PREVIEW PLAN"})]}),s==="planning"&&i.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"planning-indicator",children:"Planning..."}),s==="planned"&&k&&i.jsxs("div",{"data-testid":"plan-preview",children:[i.jsxs("div",{className:"flex flex-wrap gap-spacing-4 mb-spacing-4 text-label-sm",children:[i.jsxs("span",{children:["Approved: ",i.jsx("span",{className:"font-mono text-success","data-testid":"plan-actionable",children:k.actionable})]}),i.jsxs("span",{children:["Deferred: ",i.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"plan-deferred",children:k.deferred})]}),i.jsxs("span",{children:["Conflicts: ",i.jsx("span",{className:"font-mono text-destructive","data-testid":"plan-conflicts",children:k.conflicts})]}),i.jsxs("span",{children:["No-ops: ",i.jsx("span",{className:"font-mono","data-testid":"plan-noops",children:k.noOps})]}),k.rejected>0&&i.jsxs("span",{children:["Rejected: ",i.jsx("span",{className:"font-mono text-warning","data-testid":"plan-rejected",children:k.rejected})]})]}),P&&i.jsx(vn,{className:"mb-spacing-4","data-testid":"conflict-warning",children:i.jsx(cn,{className:"text-destructive",children:"Conflicts detected — resolve before applying"})}),i.jsxs(w_,{children:[i.jsx(j_,{children:i.jsxs(Bd,{children:[i.jsx(so,{children:"TYPE"}),i.jsx(so,{children:"NAME"}),i.jsx(so,{children:"STATUS"}),i.jsx(so,{children:"TARGET"})]})}),i.jsx(S_,{children:k.entries.map((O,B)=>i.jsxs(Bd,{className:Yce(O.policyStatus),"data-testid":"plan-entry","data-policy-status":O.policyStatus,children:[i.jsx(ro,{className:"font-mono text-label-sm",children:O.exportType}),i.jsx(ro,{className:"font-mono text-label-sm",children:O.exportName}),i.jsxs(ro,{className:he("font-mono text-label-sm uppercase",Wce(O.policyStatus)),children:[O.policyStatus,O.deferReason&&i.jsxs("span",{className:"text-foreground-muted normal-case",children:[" — ",O.deferReason]}),O.conflict&&i.jsxs("span",{className:"text-destructive normal-case",children:[" — ",O.conflict.reason]})]}),i.jsx(ro,{className:"font-mono text-label-sm text-foreground-muted truncate max-w-[200px]",children:O.targetPath||"—"})]},B))})]}),i.jsx("div",{className:"mt-spacing-4",children:i.jsx(_e,{variant:"tactical","data-testid":"apply-btn",onClick:L,disabled:P,title:P?"Resolve conflicts before applying":void 0,children:"APPLY"})})]}),s==="applying"&&i.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"applying-indicator",children:"Applying..."}),s==="done"&&R&&i.jsxs("div",{"data-testid":"install-result",children:[i.jsx(vn,{className:"mb-spacing-4",children:i.jsxs(cn,{children:[i.jsx("span",{className:"text-primary font-mono",children:R.packageName}),i.jsx("span",{className:"text-foreground-muted",children:" installed as "}),i.jsx("span",{className:"font-mono","data-testid":"result-install-id",children:R.installId})]})}),i.jsxs("div",{className:"flex gap-spacing-4 text-label-sm mb-spacing-4",children:[i.jsxs("span",{children:["Applied: ",i.jsx("span",{className:"font-mono text-success","data-testid":"result-applied",children:R.applied.length})]}),i.jsxs("span",{children:["Deferred: ",i.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"result-deferred",children:R.deferred.length})]}),i.jsxs("span",{children:["Verified: ",i.jsx("span",{className:he("font-mono",R.verification.passed?"text-success":"text-destructive"),"data-testid":"result-verified",children:R.verification.passed?"PASS":"FAIL"})]})]}),i.jsx("div",{className:"flex gap-spacing-3",children:i.jsx(_e,{variant:"tactical","data-testid":"detail-link",onClick:()=>e({to:"/packages/$packageId",params:{packageId:R.packageId}}),children:"VIEW INSTALL DETAILS"})})]}),s==="error"&&i.jsxs("div",{"data-testid":"install-errors",children:[u.map((O,B)=>i.jsx(vn,{className:"mb-spacing-2",children:i.jsx(cn,{className:"text-destructive",children:O})},B)),i.jsx(_e,{variant:"tactical",className:"mt-spacing-4","data-testid":"try-again-btn",onClick:()=>{r("enter"),d([]),p(null),_(null),T(null),l(0)},children:"TRY AGAIN"})]})]})})}function da(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Xce(e,t){const n=C.createContext(t),s=a=>{const{children:l,...u}=a,d=C.useMemo(()=>u,Object.values(u));return i.jsx(n.Provider,{value:d,children:l})};s.displayName=e+"Provider";function r(a){const l=C.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,r]}function Zce(e,t=[]){let n=[];function s(a,l){const u=C.createContext(l),d=n.length;n=[...n,l];const f=m=>{var S;const{scope:x,children:y,...v}=m,b=((S=x==null?void 0:x[e])==null?void 0:S[d])||u,w=C.useMemo(()=>v,Object.values(v));return i.jsx(b.Provider,{value:w,children:y})};f.displayName=a+"Provider";function p(m,x){var b;const y=((b=x==null?void 0:x[e])==null?void 0:b[d])||u,v=C.useContext(y);if(v)return v;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[f,p]}const r=()=>{const a=n.map(l=>C.createContext(l));return function(u){const d=(u==null?void 0:u[e])||a;return C.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return r.scopeName=e,[s,Jce(r,...t)]}function Jce(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const l=s.reduce((u,{useScope:d,scopeName:f})=>{const m=d(a)[`__scope${f}`];return{...u,...m}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Fd=globalThis!=null&&globalThis.document?C.useLayoutEffect:()=>{},eue=p2[" useId ".trim().toString()]||(()=>{}),tue=0;function IS(e){const[t,n]=C.useState(eue());return Fd(()=>{n(s=>s??String(tue++))},[e]),e||(t?`radix-${t}`:"")}var nue=p2[" useInsertionEffect ".trim().toString()]||Fd;function sue({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[r,a,l]=rue({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:r;{const p=C.useRef(e!==void 0);C.useEffect(()=>{const m=p.current;m!==u&&console.warn(`${s} is changing from ${m?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,s])}const f=C.useCallback(p=>{var m;if(u){const x=iue(p)?p(e):p;x!==e&&((m=l.current)==null||m.call(l,x))}else a(p)},[u,e,a,l]);return[d,f]}function rue({defaultProp:e,onChange:t}){const[n,s]=C.useState(e),r=C.useRef(n),a=C.useRef(t);return nue(()=>{a.current=t},[t]),C.useEffect(()=>{var l;r.current!==n&&((l=a.current)==null||l.call(a,n),r.current=n)},[n,r]),[n,s,a]}function iue(e){return typeof e=="function"}function aue(e){const t=oue(e),n=C.forwardRef((s,r)=>{const{children:a,...l}=s,u=C.Children.toArray(a),d=u.find(cue);if(d){const f=d.props.children,p=u.map(m=>m===d?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return i.jsx(t,{...l,ref:r,children:C.isValidElement(f)?C.cloneElement(f,void 0,p):null})}return i.jsx(t,{...l,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function oue(e){const t=C.forwardRef((n,s)=>{const{children:r,...a}=n;if(C.isValidElement(r)){const l=due(r),u=uue(a,r.props);return r.type!==C.Fragment&&(u.ref=s?ug(s,l):l),C.cloneElement(r,u)}return C.Children.count(r)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lue=Symbol("radix.slottable");function cue(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lue}function uue(e,t){const n={...t};for(const s in t){const r=e[s],a=t[s];/^on[A-Z]/.test(s)?r&&a?n[s]=(...u)=>{const d=a(...u);return r(...u),d}:r&&(n[s]=r):s==="style"?n[s]={...r,...a}:s==="className"&&(n[s]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function due(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fue=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ri=fue.reduce((e,t)=>{const n=aue(`Primitive.${t}`),s=C.forwardRef((r,a)=>{const{asChild:l,...u}=r,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(d,{...u,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function hue(e,t){e&&Wm.flushSync(()=>e.dispatchEvent(t))}function Hd(e){const t=C.useRef(e);return C.useEffect(()=>{t.current=e}),C.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function pue(e,t=globalThis==null?void 0:globalThis.document){const n=Hd(e);C.useEffect(()=>{const s=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var mue="DismissableLayer",t2="dismissableLayer.update",gue="dismissableLayer.pointerDownOutside",xue="dismissableLayer.focusOutside",YL,C9=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),E9=C.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:r,onFocusOutside:a,onInteractOutside:l,onDismiss:u,...d}=e,f=C.useContext(C9),[p,m]=C.useState(null),x=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=C.useState({}),v=Io(t,A=>m(A)),b=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),S=b.indexOf(w),E=p?b.indexOf(p):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,_=E>=S,R=bue(A=>{const M=A.target,L=[...f.branches].some(P=>P.contains(M));!_||L||(r==null||r(A),l==null||l(A),A.defaultPrevented||u==null||u())},x),T=wue(A=>{const M=A.target;[...f.branches].some(P=>P.contains(M))||(a==null||a(A),l==null||l(A),A.defaultPrevented||u==null||u())},x);return pue(A=>{E===f.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&u&&(A.preventDefault(),u()))},x),C.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(YL=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),QL(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=YL)}},[p,x,n,f]),C.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),QL())},[p,f]),C.useEffect(()=>{const A=()=>y({});return document.addEventListener(t2,A),()=>document.removeEventListener(t2,A)},[]),i.jsx(ri.div,{...d,ref:v,style:{pointerEvents:k?_?"auto":"none":void 0,...e.style},onFocusCapture:da(e.onFocusCapture,T.onFocusCapture),onBlurCapture:da(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:da(e.onPointerDownCapture,R.onPointerDownCapture)})});E9.displayName=mue;var yue="DismissableLayerBranch",vue=C.forwardRef((e,t)=>{const n=C.useContext(C9),s=C.useRef(null),r=Io(t,s);return C.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(ri.div,{...e,ref:r})});vue.displayName=yue;function bue(e,t=globalThis==null?void 0:globalThis.document){const n=Hd(e),s=C.useRef(!1),r=C.useRef(()=>{});return C.useEffect(()=>{const a=u=>{if(u.target&&!s.current){let d=function(){R9(gue,n,f,{discrete:!0})};const f={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=d,t.addEventListener("click",r.current,{once:!0})):d()}else t.removeEventListener("click",r.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function wue(e,t=globalThis==null?void 0:globalThis.document){const n=Hd(e),s=C.useRef(!1);return C.useEffect(()=>{const r=a=>{a.target&&!s.current&&R9(xue,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function QL(){const e=new CustomEvent(t2);document.dispatchEvent(e)}function R9(e,t,n,{discrete:s}){const r=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),s?hue(r,a):r.dispatchEvent(a)}var MS="focusScope.autoFocusOnMount",OS="focusScope.autoFocusOnUnmount",XL={bubbles:!1,cancelable:!0},jue="FocusScope",A9=C.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:a,...l}=e,[u,d]=C.useState(null),f=Hd(r),p=Hd(a),m=C.useRef(null),x=Io(t,b=>d(b)),y=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(s){let b=function(k){if(y.paused||!u)return;const _=k.target;u.contains(_)?m.current=_:Fi(m.current,{select:!0})},w=function(k){if(y.paused||!u)return;const _=k.relatedTarget;_!==null&&(u.contains(_)||Fi(m.current,{select:!0}))},S=function(k){if(document.activeElement===document.body)for(const R of k)R.removedNodes.length>0&&Fi(u)};document.addEventListener("focusin",b),document.addEventListener("focusout",w);const E=new MutationObserver(S);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",w),E.disconnect()}}},[s,u,y.paused]),C.useEffect(()=>{if(u){JL.add(y);const b=document.activeElement;if(!u.contains(b)){const S=new CustomEvent(MS,XL);u.addEventListener(MS,f),u.dispatchEvent(S),S.defaultPrevented||(Sue(Eue(T9(u)),{select:!0}),document.activeElement===b&&Fi(u))}return()=>{u.removeEventListener(MS,f),setTimeout(()=>{const S=new CustomEvent(OS,XL);u.addEventListener(OS,p),u.dispatchEvent(S),S.defaultPrevented||Fi(b??document.body,{select:!0}),u.removeEventListener(OS,p),JL.remove(y)},0)}}},[u,f,p,y]);const v=C.useCallback(b=>{if(!n&&!s||y.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,S=document.activeElement;if(w&&S){const E=b.currentTarget,[k,_]=Nue(E);k&&_?!b.shiftKey&&S===_?(b.preventDefault(),n&&Fi(k,{select:!0})):b.shiftKey&&S===k&&(b.preventDefault(),n&&Fi(_,{select:!0})):S===E&&b.preventDefault()}},[n,s,y.paused]);return i.jsx(ri.div,{tabIndex:-1,...l,ref:x,onKeyDown:v})});A9.displayName=jue;function Sue(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Fi(s,{select:t}),document.activeElement!==n)return}function Nue(e){const t=T9(e),n=ZL(t,e),s=ZL(t.reverse(),e);return[n,s]}function T9(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ZL(e,t){for(const n of e)if(!kue(n,{upTo:t}))return n}function kue(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function _ue(e){return e instanceof HTMLInputElement&&"select"in e}function Fi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_ue(e)&&t&&e.select()}}var JL=Cue();function Cue(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=eP(e,t),e.unshift(t)},remove(t){var n;e=eP(e,t),(n=e[0])==null||n.resume()}}}function eP(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Eue(e){return e.filter(t=>t.tagName!=="A")}var Rue="Portal",I9=C.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[r,a]=C.useState(!1);Fd(()=>a(!0),[]);const l=n||r&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?cU.createPortal(i.jsx(ri.div,{...s,ref:t}),l):null});I9.displayName=Rue;function Aue(e,t){return C.useReducer((n,s)=>t[n][s]??n,e)}var sx=e=>{const{present:t,children:n}=e,s=Tue(t),r=typeof n=="function"?n({present:s.isPresent}):C.Children.only(n),a=Io(s.ref,Iue(r));return typeof n=="function"||s.isPresent?C.cloneElement(r,{ref:a}):null};sx.displayName="Presence";function Tue(e){const[t,n]=C.useState(),s=C.useRef(null),r=C.useRef(e),a=C.useRef("none"),l=e?"mounted":"unmounted",[u,d]=Aue(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{const f=Ip(s.current);a.current=u==="mounted"?f:"none"},[u]),Fd(()=>{const f=s.current,p=r.current;if(p!==e){const x=a.current,y=Ip(f);e?d("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(p&&x!==y?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,d]),Fd(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,m=y=>{const b=Ip(s.current).includes(CSS.escape(y.animationName));if(y.target===t&&b&&(d("ANIMATION_END"),!r.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},x=y=>{y.target===t&&(a.current=Ip(s.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(f),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:C.useCallback(f=>{s.current=f?getComputedStyle(f):null,n(f)},[])}}function Ip(e){return(e==null?void 0:e.animationName)||"none"}function Iue(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var LS=0;function Mue(){C.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??tP()),document.body.insertAdjacentElement("beforeend",e[1]??tP()),LS++,()=>{LS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),LS--}},[])}function tP(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ir=function(){return ir=Object.assign||function(t){for(var n,s=1,r=arguments.length;s<r;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ir.apply(this,arguments)};function M9(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function Oue(e,t,n){if(n||arguments.length===2)for(var s=0,r=t.length,a;s<r;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var am="right-scroll-bar-position",om="width-before-scroll-bar",Lue="with-scroll-bars-hidden",Pue="--removed-body-scroll-bar-size";function PS(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function $ue(e,t){var n=C.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var r=n.value;r!==s&&(n.value=s,n.callback(s,r))}}}})[0];return n.callback=t,n.facade}var Due=typeof window<"u"?C.useLayoutEffect:C.useEffect,nP=new WeakMap;function que(e,t){var n=$ue(null,function(s){return e.forEach(function(r){return PS(r,s)})});return Due(function(){var s=nP.get(n);if(s){var r=new Set(s),a=new Set(e),l=n.current;r.forEach(function(u){a.has(u)||PS(u,null)}),a.forEach(function(u){r.has(u)||PS(u,l)})}nP.set(n,e)},[e]),n}function zue(e){return e}function Bue(e,t){t===void 0&&(t=zue);var n=[],s=!1,r={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,s);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(s=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(u){return a(u)},filter:function(){return n}}},assignMedium:function(a){s=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(a),l=n}var d=function(){var p=l;l=[],p.forEach(a)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(p){l.push(p),f()},filter:function(p){return l=l.filter(p),n}}}};return r}function Fue(e){e===void 0&&(e={});var t=Bue(null);return t.options=ir({async:!0,ssr:!1},e),t}var O9=function(e){var t=e.sideCar,n=M9(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return C.createElement(s,ir({},n))};O9.isSideCarExport=!0;function Hue(e,t){return e.useMedium(t),O9}var L9=Fue(),$S=function(){},rx=C.forwardRef(function(e,t){var n=C.useRef(null),s=C.useState({onScrollCapture:$S,onWheelCapture:$S,onTouchMoveCapture:$S}),r=s[0],a=s[1],l=e.forwardProps,u=e.children,d=e.className,f=e.removeScrollBar,p=e.enabled,m=e.shards,x=e.sideCar,y=e.noRelative,v=e.noIsolation,b=e.inert,w=e.allowPinchZoom,S=e.as,E=S===void 0?"div":S,k=e.gapMode,_=M9(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=x,T=que([n,t]),A=ir(ir({},_),r);return C.createElement(C.Fragment,null,p&&C.createElement(R,{sideCar:L9,removeScrollBar:f,shards:m,noRelative:y,noIsolation:v,inert:b,setCallbacks:a,allowPinchZoom:!!w,lockRef:n,gapMode:k}),l?C.cloneElement(C.Children.only(u),ir(ir({},A),{ref:T})):C.createElement(E,ir({},A,{className:d,ref:T}),u))});rx.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};rx.classNames={fullWidth:om,zeroRight:am};var Uue=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Vue(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Uue();return t&&e.setAttribute("nonce",t),e}function Gue(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Kue(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Wue=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Vue())&&(Gue(t,n),Kue(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Yue=function(){var e=Wue();return function(t,n){C.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},P9=function(){var e=Yue(),t=function(n){var s=n.styles,r=n.dynamic;return e(s,r),null};return t},Que={left:0,top:0,right:0,gap:0},DS=function(e){return parseInt(e||"",10)||0},Xue=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],r=t[e==="padding"?"paddingRight":"marginRight"];return[DS(n),DS(s),DS(r)]},Zue=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Que;var t=Xue(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},Jue=P9(),tc="data-scroll-locked",ede=function(e,t,n,s){var r=e.left,a=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
475
+ .`.concat(Lue,` {
476
+ overflow: hidden `).concat(s,`;
477
+ padding-right: `).concat(u,"px ").concat(s,`;
478
+ }
479
+ body[`).concat(tc,`] {
480
+ overflow: hidden `).concat(s,`;
481
+ overscroll-behavior: contain;
482
+ `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
483
+ padding-left: `.concat(r,`px;
484
+ padding-top: `).concat(a,`px;
485
+ padding-right: `).concat(l,`px;
486
+ margin-left:0;
487
+ margin-top:0;
488
+ margin-right: `).concat(u,"px ").concat(s,`;
489
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
490
+ }
491
+
492
+ .`).concat(am,` {
493
+ right: `).concat(u,"px ").concat(s,`;
494
+ }
495
+
496
+ .`).concat(om,` {
497
+ margin-right: `).concat(u,"px ").concat(s,`;
498
+ }
499
+
500
+ .`).concat(am," .").concat(am,` {
501
+ right: 0 `).concat(s,`;
502
+ }
503
+
504
+ .`).concat(om," .").concat(om,` {
505
+ margin-right: 0 `).concat(s,`;
506
+ }
507
+
508
+ body[`).concat(tc,`] {
509
+ `).concat(Pue,": ").concat(u,`px;
510
+ }
511
+ `)},sP=function(){var e=parseInt(document.body.getAttribute(tc)||"0",10);return isFinite(e)?e:0},tde=function(){C.useEffect(function(){return document.body.setAttribute(tc,(sP()+1).toString()),function(){var e=sP()-1;e<=0?document.body.removeAttribute(tc):document.body.setAttribute(tc,e.toString())}},[])},nde=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,r=s===void 0?"margin":s;tde();var a=C.useMemo(function(){return Zue(r)},[r]);return C.createElement(Jue,{styles:ede(a,!t,r,n?"":"!important")})},n2=!1;if(typeof window<"u")try{var Mp=Object.defineProperty({},"passive",{get:function(){return n2=!0,!0}});window.addEventListener("test",Mp,Mp),window.removeEventListener("test",Mp,Mp)}catch{n2=!1}var Ml=n2?{passive:!1}:!1,sde=function(e){return e.tagName==="TEXTAREA"},$9=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!sde(e)&&n[t]==="visible")},rde=function(e){return $9(e,"overflowY")},ide=function(e){return $9(e,"overflowX")},rP=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var r=D9(e,s);if(r){var a=q9(e,s),l=a[1],u=a[2];if(l>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},ade=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},ode=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},D9=function(e,t){return e==="v"?rde(t):ide(t)},q9=function(e,t){return e==="v"?ade(t):ode(t)},lde=function(e,t){return e==="h"&&t==="rtl"?-1:1},cde=function(e,t,n,s,r){var a=lde(e,window.getComputedStyle(t).direction),l=a*s,u=n.target,d=t.contains(u),f=!1,p=l>0,m=0,x=0;do{if(!u)break;var y=q9(e,u),v=y[0],b=y[1],w=y[2],S=b-w-a*v;(v||S)&&D9(e,u)&&(m+=S,x+=v);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(p&&Math.abs(m)<1||!p&&Math.abs(x)<1)&&(f=!0),f},Op=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},iP=function(e){return[e.deltaX,e.deltaY]},aP=function(e){return e&&"current"in e?e.current:e},ude=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dde=function(e){return`
512
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
513
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
514
+ `)},fde=0,Ol=[];function hde(e){var t=C.useRef([]),n=C.useRef([0,0]),s=C.useRef(),r=C.useState(fde++)[0],a=C.useState(P9)[0],l=C.useRef(e);C.useEffect(function(){l.current=e},[e]),C.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var b=Oue([e.lockRef.current],(e.shards||[]).map(aP),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var u=C.useCallback(function(b,w){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!l.current.allowPinchZoom;var S=Op(b),E=n.current,k="deltaX"in b?b.deltaX:E[0]-S[0],_="deltaY"in b?b.deltaY:E[1]-S[1],R,T=b.target,A=Math.abs(k)>Math.abs(_)?"h":"v";if("touches"in b&&A==="h"&&T.type==="range")return!1;var M=window.getSelection(),L=M&&M.anchorNode,P=L?L===T||L.contains(T):!1;if(P)return!1;var O=rP(A,T);if(!O)return!0;if(O?R=A:(R=A==="v"?"h":"v",O=rP(A,T)),!O)return!1;if(!s.current&&"changedTouches"in b&&(k||_)&&(s.current=R),!R)return!0;var B=s.current||R;return cde(B,w,b,B==="h"?k:_)},[]),d=C.useCallback(function(b){var w=b;if(!(!Ol.length||Ol[Ol.length-1]!==a)){var S="deltaY"in w?iP(w):Op(w),E=t.current.filter(function(R){return R.name===w.type&&(R.target===w.target||w.target===R.shadowParent)&&ude(R.delta,S)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var k=(l.current.shards||[]).map(aP).filter(Boolean).filter(function(R){return R.contains(w.target)}),_=k.length>0?u(w,k[0]):!l.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),f=C.useCallback(function(b,w,S,E){var k={name:b,delta:w,target:S,should:E,shadowParent:pde(S)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(_){return _!==k})},1)},[]),p=C.useCallback(function(b){n.current=Op(b),s.current=void 0},[]),m=C.useCallback(function(b){f(b.type,iP(b),b.target,u(b,e.lockRef.current))},[]),x=C.useCallback(function(b){f(b.type,Op(b),b.target,u(b,e.lockRef.current))},[]);C.useEffect(function(){return Ol.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",d,Ml),document.addEventListener("touchmove",d,Ml),document.addEventListener("touchstart",p,Ml),function(){Ol=Ol.filter(function(b){return b!==a}),document.removeEventListener("wheel",d,Ml),document.removeEventListener("touchmove",d,Ml),document.removeEventListener("touchstart",p,Ml)}},[]);var y=e.removeScrollBar,v=e.inert;return C.createElement(C.Fragment,null,v?C.createElement(a,{styles:dde(r)}):null,y?C.createElement(nde,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pde(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const mde=Hue(L9,hde);var z9=C.forwardRef(function(e,t){return C.createElement(rx,ir({},e,{ref:t,sideCar:mde}))});z9.classNames=rx.classNames;var gde=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ll=new WeakMap,Lp=new WeakMap,Pp={},qS=0,B9=function(e){return e&&(e.host||B9(e.parentNode))},xde=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=B9(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},yde=function(e,t,n,s){var r=xde(t,Array.isArray(e)?e:[e]);Pp[n]||(Pp[n]=new WeakMap);var a=Pp[n],l=[],u=new Set,d=new Set(r),f=function(m){!m||u.has(m)||(u.add(m),f(m.parentNode))};r.forEach(f);var p=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(x){if(u.has(x))p(x);else try{var y=x.getAttribute(s),v=y!==null&&y!=="false",b=(Ll.get(x)||0)+1,w=(a.get(x)||0)+1;Ll.set(x,b),a.set(x,w),l.push(x),b===1&&v&&Lp.set(x,!0),w===1&&x.setAttribute(n,"true"),v||x.setAttribute(s,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return p(t),u.clear(),qS++,function(){l.forEach(function(m){var x=Ll.get(m)-1,y=a.get(m)-1;Ll.set(m,x),a.set(m,y),x||(Lp.has(m)||m.removeAttribute(s),Lp.delete(m)),y||m.removeAttribute(n)}),qS--,qS||(Ll=new WeakMap,Ll=new WeakMap,Lp=new WeakMap,Pp={})}},vde=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=gde(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),yde(s,r,n,"aria-hidden")):function(){return null}};function bde(e){const t=wde(e),n=C.forwardRef((s,r)=>{const{children:a,...l}=s,u=C.Children.toArray(a),d=u.find(Sde);if(d){const f=d.props.children,p=u.map(m=>m===d?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:m);return i.jsx(t,{...l,ref:r,children:C.isValidElement(f)?C.cloneElement(f,void 0,p):null})}return i.jsx(t,{...l,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function wde(e){const t=C.forwardRef((n,s)=>{const{children:r,...a}=n;if(C.isValidElement(r)){const l=kde(r),u=Nde(a,r.props);return r.type!==C.Fragment&&(u.ref=s?ug(s,l):l),C.cloneElement(r,u)}return C.Children.count(r)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jde=Symbol("radix.slottable");function Sde(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jde}function Nde(e,t){const n={...t};for(const s in t){const r=e[s],a=t[s];/^on[A-Z]/.test(s)?r&&a?n[s]=(...u)=>{const d=a(...u);return r(...u),d}:r&&(n[s]=r):s==="style"?n[s]={...r,...a}:s==="className"&&(n[s]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function kde(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ix="Dialog",[F9]=Zce(ix),[_de,Gs]=F9(ix),H9=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:r,onOpenChange:a,modal:l=!0}=e,u=C.useRef(null),d=C.useRef(null),[f,p]=sue({prop:s,defaultProp:r??!1,onChange:a,caller:ix});return i.jsx(_de,{scope:t,triggerRef:u,contentRef:d,contentId:IS(),titleId:IS(),descriptionId:IS(),open:f,onOpenChange:p,onOpenToggle:C.useCallback(()=>p(m=>!m),[p]),modal:l,children:n})};H9.displayName=ix;var U9="DialogTrigger",Cde=C.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Gs(U9,n),a=Io(t,r.triggerRef);return i.jsx(ri.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":__(r.open),...s,ref:a,onClick:da(e.onClick,r.onOpenToggle)})});Cde.displayName=U9;var N_="DialogPortal",[Ede,V9]=F9(N_,{forceMount:void 0}),G9=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:r}=e,a=Gs(N_,t);return i.jsx(Ede,{scope:t,forceMount:n,children:C.Children.map(s,l=>i.jsx(sx,{present:n||a.open,children:i.jsx(I9,{asChild:!0,container:r,children:l})}))})};G9.displayName=N_;var qm="DialogOverlay",K9=C.forwardRef((e,t)=>{const n=V9(qm,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,a=Gs(qm,e.__scopeDialog);return a.modal?i.jsx(sx,{present:s||a.open,children:i.jsx(Ade,{...r,ref:t})}):null});K9.displayName=qm;var Rde=bde("DialogOverlay.RemoveScroll"),Ade=C.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Gs(qm,n);return i.jsx(z9,{as:Rde,allowPinchZoom:!0,shards:[r.contentRef],children:i.jsx(ri.div,{"data-state":__(r.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Eo="DialogContent",W9=C.forwardRef((e,t)=>{const n=V9(Eo,e.__scopeDialog),{forceMount:s=n.forceMount,...r}=e,a=Gs(Eo,e.__scopeDialog);return i.jsx(sx,{present:s||a.open,children:a.modal?i.jsx(Tde,{...r,ref:t}):i.jsx(Ide,{...r,ref:t})})});W9.displayName=Eo;var Tde=C.forwardRef((e,t)=>{const n=Gs(Eo,e.__scopeDialog),s=C.useRef(null),r=Io(t,n.contentRef,s);return C.useEffect(()=>{const a=s.current;if(a)return vde(a)},[]),i.jsx(Y9,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:da(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:da(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&a.preventDefault()}),onFocusOutside:da(e.onFocusOutside,a=>a.preventDefault())})}),Ide=C.forwardRef((e,t)=>{const n=Gs(Eo,e.__scopeDialog),s=C.useRef(!1),r=C.useRef(!1);return i.jsx(Y9,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),a.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:a=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const l=a.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&r.current&&a.preventDefault()}})}),Y9=C.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:a,...l}=e,u=Gs(Eo,n),d=C.useRef(null),f=Io(t,d);return Mue(),i.jsxs(i.Fragment,{children:[i.jsx(A9,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:a,children:i.jsx(E9,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":__(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(Mde,{titleId:u.titleId}),i.jsx(Lde,{contentRef:d,descriptionId:u.descriptionId})]})]})}),k_="DialogTitle",Q9=C.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Gs(k_,n);return i.jsx(ri.h2,{id:r.titleId,...s,ref:t})});Q9.displayName=k_;var X9="DialogDescription",Z9=C.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Gs(X9,n);return i.jsx(ri.p,{id:r.descriptionId,...s,ref:t})});Z9.displayName=X9;var J9="DialogClose",ez=C.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,r=Gs(J9,n);return i.jsx(ri.button,{type:"button",...s,ref:t,onClick:da(e.onClick,()=>r.onOpenChange(!1))})});ez.displayName=J9;function __(e){return e?"open":"closed"}var tz="DialogTitleWarning",[sve,nz]=Xce(tz,{contentName:Eo,titleName:k_,docsSlug:"dialog"}),Mde=({titleId:e})=>{const t=nz(tz),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
515
+
516
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
517
+
518
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return C.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ode="DialogDescriptionWarning",Lde=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nz(Ode).contentName}}.`;return C.useEffect(()=>{var a;const r=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Pde=H9,$de=G9,sz=K9,rz=W9,iz=Q9,az=Z9,Dde=ez;const oz=Pde,qde=$de,lz=C.forwardRef(({className:e,...t},n)=>i.jsx(sz,{ref:n,className:he("fixed inset-0 z-50 bg-black/20 backdrop-blur-[8px]",e),...t}));lz.displayName=sz.displayName;const C_=C.forwardRef(({className:e,children:t,hideCloseButton:n,...s},r)=>i.jsxs(qde,{children:[i.jsx(lz,{}),i.jsxs(rz,{ref:r,className:he("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 vellum-heavy p-6 shadow-[0_20px_40px_rgba(46,52,46,0.06)] border border-stone-300",e),...s,children:[t,!n&&i.jsxs(Dde,{className:"absolute right-4 top-4 opacity-70 transition-opacity duration-150 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background disabled:pointer-events-none",children:[i.jsx(q2,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));C_.displayName=rz.displayName;const E_=({className:e,...t})=>i.jsx("div",{className:he("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});E_.displayName="DialogHeader";const R_=({className:e,...t})=>i.jsx("div",{className:he("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});R_.displayName="DialogFooter";const A_=C.forwardRef(({className:e,...t},n)=>i.jsx(iz,{ref:n,className:he("text-lg font-semibold leading-none tracking-tight",e),...t}));A_.displayName=iz.displayName;const T_=C.forwardRef(({className:e,...t},n)=>i.jsx(az,{ref:n,className:he("text-sm text-foreground-muted",e),...t}));T_.displayName=az.displayName;function zde(e){return qe({queryKey:["packages",e],queryFn:async()=>{const t=await fetch(`/api/packages/${e}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function Bde(e){return qe({queryKey:["packages",e,"installs"],queryFn:async()=>{const t=await fetch(`/api/packages/${e}/installs`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function Fde(e){return qe({queryKey:["installs",e,"journal"],queryFn:async()=>{const t=await fetch(`/api/packages/installs/${e}/journal`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function Hde(e){const t=Mt();return en({mutationFn:async n=>{const s=await fetch(`/api/packages/${n}/rollback`,{method:"POST"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["packages",e,"installs"]}),t.invalidateQueries({queryKey:["installs"]})}})}function Ude(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted"}}function Vde(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return e.toUpperCase()}}function Gde({installId:e}){const{data:t,isPending:n,isError:s}=Fde(e);return n?i.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"Loading journal..."}):s?i.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-destructive","data-testid":"journal-error",children:"Failed to load journal entries"}):!t||t.length===0?i.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"No journal entries"}):i.jsx("div",{className:"pl-spacing-6 py-spacing-2 space-y-spacing-1","data-testid":"journal-entries",children:t.map(r=>i.jsxs("div",{"data-testid":"journal-entry",className:"flex items-center gap-spacing-3 text-label-sm font-mono py-spacing-1 border-b border-foreground/6 last:border-0",children:[i.jsx("span",{className:"text-foreground-muted w-6 text-right",children:r.seq}),i.jsx("span",{className:"uppercase",children:r.action}),i.jsx("span",{className:"text-foreground-muted",children:r.exportType}),i.jsx("span",{className:"text-foreground-muted truncate max-w-[200px]",children:r.targetPath}),i.jsx("span",{className:"text-foreground-muted ml-auto",children:r.status})]},r.id))})}function Kde({install:e,onRollback:t}){const[n,s]=C.useState(!1);return i.jsxs("div",{"data-testid":"install-row",className:"card-dark p-spacing-4 mb-spacing-2",children:[i.jsxs("div",{className:"flex items-center gap-spacing-4",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-spacing-3 mb-spacing-1",children:[i.jsx("span",{className:"font-mono text-label-sm text-foreground-muted",children:e.createdAt}),i.jsx("span",{"data-testid":"install-status-badge",className:he("inline-block px-spacing-2 py-px text-label-sm uppercase",Ude(e.status)),children:Vde(e.status)})]}),i.jsx("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:e.targetRoot}),i.jsxs("div",{className:"flex items-center gap-spacing-3 mt-spacing-1 text-label-sm",children:[i.jsxs("span",{"data-testid":"applied-count",children:[i.jsx("span",{className:"font-mono",children:e.appliedCount})," applied"]}),i.jsx("span",{"data-testid":"deferred-placeholder",className:"text-foreground-muted",children:"— deferred"})]})]}),i.jsxs("div",{className:"flex items-center gap-spacing-2 shrink-0",children:[i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"expand-btn",onClick:()=>s(!n),children:n?"COLLAPSE":"EXPAND"}),e.status==="applied"&&i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"rollback-btn",onClick:()=>t(e.id),children:"ROLLBACK"})]})]}),n&&i.jsx(Gde,{installId:e.id})]})}function Wde(){var b;const{packageId:e}=dn({strict:!1}),{data:t,isPending:n,error:s}=zde(e),{data:r,isPending:a,error:l}=Bde(e),u=Hde(e),[d,f]=C.useState(null),[p,m]=C.useState(!1),x=w=>{f(w),m(!0)},y=()=>{d&&u.mutate(d,{onSuccess:()=>{m(!1),f(null)}})};if(n||a)return i.jsx(at,{children:i.jsxs("div",{"data-testid":"detail-loading",children:[i.jsx("div",{className:"h-8 w-48 shimmer mb-spacing-4"}),i.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-4",children:[i.jsx("div",{className:"h-6 w-64 shimmer-dark mb-spacing-3"}),i.jsx("div",{className:"h-4 w-full shimmer-dark"})]})]})});if(s)return i.jsx(at,{children:i.jsx("div",{"data-testid":"detail-error",children:i.jsx("p",{className:"text-destructive",children:s.message})})});if(l)return i.jsx(at,{children:i.jsx("div",{"data-testid":"installs-error",children:i.jsx("p",{className:"text-destructive",children:"Failed to load install history"})})});const v=r??[];return i.jsx(at,{children:i.jsxs("div",{children:[t&&i.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-6","data-testid":"package-header",children:[i.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[i.jsxs("h2",{className:"text-headline-lg uppercase",children:[t.name," (Legacy)"]}),i.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",t.version]})]}),i.jsxs("div",{className:"text-label-sm text-foreground-muted-on-dark mb-spacing-2",children:["SOURCE"," ",i.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"package-source",children:t.sourceRef})]}),t.summary&&i.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark",children:t.summary})]}),i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-4",children:"INSTALL HISTORY"}),v.length===0?i.jsx("div",{"data-testid":"empty-installs",className:"text-body-md text-foreground-muted",children:"No installs yet"}):i.jsx("div",{"data-testid":"install-list",children:v.map(w=>i.jsx(Kde,{install:w,onRollback:x},w.id))}),i.jsx(oz,{open:p,onOpenChange:w=>{u.isPending||(m(w),w||u.reset())},children:i.jsxs(C_,{"data-testid":"rollback-dialog",onPointerDownOutside:w=>{u.isPending&&w.preventDefault()},onEscapeKeyDown:w=>{u.isPending&&w.preventDefault()},hideCloseButton:u.isPending,children:[i.jsxs(E_,{children:[i.jsx(A_,{className:"text-headline-md uppercase",children:"CONFIRM ROLLBACK"}),i.jsx(T_,{children:"This will roll back the install and restore previous file states. This action cannot be undone."})]}),u.isError&&i.jsxs("p",{className:"text-destructive text-label-sm","data-testid":"rollback-error",children:["Rollback failed: ",((b=u.error)==null?void 0:b.message)??"Unknown error"]}),i.jsxs(R_,{children:[i.jsx(_e,{variant:"ghost",onClick:()=>{u.reset(),m(!1)},"data-testid":"rollback-cancel",disabled:u.isPending,children:"CANCEL"}),i.jsx(_e,{variant:"destructive",onClick:y,"data-testid":"rollback-confirm",disabled:u.isPending,children:u.isPending?"ROLLING BACK...":"ROLLBACK"})]})]})})]})})}function Yde(e){switch(e){case"installed":return"bg-success";case"missing":return"bg-destructive";case"unsupported":return"bg-warning";case"unknown":return"bg-warning";default:return"bg-foreground-muted"}}function Qde(e){switch(e){case"installed":return"OK";case"missing":return"MISSING";case"unsupported":return"MANUAL";case"unknown":return"UNKNOWN";default:return e.toUpperCase()}}function Xde({results:e}){return e.length===0?i.jsx("div",{className:"text-body-sm text-foreground-muted","data-testid":"no-requirements",children:"No requirements declared."}):i.jsx("div",{className:"space-y-spacing-1","data-testid":"requirements-panel",children:e.map(t=>i.jsxs("div",{"data-testid":"requirement-row",className:"flex items-center gap-spacing-3 py-spacing-1 text-label-sm font-mono",children:[i.jsx("span",{"data-testid":"requirement-dot",className:he("w-2 h-2 shrink-0",Yde(t.status))}),i.jsx("span",{"data-testid":"requirement-status",className:"w-16 uppercase",children:Qde(t.status)}),i.jsx("span",{className:"text-foreground-muted w-24",children:t.kind}),i.jsx("span",{children:t.name}),t.detectedPath&&i.jsx("span",{className:"text-foreground-muted ml-auto truncate max-w-[200px]",children:t.detectedPath})]},`${t.kind}:${t.name}`))})}function cz(e,t){var s,r;const n=((s=e.stages)==null?void 0:s.flatMap(a=>{const l=a.detail;if(!l)return[];const u=[];return Array.isArray(l.errors)&&u.push(...l.errors.filter(d=>typeof d=="string")),typeof l.error=="string"&&u.push(l.error),u}))??[];return((r=e.errors)==null?void 0:r.find(a=>typeof a=="string"))??n[0]??e.error??`HTTP ${t}`}function Zde(){return en({mutationFn:async({sourceRef:e})=>{const t=await fetch("/api/bootstrap/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:e})});if(!t.ok){const n=await t.json().catch(()=>({})),s=new Error(cz(n,t.status));throw s.data=n,s}return t.json()}})}function Jde(){const e=Mt();return en({mutationFn:async({sourceRef:t,autoApprove:n,approvedActionKeys:s})=>{const r=await fetch("/api/bootstrap/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,autoApprove:n,approvedActionKeys:s})}),a=await r.json();if(!r.ok){const l=new Error(cz(a,r.status));throw l.data=a,l}return a},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}const efe=["ENTER","PLAN","REVIEW","APPLY"],tfe=efe.map((e,t)=>({num:t+1,label:e}));function nfe(e){switch(e){case"enter":return 1;case"planning":return 2;case"planned":return 3;case"applying":return 4;case"done":case"error":return 4;default:return 1}}function sfe(){const e=It(),{bootstrapSourceRef:t,setBootstrapSourceRef:n}=lf(),[s,r]=C.useState("enter"),[a,l]=C.useState(()=>t),[u,d]=C.useState(null),[f,p]=C.useState(new Set),[m,x]=C.useState(!1),[y,v]=C.useState(null),b=Zde(),w=Jde();C.useEffect(()=>{n(a)},[n,a]);const S=async()=>{if(a.trim()){r("planning");try{const H=await b.mutateAsync({sourceRef:a.trim()});d(H),p(new Set(H.actionKeys??[])),r("planned")}catch(H){v(H.message),r("error")}}},E=async()=>{r("applying");try{const H=await w.mutateAsync({sourceRef:a.trim(),autoApprove:m,approvedActionKeys:m?void 0:[...f]});d(H),r("done")}catch(H){v(H.message),r("error")}},k=()=>{r("enter"),l(""),d(null),p(new Set),x(!1),v(null),b.reset(),w.reset()},_=u==null?void 0:u.stages.find(H=>H.stage==="probe_requirements"),R=_==null?void 0:_.detail,T=(R==null?void 0:R.results)??[],A=u==null?void 0:u.stages.find(H=>H.stage==="build_install_plan"),M=A==null?void 0:A.detail,L=(M==null?void 0:M.actions)??[],P=(A==null?void 0:A.status)==="blocked",B=L.some(H=>H.classification!=="manual_only"&&H.commandPreview)&&f.size===0&&!m;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"bootstrap-wizard",className:"space-y-8",children:[i.jsx(wn,{eyebrow:"Bootstrap",title:"Bootstrap",description:"Plan environment requirements, approve install actions, then import the rig into a running topology."}),i.jsx(k9,{"data-testid":"step-indicator",steps:tfe,currentStep:nfe(s)}),s==="enter"&&i.jsx(bs,{title:"Source",description:"Provide a rig spec or bundle path. Bootstrap will inspect requirements before it imports anything.",children:i.jsxs("div",{"data-testid":"step-enter",children:[i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"SPEC OR BUNDLE PATH"}),i.jsx(v_,{"data-testid":"spec-input",type:"text",value:a,onChange:H=>l(H.target.value),placeholder:"/path/to/rig.yaml or /path/to/bundle.rigbundle",className:"font-mono text-body-md"}),i.jsxs("p",{className:"text-label-sm text-foreground-muted mt-spacing-1",children:["Accepts .yaml rig specs or .rigbundle archives."," ",i.jsx("span",{role:"link",tabIndex:0,className:"text-primary cursor-pointer","data-testid":"inspect-link",onClick:()=>e({to:"/bundles/inspect"}),onKeyDown:H=>{H.key==="Enter"&&e({to:"/bundles/inspect"})},children:"Inspect a bundle first →"})]}),i.jsx("div",{className:"mt-spacing-4",children:i.jsx(_e,{variant:"tactical",onClick:S,disabled:!a.trim(),"data-testid":"plan-btn",children:"PLAN"})})]})}),s==="planning"&&i.jsx("div",{"data-testid":"step-planning",className:"text-body-md text-foreground-muted",children:"Planning..."}),s==="planned"&&u&&i.jsx(bs,{title:"Plan Review",description:"Review requirement probe results and approve the install actions that bootstrap should execute.",children:i.jsxs("div",{"data-testid":"step-planned",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"STAGES"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-6","data-testid":"stage-list",children:u.stages.map(H=>i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"stage-row",children:[i.jsx("span",{className:H.status==="ok"?"text-success":H.status==="blocked"?"text-warning":"text-foreground-muted",children:H.status.toUpperCase()}),i.jsx("span",{children:H.stage})]},H.stage))}),T.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"REQUIREMENTS"}),i.jsx("div",{className:"mb-spacing-6",children:i.jsx(Xde,{results:T})})]}),L.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"ACTIONS"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:L.map(H=>i.jsxs("label",{className:"flex items-center gap-spacing-3 text-label-sm font-mono cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:m||f.has(H.key),disabled:m||H.classification==="manual_only",onChange:z=>{const W=new Set(f);z.target.checked?W.add(H.key):W.delete(H.key),p(W)}}),i.jsx("span",{className:H.classification==="manual_only"?"text-warning":"",children:H.requirementName}),H.commandPreview&&i.jsx("span",{className:"text-foreground-muted",children:H.commandPreview})]},H.key))}),i.jsxs("label",{className:"flex items-center gap-spacing-2 text-label-sm mb-spacing-4",children:[i.jsx("input",{type:"checkbox",checked:m,onChange:H=>x(H.target.checked)}),"Auto-approve all trusted actions"]})]}),P&&i.jsx("div",{className:"text-warning text-label-sm mb-spacing-4","data-testid":"blocked-warning",children:"Manual requirements must be resolved before bootstrap can proceed."}),u.warnings.length>0&&i.jsx("div",{className:"mb-spacing-4",children:u.warnings.map((H,z)=>i.jsx("div",{className:"text-warning text-label-sm",children:H},z))}),i.jsx(_e,{variant:"tactical",onClick:E,disabled:P||B,title:P?"Manual requirements must be resolved":B?"Select actions to approve":void 0,"data-testid":"apply-btn",children:"APPLY"})]})}),s==="applying"&&u&&i.jsx(bs,{title:"Applying",description:"Bootstrap is executing the approved actions and importing the rig.",children:i.jsxs("div",{"data-testid":"step-applying",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"APPLYING"}),i.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"applying-checklist",children:[u.stages.map(H=>i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:H.stage})]},H.stage)),i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:"execute_external_installs"})]}),i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:"install_packages"})]}),i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[i.jsx("span",{className:"text-foreground-muted",children:"○"}),i.jsx("span",{children:"import_rig"})]})]}),i.jsx("p",{className:"text-body-sm text-foreground-muted",children:"Bootstrapping..."})]})}),s==="done"&&u&&i.jsx(bs,{title:"Result",description:"Bootstrap finished and returned the managed rig identity.",children:i.jsxs("div",{"data-testid":"step-done",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:u.status==="completed"?"BOOTSTRAP COMPLETE":"BOOTSTRAP PARTIAL"}),i.jsxs("div",{className:"text-label-sm font-mono space-y-spacing-1 mb-spacing-4",children:[i.jsxs("div",{children:["Status: ",i.jsx("span",{className:u.status==="completed"?"text-success":"text-warning",children:u.status.toUpperCase()})]}),u.rigId&&i.jsxs("div",{"data-testid":"result-rig-id",children:["Rig: ",u.rigId]})]}),u.rigId&&i.jsx(_e,{variant:"tactical","data-testid":"view-rig-btn",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:u.rigId}}),children:"VIEW RIG"})]})}),s==="error"&&i.jsx(bs,{title:"Bootstrap Error",description:"Bootstrap could not complete. Fix the issue and retry the plan.",children:i.jsxs("div",{"data-testid":"step-error",children:[i.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:y}),i.jsx(_e,{variant:"tactical",onClick:k,"data-testid":"try-again-btn",children:"TRY AGAIN"})]})})]})})}function rfe(){const{currentAgentDraft:e,selectedAgentDraft:t,saveAgentDraft:n,rememberAgentDraft:s,clearSelectedAgentDraft:r}=lf(),[a,l]=C.useState(()=>(t==null?void 0:t.yaml)??(e==null?void 0:e.yaml)??""),[u,d]=C.useState("idle"),[f,p]=C.useState([]);C.useEffect(()=>{n(a)},[n,a]),C.useEffect(()=>{t&&(l(t.yaml),r())},[r,t]);const m=async()=>{s(a),d("pending"),p([]);try{const x=await fetch("/api/agents/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:a}),y=await x.json().catch(()=>({}));if(x.ok&&y.valid){d("valid");return}p(y.errors??["Validation failed"]),d("invalid")}catch{p(["Validation request failed"]),d("error")}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"agent-spec-validate-flow",className:"space-y-8",children:[i.jsx(wn,{eyebrow:"Agent Spec Validation",title:"VALIDATE AGENT",description:"Check an AgentSpec before you use it in a rig."}),i.jsxs(bs,{title:"Agent YAML",description:"Paste or refine an AgentSpec draft, then validate it against the daemon contract.",children:[i.jsx(b_,{"data-testid":"agent-spec-yaml-input",value:a,onChange:x=>l(x.target.value),placeholder:"Paste agent.yaml here...",rows:16,className:"bg-background font-mono text-body-sm"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:i.jsx(_e,{variant:"tactical","data-testid":"agent-spec-validate-btn",onClick:m,disabled:!a.trim()||u==="pending",children:u==="pending"?"VALIDATING...":"VALIDATE AGENTSPEC"})}),u==="valid"&&i.jsx(vn,{className:"mt-spacing-1","data-testid":"agent-spec-valid",children:i.jsx(cn,{className:"text-primary",children:"AgentSpec valid."})}),(u==="invalid"||u==="error")&&i.jsx(vn,{className:"mt-spacing-1","data-testid":"agent-spec-invalid",children:i.jsx(cn,{children:i.jsx("ul",{className:"list-disc pl-5",children:f.map(x=>i.jsx("li",{children:x},x))})})})]})]})})}async function ife(e,t="draft"){var s;const n=await fetch("/api/specs/review/rig",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(((s=r.errors)==null?void 0:s.join("; "))??`HTTP ${n.status}`)}return n.json()}async function afe(e,t="draft"){var s;const n=await fetch("/api/specs/review/agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(((s=r.errors)==null?void 0:s.join("; "))??`HTTP ${n.status}`)}return n.json()}function uz(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function ofe(e,t="draft"){return qe({queryKey:["spec-review","rig",e?uz(e):null,t],queryFn:()=>ife(e,t),enabled:!!e})}function lfe(e,t="draft"){return qe({queryKey:["spec-review","agent",e?uz(e):null,t],queryFn:()=>afe(e,t),enabled:!!e})}const cfe=160,ufe=48,oP=200,dfe=100;function ffe(e){switch(e){case"claude-code":return"#d4c4a8";case"codex":return"#b8c9d4";case"terminal":return"#c4c4c4";default:return"#e0ddd4"}}function hfe(e){const t=new Map,n=[];for(const a of e)a.pod?(t.has(a.pod)||t.set(a.pod,[]),t.get(a.pod).push(a)):n.push(a);const s=[];let r=0;for(const[,a]of t)a.forEach((l,u)=>{s.push({id:l.id,x:u*oP,y:r})}),r+=dfe;return n.forEach((a,l)=>{s.push({id:a.id,x:l*oP,y:r})}),s}function pfe({graph:e,testId:t}){const n=e??{nodes:[],edges:[]},{nodes:s,edges:r}=C.useMemo(()=>{const a=hfe(n.nodes),l=new Map(a.map(f=>[f.id,f])),u=n.nodes.map(f=>{const p=l.get(f.id)??{x:0,y:0};return{id:f.id,type:"default",position:{x:p.x,y:p.y},data:{label:i.jsxs("div",{className:"flex h-full min-w-0 flex-col justify-center gap-1 font-mono leading-tight",children:[i.jsxs("div",{className:"truncate text-[10px] font-bold text-stone-900",children:[f.pod?`${f.pod} / `:"",f.label]}),i.jsx(Gn,{runtime:f.runtime,size:"xs",compact:!0,variant:"inline"})]})},style:{backgroundColor:ffe(f.runtime),border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:cfe,height:ufe}}}),d=n.edges.map((f,p)=>({id:`e-${p}`,source:f.source,target:f.target,label:f.kind,labelStyle:{fontSize:9,fontFamily:"monospace"},style:{strokeDasharray:"4 4",stroke:"#8a8577"}}));return{nodes:u,edges:d}},[n]);return i.jsx("div",{"data-testid":t??"spec-topology-preview",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:i.jsxs(xf,{nodes:s,edges:r,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[i.jsx(Kk,{gap:20,size:.5,color:"#d4d0c8"}),i.jsx(yf,{showInteractive:!1})]})})}function mfe({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:a}=Ng();return i.jsx("button",{type:"button","data-testid":r??"sub-spec-trigger",onClick:()=>a({type:"sub-spec",data:e}),className:n??"text-left",style:s,children:t})}function gfe(e){const n=(e.startsWith("local:")?e.slice(6):e).replace(/^(builtin|user|fork):/,""),s=n.startsWith("agents/")?n.slice(7):n,r=s.split("@")[0]??s,a=e.startsWith("fork:")?"fork":e.startsWith("builtin:")?"builtin":"user_file";return{specName:r,source:a}}function I_({review:e,yaml:t,testIdPrefix:n="",yamlTestId:s,showEnvironmentTab:r,onMemberClick:a}){var v,b,w;const l=r&&!!(e!=null&&e.services),u=l?["topology","configuration","environment","yaml"]:["topology","configuration","yaml"],[d,f]=C.useState("topology"),p=(e==null?void 0:e.pods)??[],m=(e==null?void 0:e.nodes)??[],x=(e==null?void 0:e.edges)??[],y=n?`${n}-`:"";return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex gap-1 border-b border-stone-200",children:u.map(S=>i.jsx("button",{"data-testid":`${y}tab-${S}`,onClick:()=>f(S),className:`px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider transition-colors ${d===S?"border-b-2 border-stone-900 text-stone-900 font-bold":"text-stone-500 hover:text-stone-700"}`,children:S},S))}),d==="topology"&&e&&i.jsx(pfe,{graph:e.graph,testId:`${y}topology-preview`}),d==="configuration"&&e&&i.jsxs("div",{"data-testid":`${y}config-tables`,className:"space-y-4",children:[e.format==="pod_aware"&&p.map(S=>i.jsxs("div",{className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:S.label??S.id}),i.jsxs("table",{className:"w-full font-mono text-[10px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[i.jsx("th",{className:"text-left py-1",children:"Member"}),i.jsx("th",{className:"text-left py-1",children:"Agent Ref"}),i.jsx("th",{className:"text-left py-1",children:"Runtime"}),i.jsx("th",{className:"text-left py-1",children:"Profile"})]})}),i.jsx("tbody",{children:S.members.map(E=>i.jsxs("tr",{className:"border-b border-stone-100",children:[i.jsx("td",{className:"py-1",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:E.id}),a&&i.jsx(_e,{variant:"outline",size:"sm","data-testid":`${y}member-open-agent-${S.id}-${E.id}`,className:"h-6 px-2 font-mono text-[9px] uppercase tracking-[0.12em]",onClick:()=>a(S.id,E),children:"Agent Spec"})]})}),i.jsx("td",{className:"py-1 text-stone-600",children:(()=>{const k=gfe(E.agentRef);return i.jsx(mfe,{data:{specKind:"agent",specName:k.specName,source:k.source},testId:`${y}member-sub-spec-${S.id}-${E.id}`,className:"text-stone-600 underline decoration-dotted decoration-stone-400 hover:text-stone-900 hover:decoration-stone-700",children:E.agentRef})})()}),i.jsx("td",{className:"py-1",children:i.jsx(Gn,{runtime:E.runtime,size:"xs",compact:!0,variant:"inline"})}),i.jsx("td",{className:"py-1 text-stone-500",children:E.profile??"—"})]},E.id))})]})]},S.id)),e.format==="legacy"&&m.length>0&&i.jsxs("div",{className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Nodes"}),i.jsxs("table",{className:"w-full font-mono text-[10px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[i.jsx("th",{className:"text-left py-1",children:"ID"}),i.jsx("th",{className:"text-left py-1",children:"Runtime"}),i.jsx("th",{className:"text-left py-1",children:"Role"})]})}),i.jsx("tbody",{children:m.map(S=>i.jsxs("tr",{className:"border-b border-stone-100",children:[i.jsx("td",{className:"py-1",children:S.id}),i.jsx("td",{className:"py-1",children:i.jsx(Gn,{runtime:S.runtime,size:"xs",compact:!0,variant:"inline"})}),i.jsx("td",{className:"py-1 text-stone-500",children:S.role??"—"})]},S.id))})]})]}),x.length>0&&i.jsxs("div",{className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:e.format==="pod_aware"?"Cross-Pod Edges":"Edges"}),i.jsxs("table",{className:"w-full font-mono text-[10px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[i.jsx("th",{className:"text-left py-1",children:"From"}),i.jsx("th",{className:"text-left py-1",children:"To"}),i.jsx("th",{className:"text-left py-1",children:"Kind"})]})}),i.jsx("tbody",{children:x.map((S,E)=>i.jsxs("tr",{className:"border-b border-stone-100",children:[i.jsx("td",{className:"py-1",children:S.from}),i.jsx("td",{className:"py-1",children:S.to}),i.jsx("td",{className:"py-1 text-stone-500",children:S.kind})]},E))})]})]})]}),d==="environment"&&l&&(e==null?void 0:e.services)&&i.jsxs("div",{className:"space-y-4","data-testid":`${y}env-details`,children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Services"}),(v=e.services.composePreview)==null?void 0:v.services.map(S=>i.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[i.jsx("span",{className:"font-mono text-[11px] text-stone-800",children:S.name}),S.image&&i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:S.image})]},S.name))]}),e.services.waitFor.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Health Gates"}),e.services.waitFor.map((S,E)=>i.jsxs("div",{className:"font-mono text-[10px] text-stone-600 border border-stone-200 px-3 py-2",children:[S.url&&i.jsx("span",{children:S.url}),S.tcp&&i.jsxs("span",{children:["tcp: ",S.tcp]}),S.service&&i.jsxs("span",{children:["service: ",S.service,S.condition?` (${S.condition})`:""]})]},E))]}),e.services.surfaces&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Surfaces"}),(b=e.services.surfaces.urls)==null?void 0:b.map(S=>i.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[i.jsx("span",{className:"text-[11px] text-stone-800",children:S.name}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:S.url})]},S.name)),(w=e.services.surfaces.commands)==null?void 0:w.map(S=>i.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[i.jsx("span",{className:"text-[11px] text-stone-800",children:S.name}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:S.command})]},S.name))]})]}),d==="yaml"&&i.jsx(_9,{title:"YAML Preview",testId:s??`${y}spec-yaml`,children:t})]})}function xfe(){const e=It(),{selectedRigDraft:t,currentRigDraft:n}=lf(),s=t??n,{data:r,isLoading:a,error:l}=ofe((s==null?void 0:s.yaml)??null),u=(r==null?void 0:r.pods)??[],d=(r==null?void 0:r.nodes)??[],f=(r==null?void 0:r.edges)??[];return s?i.jsx(at,{children:i.jsxs("div",{"data-testid":"rig-spec-review",className:"space-y-6",children:[i.jsx(wn,{eyebrow:"Rig Spec Review",title:(r==null?void 0:r.name)??s.label,description:(r==null?void 0:r.summary)??"Review the spec structure before import or bootstrap.",actions:i.jsxs(i.Fragment,{children:[i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open In Import"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/bootstrap"}),children:"Bootstrap"})]})}),r&&i.jsxs(Do,{children:[i.jsx(st,{label:"Format",value:r.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"rig-spec-summary-format"}),i.jsx(st,{label:r.format==="pod_aware"?"Pods":"Nodes",value:r.format==="pod_aware"?u.length:d.length,testId:"rig-spec-summary-pods"}),i.jsx(st,{label:"Members",value:r.format==="pod_aware"?u.reduce((p,m)=>p+m.members.length,0):d.length,testId:"rig-spec-summary-members"}),i.jsx(st,{label:"Edges",value:f.length+(r.format==="pod_aware"?u.reduce((p,m)=>{var x;return p+(((x=m.edges)==null?void 0:x.length)??0)},0):0),testId:"rig-spec-summary-edges"})]}),a&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),l&&i.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:l.message}),i.jsx(I_,{review:r,yaml:s.yaml,yamlTestId:"rig-spec-yaml"})]})}):i.jsx(at,{children:i.jsxs("div",{"data-testid":"rig-spec-review-empty",className:"space-y-5",children:[i.jsx(wn,{eyebrow:"Rig Spec Review",title:"No RigSpec Selected",description:"Choose a current or recent rig draft from the Library drawer to review it here before you import or bootstrap it."}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open Import"})]})})}function _f({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:a}=Ng();return i.jsx("button",{type:"button","data-testid":r??"file-reference-trigger",onClick:()=>a({type:"file",data:e}),className:n??"text-left",style:s,children:t})}function yfe(e,t){if(!e||!t)return null;if(t.startsWith("/"))return t;const s=`${e.replace(/\/[^/]*$/,"")}/${t}`.split("/"),r=[];for(const a of s)if(!(!a||a===".")){if(a===".."){r.pop();continue}r.push(a)}return`/${r.join("/")}`}function lP({label:e,sourcePath:t,testId:n,children:s}){const r=yfe(t,e);return r?i.jsx(_f,{data:{path:e,absolutePath:r},testId:n,className:"inline-block text-left",children:s}):i.jsx(i.Fragment,{children:s})}function M_({review:e,yaml:t,testIdPrefix:n="agent",sourcePath:s}){const r=(e==null?void 0:e.profiles)??[],a=(e==null?void 0:e.resources)??{skills:[],guidance:[],plugins:[]},l=(e==null?void 0:e.startup)??{files:[],actions:[]};return i.jsxs(i.Fragment,{children:[r.length>0&&i.jsxs("div",{"data-testid":`${n}-profiles-section`,className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Profiles"}),i.jsx("div",{className:"space-y-1",children:r.map(u=>i.jsxs("div",{className:"font-mono text-[10px] flex justify-between",children:[i.jsx("span",{className:"font-bold",children:u.name}),u.description&&i.jsx("span",{className:"text-stone-500",children:u.description})]},u.name))})]}),i.jsxs("div",{"data-testid":`${n}-resources-section`,className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Resources"}),i.jsxs("div",{className:"space-y-2 font-mono text-[10px]",children:[a.skills.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"text-stone-500",children:"Skills:"})," ",a.skills.map((u,d)=>i.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5",children:[i.jsx($e,{tool:"file",size:"xs",decorative:!0}),u]},d))]}),a.guidance.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"text-stone-500",children:"Guidance:"})," ",a.guidance.map((u,d)=>i.jsx(lP,{label:u,sourcePath:s,testId:`${n}-guidance-file-trigger-${u}`,children:i.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5 underline decoration-dotted decoration-stone-400",children:[i.jsx($e,{tool:u,size:"xs",decorative:!0}),u]})},`${u}-${d}`))]}),a.plugins.length>0&&i.jsxs("div",{children:[i.jsx("span",{className:"text-stone-500",children:"Plugins:"})," ",a.plugins.map((u,d)=>i.jsxs("span",{className:"mr-1 mb-0.5 inline-flex items-center gap-1 bg-stone-100 px-1.5 py-0.5",children:[i.jsx($e,{tool:"file",size:"xs",decorative:!0}),u]},`${u}-${d}`))]})]})]}),(l.files.length>0||l.actions.length>0)&&i.jsxs("div",{"data-testid":`${n}-startup-section`,className:"border border-stone-200 p-3",children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Startup"}),l.files.length>0&&i.jsxs("div",{className:"mb-2",children:[i.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Files"}),l.files.map((u,d)=>i.jsxs("div",{className:"font-mono text-[10px]",children:[i.jsx(lP,{label:u.path,sourcePath:s,testId:`${n}-startup-file-trigger-${u.path}`,children:i.jsxs("span",{className:"inline-flex items-center gap-1 underline decoration-dotted decoration-stone-400",children:[i.jsx($e,{tool:u.path,size:"xs",decorative:!0}),u.path]})})," ",u.required&&i.jsx("span",{className:"text-red-500 text-[8px]",children:"REQUIRED"})]},d))]}),l.actions.length>0&&i.jsxs("div",{children:[i.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Actions"}),l.actions.map((u,d)=>i.jsxs("div",{className:"font-mono text-[10px]",children:[i.jsxs("span",{className:"inline-flex items-center gap-1 text-stone-500",children:[i.jsx($e,{tool:u.type.includes("command")?"terminal":u.type,size:"xs",decorative:!0}),u.type,":"]})," ",u.value]},d))]})]}),i.jsx(_9,{title:"YAML Preview",testId:`${n}-spec-yaml`,children:t})]})}function vfe(){const e=It(),{selectedAgentDraft:t,currentAgentDraft:n}=lf(),s=t??n,{data:r,isLoading:a,error:l}=lfe((s==null?void 0:s.yaml)??null);return s?i.jsx(at,{children:i.jsxs("div",{"data-testid":"agent-spec-review",className:"space-y-6",children:[i.jsx(wn,{eyebrow:"Agent Spec Review",title:(r==null?void 0:r.name)??s.label,description:(r==null?void 0:r.description)??"Review the agent spec structure before validation.",actions:i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open In Validate"})}),r&&i.jsxs(Do,{children:[i.jsx(st,{label:"Format",value:"AgentSpec",testId:"agent-spec-summary-format"}),i.jsx(st,{label:"Version",value:r.version,testId:"agent-spec-summary-version"}),i.jsx(st,{label:"Profiles",value:(r.profiles??[]).length,testId:"agent-spec-summary-profiles"}),i.jsx(st,{label:"Skills",value:(r.resources??{skills:[]}).skills.length,testId:"agent-spec-summary-skills"})]}),a&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),l&&i.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:l.message}),i.jsx(M_,{review:r,yaml:s.yaml,testIdPrefix:"agent"})]})}):i.jsx(at,{children:i.jsxs("div",{"data-testid":"agent-spec-review-empty",className:"space-y-5",children:[i.jsx(wn,{eyebrow:"Agent Spec Review",title:"No AgentSpec Selected",description:"Choose a current or recent agent draft from the Library drawer to review it here before you validate it."}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open Validate"})]})})}function bfe(){return en({mutationFn:async({bundlePath:e})=>{const t=await fetch("/api/bundles/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e})}),n=await t.json();if(n.error)throw new Error(n.error);if(!t.ok)throw new Error(`HTTP ${t.status}`);return n}})}function wfe(){return en({mutationFn:async({bundlePath:e,plan:t,autoApprove:n,targetRoot:s})=>{const r=await fetch("/api/bundles/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e,plan:t,autoApprove:n,targetRoot:s})}),a=await r.json();if(!r.ok)throw new Error(a.error??`HTTP ${r.status}`);return a}})}function jfe(){var a,l;const[e,t]=C.useState(""),n=bfe(),s=()=>{e.trim()&&n.mutate({bundlePath:e.trim()})},r=n.data;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"bundle-inspector",children:[i.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSPECT BUNDLE"}),i.jsxs("div",{className:"mb-spacing-4",children:[i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),i.jsx("input",{"data-testid":"bundle-path-input",type:"text",value:e,onChange:u=>t(u.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary"}),i.jsx(_e,{variant:"tactical",onClick:s,disabled:!e.trim()||n.isPending,className:"mt-spacing-3","data-testid":"inspect-btn",children:n.isPending?"INSPECTING...":"INSPECT"})]}),n.isError&&i.jsx("div",{className:"text-destructive text-body-md mb-spacing-4","data-testid":"inspect-error",children:n.error.message}),r&&i.jsxs("div",{"data-testid":"inspect-result",children:[i.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4","data-testid":"manifest-summary",children:[i.jsxs("div",{className:"flex items-center gap-spacing-2 mb-spacing-2",children:[i.jsx("h3",{className:"text-headline-md uppercase",children:r.manifest.name}),i.jsxs("span",{className:"text-label-sm font-mono px-spacing-2 py-px bg-foreground/10","data-testid":"schema-badge",children:["v",r.manifest.schemaVersion??1]})]}),i.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["v",r.manifest.version]}),i.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["Spec: ",r.manifest.rigSpec]}),i.jsxs("div",{className:"mt-spacing-2 flex gap-spacing-3",children:[i.jsxs("span",{className:he("text-label-sm",r.digestValid?"text-success":"text-destructive"),children:["DIGEST: ",r.digestValid?"VALID":"INVALID"]}),i.jsxs("span",{className:he("text-label-sm",r.integrityResult.passed?"text-success":"text-destructive"),"data-testid":"integrity-status",children:["INTEGRITY: ",r.integrityResult.passed?"PASS":"FAIL"]})]})]}),r.manifest.schemaVersion===2&&r.manifest.agents?i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"AGENTS"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"agent-list",children:r.manifest.agents.map(u=>i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"agent-entry",children:[u.name," v",u.version," — ",u.path]},u.name))})]}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PACKAGES"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"package-list",children:(r.manifest.packages??[]).map(u=>i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"package-entry",children:[u.name," v",u.version," — ",u.path]},u.name))})]}),r.manifest.provenance&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PROVENANCE"}),i.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4 space-y-spacing-1","data-testid":"provenance-block",children:[r.manifest.provenance.createdAt&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"provenance-createdAt",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Created: "}),r.manifest.provenance.createdAt]}),r.manifest.provenance.sourceHost&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"provenance-sourceHost",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Host: "}),r.manifest.provenance.sourceHost]}),r.manifest.provenance.authorSession&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"provenance-authorSession",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Author: "}),r.manifest.provenance.authorSession]}),r.manifest.provenance.sourceRigName&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"provenance-sourceRigName",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Rig: "}),r.manifest.provenance.sourceRigName,r.manifest.provenance.sourceRigId&&i.jsxs("span",{className:"text-foreground-muted-on-dark",children:[" (",r.manifest.provenance.sourceRigId,")"]})]}),(r.manifest.provenance.daemonVersion||r.manifest.provenance.cliVersion)&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"provenance-versions",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Built with: "}),r.manifest.provenance.daemonVersion&&i.jsxs(i.Fragment,{children:["daemon ",r.manifest.provenance.daemonVersion]}),r.manifest.provenance.daemonVersion&&r.manifest.provenance.cliVersion&&" / ",r.manifest.provenance.cliVersion&&i.jsxs(i.Fragment,{children:["cli ",r.manifest.provenance.cliVersion]})]}),r.manifest.provenance.notes&&i.jsxs("div",{className:"text-label-sm font-mono whitespace-pre-wrap mt-spacing-2","data-testid":"provenance-notes",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Notes: "}),r.manifest.provenance.notes]})]})]}),r.manifest.compatibility&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"COMPATIBILITY"}),i.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4 space-y-spacing-1","data-testid":"compatibility-block",children:[r.manifest.compatibility.minDaemonVersion&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"compatibility-minDaemonVersion",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Min daemon: "}),r.manifest.compatibility.minDaemonVersion]}),r.manifest.compatibility.minCliVersion&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"compatibility-minCliVersion",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Min CLI: "}),r.manifest.compatibility.minCliVersion]}),r.manifest.compatibility.schemaVersion!==void 0&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"compatibility-schemaVersion",children:[i.jsx("span",{className:"text-foreground-muted-on-dark",children:"Schema: "}),"v",r.manifest.compatibility.schemaVersion]})]})]}),r.integrityResult&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"FILE INTEGRITY"}),i.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"file-integrity",children:[Object.keys((r.manifest.packages??r.manifest.agents??[]).length>0?((l=(a=r.manifest)==null?void 0:a.integrity)==null?void 0:l.files)??{}:{}).map(u=>{const d=r.integrityResult.mismatches.includes(u),f=r.integrityResult.missing.includes(u),p=d?"MISMATCH":f?"MISSING":"OK";return i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[i.jsx("span",{className:he("w-2 h-2",p==="OK"?"bg-success":"bg-destructive"),"data-testid":"file-dot"}),i.jsx("span",{children:u}),i.jsx("span",{className:"text-foreground-muted ml-auto",children:p})]},u)}),r.integrityResult.extra.map(u=>i.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[i.jsx("span",{className:"w-2 h-2 bg-warning","data-testid":"file-dot"}),i.jsx("span",{children:u}),i.jsx("span",{className:"text-foreground-muted ml-auto",children:"EXTRA"})]},u))]})]}),i.jsx(_e,{variant:"tactical","data-testid":"install-btn",onClick:()=>window.location.href=`/bundles/install?bundlePath=${encodeURIComponent(e)}`,children:"INSTALL THIS BUNDLE"})]})]})})}function Sfe(){const e=It(),[t,n]=C.useState("enter"),s=typeof window<"u"?new URLSearchParams(window.location.search):null,[r,a]=C.useState((s==null?void 0:s.get("bundlePath"))??""),[l,u]=C.useState(""),[d,f]=C.useState(null),[p,m]=C.useState(null),x=wfe(),y=async()=>{if(r.trim()){n("planning");try{const b=await x.mutateAsync({bundlePath:r.trim(),plan:!0});f(b),n("planned")}catch(b){m(b.message),n("error")}}},v=async()=>{if(l.trim()){n("applying");try{const b=await x.mutateAsync({bundlePath:r.trim(),autoApprove:!0,targetRoot:l.trim()});f(b),n("done")}catch(b){m(b.message),n("error")}}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"bundle-install-flow",children:[i.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSTALL BUNDLE"}),t==="enter"&&i.jsxs("div",{"data-testid":"step-enter",children:[i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),i.jsx("input",{"data-testid":"bundle-input",type:"text",value:r,onChange:b=>a(b.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),i.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"TARGET ROOT"}),i.jsx("input",{"data-testid":"target-input",type:"text",value:l,onChange:b=>u(b.target.value),placeholder:"/path/to/target/project",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),i.jsx(_e,{variant:"tactical",onClick:y,disabled:!r.trim(),"data-testid":"plan-btn",children:"PLAN"})]}),t==="planning"&&i.jsx("div",{"data-testid":"step-planning",className:"text-foreground-muted",children:"Planning..."}),t==="planned"&&d&&i.jsxs("div",{"data-testid":"step-planned",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PLAN"}),i.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:d.stages.map(b=>i.jsxs("div",{className:"text-label-sm font-mono",children:[i.jsx("span",{className:b.status==="ok"?"text-success":"text-foreground-muted",children:b.status.toUpperCase()})," ",b.stage]},b.stage))}),i.jsx(_e,{variant:"tactical",onClick:v,disabled:!l.trim(),"data-testid":"apply-btn",children:"APPLY"})]}),t==="applying"&&i.jsx("div",{"data-testid":"step-applying",className:"text-foreground-muted",children:"Installing..."}),t==="done"&&d&&i.jsxs("div",{"data-testid":"step-done",children:[i.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"COMPLETE"}),i.jsxs("div",{className:"text-label-sm font-mono",children:["Status: ",i.jsx("span",{className:"text-success",children:d.status.toUpperCase()}),d.stages.some(b=>{var w;return((w=b.detail)==null?void 0:w.source)==="pod_bundle"})?i.jsx("span",{className:"ml-spacing-2 text-primary","data-testid":"bundle-type-label",children:"Pod-aware bundle"}):i.jsx("span",{className:"ml-spacing-2 text-foreground-muted","data-testid":"bundle-type-label",children:"Legacy bundle"})]}),d.rigId&&i.jsxs("div",{className:"text-label-sm font-mono","data-testid":"result-rig-id",children:["Rig: ",d.rigId]}),d.rigId&&i.jsx(_e,{variant:"tactical",className:"mt-spacing-3",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:d.rigId}}),children:"VIEW RIG"})]}),t==="error"&&i.jsxs("div",{"data-testid":"step-error",children:[i.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:p}),i.jsx(_e,{variant:"tactical",onClick:()=>{n("enter"),m(null),x.reset()},"data-testid":"try-again-btn",children:"TRY AGAIN"})]})]})})}async function Nfe(){const e=await fetch("/api/mission-control/destinations");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function dz(e){return qe({queryKey:["mission-control","destinations"],queryFn:Nfe,enabled:e,staleTime:3e4})}function kfe(e){const t=[`Install and launch the "${e.name}" managed app using OpenRig.`,""];return e.summary&&t.push(`About: ${e.summary}`,""),t.push(`Source: ${e.sourcePath}`,"","Steps:",`1. Run: rig up ${e.name}`,"2. Monitor: rig ps --nodes","3. Check env: rig env status <rig-name>"),t.join(`
519
+ `)}function O_({sourcePath:e,sourceState:t}){return i.jsxs("div",{className:"font-mono text-[9px] text-stone-500","data-testid":"library-provenance",children:["Source: ",e," · ",t]})}function _fe({review:e}){const t=It(),n=e.profiles??[],s=e.resources??{skills:[]};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-agent",className:"space-y-6",children:[i.jsx(wn,{eyebrow:"Library — Agent Spec",title:e.name,description:e.description??"Agent spec from library.",actions:i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/agents/validate"}),children:"Validate"})}),i.jsx(O_,{sourcePath:e.sourcePath,sourceState:e.sourceState}),i.jsxs(Do,{children:[i.jsx(st,{label:"Format",value:"AgentSpec",testId:"lib-agent-format"}),i.jsx(st,{label:"Version",value:e.version,testId:"lib-agent-version"}),i.jsx(st,{label:"Profiles",value:n.length,testId:"lib-agent-profiles"}),i.jsx(st,{label:"Skills",value:s.skills.length,testId:"lib-agent-skills"})]}),i.jsx(M_,{review:e,yaml:e.raw,testIdPrefix:"lib-agent",sourcePath:e.sourcePath})]})})}function Cfe({review:e}){const t=It(),[n,s]=C.useState(!1),{data:r=[]}=Rc("agent");new Map(r.map(f=>[f.name,f]));const a=e.pods??[],l=e.nodes??[],u=e.edges??[],d=f=>{if(!f.startsWith("local:"))return null;const p=f.slice(6),x=`${e.sourcePath.replace(/\/[^/]+$/,"")}/${p}`.split("/"),y=[];for(const b of x)b===".."?y.pop():b!=="."&&b!==""&&y.push(b);const v="/"+y.join("/");return r.find(b=>b.sourcePath.startsWith(v+"/"))??null};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-rig",className:"space-y-6",children:[i.jsx(wn,{eyebrow:e.services?"Library — Managed App":"Library — Rig Spec",title:e.name,description:e.summary??"Rig spec from library.",actions:i.jsxs("div",{className:"flex gap-2",children:[e.services&&i.jsx(_e,{variant:"outline",size:"sm","data-testid":"copy-setup-prompt",onClick:()=>void(async()=>{await Zr(kfe({name:e.name,summary:e.summary,sourcePath:e.sourcePath}))&&(s(!0),window.setTimeout(()=>s(!1),2e3))})(),children:n?"Copied":"Copy Setup Prompt"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/import"}),children:"Import"})]})}),i.jsx(O_,{sourcePath:e.sourcePath,sourceState:e.sourceState}),i.jsxs(Do,{children:[i.jsx(st,{label:"Format",value:e.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"lib-rig-format"}),e.services&&i.jsx(st,{label:"Type",value:"Agent-Managed App",testId:"lib-rig-type"}),e.services&&a.length>0&&(()=>{const f=a.find(p=>p.members.some(m=>m.id==="specialist"));return f?i.jsx(st,{label:"Specialist Agent",value:`${f.id}.specialist`,testId:"lib-rig-specialist"}):null})(),i.jsx(st,{label:e.format==="pod_aware"?"Pods":"Nodes",value:e.format==="pod_aware"?a.length:l.length,testId:"lib-rig-pods"}),i.jsx(st,{label:"Members",value:e.format==="pod_aware"?a.reduce((f,p)=>f+p.members.length,0):l.length,testId:"lib-rig-members"}),i.jsx(st,{label:"Edges",value:u.length+(e.format==="pod_aware"?a.reduce((f,p)=>{var m;return f+(((m=p.edges)==null?void 0:m.length)??0)},0):0),testId:"lib-rig-edges"})]}),i.jsx(I_,{review:e,yaml:e.raw,testIdPrefix:"lib",yamlTestId:"lib-rig-yaml",showEnvironmentTab:!!e.services,onMemberClick:(f,p)=>{const m=d(p.agentRef);m&&t({to:"/specs/library/$entryId",params:{entryId:m.id}})}})]})})}function Efe({entryId:e}){return e.startsWith("context-pack:")?i.jsx(Pfe,{entryId:e}):e.startsWith("agent-image:")?i.jsx(Dfe,{entryId:e}):i.jsx(Rfe,{entryId:e})}function Rfe({entryId:e}){const t=It(),{data:n,isLoading:s,error:r}=ik(e);return s?i.jsx(at,{children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading spec review..."})}):r||!n?i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[i.jsx(wn,{eyebrow:"Library",title:"Spec Not Found",description:(r==null?void 0:r.message)??"Could not load spec."}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):n.kind==="agent"?i.jsx(_fe,{review:n}):n.kind==="workflow"?i.jsx(Lfe,{review:n}):i.jsx(Cfe,{review:n})}const Afe=180,Tfe=56,Ife=220,Mfe=110;function Ofe({topology:e,testId:t}){const{nodes:n,edges:s}=C.useMemo(()=>{const r=new Map;for(const x of e.edges)r.has(x.fromStepId)||r.set(x.fromStepId,[]),r.get(x.fromStepId).push(x.toStepId);const a=new Map,l=[];for(const x of e.nodes)x.isEntry&&(a.set(x.stepId,0),l.push({id:x.stepId,d:0}));for(;l.length>0;){const{id:x,d:y}=l.shift(),v=r.get(x)??[];for(const b of v)a.has(b)||(a.set(b,y+1),l.push({id:b,d:y+1}))}let u=0;for(const x of e.nodes)a.has(x.stepId)||a.set(x.stepId,u++);const d=new Map;for(const x of e.nodes){const y=a.get(x.stepId)??0;d.has(y)||d.set(y,[]),d.get(y).push(x.stepId)}const f=new Map;for(const[x,y]of d)y.forEach((v,b)=>{f.set(v,{x:b*Ife,y:x*Mfe})});const p=e.nodes.map(x=>{const y=f.get(x.stepId)??{x:0,y:0},v=x.isEntry?"#a8c8d4":x.isTerminal?"#d4b8a8":"#d4c4a8";return{id:x.stepId,type:"default",position:y,data:{label:i.jsxs("div",{className:"font-mono text-[10px] leading-tight",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 font-bold",children:[i.jsx("span",{children:x.stepId}),x.isTerminal?i.jsx($e,{tool:"terminal",size:"xs",title:"Terminal step",decorative:!0}):null]}),i.jsx("div",{className:"text-stone-600",children:x.role}),x.preferredTarget&&i.jsxs("div",{className:"text-[8px] text-stone-500",children:["→ ",x.preferredTarget]})]})},style:{backgroundColor:v,border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:Afe,height:Tfe,padding:6}}}),m=e.edges.map((x,y)=>({id:`e-${y}`,source:x.fromStepId,target:x.toStepId,style:{stroke:"#8a8577"}}));return{nodes:p,edges:m}},[e]);return i.jsx("div",{"data-testid":t??"workflow-topology-graph",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:i.jsxs(xf,{nodes:n,edges:s,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[i.jsx(Kk,{gap:20,size:.5,color:"#d4d0c8"}),i.jsx(yf,{showInteractive:!1})]})})}function Lfe({review:e}){const t=It(),n=Mt(),{data:s}=EW(),[r,a]=C.useState(null),[l,u]=C.useState(!1),d=(s==null?void 0:s.specName)===e.name&&(s==null?void 0:s.specVersion)===e.version,f=async()=>{u(!0),a(null);try{await RW(e.name,e.version),await n.invalidateQueries({queryKey:["spec-library","active-lens"]}),await n.invalidateQueries({queryKey:["slices"]})}catch(m){a(m.message)}finally{u(!1)}},p=async()=>{u(!0),a(null);try{await AW(),await n.invalidateQueries({queryKey:["spec-library","active-lens"]}),await n.invalidateQueries({queryKey:["slices"]})}catch(m){a(m.message)}finally{u(!1)}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-workflow",className:"space-y-6",children:[i.jsx(wn,{eyebrow:e.isBuiltIn?"Library — Workflow (Built-in)":"Library — Workflow",title:`${e.name} v${e.version}`,description:e.purpose??"Workflow spec from library.",actions:i.jsxs("div",{className:"flex gap-2 items-center",children:[d?i.jsx(_e,{variant:"outline",size:"sm","data-testid":"workflow-deactivate-lens",onClick:()=>void p(),disabled:l,children:l?"...":"Deactivate Lens"}):i.jsx(_e,{variant:"outline",size:"sm","data-testid":"workflow-activate-lens",onClick:()=>void f(),disabled:l,children:l?"...":"Activate as Lens"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back"})]})}),i.jsx(O_,{sourcePath:e.sourcePath,sourceState:"library_item"}),r&&i.jsx("div",{"data-testid":"workflow-lens-error",className:"font-mono text-[10px] text-red-600",children:r}),i.jsxs(Do,{children:[i.jsx(st,{label:"Format",value:"WorkflowSpec",testId:"lib-wf-format"}),i.jsx(st,{label:"Version",value:e.version,testId:"lib-wf-version"}),i.jsx(st,{label:"Roles",value:e.rolesCount,testId:"lib-wf-roles"}),i.jsx(st,{label:"Steps",value:e.stepsCount,testId:"lib-wf-steps"}),i.jsx(st,{label:"Target Rig",value:e.targetRig??"(any)",testId:"lib-wf-target-rig"}),i.jsx(st,{label:"Source",value:e.isBuiltIn?"built-in":"user file",testId:"lib-wf-source"})]}),i.jsxs("div",{"data-testid":"workflow-terminal-rule",className:"flex items-center gap-2 border border-stone-300/40 bg-white/10 px-3 py-2 font-mono text-[10px] text-stone-700",children:[i.jsx($e,{tool:"terminal",size:"xs",decorative:!0}),i.jsx("span",{className:"text-stone-500 uppercase tracking-[0.16em] text-[8px]",children:"Coordination Terminal Turn:"}),e.terminalTurnRule]}),i.jsx(Ofe,{topology:e.topology}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Steps"}),i.jsx("div",{className:"space-y-1",children:e.steps.map(m=>i.jsxs("div",{"data-testid":`workflow-step-${m.stepId}`,className:"border border-stone-300/40 bg-white/5 px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"font-mono text-[11px] font-bold text-stone-800",children:m.stepId}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:m.role})]}),m.objective&&i.jsx("div",{className:"mt-1 text-[10px] text-stone-600 leading-tight",children:m.objective}),m.allowedNextSteps.length>0&&i.jsxs("div",{className:"mt-1 font-mono text-[9px] text-stone-500",children:["next: ",m.allowedNextSteps.map(x=>`${x.stepId} (${x.role})`).join(", ")]}),m.allowedExits.length>0&&i.jsxs("div",{className:"font-mono text-[9px] text-stone-400",children:["exits: ",m.allowedExits.join(", ")]})]},m.stepId))})]})]})})}function Pfe({entryId:e}){const t=It(),{data:n=[],isLoading:s,error:r}=ak(),a=n.find(d=>d.id===e)??null,{data:l,isLoading:u}=MW(a?e:null);return s?i.jsx(at,{children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading context pack…"})}):r||!a?i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[i.jsx(wn,{eyebrow:"Library",title:"Context Pack Not Found",description:(r==null?void 0:r.message)??`No context pack with id ${e}.`}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):i.jsx($fe,{entry:a,preview:l,previewLoading:u})}function $fe({entry:e,preview:t,previewLoading:n}){var S;const s=It(),[r,a]=C.useState(!1),[l,u]=C.useState(""),[d,f]=C.useState(null),[p,m]=C.useState("idle"),x=OW(),{data:y}=dz(r),v=((y==null?void 0:y.destinations)??[]).filter(E=>E.source==="topology"&&E.status==="running").map(E=>E.sessionName).sort(),b=async()=>{if(f(null),!l){f("Pick a destination session first.");return}try{await x.mutateAsync({id:e.id,destinationSession:l,dryRun:!0}),m("dry-run-shown")}catch(E){f(E.message)}},w=async()=>{if(f(null),!l){f("Pick a destination session first.");return}try{await x.mutateAsync({id:e.id,destinationSession:l,dryRun:!1}),m("sent")}catch(E){f(E.message)}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-context-pack",className:"space-y-4",children:[i.jsx(wn,{eyebrow:`Library — Context Pack${e.sourceType==="builtin"?" (built-in)":""}`,title:e.name,description:e.purpose??"Operator-authored composable context bundle.",actions:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(_e,{variant:"outline",size:"sm","data-testid":"context-pack-send-button",onClick:()=>a(E=>!E),children:r?"Hide Send":"Send to seat"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>s({to:"/specs"}),children:"Back to Library"})]})}),i.jsxs(Do,{children:[i.jsx(st,{label:"Version",value:e.version,testId:"lib-pack-version"}),i.jsx(st,{label:"Files",value:e.files.length,testId:"lib-pack-files"}),i.jsx(st,{label:"Tokens (~)",value:String(e.derivedEstimatedTokens),testId:"lib-pack-tokens"}),i.jsx(st,{label:"Source",value:e.sourceType,testId:"lib-pack-source"})]}),i.jsxs("div",{"data-testid":"lib-pack-source-path",className:"font-mono text-[9px] text-stone-500",children:["path: ",e.sourcePath]}),i.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Files"}),i.jsx("ul",{"data-testid":"lib-pack-file-list",className:"divide-y divide-stone-100",children:e.files.map(E=>{const k=E.bytes===null;return i.jsx("li",{"data-testid":`lib-pack-file-${E.path}`,"data-missing":k?"true":"false",className:`font-mono text-[10px] ${k?"text-red-700":"text-stone-800"}`,children:i.jsxs(_f,{data:{path:E.path,absolutePath:E.absolutePath},testId:`lib-pack-file-trigger-${E.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors",children:[i.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[i.jsx("span",{className:"font-bold truncate underline decoration-dotted decoration-stone-400",children:E.path}),i.jsxs("span",{className:"font-mono text-[8px] text-stone-500 shrink-0",children:["role: ",E.role,k?" · MISSING":` · ${E.bytes}B · ~${E.estimatedTokens} tokens`]})]}),E.summary&&i.jsx("div",{className:"mt-0.5 text-stone-600 text-[9px]",children:E.summary})]})},E.path)})})]}),r&&i.jsxs("section",{"data-testid":"context-pack-send-modal",className:"border border-stone-400 bg-white px-3 py-3 space-y-2",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-700",children:"Send to seat"}),i.jsxs("select",{"data-testid":"context-pack-send-session",className:"w-full font-mono text-[10px] border border-stone-300 px-2 py-1",value:l,onChange:E=>u(E.target.value),children:[i.jsx("option",{value:"",children:"Pick a running session…"}),v.map(E=>i.jsx("option",{value:E,children:E},E))]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(_e,{variant:"outline",size:"sm","data-testid":"context-pack-send-dry-run",onClick:()=>void b(),disabled:x.isPending,children:x.isPending?"…":"Dry run"}),i.jsx(_e,{size:"sm","data-testid":"context-pack-send-confirm",onClick:()=>void w(),disabled:x.isPending||!l,children:x.isPending?"Sending…":"Send"})]}),d&&i.jsx("div",{"data-testid":"context-pack-send-error",className:"font-mono text-[9px] text-red-600",children:d}),p==="sent"&&i.jsxs("div",{"data-testid":"context-pack-send-success",className:"font-mono text-[9px] text-emerald-700",children:["Sent to ",l,"."]}),p==="dry-run-shown"&&((S=x.data)==null?void 0:S.bundleText)&&i.jsx("pre",{"data-testid":"context-pack-send-bundle-preview",className:"font-mono text-[9px] bg-stone-50 border border-stone-200 px-2 py-1 max-h-64 overflow-y-auto whitespace-pre-wrap",children:x.data.bundleText})]}),i.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Bundle preview"}),n&&i.jsx("div",{className:"px-3 py-2 font-mono text-[9px] text-stone-400",children:"Loading bundle…"}),t&&i.jsxs(i.Fragment,{children:[t.missingFiles.length>0&&i.jsxs("div",{"data-testid":"lib-pack-missing-warning",className:"px-3 py-2 font-mono text-[9px] text-red-700 border-b border-stone-200",children:["Warning: ",t.missingFiles.length," file",t.missingFiles.length===1?"":"s"," referenced by manifest but missing on disk."]}),i.jsx("pre",{"data-testid":"lib-pack-bundle-text",className:"font-mono text-[9px] text-stone-800 bg-stone-50 px-3 py-2 max-h-96 overflow-y-auto whitespace-pre-wrap",children:t.bundleText})]})]})]})})}function Dfe({entryId:e}){const t=It(),{data:n=[],isLoading:s,error:r}=ok(),a=n.find(d=>d.id===e)??null,{data:l,isLoading:u}=$W(a?e:null);return s?i.jsx(at,{children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading agent image…"})}):r||!a?i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[i.jsx(wn,{eyebrow:"Library",title:"Agent Image Not Found",description:(r==null?void 0:r.message)??`No agent image with id ${e}.`}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Library"})]})}):i.jsx(qfe,{entry:a,preview:l,previewLoading:u})}function qfe({entry:e,preview:t,previewLoading:n}){const s=It(),r=DW(),[a,l]=C.useState(!1),[u,d]=C.useState(null),f=async()=>{if(!(t!=null&&t.starterSnippet))return;await Zr(t.starterSnippet)&&(l(!0),window.setTimeout(()=>l(!1),2e3))},p=async()=>{d(null);try{await r.mutateAsync({id:e.id,pin:!e.pinned})}catch(m){d(m.message)}};return i.jsx(at,{children:i.jsxs("div",{"data-testid":"library-review-agent-image",className:"space-y-4",children:[i.jsx(wn,{eyebrow:`Library — Agent Image${e.sourceType==="builtin"?" (built-in)":""}`,title:`${e.name} v${e.version}`,description:e.notes??`Snapshot of ${e.sourceSeat}.`,actions:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(_e,{variant:"outline",size:"sm","data-testid":"agent-image-pin-toggle",onClick:()=>void p(),disabled:r.isPending,children:e.pinned?"Unpin":"Pin"}),i.jsx(_e,{variant:"outline",size:"sm",onClick:()=>s({to:"/specs"}),children:"Back to Library"})]})}),i.jsxs(Do,{children:[i.jsx(st,{label:"Runtime",value:i.jsx(Gn,{runtime:e.runtime,size:"sm",compact:!0,variant:"inline"}),testId:"lib-image-runtime"}),i.jsx(st,{label:"Forks",value:String(e.stats.forkCount),testId:"lib-image-forks"}),i.jsx(st,{label:"Tokens (~)",value:String(e.derivedEstimatedTokens),testId:"lib-image-tokens"}),i.jsx(st,{label:"Size",value:`${e.stats.estimatedSizeBytes}B`,testId:"lib-image-size"})]}),i.jsxs("div",{"data-testid":"lib-image-source",className:"font-mono text-[9px] text-stone-500 space-y-0.5",children:[i.jsxs("div",{children:["source seat: ",e.sourceSeat]}),i.jsxs("div",{"data-testid":"lib-image-source-cwd",children:["source cwd: ",e.sourceCwd??"(unknown — pre-Finding-2 manifest)"]}),i.jsxs("div",{children:["created: ",e.createdAt]}),i.jsxs("div",{children:["last used: ",e.stats.lastUsedAt??"never"]}),i.jsxs("div",{children:["path: ",e.sourcePath]}),i.jsxs("div",{"data-testid":"lib-image-pinned",className:e.pinned?"text-amber-700 font-bold":"",children:["pinned: ",String(e.pinned)]})]}),e.lineage.length>0&&i.jsxs("section",{"data-testid":"lib-image-lineage",className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Lineage"}),i.jsxs("div",{className:"px-3 py-2 font-mono text-[10px] text-stone-700",children:[e.lineage.join(" → ")," → ",i.jsx("span",{className:"font-bold",children:e.name})]})]}),i.jsxs("section",{"data-testid":"lib-image-starter-snippet",className:"border border-stone-400 bg-white px-3 py-3 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-700",children:"Use as starter"}),i.jsx(_e,{variant:"outline",size:"sm","data-testid":"agent-image-copy-snippet",onClick:()=>void f(),disabled:!(t!=null&&t.starterSnippet),children:a?"Copied":"Copy snippet"})]}),i.jsx("div",{className:"font-mono text-[9px] text-stone-500",children:"Paste into your agent.yaml's session_source. The instantiator resolves the image via the daemon AgentImageLibraryService at startup time."}),n&&i.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"Loading snippet…"}),(t==null?void 0:t.starterSnippet)&&i.jsx("pre",{"data-testid":"lib-image-snippet-text",className:"font-mono text-[10px] bg-stone-50 border border-stone-200 px-2 py-1 whitespace-pre-wrap",children:t.starterSnippet})]}),u&&i.jsx("div",{"data-testid":"lib-image-pin-error",className:"font-mono text-[9px] text-red-600",children:u}),e.files.length>0&&i.jsxs("section",{className:"border border-stone-300/40 bg-white/8",children:[i.jsx("header",{className:"border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-600",children:"Supplementary files"}),i.jsx("ul",{className:"divide-y divide-stone-100",children:e.files.map(m=>i.jsx("li",{className:"font-mono text-[10px] text-stone-800","data-testid":`lib-image-file-${m.path}`,children:i.jsxs(_f,{data:{path:m.path,absolutePath:m.absolutePath},testId:`lib-image-file-trigger-${m.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors",children:[i.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[i.jsx("span",{className:"font-bold truncate underline decoration-dotted decoration-stone-400",children:m.path}),i.jsxs("span",{className:"font-mono text-[8px] text-stone-500 shrink-0",children:["role: ",m.role,m.bytes===null?" · MISSING":` · ${m.bytes}B`]})]}),m.summary&&i.jsx("div",{className:"mt-0.5 text-stone-600 text-[9px]",children:m.summary})]})},m.path))})]})]})})}async function zfe(e,t){const n=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}function Bfe(e,t){return qe({queryKey:["rig",e,"nodes",t],queryFn:()=>zfe(e,t),enabled:!!e&&!!t,refetchInterval:3e4})}function Ffe({pluginIds:e}){const{data:t=[]}=ag();if(e.length===0)return i.jsx("div",{className:"px-3 py-4",children:i.jsx(Ge,{label:"NO PLUGINS",description:"This agent's profile does not declare any plugins.",variant:"card",testId:"agent-plugins-empty"})});const n=new Map;for(const s of t)n.set(s.id,s);return i.jsx("ul",{"data-testid":"agent-plugins-list",className:"flex flex-col gap-2",children:e.map(s=>{const r=n.get(s);return i.jsx("li",{children:r?i.jsx(Hfe,{entry:r}):i.jsx(Ufe,{pluginId:s})},s)})})}function Hfe({entry:e}){return i.jsxs(Ve,{to:"/plugins/$pluginId",params:{pluginId:e.id},"data-testid":`agent-plugin-chip-${e.id}`,className:"flex items-center justify-between gap-3 border border-outline-variant bg-white/30 px-3 py-2 font-mono text-[11px] hover:bg-stone-100/50",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx($e,{tool:"skill",title:`${e.name} plugin`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:e.name}),i.jsx("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:`v${e.version}`})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-2 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:[e.runtimes.map(t=>i.jsx("span",{className:"inline-block border border-outline-variant px-1.5 py-0.5 font-mono",children:t},t)),i.jsx("span",{title:e.path,children:e.sourceLabel})]})]})}function Ufe({pluginId:e}){return i.jsxs(Ve,{to:"/plugins/$pluginId",params:{pluginId:e},"data-testid":`agent-plugin-chip-${e}`,className:"flex items-center justify-between gap-3 border border-dashed border-outline-variant bg-white/20 px-3 py-2 font-mono text-[11px] hover:bg-stone-100/50",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx($e,{tool:"skill",title:`${e} plugin (unresolved)`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:e})]}),i.jsx("span",{"data-testid":`agent-plugin-unresolved-${e}`,className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:"not discovered"})]})}function Vfe(e){return e==null?i.jsx("span",{className:"text-stone-400",children:"—"}):typeof e=="string"&&e.trim()===""?i.jsx("span",{className:"text-stone-400",children:"—"}):e}function Gfe(e){return e==="running"?"active":H2(e)}function Kfe(e){return e==="active"?"active":e==="needs_input"?"needs input":e}function Wfe({data:e,activityVisual:t}){var y,v,b;const n=F2(e.agentActivity),s=(t==null?void 0:t.state)??n,r=t?Kfe(t.state):Gfe(n),a=t?t.state==="active":n==="running",l=((y=e.contextUsage)==null?void 0:y.availability)==="known"&&typeof e.contextUsage.usedPercentage=="number"?`${e.contextUsage.usedPercentage}%`:null,u=ma((v=e.contextUsage)==null?void 0:v.totalInputTokens,(b=e.contextUsage)==null?void 0:b.totalOutputTokens),d=bf(u),f=e.resolvedSpecName&&e.resolvedSpecVersion?`${e.resolvedSpecName}@${e.resolvedSpecVersion}`:e.resolvedSpecName??null,p=i.jsx("span",{"data-testid":"seat-overview-activity-state","data-activity-state":s,className:a?"topology-table-active-shimmer text-emerald-600":"text-stone-700",children:r}),m=[{key:"runtime",label:"runtime",value:e.runtime?i.jsx(Gn,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}):null},{key:"model",label:"model",value:e.model,mono:!0},{key:"profile",label:"profile",value:e.profile,mono:!0},{key:"spec",label:"spec",value:f,mono:!0},{key:"activity",label:"activity",value:p},{key:"context-percent",label:"context %",value:l,mono:!0},{key:"total-tokens",label:"tokens",value:d,mono:!0}],x=m.length-1;return i.jsx("section",{"data-testid":"seat-overview-table",className:"border border-outline-variant bg-white/30",children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left",children:[i.jsx("thead",{children:i.jsx("tr",{"data-testid":"seat-overview-header-row",className:"border-b border-outline-variant/55 bg-stone-50/30",children:m.map((w,S)=>i.jsx("th",{scope:"col","data-testid":`seat-overview-header-${w.key}`,className:`px-3 py-1.5 text-left font-mono text-[10px] font-normal lowercase tracking-[0.04em] text-stone-500 ${S<x?"border-r border-outline-variant/55":""}`,children:w.label},w.key))})}),i.jsx("tbody",{children:i.jsx("tr",{"data-testid":"seat-overview-data-row","data-row-shape":"data",children:m.map((w,S)=>i.jsx("td",{"data-testid":`seat-overview-cell-${w.key}`,className:`min-w-0 px-3 py-1.5 align-middle ${w.mono?"font-mono text-[11px]":"text-[11px]"} text-stone-900 ${S<x?"border-r border-outline-variant/55":""}`,children:i.jsx("div",{className:"truncate",children:Vfe(w.value)})},w.key))})})]})})})}function Yfe(e){return e==null?i.jsx("span",{className:"text-stone-400",children:"—"}):typeof e=="string"&&e.trim()===""?i.jsx("span",{className:"text-stone-400",children:"—"}):e}function Qfe({data:e}){var s;const t=((s=e.currentQitems)==null?void 0:s[0])??null,n=t?i.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[i.jsx("span",{className:"shrink-0 font-mono text-[10px] text-stone-500",children:t.qitemId}),i.jsx("span",{className:"min-w-0 truncate text-[11px] text-stone-900",children:t.bodyExcerpt})]}):null;return i.jsx("section",{"data-testid":"seat-overview-secondary",className:"border border-outline-variant bg-white/30",children:i.jsxs("dl",{className:"divide-y divide-outline-variant/55",children:[i.jsx(cP,{fieldKey:"cwd",label:"cwd",value:e.cwd,mono:!0,titleAttr:e.cwd??void 0}),i.jsx(cP,{fieldKey:"current-work",label:"current work",value:n})]})})}function cP({fieldKey:e,label:t,value:n,mono:s,titleAttr:r}){return i.jsxs("div",{"data-testid":`seat-overview-secondary-row-${e}`,className:"flex min-w-0 items-baseline gap-3 px-3 py-1.5",title:r,children:[i.jsx("dt",{className:"shrink-0 font-mono text-[10px] lowercase tracking-[0.04em] text-stone-500",children:t}),i.jsx("dd",{"data-testid":`seat-overview-secondary-cell-${e}`,className:`min-w-0 flex-1 truncate ${s?"font-mono text-[11px]":"text-[11px]"} text-stone-900`,children:Yfe(n)})]})}function Xfe(e){return e.startupStatus==="failed"?"Startup failed":e.startupStatus==="attention_required"?"Attention required":e.latestError?"Error":null}function Zfe(e){return e.startupStatus==="failed"||e.latestError&&e.startupStatus!=="attention_required"?"destructive":"default"}function Jfe({data:e}){const t=Xfe(e);if(!t)return null;const n=!!e.latestError,s=!!e.recoveryGuidance;return i.jsxs(vn,{"data-testid":"seat-notification-banner","data-startup-status":e.startupStatus??"unknown",variant:Zfe(e),children:[i.jsx(wq,{"data-testid":"seat-notification-headline",className:"font-mono text-[11px] uppercase tracking-[0.08em]",children:t}),n?i.jsx(cn,{"data-testid":"seat-notification-error",className:"font-mono text-[10px]",children:e.latestError}):null,s&&e.recoveryGuidance?i.jsx(cn,{"data-testid":"seat-notification-guidance",className:"mt-1 font-mono text-[10px] text-stone-700",children:e.recoveryGuidance.summary}):null]})}function ehe(e){switch(e){case"resumed":return"text-success";case"rebuilt":return"text-success";case"fresh":return"text-foreground-muted";case"failed":return"text-destructive";case"checkpoint_written":return"text-success";case"fresh_no_checkpoint":return"text-foreground-muted";default:return"text-foreground-muted"}}const ga="border border-outline-variant bg-white/30 p-3";function the(e){switch(e){case"ready":return"text-green-600";case"pending":return"text-amber-600";case"attention_required":return"text-orange-600";case"failed":return"text-red-600";default:return"text-stone-400"}}function nhe(e){switch(e){case"attention_required":return"attention required";default:return e??"stopped"}}function she(e){if(!e)return null;const t=e.match(/^local:agents\/([^/]+)$/);return(t==null?void 0:t[1])??null}function Ps({label:e,value:t}){return t==null||t===""?null:i.jsxs("div",{className:"flex justify-between gap-3 font-mono text-[10px]",children:[i.jsx("span",{className:"text-stone-500",children:e}),i.jsx("span",{className:"truncate text-right text-stone-900",children:t})]})}function rhe({data:e}){const t=she(e.agentRef),{data:n=[],isLoading:s}=Rc("agent"),r=t?n.filter(d=>d.name===t):[],a=r.length===1?r[0].id:null,{data:l,isLoading:u}=ik(a);return i.jsxs("div",{"data-testid":"live-agent-spec-section",className:"space-y-4",children:[e.compactSpec.name&&i.jsxs("section",{"data-testid":"detail-compact-spec",className:ga,children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Resolved Agent Spec"}),i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(Ps,{label:"Spec",value:e.compactSpec.name}),i.jsx(Ps,{label:"Version",value:e.compactSpec.version}),i.jsx(Ps,{label:"Profile",value:e.compactSpec.profile}),i.jsx(Ps,{label:"Skills",value:e.compactSpec.skillCount}),i.jsx(Ps,{label:"Guidance",value:e.compactSpec.guidanceCount})]})]}),t?s||u?i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading agent spec..."}):r.length===0?i.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):r.length>1?i.jsxs("div",{"data-testid":"agent-spec-ambiguous",className:"p-4 font-mono text-[10px] text-amber-600",children:["Agent spec ambiguous (",r.length,' matches for "',t,'")']}):!l||l.kind!=="agent"?i.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):i.jsxs(i.Fragment,{children:[i.jsx(M_,{review:l,yaml:l.raw,testIdPrefix:"live-agent",sourcePath:l.sourcePath}),i.jsxs("section",{"data-testid":"live-agent-plugins-section",className:"border border-outline-variant bg-white/30 p-3",children:[i.jsx("div",{className:"mb-2 font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Plugins"}),i.jsx(Ffe,{pluginIds:ihe(l)})]})]}):i.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"})]})}function ihe(e){if(!e||typeof e!="object")return[];const t=e.resources;if(!t||typeof t!="object")return[];const n=t.plugins;if(!Array.isArray(n))return[];const s=[];for(const r of n)r&&typeof r=="object"&&typeof r.id=="string"?s.push(r.id):typeof r=="string"&&s.push(r);return s}function ahe({rigId:e,logicalId:t,data:n}){const s=async()=>{n.tmuxAttachCommand&&await Zr(n.tmuxAttachCommand)},r=async()=>{try{await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/open-cmux`,{method:"POST"})}catch{}},a=async()=>{n.resumeCommand&&await Zr(n.resumeCommand)};return i.jsxs("div",{"data-testid":"live-node-actions",className:"flex flex-wrap gap-2",children:[i.jsxs("button",{onClick:r,"data-testid":"detail-cmux-open",className:"inline-flex min-h-11 items-center gap-1.5 px-3 py-2 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-900 hover:bg-stone-100/60",children:[i.jsx($e,{tool:"cmux",size:"sm"}),"Open CMUX"]}),n.tmuxAttachCommand&&i.jsxs("button",{onClick:s,"data-testid":"detail-copy-attach",className:"inline-flex min-h-11 items-center gap-1.5 px-3 py-2 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:[i.jsx($e,{tool:"tmux",size:"sm"}),"Copy tmux attach"]}),n.resumeCommand&&i.jsxs("button",{onClick:a,"data-testid":"detail-copy-resume",className:"inline-flex min-h-11 items-center gap-1.5 px-3 py-2 border border-outline-variant bg-white/30 font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:[i.jsx($V,{"aria-hidden":"true",className:"h-4 w-4 shrink-0",strokeWidth:1.5}),"Copy resume command"]})]})}function ohe({data:e}){const t=e.startupStatus==="failed"||e.startupStatus==="attention_required"||!!e.latestError;return i.jsxs("section",{"data-testid":"live-node-status",className:"grid gap-2 border border-outline-variant bg-white/30 p-3 sm:grid-cols-2",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Startup"}),i.jsx("span",{className:the(e.startupStatus),"data-testid":"detail-startup-status",children:nhe(e.startupStatus)})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400",children:"Restore"}),i.jsx("span",{className:`font-mono text-xs font-bold ${ehe(e.restoreOutcome)}`,"data-testid":"detail-restore-outcome",children:e.restoreOutcome})]}),t&&i.jsxs("div",{className:`sm:col-span-2 mt-1 p-2 border ${e.startupStatus==="attention_required"?"bg-orange-50 border-orange-200":"bg-red-50 border-red-200"}`,"data-testid":"detail-failure-banner",children:[i.jsx("div",{className:`font-mono text-[9px] font-bold mb-1 ${e.startupStatus==="attention_required"?"text-orange-700":"text-red-700"}`,children:e.startupStatus==="attention_required"?"Attention Required":e.startupStatus==="failed"?"Startup Failed":"Error"}),e.latestError&&i.jsx("div",{className:`font-mono text-[9px] mb-1 ${e.startupStatus==="attention_required"?"text-orange-700":"text-red-600"}`,children:e.latestError}),i.jsx("div",{className:"font-mono text-[8px] text-stone-500",children:e.startupStatus==="attention_required"?`Use rig capture ${e.canonicalSessionName??"<session>"} to inspect the prompt, then rig send ${e.canonicalSessionName??"<session>"} to clear it.`:e.startupStatus==="failed"?"Check logs with: rig ps --nodes, or restart with: rig up":"Try: rig restore <snapshotId>"}),e.recoveryGuidance&&i.jsxs("div",{className:"mt-2 border-t border-stone-200 pt-2","data-testid":"detail-recovery-guidance",children:[i.jsx("div",{className:"font-mono text-[8px] font-bold text-stone-700 mb-1",children:"Recovery"}),i.jsx("div",{className:"font-mono text-[8px] text-stone-600 mb-1",children:e.recoveryGuidance.summary}),i.jsx("div",{className:"space-y-0.5 mb-1",children:e.recoveryGuidance.commands.map((n,s)=>i.jsx("code",{className:"font-mono text-[8px] text-stone-800 bg-stone-100 px-1 py-0.5 block",children:n},`${n}-${s}`))}),i.jsx("div",{className:"space-y-0.5",children:e.recoveryGuidance.notes.map((n,s)=>i.jsx("div",{className:"font-mono text-[8px] text-stone-500",children:n},`${n}-${s}`))})]})]})]})}function lhe({data:e}){return!e.recentEvents||e.recentEvents.length===0?null:i.jsxs("section",{"data-testid":"live-node-recent-events",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Recent Events"}),i.jsx("div",{className:"space-y-0.5",children:e.recentEvents.slice(0,10).map((t,n)=>i.jsxs("div",{className:"font-mono text-[9px] flex justify-between gap-3",children:[i.jsx("span",{className:"text-stone-700 truncate",children:t.type}),i.jsx("span",{className:"text-stone-400 ml-2 shrink-0",children:t.createdAt})]},`${t.type}-${n}`))})]})}function che({data:e}){const{outgoing:t,incoming:n}=e.edges;return t.length===0&&n.length===0?null:i.jsxs("section",{"data-testid":"detail-edges",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Edges"}),i.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[t.map((s,r)=>{var a;return i.jsxs("div",{className:"flex gap-1",children:[i.jsx("span",{className:"text-stone-400",children:"->"}),i.jsx("span",{className:"text-stone-500",children:s.kind}),i.jsx("span",{className:"text-stone-900",children:((a=s.to)==null?void 0:a.logicalId)??"?"})]},`out-${r}`)}),n.map((s,r)=>{var a;return i.jsxs("div",{className:"flex gap-1",children:[i.jsx("span",{className:"text-stone-400",children:"<-"}),i.jsx("span",{className:"text-stone-500",children:s.kind}),i.jsx("span",{className:"text-stone-900",children:((a=s.from)==null?void 0:a.logicalId)??"?"})]},`in-${r}`)})]})]})}function uhe({data:e}){return e.peers.length===0?null:i.jsxs("section",{"data-testid":"detail-peers",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Peers"}),i.jsx("div",{className:"space-y-1 font-mono text-[10px]",children:e.peers.map(t=>i.jsxs("div",{className:"space-y-0",children:[i.jsxs("div",{className:"flex justify-between gap-3",children:[i.jsx("span",{className:"text-stone-900",children:t.logicalId}),i.jsx("span",{className:"text-stone-500",children:t.runtime??"-"})]}),t.canonicalSessionName&&i.jsx("div",{className:"text-[9px] text-stone-400 truncate",children:t.canonicalSessionName})]},t.logicalId))})]})}function dhe({data:e}){var n,s,r;const t=e.contextUsage;return i.jsxs("section",{"data-testid":"detail-context-usage",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Context"}),(t==null?void 0:t.availability)==="known"?i.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[i.jsx(Ps,{label:"Used",value:t.usedPercentage!=null?`${t.usedPercentage}%`:null}),i.jsx(Ps,{label:"Remaining",value:t.remainingPercentage!=null?`${t.remainingPercentage}%`:null}),i.jsx(Ps,{label:"Window",value:(n=t.contextWindowSize)==null?void 0:n.toLocaleString()}),i.jsx(Ps,{label:"Input tokens",value:(s=t.totalInputTokens)==null?void 0:s.toLocaleString()}),i.jsx(Ps,{label:"Output tokens",value:(r=t.totalOutputTokens)==null?void 0:r.toLocaleString()}),i.jsx(Ps,{label:"Sampled",value:t.sampledAt}),t.fresh===!1&&i.jsx("div",{className:"font-mono text-[9px] text-amber-600 mt-1",children:"Stale sample"})]}):i.jsxs("div",{className:"font-mono text-[10px] text-stone-400",children:["unknown",t!=null&&t.reason?` (${t.reason})`:""]})]})}function fhe({data:e,activityVisual:t}){return i.jsxs("div",{"data-testid":"live-overview-section",className:"space-y-4",children:[i.jsx(Jfe,{data:e}),i.jsx(Wfe,{data:e,activityVisual:t}),i.jsx(Qfe,{data:e}),i.jsx(phe,{data:e}),i.jsx(lhe,{data:e})]})}function hhe({rigId:e,logicalId:t,data:n,isAgent:s}){return i.jsxs("div",{"data-testid":"live-details-section",className:"space-y-4",children:[i.jsx(mhe,{rigId:e,logicalId:t,data:n}),s?i.jsx(rhe,{data:n}):null,i.jsx(che,{data:n}),i.jsx(uhe,{data:n}),i.jsx(dhe,{data:n}),i.jsx(ghe,{data:n})]})}function phe({data:e}){return e.canonicalSessionName?i.jsx("div",{"data-testid":"live-terminal-shell",className:"bg-stone-950/65 p-2 text-stone-50 backdrop-blur-sm",children:i.jsx(Pg,{sessionName:e.canonicalSessionName,lines:80,testIdPrefix:"live-terminal-preview",variant:"compact-terminal"})}):i.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"No canonical session name; terminal preview unavailable."})}function mhe({rigId:e,logicalId:t,data:n}){return i.jsxs("div",{"data-testid":"live-startup-section",className:"space-y-4",children:[i.jsx(ohe,{data:n}),n.infrastructureStartupCommand&&i.jsxs("section",{"data-testid":"live-node-infra-startup",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Startup Command"}),i.jsx("code",{className:"font-mono text-[9px] text-stone-700 bg-stone-100 px-2 py-1 block",children:n.infrastructureStartupCommand})]}),n.startupActions.length>0&&i.jsxs("section",{"data-testid":"live-startup-actions",className:ga,children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wider text-stone-400 mb-2",children:"Startup Actions"}),i.jsx("div",{className:"space-y-1",children:n.startupActions.map((s,r)=>i.jsxs("div",{className:"font-mono text-[10px] text-stone-700",children:[i.jsxs("span",{className:"text-stone-500",children:[s.type,":"]})," ",s.value]},`${s.type}-${s.value}-${r}`))})]}),n.startupFiles.length>0?i.jsxs("section",{className:"border border-outline-variant bg-white/30",children:[i.jsx("div",{className:"px-3 py-2 border-b border-outline-variant font-mono text-xs font-bold",children:"Startup Files"}),i.jsx("ul",{className:"divide-y divide-outline-variant",children:n.startupFiles.map((s,r)=>i.jsx("li",{"data-testid":`live-startup-file-${s.path}`,children:i.jsxs(_f,{data:{path:s.path,absolutePath:s.absolutePath},testId:`live-startup-file-trigger-${s.path}`,className:"block w-full px-3 py-2 text-left hover:bg-stone-100/60 transition-colors font-mono text-[10px]",children:[i.jsx("span",{className:"font-bold underline decoration-dotted decoration-stone-400",children:s.path}),i.jsxs("span",{className:"text-stone-400 ml-2",children:["(",s.deliveryHint,")"]}),s.required&&i.jsx("span",{className:"text-red-500 text-[8px] ml-1",children:"REQUIRED"})]})},`${s.path}-${r}`))})]}):i.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"No startup files declared"})]})}function ghe({data:e}){return e.transcript.enabled?i.jsx("div",{"data-testid":"live-transcript-section",className:"space-y-4",children:i.jsxs("section",{"data-testid":"detail-transcript",className:ga,children:[i.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Transcript"}),i.jsx("div",{className:"font-mono text-[10px] text-stone-700",children:e.transcript.path??"enabled"}),e.transcript.tailCommand&&i.jsx("button",{type:"button",onClick:()=>Zr(e.transcript.tailCommand),className:"mt-2 w-full border border-stone-300 bg-white/40 px-2 py-1 text-left font-mono text-[8px] uppercase text-stone-700 hover:bg-stone-100",children:"Copy tail command"})]})}):i.jsx("div",{"data-testid":"live-transcript-section",className:"font-mono text-[10px] text-stone-400 p-4",children:"Transcript capture not enabled"})}function xhe({tabs:e,activeTab:t,onSelect:n}){return i.jsx("div",{className:"flex gap-1 border-b border-outline-variant",role:"tablist","data-testid":"live-node-tabs",children:e.map(s=>i.jsx("button",{role:"tab","aria-selected":t===s,"data-testid":`live-tab-${s}`,onClick:()=>n(s),className:`min-h-11 px-3 py-2 font-mono text-[10px] uppercase tracking-wider transition-colors ${t===s?"border-b-2 border-stone-900 text-stone-900 font-bold -mb-px":"text-stone-500 hover:text-stone-700"}`,children:s.replace("-"," ")},s))})}function fz({rigId:e,logicalId:t}){const{data:n,isLoading:s,error:r}=Bfe(e,t),a=C.useMemo(()=>tx(n?[{nodeId:`${n.rigId}::${n.logicalId}`,rigId:n.rigId,rigName:n.rigName,logicalId:n.logicalId,canonicalSessionName:n.canonicalSessionName,agentActivity:n.agentActivity??null,currentQitems:n.currentQitems??null,startupStatus:n.startupStatus,terminalActive:n.terminalActive,hasAssignedWork:n.hasAssignedWork??!1,pendingWorkCount:n.pendingWorkCount??0}]:[]),[n]),l=nx(a),u=n?l.getNodeActivity(`${n.rigId}::${n.logicalId}`,{agentActivity:n.agentActivity??null,currentQitems:n.currentQitems??null,startupStatus:n.startupStatus,terminalActive:n.terminalActive,hasAssignedWork:n.hasAssignedWork??!1,pendingWorkCount:n.pendingWorkCount??0}):null,[d,f]=C.useState("overview"),p=n?n.nodeKind!=="infrastructure":!0,m=["overview","details"];return i.jsx(at,{children:i.jsxs("div",{"data-testid":"live-node-details",className:"space-y-4",children:[i.jsx(wn,{eyebrow:"Live Node Details",title:(n==null?void 0:n.canonicalSessionName)??t,description:`${(n==null?void 0:n.rigName)??e} / ${(n==null?void 0:n.podNamespace)??ar(t)??Ql((n==null?void 0:n.podId)??null)} / ${t}`,actions:n?i.jsx(Gn,{runtime:n.runtime,model:n.model,size:"sm",compact:!0,className:"bg-white/40 backdrop-blur-sm"}):null}),s&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading..."}),r&&i.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:r.message}),n&&i.jsxs(i.Fragment,{children:[i.jsx(ahe,{rigId:e,logicalId:t,data:n}),i.jsx(xhe,{tabs:m,activeTab:d,onSelect:f}),i.jsxs("div",{"data-testid":"live-node-tab-body",className:"space-y-4",children:[d==="overview"&&i.jsx(fhe,{data:n,activityVisual:u}),d==="details"&&i.jsx(hhe,{rigId:e,logicalId:t,data:n,isAgent:p})]})]})]})})}function yhe(e){return`'${e.replace(/'/g,"'\\''")}'`}function vhe(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${yhe(t)}`}function uP({label:e,activeLabel:t,onClick:n,testId:s,tool:r}){const[a,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const d=async()=>{await n()&&(l(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{l(!1),u.current=null},900))};return i.jsxs("button",{type:"button","data-testid":s,"aria-label":e,onClick:()=>{d()},className:he("inline-flex items-center gap-1.5 px-spacing-2 py-1 border font-mono text-[10px] uppercase transition-colors duration-150 ease-tactical",a?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:[r?i.jsx($e,{tool:r,size:"sm"}):null,i.jsx("span",{children:a?t:e})]})}function bhe({session:e,onAdopt:t}){return i.jsx("div",{"data-testid":"discovered-node",className:he("border-dashed border border-foreground/20 bg-[rgba(255,255,255,0.72)] px-spacing-4 py-spacing-3 mb-spacing-2 shadow-[0_10px_28px_rgba(20,20,20,0.04)] backdrop-blur-sm"),children:i.jsxs("div",{className:"flex flex-col gap-spacing-3 lg:flex-row lg:items-center lg:justify-between",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-spacing-3 gap-y-spacing-1",children:[i.jsx("span",{"data-testid":"runtime-badge",children:i.jsx(Gn,{runtime:e.runtimeHint,size:"sm",compact:!0})}),i.jsx("div",{"data-testid":"session-name",className:"font-mono text-[13px] leading-5 text-foreground",title:e.tmuxSession,children:e.tmuxSession}),e.confidence==="medium"?i.jsx("div",{"data-testid":"runtime-inferred-note",className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"runtime inferred"}):null]}),e.cwd?i.jsxs("div",{className:"mt-spacing-2 min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"cwd"}),i.jsx("div",{className:"font-mono text-[12px] leading-5 text-foreground-muted truncate",title:e.cwd,children:e.cwd})]}):null]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-spacing-2 lg:justify-end",children:[i.jsx(uP,{label:"copy tmux",activeLabel:"copied",testId:"copy-tmux-btn",tool:"tmux",onClick:async()=>await Zr(vhe(e))}),e.cwd?i.jsx(uP,{label:"copy cwd",activeLabel:"copied",testId:"copy-cwd-btn",onClick:async()=>await Zr(e.cwd??"")}):null,i.jsx(_e,{variant:"tactical",size:"sm","data-testid":"adopt-btn",onClick:()=>t(e.id),children:"ADOPT"})]})]})})}function whe(){const[e,t]=C.useState(null),[n,s]=C.useState(!1),r=C.useCallback(async()=>{s(!0);try{const a=await fetch("/api/discovery/draft-rig",{method:"POST"});if(!a.ok){t(`# Error: draft generation failed (HTTP ${a.status})`);return}const l=await a.text();t(l)}catch{t("# Error: failed to reach daemon")}finally{s(!1)}},[]);return i.jsxs("div",{className:"mt-spacing-4 border-t border-foreground/10 pt-spacing-4","data-testid":"generate-draft-section",children:[i.jsx(_e,{variant:"tactical",onClick:r,disabled:n,"data-testid":"generate-draft-btn",className:"mb-spacing-3",children:n?"GENERATING...":"GENERATE RIG SPEC"}),e&&(()=>{const a=e.split(`
520
+ `),l=a.filter(d=>d.startsWith("# WARNING:")).map(d=>d.replace(/^# WARNING:\s*/,"")),u=a.filter(d=>!d.startsWith("# WARNING:")).join(`
521
+ `).trim();return i.jsxs("div",{className:"relative",children:[l.length>0&&i.jsx("div",{className:"mb-spacing-2 p-spacing-2 bg-warning/10 border border-warning/30 text-label-sm","data-testid":"draft-warnings",children:l.map((d,f)=>i.jsx("div",{className:"text-warning font-mono",children:d},f))}),i.jsx("pre",{className:"bg-surface-low p-spacing-3 text-label-sm font-mono overflow-x-auto max-h-64 border border-foreground/10","data-testid":"draft-yaml",children:u}),i.jsx("button",{onClick:()=>{var d;return(d=navigator.clipboard)==null?void 0:d.writeText(e)},className:"absolute top-2 right-2 text-label-sm text-foreground-muted hover:text-foreground","data-testid":"copy-draft-btn",children:"COPY"})]})})()]})}function jhe(){var E,k;const{data:e=[]}=dk({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),t=$D(),{data:n=[]}=dr(),s=DY(),r=e,[a,l]=C.useState(null),[u,d]=C.useState(!1),[f,p]=C.useState(""),[m,x]=C.useState(""),y=_=>{l(_),d(!0),p(""),x(""),s.reset()},v=()=>{d(!1),l(null)},b=()=>{!a||!f||!m.trim()||s.mutate({discoveredId:a,rigId:f,logicalId:m.trim()},{onSuccess:v})},w=((E=s.error)==null?void 0:E.message)??null,S=s.isPending;return i.jsx(at,{children:i.jsxs("div",{"data-testid":"discovery-overlay",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-col gap-spacing-4 border-b border-foreground/10 pb-spacing-5 sm:flex-row sm:items-end sm:justify-between",children:[i.jsxs("div",{className:"max-w-[620px]",children:[i.jsx("h2",{className:"text-headline-lg uppercase",children:"DISCOVERY"}),i.jsx("p",{className:"mt-spacing-1 text-body-md text-foreground-muted",children:"Running agent sessions currently visible on this machine. Copy a tmux attach command, review the working directory, or adopt the session into a rig."})]}),i.jsx(_e,{variant:"ghost",size:"sm","data-testid":"scan-now-btn",disabled:t.isPending,onClick:()=>t.mutate(),children:t.isPending?"SCANNING...":"SCAN NOW"})]}),t.isError?i.jsxs("div",{className:"mt-spacing-4 text-label-sm text-destructive","data-testid":"scan-error",children:["Discovery scan failed: ",(k=t.error)==null?void 0:k.message]}):null,r.length===0?i.jsx("div",{className:"py-spacing-8","data-testid":"discovery-empty",children:i.jsx("p",{className:"text-body-md text-foreground-muted",children:"No running Claude or Codex sessions are currently visible."})}):i.jsxs("div",{className:"mt-spacing-6 space-y-spacing-3","data-testid":"discovery-active-section",children:[i.jsxs("div",{className:"mb-spacing-2",children:[i.jsx("h3",{className:"text-headline-sm uppercase",children:"Running agents"}),i.jsxs("p",{className:"text-label-md text-foreground-muted",children:[r.length," session",r.length!==1?"s":""," available to inspect or adopt"]})]}),r.map(_=>i.jsx(bhe,{session:_,onAdopt:y},_.id))]}),i.jsx(whe,{})]}),i.jsx(oz,{open:u,onOpenChange:d,children:i.jsxs(C_,{"data-testid":"adopt-dialog",children:[i.jsxs(E_,{children:[i.jsx(A_,{className:"text-headline-md uppercase",children:"ADOPT SESSION"}),i.jsx(T_,{children:"Bind this session to an existing logical node in the rig."})]}),i.jsxs("div",{className:"space-y-spacing-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"RIG"}),i.jsxs("select",{"data-testid":"adopt-rig-input",value:f,onChange:_=>p(_.target.value),className:"w-full bg-white border-b border-outline py-spacing-1 text-body-md font-mono focus:outline-none focus:border-stone-900 appearance-none cursor-pointer",children:[i.jsx("option",{value:"",children:"Select a rig..."}),n.map(_=>i.jsxs("option",{value:_.id,children:[_.name," (",_.nodeCount," nodes)"]},_.id))]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"LOGICAL ID (required)"}),i.jsx("input",{"data-testid":"adopt-logical-input",type:"text",value:m,onChange:_=>x(_.target.value),className:"w-full bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono focus:outline-none focus:border-primary"}),i.jsx("p",{className:"mt-spacing-1 text-label-sm text-foreground-muted",children:"Enter the logical ID of an existing node in the target rig. For pod placement, use the Discovery drawer instead."})]})]}),w&&i.jsx("p",{className:"text-destructive text-label-sm","data-testid":"adopt-error",children:w}),i.jsxs(R_,{children:[i.jsx(_e,{variant:"ghost",onClick:()=>d(!1),children:"CANCEL"}),i.jsx(_e,{variant:"tactical",onClick:b,disabled:!f||!m.trim()||S,"data-testid":"adopt-confirm",children:S?"ADOPTING...":"ADOPT"})]})]})})]})})}async function She(e){const t=new URLSearchParams;e.qitemId&&t.set("qitem_id",e.qitemId),e.actionVerb&&t.set("action_verb",e.actionVerb),e.actorSession&&t.set("actor_session",e.actorSession),e.since&&t.set("since",e.since),e.until&&t.set("until",e.until),e.limit!==void 0&&t.set("limit",String(e.limit)),e.beforeId&&t.set("before_id",e.beforeId);const n=t.toString(),s=`/api/mission-control/audit${n?`?${n}`:""}`,r=await fetch(s);if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}function hz(e){return qe({queryKey:["mission-control","audit",e],queryFn:()=>She(e)})}const Nhe="openrig.missionControlBearerToken";function khe(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Nhe),t=e==null?void 0:e.trim();return t||null}catch{return null}}function _he(){const e=khe();return e?{Authorization:`Bearer ${e}`}:{}}const pz=["approve","deny","route","annotate","hold","drop","handoff"];async function Che(e){const t=await fetch("/api/mission-control/action",{method:"POST",headers:{"Content-Type":"application/json",..._he()},body:JSON.stringify(e)}),n=await t.json();if(!t.ok){const s=new Error(typeof n=="object"&&n&&"message"in n?String(n.message):`HTTP ${t.status}`);throw typeof n=="object"&&n&&"error"in n&&(s.code=String(n.error)),s.details=n,s}return n}function Ehe(){const e=Mt();return en({mutationFn:Che,onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["mission-control","view"]}),e.invalidateQueries({queryKey:["mission-control","audit"]}),e.invalidateQueries({queryKey:["queue","item",n.qitemId]}),t.createdQitemId&&e.invalidateQueries({queryKey:["queue","item",t.createdQitemId]}),e.invalidateQueries({queryKey:["slices"]})}})}function zi(e){return typeof window>"u"?"":new URL(window.location.href).searchParams.get(e)??""}function Rhe(){var E,k,_,R;const[e,t]=C.useState(()=>zi("qitem_id")||zi("qitem")),[n,s]=C.useState(()=>zi("action_verb")||zi("verb")),[r,a]=C.useState(()=>zi("actor_session")||zi("actor")),[l,u]=C.useState(()=>zi("since")),[d,f]=C.useState(()=>zi("until")),[p]=C.useState(50),[m,x]=C.useState([]),y={qitemId:e||void 0,actionVerb:n||void 0,actorSession:r||void 0,since:l||void 0,until:d||void 0,limit:p,beforeId:m[m.length-1]},v=hz(y);function b(){x([])}function w(){var T;(T=v.data)!=null&&T.nextBeforeId&&x([...m,v.data.nextBeforeId])}function S(){x(m.slice(0,-1))}return i.jsxs("div",{"data-testid":"mc-view-audit-history",className:"space-y-3 p-3",children:[i.jsxs("header",{className:"space-y-0.5",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-stone-500",children:"audit-history"}),i.jsx("h2",{className:"font-headline text-lg text-stone-900",children:"Audit history"}),i.jsxs("p",{className:"text-xs text-stone-600",children:["Browse ",i.jsx("code",{children:"mission_control_actions"})," by qitem, verb, actor, and time range. Read-only."]})]}),i.jsxs("div",{"data-testid":"mc-audit-filters",className:"grid grid-cols-1 gap-2 border border-stone-200 bg-stone-50 p-2 sm:grid-cols-2",children:[i.jsx("input",{type:"text","data-testid":"mc-audit-filter-qitem-id",placeholder:"qitem_id (exact)",value:e,onChange:T=>t(T.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs"}),i.jsxs("select",{"data-testid":"mc-audit-filter-action-verb",value:n,onChange:T=>s(T.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs",children:[i.jsx("option",{value:"",children:"all verbs"}),pz.map(T=>i.jsx("option",{value:T,children:T},T))]}),i.jsx("input",{type:"text","data-testid":"mc-audit-filter-actor-session",placeholder:"actor_session (e.g., operator-alex@kernel)",value:r,onChange:T=>a(T.target.value),className:"border border-stone-300 px-2 py-1 font-mono text-xs"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"datetime-local","data-testid":"mc-audit-filter-since",value:l,onChange:T=>u(T.target.value),className:"flex-1 border border-stone-300 px-2 py-1 font-mono text-[11px]",title:"since"}),i.jsx("input",{type:"datetime-local","data-testid":"mc-audit-filter-until",value:d,onChange:T=>f(T.target.value),className:"flex-1 border border-stone-300 px-2 py-1 font-mono text-[11px]",title:"until"})]}),i.jsx("button",{type:"button","data-testid":"mc-audit-filter-apply",onClick:b,className:"border border-stone-700 bg-stone-800 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.12em] text-white",children:"Apply filters"})]}),v.isLoading?i.jsx("div",{"data-testid":"mc-audit-loading",className:"font-mono text-[10px] text-stone-500",children:"loading..."}):v.isError?i.jsxs("div",{"data-testid":"mc-audit-error",className:"font-mono text-[11px] text-red-700",children:["error: ",v.error.message]}):((E=v.data)==null?void 0:E.rows.length)===0?i.jsx("div",{"data-testid":"mc-audit-empty",className:"font-mono text-[11px] text-stone-500",children:"No audit entries match these filters."}):i.jsx("ul",{"data-testid":"mc-audit-rows",className:"space-y-1",children:(k=v.data)==null?void 0:k.rows.map(T=>i.jsxs("li",{"data-testid":"mc-audit-row","data-action-id":T.actionId,className:"border border-stone-200 bg-white p-2 text-[11px]",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"font-mono uppercase tracking-[0.1em] text-stone-700",children:T.actionVerb}),i.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:T.actedAt})]}),i.jsxs("div",{className:"mt-1 text-stone-700",children:["qitem: ",i.jsx("span",{className:"font-mono",children:T.qitemId??"—"})]}),i.jsxs("div",{className:"text-stone-700",children:["actor: ",i.jsx("span",{className:"font-mono",children:T.actorSession})]}),T.reason?i.jsxs("div",{className:"text-stone-700",children:["reason: ",i.jsx("span",{className:"italic",children:T.reason})]}):null,T.annotation?i.jsxs("div",{className:"text-stone-700",children:["annotation: ",i.jsx("span",{className:"italic",children:T.annotation})]}):null]},T.actionId))}),i.jsxs("footer",{"data-testid":"mc-audit-pagination",className:"flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx("button",{type:"button","data-testid":"mc-audit-prev-page",onClick:S,disabled:m.length===0,className:"border border-stone-300 px-2 py-0.5 disabled:opacity-50",children:"← prev"}),i.jsxs("span",{children:["rows: ",((_=v.data)==null?void 0:_.rows.length)??0]}),i.jsx("button",{type:"button","data-testid":"mc-audit-next-page",onClick:w,disabled:!((R=v.data)!=null&&R.hasMore),className:"border border-stone-300 px-2 py-0.5 disabled:opacity-50",children:"next →"})]})]})}function Ahe(){const e=[{pos:"top-[18%] left-[36%]",text:"▪ 03°",size:"text-[10px]"},{pos:"top-[24%] right-[34%]",text:"**",size:"text-base"},{pos:"top-[44%] left-[44%]",text:"+",size:"text-sm"},{pos:"top-[52%] right-[36%]",text:"(A)",size:"text-[10px]"},{pos:"bottom-[34%] left-[20%]",text:"[?]",size:"text-sm"},{pos:"bottom-[42%] right-[24%]",text:"▪ 06°",size:"text-[10px]"},{pos:"bottom-[18%] left-[58%]",text:"+",size:"text-sm"}];return i.jsx(i.Fragment,{children:e.map((t,n)=>i.jsx("span",{className:`absolute ${t.pos} ${t.size??"text-xs"} font-mono text-stone-900 leading-none`,children:t.text},n))})}function The({tier:e="mid"}){const t=e==="mid"?"text-base":"text-2xl",n=[{pos:"top-[22%] left-[58%]",text:"■ 03°"},{pos:"top-[60%] left-[18%]",text:"+"},{pos:"bottom-[26%] right-[40%]",text:"■ 06°"},{pos:"top-[68%] right-[22%]",text:"▣"},{pos:"top-[72%] left-[8%]",text:"**"},{pos:"top-[86%] right-[5%]",text:"(A)"}];return i.jsx(i.Fragment,{children:n.map((s,r)=>i.jsx("span",{className:`absolute ${s.pos} ${t} font-mono text-stone-900 leading-none`,children:s.text},r))})}function mz({hostname:e="127.0.0.1"}={}){return i.jsxs("div",{"data-testid":"mid-layer","aria-hidden":"true",className:"absolute inset-0 z-[10] overflow-hidden pointer-events-none select-none",children:[i.jsxs("div",{className:"absolute top-[64%] left-[3%] font-mono text-[11px] text-stone-900 leading-tight max-w-[180px]",children:[i.jsx("div",{className:"font-bold uppercase",children:"▪ 06° Field Report"}),i.jsxs("div",{className:"text-stone-800 mt-1",children:["Operator session captured at field station ",e," — release 0.3.1; daemon trace nominal."]})]}),i.jsxs("div",{className:"absolute bottom-[8%] left-[6%] font-mono text-[11px] text-stone-900 leading-tight max-w-[180px]",children:[i.jsx("div",{className:"font-bold uppercase",children:"Data Streams ⚠⚠"}),i.jsxs("div",{className:"text-stone-800 mt-1 text-[10px]",children:["x-axis(1) y-axis(2) z-axis(3) — synchronized at ",e]})]}),i.jsx(The,{tier:"mid"})]})}function gz({hostname:e="127.0.0.1",totalRigs:t=1,totalAgents:n=4,activeAgents:s=4}={}){return i.jsxs("div",{"data-testid":"top-layer",className:"absolute inset-0 z-20 pointer-events-none select-none",children:[i.jsx("div",{"data-testid":"dashboard-classification",className:"absolute top-0 inset-x-0 border-b border-stone-900/40 bg-background/40 backdrop-blur-[6px]",children:i.jsxs("div",{className:"mx-auto max-w-[1180px] px-6 py-2 flex items-center justify-between gap-4 font-mono text-[10px] uppercase tracking-[0.32em] text-stone-700",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"inline-block w-1.5 h-1.5 bg-success rounded-none"}),"Operator"]}),i.jsx("span",{className:"hidden sm:inline",children:"▪ OpenRig · 0.3.1"}),i.jsxs("span",{className:"hidden md:inline",children:["▪ Field Station ",e]}),i.jsx("span",{className:"hidden md:inline",children:"▪ Session 04°"}),i.jsx("span",{className:"text-stone-500",children:"04°"})]})}),i.jsxs("div",{className:"absolute top-[44px] left-[5%] right-[5%] z-20 pointer-events-none",children:[i.jsxs("h1",{"data-testid":"dashboard-greeting",className:"font-headline text-[44px] font-black tracking-tight uppercase text-stone-900 leading-[0.95] inky-display",children:["Welcome back",i.jsx("sup",{className:"text-[22px] tracking-tight align-super",children:"(s*)"})]}),i.jsxs("div",{"data-testid":"dashboard-stats",className:"font-mono text-xs text-stone-700 mt-2 flex flex-wrap items-baseline gap-x-4 gap-y-1",children:[i.jsxs("span",{"data-testid":"stat-rigs",className:"inline-flex items-baseline gap-1.5",children:[i.jsx("span",{className:"text-stone-900 font-bold tabular-nums text-sm",children:String(t).padStart(2,"0")}),i.jsx("span",{className:"uppercase tracking-[0.12em] text-[10px]",children:"rigs"})]}),i.jsx("span",{"aria-hidden":"true",className:"text-stone-300",children:"·"}),i.jsxs("span",{"data-testid":"stat-agents",className:"inline-flex items-baseline gap-1.5",children:[i.jsx("span",{className:"text-stone-900 font-bold tabular-nums text-sm",children:String(n).padStart(2,"0")}),i.jsx("span",{className:"uppercase tracking-[0.12em] text-[10px]",children:"agents"}),i.jsx("span",{className:"ml-1 text-stone-600",children:"("}),i.jsx("span",{className:"text-success font-bold tabular-nums",children:String(s).padStart(2,"0")}),i.jsx("span",{className:"uppercase tracking-[0.12em] text-[10px] text-success",children:"active"}),i.jsx("span",{className:"text-stone-600",children:")"})]})]})]}),i.jsx("div",{className:"absolute bottom-8 right-10 rotate-[-4deg] origin-bottom-right",children:i.jsx("span",{className:"font-headline font-black text-[13px] tracking-[0.02em] text-stone-900 uppercase inky-text",children:"Eyes Everywhere"})}),i.jsx(Ahe,{}),i.jsx("div",{className:"absolute left-2 top-[42%] font-mono text-[9px] uppercase tracking-[0.2em] text-stone-600 rotate-[-90deg] origin-top-left whitespace-nowrap",children:"▪ Author redacted · entry 04°"}),i.jsx("div",{"data-testid":"dashboard-footer-marginalia",className:"absolute bottom-0 inset-x-0 border-t border-stone-900/40 bg-background/40 backdrop-blur-[6px]",children:i.jsxs("div",{className:"mx-auto max-w-[1180px] px-6 py-2 flex items-center justify-between gap-4 font-mono text-[10px] uppercase tracking-[0.24em] text-stone-700",children:[i.jsx("span",{children:"▪▪▪ End Surface · Dashboard · 01°"}),i.jsx("span",{className:"hidden sm:inline",children:"Operator-Grade · ConfigStore-Backed"}),i.jsx("span",{children:"OpenRig · 0.3.1"})]})})]})}function ws({position:e}){const t={tl:"top-1.5 left-1.5",tr:"top-1.5 right-1.5",bl:"bottom-1.5 left-1.5",br:"bottom-1.5 right-1.5"}[e],n={tl:"M 10 0 L 0 0 L 0 10",tr:"M 0 0 L 10 0 L 10 10",bl:"M 0 0 L 0 10 L 10 10",br:"M 10 0 L 10 10 L 0 10"}[e];return i.jsx("svg",{className:`absolute ${t} w-2.5 h-2.5 text-stone-900 pointer-events-none select-none`,viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",children:i.jsx("path",{d:n})})}function Pl(e){const{to:t,num:n,big:s,label:r,icon:a,body:l,graphic:u,positionClass:d,accent:f,washed:p,layout:m="numeral",callouts:x,tint:y="white",shadow:v="none"}=e,b=p?"inky-display":"",w=p?"inky-text":"",S={white:"bg-white/30",cream:"bg-amber-50/45",stone:"bg-stone-100/45",rose:"bg-rose-50/45",slate:"bg-slate-50/50",sepia:"bg-yellow-50/45",mint:"bg-emerald-50/40"},E={none:{},soft:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.08)"},hard:{boxShadow:"3px 3px 0px #2e342e"},paper:{boxShadow:"0 2px 6px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.07)"},long:{boxShadow:"6px 6px 18px rgba(0, 0, 0, 0.1)"},inset:{boxShadow:"inset 0 1px 2px rgba(255,255,255,0.7), 0 2px 4px rgba(0,0,0,0.04)"},halo:{boxShadow:"0 0 24px rgba(0, 0, 0, 0.12)"},ambient:{boxShadow:["0 2px 4px rgba(0, 0, 0, 0.14)","0 8px 20px rgba(0, 0, 0, 0.16)","0 0 40px rgba(0, 0, 0, 0.12)"].join(", ")}},k=s??n;return i.jsx(Ve,{to:t,"data-testid":`dashboard-card-${n}`,className:`absolute ${d} w-[28%] h-[220px] pointer-events-auto group block`,children:i.jsxs("article",{"data-testid":`destination-${n}`,style:E[v],className:`relative h-full ${S[y]} backdrop-blur-[10px] overflow-hidden transition-transform duration-300 ease-tactical group-hover:-translate-y-0.5 motion-reduce:transition-none motion-reduce:group-hover:translate-y-0`,children:[i.jsx(ws,{position:"tl"}),i.jsx(ws,{position:"tr"}),i.jsx(ws,{position:"bl"}),i.jsx(ws,{position:"br"}),i.jsxs("span",{className:"absolute top-2 right-6 font-mono text-[9px] uppercase tracking-[0.18em] text-stone-700 select-none",children:["■ ",n,"°"]}),m==="headline"&&i.jsx(Mhe,{label:r,icon:a,body:l,graphic:u,to:t,accent:f,textClass:w}),m==="stat"&&i.jsx(Ohe,{label:r,num:n,icon:a,body:l,graphic:u,to:t,accent:f,textClass:w}),m==="coordinate"&&i.jsx(Lhe,{label:r,num:n,icon:a,body:l,graphic:u,to:t,accent:f,textClass:w}),m==="schematic"&&i.jsx(Phe,{label:r,num:n,icon:a,body:l,graphic:u,to:t,accent:f,textClass:w,callouts:x,washed:p}),(m==="numeral"||!m)&&i.jsx(Ihe,{big:k,numClass:b,graphic:u,body:l,label:r,icon:a,to:t,accent:f,textClass:w}),f&&i.jsxs("div",{className:"absolute bottom-[88px] right-[-14px] w-[156px] border border-tertiary text-tertiary font-mono text-[7.5px] uppercase tracking-[0.18em] px-1.5 py-[2px] flex items-center gap-1 bg-background/30",children:[i.jsx("span",{className:"inline-block w-[3px] h-[3px] bg-tertiary rounded-full"}),"Warning · Operator Live"]})]})})}function Ihe({big:e,numClass:t,graphic:n,body:s,label:r,icon:a,to:l,accent:u,textClass:d}){return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`absolute top-7 left-3 font-headline font-black text-[110px] leading-[0.82] tracking-[-0.06em] text-stone-900 select-none ${t}`,children:[e[0],i.jsx("sup",{className:"text-[55px] tracking-tight align-super",children:e[1]})]}),i.jsx("div",{className:"absolute top-7 right-7 w-[58px] h-[58px]",children:n}),i.jsx("p",{className:`absolute bottom-12 right-1 w-[140px] font-mono text-[8.5px] leading-[1.35] uppercase text-stone-900 ${d}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:u?"text-tertiary":"text-stone-900",children:a}),i.jsx("h2",{className:`font-headline font-black text-[17px] leading-none uppercase tracking-tight ${d} ${u?"text-tertiary":"text-stone-900"}`,children:r}),i.jsxs("span",{className:`ml-auto font-mono text-[9px] tracking-tight text-stone-500 ${d}`,children:["[",l,"] →"]})]})]})}function Mhe({label:e,icon:t,body:n,graphic:s,to:r,accent:a,textClass:l}){return i.jsxs(i.Fragment,{children:[i.jsx("h2",{className:`absolute top-6 left-3 right-3 font-headline font-black text-[40px] leading-[0.95] uppercase tracking-tight text-stone-900 ${l} ${a?"text-tertiary":""}`,children:e}),i.jsx("div",{className:"absolute top-[88px] left-3 right-3 h-px bg-stone-900/30"}),i.jsx("div",{className:"absolute top-[100px] left-3 w-[60px] h-[60px]",children:s}),i.jsx("p",{className:`absolute top-[100px] left-[80px] right-1 font-mono text-[8.5px] leading-[1.35] uppercase text-stone-900 ${l}`,children:n}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:a?"text-tertiary":"text-stone-900",children:t}),i.jsx("span",{className:`font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 ${l}`,children:"Destination · 01°"}),i.jsxs("span",{className:`ml-auto font-mono text-[9px] tracking-tight text-stone-500 ${l}`,children:["[",r,"] →"]})]})]})}function Ohe({label:e,num:t,icon:n,body:s,graphic:r,to:a,accent:l,textClass:u}){return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"absolute top-3 left-3 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 select-none",children:["▪ ",e," · ",t,"°"]}),i.jsx("div",{className:"absolute top-9 right-9 w-[36px] h-[36px]",children:r}),i.jsxs("div",{className:"absolute top-[44px] left-3 flex items-baseline gap-3",children:[i.jsx("span",{className:`font-headline font-black text-[64px] leading-[0.82] tracking-[-0.04em] text-stone-900 tabular-nums ${u}`,children:"38"}),i.jsxs("div",{className:"flex flex-col leading-tight",children:[i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide text-stone-900",children:"Active"}),i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide text-stone-700",children:"Artifacts"})]})]}),i.jsxs("div",{className:"absolute top-[120px] left-3 right-3 grid grid-cols-3 gap-0",children:[i.jsx(zS,{big:"12",small:"Specs"}),i.jsx(zS,{big:"08",small:"Plugins"}),i.jsx(zS,{big:"18",small:"Skills"})]}),i.jsx("p",{className:`absolute bottom-12 left-3 right-1 font-mono text-[8px] leading-[1.3] uppercase text-stone-800 ${u}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:l?"text-tertiary":"text-stone-900",children:n}),i.jsx("h2",{className:`font-headline font-black text-[15px] leading-none uppercase tracking-tight ${l?"text-tertiary":"text-stone-900"}`,children:e}),i.jsxs("span",{className:"ml-auto font-mono text-[9px] tracking-tight text-stone-500",children:["[",a,"] →"]})]})]})}function zS({big:e,small:t}){return i.jsxs("div",{className:"border-l border-stone-900/30 first:border-l-0 pl-2",children:[i.jsx("div",{className:"font-mono text-[14px] font-bold tabular-nums text-stone-900 leading-none",children:e}),i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-wide text-stone-600 mt-0.5",children:t})]})}function Lhe({label:e,num:t,icon:n,body:s,graphic:r,to:a,accent:l,textClass:u}){const d=Array.from({length:12});return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"absolute top-3 left-3 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 select-none",children:["▪ ",e," · ",t,"°"]}),i.jsx("div",{className:"absolute top-7 left-6 right-6 flex justify-between",children:d.map((f,p)=>i.jsx("span",{className:`w-px h-[6px] ${p%3===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute bottom-12 left-6 right-6 flex justify-between",children:d.map((f,p)=>i.jsx("span",{className:`w-px h-[6px] ${p%3===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute top-12 bottom-16 left-3 flex flex-col justify-between",children:Array.from({length:8}).map((f,p)=>i.jsx("span",{className:`h-px w-[6px] ${p%2===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute top-12 bottom-16 right-3 flex flex-col justify-between",children:Array.from({length:8}).map((f,p)=>i.jsx("span",{className:`h-px w-[6px] ${p%2===0?"bg-stone-900":"bg-stone-900/40"}`},p))}),i.jsx("div",{className:"absolute top-[40px] left-1/2 -translate-x-1/2 w-[72px] h-[72px]",children:r}),i.jsx("div",{className:"absolute top-[76px] left-6 right-6 h-px bg-stone-900/30"}),i.jsx("div",{className:"absolute top-[40px] bottom-[80px] left-1/2 w-px bg-stone-900/30"}),i.jsx("span",{className:"absolute top-[120px] left-1/2 ml-1 font-mono text-[8px] text-stone-700",children:"⟨x: 24, y: 18⟩"}),i.jsx("p",{className:`absolute bottom-[60px] left-6 right-6 font-mono text-[8px] leading-[1.3] uppercase text-stone-800 text-center ${u}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:l?"text-tertiary":"text-stone-900",children:n}),i.jsx("h2",{className:"font-headline font-black text-[15px] leading-none uppercase tracking-tight text-stone-900",children:e}),i.jsxs("span",{className:"ml-auto font-mono text-[9px] tracking-tight text-stone-500",children:["[",a,"] →"]})]})]})}function Phe({label:e,num:t,icon:n,body:s,graphic:r,to:a,accent:l,textClass:u,callouts:d,washed:f}){const p=d??["A","B","C","D"];return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"absolute top-3 left-3 font-mono text-[9px] uppercase tracking-[0.16em] text-stone-700 select-none",children:["▪ ",e," · ",t,"°"]}),i.jsx("div",{className:"absolute top-7 left-1/2 -translate-x-1/2 w-[110px] h-[110px]",children:r}),i.jsx($p,{num:".01",label:p[0],positionClass:"top-[42px] left-3",align:"left"}),i.jsx($p,{num:".02",label:p[1],positionClass:"top-[42px] right-3",align:"right"}),i.jsx($p,{num:".03",label:p[2],positionClass:"top-[98px] left-3",align:"left"}),i.jsx($p,{num:".04",label:p[3],positionClass:"top-[98px] right-3",align:"right"}),i.jsx("p",{className:`absolute bottom-12 left-3 right-3 font-mono text-[8px] leading-[1.3] uppercase text-stone-800 text-center ${u}`,children:s}),i.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex items-baseline gap-2",children:[i.jsx("span",{className:l?"text-tertiary":"text-stone-900",children:n}),i.jsx("h2",{className:`font-headline font-black text-[15px] leading-none uppercase tracking-tight ${f?"inky-text":""} ${l?"text-tertiary":"text-stone-900"}`,children:e}),i.jsxs("span",{className:"ml-auto font-mono text-[9px] tracking-tight text-stone-500",children:["[",a,"] →"]})]})]})}function $p({num:e,label:t,positionClass:n,align:s}){return i.jsxs("div",{className:`absolute ${n} font-mono text-[8px] text-stone-700 ${s==="right"?"text-right":"text-left"}`,children:[i.jsx("span",{className:"block",children:e}),i.jsx("span",{className:"block tabular-nums text-stone-900",children:t})]})}function $he(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("path",{d:"M2 26 Q 18 18 30 22 T 58 18"}),i.jsx("path",{d:"M2 36 Q 18 28 30 32 T 58 28",strokeDasharray:"2 2"}),i.jsx("path",{d:"M2 46 Q 18 40 30 42 T 58 38",strokeDasharray:"2 2"}),i.jsx("circle",{cx:"30",cy:"22",r:"2",fill:"currentColor"}),i.jsx("line",{x1:"30",y1:"22",x2:"30",y2:"10"}),i.jsx("text",{x:"34",y:"12",fontSize:"6",fontFamily:"monospace",fill:"currentColor",fontWeight:"bold",children:"[01]"})]})}function Dhe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("rect",{x:"22",y:"6",width:"16",height:"8"}),i.jsx("rect",{x:"6",y:"28",width:"14",height:"8"}),i.jsx("rect",{x:"40",y:"28",width:"14",height:"8"}),i.jsx("rect",{x:"6",y:"48",width:"14",height:"6"}),i.jsx("rect",{x:"22",y:"48",width:"14",height:"6"}),i.jsx("rect",{x:"40",y:"48",width:"14",height:"6"}),i.jsx("line",{x1:"30",y1:"14",x2:"13",y2:"28"}),i.jsx("line",{x1:"30",y1:"14",x2:"47",y2:"28"}),i.jsx("line",{x1:"13",y1:"36",x2:"13",y2:"48"}),i.jsx("line",{x1:"47",y1:"36",x2:"47",y2:"48"}),i.jsx("line",{x1:"13",y1:"44",x2:"29",y2:"48"}),i.jsx("line",{x1:"47",y1:"44",x2:"29",y2:"48"})]})}function qhe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("circle",{cx:"30",cy:"30",r:"4",fill:"currentColor"}),i.jsx("circle",{cx:"30",cy:"30",r:"12"}),i.jsx("circle",{cx:"30",cy:"30",r:"20",strokeDasharray:"2 3"}),i.jsx("circle",{cx:"30",cy:"30",r:"27",strokeDasharray:"2 4"}),i.jsx("line",{x1:"30",y1:"0",x2:"30",y2:"60",strokeDasharray:"2 3"}),i.jsx("line",{x1:"0",y1:"30",x2:"60",y2:"30",strokeDasharray:"2 3"})]})}function zhe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("circle",{cx:"30",cy:"30",r:"26"}),i.jsx("ellipse",{cx:"30",cy:"30",rx:"26",ry:"9"}),i.jsx("ellipse",{cx:"30",cy:"30",rx:"9",ry:"26"}),i.jsx("line",{x1:"0",y1:"30",x2:"60",y2:"30",strokeDasharray:"2 3"}),i.jsx("line",{x1:"30",y1:"0",x2:"30",y2:"60",strokeDasharray:"2 3"}),i.jsx("circle",{cx:"30",cy:"30",r:"3",fill:"currentColor"})]})}function Bhe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1.2",children:[i.jsx("circle",{cx:"24",cy:"24",r:"14"}),i.jsx("line",{x1:"20",y1:"24",x2:"28",y2:"24"}),i.jsx("line",{x1:"24",y1:"20",x2:"24",y2:"28"}),i.jsx("line",{x1:"34",y1:"34",x2:"52",y2:"52",strokeWidth:"1.6"}),i.jsx("line",{x1:"48",y1:"48",x2:"55",y2:"48"}),i.jsx("line",{x1:"48",y1:"48",x2:"48",y2:"55"})]})}function Fhe(){return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"none",stroke:"currentColor",strokeWidth:"1",children:[i.jsx("circle",{cx:"30",cy:"30",r:"20"}),i.jsx("circle",{cx:"30",cy:"30",r:"12"}),i.jsx("circle",{cx:"30",cy:"30",r:"3",fill:"currentColor"}),i.jsx("line",{x1:"30",y1:"6",x2:"30",y2:"11",strokeWidth:"1.5"}),i.jsx("line",{x1:"30",y1:"49",x2:"30",y2:"54",strokeWidth:"1.5"}),i.jsx("line",{x1:"6",y1:"30",x2:"11",y2:"30",strokeWidth:"1.5"}),i.jsx("line",{x1:"49",y1:"30",x2:"54",y2:"30",strokeWidth:"1.5"}),i.jsx("line",{x1:"13",y1:"13",x2:"17",y2:"17",strokeWidth:"1.5"}),i.jsx("line",{x1:"43",y1:"13",x2:"47",y2:"17",strokeWidth:"1.5"}),i.jsx("line",{x1:"13",y1:"47",x2:"17",y2:"43",strokeWidth:"1.5"}),i.jsx("line",{x1:"43",y1:"47",x2:"47",y2:"43",strokeWidth:"1.5"})]})}function xz({librarySize:e}={}){const t=e&&e>0?`Specs · Plugins · Skills · Context packs. Field catalog 0.3.1 — ${e} active artifacts.`:"Specs · Plugins · Skills · Context packs. Field catalog 0.3.1 — 38 active artifacts.";return i.jsxs("div",{"data-testid":"destinations-layer",className:"absolute inset-0 z-[18] pointer-events-none",children:[i.jsx(Pl,{to:"/topology",num:"01",big:"01",label:"Topology",icon:i.jsx(P2,{className:"h-4 w-4"}),body:"Host · Rig · Pod · Seat tree — live edges + runtimes; drill into any rig's pod graph.",positionClass:"top-[22%] left-[5%]",graphic:i.jsx(Dhe,{}),layout:"numeral",callouts:["HOST","RIG","POD","SEAT"],tint:"stone",shadow:"ambient"}),i.jsx(Pl,{to:"/project",num:"02",big:"02",label:"Project",icon:i.jsx(L2,{className:"h-4 w-4"}),body:"Workspace · Mission · Slice. Browse all in-flight work by what agents are doing, not by repo.",positionClass:"top-[22%] left-[36%]",graphic:i.jsx($he,{}),layout:"numeral",callouts:["WORKSPACE","MISSION","SLICE","TASK"],washed:!0,tint:"stone",shadow:"ambient"}),i.jsx(Pl,{to:"/for-you",num:"03",big:"03",label:"For You",icon:i.jsx(D2,{className:"h-4 w-4"}),body:"Action feed → what needs you · what shipped · what's in flight. Prioritized for the operator.",positionClass:"top-[22%] left-[67%]",graphic:i.jsx(qhe,{}),layout:"numeral",callouts:["NEEDS YOU","SHIPPED","IN-FLIGHT","BLOCKED"],accent:!0,tint:"stone",shadow:"ambient"}),i.jsx(Pl,{to:"/specs",num:"04",big:"04",label:"Library",icon:i.jsx(H$,{className:"h-4 w-4"}),body:t,positionClass:"top-[55%] left-[5%]",graphic:i.jsx(zhe,{}),layout:"numeral",callouts:["SPECS","PLUGINS","SKILLS","PACKS"],tint:"stone",shadow:"ambient"}),i.jsx(Pl,{to:"/search",num:"05",big:"05",label:"Search & Audit",icon:i.jsx(xG,{className:"h-4 w-4"}),body:"Audit history · full artifact explorer. V1 placeholder; the full surface ships in V2.",positionClass:"top-[55%] left-[36%]",graphic:i.jsx(Bhe,{}),layout:"numeral",callouts:["AUDIT","HISTORY","QUERY","FILTER"],tint:"stone",shadow:"ambient"}),i.jsx(Pl,{to:"/settings",num:"06",big:"06",label:"Settings",icon:i.jsx(F$,{className:"h-4 w-4"}),body:"Config · Policy · Log · Status. Operator-grade controls; ConfigStore-backed; reversible.",positionClass:"top-[55%] left-[67%]",graphic:i.jsx(Fhe,{}),layout:"numeral",callouts:["CONFIG","POLICY","LOG","STATUS"],tint:"stone",shadow:"ambient"})]})}function Hhe(){const{data:e}=dr(),{data:t}=Xm(),{data:n}=Rc(),s=(e==null?void 0:e.length)??0,r=(e==null?void 0:e.reduce((d,f)=>d+f.nodeCount,0))??0,a=(t==null?void 0:t.reduce((d,f)=>d+(f.activeCount??f.runningCount),0))??0,l=(n==null?void 0:n.length)??0,u=typeof window>"u"?"localhost":window.location.hostname||"localhost";return i.jsxs("div",{"data-testid":"dashboard-surface",className:"relative min-h-screen overflow-hidden",children:[i.jsx(mz,{hostname:u}),i.jsx(gz,{hostname:u,totalRigs:s,totalAgents:r,activeAgents:a}),i.jsx(xz,{librarySize:l})]})}async function Uhe(e){const t=new URLSearchParams({attention:"1"});e!==void 0&&t.set("limit",String(e));const n=await fetch(`/api/queue/list?${t.toString()}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function Vhe(e=50){return qe({queryKey:["attention-items",e],queryFn:()=>Uhe(e),staleTime:15e3,refetchOnWindowFocus:"always"})}function s2(e){return typeof e=="string"&&e.length>0?e:void 0}function ln(e,...t){for(const n of t){const s=s2(e[n]);if(s)return s}}function Ghe(e){if(e)return e.length<=28?e:`${e.slice(0,18)}...${e.slice(-6)}`}function Khe(e){switch(e){case"queue.created":case"queue.item.created":return"Queue item created";case"queue.updated":case"queue.item.updated":return"Queue item updated";case"queue.handed_off":return"Queue item handed off";case"queue.claimed":return"Queue item claimed";case"queue.unclaimed":return"Queue item unclaimed";case"qitem.fallback_routed":return"Queue item fallback routed";case"qitem.closure_overdue":return"Queue item closure overdue";case"inbox.absorbed":return"Inbox item absorbed";case"inbox.denied":return"Inbox item denied";default:return e}}function Whe(e){return e==="queue.created"||e==="queue.updated"||e==="queue.claimed"||e==="queue.unclaimed"||e==="queue.handed_off"||e==="queue.item.created"||e==="queue.item.updated"||e==="qitem.fallback_routed"||e==="qitem.closure_overdue"||e==="inbox.absorbed"||e==="inbox.denied"}function Yhe(e,t){return e.startsWith("queue.")&&e.endsWith(".closed")?"shipped":e==="qitem.closure_overdue"||e==="inbox.denied"||t==="human-gate"||t==="pending-approval"?"action-required":t==="closeout-pending-ratify"?"approval":t==="done"||t==="closed"||t==="completed"||t==="shipped"?"shipped":"progress"}function Qhe(e){const t=ln(e,"sourceSession","source_session","fromSession"),n=ln(e,"destinationSession","destination_session","toSession","destination"),s=t&&n?`${t} -> ${n}`:t?`Source: ${t}`:n?`Destination: ${n}`:void 0,r=[ln(e,"priority")?`priority=${ln(e,"priority")}`:void 0,ln(e,"tier")?`tier=${ln(e,"tier")}`:void 0,ln(e,"state","toState")?`state=${ln(e,"state","toState")}`:void 0,ln(e,"closureReason")?`closure=${ln(e,"closureReason")}`:void 0].filter(a=>!!a);return[s,r.length>0?r.join(" / "):void 0].filter(a=>!!a).join(`
522
+ `)||void 0}function Xhe(e){return/^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/.test(e??"")}function Zhe(e){const t=e.payload??{},n=ln(t,"actor_session","actorSession","source_session","sourceSession","fromSession","sender"),s=ln(t,"rig_id","rigId"),r=ln(t,"summary","body","title"),a={id:`${e.type}-${e.seq}`,title:r??e.type,body:s2(t.body),authorSession:n,rigId:s,receivedAt:e.receivedAt,createdAt:e.createdAt,source:e};if(e.type.startsWith("queue.")&&e.type.endsWith(".closed"))return{...a,kind:"shipped"};if(Whe(e.type)){const l=ln(t,"qitemId","qitem_id"),u=ln(t,"destinationSession","destination_session","toSession","destination"),d=ln(t,"state","toState"),f=Yhe(e.type,d),p=f==="approval"?"approval":Xhe(u)?"action-required":f,m=ln(t,"summary","title"),x=p==="shipped"&&e.type==="queue.updated"?"Queue item shipped":Khe(e.type),y=m??[x,Ghe(l)].filter(v=>!!v).join(": ");return{...a,title:y,body:s2(t.body)??Qhe(t),kind:p}}return e.type.startsWith("workflow.")?{...a,kind:"progress"}:e.type.startsWith("stream.")||e.type.startsWith("watchdog.")?{...a,kind:"observation"}:e.type.startsWith("lifecycle.")||e.type.startsWith("git.")?{...a,kind:"shipped"}:{...a,kind:"observation"}}function Jhe(e){return e.map(Zhe).filter(n=>n!==null).sort((n,s)=>s.receivedAt-n.receivedAt)}const dP=new Set(["action-required","approval"]);function epe(e){const t=(r,a)=>a.receivedAt-r.receivedAt,n=e.filter(r=>dP.has(r.kind)).sort(t),s=e.filter(r=>!dP.has(r.kind)).sort(t);return[...n,...s]}const tpe=/^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/;function npe(e){return e.tier==="human-gate"?"approval":(tpe.test(e.destinationSession??""),"action-required")}function spe(e){const t=npe(e),n=`queue-attention-${e.qitemId}`,s=Date.parse(e.tsUpdated)||Date.now(),r=e.tsUpdated||e.tsCreated||new Date().toISOString(),a={seq:-1,type:"queue.attention.synthetic",payload:{qitemId:e.qitemId,destinationSession:e.destinationSession,sourceSession:e.sourceSession,tier:e.tier,state:e.state,body:e.body},createdAt:r,receivedAt:s},l=t==="approval"?`Approval needed: ${e.qitemId.slice(0,24)}`:`Action required: ${e.qitemId.slice(0,24)}`;return{id:n,kind:t,title:l,body:e.body,authorSession:e.sourceSession,receivedAt:s,createdAt:r,source:a}}function rpe(e,t){const n=new Set;for(const r of t){const a=fP(r);a&&n.add(a)}const s=e.filter(r=>{if(r.kind!=="action-required"&&r.kind!=="approval")return!0;const a=fP(r);return a?!n.has(a):!0});return[...t,...s]}const ipe="queue-attention-";function r2(e){return e.id.startsWith(ipe)}function ape(e){return e.filter(t=>!r2(t)).map(t=>t.source.seq)}function fP(e){const t=e.source.payload??{};return typeof t.qitemId=="string"&&t.qitemId.length>0?t.qitemId:typeof t.qitem_id=="string"&&t.qitem_id.length>0?t.qitem_id:null}const yz="forYou.dismissedSeqs";function ope(){try{const e=localStorage.getItem(yz);if(!e)return new Set;const t=JSON.parse(e);if(!Array.isArray(t))return new Set;const n=t.filter(s=>typeof s=="number"&&Number.isFinite(s));return new Set(n)}catch{return new Set}}function BS(e){try{localStorage.setItem(yz,JSON.stringify(Array.from(e)))}catch{}}function lpe(e){const[t,n]=C.useState(()=>ope()),s=C.useMemo(()=>{if(e.length===0)return null;let l=e[0];for(const u of e)u<l&&(l=u);return l},[e]);C.useEffect(()=>{if(s===null)return;let l=!1;const u=new Set;for(const d of t)d>=s?u.add(d):l=!0;l&&(n(u),BS(u))},[s,t]);const r=C.useCallback(l=>{n(u=>{if(u.has(l))return u;const d=new Set(u);return d.add(l),BS(d),d})},[]),a=C.useCallback(l=>{n(u=>{if(!u.has(l))return u;const d=new Set(u);return d.delete(l),BS(d),d})},[]);return{dismissedSeqs:t,dismiss:r,undismiss:a}}const vz="forYou.dismissedCardIds";function cpe(){try{const e=localStorage.getItem(vz);if(!e)return new Set;const t=JSON.parse(e);if(!Array.isArray(t))return new Set;const n=t.filter(s=>typeof s=="string"&&s.length>0);return new Set(n)}catch{return new Set}}function FS(e){try{localStorage.setItem(vz,JSON.stringify(Array.from(e)))}catch{}}function upe(e){const[t,n]=C.useState(()=>cpe()),s=C.useMemo(()=>new Set(e),[e]);C.useEffect(()=>{if(s.size===0)return;let l=!1;const u=new Set;for(const d of t)s.has(d)?u.add(d):l=!0;l&&(n(u),FS(u))},[s,t]);const r=C.useCallback(l=>{n(u=>{if(u.has(l))return u;const d=new Set(u);return d.add(l),FS(d),d})},[]),a=C.useCallback(l=>{n(u=>{if(!u.has(l))return u;const d=new Set(u);return d.delete(l),FS(d),d})},[]);return{dismissedIds:t,dismiss:r,undismiss:a}}const bz="forYou.completedMissionIds";function dpe(){try{const e=localStorage.getItem(bz);if(!e)return new Set;const t=JSON.parse(e);if(!Array.isArray(t))return new Set;const n=t.filter(s=>typeof s=="string"&&s.length>0);return new Set(n)}catch{return new Set}}function hP(e){try{localStorage.setItem(bz,JSON.stringify(Array.from(e)))}catch{}}function fpe(){const[e,t]=C.useState(()=>dpe()),n=C.useCallback(r=>{t(a=>{if(a.has(r))return a;const l=new Set(a);return l.add(r),hP(l),l})},[]),s=C.useCallback(r=>{t(a=>{if(!a.has(r))return a;const l=new Set(a);return l.delete(r),hP(l),l})},[]);return{completedMissionIds:e,markCompleted:n,unmarkCompleted:s}}function hpe(e){const t=tf({queries:e.map(n=>({queryKey:["mission-status",n],queryFn:async()=>{const s=await fetch(`/api/missions/${encodeURIComponent(n)}`);if(!s.ok)return null;const r=await s.json();return typeof r.status=="string"&&r.status.length>0?r.status:null},enabled:n.length>0,staleTime:3e4}))});return C.useMemo(()=>{const n=new Map;let s=!1;for(let r=0;r<e.length;r++){const a=e[r],l=t[r];n.set(a,(l==null?void 0:l.data)??null),l!=null&&l.isPending&&(s=!0)}return{statuses:n,isLoading:s}},[e,t])}async function ppe({rigId:e,logicalId:t}){const n=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/open-cmux`,{method:"POST"}),s=await n.json().catch(()=>null);if(!n.ok||(s==null?void 0:s.ok)===!1)throw new Error((s==null?void 0:s.message)??(s==null?void 0:s.error)??(s==null?void 0:s.code)??`HTTP ${n.status}`);return s??{ok:!0}}function L_(){return en({mutationFn:ppe})}function mpe(e){const t=e.indexOf("@");return t===-1?{logicalId:e,rigId:null}:{logicalId:e.slice(0,t),rigId:e.slice(t+1)}}function gpe({authorSession:e,rigId:t,className:n,testId:s}){const r=mpe(e),a=t??r.rigId,l=L_(),u=bD(e);return a?i.jsxs(Ve,{to:"/topology/seat/$rigId/$logicalId",params:{rigId:a,logicalId:encodeURIComponent(r.logicalId)},"data-testid":s??"author-agent-tag",onClick:d=>{d.metaKey||d.ctrlKey||d.shiftKey||d.button!==0||l.mutate({rigId:a,logicalId:r.logicalId})},className:n??"inline-flex items-center gap-1 font-mono text-[10px] text-on-surface-variant hover:text-stone-900 hover:underline",children:[u?i.jsx(bm,{actor:e,size:"xs"}):null,i.jsx("span",{children:e})]}):i.jsxs("span",{"data-testid":s??"author-agent-tag",className:n??"inline-flex items-center gap-1 font-mono text-[10px] text-on-surface-variant",children:[u?i.jsx(bm,{actor:e,size:"xs"}):null,i.jsx("span",{children:e})]})}const xpe="openrig:topology-terminal-preview";function ype({cardId:e,sessionName:t}){if(!t)return i.jsx("button",{type:"button",disabled:!0,"data-testid":`feed-card-drill-${e}`,title:"No session resolved for this card — terminal preview unavailable",className:"inline-flex items-center gap-1 font-mono text-[10px] uppercase tracking-wide text-stone-400 cursor-not-allowed",children:"terminal preview"});const n=`${e}:${t}`,s=r=>{r.stopPropagation(),window.dispatchEvent(new CustomEvent(xpe,{detail:{key:n}}))};return i.jsxs("span",{className:"inline-flex items-center",children:[i.jsx("button",{type:"button","data-testid":`feed-card-drill-${e}`,onClick:s,title:`Terminal preview for ${t} — captured snapshot, not live`,className:"font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:text-stone-900 underline",children:"terminal preview"}),i.jsx(vf,{rigId:e,logicalId:t,sessionName:t,renderTrigger:!1,testIdPrefix:`feed-card-drill-${e}`})]})}function ax({data:e,children:t,className:n,style:s,testId:r}){const{setSelection:a}=Ng();return i.jsx("button",{type:"button","data-testid":r??"queue-item-trigger",onClick:()=>a({type:"qitem",data:e}),className:n??"text-left",style:s,children:t})}const Kl={approve:{label:"Approve",outcomeLabel:"Approved",description:"Accept the work and let it close or continue.",tone:"success",icon:_d},deny:{label:"Deny",outcomeLabel:"Denied",description:"Reject this request and leave a reason if needed.",tone:"danger",icon:jG},route:{label:"Route",outcomeLabel:"Routed",description:"Send this to another session for follow-up.",tone:"info",icon:V$},annotate:{label:"Annotate",outcomeLabel:"Annotated",description:"Add context without changing ownership.",tone:"neutral",icon:VV},hold:{label:"Hold",outcomeLabel:"Held",description:"Pause this item until more context is available.",tone:"warning",icon:uG},drop:{label:"Drop",outcomeLabel:"Dropped",description:"Remove this item from the active path.",tone:"neutral",icon:kG},handoff:{label:"Handoff",outcomeLabel:"Handed off",description:"Transfer active ownership to another session.",tone:"info",icon:Qm}};function vpe(e,t="action"){const n=Kl[e];return{label:t==="outcome"?n.outcomeLabel:n.label,tone:n.tone,icon:n.icon}}const bpe=new Set(["approve"]);function wpe(e){return e instanceof Error?e.message:typeof e=="string"?e:"Action failed."}const pP={approve:{idle:"border-success text-success hover:bg-success hover:text-white",active:"border-success bg-success text-white"},deny:{idle:"border-tertiary text-tertiary hover:bg-tertiary hover:text-white",active:"border-tertiary bg-tertiary text-white"},route:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"},annotate:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"},hold:{idle:"border-warning text-warning hover:bg-warning hover:text-white",active:"border-warning bg-warning text-white"},drop:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"},handoff:{idle:"border-stone-700 text-stone-700 hover:bg-stone-900 hover:text-white",active:"border-stone-900 bg-stone-900 text-white"}};function jpe({qitemId:e,actorSession:t,enabledVerbs:n=[...pz],oneClickVerbs:s,onSettled:r,onOptimisticOutcome:a}){var $;const l=Ehe(),[u,d]=C.useState(null),[f,p]=C.useState(""),[m,x]=C.useState(!1),[y,v]=C.useState(""),[b,w]=C.useState(""),[S,E]=C.useState(null),k=u==="route"||u==="handoff",_=u==="annotate",R=u==="hold"||u==="drop";function T(){d(null),p(""),x(!1),v(""),w(""),E(null)}function A(F){d(F),p(""),x(!1),v(""),w(""),E(null)}function M(F,G){const{dest:X,annotationText:Z,reasonText:D}=G;l.mutate({verb:F,qitemId:e,actorSession:t,destinationSession:X,annotation:Z,reason:D},{onSuccess:()=>{a==null||a({verb:F,actorSession:t,actedAt:new Date().toISOString(),destinationSession:X??null,reason:D??null}),T(),r==null||r()},onError:V=>{E(wpe(V))}})}function L(){u&&M(u,{dest:k?f:void 0,annotationText:_?y:void 0,reasonText:R?b:void 0})}function P(F){return!!(s!=null&&s.includes(F))&&bpe.has(F)}const O=dz(k),B=(($=O.data)==null?void 0:$.destinations)??[],H=k&&O.isLoading,z=k&&(B.length>0||H),W=k&&(m||O.isError||O.isFetched&&B.length===0);return i.jsxs("div",{"data-testid":"mc-verb-actions",className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 border border-outline-variant bg-white/40 px-2 py-1.5 backdrop-blur-sm",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-800",children:"Choose response"}),i.jsx("div",{className:"mt-0.5 font-mono text-[10px] leading-relaxed text-stone-500",children:"Pick the next move for this queue item."})]}),u?i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:["Selected: ",i.jsx("span",{className:"text-stone-900",children:Kl[u].label})]}):null]}),i.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(F=>{const G=Kl[F],X=G.icon,Z=P(F);return i.jsxs("button",{type:"button","data-testid":`mc-verb-${F}`,"data-one-click":Z?"true":void 0,onClick:()=>{if(Z){E(null),M(F,{});return}A(F)},disabled:l.isPending,title:Z?`${G.description} (records immediately)`:G.description,className:he("inline-flex min-h-[44px] items-center gap-1 border px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] transition-colors disabled:opacity-50",u===F?pP[F].active:pP[F].idle),children:[i.jsx(X,{className:"h-3 w-3",strokeWidth:1.7}),G.label]},F)})}),u&&i.jsxs("div",{className:"space-y-1 border border-stone-200 bg-stone-50 p-2",children:[i.jsx("div",{"data-testid":"mc-verb-guidance",className:"font-mono text-[10px] leading-relaxed text-stone-600",children:Kl[u].description}),k&&i.jsxs("div",{className:"space-y-1",children:[z?i.jsxs("select",{"data-testid":"mc-verb-destination-select","aria-label":"Destination session",value:m?"__manual__":f,disabled:H,onChange:F=>{if(F.target.value==="__manual__"){x(!0),p("");return}x(!1),p(F.target.value)},className:"w-full border border-stone-300 bg-white px-2 py-1 font-mono text-xs",children:[i.jsx("option",{value:"",children:H?"loading destinations...":"choose destination"}),B.map(F=>i.jsx("option",{value:F.sessionName,children:F.label},F.sessionName)),i.jsx("option",{value:"__manual__",children:"manual entry"})]}):null,W?i.jsx("input",{type:"text","data-testid":"mc-verb-destination-input",value:f,onChange:F=>p(F.target.value),placeholder:"destination session (member@rig)",className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}):null,O.isError?i.jsx("div",{className:"font-mono text-[10px] text-amber-700",children:"destination list unavailable"}):null]}),_&&i.jsx("textarea",{"data-testid":"mc-verb-annotation-input",value:y,onChange:F=>v(F.target.value),placeholder:"annotation",rows:2,className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}),R&&i.jsx("input",{type:"text","data-testid":"mc-verb-reason-input",value:b,onChange:F=>w(F.target.value),placeholder:`${u} reason`,className:"w-full border border-stone-300 px-2 py-1 font-mono text-xs"}),i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx("button",{type:"button",onClick:T,"data-testid":"mc-verb-cancel",className:"border border-stone-300 px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-600",children:"Cancel"}),i.jsx("button",{type:"button",onClick:L,"data-testid":"mc-verb-submit",disabled:l.isPending||k&&!f||_&&!y||R&&!b,className:"border border-stone-700 bg-stone-800 px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-white disabled:opacity-50",children:l.isPending?"...":`Confirm ${Kl[u].label}`})]})]}),S?i.jsx("div",{"data-testid":"mc-verb-error",role:"alert",className:"truncate border border-tertiary bg-stone-50/40 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-tertiary",title:S,children:S}):null]})}function P_({sliceName:e,relPath:t,onClose:n,testId:s="proof-image-viewer",imageTestId:r="proof-image-viewer-image",closeTestId:a="proof-image-viewer-close"}){return t?i.jsx("div",{role:"dialog","aria-label":"Screenshot preview","data-testid":s,className:"fixed bottom-0 right-0 top-14 z-[1000] flex items-center justify-center bg-stone-950/20 p-6 backdrop-blur-[2px] lg:left-[21rem]",onClick:n,children:i.jsxs("div",{className:"max-h-full max-w-[92vw] border border-white/20 bg-stone-950/70 p-2 backdrop-blur-sm",onClick:l=>l.stopPropagation(),children:[i.jsx("img",{src:ud(e,t),alt:t,"data-testid":r,className:"max-h-[78vh] max-w-full object-contain"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between gap-3 font-mono text-[10px] text-stone-50",children:[i.jsx("span",{className:"truncate",children:t}),i.jsx("button",{type:"button","data-testid":a,onClick:n,className:"inline-flex h-7 w-7 items-center justify-center border border-white/30 text-stone-50 hover:bg-white/10","aria-label":"Close screenshot preview",children:i.jsx(q2,{className:"h-3.5 w-3.5",strokeWidth:1.5})})]})]})}):null}const Spe={"action-required":"bg-tertiary",approval:"bg-warning",shipped:"bg-success",progress:"bg-secondary",observation:"bg-stone-500"},zm={neutral:"bg-stone-500",info:"bg-secondary",success:"bg-success",warning:"bg-warning",danger:"bg-tertiary"},Npe={"action-required":"feed-card-action",approval:"feed-card-approval",shipped:"feed-card-shipped",progress:"feed-card-progress",observation:"feed-card-observation"},kpe={"action-required":{label:"Your turn",tone:"danger",icon:ha},approval:{label:"Needs approval",tone:"warning",icon:ha},shipped:{label:"Shipped",tone:"success",icon:$2},progress:{label:"Progress",tone:"info",icon:Yl},observation:{label:"Observation",tone:"neutral",icon:Cd}},_pe="relative bg-stone-100/45 backdrop-blur-[10px] overflow-hidden group",Cpe={boxShadow:["0 2px 4px rgba(0, 0, 0, 0.14)","0 8px 20px rgba(0, 0, 0, 0.16)","0 0 40px rgba(0, 0, 0, 0.12)"].join(", ")};function Is(e){return typeof e=="string"&&e.length>0?e:void 0}function Epe(e){const t=e.source.payload??{},n=Is(t.qitem_id)??Is(t.qitemId);if(!n)return null;const s=t.tags,r=Array.isArray(s)?s.filter(a=>typeof a=="string"):void 0;return{qitemId:n,source:Is(t.source_session)??Is(t.sourceSession)??Is(t.fromSession),destination:Is(t.destination)??Is(t.destination_session)??Is(t.destinationSession)??Is(t.toSession),state:Is(t.state),tags:r,createdAt:e.createdAt,body:Is(t.body)??e.body}}function Rpe(e,t){const n=Epe(e);return t?{qitemId:t.qitemId,source:t.sourceSession,destination:t.destinationSession,state:t.state,tags:t.tags??void 0,createdAt:t.tsCreated,body:t.body||(n==null?void 0:n.body)||e.body}:n}function Ape(e){if(!e)return;const t=e.trim();return t.length<=520?t:`${t.slice(0,520).trimEnd()}
523
+ ...`}const Tpe=new Set(["done","closed","completed","shipped","canceled","cancelled","denied","failed","handed-off"]);function wz(e){return e?Tpe.has(e.state.toLowerCase()):!1}function Ipe(e,t,n){return!(e!=="action-required"&&e!=="approval"||n||wz(t))}function Mpe(e,t){if(e!=="action-required"&&e!=="approval"||!t||!wz(t))return null;const n=t.closureReason??null,s=t.handedOffTo??t.closureTarget??null;return{verb:n==="denied"?"deny":n==="handed_off_to"?"route":n==="canceled"?"drop":"approve",actorSession:t.destinationSession,actedAt:t.tsUpdated,state:t.state,destinationSession:s,reason:n==="no-follow-on"?null:t.closureTarget??n}}function Ope(e){return vpe(e.verb,"outcome")}function mP({token:e}){return i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:he("inline-block w-1.5 h-1.5 rounded-full shrink-0",zm[e.tone])}),e.label]})}function jz({value:e}){return i.jsxs("time",{dateTime:e??void 0,className:"inline-flex items-center gap-1 font-mono text-[10px] text-stone-500",children:[i.jsx(O2,{className:"h-3 w-3",strokeWidth:1.5}),J2(e)]})}function i2({session:e}){return i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 font-mono text-[10px] text-stone-600",children:[i.jsx(bm,{actor:e,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:SD(e)})]})}function Sz({source:e,destination:t}){return!e&&!t?null:i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx(i2,{session:e??"unknown source"}),i.jsx(ym,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(i2,{session:t??"unresolved target"})]})}function Lpe(e){switch(e.verb){case"approve":return`Approved by ${e.actorSession}.`;case"deny":return`Denied by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"route":case"handoff":return e.destinationSession?`Routed by ${e.actorSession} to ${e.destinationSession}.`:`Routed by ${e.actorSession}.`;case"hold":return`Held by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"drop":return`Dropped by ${e.actorSession}${e.reason?`: ${e.reason}.`:"."}`;case"annotate":return`Annotated by ${e.actorSession}.`}}function Ppe({outcome:e}){const t=Kl[e.verb],n=t.icon;return i.jsxs("div",{"data-testid":"feed-card-action-outcome",className:"mt-3 bg-stone-50/40 px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx("span",{"aria-hidden":"true",className:he("mt-2 inline-block w-1.5 h-1.5 rounded-full shrink-0",zm[t.tone])}),i.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white/55 text-stone-800",children:i.jsx(n,{className:"h-4 w-4",strokeWidth:1.8})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-stone-700",children:t.outcomeLabel}),i.jsx("div",{className:"mt-0.5 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:"Decision recorded"})]})]}),i.jsx(jz,{value:e.actedAt})]}),i.jsx("p",{className:"mt-3 font-body text-[12px] leading-relaxed text-stone-800",children:Lpe(e)}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx(i2,{session:e.actorSession}),e.reason?i.jsx(pa,{tag:e.reason}):null]}),(e.verb==="route"||e.verb==="handoff")&&e.destinationSession?i.jsx("div",{className:"mt-2",children:i.jsx(Sz,{source:e.actorSession,destination:e.destinationSession})}):null]})}const $pe=.5;function Dpe({card:e,queueItem:t,proofPreview:n,actionOutcome:s,onDismiss:r,onOptimisticOutcome:a}){const[l,u]=C.useState(null),d=C.useRef(null),f=T=>{r&&T.target===T.currentTarget&&(T.key==="Backspace"||T.key==="Delete")&&(T.preventDefault(),r(e))},p=T=>{if(!r)return;const A=T.touches[0];A&&(d.current={startX:A.clientX,pointerId:A.identifier,isTouch:!0})},m=T=>{const A=d.current;if(d.current=null,!r||!A)return;const M=T.changedTouches[0];if(!M)return;const L=M.clientX-A.startX;if(L<=0)return;const O=T.currentTarget.getBoundingClientRect();O.width<=0||L/O.width>=$pe&&r(e)},x=T=>{T.stopPropagation(),r&&r(e)},y=Rpe(e,t),v=Ape((t==null?void 0:t.body)||e.body),b=(t==null?void 0:t.tags)??(y==null?void 0:y.tags)??[],w=(y==null?void 0:y.source)??e.authorSession,S=y==null?void 0:y.destination,E=S!=null&&S.startsWith("human")?S:"human@host",k=s??Mpe(e.kind,t),_=k?Ope(k):kpe[e.kind],R=k?zm[_.tone]:Spe[e.kind];return i.jsxs("article",{"data-testid":Npe[e.kind],style:Cpe,className:he(_pe,"mb-3"),...r?{tabIndex:0,onKeyDown:f,onTouchStart:p,onTouchEnd:m}:{},children:[i.jsx(ws,{position:"tl"}),i.jsx(ws,{position:"tr"}),i.jsx(ws,{position:"bl"}),i.jsx(ws,{position:"br"}),i.jsxs("div",{className:"px-4 py-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0 space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.16em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:he("inline-block w-1.5 h-1.5 rounded-full shrink-0",R)}),_.label]}),i.jsx(mP,{token:X2(e.source.type)}),y!=null&&y.state?i.jsx(mP,{token:jD(y.state)}):null]}),i.jsx("h3",{className:"font-headline text-[16px] font-bold leading-tight text-stone-900 truncate",children:e.title})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(jz,{value:e.createdAt}),r?i.jsx("button",{type:"button","data-testid":"feed-card-dismiss","aria-label":"Dismiss card",onClick:x,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 focus:outline-none focus:ring-1 focus:ring-stone-400 transition-opacity inline-flex h-5 w-5 items-center justify-center border border-stone-300 bg-white/80 text-stone-600 hover:text-stone-900 hover:border-stone-500",children:i.jsx(q2,{className:"h-3 w-3",strokeWidth:1.8})}):null]})]}),v?i.jsx("p",{className:"mt-3 font-body text-[12px] leading-relaxed text-stone-700 whitespace-pre-line",children:v}):null,i.jsx("div",{className:"mt-3",children:i.jsx(Sz,{source:w,destination:S})}),b.length>0?i.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:b.slice(0,6).map(T=>i.jsx(pa,{tag:T},T))}):null,n&&n.screenshots.length>0?i.jsxs("div",{"data-testid":`feed-card-proof-preview-${e.id}`,className:"mt-3 bg-stone-50/40 p-2",children:[i.jsx(rg,{title:`Proof packet · ${n.displayName}`,badge:n.passFailBadge}),i.jsx("div",{className:"mt-2",children:i.jsx(ND,{sliceName:n.sliceName,screenshots:n.screenshots,onSelect:u,testIdPrefix:"feed-card-proof-screenshot"})})]}):null,k?i.jsx(Ppe,{outcome:k}):null,y&&Ipe(e.kind,t,k)?i.jsxs("div",{"data-testid":`feed-card-actions-${e.id}`,className:"mt-3 bg-stone-50/40 p-3",children:[i.jsx("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:i.jsxs("div",{children:[i.jsxs("div",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:he("inline-block w-1.5 h-1.5 rounded-full shrink-0",zm.danger)}),"Your turn"]}),i.jsx("p",{className:"mt-1 max-w-xl font-body text-[12px] leading-relaxed text-stone-700",children:"Review the context, then approve, deny, or route this queue item."})]})}),i.jsx(jpe,{qitemId:y.qitemId,actorSession:E,enabledVerbs:["approve","deny","route"],oneClickVerbs:["approve"],onOptimisticOutcome:a?T=>a(y.qitemId,T):void 0})]}):null,i.jsx("div",{className:"mt-3 flex items-center justify-between gap-3 font-mono text-[10px] text-stone-500",children:i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.authorSession?i.jsx(gpe,{authorSession:e.authorSession,rigId:e.rigId}):i.jsx("span",{className:"truncate",children:e.source.type}),y?i.jsx(ax,{data:y,testId:`feed-card-show-context-${e.id}`,className:"font-mono text-[10px] uppercase tracking-wide text-stone-700 hover:text-stone-900 underline",children:"show context"}):null,i.jsx(ype,{cardId:e.id,sessionName:w})]})})]}),n?i.jsx(P_,{sliceName:n.sliceName,relPath:l,onClose:()=>u(null)}):null]})}function qpe({label:e,onUndo:t,onExpire:n,durationMs:s}){const r=C.useRef(!1);C.useEffect(()=>{const l=window.setTimeout(()=>{r.current||(r.current=!0,n())},s);return()=>window.clearTimeout(l)},[s,n]);const a=()=>{r.current||(r.current=!0,t())};return i.jsxs("div",{"data-testid":"undo-toast",role:"status","aria-live":"polite",className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 border border-stone-700 bg-stone-900/95 px-4 py-2 font-mono text-[11px] uppercase tracking-wide text-stone-50 backdrop-blur-sm shadow-lg",children:[i.jsx("span",{children:e}),i.jsx("button",{type:"button","data-testid":"undo-toast-button",onClick:a,className:"border border-stone-500 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-stone-50 hover:bg-stone-800 focus:outline-none focus:ring-1 focus:ring-stone-300",children:"Undo"})]})}const Cf={shipped:{stripe:"border-l-emerald-600",pill:"bg-emerald-50 border-emerald-300",ink:"text-emerald-800",label:"SHIPPED"},incident:{stripe:"border-l-red-600",pill:"bg-red-50 border-red-300",ink:"text-red-800",label:"INCIDENT"},progress:{stripe:"border-l-sky-600",pill:"bg-sky-50 border-sky-300",ink:"text-sky-800",label:"PROGRESS"},approval:{stripe:"border-l-amber-600",pill:"bg-amber-50 border-amber-300",ink:"text-amber-800",label:"APPROVAL NEEDED"},concept:{stripe:"border-l-violet-600",pill:"bg-violet-50 border-violet-300",ink:"text-violet-800",label:"CONCEPT"}},zpe={shipped:"bg-success",incident:"bg-tertiary",progress:"bg-secondary",approval:"bg-warning",concept:"bg-stone-500"},Bpe={shipped:"Shipped",incident:"Incident",progress:"Progress",approval:"Approval",concept:"Concept"},Fpe={boxShadow:["0 2px 4px rgba(0, 0, 0, 0.14)","0 8px 20px rgba(0, 0, 0, 0.16)","0 0 40px rgba(0, 0, 0, 0.12)"].join(", ")};function Ef({testId:e,kind:t,title:n,oneLiner:s,expanded:r,drillInHref:a,drillInLabel:l,inlineActions:u,leadingAccessory:d}){const[f,p]=C.useState(!1);return i.jsxs("article",{"data-testid":e,"data-card-kind":t,"data-expanded":f,style:Fpe,className:"relative bg-stone-100/45 backdrop-blur-[10px] overflow-hidden",children:[i.jsx(ws,{position:"tl"}),i.jsx(ws,{position:"tr"}),i.jsx(ws,{position:"bl"}),i.jsx(ws,{position:"br"}),i.jsxs("div",{role:"button",tabIndex:0,"data-testid":`${e}-toggle`,onClick:()=>p(m=>!m),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),p(x=>!x))},className:"flex w-full min-h-[80px] cursor-pointer items-start gap-4 px-5 py-4 text-left","aria-expanded":f,children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{"data-testid":`${e}-pill`,className:"flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.18em] text-stone-700",children:[i.jsx("span",{"aria-hidden":"true",className:`inline-block w-1.5 h-1.5 rounded-full ${zpe[t]}`}),i.jsx("span",{children:Bpe[t]})]}),i.jsxs("h3",{"data-testid":`${e}-title`,className:"mt-2 flex items-center gap-2 font-headline text-[16px] font-bold leading-tight text-stone-900",children:[d,i.jsx("span",{className:"truncate",children:n})]}),i.jsx("p",{"data-testid":`${e}-one-liner`,className:"mt-1.5 font-body text-[12px] leading-relaxed text-stone-700 line-clamp-2",children:s})]}),u&&i.jsx("div",{"data-testid":`${e}-inline-actions`,className:"flex shrink-0 items-center gap-2",onClick:m=>m.stopPropagation(),children:u})]}),f&&i.jsxs("div",{"data-testid":`${e}-expanded`,className:"border-t border-outline-variant/40 px-5 py-4",children:[r,a&&i.jsx("div",{className:"mt-3 flex justify-end",children:i.jsxs("a",{"data-testid":`${e}-drill-in`,href:a,className:"inline-flex items-center gap-1 min-h-[44px] border border-stone-700 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hover:bg-stone-900 hover:text-white transition-colors",onClick:m=>m.stopPropagation(),children:[l??"Open"," →"]})})]})]})}function Nz({source:e}){return i.jsx(Ef,{testId:`feed-card-shipped-${e.sliceId}`,kind:"shipped",title:e.title,oneLiner:e.oneLiner,accent:Cf.shipped,drillInHref:`/project/slice/${e.sliceId}`,expanded:e.sections&&e.sections.length>0?i.jsx("ol",{className:"space-y-2 text-[11px]",children:e.sections.slice(0,3).map(t=>i.jsxs("li",{"data-testid":`feed-card-shipped-${e.sliceId}-section-${t.number}`,className:"flex gap-2",children:[i.jsxs("span",{className:"font-mono text-[10px] font-bold text-stone-500",children:[t.number,"."]}),i.jsxs("div",{children:[i.jsx("div",{className:"font-semibold text-stone-900",children:t.heading}),i.jsx("div",{className:"text-stone-700",children:t.summary})]})]},t.number))}):i.jsx("div",{className:"text-[11px] text-stone-600",children:e.oneLiner})})}const gP={success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-sky-500",muted:"bg-stone-400"};function kz({source:e}){return i.jsx(Ef,{testId:`feed-card-incident-${e.sliceId}`,kind:"incident",title:e.title,oneLiner:e.oneLiner,accent:Cf.incident,drillInHref:`/project/slice/${e.sliceId}`,drillInLabel:"Open timeline",leadingAccessory:i.jsx("span",{"data-testid":`feed-card-incident-${e.sliceId}-dot`,className:`inline-block h-3 w-3 rounded-full shrink-0 ${gP[e.status]}`,"aria-hidden":"true"}),expanded:e.recentEntries&&e.recentEntries.length>0?i.jsx("ul",{className:"space-y-2 text-[11px]",children:e.recentEntries.slice(0,3).map((t,n)=>i.jsxs("li",{"data-testid":`feed-card-incident-${e.sliceId}-entry-${n}`,className:"flex items-baseline gap-2",children:[i.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${gP[t.status]} shrink-0`,"aria-hidden":"true"}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500 shrink-0",children:t.time}),i.jsx("span",{className:"text-stone-900",children:t.title})]},n))}):i.jsx("div",{className:"text-[11px] text-stone-600",children:"No recent entries."})})}function _z({source:e,onMarkComplete:t}){const n=Math.max(0,Math.min(100,Math.round(e.percent))),s=t?i.jsx("button",{type:"button","data-testid":"progress-card-mark-complete",onClick:r=>{r.stopPropagation(),t(e.missionId)},className:"min-h-[36px] border border-stone-700 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hover:bg-stone-900 hover:text-white transition-colors focus:outline-none focus:ring-1 focus:ring-stone-700",children:"Mark complete"}):void 0;return i.jsx(Ef,{testId:`feed-card-progress-${e.missionId}`,kind:"progress",title:e.title,oneLiner:e.nextStep??e.oneLiner,accent:Cf.progress,drillInHref:`/project/mission/${e.missionId}`,drillInLabel:"Open mission",inlineActions:s,leadingAccessory:i.jsx("div",{"data-testid":`feed-card-progress-${e.missionId}-bar`,"data-percent":n,className:"h-1.5 w-16 shrink-0 border border-outline-variant bg-stone-100 overflow-hidden","aria-label":`Progress ${n}%`,children:i.jsx("div",{"data-testid":`feed-card-progress-${e.missionId}-bar-fill`,className:"h-full bg-sky-500",style:{width:`${n}%`}})}),expanded:e.activeSlice?i.jsxs("div",{"data-testid":`feed-card-progress-${e.missionId}-active-slice`,className:"border border-outline-variant bg-stone-50 px-2 py-2",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:"Active slice"}),i.jsx("div",{className:"mt-1 text-[12px] font-semibold text-stone-900",children:e.activeSlice.label}),i.jsxs("div",{className:"mt-0.5 font-mono text-[9px] text-stone-600",children:["status: ",e.activeSlice.status]})]}):i.jsx("div",{className:"text-[11px] text-stone-600",children:"No active slice."})})}function Cz({source:e}){return i.jsx(Ef,{testId:`feed-card-approval-${e.qitemId}`,kind:"approval",title:e.title,oneLiner:e.oneLiner,accent:Cf.approval,drillInHref:e.drillInHref,drillInLabel:"Open detail",inlineActions:i.jsxs(i.Fragment,{children:[e.onApprove&&i.jsx("button",{type:"button","data-testid":`feed-card-approval-${e.qitemId}-approve`,onClick:e.onApprove,className:"min-h-[44px] border border-success px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-success hover:bg-success hover:text-white transition-colors",children:"Approve"}),e.onDeny&&i.jsx("button",{type:"button","data-testid":`feed-card-approval-${e.qitemId}-deny`,onClick:e.onDeny,className:"min-h-[44px] border border-stone-700 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hover:bg-stone-900 hover:text-white transition-colors",children:"Deny"})]}),expanded:e.bodyPreview?i.jsx("pre",{"data-testid":`feed-card-approval-${e.qitemId}-body`,className:"overflow-x-auto whitespace-pre-wrap break-words bg-stone-50 p-2 font-body text-[11px] leading-relaxed text-stone-800",children:e.bodyPreview}):i.jsx("div",{className:"text-[11px] text-stone-600",children:"No body preview."})})}function Ez({source:e}){return i.jsx(Ef,{testId:`feed-card-concept-${e.sliceId}`,kind:"concept",title:e.title,oneLiner:e.oneLiner,accent:Cf.concept,drillInHref:`/project/slice/${e.sliceId}`,drillInLabel:"Open concept",expanded:e.comparePreview&&e.comparePreview.length>0?i.jsxs("table",{className:"w-full border-collapse text-[11px]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-stone-50",children:[i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[8px] uppercase tracking-[0.12em] text-stone-600"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[8px] uppercase tracking-[0.12em] text-stone-600",children:"Old"}),i.jsx("th",{className:"border border-outline-variant px-2 py-1 text-left font-mono text-[8px] uppercase tracking-[0.12em] text-stone-600",children:"New"})]})}),i.jsx("tbody",{children:e.comparePreview.slice(0,3).map((t,n)=>i.jsxs("tr",{children:[i.jsx("td",{className:"border border-outline-variant px-2 py-1 font-mono text-[10px] font-semibold text-stone-700",children:t.label}),i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-700",children:t.valueOld}),i.jsx("td",{className:"border border-outline-variant px-2 py-1 text-stone-900",children:t.valueNew})]},n))})]}):i.jsx("div",{className:"text-[11px] text-stone-600",children:e.oneLiner})})}function xP(e){return(e.rawStatus??"").toLowerCase()!=="candidate"?!1:e.missionId==="backlog"}function Hpe(e,t,n,s){const r=[],a=new Set(n?Array.from(n):[]);for(const m of e??[])(m.status??"").toLowerCase()==="complete"&&a.add(m.name);const l=(e??[]).filter(m=>!a.has(m.name));for(const m of l.slice(0,2))r.push({kind:"progress",source:{missionId:m.name,title:m.name,oneLiner:`Mission at ${m.path}`,nextStep:"Open mission for live status + active slices.",percent:0}});const u=(t??[]).filter(m=>!m.missionId||!a.has(m.missionId)),d=u.filter(xP),f=u.filter(m=>!xP(m));for(const m of d.slice(0,2)){const x=m.displayName||m.name,y=(m.description??"").trim(),v=y.length>0?y:"Shaped candidate — open to explore the proposed change.";r.push({kind:"concept",source:{sliceId:m.name,title:x,oneLiner:v}})}for(const m of f.slice(0,3)){const x=m.lastActivityAt?`Last activity ${m.lastActivityAt}`:`Slice in ${m.status??"unknown"} state`,y=m.displayName||m.name,v=m.name,b=(m.status??"").toLowerCase();b==="shipped"||b==="complete"||b==="done"?r.push({kind:"shipped",source:{sliceId:v,title:y,oneLiner:x}}):b==="blocked"||b==="danger"||b==="failed"?r.push({kind:"incident",source:{sliceId:v,title:y,oneLiner:x,status:b==="blocked"?"warning":"danger"}}):r.push({kind:"incident",source:{sliceId:v,title:y,oneLiner:x,status:"info"}})}const p=(s??[]).filter(m=>m.kind==="approval");for(const m of p.slice(0,2)){const x=m.source.payload??{},v=(typeof x.qitemId=="string"&&x.qitemId.length>0?x.qitemId:typeof x.qitem_id=="string"&&x.qitem_id.length>0?x.qitem_id:null)??m.id,b=m.authorSession?` from ${m.authorSession}`:"",w=m.body&&m.body.length>240?`${m.body.slice(0,237)}...`:m.body;r.push({kind:"approval",source:{qitemId:v,title:m.title,oneLiner:`Needs approval${b}`,bodyPreview:w,drillInHref:"/for-you"}})}return r}function Upe({items:e,onMarkMissionComplete:t}){return e.length===0?i.jsx("div",{"data-testid":"storytelling-feed-empty",className:"border border-dashed border-outline-variant bg-white/35 p-4 font-body text-[11px] text-stone-500",children:"No items in the feed."}):i.jsx("div",{"data-testid":"storytelling-feed",className:"flex flex-col gap-4",children:e.map((n,s)=>n.kind==="shipped"?i.jsx(Nz,{source:n.source},s):n.kind==="incident"?i.jsx(kz,{source:n.source},s):n.kind==="progress"?i.jsx(_z,{source:n.source,onMarkComplete:t},s):n.kind==="approval"?i.jsx(Cz,{source:n.source},s):n.kind==="concept"?i.jsx(Ez,{source:n.source},s):null)})}const Vpe=[{id:"all",label:"All"},{id:"action-required",label:"Action req"},{id:"approval",label:"Approvals"},{id:"shipped",label:"Shipped"},{id:"progress",label:"Progress"},{id:"observation",label:"Audit"}],Gpe=50,yP={all:{label:"All caught up",description:"Nothing needs you right now. New human tasks, approvals, shipped proof, and progress updates will appear here."},"action-required":{label:"No actions waiting",description:"When a queue item needs your response, it will appear here with approve, deny, and route controls."},approval:{label:"No approvals waiting",description:"Closeout and ratification requests will collect here when work needs an explicit decision."},shipped:{label:"No shipped proof yet",description:"Completed work with proof packets and screenshots will appear here when slices close."},progress:{label:"No progress cards",description:"Fresh queue movement and project updates will appear here as work advances."},observation:{label:"No audit cards",description:"Observation events are quiet right now. Turn the audit subscription on to watch more verbose activity."}};function vP(e){return typeof e=="string"&&e.length>0?e:void 0}function Kpe(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function Dp(e){const t=e.source.payload??{};return vP(t.qitemId)??vP(t.qitem_id)??null}const Wpe=new Set(["approve","deny","route","handoff","hold","drop"]);function Qu(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:null}function Ype(e){if(!e.qitemId)return null;const t=e.actionVerb;if(!Wpe.has(t))return null;const n=Qu(e.afterState,"handedOffTo")??(Qu(e.afterState,"closureReason")==="handed_off_to"?Qu(e.afterState,"closureTarget"):null);return{verb:t,actorSession:e.actorSession,actedAt:e.actedAt,state:Qu(e.afterState,"state"),destinationSession:n,reason:e.reason??Qu(e.afterState,"closureTarget")}}function Qpe(e){const t=new Map;for(const n of e){if(!n.qitemId||t.has(n.qitemId))continue;const s=Ype(n);s&&t.set(n.qitemId,s)}return t}function Rz(e,t){const n=e.source.payload??{};return[...Kpe(n.tags),...(t==null?void 0:t.tags)??[]]}function Xpe(e,t,n){if(n&&(e.kind==="action-required"||e.kind==="approval"))return"approval";if(!t)return e.kind;const s=Rz(e,t).join(" ").toLowerCase(),r=t.state.toLowerCase(),a=t.destinationSession.toLowerCase(),l=t.body.toLowerCase();return s.includes("approval")||s.includes("ratify")||r.includes("approval")||l.includes("approval requested")?"approval":r==="done"||r==="closed"||r==="completed"?"shipped":a==="human@host"||a.startsWith("human-")?"action-required":e.kind}function bP(e,t,n){const s=new Set(Rz(e,t));for(const a of n)if(s.has(a.name))return a.name;const r=[e.title,e.body,t==null?void 0:t.body,...(t==null?void 0:t.tags)??[]].filter(a=>!!a).join(`
524
+ `);for(const a of n)if(r.includes(a.name))return a.name;return null}function Zpe(e){const t=(e==null?void 0:e.tests.proofPackets.find(n=>n.screenshots.length>0))??(e==null?void 0:e.tests.proofPackets[0]);return!e||!t||t.screenshots.length===0?null:{sliceName:e.name,displayName:e.displayName||e.name,passFailBadge:t.passFailBadge,screenshots:t.screenshots}}function Jpe(){var Q;const{events:e}=ck(),[t,n]=C.useState("all"),s=TD(),[r,a]=C.useState(()=>new Map),l=C.useCallback((K,te)=>{a(re=>{const oe=new Map(re);return oe.set(K,te),oe})},[]),u=Vhe(),d=C.useMemo(()=>(u.data??[]).map(spe),[u.data]),f=C.useMemo(()=>Jhe(e).slice(0,Gpe),[e]),p=C.useMemo(()=>epe(rpe(f,d)),[f,d]),m=C.useMemo(()=>ape(p),[p]),x=C.useMemo(()=>p.map(K=>K.id),[p]),{dismissedSeqs:y,dismiss:v,undismiss:b}=lpe(m),{dismissedIds:w,dismiss:S,undismiss:E}=upe(x),[k,_]=C.useState(null),R=C.useCallback(K=>{r2(K)?(S(K.id),_({kind:"id",id:K.id})):(v(K.source.seq),_({kind:"seq",seq:K.source.seq}))},[v,S]),T=C.useCallback(()=>{k!==null&&(k.kind==="seq"?b(k.seq):E(k.id),_(null))},[k,b,E]),A=C.useCallback(()=>{_(null)},[]),M=C.useMemo(()=>p.map(Dp).filter(K=>!!K),[p]),L=U2(M),P=hz({limit:200}),O=C.useMemo(()=>{var K;return Qpe(((K=P.data)==null?void 0:K.rows)??[])},[(Q=P.data)==null?void 0:Q.rows]),B=C.useMemo(()=>{const te=p.map(oe=>{const pe=Dp(oe),ge=pe?L.itemsById.get(pe):void 0,ve=pe?O.get(pe):void 0,xe=Xpe(oe,ge,ve);return xe===oe.kind?oe:{...oe,kind:xe}}).filter(oe=>uY(oe.kind,s.state));return(t==="all"?te:te.filter(oe=>oe.kind===t)).filter(oe=>r2(oe)?!w.has(oe.id):!y.has(oe.source.seq))},[p,t,L.itemsById,O,s.state,y,w]),H=Zm("all"),z=C.useMemo(()=>!H.data||"unavailable"in H.data?[]:H.data.slices,[H.data]),W=C.useMemo(()=>{const K=new Set;for(const te of B){if(te.kind!=="shipped")continue;const re=Dp(te),oe=re?L.itemsById.get(re):void 0,pe=bP(te,oe,z);pe&&K.add(pe)}return Array.from(K)},[B,L.itemsById,z]),$=hD(W),F=mD(),{completedMissionIds:G,markCompleted:X}=fpe(),Z=C.useMemo(()=>Array.isArray(F.missions)?F.missions.map(K=>K.name):[],[F.missions]),{statuses:D}=hpe(Z),V=C.useMemo(()=>(Array.isArray(F.missions)?F.missions:[]).map(K=>({...K,status:D.get(K.name)??null})),[F.missions,D]),ne=C.useMemo(()=>Hpe(V,Array.isArray(z)?z:[],G,p),[V,z,G,p]),U=C.useCallback(K=>{X(K),fetch(`/api/missions/${encodeURIComponent(K)}/complete`,{method:"POST"}).catch(()=>{})},[X]);return i.jsxs("div",{"data-testid":"for-you-feed",className:"mx-auto w-full max-w-[720px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Attention"}),i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:"For You"})]}),i.jsx("div",{"data-testid":"feed-lens-chips",role:"toolbar","aria-label":"Feed filters",className:"flex flex-wrap gap-1 mb-4",children:Vpe.map(K=>i.jsx("button",{type:"button","data-testid":`feed-lens-${K.id}`,"data-active":t===K.id,onClick:()=>n(K.id),className:he("px-2 py-1 border font-mono text-[9px] uppercase tracking-wide",t===K.id?"border-stone-900 bg-stone-900 text-stone-50":"border-outline-variant text-on-surface-variant hover:bg-stone-100"),children:K.label},K.id))}),ne.length>0&&i.jsxs("section",{"data-testid":"for-you-storytelling-preview","aria-label":"Storytelling preview",className:"mb-4",children:[i.jsx(it,{tone:"muted",children:"Storytelling preview"}),i.jsx("div",{className:"mt-2",children:i.jsx(Upe,{items:ne,onMarkMissionComplete:U})})]}),B.length===0?i.jsx(Ge,{label:yP[t].label,description:yP[t].description,variant:"card",testId:"for-you-empty"}):i.jsx("div",{"data-testid":"for-you-feed-cards",children:B.map(K=>{const te=Dp(K),re=te?L.itemsById.get(te):void 0,oe=K.kind==="shipped"?bP(K,re,z):null,pe=oe?Zpe($.itemsByName.get(oe)):null,ge=te?r.get(te)??O.get(te)??null:null;return i.jsx(Dpe,{card:K,queueItem:re,proofPreview:pe,actionOutcome:ge,onDismiss:R,onOptimisticOutcome:l},K.id)})}),k!==null?i.jsx(qpe,{label:"Card dismissed",onUndo:T,onExpire:A,durationMs:5e3},k.kind==="seq"?`seq-${k.seq}`:`id-${k.id}`):null]})}const eme=[{label:"+ Add spec",to:"/specs/rig",testId:"specs-toolbar-add"},{label:"Import",to:"/import",testId:"specs-toolbar-import"},{label:"Discover",to:"/search",testId:"specs-toolbar-discover"},{label:"Create rig",to:"/specs/rig",testId:"specs-toolbar-create-rig"},{label:"Generate workflow",to:"/specs/agent",testId:"specs-toolbar-gen-workflow"}];function qp(e){return e.status==="error"?{id:e.id,label:e.name,meta:e.errorMessage??"Invalid workflow YAML",status:"error"}:{id:e.id,label:e.name,entryId:e.id}}function tme(e){return{id:e.id,label:e.name,entryId:e.id}}function nme(e){return{id:e.id,label:e.name,entryId:e.id}}function Ka({id:e,title:t,rows:n,isLoading:s,emptyLabel:r}){return i.jsxs("section",{"data-testid":`library-section-${e}`,className:"border border-outline-variant bg-white/25 hard-shadow",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[i.jsx(it,{tone:"default",children:t}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:s?"loading":`${n.length} items`})]}),n.length>0?i.jsx("ul",{className:"divide-y divide-outline-variant",children:n.map(a=>i.jsx("li",{children:a.entryId?i.jsx(Ve,{to:"/specs/library/$entryId",params:{entryId:a.entryId},"data-testid":`library-row-${e}-${a.id}`,className:"block px-3 py-2 hover:bg-stone-100/50",children:i.jsx(wP,{row:a})}):i.jsx("div",{"data-testid":`library-row-${e}-${a.id}`,"data-status":a.status,className:`px-3 py-2 ${a.status==="error"?"bg-red-50/40 text-red-900":""}`,children:i.jsx(wP,{row:a})})},a.id))}):i.jsx("div",{className:"px-3 py-4 font-mono text-[10px] text-stone-500",children:s?"Loading...":r??"No entries."})]})}function wP({row:e}){return i.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-3 font-mono",children:[i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:e.label}),e.meta?i.jsx("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:e.meta}):null]})}function sme({plugins:e,isLoading:t}){return i.jsxs("section",{id:"library-plugins","data-testid":"library-section-plugins",className:"border border-outline-variant bg-white/25 hard-shadow",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[i.jsx(it,{tone:"default",children:"Plugins"}),i.jsx("span",{className:"shrink-0 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${e.length} plugins`})]}),e.length===0?i.jsx("div",{className:"px-3 py-4",children:i.jsx(Ge,{label:t?"LOADING":"NO PLUGINS DISCOVERED",description:t?"Loading plugins...":"Install a Claude Code or Codex plugin (or wait for openrig-core to vendor) to see it appear here.",variant:"card",testId:"library-plugins-empty"})}):i.jsx("ul",{className:"divide-y divide-outline-variant",children:e.map(n=>i.jsx("li",{children:i.jsx(Ve,{to:"/plugins/$pluginId",params:{pluginId:n.id},"data-testid":`library-plugin-${n.id}`,className:"flex items-center gap-3 px-3 py-2 font-mono hover:bg-stone-100/50",children:i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx($e,{tool:"skill",title:`${n.name} plugin`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:n.name})]})})},n.id))})]})}function rme({skills:e,isLoading:t}){return i.jsxs("section",{id:"library-skills","data-testid":"library-section-skills",className:"border border-outline-variant bg-white/25 hard-shadow",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2",children:[i.jsx(it,{tone:"default",children:"Skills"}),i.jsx("span",{className:"shrink-0 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${e.length} folders`})]}),e.length===0?i.jsx("div",{className:"px-3 py-4",children:i.jsx(Ge,{label:t?"LOADING":"NO SKILLS FOUND",description:t?"Loading skill folders...":"No .openrig/skills or packaged OpenRig skill folders are visible through configured file roots.",variant:"card",testId:"library-skills-empty"})}):i.jsx("ul",{className:"divide-y divide-outline-variant",children:e.map(n=>i.jsx("li",{children:i.jsxs("a",{href:KW(n.id),"data-testid":`library-skill-${n.name}`,className:"flex items-center justify-between gap-3 px-3 py-2 font-mono hover:bg-stone-100/50",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx($e,{tool:"skill",title:`${n.name} skill`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:n.name})]}),i.jsxs("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.08em] text-stone-500",children:[n.files.length," files"]})]})},n.id))})]})}function Az(){const{data:e=[],isLoading:t}=Rc(),{data:n=[],isLoading:s}=ak(),{data:r=[],isLoading:a}=ok(),{data:l=[],isLoading:u}=ig(),{data:d=[],isLoading:f}=ag(),p=C.useMemo(()=>{const x=e.filter(w=>w.kind==="rig"&&!w.hasServices).map(qp),y=e.filter(w=>w.kind==="workflow").map(qp),v=e.filter(w=>w.kind==="agent").map(qp),b=e.filter(w=>w.kind==="rig"&&w.hasServices).map(qp);return{rigSpecs:x,workflowSpecs:y,agentSpecs:v,applications:b}},[e]),m=p.rigSpecs.length+p.workflowSpecs.length+p.agentSpecs.length+p.applications.length+n.length+r.length+l.length;return i.jsxs("div",{"data-testid":"specs-library-page",className:"h-full overflow-y-auto bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"mb-5 flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx(it,{tone:"muted",children:"Library"}),i.jsx("h1",{className:"mt-1 font-headline text-2xl font-bold tracking-tight text-stone-900",children:"Library"}),i.jsx("p",{className:"mt-1 max-w-3xl text-sm text-stone-600",children:"Specs, context packs, agent images, applications, and skill folders."})]}),i.jsx("nav",{"aria-label":"Library actions",className:"flex flex-wrap justify-end gap-2",children:eme.map(x=>i.jsx(Ve,{to:x.to,"data-testid":x.testId,className:"border border-outline-variant bg-white/25 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700 hard-shadow hover:bg-white/40",children:x.label},x.testId))})]}),i.jsxs("div",{className:"mb-4 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-500",children:[m," library entries visible through current sources"]}),i.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[i.jsx(Ka,{id:"rig-specs",title:"Rig Specs",rows:p.rigSpecs,isLoading:t,emptyLabel:"No rig specs found."}),i.jsx(Ka,{id:"workspace-specs",title:"Workspace Specs",rows:[],emptyLabel:"No workspace specs source is wired yet."}),i.jsx(Ka,{id:"workflow-specs",title:"Workflow Specs",rows:p.workflowSpecs,isLoading:t,emptyLabel:"No workflow specs found."}),i.jsx(Ka,{id:"context-packs",title:"Context Packs",rows:n.map(tme),isLoading:s,emptyLabel:"No context packs found."}),i.jsx(Ka,{id:"agent-specs",title:"Agent Specs",rows:p.agentSpecs,isLoading:t,emptyLabel:"No agent specs found."}),i.jsx(Ka,{id:"agent-images",title:"Agent Images",rows:r.map(nme),isLoading:a,emptyLabel:"No agent images found."}),i.jsx(Ka,{id:"applications",title:"Applications",rows:p.applications,isLoading:t,emptyLabel:"No application specs found."})]}),i.jsxs("div",{className:"mt-4 space-y-4",children:[i.jsx(sme,{plugins:d,isLoading:f}),i.jsx(rme,{skills:l,isLoading:u})]})]})}async function ime(e,t){const n=await fetch(`/api/skills/${encodeURIComponent(e)}/files/list?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}async function ame(e,t){const n=await fetch(`/api/skills/${encodeURIComponent(e)}/files/read?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function ome(e,t){return qe({queryKey:["skill-files","list",e,t],queryFn:()=>ime(e,t??""),enabled:!!e,staleTime:15e3})}function lme(e,t){return qe({queryKey:["skill-files","read",e,t],queryFn:()=>ame(e,t),enabled:!!e&&!!t,staleTime:15e3})}const cme=new Set([".md",".mdx",".txt",".log",".yaml",".yml",".json",".js",".jsx",".ts",".tsx",".py",".sh",".bash",".css",".html"]);function ume(e){const t=e.lastIndexOf(".");return t===-1?"":e.slice(t).toLowerCase()}function jP(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function dme(e,t){return e?`${e}/${t}`:t}function Tz({skillToken:e,fileToken:t}){var y;const{data:n=[],isLoading:s}=ig(),r=ED(e),a=r?n.find(v=>v.id===r)??null:null,[l,u]=C.useState(""),[d,f]=C.useState(null),[p,m]=C.useState(!1);C.useEffect(()=>{if(!t||!a)return;const v=RD(t);v&&(u(jP(v)),f(v),m(!0))},[t,a]);const x=ome((a==null?void 0:a.id)??null,l);return C.useEffect(()=>{if(p||l!==""||!x.data)return;const v=x.data.entries.find(b=>b.type==="file"&&/^skill\.md$/i.test(b.name));v&&f(v.name),m(!0)},[x.data,l,p]),s?i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ge,{label:"LOADING SKILL",description:"Loading skill files from the daemon skill library.",variant:"card",testId:"skill-detail-loading"})}):a?i.jsxs("div",{"data-testid":"skill-detail-page",className:"h-full overflow-hidden bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"mb-4",children:[i.jsx(it,{tone:"muted",children:"Skill"}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-3",children:[i.jsx("h1",{className:"font-headline text-2xl font-bold tracking-tight text-stone-900",children:a.name}),i.jsx("span",{"data-testid":"skill-detail-source",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:a.source})]}),i.jsx("div",{"data-testid":"skill-detail-absolute-path",className:"mt-1 font-mono text-[10px] text-stone-500 truncate",title:a.absolutePath,children:a.absolutePath})]}),i.jsxs("div",{"data-testid":"skill-detail-docs-browser",className:"flex h-[calc(100%-5rem)] flex-col border border-outline-variant bg-white/25 hard-shadow sm:flex-row",children:[i.jsxs("aside",{"data-testid":"skill-detail-tree",className:"w-full max-h-48 shrink-0 overflow-y-auto border-b border-outline-variant bg-white/30 sm:w-64 sm:max-h-none sm:border-b-0 sm:border-r",children:[i.jsx(fme,{testId:"skill-detail-breadcrumbs",skillName:a.name,path:l,onNavigate:v=>{u(v),f(null)}}),x.isLoading?i.jsx("div",{"data-testid":"skill-detail-tree-loading",className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading…"}):x.isError?i.jsx("div",{"data-testid":"skill-detail-tree-error",className:"p-3 font-mono text-[10px] text-red-600",children:((y=x.error)==null?void 0:y.message)??"Error loading directory."}):!x.data||x.data.entries.length===0?i.jsx("div",{"data-testid":"skill-detail-tree-empty",className:"p-3 font-mono text-[10px] text-stone-400",children:"Empty directory."}):i.jsxs("ul",{className:"p-1",children:[l&&i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":"skill-detail-tree-up",onClick:()=>{u(jP(l)),f(null)},className:"block w-full px-2 py-1 text-left font-mono text-[10px] text-stone-500 hover:bg-stone-100",children:".."})}),x.data.entries.map(v=>{const b=dme(l,v.name),w=v.type==="file",S=d===b;return i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":`skill-detail-tree-entry-${b}`,"data-type":v.type,"data-active":S,onClick:()=>{w?f(b):v.type==="dir"&&(u(b),f(null))},disabled:v.type==="other",className:`block w-full px-2 py-1 text-left font-mono text-[10px] ${v.type==="other"?"text-stone-400":`hover:bg-stone-100 ${S?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,children:v.type==="dir"?`▸ ${v.name}`:v.name})},b)})]})]}),i.jsx("main",{"data-testid":"skill-detail-viewer",className:"flex-1 min-w-0 overflow-y-auto bg-white",children:d?i.jsx(hme,{skillId:a.id,path:d}):i.jsx("div",{"data-testid":"skill-detail-viewer-no-selection",className:"p-4 font-mono text-[10px] text-stone-400",children:"Select a file from the tree."})})]})]}):i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ge,{label:"SKILL NOT FOUND",description:"The selected skill is not discoverable through the daemon skill library.",variant:"card",testId:"skill-detail-not-found"})})}function fme({testId:e,skillName:t,path:n,onNavigate:s}){const r=n?n.split("/"):[];return i.jsxs("nav",{"data-testid":e,className:"flex flex-wrap items-baseline gap-1 border-b border-outline-variant px-2 py-1 font-mono text-[10px] text-stone-700",children:[i.jsx("button",{type:"button",onClick:()=>s(""),className:"font-bold hover:underline",children:t}),r.map((a,l)=>{const u=r.slice(0,l+1).join("/");return i.jsxs("span",{children:[i.jsx("span",{className:"mx-0.5 text-stone-400",children:"/"}),i.jsx("button",{type:"button",onClick:()=>s(u),className:"hover:underline",children:a})]},u)})]})}function hme({skillId:e,path:t}){var r;const n=lme(e,t),s=C.useMemo(()=>ume(t),[t]);return n.isLoading?i.jsx("div",{"data-testid":"skill-detail-viewer-loading",className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}):n.isError?i.jsx("div",{"data-testid":"skill-detail-viewer-error",className:"p-4 font-mono text-[10px] text-red-600",children:((r=n.error)==null?void 0:r.message)??"Error loading file."}):n.data?i.jsxs("div",{"data-testid":"skill-detail-viewer-content",className:"flex h-full flex-col",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2 font-mono text-[10px]",children:[i.jsx("div",{"data-testid":"skill-detail-viewer-path",className:"text-stone-700",children:t}),i.jsxs("div",{className:"flex items-baseline gap-3 text-stone-500",children:[i.jsxs("span",{children:[n.data.size,"b"]}),i.jsx("span",{children:n.data.mtime})]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[n.data.truncated&&i.jsxs("div",{"data-testid":"skill-detail-viewer-truncated",className:"mb-3 mx-4 mt-4 border border-amber-400 bg-amber-50 px-3 py-2 font-mono text-[10px] text-amber-900",children:["⚠ Truncated at ",Math.round((n.data.truncatedAtBytes??0)/1024)," KB — file is"," ",Math.round((n.data.totalBytes??n.data.size)/1024)," KB total."]}),s===".md"||s===".mdx"?i.jsx("div",{className:"p-4",children:i.jsx(Jr,{content:n.data.content})}):cme.has(s)?i.jsx("div",{className:"p-4",children:i.jsx(fg,{code:n.data.content,language:s.slice(1)})}):i.jsx("pre",{"data-testid":"skill-detail-viewer-text-fallback",className:"p-4 whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:n.data.content})]})]}):null}function pme(e){return e==="workspace"?"Workspace":e==="openrig-managed"?"OpenRig managed":e}function mme(){const{data:e=[],isLoading:t}=ig(),n=[...e].sort((s,r)=>s.name.localeCompare(r.name));return i.jsxs("div",{"data-testid":"skills-index-page",className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Library"}),i.jsxs("div",{className:"mt-1 flex items-baseline justify-between",children:[i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900",children:"Skills"}),i.jsx("span",{"data-testid":"skills-index-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${n.length} ${n.length===1?"skill":"skills"}`})]})]}),t&&n.length===0?i.jsx("div",{"data-testid":"skills-index-loading",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:"Loading skills…"}):n.length===0?i.jsxs("div",{"data-testid":"skills-index-empty",className:"border border-outline-variant bg-white/25 px-4 py-6 font-mono text-xs leading-relaxed text-stone-700",children:[i.jsx("p",{className:"font-bold uppercase tracking-wide text-stone-900",children:"No skills visible"}),i.jsxs("p",{className:"mt-2",children:["Skills live under ",i.jsx("code",{className:"font-mono text-stone-900",children:".openrig/skills/"})," in your workspace, plus the built-in set shipped with OpenRig. If this list is empty, the daemon could not see either source through configured file roots."]})]}):i.jsx("ul",{"data-testid":"skills-index-rows",className:"border border-outline-variant bg-white/25 hard-shadow divide-y divide-outline-variant",children:n.map(s=>i.jsx("li",{children:i.jsxs(Ve,{to:"/specs/skills/$skillToken",params:{skillToken:og(s.id)},"data-testid":`skills-index-row-${s.id}`,className:"flex w-full items-center justify-between gap-3 px-3 py-2 font-mono text-left hover:bg-stone-100/60 focus:outline-none focus:bg-stone-100/80",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx($e,{tool:"skill",title:`${s.name} skill`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:s.name})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-3 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx("span",{"data-testid":`skills-index-row-${s.id}-source`,children:pme(s.source)}),i.jsxs("span",{"data-testid":`skills-index-row-${s.id}-filecount`,children:[s.files.length," ",s.files.length===1?"file":"files"]})]})]})},s.id))})]})}function gme(){const{data:e=[],isLoading:t}=ag(),n=[...e].sort((s,r)=>s.name.localeCompare(r.name));return i.jsxs("div",{"data-testid":"plugins-index-page",className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Library"}),i.jsxs("div",{className:"mt-1 flex items-baseline justify-between",children:[i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900",children:"Plugins"}),i.jsx("span",{"data-testid":"plugins-index-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:t?"loading":`${n.length} ${n.length===1?"plugin":"plugins"}`})]})]}),t&&n.length===0?i.jsx("div",{"data-testid":"plugins-index-loading",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:"Loading plugins…"}):n.length===0?i.jsxs("div",{"data-testid":"plugins-index-empty",className:"border border-outline-variant bg-white/25 px-4 py-6 font-mono text-xs leading-relaxed text-stone-700",children:[i.jsx("p",{className:"font-bold uppercase tracking-wide text-stone-900",children:"No plugins visible"}),i.jsx("p",{className:"mt-2",children:"Plugins are discovered from Claude Code's global plugin cache, Codex's plugin cache, or OpenRig's vendored set (openrig-core ships with the daemon)."})]}):i.jsx("ul",{"data-testid":"plugins-index-rows",className:"border border-outline-variant bg-white/25 hard-shadow divide-y divide-outline-variant",children:n.map(s=>i.jsx("li",{children:i.jsxs(Ve,{to:"/plugins/$pluginId",params:{pluginId:s.id},"data-testid":`plugins-index-row-${s.id}`,className:"flex w-full items-center justify-between gap-3 px-3 py-2 font-mono text-left hover:bg-stone-100/60 focus:outline-none focus:bg-stone-100/80",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx($e,{tool:"plugin",title:`${s.name} plugin`,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate text-xs font-bold text-stone-900",children:s.name})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-3 font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsxs("span",{"data-testid":`plugins-index-row-${s.id}-version`,children:["v",s.version]}),i.jsx("span",{"data-testid":`plugins-index-row-${s.id}-runtimes`,className:"flex gap-1",children:s.runtimes.map(r=>i.jsx("span",{className:"border border-outline-variant px-1.5 py-0.5",children:r},r))}),i.jsxs("span",{"data-testid":`plugins-index-row-${s.id}-skillcount`,children:[s.skillCount," ",s.skillCount===1?"skill":"skills"]}),i.jsx("span",{"data-testid":`plugins-index-row-${s.id}-source`,children:s.sourceLabel})]})]})},s.id))})]})}async function xme(e,t){const n=await fetch(`/api/plugins/${encodeURIComponent(e)}/files/list?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}async function yme(e,t){const n=await fetch(`/api/plugins/${encodeURIComponent(e)}/files/read?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function vme(e,t){return qe({queryKey:["plugin-files","list",e,t],queryFn:()=>xme(e,t??""),enabled:!!e,staleTime:15e3})}function bme(e,t){return qe({queryKey:["plugin-files","read",e,t],queryFn:()=>yme(e,t),enabled:!!e&&!!t,staleTime:15e3})}const wme=new Set([".md",".mdx",".txt",".log",".yaml",".yml",".json",".js",".jsx",".ts",".tsx",".py",".sh",".bash",".css",".html"]);function Iz(e){const t=e.lastIndexOf(".");return t===-1?"":e.slice(t).toLowerCase()}function jme(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function Sme(e,t){return e?`${e}/${t}`:t}function Nme(e){const t=Iz(e);return t===".md"||t===".mdx"}function kme(e){const t=e.find(s=>s.type==="file"&&/^readme\.(md|mdx)$/i.test(s.name));if(t)return t.name;const n=e.find(s=>s.type==="file"&&Nme(s.name));return n?n.name:null}function _me({pluginId:e}){var b;const{data:t,isLoading:n,error:s}=UW(e),{data:r=[]}=VW(e),[a,l]=C.useState(""),[u,d]=C.useState(null),[f,p]=C.useState(!1),m=vme(e,a);if(C.useEffect(()=>{if(f||a!==""||!m.data)return;const w=kme(m.data.entries);w&&d(w),p(!0)},[m.data,a,f]),n)return i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ge,{label:"LOADING PLUGIN",description:"Loading plugin manifest from discovery service.",variant:"card",testId:"plugin-detail-loading"})});if(s||!t)return i.jsx("div",{className:"h-full bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:i.jsx(Ge,{label:"PLUGIN NOT FOUND",description:"The selected plugin is not visible through any configured discovery source.",variant:"card",testId:"plugin-detail-not-found"})});const x=t.entry,y=x.skillCount,v=r.length;return i.jsxs("div",{"data-testid":"plugin-detail-page",className:"h-full overflow-hidden bg-paper-grid px-6 py-5 lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"mb-4",children:[i.jsx(it,{tone:"muted",children:"Plugin"}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-baseline gap-3",children:[i.jsx("h1",{className:"font-headline text-2xl font-bold tracking-tight text-stone-900",children:x.name}),i.jsxs("span",{className:"font-mono text-sm text-stone-600",children:["v",x.version]}),x.runtimes.map(w=>i.jsx("span",{"data-testid":`plugin-detail-runtime-${w}`,className:"inline-block border border-outline-variant bg-white/30 px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-700",children:w},w)),i.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",title:x.path,children:x.sourceLabel}),i.jsxs("span",{"data-testid":"plugin-detail-skill-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:[y," ",y===1?"skill":"skills"]}),i.jsxs("span",{"data-testid":"plugin-detail-used-by-count",className:"font-mono text-[10px] uppercase tracking-[0.12em] text-stone-500",children:["used by ",v," ",v===1?"agent":"agents"]})]}),x.description&&i.jsx("p",{className:"mt-2 max-w-3xl text-sm text-stone-600",children:x.description})]}),i.jsxs("div",{"data-testid":"plugin-detail-docs-browser",className:"flex h-[calc(100%-7rem)] flex-col border border-outline-variant bg-white/25 hard-shadow sm:flex-row",children:[i.jsxs("aside",{"data-testid":"plugin-detail-tree",className:"w-full max-h-64 shrink-0 overflow-y-auto border-b border-outline-variant bg-white/30 sm:w-72 sm:max-h-none sm:border-b-0 sm:border-r",children:[i.jsx(Cme,{testId:"plugin-detail-breadcrumbs",pluginName:x.name,path:a,onNavigate:w=>{l(w),d(null)}}),m.isLoading?i.jsx("div",{"data-testid":"plugin-detail-tree-loading",className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading…"}):m.isError?i.jsx("div",{"data-testid":"plugin-detail-tree-error",className:"p-3 font-mono text-[10px] text-red-600",children:((b=m.error)==null?void 0:b.message)??"Error loading directory."}):!m.data||m.data.entries.length===0?i.jsx("div",{"data-testid":"plugin-detail-tree-empty",className:"p-3 font-mono text-[10px] text-stone-400",children:"Empty directory."}):i.jsxs("ul",{className:"p-1",children:[a&&i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":"plugin-detail-tree-up",onClick:()=>{l(jme(a)),d(null)},className:"block w-full px-2 py-1 text-left font-mono text-[10px] text-stone-500 hover:bg-stone-100",children:".."})}),m.data.entries.map(w=>{const S=Sme(a,w.name),E=w.type==="file",k=u===S;return i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":`plugin-detail-tree-entry-${S}`,"data-type":w.type,"data-active":k,onClick:()=>{E?d(S):w.type==="dir"&&(l(S),d(null))},disabled:w.type==="other",className:`block w-full px-2 py-1 text-left font-mono text-[10px] ${w.type==="other"?"text-stone-400":`hover:bg-stone-100 ${k?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,children:w.type==="dir"?`▸ ${w.name}`:w.name})},S)})]})]}),i.jsx("main",{"data-testid":"plugin-detail-viewer",className:"flex-1 min-w-0 overflow-y-auto bg-white",children:u?i.jsx(Eme,{pluginId:e,path:u}):i.jsx("div",{"data-testid":"plugin-detail-viewer-no-selection",className:"p-4 font-mono text-[10px] text-stone-400",children:"Select a file from the tree."})})]})]})}function Cme({testId:e,pluginName:t,path:n,onNavigate:s}){const r=n?n.split("/"):[];return i.jsxs("nav",{"data-testid":e,className:"flex flex-wrap items-baseline gap-1 border-b border-outline-variant px-2 py-1 font-mono text-[10px] text-stone-700",children:[i.jsx("button",{type:"button",onClick:()=>s(""),className:"font-bold hover:underline",children:t}),r.map((a,l)=>{const u=r.slice(0,l+1).join("/");return i.jsxs("span",{children:[i.jsx("span",{className:"mx-0.5 text-stone-400",children:"/"}),i.jsx("button",{type:"button",onClick:()=>s(u),className:"hover:underline",children:a})]},u)})]})}function Eme({pluginId:e,path:t}){var r;const n=bme(e,t),s=C.useMemo(()=>Iz(t),[t]);return n.isLoading?i.jsx("div",{"data-testid":"plugin-detail-viewer-loading",className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}):n.isError?i.jsx("div",{"data-testid":"plugin-detail-viewer-error",className:"p-4 font-mono text-[10px] text-red-600",children:((r=n.error)==null?void 0:r.message)??"Error loading file."}):n.data?i.jsxs("div",{"data-testid":"plugin-detail-viewer-content",className:"flex h-full flex-col",children:[i.jsxs("header",{className:"flex items-baseline justify-between border-b border-outline-variant bg-white/30 px-3 py-2 font-mono text-[10px]",children:[i.jsx("div",{"data-testid":"plugin-detail-viewer-path",className:"text-stone-700",children:t}),i.jsxs("div",{className:"flex items-baseline gap-3 text-stone-500",children:[i.jsxs("span",{children:[n.data.size,"b"]}),i.jsx("span",{children:n.data.mtime})]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[n.data.truncated&&i.jsxs("div",{"data-testid":"plugin-detail-viewer-truncated",className:"mb-3 mx-4 mt-4 border border-amber-400 bg-amber-50 px-3 py-2 font-mono text-[10px] text-amber-900",children:["⚠ Truncated at ",Math.round((n.data.truncatedAtBytes??0)/1024)," KB — file is"," ",Math.round((n.data.totalBytes??n.data.size)/1024)," KB total."]}),s===".md"||s===".mdx"?i.jsx("div",{className:"p-4",children:i.jsx(Jr,{content:n.data.content})}):wme.has(s)?i.jsx("div",{className:"p-4",children:i.jsx(fg,{code:n.data.content,language:s.slice(1)})}):i.jsx("pre",{"data-testid":"plugin-detail-viewer-text-fallback",className:"p-4 whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:n.data.content})]})]}):null}async function Rme(e,t){const n=await fetch(`/api/specs/review/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:t})});if(n.status===400)return await n.json();if(!n.ok)throw new Error(`HTTP ${n.status}`);return await n.json()}function Ame(e,t){return qe({queryKey:["spec-review",e,t?t.length:0,t?t.slice(0,64):""],queryFn:()=>Rme(e,t),enabled:!!e&&!!t,staleTime:6e4})}async function Tme(){const t=new URL(window.location.href).searchParams.get("session"),n=new URLSearchParams;if(t&&n.set("sessionName",t),n.toString()==="")return null;const s=await fetch(`/api/whoami?${n.toString()}`);if(!s.ok)return null;const r=await s.json().catch(()=>null);if(!r||typeof r!="object")return null;const a=r.workspace;return!a||typeof a!="object"?null:Array.isArray(a.repos)?a:{...a,repos:[]}}function Ime(){return qe({queryKey:["workspace","whoami"],queryFn:Tme,staleTime:6e4})}const Mme={user:{label:"USER",glyph:"U",bg:"bg-violet-50",fg:"text-violet-700",border:"border-violet-200"},project:{label:"PROJECT",glyph:"P",bg:"bg-blue-50",fg:"text-blue-700",border:"border-blue-200"},knowledge:{label:"KNOW",glyph:"K",bg:"bg-emerald-50",fg:"text-emerald-700",border:"border-emerald-200"},lab:{label:"LAB",glyph:"L",bg:"bg-amber-50",fg:"text-amber-700",border:"border-amber-200"},delivery:{label:"DELIVERY",glyph:"D",bg:"bg-rose-50",fg:"text-rose-700",border:"border-rose-200"}};function Ome({kind:e,compact:t,className:n}){const s=Mme[e];if(!s)return null;const r=`inline-block border ${s.border} ${s.bg} ${s.fg} font-mono text-[8px] uppercase tracking-[0.14em] leading-none rounded-sm`,a=t?"px-1 py-[2px]":"px-1.5 py-0.5";return i.jsx("span",{"data-testid":`workspace-kind-badge-${e}`,title:`workspace kind: ${e}`,className:`${r} ${a} ${n??""}`.trim(),children:t?s.glyph:s.label})}function Lme(e,t){if(!e||!t)return null;let n=null;for(const s of t.repos)SP(e,s.path)&&s.path.length>((n==null?void 0:n.len)??-1)&&(n={kind:s.kind,len:s.path.length});return n?n.kind:t.knowledgeRoot&&SP(e,t.knowledgeRoot)?"knowledge":null}function SP(e,t){return!e||!t?!1:e===t?!0:e.startsWith(t.endsWith("/")?t:t+"/")}const Pme=new Set([".md",".txt",".log",".yaml",".yml",".json",".js",".jsx",".ts",".tsx",".py",".sh",".bash",".sql",".css",".html"]),$me=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]),Dme=new Set([".zip",".tar",".gz",".pdf",".mp4",".webm",".mov"]);function Mz(e){return!!(e&&typeof e=="object"&&"unavailable"in e)}function qme(){const e=Jm(),t=Ime(),[n,s]=C.useState(null),[r,a]=C.useState(""),[l,u]=C.useState(null),[d,f]=C.useState(!1);return C.useEffect(()=>{if(n||!e.data||Mz(e.data))return;const p=e.data.roots[0];p&&s(p.name)},[e.data,n]),C.useEffect(()=>{a(""),u(null),f(!1)},[n]),i.jsxs("div",{"data-testid":"files-workspace",className:"flex h-full flex-col lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",children:[i.jsxs("header",{className:"border-b border-stone-200 bg-stone-50 px-4 py-3",children:[i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:"Workspace"}),i.jsx("h1",{className:"font-headline text-xl font-bold tracking-tight text-stone-900",children:"Files"})]}),i.jsxs("div",{className:"flex flex-1 min-h-0 flex-col sm:flex-row",children:[i.jsxs("aside",{"data-testid":"files-tree-pane",className:"w-full max-h-48 shrink-0 overflow-y-auto border-b border-stone-200 bg-stone-50 sm:w-72 sm:max-h-none sm:border-b-0 sm:border-r",children:[i.jsx(zme,{roots:e.data,isLoading:e.isLoading,selectedRoot:n,onSelect:s,workspace:t.data??null}),n&&i.jsxs(i.Fragment,{children:[i.jsx(Bme,{root:n,path:r,onNavigate:a}),i.jsx(Fme,{root:n,path:r,onEnterDir:p=>{a(p),u(null)},onSelectFile:p=>{u(p),f(!1)},selectedFile:l})]})]}),i.jsxs("main",{"data-testid":"files-content-pane",className:"flex-1 min-w-0 overflow-y-auto bg-white",children:[!n&&i.jsx("div",{className:"m-auto p-4 font-mono text-[10px] text-stone-400",children:"Select an allowlist root to browse."}),n&&!l&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"files-no-selection",children:"Select a file from the tree."}),n&&l&&i.jsx(Hme,{root:n,path:l,editMode:d,onToggleEditMode:()=>f(p=>!p)})]})]})]})}function zme({roots:e,isLoading:t,selectedRoot:n,onSelect:s,workspace:r}){return t?i.jsx("div",{className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading roots…"}):e?Mz(e)?i.jsxs("div",{"data-testid":"files-roots-unavailable",className:"p-3 font-mono text-[10px] text-stone-500",children:[i.jsx("div",{children:"Files routes unavailable."}),e.hint&&i.jsx("div",{className:"mt-1 text-stone-400",children:e.hint})]}):e.roots.length===0?i.jsxs("div",{"data-testid":"files-roots-empty",className:"p-3 font-mono text-[10px] text-stone-500",children:[i.jsx("div",{children:"No allowlist roots configured."}),e.hint&&i.jsx("div",{className:"mt-1 text-stone-400",children:e.hint})]}):i.jsxs("div",{"data-testid":"files-root-selector",className:"border-b border-stone-200 p-2",children:[i.jsx("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.18em] text-stone-500",children:"Roots"}),i.jsx("ul",{children:e.roots.map(a=>{const l=Lme(a.path,r);return i.jsx("li",{children:i.jsxs("button",{type:"button","data-testid":`files-root-${a.name}`,"data-active":n===a.name,onClick:()=>s(a.name),className:`flex w-full items-center justify-between gap-2 px-2 py-1 text-left font-mono text-[10px] hover:bg-stone-100 ${n===a.name?"bg-stone-200/80 text-stone-900":"text-stone-700"}`,title:a.path,children:[i.jsx("span",{className:"truncate",children:a.name}),l&&i.jsx(Ome,{kind:l,compact:!0})]})},a.name)})})]}):null}function Bme({root:e,path:t,onNavigate:n}){const s=t?t.split("/"):[];return i.jsxs("nav",{"data-testid":"files-breadcrumbs",className:"flex flex-wrap items-baseline gap-1 border-b border-stone-200 px-2 py-1 font-mono text-[10px] text-stone-700",children:[i.jsx("button",{type:"button",onClick:()=>n(""),className:"font-bold hover:underline",children:e}),s.map((r,a)=>{const l=s.slice(0,a+1).join("/");return i.jsxs("span",{children:[i.jsx("span",{className:"mx-0.5 text-stone-400",children:"/"}),i.jsx("button",{type:"button",onClick:()=>n(l),className:"hover:underline",children:r})]},l)})]})}function Fme({root:e,path:t,onEnterDir:n,onSelectFile:s,selectedFile:r}){var l;const a=pD(e,t);return a.isLoading?i.jsx("div",{className:"p-3 font-mono text-[10px] text-stone-400",children:"Loading…"}):a.isError?i.jsx("div",{"data-testid":"files-list-error",className:"p-3 font-mono text-[10px] text-red-600",children:((l=a.error)==null?void 0:l.message)??"Error loading directory."}):!a.data||a.data.entries.length===0?i.jsx("div",{className:"p-3 font-mono text-[10px] text-stone-400",children:"Empty directory."}):i.jsxs("ul",{"data-testid":"files-directory-tree",className:"p-1",children:[t&&i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":"files-up",onClick:()=>n(Yme(t)),className:"block w-full px-2 py-1 text-left font-mono text-[10px] text-stone-500 hover:bg-stone-100",children:".."})}),a.data.entries.map(u=>{const d=t?`${t}/${u.name}`:u.name,f=u.type==="file",p=r===d;return i.jsx("li",{children:i.jsx("button",{type:"button","data-testid":`files-entry-${d}`,"data-type":u.type,onClick:()=>f?s(d):u.type==="dir"?n(d):void 0,disabled:u.type==="other",className:`block w-full px-2 py-1 text-left font-mono text-[10px] ${u.type==="other"?"text-stone-400":`hover:bg-stone-100 ${p?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,children:u.type==="dir"?`▸ ${u.name}`:u.name})},d)})]})}function Hme({root:e,path:t,editMode:n,onToggleEditMode:s}){var a;const r=eg(e,t);return i.jsxs("div",{"data-testid":"files-content-panel",className:"flex h-full flex-col",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2 font-mono text-[10px]",children:[i.jsxs("div",{className:"text-stone-700","data-testid":"files-content-path",children:[e,"/",t]}),i.jsxs("div",{className:"flex items-center gap-3 text-stone-500",children:[r.data&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{"data-testid":"files-content-size",children:[r.data.size,"b"]}),i.jsx("span",{"data-testid":"files-content-mtime",children:r.data.mtime})]}),i.jsx("button",{type:"button","data-testid":"files-edit-toggle","data-active":n,onClick:s,className:`border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${n?"border-amber-400 bg-amber-50 text-amber-900":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:n?"editing":"edit"})]})]}),i.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[r.isLoading&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}),r.isError&&i.jsx("div",{"data-testid":"files-read-error",className:"p-4 font-mono text-[10px] text-red-600",children:((a=r.error)==null?void 0:a.message)??"Error loading file."}),r.data&&(n?i.jsx(Kme,{root:e,path:t,read:r.data}):i.jsx(Ume,{root:e,path:t,read:r.data}))]})]})}function Ume({root:e,path:t,read:n}){const s=Wme(t),r=Vme(t);return $me.has(s)?i.jsxs("div",{"data-testid":"files-image-view",className:"p-4",children:[i.jsx(zp,{read:n}),i.jsx("img",{src:RN(e,t),alt:t,className:"max-w-full border border-stone-200"})]}):s===".md"?i.jsxs("div",{className:"p-4",children:[i.jsx(zp,{read:n}),i.jsx(Jr,{content:n.content})]}):Pme.has(s)?i.jsxs("div",{"data-testid":"files-code-view",className:"p-4",children:[i.jsx(zp,{read:n}),r&&i.jsx(Gme,{kind:r,yaml:n.content}),i.jsx(fg,{code:n.content,language:s.slice(1)})]}):Dme.has(s)?i.jsx("div",{"data-testid":"files-download-only",className:"p-4 font-mono text-[10px] text-stone-700",children:i.jsxs("a",{href:RN(e,t),download:!0,className:"text-blue-700 underline",children:["Download ",t]})}):i.jsxs("div",{"data-testid":"files-text-fallback",className:"p-4",children:[i.jsx(zp,{read:n}),i.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[10px] text-stone-800",children:n.content})]})}function zp({read:e}){if(!e.truncated)return null;const t=Math.round((e.totalBytes??e.size)/1024);return i.jsxs("div",{"data-testid":"files-truncation-marker","data-truncated-at-bytes":e.truncatedAtBytes??"","data-total-bytes":e.totalBytes??"",className:"mb-3 border border-amber-400 bg-amber-50 px-3 py-2 font-mono text-[10px] text-amber-900",children:["⚠ Truncated by file viewer at ",Math.round((e.truncatedAtBytes??0)/1024)," KB — file is ",t," KB total. Use an external editor for full content."]})}function Vme(e){const t=e.toLowerCase();return t.endsWith("/rig.yaml")||t==="rig.yaml"||t.endsWith("/rig.yml")||t==="rig.yml"?"rig":t.endsWith("/agent.yaml")||t==="agent.yaml"||t.endsWith("/agent.yml")||t==="agent.yml"?"agent":null}function Gme({kind:e,yaml:t}){var a;const n=Ame(e,t);if(n.isLoading)return i.jsxs("div",{"data-testid":"files-spec-validation-loading",className:"mb-3 border border-stone-300 bg-stone-50 px-3 py-2 font-mono text-[10px] text-stone-500",children:["Validating ",e,".yaml…"]});if(n.isError)return i.jsxs("div",{"data-testid":"files-spec-validation-error",className:"mb-3 border border-red-400 bg-red-50 px-3 py-2 font-mono text-[10px] text-red-900",children:["Validation failed to run: ",((a=n.error)==null?void 0:a.message)??"unknown error"]});if(!n.data)return null;const s=n.data.errors??[],r=s.length===0;return i.jsxs("div",{"data-testid":"files-spec-validation-panel","data-spec-kind":e,"data-valid":r,className:`mb-3 border px-3 py-2 font-mono text-[10px] ${r?"border-emerald-400 bg-emerald-50 text-emerald-900":"border-red-400 bg-red-50 text-red-900"}`,children:[i.jsx("div",{className:"mb-1 font-bold uppercase tracking-[0.10em]",children:r?`✓ Valid ${e==="rig"?"RigSpec":"AgentSpec"}`:`✗ ${e==="rig"?"RigSpec":"AgentSpec"} validation errors`}),s.length>0&&i.jsx("ul",{className:"space-y-1",children:s.map((l,u)=>i.jsxs("li",{"data-testid":`files-spec-validation-error-${u}`,className:"text-[10px]",children:[l.field&&i.jsxs("span",{className:"font-bold",children:[l.field,": "]}),l.message]},u))})]})}function Kme({root:e,path:t,read:n}){const[s,r]=C.useState(n.content),[a,l]=C.useState(null),[u,d]=C.useState(null),[f,p]=C.useState(!1),m=zK(),x=Mt();C.useEffect(()=>{r(n.content),d(null)},[n.contentHash,n.mtime,n.content]);const y=C.useMemo(()=>s!==n.content,[s,n.content]);return i.jsxs("div",{"data-testid":"files-editor",className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-stone-200 bg-amber-50 px-3 py-1.5 font-mono text-[9px]",children:[i.jsx("span",{className:"font-bold text-amber-900","data-testid":"files-editor-status",children:y?"draft (unsaved)":"no changes"}),i.jsx("button",{type:"button","data-testid":"files-editor-save",disabled:!y||m.isPending,onClick:()=>{l(null),d(null),p(!1),m.mutate({root:e,path:t,content:s,expectedMtime:n.mtime,expectedContentHash:n.contentHash,actor:"ui-files-edit-mode"},{onSuccess:v=>{"conflict"in v?d({currentMtime:v.currentMtime,currentContentHash:v.currentContentHash}):(p(!0),setTimeout(()=>p(!1),2e3))},onError:v=>{l(v instanceof Error?v.message:String(v))}})},className:"border border-emerald-500 bg-emerald-50 px-2 py-0.5 uppercase tracking-[0.10em] text-emerald-900 disabled:cursor-not-allowed disabled:opacity-50",children:"save"}),i.jsx("button",{type:"button","data-testid":"files-editor-cancel",onClick:()=>{r(n.content),l(null),d(null)},className:"border border-stone-400 bg-white px-2 py-0.5 uppercase tracking-[0.10em] text-stone-700",children:"cancel"}),f&&i.jsx("span",{"data-testid":"files-editor-saved",className:"ml-auto text-emerald-700",children:"saved"})]}),u&&i.jsxs("div",{"data-testid":"files-editor-conflict",className:"flex items-center gap-2 border-b border-red-200 bg-red-50 px-3 py-2 font-mono text-[10px] text-red-900",children:[i.jsxs("span",{className:"flex-1",children:["File changed externally. Local mtime ",i.jsx("code",{children:n.mtime})," ≠ server ",i.jsx("code",{children:u.currentMtime}),". Click Refresh to re-read the file (your draft will be replaced with the new server content; copy it elsewhere first if you need to re-apply)."]}),i.jsx("button",{type:"button","data-testid":"files-editor-refresh",onClick:()=>{x.invalidateQueries({queryKey:["files","read",e,t]})},className:"border border-red-500 bg-white px-2 py-0.5 uppercase tracking-[0.10em] text-red-900",children:"refresh"})]}),a&&i.jsxs("div",{"data-testid":"files-editor-error",className:"border-b border-red-200 bg-red-50 px-3 py-2 font-mono text-[10px] text-red-900",children:["Save failed: ",a]}),i.jsx("textarea",{"data-testid":"files-editor-textarea",value:s,onChange:v=>r(v.target.value),className:"flex-1 min-h-0 resize-none border-0 bg-stone-50 p-3 font-mono text-[11px] leading-relaxed text-stone-900 outline-none",spellCheck:!1})]})}function Wme(e){const t=e.lastIndexOf(".");return t===-1?"":e.slice(t).toLowerCase()}function Yme(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function ox({testId:e,title:t,children:n}){return i.jsxs("div",{"data-testid":e,className:"mx-auto w-full max-w-[960px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:"Configuration"}),i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:t})]}),n]})}function Qme(){return i.jsx(ox,{testId:"settings-center",title:"Settings",children:i.jsx(OD,{})})}const NP="policies.claude_compaction.enabled",kP="policies.claude_compaction.threshold_percent",_P="policies.claude_compaction.pre_compact_instruction",CP="policies.claude_compaction.compact_instruction",EP="policies.claude_compaction.message_inline",RP="policies.claude_compaction.message_file_path",AP="policies.claude_compaction.post_restore_audit_instruction";function Xme(e,t){return typeof e=="boolean"?e:e==="true"?!0:e==="false"?!1:t}function Zme(e,t){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){const n=Number(e);if(!Number.isNaN(n))return n}return t}function Xu(e){return typeof e=="string"?e:e==null?"":String(e)}function Jme(){const{data:e,isLoading:t,error:n}=wa(),s=V2();return e?i.jsx(ege,{data:e.settings,setSetting:s}):i.jsxs("section",{"data-testid":"claude-compaction-policy-form",className:"border border-outline-variant p-5 bg-white/50",children:[i.jsx(it,{tone:"muted",children:"Policy"}),i.jsx("h2",{className:"font-headline text-headline-sm font-bold tracking-tight uppercase text-stone-900 mt-1",children:"Claude Auto-Compaction"}),t&&i.jsx("p",{className:"mt-4 text-sm text-on-surface-variant","data-testid":"claude-compaction-policy-loading",children:"Loading current settings…"}),n&&i.jsx("p",{className:"mt-4 text-sm text-error","data-testid":"claude-compaction-policy-error",children:n instanceof Error?n.message:String(n)})]})}function ege({data:e,setSetting:t}){const[n,s]=C.useState(()=>{var m,x,y,v,b,w,S;return{enabled:Xme((m=e[NP])==null?void 0:m.value,!1),thresholdPercent:String(Zme((x=e[kP])==null?void 0:x.value,80)),preCompactInstruction:Xu((y=e[_P])==null?void 0:y.value),compactInstruction:Xu((v=e[CP])==null?void 0:v.value),messageInline:Xu((b=e[EP])==null?void 0:b.value),messageFilePath:Xu((w=e[RP])==null?void 0:w.value),postRestoreAuditInstruction:Xu((S=e[AP])==null?void 0:S.value)}}),[r,a]=C.useState(null),[l,u]=C.useState(null),[d,f]=C.useState(!1);async function p(m){m.preventDefault(),f(!1),u(null);const x=n.thresholdPercent.trim(),y=Number(x);if(!/^\d+$/.test(x)||y<1||y>100){a("Threshold must be an integer between 1 and 100.");return}a(null);const v=[{key:NP,value:n.enabled?"true":"false"},{key:kP,value:String(y)},{key:_P,value:n.preCompactInstruction},{key:CP,value:n.compactInstruction},{key:EP,value:n.messageInline},{key:RP,value:n.messageFilePath},{key:AP,value:n.postRestoreAuditInstruction}];try{for(const b of v)await t.mutateAsync(b);f(!0)}catch(b){u(b instanceof Error?b.message:String(b))}}return i.jsxs("section",{"data-testid":"claude-compaction-policy-form",className:"border border-outline-variant p-5 bg-white/50",children:[i.jsx(it,{tone:"muted",children:"Policy"}),i.jsx("h2",{className:"font-headline text-headline-sm font-bold tracking-tight uppercase text-stone-900 mt-1",children:"Claude Auto-Compaction"}),i.jsxs("p",{className:"mt-2 text-sm text-on-surface-variant max-w-prose",children:["When a Claude seat's context usage crosses the configured threshold, OpenRig first sends a preparation message, then sends",i.jsx("code",{className:"font-mono text-[12px]",children:" /compact"})," on the next eligible observation. After compaction, OpenRig sends one restore prompt that points the seat at its restore packet, followed by a read-depth audit prompt."]}),i.jsxs("form",{className:"mt-4 flex flex-col gap-5",onSubmit:p,"data-testid":"claude-compaction-policy-form-element",children:[i.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-stone-900",children:[i.jsx("input",{type:"checkbox","data-testid":"claude-compaction-enabled",checked:n.enabled,onChange:m=>s(x=>({...x,enabled:m.target.checked}))}),i.jsx("span",{children:"Enable automatic pre-compaction trigger"})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-threshold",className:"text-sm font-medium text-stone-900",children:"Threshold percentage"}),i.jsx("input",{id:"claude-compaction-threshold","data-testid":"claude-compaction-threshold",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:n.thresholdPercent,onChange:m=>s(x=>({...x,thresholdPercent:m.target.value})),className:"border border-outline-variant px-2 py-1 w-32 font-mono text-sm","aria-describedby":"claude-compaction-threshold-hint"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Preparation starts when context usage is at-or-above this percentage (1–100)."}),r&&i.jsx("span",{className:"text-xs text-error","data-testid":"claude-compaction-threshold-error",children:r})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-pre-compact-instruction",className:"text-sm font-medium text-stone-900",children:"Pre-compaction prep message"}),i.jsx("textarea",{id:"claude-compaction-pre-compact-instruction","data-testid":"claude-compaction-pre-compact-instruction",rows:4,value:n.preCompactInstruction,onChange:m=>s(x=>({...x,preCompactInstruction:m.target.value})),placeholder:"Read the claude-compaction-restore skill and prepare for compaction.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"OpenRig wraps this with the current context usage, threshold, and operator-authorized user-channel framing."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-compact-instruction",className:"text-sm font-medium text-stone-900",children:"Compaction instruction"}),i.jsx("textarea",{id:"claude-compaction-compact-instruction","data-testid":"claude-compaction-compact-instruction",rows:3,value:n.compactInstruction,onChange:m=>s(x=>({...x,compactInstruction:m.target.value})),placeholder:"Optional. Sent as /compact <instruction> when OpenRig triggers compaction.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Optional advanced override. Leave blank to rely on Claude's native compaction summary; OpenRig still appends a trust-channel note."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-inline",className:"text-sm font-medium text-stone-900",children:"Post-compaction restore instruction (inline)"}),i.jsx("textarea",{id:"claude-compaction-inline","data-testid":"claude-compaction-message-inline",rows:4,value:n.messageInline,onChange:m=>s(x=>({...x,messageInline:m.target.value})),placeholder:"Optional override. Leave blank to use the instruction file path below.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Default asks Claude to read the claude-compaction-restore skill. OpenRig wraps this with marker, transcript, and current-task framing."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-file",className:"text-sm font-medium text-stone-900",children:"Post-compaction restore instruction (file path)"}),i.jsx("input",{id:"claude-compaction-file","data-testid":"claude-compaction-message-file-path",type:"text",value:n.messageFilePath,onChange:m=>s(x=>({...x,messageFilePath:m.target.value})),placeholder:"Path read at hook-fire time for extra restore instructions.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"Default points at a user-owned placeholder file. Put mission-specific reading lists or extra restore notes there without changing the canonical skill."})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("label",{htmlFor:"claude-compaction-post-restore-audit",className:"text-sm font-medium text-stone-900",children:"Post-restore audit message"}),i.jsx("textarea",{id:"claude-compaction-post-restore-audit","data-testid":"claude-compaction-post-restore-audit-instruction",rows:4,value:n.postRestoreAuditInstruction,onChange:m=>s(x=>({...x,postRestoreAuditInstruction:m.target.value})),placeholder:"Read the claude-compaction-restore skill and audit restore read depth.",className:"border border-outline-variant px-2 py-1 font-mono text-sm"}),i.jsx("span",{className:"text-xs text-on-surface-variant",children:"OpenRig wraps this with the required FULL/PARTIAL/NOT_READ table and no-token-conservation language."})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{type:"submit","data-testid":"claude-compaction-policy-submit",disabled:t.isPending,className:"border border-outline px-4 py-2 bg-stone-900 text-white font-medium text-sm disabled:opacity-60",children:t.isPending?"Saving…":"Save policy"}),d&&i.jsx("span",{className:"text-sm text-success","data-testid":"claude-compaction-policy-saved",children:"Saved."}),l&&i.jsx("span",{className:"text-sm text-error","data-testid":"claude-compaction-policy-submit-error",children:l})]})]})]})}function tge(){return i.jsxs(ox,{testId:"settings-page-policies",title:"Policies",children:[i.jsx("p",{className:"mb-6 text-sm text-on-surface-variant max-w-prose",children:"Opt-in policies that affect agent runtime behavior. Each policy ships disabled by default and can be turned on independently."}),i.jsx("div",{className:"flex flex-col gap-6",children:i.jsx(Jme,{})})]})}const nge=["summary","body","detail","message","title","text","description"],sge=new Set(["ts","ts_created","ts_updated","ts_emitted","created_at","updated_at","received_at","stream_sort_key","audit_pointer"]);function a2(e,t=40){return e.length<=t?e:e.slice(0,t-1)+"…"}function rge(e){if(e==null)return null;if(typeof e=="string"){const t=e.trim();return t.length>0?a2(t):null}return typeof e=="number"||typeof e=="boolean"?String(e):null}function TP(e){if(!e||typeof e!="object")return"—";const t=e;for(const s of nge){const r=t[s];if(typeof r=="string"&&r.trim().length>0)return a2(r.trim(),200)}const n=[];for(const[s,r]of Object.entries(t)){if(sge.has(s))continue;const a=rge(r);if(a!==null&&(n.push(`${s}=${a}`),n.length>=4))break}if(n.length>0)return n.join(" · ");try{const s=JSON.stringify(t);return a2(s,200)}catch{return"—"}}function ige(){const{events:e}=ck();return i.jsx(ox,{testId:"settings-page-log",title:"Log",children:e.length===0?i.jsx(Ge,{label:"LOG IS QUIET",description:"Activity events from rigs will stream here.",variant:"card",testId:"settings-log-empty"}):i.jsx("ul",{"data-testid":"settings-log-stream",className:"divide-y divide-outline-variant border border-outline-variant max-h-[60vh] overflow-y-auto",children:e.slice(0,100).map(t=>i.jsxs("li",{className:"px-3 py-2 flex items-baseline gap-3 font-mono text-xs",children:[i.jsx("span",{className:"text-on-surface-variant text-[10px] uppercase tracking-wide w-32 shrink-0 truncate",children:t.type}),i.jsx("span",{className:"text-stone-900 truncate",title:TP(t.payload),children:TP(t.payload)})]},t.seq))})})}const IP={active:"bg-success",running:"bg-success",stopped:"bg-stone-400",warning:"bg-warning",error:"bg-tertiary",info:"bg-secondary"},age={active:"border-success text-success",running:"border-success text-success",stopped:"border-stone-400 text-stone-500",warning:"border-warning text-warning",error:"border-tertiary text-tertiary",info:"border-secondary text-secondary"};function Bm({status:e,label:t,variant:n="dot",className:s,labelClassName:r,testId:a}){const l=t??e;return n==="pill"?i.jsxs("span",{"data-testid":a,className:he("inline-flex items-center gap-1 px-1.5 py-0.5 border font-mono text-[9px] uppercase tracking-wide",age[e],s),role:"status","aria-label":l,children:[i.jsx("span",{className:he("w-1.5 h-1.5 rounded-full",IP[e]),"aria-hidden":"true"}),i.jsx("span",{className:r,children:l})]}):i.jsxs("span",{"data-testid":a,className:he("inline-flex items-center gap-1.5",s),role:"status","aria-label":l,children:[i.jsx("span",{className:he("w-2 h-2 rounded-full",IP[e]),"aria-hidden":"true"}),t?i.jsx("span",{className:he("font-mono text-[9px] uppercase tracking-wide text-on-surface-variant",r),children:t}):null]})}async function oge(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function lge(){const e=await fetch("/api/adapters/cmux/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function cge(){var x;const e=qe({queryKey:["daemon","health"],queryFn:oge,refetchInterval:1e4,retry:!1}),t=qe({queryKey:["daemon","cmux"],queryFn:lge,refetchInterval:3e4,retry:!1}),{data:n,isLoading:s,error:r}=dr(),{data:a}=Xm(),l=e.isSuccess,u=l?((x=t.data)==null?void 0:x.available)??null:null,d=(n==null?void 0:n.length)??0,f=(a==null?void 0:a.filter(y=>y.runningCount>0).length)??0,p=l?"active":e.isError?"error":e.isLoading?"info":"stopped",m=u===!0?"active":u===!1?"warning":"info";return i.jsxs("div",{"data-testid":"settings-status-panel",className:"space-y-4",children:[i.jsxs("section",{children:[i.jsx(it,{tone:"muted",children:"Daemon"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between font-mono text-xs",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Reachable"}),i.jsx(Bm,{status:p,label:l?"OK":e.isError?"ERROR":e.isLoading?"LOADING":"DISCONNECTED",variant:"pill",testId:"status-daemon"})]})]}),i.jsxs("section",{children:[i.jsx(it,{tone:"muted",children:"Cmux control"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between font-mono text-xs",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Adapter"}),i.jsx(Bm,{status:m,label:u===!0?"AVAILABLE":u===!1?"UNAVAILABLE":"UNKNOWN",variant:"pill",testId:"status-cmux"})]}),i.jsx("div",{className:"mt-1 font-mono text-[10px] text-on-surface-variant",children:"OpenRig can control cmux surfaces for node open-or-focus."})]}),i.jsxs("section",{children:[i.jsx(it,{tone:"muted",children:"Rigs"}),i.jsxs("div",{className:"mt-2 space-y-1.5 font-mono text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Total"}),i.jsx("span",{className:"text-stone-900 font-bold","data-testid":"status-rigs-total",children:d})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-on-surface-variant",children:"Running"}),i.jsx("span",{className:"text-stone-900 font-bold","data-testid":"status-rigs-running",children:f})]})]})]})]})}function uge(){return i.jsx(ox,{testId:"settings-page-status",title:"Status",children:i.jsx(cge,{})})}function $_({tabs:e,active:t,onSelect:n,testIdPrefix:s="topology-view-mode",trailing:r}){const a=i.jsx("div",{role:"tablist","aria-label":"Topology view modes","data-testid":`${s}-tabs`,className:"flex gap-6 items-center",children:e.map(l=>i.jsx("button",{type:"button",role:"tab","aria-selected":t===l.id,"data-testid":`${s}-tab-${l.id}`,"data-active":t===l.id,onClick:()=>n(l.id),className:he("py-3 font-mono text-[10px] uppercase tracking-[0.18em] border-b-2",t===l.id?"border-stone-900 text-stone-900":"border-transparent text-on-surface-variant hover:text-stone-900"),children:l.label},l.id))});return r?i.jsxs("div",{"data-testid":`${s}-tab-bar`,className:"flex items-center",children:[a,i.jsx("div",{"data-testid":`${s}-trailing`,className:"ml-auto",children:r})]}):a}const dge=[{id:"graph",label:"Graph"},{id:"table",label:"Table"},{id:"terminal",label:"Terminal"}],Oz=[{id:"graph",label:"Graph"},{id:"table",label:"Table"},{id:"terminal",label:"Terminal"},{id:"overview",label:"Overview"}];/**
525
+ * table-core
526
+ *
527
+ * Copyright (c) TanStack
528
+ *
529
+ * This source code is licensed under the MIT license found in the
530
+ * LICENSE.md file in the root directory of this source tree.
531
+ *
532
+ * @license MIT
533
+ */function ia(e,t){return typeof e=="function"?e(t):e}function as(e,t){return n=>{t.setState(s=>({...s,[e]:ia(n,s[e])}))}}function lx(e){return e instanceof Function}function fge(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function hge(e,t){const n=[],s=r=>{r.forEach(a=>{n.push(a);const l=t(a);l!=null&&l.length&&s(l)})};return s(e),n}function Le(e,t,n){let s=[],r;return a=>{let l;n.key&&n.debug&&(l=Date.now());const u=e(a);if(!(u.length!==s.length||u.some((p,m)=>s[m]!==p)))return r;s=u;let f;if(n.key&&n.debug&&(f=Date.now()),r=t(...u),n==null||n.onChange==null||n.onChange(r),n.key&&n.debug&&n!=null&&n.debug()){const p=Math.round((Date.now()-l)*100)/100,m=Math.round((Date.now()-f)*100)/100,x=m/16,y=(v,b)=>{for(v=String(v);v.length<b;)v=" "+v;return v};console.info(`%c⏱ ${y(m,5)} /${y(p,5)} ms`,`
534
+ font-size: .6rem;
535
+ font-weight: bold;
536
+ color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,n==null?void 0:n.key)}return r}}function Pe(e,t,n,s){return{debug:()=>{var r;return(r=e==null?void 0:e.debugAll)!=null?r:e[t]},key:!1,onChange:s}}function pge(e,t,n,s){const r=()=>{var l;return(l=a.getValue())!=null?l:e.options.renderFallbackValue},a={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(s),renderValue:r,getContext:Le(()=>[e,n,t,a],(l,u,d,f)=>({table:l,column:u,row:d,cell:f,getValue:f.getValue,renderValue:f.renderValue}),Pe(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(a,n,t,e)},{}),a}function mge(e,t,n,s){var r,a;const u={...e._getDefaultColumnDef(),...t},d=u.accessorKey;let f=(r=(a=u.id)!=null?a:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,p;if(u.accessorFn?p=u.accessorFn:d&&(d.includes(".")?p=x=>{let y=x;for(const b of d.split(".")){var v;y=(v=y)==null?void 0:v[b]}return y}:p=x=>x[u.accessorKey]),!f)throw new Error;let m={id:`${String(f)}`,accessorFn:p,parent:s,depth:n,columnDef:u,columns:[],getFlatColumns:Le(()=>[!0],()=>{var x;return[m,...(x=m.columns)==null?void 0:x.flatMap(y=>y.getFlatColumns())]},Pe(e.options,"debugColumns")),getLeafColumns:Le(()=>[e._getOrderColumnsFn()],x=>{var y;if((y=m.columns)!=null&&y.length){let v=m.columns.flatMap(b=>b.getLeafColumns());return x(v)}return[m]},Pe(e.options,"debugColumns"))};for(const x of e._features)x.createColumn==null||x.createColumn(m,e);return m}const mn="debugHeaders";function MP(e,t,n){var s;let a={id:(s=n.id)!=null?s:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],u=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(u),l.push(d)};return u(a),l},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(a,e)}),a}const gge={createTable:e=>{e.getHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,r)=>{var a,l;const u=(a=s==null?void 0:s.map(m=>n.find(x=>x.id===m)).filter(Boolean))!=null?a:[],d=(l=r==null?void 0:r.map(m=>n.find(x=>x.id===m)).filter(Boolean))!=null?l:[],f=n.filter(m=>!(s!=null&&s.includes(m.id))&&!(r!=null&&r.includes(m.id)));return Bp(t,[...u,...f,...d],e)},Pe(e.options,mn)),e.getCenterHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,r)=>(n=n.filter(a=>!(s!=null&&s.includes(a.id))&&!(r!=null&&r.includes(a.id))),Bp(t,n,e,"center")),Pe(e.options,mn)),e.getLeftHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,s)=>{var r;const a=(r=s==null?void 0:s.map(l=>n.find(u=>u.id===l)).filter(Boolean))!=null?r:[];return Bp(t,a,e,"left")},Pe(e.options,mn)),e.getRightHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,s)=>{var r;const a=(r=s==null?void 0:s.map(l=>n.find(u=>u.id===l)).filter(Boolean))!=null?r:[];return Bp(t,a,e,"right")},Pe(e.options,mn)),e.getFooterGroups=Le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Pe(e.options,mn)),e.getLeftFooterGroups=Le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Pe(e.options,mn)),e.getCenterFooterGroups=Le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Pe(e.options,mn)),e.getRightFooterGroups=Le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Pe(e.options,mn)),e.getFlatHeaders=Le(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),Pe(e.options,mn)),e.getLeftFlatHeaders=Le(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),Pe(e.options,mn)),e.getCenterFlatHeaders=Le(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),Pe(e.options,mn)),e.getRightFlatHeaders=Le(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),Pe(e.options,mn)),e.getCenterLeafHeaders=Le(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Pe(e.options,mn)),e.getLeftLeafHeaders=Le(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Pe(e.options,mn)),e.getRightLeafHeaders=Le(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),Pe(e.options,mn)),e.getLeafHeaders=Le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,s)=>{var r,a,l,u,d,f;return[...(r=(a=t[0])==null?void 0:a.headers)!=null?r:[],...(l=(u=n[0])==null?void 0:u.headers)!=null?l:[],...(d=(f=s[0])==null?void 0:f.headers)!=null?d:[]].map(p=>p.getLeafHeaders()).flat()},Pe(e.options,mn))}};function Bp(e,t,n,s){var r,a;let l=0;const u=function(x,y){y===void 0&&(y=1),l=Math.max(l,y),x.filter(v=>v.getIsVisible()).forEach(v=>{var b;(b=v.columns)!=null&&b.length&&u(v.columns,y+1)},0)};u(e);let d=[];const f=(x,y)=>{const v={depth:y,id:[s,`${y}`].filter(Boolean).join("_"),headers:[]},b=[];x.forEach(w=>{const S=[...b].reverse()[0],E=w.column.depth===v.depth;let k,_=!1;if(E&&w.column.parent?k=w.column.parent:(k=w.column,_=!0),S&&(S==null?void 0:S.column)===k)S.subHeaders.push(w);else{const R=MP(n,k,{id:[s,y,k.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${b.filter(T=>T.column===k).length}`:void 0,depth:y,index:b.length});R.subHeaders.push(w),b.push(R)}v.headers.push(w),w.headerGroup=v}),d.push(v),y>0&&f(b,y-1)},p=t.map((x,y)=>MP(n,x,{depth:l,index:y}));f(p,l-1),d.reverse();const m=x=>x.filter(v=>v.column.getIsVisible()).map(v=>{let b=0,w=0,S=[0];v.subHeaders&&v.subHeaders.length?(S=[],m(v.subHeaders).forEach(k=>{let{colSpan:_,rowSpan:R}=k;b+=_,S.push(R)})):b=1;const E=Math.min(...S);return w=w+E,v.colSpan=b,v.rowSpan=w,{colSpan:b,rowSpan:w}});return m((r=(a=d[0])==null?void 0:a.headers)!=null?r:[]),d}const D_=(e,t,n,s,r,a,l)=>{let u={id:t,index:s,original:n,depth:r,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(u._valuesCache.hasOwnProperty(d))return u._valuesCache[d];const f=e.getColumn(d);if(f!=null&&f.accessorFn)return u._valuesCache[d]=f.accessorFn(u.original,s),u._valuesCache[d]},getUniqueValues:d=>{if(u._uniqueValuesCache.hasOwnProperty(d))return u._uniqueValuesCache[d];const f=e.getColumn(d);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(u._uniqueValuesCache[d]=f.columnDef.getUniqueValues(u.original,s),u._uniqueValuesCache[d]):(u._uniqueValuesCache[d]=[u.getValue(d)],u._uniqueValuesCache[d])},renderValue:d=>{var f;return(f=u.getValue(d))!=null?f:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>hge(u.subRows,d=>d.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let d=[],f=u;for(;;){const p=f.getParentRow();if(!p)break;d.push(p),f=p}return d.reverse()},getAllCells:Le(()=>[e.getAllLeafColumns()],d=>d.map(f=>pge(e,u,f,f.id)),Pe(e.options,"debugRows")),_getAllCellsByColumnId:Le(()=>[u.getAllCells()],d=>d.reduce((f,p)=>(f[p.column.id]=p,f),{}),Pe(e.options,"debugRows"))};for(let d=0;d<e._features.length;d++){const f=e._features[d];f==null||f.createRow==null||f.createRow(u,e)}return u},xge={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Lz=(e,t,n)=>{var s,r;const a=n==null||(s=n.toString())==null?void 0:s.toLowerCase();return!!(!((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(a))};Lz.autoRemove=e=>zs(e);const Pz=(e,t,n)=>{var s;return!!(!((s=e.getValue(t))==null||(s=s.toString())==null)&&s.includes(n))};Pz.autoRemove=e=>zs(e);const $z=(e,t,n)=>{var s;return((s=e.getValue(t))==null||(s=s.toString())==null?void 0:s.toLowerCase())===(n==null?void 0:n.toLowerCase())};$z.autoRemove=e=>zs(e);const Dz=(e,t,n)=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(n)};Dz.autoRemove=e=>zs(e);const qz=(e,t,n)=>!n.some(s=>{var r;return!((r=e.getValue(t))!=null&&r.includes(s))});qz.autoRemove=e=>zs(e)||!(e!=null&&e.length);const zz=(e,t,n)=>n.some(s=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(s)});zz.autoRemove=e=>zs(e)||!(e!=null&&e.length);const Bz=(e,t,n)=>e.getValue(t)===n;Bz.autoRemove=e=>zs(e);const Fz=(e,t,n)=>e.getValue(t)==n;Fz.autoRemove=e=>zs(e);const q_=(e,t,n)=>{let[s,r]=n;const a=e.getValue(t);return a>=s&&a<=r};q_.resolveFilterValue=e=>{let[t,n]=e,s=typeof t!="number"?parseFloat(t):t,r=typeof n!="number"?parseFloat(n):n,a=t===null||Number.isNaN(s)?-1/0:s,l=n===null||Number.isNaN(r)?1/0:r;if(a>l){const u=a;a=l,l=u}return[a,l]};q_.autoRemove=e=>zs(e)||zs(e[0])&&zs(e[1]);const zr={includesString:Lz,includesStringSensitive:Pz,equalsString:$z,arrIncludes:Dz,arrIncludesAll:qz,arrIncludesSome:zz,equals:Bz,weakEquals:Fz,inNumberRange:q_};function zs(e){return e==null||e===""}const yge={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:as("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);return typeof s=="string"?zr.includesString:typeof s=="number"?zr.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?zr.equals:Array.isArray(s)?zr.arrIncludes:zr.weakEquals},e.getFilterFn=()=>{var n,s;return lx(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(s=t.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?n:zr[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,s,r;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((s=t.options.enableColumnFilters)!=null?s:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(s=>s.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,s;return(n=(s=t.getState().columnFilters)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(s=>{const r=e.getFilterFn(),a=s==null?void 0:s.find(p=>p.id===e.id),l=ia(n,a?a.value:void 0);if(OP(r,l,e)){var u;return(u=s==null?void 0:s.filter(p=>p.id!==e.id))!=null?u:[]}const d={id:e.id,value:l};if(a){var f;return(f=s==null?void 0:s.map(p=>p.id===e.id?d:p))!=null?f:[]}return s!=null&&s.length?[...s,d]:[d]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),s=r=>{var a;return(a=ia(t,r))==null?void 0:a.filter(l=>{const u=n.find(d=>d.id===l.id);if(u){const d=u.getFilterFn();if(OP(d,l.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=t=>{var n,s;e.setColumnFilters(t?[]:(n=(s=e.initialState)==null?void 0:s.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function OP(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const vge=(e,t,n)=>n.reduce((s,r)=>{const a=r.getValue(e);return s+(typeof a=="number"?a:0)},0),bge=(e,t,n)=>{let s;return n.forEach(r=>{const a=r.getValue(e);a!=null&&(s>a||s===void 0&&a>=a)&&(s=a)}),s},wge=(e,t,n)=>{let s;return n.forEach(r=>{const a=r.getValue(e);a!=null&&(s<a||s===void 0&&a>=a)&&(s=a)}),s},jge=(e,t,n)=>{let s,r;return n.forEach(a=>{const l=a.getValue(e);l!=null&&(s===void 0?l>=l&&(s=r=l):(s>l&&(s=l),r<l&&(r=l)))}),[s,r]},Sge=(e,t)=>{let n=0,s=0;if(t.forEach(r=>{let a=r.getValue(e);a!=null&&(a=+a)>=a&&(++n,s+=a)}),n)return s/n},Nge=(e,t)=>{if(!t.length)return;const n=t.map(a=>a.getValue(e));if(!fge(n))return;if(n.length===1)return n[0];const s=Math.floor(n.length/2),r=n.sort((a,l)=>a-l);return n.length%2!==0?r[s]:(r[s-1]+r[s])/2},kge=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),_ge=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Cge=(e,t)=>t.length,HS={sum:vge,min:bge,max:wge,extent:jge,mean:Sge,median:Nge,unique:kge,uniqueCount:_ge,count:Cge},Ege={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:as("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(s=>s!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,s;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((s=t.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);if(typeof s=="number")return HS.sum;if(Object.prototype.toString.call(s)==="[object Date]")return HS.extent},e.getAggregationFn=()=>{var n,s;if(!e)throw new Error;return lx(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(s=t.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?n:HS[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,s;e.setGrouping(t?[]:(n=(s=e.initialState)==null?void 0:s.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const s=t.getColumn(n);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[n]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,s)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=n.subRows)!=null&&r.length)}}};function Rge(e,t,n){if(!(t!=null&&t.length)||!n)return e;const s=e.filter(a=>!t.includes(a.id));return n==="remove"?s:[...t.map(a=>e.find(l=>l.id===a)).filter(Boolean),...s]}const Age={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:as("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Le(n=>[xd(t,n)],n=>n.findIndex(s=>s.id===e.id),Pe(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var s;return((s=xd(t,n)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=n=>{var s;const r=xd(t,n);return((s=r[r.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,s)=>r=>{let a=[];if(!(t!=null&&t.length))a=r;else{const l=[...t],u=[...r];for(;u.length&&l.length;){const d=l.shift(),f=u.findIndex(p=>p.id===d);f>-1&&a.push(u.splice(f,1)[0])}a=[...a,...u]}return Rge(a,n,s)},Pe(e.options,"debugTable"))}},US=()=>({left:[],right:[]}),Tge={getInitialState:e=>({columnPinning:US(),...e}),getDefaultOptions:e=>({onColumnPinningChange:as("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const s=e.getLeafColumns().map(r=>r.id).filter(Boolean);t.setColumnPinning(r=>{var a,l;if(n==="right"){var u,d;return{left:((u=r==null?void 0:r.left)!=null?u:[]).filter(m=>!(s!=null&&s.includes(m))),right:[...((d=r==null?void 0:r.right)!=null?d:[]).filter(m=>!(s!=null&&s.includes(m))),...s]}}if(n==="left"){var f,p;return{left:[...((f=r==null?void 0:r.left)!=null?f:[]).filter(m=>!(s!=null&&s.includes(m))),...s],right:((p=r==null?void 0:r.right)!=null?p:[]).filter(m=>!(s!=null&&s.includes(m)))}}return{left:((a=r==null?void 0:r.left)!=null?a:[]).filter(m=>!(s!=null&&s.includes(m))),right:((l=r==null?void 0:r.right)!=null?l:[]).filter(m=>!(s!=null&&s.includes(m)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var r,a,l;return((r=s.columnDef.enablePinning)!=null?r:!0)&&((a=(l=t.options.enableColumnPinning)!=null?l:t.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(u=>u.id),{left:s,right:r}=t.getState().columnPinning,a=n.some(u=>s==null?void 0:s.includes(u)),l=n.some(u=>r==null?void 0:r.includes(u));return a?"left":l?"right":!1},e.getPinnedIndex=()=>{var n,s;const r=e.getIsPinned();return r?(n=(s=t.getState().columnPinning)==null||(s=s[r])==null?void 0:s.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,s,r)=>{const a=[...s??[],...r??[]];return n.filter(l=>!a.includes(l.column.id))},Pe(t.options,"debugRows")),e.getLeftVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,s)=>(s??[]).map(a=>n.find(l=>l.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),Pe(t.options,"debugRows")),e.getRightVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,s)=>(s??[]).map(a=>n.find(l=>l.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),Pe(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,s;return e.setColumnPinning(t?US():(n=(s=e.initialState)==null?void 0:s.columnPinning)!=null?n:US())},e.getIsSomeColumnsPinned=t=>{var n;const s=e.getState().columnPinning;if(!t){var r,a;return!!((r=s.left)!=null&&r.length||(a=s.right)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e.getLeftLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(r=>r.id===s)).filter(Boolean),Pe(e.options,"debugColumns")),e.getRightLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(s=>t.find(r=>r.id===s)).filter(Boolean),Pe(e.options,"debugColumns")),e.getCenterLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s)=>{const r=[...n??[],...s??[]];return t.filter(a=>!r.includes(a.id))},Pe(e.options,"debugColumns"))}};function Ige(e){return e||(typeof document<"u"?document:null)}const Fp={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},VS=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Mge={getDefaultColumnDef:()=>Fp,getInitialState:e=>({columnSizing:{},columnSizingInfo:VS(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:as("columnSizing",e),onColumnSizingInfoChange:as("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,s,r;const a=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:Fp.minSize,(s=a??e.columnDef.size)!=null?s:Fp.size),(r=e.columnDef.maxSize)!=null?r:Fp.maxSize)},e.getStart=Le(n=>[n,xd(t,n),t.getState().columnSizing],(n,s)=>s.slice(0,e.getIndex(n)).reduce((r,a)=>r+a.getSize(),0),Pe(t.options,"debugColumns")),e.getAfter=Le(n=>[n,xd(t,n),t.getState().columnSizing],(n,s)=>s.slice(e.getIndex(n)+1).reduce((r,a)=>r+a.getSize(),0),Pe(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:s,...r}=n;return r})},e.getCanResize=()=>{var n,s;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((s=t.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const s=r=>{if(r.subHeaders.length)r.subHeaders.forEach(s);else{var a;n+=(a=r.column.getSize())!=null?a:0}};return s(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const s=t.getColumn(e.column.id),r=s==null?void 0:s.getCanResize();return a=>{if(!s||!r||(a.persist==null||a.persist(),GS(a)&&a.touches&&a.touches.length>1))return;const l=e.getSize(),u=e?e.getLeafHeaders().map(S=>[S.column.id,S.column.getSize()]):[[s.id,s.getSize()]],d=GS(a)?Math.round(a.touches[0].clientX):a.clientX,f={},p=(S,E)=>{typeof E=="number"&&(t.setColumnSizingInfo(k=>{var _,R;const T=t.options.columnResizeDirection==="rtl"?-1:1,A=(E-((_=k==null?void 0:k.startOffset)!=null?_:0))*T,M=Math.max(A/((R=k==null?void 0:k.startSize)!=null?R:0),-.999999);return k.columnSizingStart.forEach(L=>{let[P,O]=L;f[P]=Math.round(Math.max(O+O*M,0)*100)/100}),{...k,deltaOffset:A,deltaPercentage:M}}),(t.options.columnResizeMode==="onChange"||S==="end")&&t.setColumnSizing(k=>({...k,...f})))},m=S=>p("move",S),x=S=>{p("end",S),t.setColumnSizingInfo(E=>({...E,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},y=Ige(n),v={moveHandler:S=>m(S.clientX),upHandler:S=>{y==null||y.removeEventListener("mousemove",v.moveHandler),y==null||y.removeEventListener("mouseup",v.upHandler),x(S.clientX)}},b={moveHandler:S=>(S.cancelable&&(S.preventDefault(),S.stopPropagation()),m(S.touches[0].clientX),!1),upHandler:S=>{var E;y==null||y.removeEventListener("touchmove",b.moveHandler),y==null||y.removeEventListener("touchend",b.upHandler),S.cancelable&&(S.preventDefault(),S.stopPropagation()),x((E=S.touches[0])==null?void 0:E.clientX)}},w=Oge()?{passive:!1}:!1;GS(a)?(y==null||y.addEventListener("touchmove",b.moveHandler,w),y==null||y.addEventListener("touchend",b.upHandler,w)):(y==null||y.addEventListener("mousemove",v.moveHandler,w),y==null||y.addEventListener("mouseup",v.upHandler,w)),t.setColumnSizingInfo(S=>({...S,startOffset:d,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?VS():(n=e.initialState.columnSizingInfo)!=null?n:VS())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((s,r)=>s+r.getSize(),0))!=null?t:0}}};let Hp=null;function Oge(){if(typeof Hp=="boolean")return Hp;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Hp=e,Hp}function GS(e){return e.type==="touchstart"}const Lge={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:as("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(s=>({...s,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,s;const r=e.columns;return(n=r.length?r.some(a=>a.getIsVisible()):(s=t.getState().columnVisibility)==null?void 0:s[e.id])!=null?n:!0},e.getCanHide=()=>{var n,s;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((s=t.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Le(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(s=>s.column.getIsVisible()),Pe(t.options,"debugRows")),e.getVisibleCells=Le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,s,r)=>[...n,...s,...r],Pe(t.options,"debugRows"))},createTable:e=>{const t=(n,s)=>Le(()=>[s(),s().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),Pe(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var s;e.setColumnVisibility(n?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=n=>{var s;n=(s=n)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,a)=>({...r,[a.id]:n||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var s;e.toggleAllColumnsVisible((s=n.target)==null?void 0:s.checked)}}};function xd(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Pge={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},$ge={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:as("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const s=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,s,r,a;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((s=t.options.enableGlobalFilter)!=null?s:!0)&&((r=t.options.enableFilters)!=null?r:!0)&&((a=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>zr.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:s}=e.options;return lx(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[s])!=null?t:zr[s]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Dge={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:as("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var s,r;if(!t){e._queue(()=>{t=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var r,a;e.setExpanded(s?{}:(r=(a=e.initialState)==null?void 0:a.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{const l=a.split(".");s=Math.max(s,l.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(s=>{var r;const a=s===!0?!0:!!(s!=null&&s[e.id]);let l={};if(s===!0?Object.keys(t.getRowModel().rowsById).forEach(u=>{l[u]=!0}):l=s,n=(r=n)!=null?r:!a,!a&&n)return{...l,[e.id]:!0};if(a&&!n){const{[e.id]:u,...d}=l;return d}return s})},e.getIsExpanded=()=>{var n;const s=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:s===!0||s!=null&&s[e.id])},e.getCanExpand=()=>{var n,s,r;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((s=t.options.enableExpanding)!=null?s:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let n=!0,s=e;for(;n&&s.parentId;)s=t.getRow(s.parentId,!0),n=s.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},o2=0,l2=10,KS=()=>({pageIndex:o2,pageSize:l2}),qge={getInitialState:e=>({...e,pagination:{...KS(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:as("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var s,r;if(!t){e._queue(()=>{t=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=s=>{const r=a=>ia(s,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=s=>{var r;e.setPagination(s?KS():(r=e.initialState.pagination)!=null?r:KS())},e.setPageIndex=s=>{e.setPagination(r=>{let a=ia(s,r.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,l)),{...r,pageIndex:a}})},e.resetPageIndex=s=>{var r,a;e.setPageIndex(s?o2:(r=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?r:o2)},e.resetPageSize=s=>{var r,a;e.setPageSize(s?l2:(r=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?r:l2)},e.setPageSize=s=>{e.setPagination(r=>{const a=Math.max(1,ia(s,r.pageSize)),l=r.pageSize*r.pageIndex,u=Math.floor(l/a);return{...r,pageIndex:u,pageSize:a}})},e.setPageCount=s=>e.setPagination(r=>{var a;let l=ia(s,(a=e.options.pageCount)!=null?a:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...r,pageCount:l}}),e.getPageOptions=Le(()=>[e.getPageCount()],s=>{let r=[];return s&&s>0&&(r=[...new Array(s)].fill(null).map((a,l)=>l)),r},Pe(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:s<r-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},WS=()=>({top:[],bottom:[]}),zge={getInitialState:e=>({rowPinning:WS(),...e}),getDefaultOptions:e=>({onRowPinningChange:as("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,s,r)=>{const a=s?e.getLeafRows().map(d=>{let{id:f}=d;return f}):[],l=r?e.getParentRows().map(d=>{let{id:f}=d;return f}):[],u=new Set([...l,e.id,...a]);t.setRowPinning(d=>{var f,p;if(n==="bottom"){var m,x;return{top:((m=d==null?void 0:d.top)!=null?m:[]).filter(b=>!(u!=null&&u.has(b))),bottom:[...((x=d==null?void 0:d.bottom)!=null?x:[]).filter(b=>!(u!=null&&u.has(b))),...Array.from(u)]}}if(n==="top"){var y,v;return{top:[...((y=d==null?void 0:d.top)!=null?y:[]).filter(b=>!(u!=null&&u.has(b))),...Array.from(u)],bottom:((v=d==null?void 0:d.bottom)!=null?v:[]).filter(b=>!(u!=null&&u.has(b)))}}return{top:((f=d==null?void 0:d.top)!=null?f:[]).filter(b=>!(u!=null&&u.has(b))),bottom:((p=d==null?void 0:d.bottom)!=null?p:[]).filter(b=>!(u!=null&&u.has(b)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:s,enablePinning:r}=t.options;return typeof s=="function"?s(e):(n=s??r)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:s,bottom:r}=t.getState().rowPinning,a=n.some(u=>s==null?void 0:s.includes(u)),l=n.some(u=>r==null?void 0:r.includes(u));return a?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var n,s;const r=e.getIsPinned();if(!r)return-1;const a=(n=r==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(l=>{let{id:u}=l;return u});return(s=a==null?void 0:a.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,s;return e.setRowPinning(t?WS():(n=(s=e.initialState)==null?void 0:s.rowPinning)!=null?n:WS())},e.getIsSomeRowsPinned=t=>{var n;const s=e.getState().rowPinning;if(!t){var r,a;return!!((r=s.top)!=null&&r.length||(a=s.bottom)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e._getPinnedRows=(t,n,s)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(n??[]).map(l=>{const u=e.getRow(l,!0);return u.getIsAllParentsExpanded()?u:null}):(n??[]).map(l=>t.find(u=>u.id===l))).filter(Boolean).map(l=>({...l,position:s}))},e.getTopRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),Pe(e.options,"debugRows")),e.getBottomRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),Pe(e.options,"debugRows")),e.getCenterRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,s)=>{const r=new Set([...n??[],...s??[]]);return t.filter(a=>!r.has(a.id))},Pe(e.options,"debugRows"))}},Bge={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:as("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const s={...n},r=e.getPreGroupedRowModel().flatRows;return t?r.forEach(a=>{a.getCanSelect()&&(s[a.id]=!0)}):r.forEach(a=>{delete s[a.id]}),s})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const s=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),r={...n};return e.getRowModel().rows.forEach(a=>{c2(r,a.id,s,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?YS(e,n):{rows:[],flatRows:[],rowsById:{}},Pe(e.options,"debugTable")),e.getFilteredSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?YS(e,n):{rows:[],flatRows:[],rowsById:{}},Pe(e.options,"debugTable")),e.getGroupedSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?YS(e,n):{rows:[],flatRows:[],rowsById:{}},Pe(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let s=!!(t.length&&Object.keys(n).length);return s&&t.some(r=>r.getCanSelect()&&!n[r.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:n}=e.getState();let s=!!t.length;return s&&t.some(r=>!n[r.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,s)=>{const r=e.getIsSelected();t.setRowSelection(a=>{var l;if(n=typeof n<"u"?n:!r,e.getCanSelect()&&r===n)return a;const u={...a};return c2(u,e.id,n,(l=s==null?void 0:s.selectChildren)!=null?l:!0,t),u})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return z_(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return u2(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return u2(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return s=>{var r;n&&e.toggleSelected((r=s.target)==null?void 0:r.checked)}}}},c2=(e,t,n,s,r)=>{var a;const l=r.getRow(t,!0);n?(l.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),l.getCanSelect()&&(e[t]=!0)):delete e[t],s&&(a=l.subRows)!=null&&a.length&&l.getCanSelectSubRows()&&l.subRows.forEach(u=>c2(e,u.id,n,s,r))};function YS(e,t){const n=e.getState().rowSelection,s=[],r={},a=function(l,u){return l.map(d=>{var f;const p=z_(d,n);if(p&&(s.push(d),r[d.id]=d),(f=d.subRows)!=null&&f.length&&(d={...d,subRows:a(d.subRows)}),p)return d}).filter(Boolean)};return{rows:a(t.rows),flatRows:s,rowsById:r}}function z_(e,t){var n;return(n=t[e.id])!=null?n:!1}function u2(e,t,n){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let r=!0,a=!1;return e.subRows.forEach(l=>{if(!(a&&!r)&&(l.getCanSelect()&&(z_(l,t)?a=!0:r=!1),l.subRows&&l.subRows.length)){const u=u2(l,t);u==="all"?a=!0:(u==="some"&&(a=!0),r=!1)}}),r?"all":a?"some":!1}const d2=/([0-9]+)/gm,Fge=(e,t,n)=>Hz(xa(e.getValue(n)).toLowerCase(),xa(t.getValue(n)).toLowerCase()),Hge=(e,t,n)=>Hz(xa(e.getValue(n)),xa(t.getValue(n))),Uge=(e,t,n)=>B_(xa(e.getValue(n)).toLowerCase(),xa(t.getValue(n)).toLowerCase()),Vge=(e,t,n)=>B_(xa(e.getValue(n)),xa(t.getValue(n))),Gge=(e,t,n)=>{const s=e.getValue(n),r=t.getValue(n);return s>r?1:s<r?-1:0},Kge=(e,t,n)=>B_(e.getValue(n),t.getValue(n));function B_(e,t){return e===t?0:e>t?1:-1}function xa(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Hz(e,t){const n=e.split(d2).filter(Boolean),s=t.split(d2).filter(Boolean);for(;n.length&&s.length;){const r=n.shift(),a=s.shift(),l=parseInt(r,10),u=parseInt(a,10),d=[l,u].sort();if(isNaN(d[0])){if(r>a)return 1;if(a>r)return-1;continue}if(isNaN(d[1]))return isNaN(l)?-1:1;if(l>u)return 1;if(u>l)return-1}return n.length-s.length}const Zu={alphanumeric:Fge,alphanumericCaseSensitive:Hge,text:Uge,textCaseSensitive:Vge,datetime:Gge,basic:Kge},Wge={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:as("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const r of n){const a=r==null?void 0:r.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return Zu.datetime;if(typeof a=="string"&&(s=!0,a.split(d2).length>1))return Zu.alphanumeric}return s?Zu.text:Zu.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,s;if(!e)throw new Error;return lx(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(s=t.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?n:Zu[e.columnDef.sortingFn]},e.toggleSorting=(n,s)=>{const r=e.getNextSortingOrder(),a=typeof n<"u"&&n!==null;t.setSorting(l=>{const u=l==null?void 0:l.find(y=>y.id===e.id),d=l==null?void 0:l.findIndex(y=>y.id===e.id);let f=[],p,m=a?n:r==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&s?u?p="toggle":p="add":l!=null&&l.length&&d!==l.length-1?p="replace":u?p="toggle":p="replace",p==="toggle"&&(a||r||(p="remove")),p==="add"){var x;f=[...l,{id:e.id,desc:m}],f.splice(0,f.length-((x=t.options.maxMultiSortColCount)!=null?x:Number.MAX_SAFE_INTEGER))}else p==="toggle"?f=l.map(y=>y.id===e.id?{...y,desc:m}:y):p==="remove"?f=l.filter(y=>y.id!==e.id):f=[{id:e.id,desc:m}];return f})},e.getFirstSortDir=()=>{var n,s;return((n=(s=e.columnDef.sortDescFirst)!=null?s:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var s,r;const a=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==a&&((s=t.options.enableSortingRemoval)==null||s)&&(!(n&&(r=t.options.enableMultiRemove)!=null)||r)?!1:l==="desc"?"asc":"desc":a},e.getCanSort=()=>{var n,s;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((s=t.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,s;return(n=(s=e.columnDef.enableMultiSort)!=null?s:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const s=(n=t.getState().sorting)==null?void 0:n.find(r=>r.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,s;return(n=(s=t.getState().sorting)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return s=>{n&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,s;e.setSorting(t?[]:(n=(s=e.initialState)==null?void 0:s.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Yge=[gge,Lge,Age,Tge,xge,yge,Pge,$ge,Wge,Ege,Dge,qge,zge,Bge,Mge];function Qge(e){var t,n;const s=[...Yge,...(t=e._features)!=null?t:[]];let r={_features:s};const a=r._features.reduce((x,y)=>Object.assign(x,y.getDefaultOptions==null?void 0:y.getDefaultOptions(r)),{}),l=x=>r.options.mergeOptions?r.options.mergeOptions(a,x):{...a,...x};let d={...{},...(n=e.initialState)!=null?n:{}};r._features.forEach(x=>{var y;d=(y=x.getInitialState==null?void 0:x.getInitialState(d))!=null?y:d});const f=[];let p=!1;const m={_features:s,options:{...a,...e},initialState:d,_queue:x=>{f.push(x),p||(p=!0,Promise.resolve().then(()=>{for(;f.length;)f.shift()();p=!1}).catch(y=>setTimeout(()=>{throw y})))},reset:()=>{r.setState(r.initialState)},setOptions:x=>{const y=ia(x,r.options);r.options=l(y)},getState:()=>r.options.state,setState:x=>{r.options.onStateChange==null||r.options.onStateChange(x)},_getRowId:(x,y,v)=>{var b;return(b=r.options.getRowId==null?void 0:r.options.getRowId(x,y,v))!=null?b:`${v?[v.id,y].join("."):y}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(x,y)=>{let v=(y?r.getPrePaginationRowModel():r.getRowModel()).rowsById[x];if(!v&&(v=r.getCoreRowModel().rowsById[x],!v))throw new Error;return v},_getDefaultColumnDef:Le(()=>[r.options.defaultColumn],x=>{var y;return x=(y=x)!=null?y:{},{header:v=>{const b=v.header.column.columnDef;return b.accessorKey?b.accessorKey:b.accessorFn?b.id:null},cell:v=>{var b,w;return(b=(w=v.renderValue())==null||w.toString==null?void 0:w.toString())!=null?b:null},...r._features.reduce((v,b)=>Object.assign(v,b.getDefaultColumnDef==null?void 0:b.getDefaultColumnDef()),{}),...x}},Pe(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:Le(()=>[r._getColumnDefs()],x=>{const y=function(v,b,w){return w===void 0&&(w=0),v.map(S=>{const E=mge(r,S,w,b),k=S;return E.columns=k.columns?y(k.columns,E,w+1):[],E})};return y(x)},Pe(e,"debugColumns")),getAllFlatColumns:Le(()=>[r.getAllColumns()],x=>x.flatMap(y=>y.getFlatColumns()),Pe(e,"debugColumns")),_getAllFlatColumnsById:Le(()=>[r.getAllFlatColumns()],x=>x.reduce((y,v)=>(y[v.id]=v,y),{}),Pe(e,"debugColumns")),getAllLeafColumns:Le(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(x,y)=>{let v=x.flatMap(b=>b.getLeafColumns());return y(v)},Pe(e,"debugColumns")),getColumn:x=>r._getAllFlatColumnsById()[x]};Object.assign(r,m);for(let x=0;x<r._features.length;x++){const y=r._features[x];y==null||y.createTable==null||y.createTable(r)}return r}function Xge(){return e=>Le(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},s=function(r,a,l){a===void 0&&(a=0);const u=[];for(let f=0;f<r.length;f++){const p=D_(e,e._getRowId(r[f],f,l),r[f],f,a,void 0,l==null?void 0:l.id);if(n.flatRows.push(p),n.rowsById[p.id]=p,u.push(p),e.options.getSubRows){var d;p.originalSubRows=e.options.getSubRows(r[f],f),(d=p.originalSubRows)!=null&&d.length&&(p.subRows=s(p.originalSubRows,a+1,p))}}return u};return n.rows=s(t),n},Pe(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Zge(e,t,n){return n.options.filterFromLeafRows?Jge(e,t,n):exe(e,t,n)}function Jge(e,t,n){var s;const r=[],a={},l=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,u=function(d,f){f===void 0&&(f=0);const p=[];for(let x=0;x<d.length;x++){var m;let y=d[x];const v=D_(n,y.id,y.original,y.index,y.depth,void 0,y.parentId);if(v.columnFilters=y.columnFilters,(m=y.subRows)!=null&&m.length&&f<l){if(v.subRows=u(y.subRows,f+1),y=v,t(y)&&!v.subRows.length){p.push(y),a[y.id]=y,r.push(y);continue}if(t(y)||v.subRows.length){p.push(y),a[y.id]=y,r.push(y);continue}}else y=v,t(y)&&(p.push(y),a[y.id]=y,r.push(y))}return p};return{rows:u(e),flatRows:r,rowsById:a}}function exe(e,t,n){var s;const r=[],a={},l=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,u=function(d,f){f===void 0&&(f=0);const p=[];for(let x=0;x<d.length;x++){let y=d[x];if(t(y)){var m;if((m=y.subRows)!=null&&m.length&&f<l){const b=D_(n,y.id,y.original,y.index,y.depth,void 0,y.parentId);b.subRows=u(y.subRows,f+1),y=b}p.push(y),r.push(y),a[y.id]=y}}return p};return{rows:u(e),flatRows:r,rowsById:a}}function txe(){return e=>Le(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,s)=>{if(!t.rows.length||!(n!=null&&n.length)&&!s){for(let x=0;x<t.flatRows.length;x++)t.flatRows[x].columnFilters={},t.flatRows[x].columnFiltersMeta={};return t}const r=[],a=[];(n??[]).forEach(x=>{var y;const v=e.getColumn(x.id);if(!v)return;const b=v.getFilterFn();b&&r.push({id:x.id,filterFn:b,resolvedValue:(y=b.resolveFilterValue==null?void 0:b.resolveFilterValue(x.value))!=null?y:x.value})});const l=(n??[]).map(x=>x.id),u=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(x=>x.getCanGlobalFilter());s&&u&&d.length&&(l.push("__global__"),d.forEach(x=>{var y;a.push({id:x.id,filterFn:u,resolvedValue:(y=u.resolveFilterValue==null?void 0:u.resolveFilterValue(s))!=null?y:s})}));let f,p;for(let x=0;x<t.flatRows.length;x++){const y=t.flatRows[x];if(y.columnFilters={},r.length)for(let v=0;v<r.length;v++){f=r[v];const b=f.id;y.columnFilters[b]=f.filterFn(y,b,f.resolvedValue,w=>{y.columnFiltersMeta[b]=w})}if(a.length){for(let v=0;v<a.length;v++){p=a[v];const b=p.id;if(p.filterFn(y,b,p.resolvedValue,w=>{y.columnFiltersMeta[b]=w})){y.columnFilters.__global__=!0;break}}y.columnFilters.__global__!==!0&&(y.columnFilters.__global__=!1)}}const m=x=>{for(let y=0;y<l.length;y++)if(x.columnFilters[l[y]]===!1)return!1;return!0};return Zge(t.rows,m,e)},Pe(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function nxe(){return e=>Le(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const s=e.getState().sorting,r=[],a=s.filter(d=>{var f;return(f=e.getColumn(d.id))==null?void 0:f.getCanSort()}),l={};a.forEach(d=>{const f=e.getColumn(d.id);f&&(l[d.id]={sortUndefined:f.columnDef.sortUndefined,invertSorting:f.columnDef.invertSorting,sortingFn:f.getSortingFn()})});const u=d=>{const f=d.map(p=>({...p}));return f.sort((p,m)=>{for(let y=0;y<a.length;y+=1){var x;const v=a[y],b=l[v.id],w=b.sortUndefined,S=(x=v==null?void 0:v.desc)!=null?x:!1;let E=0;if(w){const k=p.getValue(v.id),_=m.getValue(v.id),R=k===void 0,T=_===void 0;if(R||T){if(w==="first")return R?-1:1;if(w==="last")return R?1:-1;E=R&&T?0:R?w:-w}}if(E===0&&(E=b.sortingFn(p,m,v.id)),E!==0)return S&&(E*=-1),b.invertSorting&&(E*=-1),E}return p.index-m.index}),f.forEach(p=>{var m;r.push(p),(m=p.subRows)!=null&&m.length&&(p.subRows=u(p.subRows))}),f};return{rows:u(n.rows),flatRows:r,rowsById:n.rowsById}},Pe(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
537
+ * react-table
538
+ *
539
+ * Copyright (c) TanStack
540
+ *
541
+ * This source code is licensed under the MIT license found in the
542
+ * LICENSE.md file in the root directory of this source tree.
543
+ *
544
+ * @license MIT
545
+ */function LP(e,t){return e?sxe(e)?C.createElement(e,t):e:null}function sxe(e){return rxe(e)||typeof e=="function"||ixe(e)}function rxe(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function ixe(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function axe(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=C.useState(()=>({current:Qge(t)})),[s,r]=C.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...s,...e.state},onStateChange:l=>{r(l),e.onStateChange==null||e.onStateChange(l)}})),n.current}const Uz=C.forwardRef(({className:e,testId:t,...n},s)=>i.jsx("input",{ref:s,"data-testid":t,className:he("block w-full border border-stone-300 bg-white px-2 py-1 font-mono text-xs text-stone-900","hover:bg-stone-50 focus:border-stone-900 focus:bg-white focus:outline-none","disabled:bg-stone-100 disabled:text-stone-400 disabled:cursor-not-allowed",e),...n}));Uz.displayName="VellumInput";async function oxe(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function lxe(e){return e==="running"||e==="ready"?"running":e==="active"?"active":e==="stopped"?"stopped":e==="attention_required"||e==="warning"?"warning":e==="failed"||e==="error"?"error":"info"}function cxe({row:e}){const t=L_();return i.jsxs("button",{type:"button","data-testid":`topology-table-cmux-${e.logicalId}`,onClick:n=>{n.stopPropagation(),t.mutate({rigId:e.rigId,logicalId:e.logicalId})},"aria-busy":t.isPending||void 0,"aria-label":`${t.isPending?"Opening":"Open"} ${e.logicalId} in cmux`,title:t.isPending?"Opening in cmux":"Open in cmux",disabled:t.isPending,className:"inline-flex h-7 w-7 items-center justify-center border border-outline-variant bg-white/65 text-stone-700 shadow-[1px_1px_0_rgba(46,52,46,0.12)] transition-colors hover:bg-stone-100 hover:text-stone-950 focus:outline-none focus:ring-2 focus:ring-stone-900/20 disabled:cursor-wait disabled:opacity-60",children:[i.jsx($e,{tool:"cmux",size:"sm"}),i.jsx("span",{className:"sr-only",children:"CMUX"})]})}const Vz=C.memo(function({status:t,activityState:n}){const s=lxe(t),r=t==="running"||t==="ready",a=r&&n==="active",u=a?"active":r&&!a?"idle":t,d=a?"topology-table-active-shimmer":"";return i.jsx("span",{"data-testid":`topology-table-status-${n??"unknown"}`,"data-activity-state":n??null,children:i.jsx(Bm,{status:s,label:u,variant:"pill",labelClassName:d})})});Vz.displayName="StatusCell";const Gz=C.memo(function({row:t}){const n=t.contextUsage,s=(n==null?void 0:n.availability)==="known"&&typeof n.usedPercentage=="number";return i.jsx("span",{"data-testid":`topology-table-context-${t.logicalId}`,className:`font-mono text-xs font-bold ${xq(n==null?void 0:n.usedPercentage,n==null?void 0:n.fresh,n==null?void 0:n.availability)}`,title:s?(n==null?void 0:n.fresh)===!1?"Context usage (stale sample)":"Context usage (fresh)":"Context sample unavailable",children:s?`${n.usedPercentage}%`:"--"})},(e,t)=>{const n=e.row.contextUsage,s=t.row.contextUsage;return e.row.logicalId===t.row.logicalId&&(n==null?void 0:n.availability)===(s==null?void 0:s.availability)&&(n==null?void 0:n.usedPercentage)===(s==null?void 0:s.usedPercentage)&&(n==null?void 0:n.fresh)===(s==null?void 0:s.fresh)});Gz.displayName="ContextCell";const Kz=C.memo(function({row:t}){const n=t.contextUsage,s=ma(n==null?void 0:n.totalInputTokens,n==null?void 0:n.totalOutputTokens),r=bf(s),a=$g(n==null?void 0:n.totalInputTokens,n==null?void 0:n.totalOutputTokens);return i.jsx("span",{"data-testid":`topology-table-tokens-${t.logicalId}`,className:`font-mono text-xs font-bold ${r?"text-stone-500":"text-stone-300"}`,title:a??"Token sample unavailable",children:r??"--"})},(e,t)=>{const n=e.row.contextUsage,s=t.row.contextUsage;return e.row.logicalId===t.row.logicalId&&(n==null?void 0:n.totalInputTokens)===(s==null?void 0:s.totalInputTokens)&&(n==null?void 0:n.totalOutputTokens)===(s==null?void 0:s.totalOutputTokens)});Kz.displayName="TokenCell";function uxe(){return[{accessorKey:"rigName",header:"Rig",cell:({getValue:e})=>i.jsx("span",{className:"font-mono text-xs",children:String(e())})},{accessorKey:"podName",header:"Pod",cell:({getValue:e})=>i.jsx("span",{className:"font-mono text-xs",children:String(e())})},{accessorKey:"logicalId",header:"Agent",cell:({row:e})=>{var t,n;return i.jsx(Wk,{as:"span",state:((t=e.original.activityRing)==null?void 0:t.state)??"idle",flash:((n=e.original.activityRing)==null?void 0:n.flash)??null,reducedMotion:e.original.reducedMotion,testId:`topology-table-activity-ring-${e.original.logicalId}`,className:"inline-flex rounded-sm",ringClassName:"-inset-1",children:i.jsx("span",{className:"inline-flex min-w-0 items-center gap-1.5 font-mono text-xs",children:i.jsx("span",{className:"truncate",children:e.original.logicalId})})})}},{accessorKey:"runtime",header:"Runtime",cell:({getValue:e})=>i.jsx(Gn,{runtime:String(e()??""),size:"xs",compact:!0,variant:"inline"})},{id:"context",header:"Context",sortingFn:(e,t)=>{var n,s;return(((n=e.original.contextUsage)==null?void 0:n.usedPercentage)??-1)-(((s=t.original.contextUsage)==null?void 0:s.usedPercentage)??-1)},cell:({row:e})=>i.jsx(Gz,{row:e.original})},{id:"tokens",header:"Tokens",sortingFn:(e,t)=>{var r,a,l,u;const n=ma((r=e.original.contextUsage)==null?void 0:r.totalInputTokens,(a=e.original.contextUsage)==null?void 0:a.totalOutputTokens)??-1,s=ma((l=t.original.contextUsage)==null?void 0:l.totalInputTokens,(u=t.original.contextUsage)==null?void 0:u.totalOutputTokens)??-1;return n-s},cell:({row:e})=>i.jsx(Kz,{row:e.original})},{accessorKey:"status",header:"Status",cell:({getValue:e,row:t})=>{var n;return i.jsx(Vz,{status:String(e()),activityState:(n=t.original.activityRing)==null?void 0:n.state})}},{id:"actions",header:"Actions",enableSorting:!1,cell:({row:e})=>i.jsxs("span",{className:"inline-flex items-center gap-1.5","data-testid":`topology-table-actions-${e.original.logicalId}`,children:[i.jsx(cxe,{row:e.original}),e.original.rigId?i.jsx(vf,{rigId:e.original.rigId,logicalId:e.original.logicalId,sessionName:e.original.sessionName??null,reducedMotion:!1,testIdPrefix:`topology-table-${e.original.logicalId}`,buttonClassName:"inline-flex h-7 w-7 items-center justify-center border border-outline-variant bg-white/65 text-stone-700 shadow-[1px_1px_0_rgba(46,52,46,0.12)] transition-colors hover:bg-stone-100 hover:text-stone-950 focus:outline-none focus:ring-2 focus:ring-stone-900/20"}):null]})}]}function F_({rigIdScope:e,podNameScope:t}){const n=It(),{data:s}=dr(),r=x_(),a=C.useMemo(()=>e?(s==null?void 0:s.filter(S=>S.id===e))??[]:s??[],[s,e]),l=tf({queries:a.map(S=>({queryKey:["rig",S.id,"nodes"],queryFn:()=>oxe(S.id),refetchInterval:3e4}))}),u=C.useMemo(()=>{const S=[];for(let E=0;E<a.length;E++){const k=a[E],_=l[E];if(!k||!_)continue;const R=_.data??[],T=t?R.filter(A=>(A.podNamespace??A.podId)===t):R;for(const A of T)S.push({rigId:k.id,rigName:k.name,podName:ar(A.logicalId)??"default",logicalId:A.logicalId,sessionName:A.canonicalSessionName??A.logicalId,runtime:A.runtime??"-",status:A.sessionStatus??"unknown",startupStatus:A.startupStatus??null,contextUsage:A.contextUsage??null,agentActivity:A.agentActivity??null,currentQitems:A.currentQitems??[],terminalActive:A.terminalActive,hasAssignedWork:A.hasAssignedWork??!1,pendingWorkCount:A.pendingWorkCount??0})}return S},[a,l,t]),d=C.useMemo(()=>tx(u.map(S=>({nodeId:`${S.rigId}::${S.logicalId}`,rigId:S.rigId,rigName:S.rigName,logicalId:S.logicalId,canonicalSessionName:S.sessionName,agentActivity:S.agentActivity??null,currentQitems:S.currentQitems??null,startupStatus:S.startupStatus,terminalActive:S.terminalActive,hasAssignedWork:S.hasAssignedWork??!1,pendingWorkCount:S.pendingWorkCount??0}))),[u]),f=nx(d),p=C.useMemo(()=>u.map(S=>({...S,activityRing:f.getNodeActivity(`${S.rigId}::${S.logicalId}`,S),reducedMotion:r})),[u,f,r]),[m,x]=C.useState([]),[y,v]=C.useState(""),b=C.useMemo(()=>uxe(),[]),w=axe({data:p,columns:b,state:{sorting:m,globalFilter:y},onSortingChange:x,onGlobalFilterChange:v,getCoreRowModel:Xge(),getSortedRowModel:nxe(),getFilteredRowModel:txe(),globalFilterFn:(S,E,k)=>{const _=String(k??"").toLowerCase();if(!_)return!0;const R=S.original;return R.rigName.toLowerCase().includes(_)||R.podName.toLowerCase().includes(_)||R.logicalId.toLowerCase().includes(_)||R.runtime.toLowerCase().includes(_)||R.status.toLowerCase().includes(_)}});return i.jsxs("div",{"data-testid":"topology-table-view",className:"space-y-3 mt-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Uz,{placeholder:"Filter agents...",value:y,onChange:S=>v(S.target.value),className:"max-w-xs",testId:"topology-table-search"}),i.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wide text-on-surface-variant ml-auto",children:[w.getFilteredRowModel().rows.length," of ",p.length]})]}),i.jsx("div",{className:"border border-outline-variant overflow-x-auto",children:i.jsxs("table",{className:"w-full text-left",children:[i.jsx("thead",{className:"bg-stone-50 border-b border-outline-variant",children:w.getHeaderGroups().map(S=>i.jsx("tr",{children:S.headers.map(E=>i.jsxs("th",{onClick:E.column.getToggleSortingHandler(),className:"px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-on-surface-variant cursor-pointer select-none",children:[LP(E.column.columnDef.header,E.getContext()),{asc:" ↑",desc:" ↓"}[E.column.getIsSorted()]??null]},E.id))},S.id))}),i.jsx("tbody",{children:w.getRowModel().rows.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:b.length,className:"px-3 py-6 text-center font-mono text-xs text-on-surface-variant",children:"No agents match."})}):w.getRowModel().rows.map(S=>i.jsx("tr",{"data-testid":`topology-table-row-${S.original.logicalId}`,onClick:()=>n({to:"/topology/seat/$rigId/$logicalId",params:{rigId:S.original.rigId,logicalId:encodeURIComponent(S.original.logicalId)}}),className:"group border-b border-outline-variant last:border-b-0 hover:bg-surface-low focus-within:bg-surface-low cursor-pointer",children:S.getVisibleCells().map(E=>i.jsx("td",{className:"px-3 py-2",children:LP(E.column.columnDef.cell,E.getContext())},E.id))},S.id))})]})})]})}async function dxe({rigId:e}){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/cmux/launch`,{method:"POST"});if(!t.ok){let n=null;try{n=await t.json()}catch{}const s=(n==null?void 0:n.message)??(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Error(s)}return await t.json()}const fxe=6e3,hxe=8e3;function pxe({rigId:e}){const t=C.useRef(null),n=C.useRef(null),s=C.useRef(!1),r=C.useRef(null);C.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const a=f=>{const p=t.current;p&&(p.disabled=f,p.setAttribute("aria-busy",f?"true":"false"),p.textContent=f?"Launching...":"Launch in CMUX")},l=()=>{const f=n.current;f&&(f.hidden=!0,f.textContent="",f.removeAttribute("data-status-kind"))},u=(f,p)=>{const m=n.current;m&&(m.hidden=!1,m.textContent=p,m.setAttribute("data-status-kind",f),m.className=f==="error"?"font-mono text-[10px] text-rose-700 max-w-2xl leading-relaxed whitespace-normal break-words":"font-mono text-[10px] text-emerald-700 max-w-2xl leading-relaxed whitespace-normal break-words",r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(l,f==="success"?fxe:hxe))},d=()=>{s.current||(s.current=!0,a(!0),l(),dxe({rigId:e}).then(f=>{const p=f.workspaces.length,m=f.workspaces.reduce((y,v)=>y+v.agents.length,0),x=f.workspaces.map(y=>y.name).join(", ");u("success",p===1?`Launched cmux workspace "${x}" with ${m} agent${m===1?"":"s"}.`:`Launched ${p} cmux workspaces (${x}) with ${m} agents total.`)}).catch(f=>{u("error",f.message)}).finally(()=>{s.current=!1,a(!1)}))};return i.jsxs("div",{"data-testid":"launch-cmux-wrapper",className:"hidden lg:inline-flex items-center gap-3 ml-auto",children:[i.jsx("button",{ref:t,type:"button","data-testid":"launch-cmux-button",onClick:d,className:"border border-stone-700 bg-white px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-stone-900 hover:bg-stone-100 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-1 focus:ring-stone-400",children:"Launch in CMUX"}),i.jsx("span",{ref:n,hidden:!0,"data-testid":"launch-cmux-status",role:"status","aria-live":"polite",className:"font-mono text-[10px] text-emerald-700 max-w-2xl leading-relaxed whitespace-normal break-words"})]})}const QS=12;function mxe(e){var t;return((t=e.agentActivity)==null?void 0:t.state)==="running"}function gxe({seat:e}){const t=e.contextUsage,n=(t==null?void 0:t.availability)==="known"&&typeof t.usedPercentage=="number";return i.jsx("span",{"data-testid":`terminal-card-context-${e.rigId}-${e.logicalId}`,className:`font-mono text-[8px] font-bold uppercase tracking-wide ${xq(t==null?void 0:t.usedPercentage,t==null?void 0:t.fresh,t==null?void 0:t.availability)}`,title:n?(t==null?void 0:t.fresh)===!1?"Context usage (stale sample)":"Context usage (fresh)":"Context sample unavailable",children:n?`${t.usedPercentage}%`:"--"})}function xxe({seat:e}){const t=e.contextUsage,n=ma(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens),s=bf(n),r=$g(t==null?void 0:t.totalInputTokens,t==null?void 0:t.totalOutputTokens);return i.jsx("span",{"data-testid":`terminal-card-tokens-${e.rigId}-${e.logicalId}`,className:`font-mono text-[8px] font-bold uppercase tracking-wide ${s?"text-stone-500":"text-stone-300"}`,title:r??"Token sample unavailable",children:s??"--"})}const yxe="openrig:topology-terminal-preview";function vxe({seat:e}){const t=e.canonicalSessionName??e.logicalId,n=mxe(e),s=lg(e.logicalId),r=`${e.rigId??"unknown"}:${e.logicalId}`,a=()=>{window.dispatchEvent(new CustomEvent(yxe,{detail:{key:r}}))};return i.jsxs("div",{"data-testid":`terminal-card-${e.rigId}-${e.logicalId}`,"data-active":n?"true":"false",className:he("relative border bg-white/40 p-2 flex flex-col gap-2",n?"border-secondary terminal-card-active":"border-outline-variant"),children:[i.jsx("button",{type:"button",onClick:a,"aria-label":`Open ${s} terminal preview`,className:"absolute inset-0 z-10 cursor-pointer bg-transparent focus:outline-none focus:ring-2 focus:ring-stone-900/20","data-testid":`terminal-card-trigger-${e.rigId}-${e.logicalId}`}),e.rigId?i.jsx(vf,{rigId:e.rigId,logicalId:e.logicalId,sessionName:t,reducedMotion:!1,testIdPrefix:`terminal-grid-${e.rigId}-${e.logicalId}`,wrapperClassName:"absolute right-1 top-1 z-20",renderTrigger:!1}):null,i.jsxs("header",{className:"relative z-0 flex items-center justify-between gap-2 pointer-events-none",children:[i.jsx("span",{className:"font-mono text-[8px] font-semibold uppercase tracking-[0.10em] text-stone-900 truncate",children:s}),i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[i.jsx(Gn,{runtime:e.runtime,size:"xs",compact:!0,variant:"inline"}),i.jsx(gxe,{seat:e}),i.jsx(xxe,{seat:e})]})]}),i.jsx("div",{className:"relative z-0 pointer-events-none",children:i.jsx(Pg,{sessionName:t,lines:20,testIdPrefix:`terminal-preview-${e.rigId}-${e.logicalId}`})})]})}function Wz({seats:e,emptyLabel:t,emptyDescription:n}){const[s,r]=C.useState(!1),a=s?e:e.slice(0,QS),l=e.length>QS;return e.length===0?i.jsx(Ge,{label:t,description:n,variant:"card",testId:"topology-terminal-empty"}):i.jsxs("div",{"data-testid":"topology-terminal-grid",className:"space-y-3",children:[i.jsxs("div",{className:"font-mono text-[9px] text-on-surface-variant flex items-center justify-between",children:[i.jsxs("span",{"data-testid":"topology-terminal-count",children:["showing ",a.length," of ",e.length," terminal",e.length===1?"":"s"]}),l?i.jsx("button",{type:"button","data-testid":"topology-terminal-show-toggle",onClick:()=>r(u=>!u),className:"px-2 py-0.5 border border-outline-variant font-mono text-[9px] uppercase tracking-wide text-stone-700 hover:bg-stone-100/60",children:s?`show first ${QS}`:`show all ${e.length}`}):null]}),i.jsx("div",{className:"grid gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:a.map(u=>i.jsx(vxe,{seat:u},`${u.rigId}-${u.logicalId}`))})]})}function bxe({rigId:e,rigName:t}){const{data:n}=lk(e),s=C.useMemo(()=>(n??[]).filter(r=>r.nodeKind!=="infrastructure"),[n]);return s.length===0?null:i.jsxs("section",{"data-testid":`topology-terminal-rig-${e}`,className:"border-t border-outline-variant pt-4 first:border-t-0 first:pt-0",children:[i.jsx(it,{tone:"muted",children:t}),i.jsx("div",{className:"mt-2",children:i.jsx(Wz,{seats:s,emptyLabel:"NO SEATS",emptyDescription:`No agent seats in ${t}.`})})]})}function H_({scope:e,rigId:t,podName:n}){const{data:s}=dr(),{data:r}=lk(e!=="host"?t??null:null);if(e==="host")return!s||s.length===0?i.jsx("div",{className:"p-6",children:i.jsx(Ge,{label:"NO RIGS",description:"No rigs registered. Register a rig to see terminals at host scope.",variant:"card",testId:"topology-terminal-empty"})}):i.jsx("div",{"data-testid":"topology-terminal-host",className:"p-6 space-y-6",children:s.map(u=>i.jsx(bxe,{rigId:u.id,rigName:u.name},u.id))});const a=(r??[]).filter(u=>u.nodeKind!=="infrastructure"),l=e==="pod"&&n?a.filter(u=>(u.podNamespace??u.podId)===n):a;return i.jsx("div",{"data-testid":`topology-terminal-${e}`,className:"p-6",children:i.jsx(Wz,{seats:l,emptyLabel:"NO SEATS",emptyDescription:e==="pod"?`No agent seats in pod ${n}.`:"No agent seats in this rig."})})}const XS=1024;function U_(){const[e,t]=C.useState(()=>typeof window>"u"?{isWideLayout:!0,innerWidth:XS}:{isWideLayout:window.innerWidth>=XS,innerWidth:window.innerWidth});return C.useEffect(()=>{const n=()=>{t({isWideLayout:window.innerWidth>=XS,innerWidth:window.innerWidth})};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e}function wxe(e){return e==="running"?"running":e==="stopped"?"stopped":"warning"}function jxe({data:e}){const{rigId:t,rigName:n,collapsed:s,status:r,nodeCount:a,runningCount:l,activeCount:u,podCount:d,recentActivity:f,onToggle:p}=e,m=u??l;return i.jsxs("div",{"data-testid":`rig-group-node-${t}`,"data-collapsed":s?"true":"false",onClick:x=>{x.stopPropagation(),p(t)},className:he("w-full h-full relative flex flex-col cursor-pointer select-none overflow-visible",s?"border border-outline-variant bg-white/40 backdrop-blur-[8px] hard-shadow hover:bg-white/50":"border border-outline-variant/70 bg-white/40 backdrop-blur-[8px] shadow-[0_0_0_1px_rgba(84,96,115,0.06)]",f&&"rig-activity-frame-pulse"),children:[i.jsx(dg,{testIdPrefix:`rig-group-${t}`}),i.jsxs("header",{className:"absolute -top-8 left-4 z-10 flex items-center gap-2 border border-outline-variant/70 bg-background px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.10em] text-stone-900 shadow-[2px_2px_0_rgba(46,52,46,0.10)]",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(Bs,{className:he("h-3 w-3 text-on-surface-variant shrink-0 transition-transform",s?"":"rotate-90"),"aria-hidden":"true"}),i.jsx("span",{"data-testid":`rig-group-name-${t}`,className:"font-mono text-[11px] font-bold uppercase tracking-[0.10em] text-stone-900 truncate",children:n})]}),i.jsx(Bm,{status:wxe(r),label:r,variant:"pill",testId:`rig-group-status-${t}`}),i.jsx(Ve,{to:"/topology/rig/$rigId",params:{rigId:t},onClick:x=>x.stopPropagation(),"data-testid":`rig-group-drill-${t}`,className:"shrink-0 p-0.5 text-on-surface-variant hover:text-stone-900 hover:bg-stone-200/60","aria-label":`Open ${n} rig page`,children:i.jsx(SV,{className:"h-3 w-3","aria-hidden":"true"})})]}),s?i.jsx("div",{className:"px-3 pt-8 pb-3 flex items-center justify-between gap-2 flex-1",children:i.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-wider text-on-surface-variant",children:[d!==void 0?`${d} pods / `:"",a," agent",a===1?"":"s"]}),i.jsxs("div",{className:"font-mono text-[9px] text-on-surface-variant",children:[m," active"]})]})}):i.jsxs("div",{className:"absolute right-3 top-3 flex items-center gap-2 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500","data-testid":`rig-group-expanded-counts-${t}`,children:[i.jsx("span",{children:d!==void 0?`${d} pods`:""}),d!==void 0?i.jsx("span",{children:"/"}):null,i.jsxs("span",{children:[a," agents"]}),i.jsx("span",{children:"/"}),i.jsxs("span",{children:[m," active"]})]}),i.jsx(bn,{type:"target",position:ye.Top,className:"opacity-0 pointer-events-none"}),i.jsx(bn,{type:"source",position:ye.Bottom,className:"opacity-0 pointer-events-none"})]})}const Yz=C.memo(jxe,(e,t)=>{const n=e.data,s=t.data;return n.rigId===s.rigId&&n.rigName===s.rigName&&n.collapsed===s.collapsed&&n.status===s.status&&n.nodeCount===s.nodeCount&&n.runningCount===s.runningCount&&n.activeCount===s.activeCount&&n.podCount===s.podCount&&n.recentActivity===s.recentActivity&&n.onToggle===s.onToggle});Yz.displayName="RigGroupNode";function Sxe(e){return e==="architect"||e==="lead"||e==="orchestrator"}function Nxe(e,t){if(typeof e!="number")return"text-stone-300";const n=e>=80?"text-red-600":e>=60?"text-amber-600":"text-green-700";return t===!1?`${n} opacity-50`:n}function kxe({data:e}){const t=e.podDisplayName??e.podNamespace??ar(e.logicalId??null)??e.podId??"pod";return i.jsxs("div",{"data-testid":"hybrid-pod-group-node",className:"relative h-full w-full border border-dashed border-stone-400/55 bg-stone-50/25",children:[i.jsxs("div",{className:"absolute left-2 top-2 flex items-center gap-2 font-mono text-[9px] lowercase tracking-[0.02em] text-stone-600",children:[i.jsx("span",{children:t}),typeof e.agentCount=="number"?i.jsx("span",{className:"text-stone-400",children:e.agentCount}):null]}),i.jsx(bn,{type:"target",position:ye.Left,className:"opacity-0 pointer-events-none"}),i.jsx(bn,{type:"source",position:ye.Right,className:"opacity-0 pointer-events-none"})]})}const Qz=C.memo(kxe,(e,t)=>{const n=e.data,s=t.data;return n.podDisplayName===s.podDisplayName&&n.podNamespace===s.podNamespace&&n.podId===s.podId&&n.logicalId===s.logicalId&&n.agentCount===s.agentCount});Qz.displayName="HybridPodGroupNode";function _xe({data:e}){var S,E;const t=L_(),n=Sxe(e.role),s=e.nodeKind==="infrastructure",r=F2(e.agentActivity),a=H2(r),l=cD(r),u=uD(r),d=dD(e.agentActivity),f=yq({activityRing:e.activityRing,activityState:r}),p=e.runtime||e.model?gD(e.runtime,e.model):null,m=e.contextAvailability==="known"&&typeof e.contextUsedPercentage=="number",x=ma(e.contextTotalInputTokens,e.contextTotalOutputTokens),y=bf(x),v=$g(e.contextTotalInputTokens,e.contextTotalOutputTokens),b="inline-flex h-6 w-6 items-center justify-center border border-outline-variant bg-white/90 text-stone-700 opacity-0 shadow-[1px_1px_0_rgba(46,52,46,0.14)] transition-opacity hover:bg-stone-100 hover:text-stone-950 focus:!opacity-100 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-stone-900/20 group-hover:!opacity-100 group-hover:opacity-100 group-focus-within:!opacity-100 group-focus-within:opacity-100",w=i.jsxs("div",{"data-testid":"hybrid-agent-node",title:[e.canonicalSessionName,`activity: ${a}${d?" (stale)":""}`,p,v].filter(Boolean).join(`
546
+ `),"data-activity-card-state":f.state,"data-activity-card-flash":f.flash??"none",className:he("group relative h-full w-full select-none border bg-white/40 backdrop-blur-[8px] hard-shadow transition-[background-color,border-color,box-shadow] duration-300",vq({state:f.state,flash:f.flash,reducedMotion:e.reducedMotion}),e.startupStatus==="failed"?"border-red-700":e.startupStatus==="attention_required"?"border-amber-700":"border-stone-900"),children:[i.jsx(bn,{type:"target",position:ye.Left,className:"opacity-0"}),i.jsxs("div",{className:he("flex items-center justify-between gap-1 px-2 py-1 font-mono text-[8px]",s?"bg-stone-500 text-white border-b border-stone-900":n?"bg-stone-900 text-white":"border-b border-stone-900 bg-stone-200 text-stone-900"),children:[i.jsx("span",{className:"truncate font-bold",children:lg(e.logicalId)}),i.jsx("span",{className:he("inline-flex h-2 w-2 shrink-0 rounded-full border border-white/60",l,u),"data-testid":`hybrid-activity-dot-${e.logicalId}`,"data-activity-state":r,"aria-label":`activity: ${a}`})]}),e.rigId?i.jsx(vf,{rigId:e.rigId,logicalId:e.logicalId,sessionName:e.canonicalSessionName??null,reducedMotion:e.reducedMotion,testIdPrefix:`hybrid-${e.logicalId}`,wrapperClassName:"absolute right-8 top-6 z-20",buttonClassName:b}):null,e.rigId?i.jsx("button",{type:"button","data-testid":`hybrid-cmux-open-${e.logicalId}`,"aria-busy":t.isPending||void 0,"aria-label":`${t.isPending?"Opening":"Open"} ${e.logicalId} in cmux`,title:t.isPending?"Opening in cmux":"Open in cmux",disabled:t.isPending,onClick:k=>{k.stopPropagation(),t.mutate({rigId:e.rigId,logicalId:e.logicalId})},className:he("absolute right-1.5 top-6 z-10 disabled:cursor-wait disabled:opacity-60",b),children:i.jsx($e,{tool:"cmux",size:"sm"})}):null,i.jsxs("div",{className:"space-y-1 px-2 py-1.5",children:[i.jsx("div",{className:"truncate font-mono text-[8px] leading-tight text-stone-500",children:e.canonicalSessionName??e.logicalId}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(Gn,{runtime:e.runtime,model:e.model,size:"xs",compact:!0,variant:"inline",className:"max-w-full"}),!p&&(e.resolvedSpecName||e.profile)?i.jsx("span",{className:"ml-1 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-400",children:e.resolvedSpecName||e.profile}):null]}),i.jsxs("div",{className:"flex items-end justify-between gap-2 pt-0.5",children:[i.jsx("div",{className:he("font-mono text-[14px] font-bold leading-none",Nxe(e.contextUsedPercentage,e.contextFresh)),"data-testid":"hybrid-context-badge",children:m?`${e.contextUsedPercentage}%`:"--"}),i.jsx("div",{className:he("font-mono text-[13px] font-bold leading-none tracking-[0.02em]",y?"text-stone-500":"text-stone-300"),"data-testid":"hybrid-token-total",title:v??"Token sample unavailable",children:y??"--"})]})]}),i.jsx(bn,{type:"source",position:ye.Right,className:"opacity-0"})]});return i.jsx(Wk,{state:((S=e.activityRing)==null?void 0:S.state)??"idle",flash:((E=e.activityRing)==null?void 0:E.flash)??null,reducedMotion:e.reducedMotion,testId:`hybrid-activity-ring-${e.logicalId}`,className:"h-full w-full rounded-none",children:w})}const Xz=C.memo(_xe,(e,t)=>{var r,a,l,u,d,f;const n=e.data,s=t.data;return n.logicalId===s.logicalId&&n.role===s.role&&n.runtime===s.runtime&&n.model===s.model&&n.status===s.status&&n.nodeKind===s.nodeKind&&n.startupStatus===s.startupStatus&&n.canonicalSessionName===s.canonicalSessionName&&n.resolvedSpecName===s.resolvedSpecName&&n.profile===s.profile&&n.contextUsedPercentage===s.contextUsedPercentage&&n.contextFresh===s.contextFresh&&n.contextAvailability===s.contextAvailability&&n.contextTotalInputTokens===s.contextTotalInputTokens&&n.contextTotalOutputTokens===s.contextTotalOutputTokens&&n.agentActivity===s.agentActivity&&(((r=n.currentQitems)==null?void 0:r.length)??0)===(((a=s.currentQitems)==null?void 0:a.length)??0)&&n.rigId===s.rigId&&((l=n.activityRing)==null?void 0:l.state)===((u=s.activityRing)==null?void 0:u.state)&&((d=n.activityRing)==null?void 0:d.flash)===((f=s.activityRing)==null?void 0:f.flash)&&n.reducedMotion===s.reducedMotion});Xz.displayName="HybridAgentNode";async function Cxe(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}const Exe={rigGroup:Yz,podGroup:Qz,rigNode:Xz},Rxe={hotPotato:bq},Axe=!0,Txe=.03,Ixe=2,Zz=.08;function Jz(){const e=It(),{data:t}=Xm(),n=x_(),{expandedRigs:s,setRigExpanded:r}=Ek(),a=C.useCallback(_=>s.get(_)??Axe,[s]),l=C.useCallback(_=>{r(_,!a(_))},[a,r]),u=t??[],d=tf({queries:u.map(_=>({queryKey:["rig",_.rigId,"graph"],queryFn:()=>Cxe(_.rigId),enabled:a(_.rigId),refetchInterval:3e4}))}),f=C.useMemo(()=>u.filter(_=>a(_.rigId)).length,[u,a]),p=C.useCallback(()=>{for(const _ of u)r(_.rigId,!0)},[u,r]),m=C.useCallback(()=>{for(const _ of u)r(_.rigId,!1)},[u,r]),{mergedNodes:x,mergedEdges:y}=C.useMemo(()=>{var M,L;const _=[];for(let P=0;P<u.length;P++){const O=u[P],B=a(O.rigId),H=d[P];let z=[],W=[],$=w9,F=ZN,G;const X=((M=H==null?void 0:H.data)==null?void 0:M.nodes)??[],Z=((L=H==null?void 0:H.data)==null?void 0:L.edges)??[],D=oce({rigId:O.rigId,rigName:O.name,nodes:X,edges:Z,collapsed:!B});$=D.width,F=D.height,B&&(z=D.nodes,W=D.edges,G=D.podCount),_.push({rigId:O.rigId,rigName:O.name,status:O.status,nodeCount:O.nodeCount,runningCount:O.runningCount,activeCount:O.activeCount,podCount:G,isExpanded:B,childNodes:z,childEdges:W,width:$,height:F})}const R=lce(_.map(P=>({rigId:P.rigId,width:P.width,height:P.height}))),T=[],A=[];for(let P=0;P<_.length;P++){const O=_[P],B=R[P],H={rigId:O.rigId,rigName:O.rigName,collapsed:!O.isExpanded,status:O.status,nodeCount:O.nodeCount,runningCount:O.runningCount,activeCount:O.activeCount,podCount:O.podCount,onToggle:l};T.push({id:`rig-${O.rigId}`,type:"rigGroup",position:B.position,data:H,style:{width:B.width,height:B.height},draggable:!1,zIndex:0}),O.isExpanded&&(T.push(...O.childNodes),A.push(...O.childEdges))}return{mergedNodes:T,mergedEdges:A}},[u,a,d]),v=C.useMemo(()=>tx(x.filter(_=>_.type==="rigNode").map(_=>{const R=_.data;return{nodeId:_.id,rigId:(R==null?void 0:R.rigId)??null,rigName:(R==null?void 0:R.rigName)??null,logicalId:(R==null?void 0:R.logicalId)??null,canonicalSessionName:(R==null?void 0:R.canonicalSessionName)??null,agentActivity:(R==null?void 0:R.agentActivity)??null,currentQitems:(R==null?void 0:R.currentQitems)??null,startupStatus:(R==null?void 0:R.startupStatus)??null,terminalActive:R==null?void 0:R.terminalActive,hasAssignedWork:(R==null?void 0:R.hasAssignedWork)??!1,pendingWorkCount:(R==null?void 0:R.pendingWorkCount)??0}})),[x]),b=nx(v),w=C.useMemo(()=>x.map(_=>{if(_.type==="rigGroup"){const T=_.data;return{..._,data:{...T,recentActivity:b.isRigRecentlyActive(T.rigId)}}}if(_.type!=="rigNode")return _;const R=_.data;return{..._,data:{..._.data??{},activityRing:b.getNodeActivity(_.id,R),reducedMotion:n}}}),[x,b,n]),S=C.useMemo(()=>S9(y,b.packets,{reducedMotion:n}),[y,b.packets,n]),E=C.useMemo(()=>x.map(_=>{const R=_.style;return[_.id,Math.round(_.position.x),Math.round(_.position.y),(R==null?void 0:R.width)??"",(R==null?void 0:R.height)??"",_.parentId??""].join(":")}).join("|"),[x]),k=(_,R)=>{const T=R.data,A=T==null?void 0:T.rigId;if(A&&R.type!=="rigGroup"){if(R.type==="podGroup"||R.type==="group"){const M=(T==null?void 0:T.podNamespace)??(T==null?void 0:T.podId);if(!M)return;e({to:"/topology/pod/$rigId/$podName",params:{rigId:A,podName:M}});return}T!=null&&T.logicalId&&e({to:"/topology/seat/$rigId/$logicalId",params:{rigId:A,logicalId:encodeURIComponent(T.logicalId)}})}};return u.length===0?i.jsxs("div",{"data-testid":"host-multi-rig-graph-empty",className:"flex flex-col items-center justify-center h-full font-mono text-[10px] text-on-surface-variant",children:["No rigs registered. Run ",i.jsx("code",{className:"ml-1 text-stone-700",children:"rig up"})," to start one."]}):i.jsx("div",{"data-testid":"host-multi-rig-graph",className:"w-full h-full relative",children:i.jsxs(xf,{nodes:w,edges:S,nodeTypes:Exe,edgeTypes:Rxe,onNodeClick:k,nodesDraggable:!1,fitView:!0,fitViewOptions:{padding:Zz,includeHiddenNodes:!1},minZoom:Txe,maxZoom:Ixe,proOptions:{hideAttribution:!0},children:[i.jsx(Mxe,{layoutSignature:E}),i.jsx(mf,{position:"top-right",className:"!m-3",children:i.jsxs("div",{className:"flex items-center gap-1 border border-outline-variant bg-background/80 px-1.5 py-1 shadow-[2px_2px_0_rgba(46,52,46,0.10)] backdrop-blur-sm",children:[i.jsxs("button",{type:"button","data-testid":"topology-expand-all-rigs",onClick:p,disabled:f===u.length,title:"Expand all rigs",className:"inline-flex h-7 items-center gap-1 border border-transparent px-2 font-mono text-[9px] uppercase tracking-[0.08em] text-stone-700 hover:border-outline-variant hover:bg-white/70 hover:text-stone-950 disabled:pointer-events-none disabled:opacity-35",children:[i.jsx(sG,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Expand all"]}),i.jsxs("button",{type:"button","data-testid":"topology-collapse-all-rigs",onClick:m,disabled:f===0,title:"Collapse all rigs",className:"inline-flex h-7 items-center gap-1 border border-transparent px-2 font-mono text-[9px] uppercase tracking-[0.08em] text-stone-700 hover:border-outline-variant hover:bg-white/70 hover:text-stone-950 disabled:pointer-events-none disabled:opacity-35",children:[i.jsx(aG,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Collapse all"]})]})}),i.jsx(yf,{position:"bottom-right",showInteractive:!1,className:"!bg-white/40 !border !border-outline-variant"})]})})}function Mxe({layoutSignature:e}){const{fitView:t}=Og(),n=C.useRef(null);return C.useEffect(()=>{if(!e||n.current===e)return;n.current=e;const s=window.setTimeout(()=>{t({padding:Zz,includeHiddenNodes:!1,duration:250})},50);return()=>window.clearTimeout(s)},[t,e]),null}function V_(e){const{setMode:t}=Ek();C.useEffect(()=>(t(e==="graph"?"overlay":"opaque"),()=>{t("opaque")}),[e,t])}function G_({tabsNav:e,children:t}){return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx("div",{className:"relative z-30 px-6 pt-4",style:{marginLeft:"var(--header-anchor-offset, 0px)"},children:e}),i.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:t})]})}function Oxe(){const[e,t]=C.useState("graph"),{data:n}=dr(),{isWideLayout:s}=U_();V_(e);const r=!s&&e==="graph"?"table":e;return i.jsxs(G_,{eyebrow:"Topology · Host",title:"localhost",tabsNav:i.jsx($_,{tabs:dge,active:e,onSelect:t,testIdPrefix:"topology-host"}),children:[r==="graph"?i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(Jz,{})}):null,r==="table"?i.jsxs("div",{className:"px-6 pb-6",children:[!s&&e==="graph"?i.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,i.jsx(F_,{})]}):null,r==="terminal"?i.jsx(H_,{scope:"host"}):null]})}function Lxe(){const{rigId:e}=dn({from:"/topology/rig/$rigId"}),{data:t}=dr(),n=t==null?void 0:t.find(u=>u.id===e),[s,r]=C.useState("graph"),{isWideLayout:a}=U_();V_(s);const l=!a&&s==="graph"?"table":s;return i.jsxs(G_,{eyebrow:"Topology · Rig",title:(n==null?void 0:n.name)??e,tabsNav:i.jsx($_,{tabs:Oz,active:s,onSelect:r,testIdPrefix:"topology-rig",trailing:i.jsx(pxe,{rigId:e})}),children:[l==="graph"?i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(y_,{rigId:e,rigName:(n==null?void 0:n.name)??null,showDiscovered:!1})}):null,l==="table"?i.jsxs("div",{className:"px-6 pb-6",children:[!a&&s==="graph"?i.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,i.jsx(F_,{rigIdScope:e})]}):null,l==="terminal"?i.jsx(H_,{scope:"rig",rigId:e}):null,s==="overview"?i.jsx(Pxe,{rigId:e,rigName:(n==null?void 0:n.name)??null}):null]})}function Pxe({rigId:e,rigName:t}){const{data:n=[],isLoading:s}=Rc("rig"),r=t?n.filter(f=>f.name===t):[],a=r.length===1?r[0].id:null,{data:l,isLoading:u}=ik(a);if(s||u)return i.jsx("div",{className:"p-6",children:i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading rig spec…"})});if(r.length===0)return i.jsx("div",{className:"p-6",children:i.jsx(Ge,{label:"NO RIG SPEC",description:`No rig spec entry found for "${t??e}". Author one via /specs.`,variant:"card",testId:"topology-rig-overview-no-spec"})});if(r.length>1)return i.jsx("div",{className:"p-6",children:i.jsx(Ge,{label:"AMBIGUOUS RIG SPEC",description:`${r.length} rig spec entries match "${t??e}". Disambiguate at /specs.`,variant:"card"})});if(!l||l.kind!=="rig")return i.jsx("div",{className:"p-6",children:i.jsx(Ge,{label:"RIG SPEC UNAVAILABLE",description:"Rig spec failed to load.",variant:"card"})});const d=l;return i.jsx("div",{className:"px-6 pb-6","data-testid":"topology-rig-overview",children:i.jsx(I_,{review:d,yaml:d.raw,testIdPrefix:"topology-rig-overview-"})})}function $xe(){const{rigId:e,podName:t}=dn({from:"/topology/pod/$rigId/$podName"}),[n,s]=C.useState("graph"),{isWideLayout:r}=U_();V_(n);const a=!r&&n==="graph"?"table":n;return i.jsxs(G_,{eyebrow:"Topology · Pod",title:`${e} / ${t}`,tabsNav:i.jsx($_,{tabs:Oz,active:n,onSelect:s,testIdPrefix:"topology-pod"}),children:[a==="graph"?i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(y_,{rigId:e,rigName:null,showDiscovered:!1,podScope:t})}):null,a==="table"?i.jsxs("div",{className:"px-6 pb-6",children:[!r&&n==="graph"?i.jsx("p",{"data-testid":"topology-mobile-graph-degraded",className:"font-mono text-[9px] text-on-surface-variant italic mb-2",children:"Graph view degrades to table on narrow viewports."}):null,i.jsx(F_,{rigIdScope:e,podNameScope:t})]}):null,a==="terminal"?i.jsx(H_,{scope:"pod",rigId:e,podName:t}):null,n==="overview"?i.jsx("div",{className:"p-6",children:i.jsx(Ge,{label:"POD OVERVIEW",description:"Pod detail (Phase 5).",variant:"card"})}):null]})}function Dxe(){const{rigId:e,logicalId:t}=dn({from:"/topology/seat/$rigId/$logicalId"}),n=decodeURIComponent(t);return i.jsx("div",{"data-testid":"seat-scope-page",className:"flex flex-col h-full",children:i.jsx(fz,{rigId:e,logicalId:n})})}function PP(e){const t=e.toLowerCase();return t.includes("complete")||t.includes("shipped")||t.includes("handed_off")||t.includes("merged")||t.includes("done")?"success":t.includes("fail")||t.includes("error")||t.includes("blocked")||t.includes("rejected")?"danger":t.includes("warn")||t.includes("attention")||t.includes("flagged")?"warning":t.includes("created")||t.includes("started")||t.includes("in_progress")||t.includes("in-progress")||t.includes("transition")||t.includes("edited")||t.includes("updated")?"info":"muted"}const qxe={success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-sky-500",muted:"bg-stone-300"},$P=["bg-amber-100 text-amber-800 border-amber-300","bg-violet-100 text-violet-800 border-violet-300","bg-emerald-100 text-emerald-800 border-emerald-300","bg-sky-100 text-sky-800 border-sky-300","bg-rose-100 text-rose-800 border-rose-300","bg-fuchsia-100 text-fuchsia-800 border-fuchsia-300","bg-cyan-100 text-cyan-800 border-cyan-300","bg-orange-100 text-orange-800 border-orange-300"],zxe="bg-stone-100 text-stone-700 border-stone-300",Up=12;function eB({events:e,phaseDefinitions:t,queueItemsById:n,timelineMarkdown:s}){const[r,a]=C.useState(0),l=C.useMemo(()=>{const y=new Map;return t&&t.forEach((v,b)=>{y.set(v.id,{label:v.label,colorClass:$P[b%$P.length],token:{label:v.label,tone:["warning","info","success","neutral"][b%4]}})}),y},[t]),u=C.useMemo(()=>[...e].sort((y,v)=>DP(v.ts)-DP(y.ts)),[e]),d=Math.max(1,Math.ceil(u.length/Up)),f=Math.min(r,d-1),p=u.slice(f*Up,f*Up+Up),m=typeof s=="string"&&s.trim().length>0,x=e.length>0;return!x&&!m?i.jsxs("div",{"data-testid":"story-empty",className:"border border-dashed border-outline-variant bg-white/35 p-4 font-body text-[11px] leading-relaxed text-stone-500",children:[i.jsx("div",{className:"mb-1 font-mono uppercase tracking-[0.12em] text-stone-400",children:"No timeline yet"}),i.jsxs("div",{className:"text-stone-700",children:["Author one at ",i.jsx("span",{className:"font-mono text-stone-900",children:"<slice-dir>/timeline.md"})," with frontmatter",i.jsx("span",{className:"font-mono text-stone-900",children:" kind: incident-timeline"})," and a ",i.jsx("span",{className:"font-mono text-stone-900",children:"```timeline```"})," fenced block."]})]}):i.jsxs("div",{"data-testid":"story-tab",className:"space-y-3",children:[m&&i.jsx("div",{"data-testid":"story-timeline-markdown",className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:i.jsx(Jr,{content:s,hideFrontmatter:!0,hideRawToggle:!0})}),x&&i.jsx("div",{"data-testid":"story-step-tree","data-order":"newest-first",className:"relative border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:p.map((y,v)=>i.jsx(Hxe,{event:y,phaseMeta:l,isLast:v===p.length-1,queueItem:y.qitemId?n==null?void 0:n.get(y.qitemId):void 0},`${y.ts}-${y.kind}-${v}`))}),d>1?i.jsxs("div",{className:"mt-3 flex items-center justify-between border border-outline-variant bg-white/35 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-600",children:[i.jsx("button",{type:"button","data-testid":"story-page-prev",disabled:f===0,onClick:()=>a(y=>Math.max(0,y-1)),className:"border border-outline-variant px-2 py-1 disabled:opacity-40",children:"Newer"}),i.jsxs("span",{"data-testid":"story-page-status",children:["Page ",f+1," / ",d]}),i.jsx("button",{type:"button","data-testid":"story-page-next",disabled:f>=d-1,onClick:()=>a(y=>Math.min(d-1,y+1)),className:"border border-outline-variant px-2 py-1 disabled:opacity-40",children:"Older"})]}):null]})}function DP(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function Ud(e,t){if(!e)return null;for(const n of t){const s=e[n];if(typeof s=="string"&&s.length>0)return s}return null}function f2(e){const t=Ud(e.detail,["fromSession","sourceSession","source","actorSession"])??e.actorSession,n=Ud(e.detail,["toSession","destinationSession","targetSession","target"]);return{source:t,target:n}}function tB(e,t){const n=Ud(e.detail,["body","content","message"]);return(t==null?void 0:t.body)??n??e.summary}function Bxe(e,t){return{qitemId:e.qitemId??(t==null?void 0:t.qitemId)??"",source:(t==null?void 0:t.sourceSession)??f2(e).source??void 0,destination:(t==null?void 0:t.destinationSession)??f2(e).target??void 0,state:(t==null?void 0:t.state)??Ud(e.detail,["state","toState","fromState"])??void 0,tags:(t==null?void 0:t.tags)??void 0,createdAt:(t==null?void 0:t.tsCreated)??e.ts,body:(t==null?void 0:t.body)??tB(e,t)}}function Fxe(e,t=12){const n=e.split(`
547
+ `);return n.length<=t?e:`${n.slice(0,t).join(`
548
+ `)}
549
+ ... ${n.length-t} more lines`}function Hxe({event:e,phaseMeta:t,isLast:n,queueItem:s}){var b;const r=e.phase?t.get(e.phase):void 0,a=(r==null?void 0:r.label)??e.phase??"untagged",l=(r==null?void 0:r.colorClass)??zxe,u=(r==null?void 0:r.token)??{label:a,tone:"neutral"},d=f2(e),f=Ud(e.detail,["sliceLabel","sliceName"]),p=tB(e,s),m=!!(s!=null&&s.body),y=X2(e.kind).icon,v=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{"data-testid":`story-row-phase-${e.kind}`,"data-phase-id":e.phase??"untagged",className:`sr-only ${l}`,children:a}),i.jsx(Hn,{token:u,compact:!0}),f?i.jsx(Hn,{token:{label:f,tone:"neutral"},compact:!0}):null,i.jsx(ek,{kind:e.kind,compact:!0}),i.jsx(Ec,{value:e.ts})]}),i.jsx("pre",{"data-testid":`story-row-body-${e.kind}`,"data-source":m?"qitem":"event",className:"mt-2 whitespace-pre-wrap break-words font-body text-[12px] leading-relaxed text-stone-950",children:Fxe(p)}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.qitemId?i.jsx(pa,{tag:e.qitemId}):null,(b=s==null?void 0:s.tags)==null?void 0:b.slice(0,4).map(w=>i.jsx(pa,{tag:w},w))]}),m&&e.summary!==p?i.jsx("div",{"data-testid":`story-row-summary-${e.kind}`,className:"mt-2 truncate font-mono text-[9px] text-stone-500",children:e.summary}):null,(d.source||d.target)&&i.jsx("div",{"data-testid":`story-step-flow-${e.kind}`,className:"mt-2",children:i.jsx(sg,{source:d.source,destination:d.target,muted:!0})})]});return i.jsxs("div",{className:"relative pl-9 pb-3 last:pb-0",children:[!n&&i.jsx("div",{"data-testid":`story-step-connector-${e.kind}`,className:"absolute left-[14px] top-7 bottom-0 w-px bg-outline-variant"}),i.jsx("div",{"data-testid":`story-step-dot-${e.kind}`,"data-dot-status":PP(e.kind),className:`absolute left-[5px] top-3.5 flex h-5 w-5 items-center justify-center border border-outline-variant text-white shadow-[1px_1px_0_rgba(46,52,46,0.12)] ${qxe[PP(e.kind)]}`,children:y?i.jsx(y,{className:"h-3 w-3",strokeWidth:1.7}):null}),e.qitemId?i.jsx(ax,{data:Bxe(e,s),testId:`story-row-${e.kind}`,className:"block w-full border border-outline-variant bg-white/45 px-3 py-2 text-left hard-shadow backdrop-blur-sm hover:bg-white/60",children:v}):i.jsx("div",{"data-testid":`story-row-${e.kind}`,className:"w-full border border-outline-variant bg-white/45 px-3 py-2 text-left hard-shadow backdrop-blur-sm",children:v}),e.detail&&i.jsxs("details",{className:"mt-1",children:[i.jsx("summary",{className:"cursor-pointer font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:"Event detail"}),i.jsx("pre",{"data-testid":`story-row-detail-${e.kind}`,className:"mt-1 overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:JSON.stringify(e.detail,null,2)})]})]})}function Uxe(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?!0:s.startsWith(n+"/")}function Vxe(e,t){const n=e.replace(/\/+$/,""),s=t.replace(/\/+$/,"");return s===n?"":s.startsWith(n+"/")?s.slice(n.length+1):s}function Gxe(e,t){const n=e.find(a=>a.path.replace(/\/+$/,"")===t.replace(/\/+$/,""));if(n)return{rootName:n.name,relPath:""};const r=e.filter(a=>Uxe(a.path,t)).sort((a,l)=>l.path.length-a.path.length)[0];return r?{rootName:r.name,relPath:Vxe(r.path,t)}:null}function Fm(e,t){const n=Jm(),s=n.data,r=s&&"roots"in s?s.roots:null,a=e&&r?Gxe(r,e):null,l=a?a.relPath?`${a.relPath}/${t}`:t:null,u=eg(a?a.rootName:null,l);return e?n.isLoading?{content:null,isLoading:!0,unavailable:!1,mtime:null,resolved:null}:a?u.isLoading?{content:null,isLoading:!0,unavailable:!1,mtime:null,resolved:a}:u.isError||!u.data?{content:null,isLoading:!1,unavailable:!0,mtime:null,resolved:a}:{content:u.data.content??null,isLoading:!1,unavailable:!1,mtime:u.data.mtime??null,resolved:a}:{content:null,isLoading:!1,unavailable:!0,mtime:null,resolved:null}:{content:null,isLoading:!1,unavailable:!0,mtime:null,resolved:null}}function Kxe(e){return Fm(e,"timeline.md")}function Wxe({path:e,root:t,readPath:n,absolutePath:s,kind:r,children:a,className:l,style:u,testId:d}){const f={path:e,...t!==void 0?{root:t}:{},...n!==void 0?{readPath:n}:{},...s!==void 0?{absolutePath:s}:{},...r!==void 0?{kind:r}:{}};return i.jsx(_f,{data:f,className:l,style:u,testId:d??"file-link",children:a??e})}async function Yxe(e){const t=await fetch(`/api/missions/${encodeURIComponent(e)}`);if(t.status===503){const n=await t.json().catch(()=>({}));return{unavailable:!0,error:n.error??"missions_route_unavailable",hint:n.hint}}if(t.status===404)return{unavailable:!0,error:"mission_not_found"};if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.json()}function Qxe(e){return qe({queryKey:["mission","detail",e],queryFn:()=>Yxe(e),enabled:!!e,staleTime:3e4,refetchOnWindowFocus:!0})}const Xxe=["all","active","done","blocked"];function Zxe({acceptance:e}){const{totalItems:t,doneItems:n,percentage:s,items:r,closureCallout:a,currentStep:l}=e,[u,d]=C.useState("all"),f=C.useMemo(()=>t0e(r,u),[r,u]);return i.jsxs("div",{"data-testid":"acceptance-tab",className:"p-4",children:[l&&i.jsx(Jxe,{currentStep:l}),i.jsxs("header",{className:"mb-4",children:[i.jsxs("div",{className:"flex items-baseline justify-between",children:[i.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Acceptance"}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-500",children:[n," / ",t," (",s,"%)"]})]}),i.jsx("div",{className:"mt-2 h-2 w-full bg-stone-100","data-testid":"acceptance-progress-bar",children:i.jsx("div",{className:"h-2 bg-emerald-500 transition-all","data-testid":"acceptance-progress-fill","data-percentage":s,style:{width:`${s}%`}})}),a&&i.jsx("div",{"data-testid":"acceptance-closure-callout",className:"mt-3 border border-emerald-300 bg-emerald-50 px-3 py-2 font-mono text-[10px] text-emerald-900",children:a}),r.length>0&&i.jsx("div",{className:"mt-3 flex gap-1","data-testid":"acceptance-filter-row",children:Xxe.map(p=>i.jsx("button",{type:"button","data-testid":`acceptance-filter-${p}`,"data-active":u===p,onClick:()=>d(p),className:`border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.10em] ${u===p?"border-stone-700 bg-stone-700 text-white":"border-stone-300 text-stone-700 hover:bg-stone-100"}`,children:p},p))})]}),r.length===0?i.jsx("div",{className:"font-mono text-[10px] text-stone-400","data-testid":"acceptance-empty",children:"No acceptance items found in slice docs (looks for `[ ]` / `[x]` checkbox lines in README / IMPLEMENTATION-PRD / PROGRESS / IMPLEMENTATION)."}):f.length===0?i.jsxs("div",{className:"font-mono text-[10px] text-stone-400","data-testid":"acceptance-filter-empty",children:["No items match filter '",u,"'."]}):i.jsx("ul",{className:"space-y-1","data-testid":"acceptance-list",children:f.map((p,m)=>i.jsx(e0e,{item:p,idx:m},`${p.source.file}:${p.source.line}`))})]})}function Jxe({currentStep:e}){return i.jsxs("section",{"data-testid":"acceptance-current-step","data-step-id":e.stepId,className:"mb-6 border border-stone-300 bg-stone-50 p-3",children:[i.jsxs("div",{className:"flex items-baseline justify-between",children:[i.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Current step"}),i.jsxs("div",{className:"font-mono text-[9px] text-stone-500",children:["hop ",e.hopCount," · ",e.instanceStatus]})]}),i.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[i.jsx("span",{"data-testid":"acceptance-current-step-id",className:"font-mono text-[12px] font-bold text-stone-900",children:e.stepId}),i.jsxs("span",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:["role: ",e.role]})]}),e.objective&&i.jsx("div",{"data-testid":"acceptance-current-step-objective",className:"mt-2 whitespace-pre-line font-mono text-[10px] text-stone-700",children:e.objective}),i.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[i.jsxs("div",{"data-testid":"acceptance-current-step-allowed-exits",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500",children:"Allowed exits"}),i.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.allowedExits.length===0?i.jsx("span",{className:"font-mono text-[9px] text-stone-400",children:"(none)"}):e.allowedExits.map(t=>i.jsx("span",{className:"border border-stone-300 bg-white px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-700",children:t},t))})]}),i.jsxs("div",{"data-testid":"acceptance-current-step-allowed-next-steps",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.10em] text-stone-500",children:"Allowed next steps"}),i.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.allowedNextSteps.length===0?i.jsxs("span",{className:"inline-flex items-center gap-1 font-mono text-[9px] uppercase tracking-[0.10em] text-stone-500",children:[i.jsx($e,{tool:"terminal",size:"xs"}),"terminal"]}):e.allowedNextSteps.map(t=>i.jsx("span",{"data-testid":`acceptance-next-step-${t.stepId}`,className:"border border-emerald-300 bg-emerald-50 px-1.5 py-0.5 font-mono text-[9px] text-emerald-900",title:`role: ${t.role}`,children:t.stepId},t.stepId))})]})]})]})}function e0e({item:e,idx:t}){const[n,s]=C.useState(!1),{pillClass:r,pillIcon:a,pillLabel:l}=n0e(e.done);return i.jsxs("li",{"data-testid":`acceptance-item-${t}`,"data-done":e.done,className:"border-b border-stone-100",children:[i.jsxs("button",{type:"button",onClick:()=>s(u=>!u),"data-testid":`acceptance-item-${t}-toggle`,className:"flex w-full items-start gap-2 py-1.5 text-left hover:bg-stone-50",children:[i.jsxs("span",{"data-testid":`acceptance-pill-${t}`,className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.10em] ${r}`,"aria-label":l,children:[i.jsx("span",{"aria-hidden":"true",children:a}),i.jsx("span",{children:l})]}),i.jsx("span",{className:"flex-1 font-mono text-[10px] text-stone-800",children:e.text}),i.jsxs("span",{className:"font-mono text-[8px] text-stone-400",title:`${e.source.file}:${e.source.line}`,children:[e.source.file,":",e.source.line]})]}),n&&i.jsxs("div",{"data-testid":`acceptance-item-${t}-detail`,className:"ml-2 mt-1 border-l-2 border-stone-300 bg-stone-50 px-3 py-2 font-mono text-[9px] text-stone-700",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-bold",children:"Source:"})," ",i.jsxs("span",{"data-testid":`acceptance-item-${t}-citation`,children:[e.source.file,":",e.source.line]})]}),i.jsxs("div",{className:"mt-1",children:[i.jsx("span",{className:"font-bold",children:"Status:"})," ",l]}),i.jsx("div",{className:"mt-2 whitespace-pre-line text-stone-800",children:e.text})]})]})}function t0e(e,t){return t==="all"?e:t==="done"?e.filter(n=>n.done):t==="active"?e.filter(n=>!n.done):t==="blocked"?e.filter(n=>/\b(blocked|blocker|parked|park)\b/i.test(n.text)):e}function n0e(e){return e?{pillClass:"border-emerald-400 bg-emerald-50 text-emerald-900",pillIcon:"✓",pillLabel:"done"}:{pillClass:"border-stone-400 bg-stone-50 text-stone-700",pillIcon:"◯",pillLabel:"active"}}function s0e({sliceName:e,tree:t}){var l,u,d;const n=((l=t.find(f=>f.type==="file"&&f.name==="README.md"))==null?void 0:l.relPath)??((u=t.find(f=>f.type==="file"&&f.name==="IMPLEMENTATION-PRD.md"))==null?void 0:u.relPath)??((d=t.find(f=>f.type==="file"))==null?void 0:d.relPath)??null,[s,r]=C.useState(n),a=AK(e,s);return i.jsxs("div",{"data-testid":"docs-tab",className:"flex h-full flex-col sm:flex-row",children:[i.jsxs("aside",{className:"w-full max-h-48 shrink-0 overflow-y-auto border-b border-stone-200 bg-stone-50 p-2 sm:w-56 sm:max-h-none sm:border-b-0 sm:border-r","data-testid":"docs-tree",children:[t.length===0&&i.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Empty slice folder."}),t.map(f=>i.jsx("button",{type:"button","data-testid":`docs-tree-${f.relPath}`,"data-selected":f.relPath===s,disabled:f.type==="dir",onClick:()=>f.type==="file"&&r(f.relPath),className:`block w-full text-left font-mono text-[10px] ${f.type==="dir"?"py-1 text-stone-400":`cursor-pointer py-1 hover:bg-stone-100 ${f.relPath===s?"bg-stone-200/80 text-stone-900":"text-stone-700"}`}`,style:{paddingLeft:`${(f.relPath.split("/").length-1)*.75+.25}rem`},children:i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[f.type==="dir"?i.jsx($e,{tool:"folder",size:"xs",decorative:!0}):i.jsx($e,{tool:f.name,size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:f.name})]})},f.relPath))]}),i.jsxs("main",{className:"flex-1 min-w-0 overflow-y-auto bg-white","data-testid":"docs-viewer",children:[!s&&i.jsx("div",{className:"m-auto p-4 font-mono text-[10px] text-stone-400",children:"Select a file from the tree"}),s&&a.isLoading&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading…"}),s&&a.isError&&i.jsx("div",{className:"p-4 font-mono text-[10px] text-red-600",children:"Error loading doc."}),s&&a.data&&i.jsx("div",{"data-testid":"docs-viewer-content",className:"p-4",children:s.toLowerCase().endsWith(".md")?i.jsx(Jr,{content:a.data.content}):i.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-[11px] text-stone-800",children:a.data.content})})]})]})}function r0e({rows:e}){const[t,n]=C.useState("all"),[s,r]=C.useState("all"),[a,l]=C.useState(""),u=C.useMemo(()=>{const p=new Set(e.map(m=>m.verb));return["all",...Array.from(p).sort()]},[e]),d=C.useMemo(()=>{const p=new Set(e.map(m=>m.actor));return["all",...Array.from(p).sort()]},[e]),f=C.useMemo(()=>{const p=a.trim().toLowerCase();return e.filter(m=>t!=="all"&&m.verb!==t||s!=="all"&&m.actor!==s?!1:p?m.verb.toLowerCase().includes(p)||m.qitemId.toLowerCase().includes(p)||(m.reason??"").toLowerCase().includes(p):!0)},[e,t,s,a]);return e.length===0?i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"decisions-empty",children:"No mission_control_actions rows found for this slice's qitem chain."}):i.jsxs("div",{"data-testid":"decisions-tab",className:"flex h-full flex-col",children:[i.jsxs("div",{className:"flex flex-wrap gap-2 border-b border-stone-200 bg-stone-50 p-3","data-testid":"decisions-filters",children:[i.jsx("select",{"data-testid":"decisions-verb-filter",value:t,onChange:p=>n(p.target.value),className:"border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]",children:u.map(p=>i.jsx("option",{value:p,children:p},p))}),i.jsx("select",{"data-testid":"decisions-actor-filter",value:s,onChange:p=>r(p.target.value),className:"border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]",children:d.map(p=>i.jsx("option",{value:p,children:p},p))}),i.jsx("input",{"data-testid":"decisions-search",type:"text",placeholder:"search verb / qitem / reason",value:a,onChange:p=>l(p.target.value),className:"flex-1 min-w-32 border border-stone-300 bg-white px-2 py-1 font-mono text-[10px]"}),i.jsxs("span",{className:"font-mono text-[10px] text-stone-500","data-testid":"decisions-result-count",children:[f.length," / ",e.length]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"decisions-list",children:f.map(p=>i.jsx(i0e,{row:p},p.actionId))})]})}function i0e({row:e}){const[t,n]=C.useState(!1);return i.jsxs("div",{className:"border-b border-stone-100 px-4 py-2 hover:bg-stone-50",children:[i.jsxs("button",{type:"button","data-testid":`decision-row-${e.actionId}`,onClick:()=>n(s=>!s),className:"w-full text-left",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-mono text-[9px] text-stone-500 shrink-0",children:e.ts.slice(0,19)}),i.jsx("span",{className:"font-mono text-[10px] font-bold text-stone-900 shrink-0",children:e.verb}),i.jsx("span",{className:"font-mono text-[9px] text-stone-500 shrink-0",children:e.actor}),i.jsx("span",{className:"font-mono text-[9px] text-stone-400 truncate",children:e.qitemId})]}),e.reason&&i.jsx("div",{className:"ml-[120px] font-mono text-[10px] text-stone-700",children:e.reason})]}),t&&i.jsxs("div",{className:"ml-[120px] mt-1 grid grid-cols-2 gap-2","data-testid":`decision-row-detail-${e.actionId}`,children:[i.jsxs("pre",{className:"overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:[i.jsx("div",{className:"text-stone-500",children:"before:"}),e.beforeState??"null"]}),i.jsxs("pre",{className:"overflow-x-auto bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:[i.jsx("div",{className:"text-stone-500",children:"after:"}),e.afterState??"null"]})]})]})}const a0e={pass:"text-emerald-900",fail:"text-red-900",partial:"text-amber-900",unknown:"text-stone-700"};function o0e({sliceName:e,tests:t,qitemCount:n,docsCount:s,lastActivityAt:r}){return t.proofPackets.length===0?i.jsxs("div",{className:"border border-outline-variant bg-white/20 p-4 font-mono","data-testid":"tests-empty",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.14em] text-stone-500",children:"No proof packet matched"}),i.jsx("p",{"data-testid":"tests-empty-reason",className:"mt-2 max-w-2xl text-[11px] leading-relaxed text-stone-700",children:"The proof matcher did not find a dogfood-evidence directory whose name contains this slice id. Evidence may still exist under the configured evidence root or under a related mission folder."}),i.jsxs("div",{"data-testid":"tests-empty-diagnostics",className:"mt-3 grid gap-2 text-[10px] text-stone-600 sm:grid-cols-3",children:[i.jsx(ZS,{label:"Qitems",value:n??0}),i.jsx(ZS,{label:"Indexed files",value:s??0}),i.jsx(ZS,{label:"Last activity",value:l0e(r??null)})]}),i.jsxs("ul",{"data-testid":"tests-empty-next-steps",className:"mt-3 list-disc space-y-1 pl-4 text-[10px] leading-relaxed text-stone-600",children:[i.jsx("li",{children:"Check Artifacts for slice-local files and commit refs."}),i.jsx("li",{children:"Check the evidence root for dogfood screenshots or proof notes with related names."}),i.jsx("li",{children:"When a proof packet is added with a matching directory name, this tab will render it inline."})]})]}):i.jsxs("div",{"data-testid":"tests-tab",className:"p-4 space-y-4",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 pb-2",children:[i.jsxs("div",{className:"inline-flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:[i.jsx($e,{tool:"proof",size:"xs"}),"Tests / Verification"]}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-500","data-testid":"tests-aggregate",children:[t.aggregate.passCount," pass, ",t.aggregate.failCount," fail"," · ",t.proofPackets.length," packet",t.proofPackets.length===1?"":"s"]})]}),t.proofPackets.map(a=>i.jsx(c0e,{sliceName:e,packet:a},a.dirName))]})}function ZS({label:e,value:t}){return i.jsxs("div",{className:"border border-outline-variant bg-white/30 px-2 py-1",children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.12em] text-stone-400",children:e}),i.jsx("div",{className:"mt-0.5 truncate text-stone-900",children:t})]})}function l0e(e){if(!e)return"unknown";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function c0e({sliceName:e,packet:t}){const[n,s]=C.useState(null);return i.jsxs("article",{className:"border border-stone-200 bg-white","data-testid":`tests-packet-${t.dirName}`,children:[i.jsx("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2",children:i.jsx("div",{className:`min-w-0 flex-1 ${a0e[t.passFailBadge]}`,"data-testid":`tests-packet-badge-${t.dirName}`,children:i.jsx(rg,{title:t.dirName,badge:t.passFailBadge})})}),i.jsxs("div",{className:"p-3 space-y-3",children:[t.primaryMarkdown&&i.jsxs("div",{"data-testid":`tests-packet-primary-md-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx($e,{tool:t.primaryMarkdown.relPath,size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),t.primaryMarkdown.relPath]}),i.jsx("pre",{className:"whitespace-pre-wrap break-words bg-stone-50 p-3 font-mono text-[10px] text-stone-800",children:t.primaryMarkdown.content})]}),t.screenshots.length>0&&i.jsxs("section",{"data-testid":`tests-packet-screenshots-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx($e,{tool:"screenshot",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Screenshots (",t.screenshots.length,")"]}),i.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:t.screenshots.map(r=>i.jsxs("figure",{className:"border border-stone-200",children:[i.jsx("button",{type:"button","data-testid":`tests-packet-screenshot-open-${r}`,onClick:()=>s(r),className:"block w-full text-left",children:i.jsx("img",{"data-testid":`tests-packet-screenshot-${r}`,src:ud(e,r),alt:r,loading:"lazy",className:"block w-full bg-stone-100"})}),i.jsxs("figcaption",{className:"bg-stone-50 px-2 py-1 font-mono text-[9px] text-stone-500 truncate",children:[i.jsx($e,{tool:r,size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),r]})]},r))})]}),i.jsx(P_,{sliceName:e,relPath:n,onClose:()=>s(null),testId:"tests-screenshot-viewer",imageTestId:"tests-screenshot-viewer-image",closeTestId:"tests-screenshot-viewer-close"}),t.videos.length>0&&i.jsxs("section",{"data-testid":`tests-packet-videos-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx($e,{tool:"video",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Videos (",t.videos.length,")"]}),i.jsx("div",{className:"space-y-3",children:t.videos.map(r=>i.jsxs("figure",{className:"border border-stone-200",children:[i.jsx("video",{"data-testid":`tests-packet-video-${r}`,src:ud(e,r),controls:!0,preload:"metadata",className:"block w-full bg-black"}),i.jsx("figcaption",{className:"bg-stone-50 px-2 py-1 font-mono text-[9px] text-stone-500 truncate",children:r})]},r))})]}),t.traces.length>0&&i.jsxs("section",{"data-testid":`tests-packet-traces-${t.dirName}`,children:[i.jsxs("div",{className:"mb-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx($e,{tool:"trace",size:"xs",className:"mr-1 inline-block align-[-2px]",decorative:!0}),"Traces (download)"]}),i.jsx("ul",{className:"font-mono text-[10px]",children:t.traces.map(r=>i.jsx("li",{children:i.jsxs("a",{href:ud(e,r),download:!0,className:"inline-flex items-center gap-1 text-blue-700 hover:underline",children:[i.jsx($e,{tool:r,size:"xs",decorative:!0}),r]})},r))})]}),t.additionalMarkdown.length>0&&i.jsxs("details",{children:[i.jsxs("summary",{className:"cursor-pointer font-mono text-[10px] text-stone-700","data-testid":`tests-packet-additional-md-toggle-${t.dirName}`,children:["Additional markdown (",t.additionalMarkdown.length,")"]}),i.jsx("div",{className:"mt-2 space-y-2",children:t.additionalMarkdown.map(r=>i.jsxs("div",{children:[i.jsxs("div",{className:"inline-flex items-center gap-1 font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500",children:[i.jsx($e,{tool:r.relPath,size:"xs",decorative:!0}),r.relPath]}),i.jsx("pre",{className:"whitespace-pre-wrap break-words bg-stone-50 p-2 font-mono text-[9px] text-stone-700",children:r.content})]},r.relPath))})]})]})]})}const lm=200,cm=112,u0e={sliceWorkflowStep:h0e};function d0e({specGraph:e}){const{nodes:t,edges:n}=C.useMemo(()=>f0e(e),[e]);return i.jsxs("section",{"data-testid":"topology-spec-graph","data-spec-name":e.specName,"data-spec-version":e.specVersion,"data-layout":"react-flow-dagre",className:"border border-outline-variant bg-white/20",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-outline-variant bg-white/20 px-3 py-2",children:[i.jsxs("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-500",children:["Workflow graph - ",e.specName," v",e.specVersion]}),i.jsxs("div",{className:"font-mono text-[9px] uppercase tracking-[0.10em] text-stone-400",children:[e.nodes.length," steps / ",e.edges.length," edges"]})]}),i.jsx("div",{"data-testid":"slice-workflow-graph",className:"h-[420px] bg-[radial-gradient(circle_at_1px_1px,rgba(87,83,78,0.22)_1px,transparent_0)] [background-size:18px_18px]",children:i.jsxs(xf,{nodes:t,edges:n,nodeTypes:u0e,fitView:!0,minZoom:.2,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[i.jsx(Kk,{gap:18,size:.5,color:"#d6d3cd"}),i.jsx(yf,{showInteractive:!1})]})}),i.jsx("div",{className:"sr-only","data-testid":"slice-workflow-edge-metadata",children:e.edges.map(s=>i.jsxs("span",{"data-testid":`spec-edge-${s.fromStepId}-${s.toStepId}`,"data-routing-type":s.routingType,"data-is-loop-back":s.isLoopBack,children:[s.fromStepId," to ",s.toStepId]},`${s.fromStepId}-${s.toStepId}`))})]})}function f0e(e){const t=new Dm.graphlib.Graph;t.setDefaultEdgeLabel(()=>({})),t.setGraph({rankdir:"LR",nodesep:80,ranksep:110,marginx:24,marginy:24}),e.nodes.forEach(r=>{t.setNode(r.stepId,{width:lm,height:cm})}),e.edges.forEach(r=>{t.setEdge(r.fromStepId,r.toStepId)}),Dm.layout(t);const n=e.nodes.map(r=>{const a=t.node(r.stepId);return{id:r.stepId,type:"sliceWorkflowStep",position:{x:((a==null?void 0:a.x)??0)-lm/2,y:((a==null?void 0:a.y)??0)-cm/2},data:{step:r},sourcePosition:ye.Right,targetPosition:ye.Left,width:lm,height:cm}}),s=e.edges.map(r=>({id:`spec-edge-${r.fromStepId}-${r.toStepId}`,source:r.fromStepId,target:r.toStepId,type:"smoothstep",markerEnd:{type:Sc.ArrowClosed,color:r.isLoopBack?"#b45309":"#57534e"},style:{stroke:r.isLoopBack?"#b45309":"#57534e",strokeWidth:r.isLoopBack?1.5:1.25,strokeDasharray:r.isLoopBack?"6 5":void 0},label:r.isLoopBack?"loop":r.routingType,labelStyle:{fill:r.isLoopBack?"#b45309":"#78716c",fontSize:9,fontFamily:"monospace",textTransform:"uppercase"}}));return{nodes:n,edges:s}}function h0e({data:e}){const t=e.step;return i.jsxs("div",{"data-testid":`spec-node-${t.stepId}`,"data-is-current":t.isCurrent,"data-is-entry":t.isEntry,"data-is-terminal":t.isTerminal,style:{width:lm,height:cm},className:`relative border border-outline-variant bg-white/30 p-3 font-mono hard-shadow ${t.isCurrent?"ring-2 ring-emerald-500/50 bg-emerald-50/60":""}`,children:[i.jsx(dg,{testIdPrefix:`slice-workflow-${t.stepId}`}),i.jsx(bn,{type:"target",position:ye.Left,className:"!h-2 !w-2 !border-outline-variant !bg-stone-500"}),i.jsx(bn,{type:"source",position:ye.Right,className:"!h-2 !w-2 !border-outline-variant !bg-stone-500"}),i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px] font-bold uppercase tracking-[0.04em] text-stone-950",children:t.stepId}),i.jsx("div",{className:"mt-0.5 text-[9px] uppercase tracking-[0.10em] text-stone-500",children:t.role})]}),i.jsxs("div",{className:"flex flex-col items-end gap-1",children:[t.isEntry&&i.jsx("span",{"data-testid":`spec-node-${t.stepId}-entry-badge`,className:"border border-blue-300 bg-blue-50 px-1 text-[8px] uppercase tracking-[0.10em] text-blue-900",children:"entry"}),t.isCurrent&&i.jsx("span",{"data-testid":`spec-node-${t.stepId}-current-badge`,className:"border border-emerald-400 bg-emerald-100 px-1 text-[8px] uppercase tracking-[0.10em] text-emerald-900",children:"current"}),t.isTerminal&&i.jsxs("span",{"data-testid":`spec-node-${t.stepId}-terminal-badge`,className:"inline-flex items-center gap-1 border border-stone-300 bg-stone-100 px-1 text-[8px] uppercase tracking-[0.10em] text-stone-700",children:[i.jsx($e,{tool:"terminal",size:"xs"}),"terminal"]})]})]}),i.jsx("div",{className:"mt-3 text-[10px] leading-4 text-stone-800",children:t.label}),t.preferredTarget&&i.jsx("div",{className:"mt-2 truncate text-[9px] text-stone-500",children:t.preferredTarget})]})}function K_({topology:e}){const{affectedRigs:t,totalSeats:n,specGraph:s}=e,r=s??p0e(t);return t.length>0||s!==null?i.jsxs("div",{"data-testid":"topology-tab",className:"p-4 space-y-4",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 pb-2",children:[i.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-stone-700",children:"Topology"}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-500","data-testid":"topology-aggregate",children:[n," seat",n===1?"":"s"," · ",t.length," rig",t.length===1?"":"s",s&&i.jsxs(i.Fragment,{children:[" · spec ",i.jsx("span",{"data-testid":"topology-spec-name",children:s.specName})," v",s.specVersion]})]})]}),r&&i.jsx(d0e,{specGraph:r}),t.length>0&&i.jsxs("div",{"data-testid":"topology-rig-listing",className:"space-y-3",children:[r&&i.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.10em] text-stone-500",children:"Active seats"}),t.map(l=>i.jsxs("section",{"data-testid":`topology-rig-${l.rigName}`,className:"border border-stone-200 bg-white",children:[i.jsxs("header",{className:"flex items-center justify-between border-b border-stone-200 bg-stone-50 px-3 py-2",children:[i.jsx("div",{className:"font-mono text-[10px] font-bold text-stone-900",children:l.rigName}),i.jsx(Ve,{to:"/rigs/$rigId",params:{rigId:l.rigId},"data-testid":`topology-rig-${l.rigName}-open`,className:"font-mono text-[9px] uppercase tracking-[0.10em] text-blue-700 hover:underline",children:"Open topology →"})]}),i.jsx("ul",{className:"divide-y divide-stone-100",children:l.sessionNames.map(u=>i.jsx(m0e,{session:u},u))})]},l.rigName))]})]}):i.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400","data-testid":"topology-empty",children:"No seats found for this slice's qitem chain."})}function p0e(e){if(e.length===0)return null;const t=e.map((n,s)=>({stepId:n.rigName||n.rigId||`rig-${s+1}`,label:n.rigName||n.rigId||`Rig ${s+1}`,role:`${n.sessionNames.length} seat${n.sessionNames.length===1?"":"s"}`,preferredTarget:n.sessionNames[0]??null,isEntry:s===0,isCurrent:s===e.length-1,isTerminal:s===e.length-1}));return{specName:"runtime-handoff-map",specVersion:"derived",nodes:t,edges:t.slice(0,-1).map((n,s)=>({fromStepId:n.stepId,toStepId:t[s+1].stepId,routingType:"direct",isLoopBack:!1}))}}function m0e({session:e}){const[t,n]=C.useState(!1);return i.jsxs("li",{"data-testid":`topology-seat-${e}`,"data-open":t?"true":"false",className:"px-3 py-1",children:[i.jsxs("button",{type:"button","data-testid":`topology-seat-${e}-toggle`,onClick:()=>n(s=>!s),className:"flex w-full items-baseline gap-2 text-left font-mono text-[10px] text-stone-700 hover:bg-stone-50 -mx-3 px-3 py-0.5",children:[i.jsx("span",{className:"flex-1 truncate",children:e}),i.jsx("span",{className:"text-stone-400 shrink-0",children:t?"▾":"▸"})]}),t&&i.jsx("div",{"data-testid":`topology-seat-${e}-preview`,className:"mt-1",children:i.jsx(Pg,{sessionName:e,testIdPrefix:`topology-preview-${e}`})})]})}function nB(e){return wD[e==="neutral"?"success":e]}function g0e({rows:e,detailsByName:t,isLoading:n}){const s=e.map(r=>{const a=t.get(r.name),l=a==null?void 0:a.acceptance;return{name:r.name,displayName:r.displayName,status:r.status,items:(l==null?void 0:l.items)??[],doneItems:(l==null?void 0:l.doneItems)??0,totalItems:(l==null?void 0:l.totalItems)??0,percentage:(l==null?void 0:l.percentage)??0}});return n&&s.length===0?i.jsx(Ge,{label:"LOADING PROGRESS",description:"Reading mission slice acceptance.",variant:"card",testId:"mission-progress-heatmap-loading"}):s.length===0?i.jsx(Ge,{label:"NO MISSION SLICES",description:"Mission has no scoped slices to render a heat-map.",variant:"card",testId:"mission-progress-heatmap-empty"}):i.jsxs("section",{"data-testid":"mission-progress-heatmap",className:"border border-outline-variant bg-white/35 p-4 backdrop-blur-sm",children:[i.jsxs("header",{className:"mb-3 flex items-center justify-between gap-3 border-b border-outline-variant pb-2",children:[i.jsx("h3",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Acceptance heat-map"}),i.jsxs("span",{className:"font-mono text-[10px] text-stone-600",children:[s.length," slice",s.length===1?"":"s"," ·"," ","one cell per acceptance item"]})]}),i.jsx("div",{className:"space-y-2",children:s.map(r=>i.jsx(x0e,{row:r},r.name))}),i.jsx(v0e,{})]})}function x0e({row:e}){const t=nf(e.status);return i.jsxs("article",{"data-testid":`mission-progress-heatmap-row-${e.name}`,"data-status":e.status,"data-tone":t,className:"grid grid-cols-[minmax(8rem,16rem)_1fr_auto] items-center gap-3",children:[i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsx(Ve,{to:"/project/slice/$sliceId",params:{sliceId:e.name},className:"block truncate font-mono text-[11px] uppercase tracking-[0.12em] text-stone-900 hover:underline",title:e.displayName,"aria-label":`${e.displayName} (${e.doneItems}/${e.totalItems} acceptance items)`,children:e.displayName}),i.jsx(Hn,{token:{label:e.status,tone:t},compact:!0})]}),i.jsx(y0e,{row:e}),i.jsxs("div",{className:"font-mono text-[10px] text-stone-700 tabular-nums whitespace-nowrap",children:[e.doneItems,"/",e.totalItems||0,e.totalItems>0?` (${e.percentage}%)`:""]})]})}function y0e({row:e}){if(e.items.length===0)return i.jsx("div",{"data-testid":`mission-progress-heatmap-cells-${e.name}`,"data-cell-state":"empty",className:"font-mono text-[10px] italic text-stone-500",children:"No acceptance items declared yet."});const t=nf(e.status),n=nB(t);return i.jsx("div",{"data-testid":`mission-progress-heatmap-cells-${e.name}`,className:"flex flex-wrap gap-[3px]",children:e.items.map((s,r)=>i.jsx("span",{"data-testid":`mission-progress-heatmap-cell-${e.name}-${r}`,"data-done":s.done?"true":"false","aria-label":`${s.text} (${s.done?"done":"not done"})`,title:s.text,className:s.done?`h-4 w-4 border ${n}`:"h-4 w-4 border border-outline-variant bg-white/35"},r))})}function v0e(){return i.jsxs("footer",{"data-testid":"mission-progress-heatmap-legend",className:"mt-3 flex flex-wrap items-center gap-3 border-t border-outline-variant pt-2 font-mono text-[10px] text-stone-600",children:[i.jsx(Ju,{label:"done (active)",tone:"info",testId:"legend-active"}),i.jsx(Ju,{label:"done (complete)",tone:"success",testId:"legend-complete"}),i.jsx(Ju,{label:"done (warning)",tone:"warning",testId:"legend-warning"}),i.jsx(Ju,{label:"done (blocked)",tone:"danger",testId:"legend-blocked"}),i.jsx(Ju,{label:"not done",notDone:!0,testId:"legend-not-done"})]})}function Ju({label:e,tone:t,notDone:n,testId:s}){const r=n?"border-outline-variant bg-white/35":nB(t);return i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{"aria-hidden":"true","data-testid":`mission-progress-heatmap-${s}`,className:`inline-block h-3 w-3 border ${r}`}),i.jsx("span",{children:e})]})}const sB=[{id:"overview",label:"Overview"},{id:"story",label:"Story"},{id:"progress",label:"Progress"},{id:"artifacts",label:"Artifacts"},{id:"tests",label:"Tests"},{id:"queue",label:"Queue"},{id:"topology",label:"Topology"}],JS=[{id:"story",label:"Story"},{id:"overview",label:"Overview"},{id:"progress",label:"Progress"},{id:"artifacts",label:"Artifacts"},{id:"tests",label:"Tests"},{id:"queue",label:"Queue"},{id:"topology",label:"Topology"}];function b0e({tabs:e,active:t,onSelect:n}){return i.jsx("div",{role:"tablist","data-testid":"project-tab-nav",className:"flex gap-1 border-b border-outline-variant mb-6 overflow-x-auto",children:e.map(s=>i.jsx("button",{type:"button",role:"tab","aria-selected":t===s.id,"data-testid":`project-tab-${s.id}`,"data-active":t===s.id,onClick:()=>n(s.id),className:he("px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] border-b-2 -mb-px shrink-0",t===s.id?"border-stone-900 text-stone-900":"border-transparent text-on-surface-variant hover:text-stone-900"),children:s.label},s.id))})}function yd({eyebrow:e,title:t,tabs:n,active:s,onSelect:r,children:a}){return i.jsxs("div",{className:"mx-auto w-full max-w-[1200px] px-6 py-8",children:[i.jsxs("header",{className:"border-b border-outline-variant pb-4 mb-4",children:[i.jsx(it,{tone:"muted",children:e}),i.jsx("h1",{className:"font-headline text-headline-md font-bold tracking-tight uppercase text-stone-900 mt-1",children:t})]}),i.jsx(b0e,{tabs:n,active:s,onSelect:r}),i.jsx("div",{role:"tabpanel","data-testid":"project-tab-panel",children:a})]})}function W_({label:e,description:t}){return i.jsx(Ge,{label:e,description:t??"Phase 5 polish.",variant:"card",testId:`project-tab-placeholder-${e.toLowerCase()}`})}function w0e(e){return e<=0?"no recent activity":new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function j0e(e){return e.missionId??e.railItem??"unsorted"}function S0e(e,t){return t?e.filter(n=>j0e(n)===t):e}function rB(e,t){const n=Zm("all"),s=C.useMemo(()=>!n.data||"unavailable"in n.data?[]:S0e(n.data.slices,e),[n.data,e]),r=hD(t?s.map(u=>u.name):[]),a=C.useMemo(()=>{const u=new Set;for(const d of r.itemsByName.values())Array.isArray(d.qitemIds)&&d.qitemIds.forEach(f=>u.add(f));return Array.from(u).sort()},[r.itemsByName]),l=U2(t?a:[]);return{list:n,rows:s,details:r,qitemIds:a,queueItems:l}}function iB({rows:e,detailsByName:t,isLoading:n}){return n&&e.length===0?i.jsx(W_,{label:"LOADING PROGRESS",description:"Reading scoped slice progress."}):e.length===0?i.jsx(Ge,{label:"NO SCOPED SLICES",description:"No slices are indexed for this scope.",variant:"card",testId:"scope-progress-empty"}):i.jsx("div",{"data-testid":"scope-progress-rollup",className:"space-y-3",children:e.map(s=>{const r=t.get(s.name);return i.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsx("div",{className:"flex items-start justify-between gap-3 border-b border-outline-variant pb-2",children:i.jsxs("div",{className:"min-w-0",children:[i.jsx(Ve,{to:"/project/slice/$sliceId",params:{sliceId:s.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:s.displayName}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[i.jsx(Hn,{token:Z2(),compact:!0}),i.jsx(Hn,{token:{label:s.status,tone:ng(s.status)},compact:!0}),i.jsx(Ec,{value:s.lastActivityAt})]})]})}),i.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-4",children:[i.jsx(js,{label:"Qitems",value:(r==null?void 0:r.qitemIds.length)??s.qitemCount}),i.jsx(js,{label:"Proof",value:r?r.tests.proofPackets.length:s.hasProofPacket?1:0}),i.jsx(js,{label:"Progress",value:r?`${r.acceptance.percentage}%`:"unknown"}),i.jsx(js,{label:"Last activity",value:hB(s.lastActivityAt)})]})]},s.name)})})}function aB({qitemIds:e,queueItemsById:t,isFetching:n}){const s=[...e].sort((r,a)=>{const l=t.get(r),u=t.get(a),d=(l==null?void 0:l.tsCreated)??r,f=(u==null?void 0:u.tsCreated)??a;return d===f?0:d<f?1:-1});return s.length===0?i.jsx(Ge,{label:"NO QITEMS",description:"No queue items are indexed for this scope.",variant:"card",testId:"scope-queue-empty"}):i.jsxs("div",{"data-testid":"scope-queue-rollup",children:[n?i.jsx("div",{className:"mb-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-400",children:"Loading queue bodies..."}):null,i.jsx("ul",{className:"divide-y divide-outline-variant border border-outline-variant",children:s.map(r=>{const a=t.get(r);return i.jsx("li",{className:"bg-white/35 backdrop-blur-sm",children:i.jsxs(ax,{data:dB(r,a),testId:`scope-queue-trigger-${r}`,className:"block w-full px-3 py-2 text-left font-mono text-xs transition-colors hover:bg-white/55",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[a!=null&&a.state?i.jsx(tk,{state:a.state,compact:!0}):i.jsx(ek,{kind:"queue.item",compact:!0}),i.jsx(Ec,{value:a==null?void 0:a.tsCreated})]}),i.jsx("span",{className:"mt-2 block whitespace-pre-wrap break-words text-stone-900",children:fB(r,a)}),a?i.jsxs("span",{className:"mt-2 block space-y-2",children:[i.jsx(sg,{source:a.sourceSession,destination:a.destinationSession,muted:!0}),i.jsx("span",{className:"flex flex-wrap gap-1.5",children:(a.tags??[]).slice(0,5).map(l=>i.jsx(pa,{tag:l},l))})]}):null]})},r)})})]})}function oB({rows:e,detailsByName:t}){return e.length===0?i.jsx(Ge,{label:"NO ARTIFACTS",description:"No slices are indexed for this scope.",variant:"card",testId:"scope-artifacts-empty"}):i.jsx("div",{"data-testid":"scope-artifacts-rollup",className:"space-y-3",children:e.map(n=>{const s=t.get(n.name),r=(s==null?void 0:s.tests.proofPackets.length)??(n.hasProofPacket?1:0),a=(s==null?void 0:s.tests.proofPackets.reduce((l,u)=>l+u.screenshots.length,0))??0;return i.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsx(Ve,{to:"/project/slice/$sliceId",params:{sliceId:n.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:n.displayName}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[i.jsx(Hn,{token:Z2(),compact:!0}),i.jsx(Hn,{token:{label:n.status,tone:ng(n.status)},compact:!0})]}),i.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-4",children:[i.jsx(js,{label:"Files",value:(s==null?void 0:s.docs.tree.length)??"unknown"}),i.jsx(js,{label:"Commits",value:(s==null?void 0:s.commitRefs.length)??"unknown"}),i.jsx(js,{label:"Proof packets",value:r}),i.jsx(js,{label:"Screenshots",value:a})]})]},n.name)})})}function lB({rows:e,detailsByName:t,queueItemsById:n,isFetching:s}){const r=C.useMemo(()=>new Map(e.map(l=>[l.name,l])),[e]),a=C.useMemo(()=>Array.from(t.values()).flatMap(l=>{const u=r.get(l.name),d=(u==null?void 0:u.displayName)??l.displayName??l.name;return cB(l).map(f=>({...f,detail:{...f.detail??{},sliceLabel:d,sliceName:l.name}}))}),[t,r]);return s&&a.length===0?i.jsx(W_,{label:"LOADING STORY",description:"Reading scoped story events."}):a.length===0?i.jsx(Ge,{label:"NO STORY EVENTS",description:"No story events are indexed for this scope.",variant:"card",testId:"scope-story-empty"}):i.jsx("div",{"data-testid":"scope-story-rollup",children:i.jsx(eB,{events:a,phaseDefinitions:null,queueItemsById:n})})}function cB(e){const t=new Set(e.qitemIds);return e.story.events.filter(n=>!n.qitemId||t.has(n.qitemId))}function uB({rows:e,detailsByName:t,isFetching:n}){const[s,r]=C.useState(null),l=e.map(u=>({row:u,detail:t.get(u.name)})).filter(({detail:u})=>u&&u.tests.proofPackets.length>0);return n&&t.size===0?i.jsx(W_,{label:"LOADING TESTS",description:"Reading scoped proof packets."}):l.length===0?i.jsx(Ge,{label:"NO PROOF PACKETS",description:"No proof evidence is indexed for this scope.",variant:"card",testId:"scope-tests-empty"}):i.jsxs("div",{"data-testid":"scope-tests-rollup",className:"space-y-3",children:[l.map(({row:u,detail:d})=>{if(!d)return null;const f=d.tests.proofPackets.reduce((p,m)=>p+m.screenshots.length,0);return i.jsxs("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-outline-variant pb-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx(Ve,{to:"/project/slice/$sliceId",params:{sliceId:u.name},className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 hover:underline",children:u.displayName}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[i.jsx(Hn,{token:Z2(),compact:!0}),i.jsx(Hn,{token:{label:`${d.tests.proofPackets.length} packets`,tone:"info"},compact:!0}),i.jsx(Hn,{token:{label:`${f} screenshots`,tone:"success"},compact:!0})]})]}),i.jsx(Ec,{value:u.lastActivityAt})]}),i.jsx("div",{className:"mt-3 space-y-3",children:d.tests.proofPackets.map(p=>{var m;return i.jsxs("div",{className:"border border-outline-variant bg-white/30 p-2 backdrop-blur-sm",children:[i.jsx(rg,{title:p.dirName,badge:p.passFailBadge}),(m=p.primaryMarkdown)!=null&&m.content?i.jsx("p",{className:"mt-2 line-clamp-3 font-body text-[11px] leading-relaxed text-stone-700",children:p.primaryMarkdown.content}):null,p.screenshots.length>0?i.jsx("div",{className:"mt-2",children:i.jsx(ND,{sliceName:d.name,screenshots:p.screenshots,onSelect:x=>r({sliceName:d.name,relPath:x}),testIdPrefix:`scope-proof-screenshot-${d.name}`})}):null]},p.dirName)})})]},u.name)}),i.jsx(P_,{sliceName:(s==null?void 0:s.sliceName)??"",relPath:(s==null?void 0:s.relPath)??null,onClose:()=>r(null)})]})}function N0e(e){const t=new Map;for(const s of e.values())if(!(!s.topology||!Array.isArray(s.topology.affectedRigs)))for(const r of s.topology.affectedRigs){const a=r.rigName||r.rigId;t.has(a)||t.set(a,{rigId:r.rigId,rigName:r.rigName,sessionNames:new Set});const l=t.get(a);r.sessionNames.forEach(u=>l.sessionNames.add(u))}const n=Array.from(t.values()).map(s=>({rigId:s.rigId,rigName:s.rigName,sessionNames:Array.from(s.sessionNames).sort()}));return{affectedRigs:n,totalSeats:n.reduce((s,r)=>s+r.sessionNames.length,0),specGraph:null}}function k0e({detailsByName:e}){return i.jsx("div",{"data-testid":"scope-topology-rollup",children:i.jsx(K_,{topology:N0e(e)})})}function _0e(){const{data:e,isLoading:t}=Zm("all"),n=C.useMemo(()=>{if(!e||"unavailable"in e)return[];const a=new Map;for(const l of e.slices){const u=kD(l),d=u.missionId??u.railItem??"unsorted";a.has(d)||a.set(d,[]),a.get(d).push(u)}return Array.from(a.entries()).map(([l,u])=>({id:l,label:l==="unsorted"?"Unsorted":l,status:Xp(u),slices:u}))},[e]),s=C.useMemo(()=>_D(n),[n]);if(t)return i.jsx(Ge,{label:"LOADING WORKSPACE",description:"Reading slice index.",variant:"card",testId:"workspace-overview-loading"});if(e&&"unavailable"in e)return i.jsx(Ge,{label:"WORKSPACE INDEX UNAVAILABLE",description:e.hint??"Slice index is not available from the configured workspace.",variant:"card",testId:"workspace-overview-unavailable"});const r=(a,l)=>i.jsxs("article",{"data-testid":`workspace-overview-mission-${a.id}`,"data-mission-bucket":l,className:"border border-outline-variant bg-white/20 px-3 py-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-outline-variant pb-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"font-mono text-[12px] uppercase tracking-[0.12em] text-stone-900 truncate",children:a.label}),i.jsxs("p",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:[a.slices.length," slice",a.slices.length===1?"":"s"," ·"," ",w0e(AN(a))]})]}),i.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.12em] text-stone-500",children:a.status})]}),i.jsx("ul",{className:"mt-2 space-y-1",children:a.slices.map(u=>{const d=rk(u);return i.jsx("li",{children:i.jsxs(Ve,{to:"/project/slice/$sliceId",params:{sliceId:u.name},"data-testid":`workspace-overview-slice-${u.name}`,title:`${u.displayName} — ${d}`,"aria-label":`${u.displayName} (${d})`,className:"flex items-start gap-2 px-2 py-1 font-mono text-[11px] text-on-surface hover:bg-surface-low hover:text-stone-900",children:[i.jsx("span",{className:"min-w-0 flex-1 whitespace-normal break-words leading-snug",children:u.displayName}),i.jsxs("span",{"data-testid":`workspace-overview-slice-${u.name}-meta`,className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(nk,{count:u.qitemCount,testId:`workspace-overview-slice-${u.name}-qitems`}),i.jsx(sk,{tone:nf(u.status),label:u.status,testId:`workspace-overview-slice-${u.name}-status`})]})]})},u.name)})})]},a.id);return i.jsxs("div",{"data-testid":"workspace-overview-panel",className:"grid gap-4 lg:grid-cols-2",children:[i.jsxs("section",{"data-testid":"workspace-overview-current",className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-outline-variant pb-2",children:[i.jsx("h2",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Current Work"}),i.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:s.current.length})]}),s.current.length>0?s.current.map(a=>r(a,"current")):i.jsx(Ge,{label:"NO CURRENT WORK",description:"No live qitem-backed or recent active slices are indexed.",variant:"card",testId:"workspace-overview-current-empty"})]}),i.jsxs("section",{"data-testid":"workspace-overview-archive",className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-outline-variant pb-2",children:[i.jsx("h2",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-stone-900",children:"Archive"}),i.jsx("span",{className:"font-mono text-[10px] text-stone-500",children:s.archive.length})]}),s.archive.length>0?s.archive.map(a=>r(a,"archive")):i.jsx(Ge,{label:"NO ARCHIVE",description:"No archived slices are indexed.",variant:"card",testId:"workspace-overview-archive-empty"})]})]})}function C0e(){const[e,t]=C.useState("overview"),n=G2(),s=rB(null,e!=="overview");return!n.isLoading&&n.name===null?i.jsx("div",{className:"mx-auto w-full max-w-[960px] px-6 py-12",children:i.jsx(Ge,{label:"NO WORKSPACE CONNECTED",description:"Configure a workspace root to browse missions and slices in this destination.",variant:"card",testId:"workspace-scope-no-workspace",action:{label:"Open settings",href:"/settings"}})}):i.jsxs(yd,{eyebrow:"Workspace",title:n.name??"loading…",tabs:sB,active:e,onSelect:r=>t(r),children:[e==="overview"?i.jsx(_0e,{}):null,e==="story"?i.jsx(lB,{rows:s.rows,detailsByName:s.details.itemsByName,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,e==="progress"?i.jsx(iB,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching}):null,e==="artifacts"?i.jsx(oB,{rows:s.rows,detailsByName:s.details.itemsByName}):null,e==="tests"?i.jsx(uB,{rows:s.rows,detailsByName:s.details.itemsByName,isFetching:s.details.isFetching}):null,e==="queue"?i.jsx(aB,{qitemIds:s.qitemIds,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,e==="topology"?i.jsx("div",{"data-testid":"workspace-topology-hostmultirig",className:"flex-1 min-h-0 relative h-[60vh]",children:i.jsx(Jz,{})}):null]})}function E0e(){const{missionId:e}=dn({from:"/project/mission/$missionId"}),[t,n]=C.useState("overview"),s=rB(e,t!=="overview"),r=Qxe(e),a=r.data&&"missionPath"in r.data?r.data.missionPath:null,l=Fm(a,"README.md"),u=Fm(a,"PROGRESS.md");return i.jsxs(yd,{eyebrow:"Mission",title:e,tabs:sB,active:t,onSelect:d=>n(d),children:[t==="overview"?i.jsxs("div",{"data-testid":"mission-overview-panel",className:"space-y-6",children:[l.content&&i.jsx("section",{"data-testid":"mission-overview-readme",className:"border border-outline-variant bg-white/20 p-4",children:i.jsx(Jr,{content:l.content,hideFrontmatter:!0,hideRawToggle:!0})}),i.jsx("div",{className:"space-y-3",children:s.rows.length>0?s.rows.map(d=>{const f=rk(d);return i.jsx("article",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Ve,{to:"/project/slice/$sliceId",params:{sliceId:d.name},"data-testid":`mission-overview-slice-${d.name}`,title:`${d.displayName} — ${f}`,"aria-label":`${d.displayName} (${f})`,className:"min-w-0 flex-1 whitespace-normal break-words font-mono text-[12px] uppercase leading-snug tracking-[0.12em] text-stone-900 hover:underline",children:d.displayName}),i.jsxs("span",{"data-testid":`mission-overview-slice-${d.name}-meta`,className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(nk,{count:d.qitemCount,testId:`mission-overview-slice-${d.name}-qitems`}),i.jsx(sk,{tone:nf(d.status),label:d.status,testId:`mission-overview-slice-${d.name}-status`})]})]})},d.name)}):i.jsx(Ge,{label:"NO SLICES",description:"No indexed slices are attached to this mission.",variant:"card",testId:"mission-overview-empty"})})]}):null,t==="story"?i.jsx(lB,{rows:s.rows,detailsByName:s.details.itemsByName,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,t==="progress"?i.jsxs("div",{"data-testid":"mission-progress-panel",className:"space-y-6",children:[i.jsx(g0e,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching}),u.content&&i.jsx("section",{"data-testid":"mission-progress-readme",className:"border border-outline-variant bg-white/20 p-4",children:i.jsx(Jr,{content:u.content,hideFrontmatter:!0,hideRawToggle:!0})}),i.jsx(iB,{rows:s.rows,detailsByName:s.details.itemsByName,isLoading:s.list.isLoading||s.details.isFetching})]}):null,t==="artifacts"?i.jsx(oB,{rows:s.rows,detailsByName:s.details.itemsByName}):null,t==="tests"?i.jsx(uB,{rows:s.rows,detailsByName:s.details.itemsByName,isFetching:s.details.isFetching}):null,t==="queue"?i.jsx(aB,{qitemIds:s.qitemIds,queueItemsById:s.queueItems.itemsById,isFetching:s.details.isFetching||s.queueItems.isFetching}):null,t==="topology"?(()=>{const d=r.data&&"topology"in r.data?r.data.topology:null;return d!=null&&d.specGraph?i.jsx(K_,{topology:{affectedRigs:[],totalSeats:0,specGraph:d.specGraph}}):i.jsx(k0e,{detailsByName:s.details.itemsByName})})():null]})}function dB(e,t){return{qitemId:e,source:t==null?void 0:t.sourceSession,destination:t==null?void 0:t.destinationSession,state:t==null?void 0:t.state,tags:(t==null?void 0:t.tags)??void 0,createdAt:t==null?void 0:t.tsCreated,body:t==null?void 0:t.body}}function fB(e,t){if(!(t!=null&&t.body))return e;const n=t.body.split(`
550
+ `);return n.length<=8?t.body:`${n.slice(0,8).join(`
551
+ `)}
552
+ ... ${n.length-8} more lines`}function R0e({qitemIds:e,queueItemsById:t,queueItemsFetching:n}){return e.length===0?i.jsx(Ge,{label:"NO QITEMS",description:"No queue items associated with this slice.",variant:"card",testId:"slice-queue-empty"}):i.jsxs("div",{children:[n?i.jsx("div",{"data-testid":"slice-queue-fetching",className:"mb-2 font-mono text-[10px] uppercase tracking-[0.12em] text-stone-400",children:"Loading queue bodies..."}):null,i.jsx("ul",{"data-testid":"slice-queue-list",className:"divide-y divide-outline-variant border border-outline-variant",children:e.map(s=>{const r=t.get(s);return i.jsx("li",{className:"bg-white/35 backdrop-blur-sm",children:i.jsxs(ax,{data:dB(s,r),testId:`slice-queue-trigger-${s}`,className:"block w-full px-3 py-2 text-left hover:bg-white/55 transition-colors font-mono text-xs",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[r!=null&&r.state?i.jsx(tk,{state:r.state,compact:!0}):i.jsx(ek,{kind:"queue.item",compact:!0}),i.jsx(Ec,{value:r==null?void 0:r.tsCreated})]}),i.jsx("span",{className:"mt-2 block whitespace-pre-wrap break-words text-stone-900",children:fB(s,r)}),r?i.jsxs("span",{"data-testid":`slice-queue-meta-${s}`,className:"mt-2 block space-y-2 text-[10px] text-stone-500",children:[i.jsx(sg,{source:r.sourceSession,destination:r.destinationSession,muted:!0}),i.jsxs("span",{className:"flex flex-wrap gap-1.5",children:[i.jsx(pa,{tag:s}),(r.tags??[]).slice(0,5).map(a=>i.jsx(pa,{tag:a},a))]})]}):null]})},s)})})]})}function hB(e){return J2(e)}function js({label:e,value:t}){return i.jsxs("div",{className:"border border-outline-variant bg-white/35 p-3 backdrop-blur-sm",children:[i.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.14em] text-on-surface-variant",children:e}),i.jsx("div",{className:"mt-1 font-mono text-sm font-bold text-stone-900",children:t})]})}function A0e({detail:e}){const t=e.docs.tree,n=e.tests.proofPackets;return i.jsxs("div",{"data-testid":"slice-artifacts-tab",className:"space-y-6",children:[i.jsxs("section",{"data-testid":"slice-artifacts-files",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Files"}),t.length>0?i.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:t.map(s=>{const r=s.type==="file",a=`${e.slicePath}/${s.relPath}`;return i.jsxs("li",{className:"grid grid-cols-[1fr_auto_auto] gap-3 px-3 py-2 font-mono text-[10px]",children:[r?i.jsxs(Wxe,{path:s.relPath,absolutePath:a,className:"inline-flex min-w-0 items-center gap-1.5 text-stone-900 hover:underline text-left",testId:`slice-artifacts-file-${s.relPath}`,children:[i.jsx($e,{tool:s.relPath,size:"xs"}),i.jsx("span",{className:"truncate",children:s.relPath})]}):i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-stone-500",children:[i.jsx($e,{tool:"folder",size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:s.relPath})]}),i.jsx("span",{className:"uppercase tracking-[0.10em] text-stone-500",children:s.type}),i.jsx("span",{className:"text-stone-400",children:s.size==null?"-":`${s.size}b`})]},s.relPath)})}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No slice files indexed."})]}),i.jsxs("section",{"data-testid":"slice-artifacts-commits",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Commits"}),e.commitRefs.length>0?i.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:e.commitRefs.map(s=>i.jsx("li",{className:"px-3 py-2 font-mono text-[10px] text-stone-900",children:i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[i.jsx($e,{tool:"commit",size:"xs",decorative:!0}),i.jsx("span",{className:"truncate",children:s})]})},s))}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No commit refs indexed for this slice."})]}),i.jsxs("section",{"data-testid":"slice-artifacts-proof",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Proof Packets"}),n.length>0?i.jsx("ul",{className:"mt-3 divide-y divide-outline-variant border border-outline-variant bg-white/30",children:n.map(s=>i.jsxs("li",{className:"px-3 py-2 font-mono text-[10px] text-stone-700",children:[i.jsx(rg,{title:s.dirName,badge:s.passFailBadge}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-stone-500",children:[i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx($e,{tool:"screenshot",size:"xs",decorative:!0}),s.screenshots.length," screenshots"]}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx($e,{tool:"video",size:"xs",decorative:!0}),s.videos.length," videos"]}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx($e,{tool:"trace",size:"xs",decorative:!0}),s.traces.length," traces"]})]})]},s.dirName))}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No proof packets indexed."})]}),i.jsxs("section",{"data-testid":"slice-artifacts-docs",children:[i.jsx(it,{tone:"muted",children:"Docs Browser"}),i.jsx("div",{className:"mt-2 border border-outline-variant",children:i.jsx(s0e,{sliceName:e.name,tree:t})})]}),i.jsxs("section",{"data-testid":"slice-artifacts-decisions",children:[i.jsx(it,{tone:"muted",children:"Decisions"}),i.jsx("div",{className:"mt-2 border border-outline-variant",children:i.jsx(r0e,{rows:e.decisions.rows})})]})]})}function T0e({detail:e}){const t=e.acceptance.currentStep,n=Fm(e.slicePath??null,"README.md");return i.jsxs("div",{"data-testid":"slice-overview-tab",className:"space-y-6",children:[i.jsxs("section",{"data-testid":"slice-overview-summary",className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(js,{label:"Status",value:e.status}),i.jsx(js,{label:"Progress",value:`${e.acceptance.percentage}%`}),i.jsx(js,{label:"Qitems",value:e.qitemIds.length}),i.jsx(js,{label:"Last Activity",value:hB(e.lastActivityAt)})]}),n.content&&i.jsx("section",{"data-testid":"slice-overview-readme",className:"border border-outline-variant bg-white/20 p-4",children:i.jsx(Jr,{content:n.content,hideFrontmatter:!0,hideRawToggle:!0})}),i.jsxs("section",{"data-testid":"slice-overview-current-step",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Current Step"}),t?i.jsxs("div",{className:"mt-3 grid gap-2 font-mono text-[10px] text-stone-700 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Step"}),i.jsx("div",{className:"font-bold text-stone-900",children:t.stepId})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Role"}),i.jsx("div",{className:"font-bold text-stone-900",children:t.role})]}),i.jsxs("div",{className:"sm:col-span-2",children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Objective"}),i.jsx("div",{children:t.objective??"No objective declared."})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Allowed exits"}),i.jsx("div",{children:t.allowedExits.join(", ")||"-"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[8px] uppercase tracking-[0.14em] text-stone-400",children:"Hop count"}),i.jsx("div",{children:t.hopCount})]})]}):i.jsx("div",{className:"mt-3 font-mono text-[10px] text-stone-400",children:"No workflow step is currently bound."})]}),i.jsxs("section",{"data-testid":"slice-overview-readiness",className:"border border-outline-variant bg-white/20 p-4",children:[i.jsx(it,{tone:"muted",children:"Readiness"}),i.jsxs("div",{className:"mt-3 space-y-2 font-mono text-[10px] text-stone-700",children:[i.jsxs("div",{children:[e.acceptance.doneItems," of ",e.acceptance.totalItems," acceptance items complete."]}),i.jsxs("div",{children:[e.tests.aggregate.passCount," proof packets passing / ",e.tests.aggregate.failCount," failing."]}),e.acceptance.closureCallout&&i.jsx("div",{className:"border border-amber-300 bg-amber-50 px-2 py-1 text-amber-800",children:e.acceptance.closureCallout}),e.workflowBinding&&i.jsxs("div",{className:"text-stone-500",children:["Workflow: ",e.workflowBinding.workflowName," v",e.workflowBinding.workflowVersion]})]})]})]})}function I0e(){var d,f;const{sliceId:e}=dn({from:"/project/slice/$sliceId"}),[t,n]=C.useState("overview"),s=EK(e),r=U2(((d=s.data)==null?void 0:d.qitemIds)??[]),a=C.useMemo(()=>r.itemsById,[r.itemsById]),l=Kxe(((f=s.data)==null?void 0:f.slicePath)??null);if(s.isLoading)return i.jsx(yd,{eyebrow:"Slice",title:e,tabs:JS,active:t,onSelect:p=>n(p),children:i.jsx(Ge,{label:"LOADING",description:`Fetching /api/slices/${e}…`,variant:"card",testId:"slice-scope-loading"})});if(s.isError||!s.data)return i.jsx(yd,{eyebrow:"Slice",title:e,tabs:JS,active:t,onSelect:p=>n(p),children:i.jsx(Ge,{label:"SLICE NOT AVAILABLE",description:s.error instanceof Error?s.error.message:`Could not load slice "${e}". The slices indexer may not be configured (rig config get workspace.slices_root).`,variant:"card",testId:"slice-scope-error"})});const u=s.data;return i.jsxs(yd,{eyebrow:"Slice",title:u.displayName||u.name,tabs:JS,active:t,onSelect:p=>n(p),children:[t==="story"?i.jsx(eB,{events:cB(u),phaseDefinitions:u.story.phaseDefinitions,queueItemsById:a,timelineMarkdown:l.content??void 0}):null,t==="overview"?i.jsx(T0e,{detail:u}):null,t==="progress"?i.jsx(Zxe,{acceptance:u.acceptance}):null,t==="artifacts"?i.jsx(A0e,{detail:u}):null,t==="tests"?i.jsx(o0e,{sliceName:u.name,tests:u.tests,qitemCount:u.qitemIds.length,docsCount:u.docs.tree.length,lastActivityAt:u.lastActivityAt}):null,t==="queue"?i.jsx(R0e,{qitemIds:u.qitemIds,queueItemsById:a,queueItemsFetching:r.isFetching}):null,t==="topology"?i.jsx(K_,{topology:u.topology}):null]})}const M0e={neutral:"border-stone-300 bg-white/65 text-stone-700",info:"border-sky-300 bg-sky-50/70 text-sky-800",success:"border-emerald-300 bg-emerald-50/70 text-emerald-800",warning:"border-amber-300 bg-amber-50/80 text-amber-800",danger:"border-rose-300 bg-rose-50/75 text-rose-800"},fa=[{label:"Queue created",tone:"info",icon:B$},{label:"Handoff",tone:"neutral",icon:Qm},{label:"Claimed",tone:"warning",icon:Cd},{label:"Completed",tone:"success",icon:_d},{label:"Human action",tone:"danger",icon:ha},{label:"Shipped",tone:"success",icon:$2}],pB=[{label:"idea-ledger",tone:"neutral"},{label:"cycle-4",tone:"info"},{label:"proof",tone:"success"},{label:"urgent",tone:"danger"},{label:"human-review",tone:"warning"}];function rr({token:e,compact:t=!1}){const n=e.icon;return i.jsxs("span",{className:he("inline-flex items-center gap-1 border font-mono uppercase tracking-[0.10em]",t?"px-1.5 py-0.5 text-[8px]":"px-2 py-1 text-[9px]",M0e[e.tone]),children:[n?i.jsx(n,{className:t?"h-2.5 w-2.5":"h-3 w-3",strokeWidth:1.6}):null,e.label]})}function bo({kind:e,label:t,muted:n}){const s=e==="human"?EG:_V;return i.jsxs("span",{className:he("inline-flex min-w-0 items-center gap-1 border px-1.5 py-0.5 font-mono text-[9px]",n?"border-stone-200 bg-white/45 text-stone-600":"border-stone-300 bg-white/45 text-stone-800"),children:[i.jsx(s,{className:"h-3 w-3 shrink-0",strokeWidth:1.5}),i.jsx("span",{className:"truncate",children:t})]})}function mB({label:e}){return i.jsxs("span",{className:"inline-flex items-center gap-1 border border-stone-200 bg-white/55 px-1.5 py-0.5 font-mono text-[9px] text-stone-600",children:[i.jsx(O2,{className:"h-3 w-3",strokeWidth:1.5}),e]})}function O0e(){return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx(bo,{kind:"agent",label:"orch.lead@openrig-velocity"}),i.jsx(ym,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(bo,{kind:"agent",label:"driver@openrig-velocity"}),i.jsx(ym,{className:"h-3.5 w-3.5 text-stone-400",strokeWidth:1.4}),i.jsx(bo,{kind:"human",label:"human@host"})]})}function L0e(){return i.jsx("div",{className:"grid grid-cols-3 gap-2",children:["for-you-human-and-shipped.png","project-overview-missions.png","project-triage-slice.png"].map(e=>i.jsxs("div",{className:"border border-stone-200 bg-stone-100/80",children:[i.jsx("div",{className:"flex aspect-[4/3] items-center justify-center bg-white/65 text-stone-400",children:i.jsx(HV,{className:"h-7 w-7",strokeWidth:1.2})}),i.jsx("div",{className:"truncate border-t border-stone-200 px-1 py-0.5 font-mono text-[8px] text-stone-600",children:e})]},e))})}function eN({label:e,description:t,children:n}){return i.jsx(Sm,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:i.jsx("span",{className:"uppercase tracking-[0.16em]",children:e}),children:i.jsxs("div",{className:"space-y-4 p-4",children:[i.jsx("p",{className:"font-mono text-[10px] leading-relaxed text-stone-700",children:t}),n]})})}function qP({dense:e=!1}){return i.jsxs("article",{className:he("border border-outline-variant bg-white/60 backdrop-blur-sm hard-shadow",e?"p-3":"p-4"),children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(rr,{token:{label:"Action required",tone:"danger",icon:ha},compact:e}),i.jsx("h3",{className:"font-mono text-sm text-stone-950",children:"Review demo-seed triage proof packet"})]}),i.jsx(mB,{label:"Today 4:18 PM"})]}),i.jsx("p",{className:"mt-3 whitespace-pre-line font-mono text-[11px] leading-relaxed text-stone-700",children:"Review the proof packet screenshots, confirm the shipped slice is ready, then approve or route back with notes."}),i.jsx("div",{className:"mt-3",children:i.jsx(O0e,{})}),i.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:pB.slice(0,4).map(t=>i.jsx(rr,{token:t,compact:!0},t.label))})]})}function P0e(){return i.jsxs("article",{className:"relative border border-outline-variant bg-white/60 p-4 hard-shadow backdrop-blur-sm",children:[i.jsx("div",{className:"absolute left-5 top-12 bottom-5 w-px bg-stone-300"}),i.jsx("div",{className:"relative space-y-5 pl-8",children:[{token:fa[5],title:"Slice shipped with proof packet",body:"The triage slice closed with screenshots, queue context, and verification notes attached."},{token:fa[3],title:"Implementation completed",body:"Driver finished the UI pass and handed verification to guard and QA."},{token:fa[1],title:"Work routed for review",body:"The queue item moved from driver to guard with targeted checks."}].map(e=>{const t=e.token.icon??Yl;return i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute -left-[38px] top-0 flex h-5 w-5 items-center justify-center border border-stone-300 bg-white text-stone-700",children:i.jsx(t,{className:"h-3 w-3",strokeWidth:1.5})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(rr,{token:e.token,compact:!0}),i.jsx(mB,{label:"12 min ago"})]}),i.jsx("h4",{className:"mt-2 font-mono text-[12px] text-stone-950",children:e.title}),i.jsx("p",{className:"mt-1 font-mono text-[10px] leading-relaxed text-stone-700",children:e.body})]},e.title)})})]})}function $0e(){return i.jsx("div",{className:"divide-y divide-outline-variant border border-outline-variant bg-white/55 backdrop-blur-sm",children:[{token:fa[4],title:"Approval needed",body:"Review proof screenshots and approve release-readiness.",actor:"human@host"},{token:fa[2],title:"Claimed by QA",body:"VM verification is in progress with current worktree source.",actor:"velocity-qa"},{token:fa[1],title:"Route to guard",body:"Run narrow advisory on UI-only diff and source scans.",actor:"redo3-guard-3"}].map(e=>i.jsxs("div",{className:"grid gap-3 p-3 sm:grid-cols-[auto_1fr_auto]",children:[i.jsx(rr,{token:e.token,compact:!0}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-[12px] text-stone-950",children:e.title}),i.jsx("div",{className:"mt-1 font-mono text-[10px] leading-relaxed text-stone-700",children:e.body})]}),i.jsx(bo,{kind:e.actor.includes("human")?"human":"agent",label:e.actor,muted:!0})]},e.title))})}function D0e(){return i.jsx("div",{className:"paper-grid min-h-full p-8",children:i.jsxs("div",{className:"mx-auto max-w-7xl space-y-8",children:[i.jsxs("header",{className:"border border-outline-variant bg-white/60 p-4 font-mono backdrop-blur-sm hard-shadow",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-stone-600",children:"Project graphics package preview"}),i.jsx("h1",{className:"mt-2 text-xl uppercase tracking-[0.14em] text-stone-950",children:"Queue, story, and proof card language"}),i.jsx("p",{className:"mt-2 max-w-3xl text-[11px] leading-relaxed text-stone-700",children:"Hidden preview route for choosing metadata badges, action chips, flow arrows, and proof-card density before applying the system to For You, Story, Queue, and scope rollups."})]}),i.jsxs("section",{className:"grid gap-4 lg:grid-cols-3",children:[i.jsxs(eN,{label:"A / Compact Ledger",description:"Small pills and restrained icons. Best when density matters and queue cards need to scan like a work ledger.",children:[i.jsx(qP,{dense:!0}),i.jsx($0e,{})]}),i.jsxs(eN,{label:"B / Narrative Rail",description:"Story-first layout with event icons on a vertical rail. Best for showing how work moved from idea to proof.",children:[i.jsx(P0e,{}),i.jsx(L0e,{})]}),i.jsxs(eN,{label:"C / Action Board",description:"Bolder cards with explicit status, actors, and proof thumbnails. Best for For You and approval surfaces.",children:[i.jsx(qP,{}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:fa.map(e=>i.jsx(rr,{token:e},e.label))})]})]}),i.jsxs("section",{className:"grid gap-4 lg:grid-cols-[1.2fr_0.8fr]",children:[i.jsx(Sm,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:"EVENT BADGE VOCABULARY",children:i.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 lg:grid-cols-3",children:fa.map(e=>i.jsxs("div",{className:"border border-outline-variant bg-white/55 p-3",children:[i.jsx(rr,{token:e}),i.jsxs("div",{className:"mt-2 font-mono text-[10px] leading-relaxed text-stone-700",children:[e.label==="Queue created"?"A work item entered the system.":null,e.label==="Handoff"?"Ownership moved from one actor to another.":null,e.label==="Claimed"?"An actor is actively working the item.":null,e.label==="Completed"?"The assigned work item closed.":null,e.label==="Human action"?"A person needs to approve, deny, or route.":null,e.label==="Shipped"?"The slice closed with evidence attached.":null]})]},e.label))})}),i.jsx(Sm,{as:"section",className:"bg-white/65 backdrop-blur-sm",header:"SUPPORTING CHIPS",children:i.jsxs("div",{className:"space-y-4 p-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Tags"}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:pB.map(e=>i.jsx(rr,{token:e},e.label))})]}),i.jsxs("div",{children:[i.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Actors"}),i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.jsx(bo,{kind:"human",label:"human@host"}),i.jsx(bo,{kind:"agent",label:"driver@openrig-velocity"}),i.jsx(bo,{kind:"agent",label:"guard@openrig-velocity",muted:!0})]})]}),i.jsxs("div",{children:[i.jsx("div",{className:"mb-2 font-mono text-[9px] uppercase tracking-[0.14em] text-stone-600",children:"Scope"}),i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.jsx(rr,{token:{label:"Workspace",tone:"neutral",icon:V$}}),i.jsx(rr,{token:{label:"Mission",tone:"info",icon:YV}}),i.jsx(rr,{token:{label:"Slice",tone:"success",icon:Ym}})]})]})]})})]})]})})}function q0e(){return i.jsxs("div",{className:"mx-auto max-w-5xl space-y-10 px-6 py-10","data-testid":"card-previews-lab",children:[i.jsxs("header",{className:"space-y-2",children:[i.jsx("h1",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-stone-500",children:"/lab/card-previews"}),i.jsx("p",{className:"font-mono text-[11px] text-stone-700",children:"Visual gallery of for-you card kind variants. Each section renders the same card component the live feed uses, with sample data."})]}),i.jsx($l,{title:"Shipped",description:"A slice merged + summary view. Used when a slice closes successfully and the feed surfaces it to operators downstream."}),i.jsx(Nz,{source:{sliceId:"first-conveyor-run",title:"First Conveyor Run — shipped",oneLiner:"Slice merged at b71cddf. 4 commits + 1 proof packet.",sections:[{number:1,heading:"Lint parses + validates entries",summary:"12 tests pass; UTF-8 edge cases handled."},{number:2,heading:"Reviewer accepted with one concern",summary:"Combining-character edge addressed mid-flight."},{number:3,heading:"Proof packet captured",summary:"CLI output screenshot + diff render."}]}}),i.jsx($l,{title:"Incident / Action Required",description:"A timeline-shaped surface for an in-flight or recent incident. Use status='warning' or 'danger' to surface attention; 'info' for informational; 'muted' for resolved."}),i.jsx(kz,{source:{sliceId:"auth-bearer-tailscale-trust",title:"Auth bearer tailscale trust — concerning",oneLiner:"Reviewer flagged loopback-only default at fix-1; remediated at fix-2.",status:"warning",recentEntries:[{time:"13:42",title:"Reviewer BLOCKING-CONCERN raised",status:"danger"},{time:"14:01",title:"Driver forward-fix scoped",status:"info"},{time:"14:38",title:"Forward-fix landed; gates green",status:"success"}]}}),i.jsx($l,{title:"Progress",description:"A mission-level progress card with percent + active-slice context. Used during a mission lifecycle to keep operators informed without requiring them to open the mission page."}),i.jsx(_z,{source:{missionId:"release-0.3.1",title:"Release 0.3.1 — in flight",oneLiner:"Wave 3a + 3b dispatches; multiple slices in review.",percent:62,nextStep:"design-reviewer audit on slice 21 narrative voice",activeSlice:{id:"slice-21-onboarding-conveyor",label:"slice-21-onboarding-conveyor",status:"in-progress"}}}),i.jsx($l,{title:"Approval / Action Required",description:"An operator-decision-needed surface. Renders the qitem context + the two action paths (Approve / Deny) the operator picks between."}),i.jsx(Cz,{source:{qitemId:"qitem-20260511201234-abcdef01",title:"Auth bearer tailscale trust — approve merge?",oneLiner:"All gates green; merge requires operator sign-off.",bodyPreview:"Triple-guard CLEAR. velocity-qa VM walk PASS. Ready for merge to main.",drillInHref:"/project/slice/auth-bearer-tailscale-trust",onApprove:()=>{},onDeny:()=>{}}}),i.jsx($l,{title:"Concept / Observation",description:"A discovery / lab / scratch-pad surface. Used for not-yet-actionable observations, draft ideas, or comparison previews."}),i.jsx(Ez,{source:{sliceId:"concept-storytelling-primitives",title:"Storytelling primitives — concept",oneLiner:"Could replace one-off card components with kind-frame primitives.",comparePreview:[{label:"Card kinds",valueOld:"5 components",valueNew:"1 kind-frame + 5 sources"},{label:"Visual variance",valueOld:"drift over time",valueNew:"centralized accent tokens"},{label:"Maintenance",valueOld:"edit each component",valueNew:"edit kind-frame once"}]}}),i.jsx($l,{title:"Empty state",description:"What the for-you feed shows when no events qualify. Reusable across surfaces; the EmptyState primitive is the canonical pattern."}),i.jsx(Ge,{label:"ALL CAUGHT UP",description:"No new events. Spin up a rig or declare a slice to populate this feed.",variant:"card",testId:"card-previews-empty-state"})]})}function $l({title:e,description:t}){return i.jsxs("div",{className:"space-y-1 pt-4",children:[i.jsx("h2",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-stone-900",children:e}),i.jsx("p",{className:"font-mono text-[10px] text-stone-600 max-w-3xl",children:t})]})}function cx({backLayerOverride:e,vellumSheetOverride:t}={}){return i.jsxs("div",{"data-testid":"vellum-lab",className:"relative min-h-screen overflow-hidden",children:[e,t,i.jsx(mz,{}),i.jsx(gz,{}),i.jsx(xz,{})]})}function z0e(){return i.jsx(cx,{backLayerOverride:i.jsx(K0e,{}),vellumSheetOverride:i.jsx(V0e,{})})}function B0e(){return i.jsx(cx,{backLayerOverride:i.jsx(W0e,{}),vellumSheetOverride:i.jsx(G0e,{})})}function F0e(){return i.jsx(cx,{backLayerOverride:i.jsx(U0e,{}),vellumSheetOverride:i.jsx(H0e,{})})}function H0e(){return i.jsx("div",{"data-testid":"vellum-sheet-heavy-diffuse","aria-hidden":"true",className:"absolute inset-0 z-[5] bg-white/25 backdrop-blur-[8px] pointer-events-none"})}function U0e(){const r=Math.ceil(27.5)+2,a=(u,d,f=0)=>u/1280*Math.PI*2*d+f,l=[];for(let u=0;u<r;u++){const d=u*40-40;let f=`M 0 ${d.toFixed(2)}`;for(let p=0;p<=2560;p+=32){const m=Math.sin(a(p,2,u*.3))*36,x=Math.sin(a(p,5,u*.5))*9,y=Math.sin(a(p,3,u*.18))*14,v=m+x+y;f+=` L ${p} ${(d+v).toFixed(2)}`}l.push(f)}return i.jsx("div",{"data-testid":"back-layer-scrolling-topo","aria-hidden":"true",className:"absolute inset-0 z-0 overflow-hidden pointer-events-none select-none",children:i.jsx("svg",{className:"absolute top-0 left-0 h-full vellum-scroll-x",style:{width:"200%"},viewBox:"0 0 2560 1100",preserveAspectRatio:"xMidYMid slice",children:l.map((u,d)=>i.jsx("path",{d:u,stroke:"#1c1917",strokeWidth:"1.0",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},d))})})}function V0e(){return i.jsx("div",{"data-testid":"vellum-sheet-diffuse","aria-hidden":"true",className:"absolute top-[14px] bottom-[12px] left-[16px] right-[14px] z-[5] bg-white/35 backdrop-blur-[14px] pointer-events-none"})}function G0e(){return i.jsx("div",{"data-testid":"vellum-sheet-more-diffuse","aria-hidden":"true",className:"absolute top-[14px] bottom-[12px] left-[16px] right-[14px] z-[5] bg-white/45 backdrop-blur-[22px] pointer-events-none"})}function K0e(){const s=Math.ceil(27.5)+2,r=[];for(let a=0;a<s;a++){const l=a*40-40;let u=`M -50 ${l.toFixed(2)}`;for(let d=0;d<=1380;d+=40){const f=d/1280,p=Math.sin(f*Math.PI*2.2+a*.28)*36,m=Math.sin(f*Math.PI*5.8+a*.47)*9,x=Math.sin(f*Math.PI*3.6+a*.13+Math.sin(a*.5)*2)*16,y=p+m+x;u+=` L ${d.toFixed(0)} ${(l+y).toFixed(2)}`}r.push(u)}return i.jsx("div",{"data-testid":"back-layer-topo","aria-hidden":"true",className:"absolute inset-0 z-0 overflow-hidden pointer-events-none select-none",children:i.jsx("svg",{className:"w-full h-full",viewBox:"0 0 1280 1100",preserveAspectRatio:"xMidYMid slice",children:r.map((a,l)=>i.jsx("path",{d:a,stroke:"#1c1917",strokeWidth:"1.2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},l))})})}function W0e(){const e=[{type:"cube",size:220,pos:"top-[2%] -left-6"},{type:"spool",size:200,pos:"top-[4%] left-[24%]"},{type:"x-prism",size:220,pos:"top-[2%] left-[50%]"},{type:"cube-frame",size:240,pos:"top-[1%] -right-8"},{type:"arc-stripes",size:200,pos:"top-[28%] left-[4%]"},{type:"donut-dots",size:220,pos:"top-[26%] left-[28%]"},{type:"hex-prism",size:220,pos:"top-[26%] left-[54%]"},{type:"cylinder-stripes",size:200,pos:"top-[28%] right-[4%]"},{type:"wedge",size:230,pos:"top-[52%] -left-4"},{type:"stairs-iso",size:240,pos:"top-[50%] left-[24%]"},{type:"barrel",size:220,pos:"top-[52%] left-[50%]"},{type:"pacman",size:240,pos:"top-[50%] -right-6"},{type:"cube-stack",size:260,pos:"bottom-[-4%] left-[5%]"},{type:"L-prism",size:260,pos:"bottom-[-2%] left-[36%]"},{type:"cube-ports",size:260,pos:"bottom-[-4%] right-[4%]"}];return i.jsx("div",{"data-testid":"back-layer-isometric","aria-hidden":"true",className:"absolute inset-0 z-0 overflow-hidden pointer-events-none select-none",children:e.map((t,n)=>i.jsx(Y0e,{...t},n))})}function Y0e({type:e,size:t,pos:n}){return i.jsx("div",{className:`absolute ${n}`,style:{width:t,height:t},children:i.jsx(Q0e,{type:e})})}function Q0e({type:e}){const t={fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round"};switch(e){case"cube":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,8 52,20 52,44 30,56 8,44 8,20"}),i.jsx("line",{x1:"30",y1:"8",x2:"30",y2:"32"}),i.jsx("line",{x1:"30",y1:"32",x2:"8",y2:"20"}),i.jsx("line",{x1:"30",y1:"32",x2:"52",y2:"20"})]});case"cylinder-v":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"30",cy:"14",rx:"14",ry:"5"}),i.jsx("line",{x1:"16",y1:"14",x2:"16",y2:"46"}),i.jsx("line",{x1:"44",y1:"14",x2:"44",y2:"46"}),i.jsx("path",{d:"M 16 46 A 14 5 0 0 0 44 46"})]});case"triangle-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"14,46 30,12 46,46"}),i.jsx("polygon",{points:"46,46 30,12 38,8 54,42"}),i.jsx("line",{x1:"14",y1:"46",x2:"54",y2:"42"})]});case"rod":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("line",{x1:"12",y1:"48",x2:"48",y2:"12",strokeWidth:"1.5"}),i.jsx("circle",{cx:"12",cy:"48",r:"4"}),i.jsx("circle",{cx:"48",cy:"12",r:"4"})]});case"cube-frame":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,8 52,20 52,44 30,56 8,44 8,20"}),i.jsx("line",{x1:"30",y1:"8",x2:"30",y2:"32"}),i.jsx("line",{x1:"30",y1:"32",x2:"8",y2:"20"}),i.jsx("line",{x1:"30",y1:"32",x2:"52",y2:"20"}),i.jsx("rect",{x:"22",y:"28",width:"16",height:"16"})]});case"stairs":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("polyline",{points:"8,52 18,52 18,42 28,42 28,32 38,32 38,22 48,22 48,12 56,12"})});case"spool":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"36",cy:"30",rx:"14",ry:"6"}),i.jsx("path",{d:"M 22 30 L 8 30",strokeWidth:"1.5"}),i.jsx("line",{x1:"36",y1:"14",x2:"36",y2:"22"})]});case"arc-c":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("path",{d:"M 44 12 A 20 20 0 1 0 44 48",strokeWidth:"1.5"})});case"diamond-row":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"8,30 14,24 20,30 14,36"}),i.jsx("polygon",{points:"20,30 26,24 32,30 26,36"}),i.jsx("polygon",{points:"32,30 38,24 44,30 38,36"}),i.jsx("polygon",{points:"44,30 50,24 56,30 50,36"})]});case"plus":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("polygon",{points:"24,8 36,8 36,24 52,24 52,36 36,36 36,52 24,52 24,36 8,36 8,24 24,24"})});case"cylinder-h":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"14",cy:"30",rx:"5",ry:"14"}),i.jsx("line",{x1:"14",y1:"16",x2:"46",y2:"16"}),i.jsx("line",{x1:"14",y1:"44",x2:"46",y2:"44"}),i.jsx("path",{d:"M 46 16 A 5 14 0 0 1 46 44"})]});case"wave":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 8 16 Q 18 8 28 16 T 48 16",strokeWidth:"1.2"}),i.jsx("path",{d:"M 8 30 Q 18 22 28 30 T 48 30",strokeWidth:"1.2"}),i.jsx("path",{d:"M 8 44 Q 18 36 28 44 T 48 44",strokeWidth:"1.2"})]});case"x-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"14,8 24,8 30,18 36,8 46,8 36,22 46,36 36,36 30,26 24,36 14,36 24,22"}),i.jsx("line",{x1:"14",y1:"36",x2:"20",y2:"40"}),i.jsx("line",{x1:"46",y1:"36",x2:"52",y2:"40"})]});case"tri-stack":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"12,40 18,28 24,40"}),i.jsx("polygon",{points:"24,40 30,28 36,40"}),i.jsx("polygon",{points:"36,40 42,28 48,40"})]});case"L-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"8,28 28,18 48,28 28,38"}),i.jsx("polygon",{points:"28,38 48,28 48,44 28,54"}),i.jsx("polygon",{points:"8,28 8,44 28,54 28,38"})]});case"arc-stripes":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 12 50 A 22 22 0 0 1 48 14",strokeWidth:"1"}),i.jsx("path",{d:"M 16 50 A 18 18 0 0 1 48 18",strokeWidth:"1"}),i.jsx("path",{d:"M 20 50 A 14 14 0 0 1 48 22",strokeWidth:"1"}),i.jsx("path",{d:"M 24 50 A 10 10 0 0 1 48 26",strokeWidth:"1"})]});case"hex-prism":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,8 48,18 48,38 30,48 12,38 12,18"}),i.jsx("line",{x1:"30",y1:"8",x2:"30",y2:"48"}),i.jsx("line",{x1:"12",y1:"18",x2:"30",y2:"28"}),i.jsx("line",{x1:"48",y1:"18",x2:"30",y2:"28"})]});case"dot-circle":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:Array.from({length:16}).map((n,s)=>{const r=s/16*Math.PI*2,a=30+Math.cos(r)*22,l=30+Math.sin(r)*22;return i.jsx("circle",{cx:a,cy:l,r:"1.8"},s)})});case"wedge":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 30 30 L 30 8 A 22 22 0 0 1 52 30 Z",fill:"currentColor"}),i.jsx("path",{d:"M 30 30 L 8 30 A 22 22 0 0 1 30 8"}),i.jsx("line",{x1:"30",y1:"30",x2:"14",y2:"44"}),i.jsx("line",{x1:"30",y1:"30",x2:"22",y2:"50"}),i.jsx("line",{x1:"30",y1:"30",x2:"34",y2:"52"})]});case"down-arrows":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"20,8 40,8 30,22"}),i.jsx("polygon",{points:"20,22 40,22 30,36"}),i.jsx("polygon",{points:"20,36 40,36 30,50"})]});case"donut-dots":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("circle",{cx:"30",cy:"30",r:"22"}),i.jsx("circle",{cx:"30",cy:"30",r:"10"}),i.jsx("g",{fill:"currentColor",children:Array.from({length:24}).map((n,s)=>{const r=s/24*Math.PI*2+.08,a=16;return i.jsx("circle",{cx:30+Math.cos(r)*a,cy:30+Math.sin(r)*a,r:"0.9"},s)})})]});case"bowtie":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"8,18 22,30 8,42"}),i.jsx("polygon",{points:"52,18 38,30 52,42"}),i.jsx("circle",{cx:"30",cy:"30",r:"3"})]});case"dot-grid":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:Array.from({length:6}).map((n,s)=>Array.from({length:6}).map((r,a)=>i.jsx("circle",{cx:10+a*8,cy:10+s*8,r:"1.4"},`${s}-${a}`)))});case"arc-half":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("path",{d:"M 8 38 A 22 22 0 0 1 52 38",strokeWidth:"1.5"})});case"cylinder-stripes":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"30",cy:"14",rx:"14",ry:"5"}),i.jsx("line",{x1:"16",y1:"14",x2:"16",y2:"46"}),i.jsx("line",{x1:"44",y1:"14",x2:"44",y2:"46"}),i.jsx("path",{d:"M 16 46 A 14 5 0 0 0 44 46"}),i.jsx("line",{x1:"22",y1:"18",x2:"22",y2:"44",strokeDasharray:"2 2"}),i.jsx("line",{x1:"30",y1:"19",x2:"30",y2:"45",strokeDasharray:"2 2"}),i.jsx("line",{x1:"38",y1:"18",x2:"38",y2:"44",strokeDasharray:"2 2"})]});case"dot-cloud":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:[[22,18],[30,14],[38,18],[16,24],[24,24],[32,22],[40,24],[46,28],[18,32],[26,32],[34,32],[42,32],[22,38],[30,38],[38,38],[28,44],[36,44]].map(([n,s],r)=>i.jsx("circle",{cx:n,cy:s,r:"1.5"},r))});case"pacman":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 30 30 L 52 18 A 22 22 0 1 1 52 42 Z",fill:"currentColor"}),i.jsx("line",{x1:"20",y1:"20",x2:"14",y2:"14"}),i.jsx("line",{x1:"20",y1:"40",x2:"14",y2:"46"}),i.jsx("line",{x1:"12",y1:"30",x2:"6",y2:"30"})]});case"down-triangles":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"22,12 38,12 30,24"}),i.jsx("polygon",{points:"22,28 38,28 30,40"})]});case"cube-inset":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,4 50,16 50,36 30,48 10,36 10,16"}),i.jsx("line",{x1:"30",y1:"4",x2:"30",y2:"48"}),i.jsx("line",{x1:"10",y1:"16",x2:"30",y2:"28"}),i.jsx("line",{x1:"50",y1:"16",x2:"30",y2:"28"}),i.jsx("rect",{x:"22",y:"46",width:"16",height:"10"})]});case"hex-small":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:i.jsx("polygon",{points:"30,18 42,24 42,38 30,44 18,38 18,24"})});case"cylinder-disc":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"34",cy:"30",rx:"14",ry:"5"}),i.jsx("path",{d:"M 20 30 A 14 5 0 0 1 48 30"}),i.jsx("line",{x1:"20",y1:"30",x2:"20",y2:"36",strokeWidth:"1.5"}),i.jsx("ellipse",{cx:"20",cy:"36",rx:"3",ry:"1.4"}),i.jsx("path",{d:"M 20 30 L 14 32"})]});case"triangle-solid":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",fill:"currentColor",children:i.jsx("polygon",{points:"30,16 46,44 14,44"})});case"stairs-iso":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"8,40 16,36 24,40 16,44"}),i.jsx("polygon",{points:"16,36 24,32 32,36 24,40"}),i.jsx("polygon",{points:"24,32 32,28 40,32 32,36"}),i.jsx("polygon",{points:"32,28 40,24 48,28 40,32"}),i.jsx("polygon",{points:"40,24 48,20 56,24 48,28"})]});case"coin":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"30",cy:"26",rx:"14",ry:"6"}),i.jsx("path",{d:"M 16 26 L 16 34 A 14 6 0 0 0 44 34 L 44 26"}),i.jsx("line",{x1:"22",y1:"26",x2:"22",y2:"34"}),i.jsx("line",{x1:"30",y1:"32",x2:"30",y2:"38"}),i.jsx("line",{x1:"38",y1:"26",x2:"38",y2:"34"})]});case"cube-ports":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"30,6 52,18 52,42 30,54 8,42 8,18"}),i.jsx("line",{x1:"30",y1:"6",x2:"30",y2:"30"}),i.jsx("line",{x1:"30",y1:"30",x2:"8",y2:"18"}),i.jsx("line",{x1:"30",y1:"30",x2:"52",y2:"18"}),i.jsx("circle",{cx:"20",cy:"20",r:"2.5",fill:"currentColor"}),i.jsx("circle",{cx:"40",cy:"20",r:"2.5",fill:"currentColor"}),i.jsx("circle",{cx:"30",cy:"42",r:"2.5",fill:"currentColor"})]});case"arc-bridge":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 8 44 Q 30 8 52 44",strokeWidth:"1.5"}),i.jsx("circle",{cx:"30",cy:"44",r:"3",fill:"currentColor"})]});case"zigzag-v":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polyline",{points:"24,8 36,16 24,24 36,32 24,40 36,48",strokeWidth:"1.5"}),i.jsx("polyline",{points:"20,12 32,20 20,28 32,36 20,44 32,52",strokeWidth:"1.5"})]});case"x-flat":return i.jsx("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:i.jsx("polygon",{points:"14,14 22,14 30,22 38,14 46,14 36,28 46,46 38,46 30,34 22,46 14,46 24,28"})});case"cube-stack":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("polygon",{points:"14,30 22,26 30,30 22,34"}),i.jsx("polygon",{points:"22,34 30,30 30,38 22,42"}),i.jsx("polygon",{points:"14,30 14,38 22,42 22,34"}),i.jsx("polygon",{points:"30,22 38,18 46,22 38,26"}),i.jsx("polygon",{points:"38,26 46,22 46,30 38,34"}),i.jsx("polygon",{points:"30,22 30,30 38,34 38,26"})]});case"back-arrows":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,fill:"currentColor",children:[i.jsx("polygon",{points:"42,16 42,44 24,30"}),i.jsx("polygon",{points:"28,16 28,44 10,30"})]});case"barrel":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("ellipse",{cx:"44",cy:"30",rx:"6",ry:"14"}),i.jsx("line",{x1:"44",y1:"16",x2:"14",y2:"20"}),i.jsx("line",{x1:"44",y1:"44",x2:"14",y2:"40"}),i.jsx("ellipse",{cx:"14",cy:"30",rx:"4",ry:"10"}),i.jsx("line",{x1:"20",y1:"20",x2:"20",y2:"40",strokeDasharray:"2 2"}),i.jsx("line",{x1:"28",y1:"19",x2:"28",y2:"41",strokeDasharray:"2 2"}),i.jsx("line",{x1:"36",y1:"18",x2:"36",y2:"42",strokeDasharray:"2 2"})]});case"wave-s":return i.jsxs("svg",{className:"w-full h-full text-stone-900",viewBox:"0 0 60 60",...t,children:[i.jsx("path",{d:"M 22 8 Q 32 18 22 28 T 22 48",strokeWidth:"1.5"}),i.jsx("path",{d:"M 38 8 Q 28 18 38 28 T 38 48",strokeWidth:"1.5"})]})}}const Me=wU({component:()=>i.jsx(oV,{client:fV,children:i.jsx(pZ,{children:i.jsx(w$,{})})})}),X0e=Ie({getParentRoute:()=>Me,path:"/",component:Hhe}),Z0e=Ie({getParentRoute:()=>Me,path:"/topology",component:Oxe}),J0e=Ie({getParentRoute:()=>Me,path:"/topology/rig/$rigId",component:Lxe}),eye=Ie({getParentRoute:()=>Me,path:"/topology/pod/$rigId/$podName",component:$xe}),tye=Ie({getParentRoute:()=>Me,path:"/topology/seat/$rigId/$logicalId",component:Dxe}),nye=Ie({getParentRoute:()=>Me,path:"/for-you",component:Jpe}),sye=Ie({getParentRoute:()=>Me,path:"/project",component:C0e}),rye=Ie({getParentRoute:()=>Me,path:"/project/mission/$missionId",component:E0e}),iye=Ie({getParentRoute:()=>Me,path:"/project/slice/$sliceId",component:I0e}),aye=Ie({getParentRoute:()=>Me,path:"/specs",component:Az}),oye=Ie({getParentRoute:()=>Me,path:"/specs/applications",component:Az}),lye=Ie({getParentRoute:()=>Me,path:"/specs/skills",component:mme}),cye=Ie({getParentRoute:()=>Me,path:"/specs/skills/$skillToken",component:()=>{const{skillToken:e}=dn({from:"/specs/skills/$skillToken"});return i.jsx(Tz,{skillToken:e})}}),uye=Ie({getParentRoute:()=>Me,path:"/specs/skills/$skillToken/file/$fileToken",component:()=>{const{skillToken:e,fileToken:t}=dn({from:"/specs/skills/$skillToken/file/$fileToken"});return i.jsx(Tz,{skillToken:e,fileToken:t})}}),dye=Ie({getParentRoute:()=>Me,path:"/specs/plugins",component:gme}),fye=Ie({getParentRoute:()=>Me,path:"/files",component:qme}),hye=Ie({getParentRoute:()=>Me,path:"/plugins/$pluginId",component:()=>{const{pluginId:e}=dn({from:"/plugins/$pluginId"});return i.jsx(_me,{pluginId:e})}}),pye=Ie({getParentRoute:()=>Me,path:"/specs/$specKind/$specName",component:()=>{const{specName:e}=dn({from:"/specs/$specKind/$specName"});return i.jsx(Ro,{to:"/specs/library/$entryId",params:{entryId:e}})}}),mye=Ie({getParentRoute:()=>Me,path:"/settings",component:Qme}),gye=Ie({getParentRoute:()=>Me,path:"/settings/policies",component:tge}),xye=Ie({getParentRoute:()=>Me,path:"/settings/log",component:ige}),yye=Ie({getParentRoute:()=>Me,path:"/settings/status",component:uge}),vye=Ie({getParentRoute:()=>Me,path:"/search",component:Rhe}),bye=Ie({getParentRoute:()=>Me,path:"/lab/project-graphics-preview",component:D0e}),wye=Ie({getParentRoute:()=>Me,path:"/lab/card-previews",component:q0e}),jye=Ie({getParentRoute:()=>Me,path:"/lab/vellum-lab",component:cx}),Sye=Ie({getParentRoute:()=>Me,path:"/lab/vellum-bg/a-large",component:z0e}),Nye=Ie({getParentRoute:()=>Me,path:"/lab/vellum-bg/b-small",component:B0e}),kye=Ie({getParentRoute:()=>Me,path:"/lab/vellum-bg/c-allover",component:F0e});function _ye(){var s;const{rigId:e}=dn({from:"/rigs/$rigId"}),{data:t}=dr(),n=(s=t==null?void 0:t.find(r=>r.id===e))==null?void 0:s.name;return i.jsx("div",{className:"flex flex-col flex-1 h-full",children:i.jsx("div",{className:"flex-1 min-h-[400px] relative",children:i.jsx(y_,{rigId:e,rigName:n??null,showDiscovered:!1})})})}const Cye=Ie({getParentRoute:()=>Me,path:"/rigs/$rigId",component:_ye}),Eye=Ie({getParentRoute:()=>Me,path:"/rigs/$rigId/nodes/$logicalId",component:()=>{const{rigId:e,logicalId:t}=dn({from:"/rigs/$rigId/nodes/$logicalId"});return i.jsx(fz,{rigId:e,logicalId:decodeURIComponent(t)})}}),Rye=Ie({getParentRoute:()=>Me,path:"/import",component:Dce}),Aye=Ie({getParentRoute:()=>Me,path:"/packages",component:Uce}),Tye=Ie({getParentRoute:()=>Me,path:"/packages/install",component:Qce}),Iye=Ie({getParentRoute:()=>Me,path:"/packages/$packageId",component:Wde}),Mye=Ie({getParentRoute:()=>Me,path:"/bootstrap",component:sfe}),Oye=Ie({getParentRoute:()=>Me,path:"/agents/validate",component:rfe}),Lye=Ie({getParentRoute:()=>Me,path:"/specs/rig",component:xfe}),Pye=Ie({getParentRoute:()=>Me,path:"/specs/agent",component:vfe}),$ye=Ie({getParentRoute:()=>Me,path:"/specs/library/$entryId",component:()=>{const{entryId:e}=dn({from:"/specs/library/$entryId"});return i.jsx(Efe,{entryId:e})}}),Dye=Ie({getParentRoute:()=>Me,path:"/discovery",component:()=>i.jsx("div",{className:"flex h-full w-full items-center justify-center p-8",children:i.jsx(Ge,{label:"DISCOVERY",description:"Discovery surface preserved; redesign deferred per code-map.",variant:"card",testId:"discovery-placeholder"})})}),qye=Ie({getParentRoute:()=>Me,path:"/discovery/inventory",component:jhe}),zye=Ie({getParentRoute:()=>Me,path:"/bundles/inspect",component:jfe}),Bye=Ie({getParentRoute:()=>Me,path:"/bundles/install",component:Sfe}),Fye=Ie({getParentRoute:()=>Me,path:"/context",component:()=>i.jsx(Ro,{to:"/topology"})}),Hye=Ie({getParentRoute:()=>Me,path:"/mission-control",component:()=>i.jsx(Ro,{to:"/for-you"})}),Uye=Ie({getParentRoute:()=>Me,path:"/slices",component:()=>i.jsx(Ro,{to:"/project"})}),Vye=Ie({getParentRoute:()=>Me,path:"/slices/$name",component:()=>{const{name:e}=dn({from:"/slices/$name"});return i.jsx(Ro,{to:"/project/slice/$sliceId",params:{sliceId:e}})}}),Gye=Ie({getParentRoute:()=>Me,path:"/progress",component:()=>i.jsx(Ro,{to:"/project"})}),Kye=Ie({getParentRoute:()=>Me,path:"/steering",component:()=>i.jsx(Ro,{to:"/project"})}),Wye=Me.addChildren([X0e,Z0e,J0e,eye,tye,nye,sye,rye,iye,aye,oye,lye,dye,cye,uye,hye,fye,pye,mye,gye,xye,yye,vye,bye,wye,jye,Sye,Nye,kye,Cye,Eye,Rye,Aye,Tye,Iye,Mye,Oye,Lye,Pye,$ye,Dye,qye,zye,Bye,Fye,Hye,Uye,Vye,Gye,Kye]),Yye=TU({routeTree:Wye});function Qye(){return i.jsx(OU,{router:Yye})}const zP=document.getElementById("root");zP&&I7.createRoot(zP).render(i.jsx(C.StrictMode,{children:i.jsx(Qye,{})}));