orbital-command 0.1.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 (325) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +396 -0
  3. package/bin/orbital.js +362 -0
  4. package/dist/assets/WorkflowVisualizer-BZ21PIIF.js +84 -0
  5. package/dist/assets/WorkflowVisualizer-BZV40eAE.css +1 -0
  6. package/dist/assets/charts-D__PA1zp.js +72 -0
  7. package/dist/assets/index-D1G6i0nS.css +1 -0
  8. package/dist/assets/index-DpItvKpf.js +419 -0
  9. package/dist/assets/ui-BvF022GT.js +53 -0
  10. package/dist/assets/vendor-Dzv9lrRc.js +59 -0
  11. package/dist/index.html +19 -0
  12. package/dist/scanner-sweep.png +0 -0
  13. package/dist/server/server/adapters/index.js +34 -0
  14. package/dist/server/server/adapters/iterm2-adapter.js +29 -0
  15. package/dist/server/server/adapters/subprocess-adapter.js +21 -0
  16. package/dist/server/server/adapters/terminal-adapter.js +1 -0
  17. package/dist/server/server/config.js +156 -0
  18. package/dist/server/server/database.js +90 -0
  19. package/dist/server/server/index.js +372 -0
  20. package/dist/server/server/init.js +811 -0
  21. package/dist/server/server/parsers/event-parser.js +64 -0
  22. package/dist/server/server/parsers/scope-parser.js +188 -0
  23. package/dist/server/server/routes/config-routes.js +163 -0
  24. package/dist/server/server/routes/data-routes.js +461 -0
  25. package/dist/server/server/routes/dispatch-routes.js +215 -0
  26. package/dist/server/server/routes/git-routes.js +92 -0
  27. package/dist/server/server/routes/scope-routes.js +215 -0
  28. package/dist/server/server/routes/sprint-routes.js +116 -0
  29. package/dist/server/server/routes/version-routes.js +130 -0
  30. package/dist/server/server/routes/workflow-routes.js +185 -0
  31. package/dist/server/server/schema.js +90 -0
  32. package/dist/server/server/services/batch-orchestrator.js +253 -0
  33. package/dist/server/server/services/claude-session-service.js +352 -0
  34. package/dist/server/server/services/config-service.js +132 -0
  35. package/dist/server/server/services/deploy-service.js +51 -0
  36. package/dist/server/server/services/event-service.js +63 -0
  37. package/dist/server/server/services/gate-service.js +83 -0
  38. package/dist/server/server/services/git-service.js +309 -0
  39. package/dist/server/server/services/github-service.js +145 -0
  40. package/dist/server/server/services/readiness-service.js +184 -0
  41. package/dist/server/server/services/scope-cache.js +72 -0
  42. package/dist/server/server/services/scope-service.js +424 -0
  43. package/dist/server/server/services/sprint-orchestrator.js +312 -0
  44. package/dist/server/server/services/sprint-service.js +293 -0
  45. package/dist/server/server/services/workflow-service.js +397 -0
  46. package/dist/server/server/utils/cc-hooks-parser.js +49 -0
  47. package/dist/server/server/utils/dispatch-utils.js +305 -0
  48. package/dist/server/server/utils/logger.js +86 -0
  49. package/dist/server/server/utils/terminal-launcher.js +388 -0
  50. package/dist/server/server/utils/worktree-manager.js +98 -0
  51. package/dist/server/server/watchers/event-watcher.js +81 -0
  52. package/dist/server/server/watchers/scope-watcher.js +33 -0
  53. package/dist/server/shared/api-types.js +5 -0
  54. package/dist/server/shared/default-workflow.json +616 -0
  55. package/dist/server/shared/workflow-config.js +44 -0
  56. package/dist/server/shared/workflow-engine.js +353 -0
  57. package/index.html +15 -0
  58. package/package.json +110 -0
  59. package/postcss.config.js +6 -0
  60. package/schemas/orbital.config.schema.json +83 -0
  61. package/scripts/postinstall.js +24 -0
  62. package/scripts/start.sh +20 -0
  63. package/server/adapters/index.ts +41 -0
  64. package/server/adapters/iterm2-adapter.ts +37 -0
  65. package/server/adapters/subprocess-adapter.ts +25 -0
  66. package/server/adapters/terminal-adapter.ts +24 -0
  67. package/server/config.ts +234 -0
  68. package/server/database.ts +107 -0
  69. package/server/index.ts +452 -0
  70. package/server/init.ts +891 -0
  71. package/server/parsers/event-parser.ts +74 -0
  72. package/server/parsers/scope-parser.ts +240 -0
  73. package/server/routes/config-routes.ts +182 -0
  74. package/server/routes/data-routes.ts +548 -0
  75. package/server/routes/dispatch-routes.ts +275 -0
  76. package/server/routes/git-routes.ts +112 -0
  77. package/server/routes/scope-routes.ts +262 -0
  78. package/server/routes/sprint-routes.ts +142 -0
  79. package/server/routes/version-routes.ts +156 -0
  80. package/server/routes/workflow-routes.ts +198 -0
  81. package/server/schema.ts +90 -0
  82. package/server/services/batch-orchestrator.ts +286 -0
  83. package/server/services/claude-session-service.ts +441 -0
  84. package/server/services/config-service.ts +151 -0
  85. package/server/services/deploy-service.ts +98 -0
  86. package/server/services/event-service.ts +98 -0
  87. package/server/services/gate-service.ts +126 -0
  88. package/server/services/git-service.ts +391 -0
  89. package/server/services/github-service.ts +183 -0
  90. package/server/services/readiness-service.ts +250 -0
  91. package/server/services/scope-cache.ts +81 -0
  92. package/server/services/scope-service.ts +476 -0
  93. package/server/services/sprint-orchestrator.ts +361 -0
  94. package/server/services/sprint-service.ts +415 -0
  95. package/server/services/workflow-service.ts +461 -0
  96. package/server/utils/cc-hooks-parser.ts +70 -0
  97. package/server/utils/dispatch-utils.ts +395 -0
  98. package/server/utils/logger.ts +109 -0
  99. package/server/utils/terminal-launcher.ts +462 -0
  100. package/server/utils/worktree-manager.ts +104 -0
  101. package/server/watchers/event-watcher.ts +100 -0
  102. package/server/watchers/scope-watcher.ts +38 -0
  103. package/shared/api-types.ts +20 -0
  104. package/shared/default-workflow.json +616 -0
  105. package/shared/workflow-config.ts +170 -0
  106. package/shared/workflow-engine.ts +427 -0
  107. package/src/App.tsx +33 -0
  108. package/src/components/AgentBadge.tsx +40 -0
  109. package/src/components/BatchPreflightModal.tsx +115 -0
  110. package/src/components/CardDisplayToggle.tsx +74 -0
  111. package/src/components/ColumnHeaderActions.tsx +55 -0
  112. package/src/components/ColumnMenu.tsx +99 -0
  113. package/src/components/DeployHistory.tsx +141 -0
  114. package/src/components/DispatchModal.tsx +164 -0
  115. package/src/components/DispatchPopover.tsx +139 -0
  116. package/src/components/DragOverlay.tsx +25 -0
  117. package/src/components/DriftSidebar.tsx +140 -0
  118. package/src/components/EnvironmentStrip.tsx +88 -0
  119. package/src/components/ErrorBoundary.tsx +62 -0
  120. package/src/components/FilterChip.tsx +105 -0
  121. package/src/components/GateIndicator.tsx +33 -0
  122. package/src/components/IdeaDetailModal.tsx +190 -0
  123. package/src/components/IdeaFormDialog.tsx +113 -0
  124. package/src/components/KanbanColumn.tsx +201 -0
  125. package/src/components/MarkdownRenderer.tsx +114 -0
  126. package/src/components/NeonGrid.tsx +128 -0
  127. package/src/components/PromotionQueue.tsx +89 -0
  128. package/src/components/ScopeCard.tsx +234 -0
  129. package/src/components/ScopeDetailModal.tsx +255 -0
  130. package/src/components/ScopeFilterBar.tsx +152 -0
  131. package/src/components/SearchInput.tsx +102 -0
  132. package/src/components/SessionPanel.tsx +335 -0
  133. package/src/components/SprintContainer.tsx +303 -0
  134. package/src/components/SprintDependencyDialog.tsx +78 -0
  135. package/src/components/SprintPreflightModal.tsx +138 -0
  136. package/src/components/StatusBar.tsx +168 -0
  137. package/src/components/SwimCell.tsx +67 -0
  138. package/src/components/SwimLaneRow.tsx +94 -0
  139. package/src/components/SwimlaneBoardView.tsx +108 -0
  140. package/src/components/VersionBadge.tsx +139 -0
  141. package/src/components/ViewModeSelector.tsx +114 -0
  142. package/src/components/config/AgentChip.tsx +53 -0
  143. package/src/components/config/AgentCreateDialog.tsx +321 -0
  144. package/src/components/config/AgentEditor.tsx +175 -0
  145. package/src/components/config/DirectoryTree.tsx +582 -0
  146. package/src/components/config/FileEditor.tsx +550 -0
  147. package/src/components/config/HookChip.tsx +50 -0
  148. package/src/components/config/StageCard.tsx +198 -0
  149. package/src/components/config/TransitionZone.tsx +173 -0
  150. package/src/components/config/UnifiedWorkflowPipeline.tsx +216 -0
  151. package/src/components/config/WorkflowPipeline.tsx +161 -0
  152. package/src/components/source-control/BranchList.tsx +93 -0
  153. package/src/components/source-control/BranchPanel.tsx +105 -0
  154. package/src/components/source-control/CommitLog.tsx +100 -0
  155. package/src/components/source-control/CommitRow.tsx +47 -0
  156. package/src/components/source-control/GitHubPanel.tsx +110 -0
  157. package/src/components/source-control/GitHubSetupGuide.tsx +52 -0
  158. package/src/components/source-control/GitOverviewBar.tsx +101 -0
  159. package/src/components/source-control/PullRequestList.tsx +69 -0
  160. package/src/components/source-control/WorktreeList.tsx +80 -0
  161. package/src/components/ui/badge.tsx +41 -0
  162. package/src/components/ui/button.tsx +55 -0
  163. package/src/components/ui/card.tsx +78 -0
  164. package/src/components/ui/dialog.tsx +94 -0
  165. package/src/components/ui/popover.tsx +33 -0
  166. package/src/components/ui/scroll-area.tsx +54 -0
  167. package/src/components/ui/separator.tsx +28 -0
  168. package/src/components/ui/tabs.tsx +52 -0
  169. package/src/components/ui/toggle-switch.tsx +35 -0
  170. package/src/components/ui/tooltip.tsx +27 -0
  171. package/src/components/workflow/AddEdgeDialog.tsx +217 -0
  172. package/src/components/workflow/AddListDialog.tsx +201 -0
  173. package/src/components/workflow/ChecklistEditor.tsx +239 -0
  174. package/src/components/workflow/CommandPrefixManager.tsx +118 -0
  175. package/src/components/workflow/ConfigSettingsPanel.tsx +189 -0
  176. package/src/components/workflow/DirectionSelector.tsx +133 -0
  177. package/src/components/workflow/DispatchConfigPanel.tsx +180 -0
  178. package/src/components/workflow/EdgeDetailPanel.tsx +236 -0
  179. package/src/components/workflow/EdgePropertyEditor.tsx +251 -0
  180. package/src/components/workflow/EditToolbar.tsx +138 -0
  181. package/src/components/workflow/HookDetailPanel.tsx +250 -0
  182. package/src/components/workflow/HookExecutionLog.tsx +24 -0
  183. package/src/components/workflow/HookSourceModal.tsx +129 -0
  184. package/src/components/workflow/HooksDashboard.tsx +363 -0
  185. package/src/components/workflow/ListPropertyEditor.tsx +251 -0
  186. package/src/components/workflow/MigrationPreviewDialog.tsx +237 -0
  187. package/src/components/workflow/MovementRulesPanel.tsx +188 -0
  188. package/src/components/workflow/NodeDetailPanel.tsx +245 -0
  189. package/src/components/workflow/PresetSelector.tsx +414 -0
  190. package/src/components/workflow/SkillCommandBuilder.tsx +174 -0
  191. package/src/components/workflow/WorkflowEdgeComponent.tsx +145 -0
  192. package/src/components/workflow/WorkflowNode.tsx +147 -0
  193. package/src/components/workflow/graphLayout.ts +186 -0
  194. package/src/components/workflow/mergeHooks.ts +85 -0
  195. package/src/components/workflow/useEditHistory.ts +88 -0
  196. package/src/components/workflow/useWorkflowEditor.ts +262 -0
  197. package/src/components/workflow/validateConfig.ts +70 -0
  198. package/src/hooks/useActiveDispatches.ts +198 -0
  199. package/src/hooks/useBoardSettings.ts +170 -0
  200. package/src/hooks/useCardDisplay.ts +57 -0
  201. package/src/hooks/useCcHooks.ts +24 -0
  202. package/src/hooks/useConfigTree.ts +51 -0
  203. package/src/hooks/useEnforcementRules.ts +46 -0
  204. package/src/hooks/useEvents.ts +59 -0
  205. package/src/hooks/useFileEditor.ts +165 -0
  206. package/src/hooks/useGates.ts +57 -0
  207. package/src/hooks/useIdeaActions.ts +53 -0
  208. package/src/hooks/useKanbanDnd.ts +410 -0
  209. package/src/hooks/useOrbitalConfig.ts +54 -0
  210. package/src/hooks/usePipeline.ts +47 -0
  211. package/src/hooks/usePipelineData.ts +338 -0
  212. package/src/hooks/useReconnect.ts +25 -0
  213. package/src/hooks/useScopeFilters.ts +125 -0
  214. package/src/hooks/useScopeSessions.ts +44 -0
  215. package/src/hooks/useScopes.ts +67 -0
  216. package/src/hooks/useSearch.ts +67 -0
  217. package/src/hooks/useSettings.tsx +187 -0
  218. package/src/hooks/useSocket.ts +25 -0
  219. package/src/hooks/useSourceControl.ts +105 -0
  220. package/src/hooks/useSprintPreflight.ts +55 -0
  221. package/src/hooks/useSprints.ts +154 -0
  222. package/src/hooks/useStatusBarHighlight.ts +18 -0
  223. package/src/hooks/useSwimlaneBoardSettings.ts +104 -0
  224. package/src/hooks/useTheme.ts +9 -0
  225. package/src/hooks/useTransitionReadiness.ts +53 -0
  226. package/src/hooks/useVersion.ts +155 -0
  227. package/src/hooks/useViolations.ts +65 -0
  228. package/src/hooks/useWorkflow.tsx +125 -0
  229. package/src/hooks/useZoomModifier.ts +19 -0
  230. package/src/index.css +797 -0
  231. package/src/layouts/DashboardLayout.tsx +113 -0
  232. package/src/lib/collisionDetection.ts +20 -0
  233. package/src/lib/scope-fields.ts +61 -0
  234. package/src/lib/swimlane.ts +146 -0
  235. package/src/lib/utils.ts +15 -0
  236. package/src/main.tsx +19 -0
  237. package/src/socket.ts +11 -0
  238. package/src/types/index.ts +497 -0
  239. package/src/views/AgentFeed.tsx +339 -0
  240. package/src/views/DeployPipeline.tsx +59 -0
  241. package/src/views/EnforcementView.tsx +378 -0
  242. package/src/views/PrimitivesConfig.tsx +500 -0
  243. package/src/views/QualityGates.tsx +1012 -0
  244. package/src/views/ScopeBoard.tsx +454 -0
  245. package/src/views/SessionTimeline.tsx +516 -0
  246. package/src/views/Settings.tsx +183 -0
  247. package/src/views/SourceControl.tsx +95 -0
  248. package/src/views/WorkflowVisualizer.tsx +382 -0
  249. package/tailwind.config.js +161 -0
  250. package/templates/agents/AUTO-INVOKE.md +180 -0
  251. package/templates/agents/CONFLICT-RESOLUTION.md +128 -0
  252. package/templates/agents/QUICK-REFERENCE.md +122 -0
  253. package/templates/agents/README.md +188 -0
  254. package/templates/agents/SKILL-TRIGGERS.md +100 -0
  255. package/templates/agents/blue-team/frontend-designer.md +424 -0
  256. package/templates/agents/green-team/architect.md +526 -0
  257. package/templates/agents/green-team/rules-enforcer.md +131 -0
  258. package/templates/agents/red-team/attacker-learned.md +24 -0
  259. package/templates/agents/red-team/attacker.md +486 -0
  260. package/templates/agents/red-team/chaos.md +548 -0
  261. package/templates/agents/reference/component-registry.md +82 -0
  262. package/templates/agents/workflows/full-mode.md +218 -0
  263. package/templates/agents/workflows/quick-mode.md +118 -0
  264. package/templates/agents/workflows/security-mode.md +283 -0
  265. package/templates/anti-patterns/dangerous-shortcuts.md +427 -0
  266. package/templates/config/agent-triggers.json +92 -0
  267. package/templates/hooks/agent-team-gate.sh +31 -0
  268. package/templates/hooks/agent-trigger.sh +97 -0
  269. package/templates/hooks/block-push.sh +66 -0
  270. package/templates/hooks/block-workarounds.sh +61 -0
  271. package/templates/hooks/blocker-check.sh +28 -0
  272. package/templates/hooks/completion-checklist.sh +28 -0
  273. package/templates/hooks/decision-capture.sh +15 -0
  274. package/templates/hooks/dependency-check.sh +27 -0
  275. package/templates/hooks/end-session.sh +31 -0
  276. package/templates/hooks/exploration-logger.sh +37 -0
  277. package/templates/hooks/files-changed-summary.sh +37 -0
  278. package/templates/hooks/get-session-id.sh +49 -0
  279. package/templates/hooks/git-commit-guard.sh +34 -0
  280. package/templates/hooks/init-session.sh +93 -0
  281. package/templates/hooks/orbital-emit.sh +79 -0
  282. package/templates/hooks/orbital-report-deploy.sh +78 -0
  283. package/templates/hooks/orbital-report-gates.sh +40 -0
  284. package/templates/hooks/orbital-report-violation.sh +36 -0
  285. package/templates/hooks/orbital-scope-update.sh +53 -0
  286. package/templates/hooks/phase-verify-reminder.sh +26 -0
  287. package/templates/hooks/review-gate-check.sh +82 -0
  288. package/templates/hooks/scope-commit-logger.sh +37 -0
  289. package/templates/hooks/scope-create-cleanup.sh +36 -0
  290. package/templates/hooks/scope-create-gate.sh +80 -0
  291. package/templates/hooks/scope-create-tracker.sh +17 -0
  292. package/templates/hooks/scope-file-sync.sh +53 -0
  293. package/templates/hooks/scope-gate.sh +35 -0
  294. package/templates/hooks/scope-helpers.sh +188 -0
  295. package/templates/hooks/scope-lifecycle-gate.sh +139 -0
  296. package/templates/hooks/scope-prepare.sh +244 -0
  297. package/templates/hooks/scope-transition.sh +172 -0
  298. package/templates/hooks/session-enforcer.sh +143 -0
  299. package/templates/hooks/time-tracker.sh +33 -0
  300. package/templates/lessons-learned.md +15 -0
  301. package/templates/orbital.config.json +35 -0
  302. package/templates/presets/development.json +42 -0
  303. package/templates/presets/gitflow.json +712 -0
  304. package/templates/presets/minimal.json +23 -0
  305. package/templates/quick/rules.md +218 -0
  306. package/templates/scopes/_template.md +255 -0
  307. package/templates/settings-hooks.json +98 -0
  308. package/templates/skills/git-commit/SKILL.md +85 -0
  309. package/templates/skills/git-dev/SKILL.md +99 -0
  310. package/templates/skills/git-hotfix/SKILL.md +223 -0
  311. package/templates/skills/git-main/SKILL.md +84 -0
  312. package/templates/skills/git-production/SKILL.md +165 -0
  313. package/templates/skills/git-staging/SKILL.md +112 -0
  314. package/templates/skills/scope-create/SKILL.md +81 -0
  315. package/templates/skills/scope-fix-review/SKILL.md +168 -0
  316. package/templates/skills/scope-implement/SKILL.md +110 -0
  317. package/templates/skills/scope-post-review/SKILL.md +144 -0
  318. package/templates/skills/scope-pre-review/SKILL.md +211 -0
  319. package/templates/skills/scope-verify/SKILL.md +201 -0
  320. package/templates/skills/session-init/SKILL.md +62 -0
  321. package/templates/skills/session-resume/SKILL.md +201 -0
  322. package/templates/skills/test-checks/SKILL.md +171 -0
  323. package/templates/skills/test-code-review/SKILL.md +252 -0
  324. package/tsconfig.json +25 -0
  325. package/vite.config.ts +38 -0
@@ -0,0 +1,419 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkflowVisualizer-BZ21PIIF.js","assets/ui-BvF022GT.js","assets/vendor-Dzv9lrRc.js","assets/charts-D__PA1zp.js","assets/WorkflowVisualizer-BZV40eAE.css"])))=>i.map(i=>d[i]);
2
+ var Vx=Object.defineProperty;var $x=(e,t,n)=>t in e?Vx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Mt=(e,t,n)=>$x(e,typeof t!="symbol"?t+"":t,n);import{j as a,C as rh,P as Hx,R as Ux,T as Wx,a as sh,V as qx,b as Gx,S as ih,c as Kx,d as oh,e as ah,f as Yx,u as lh,h as Xx,g as Jx,i as Gr,k as Qx,l as ch,m as Zx,F as ey,D as ty,n as ny,o as ry,p as sy,q as iy,r as uh,A as dh,s as oy,O as fh,t as ay,v as hh,w as ly,x as cy,y as uy,z as dy,L as ph,B as mh,E as gh,G as fy}from"./ui-BvF022GT.js";import{f as hy,g as nl,a as m,u as py,N as Oc,O as my,d as Ie,b as Xn,h as xh,R as gy,B as xy,i as yy,j as Kt,k as by}from"./vendor-Dzv9lrRc.js";import{c as yh,R as mn,B as os,X as On,Y as Ln,T as or,a as nr,C as Kr,P as vy,b as wy,L as ky,A as Lc,d as ta,e as jy}from"./charts-D__PA1zp.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Os={},Ic;function Sy(){if(Ic)return Os;Ic=1;var e=hy();return Os.createRoot=e.createRoot,Os.hydrateRoot=e.hydrateRoot,Os}var Ny=Sy();const Cy=nl(Ny),Ey="modulepreload",Ty=function(e){return"/"+e},Fc={},Ay=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=o(n.map(u=>{if(u=Ty(u),u in Fc)return;Fc[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":Ey,d||(h.as="script"),h.crossOrigin="",h.href=u,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},rl="-",Py=e=>{const t=_y(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(rl);return l[0]===""&&l.length!==1&&l.shift(),bh(l,t)||My(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},bh=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?bh(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(rl);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},Bc=/^\[(.+)\]$/,My=e=>{if(Bc.test(e)){const t=Bc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},_y=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Dy(Object.entries(e.classGroups),n).forEach(([i,o])=>{na(o,r,i,t)}),r},na=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:zc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Ry(s)){na(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{na(o,zc(t,i),n,r)})})},zc=(e,t)=>{let n=e;return t.split(rl).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Ry=e=>e.isThemeGetter,Dy=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,s]}):e,Oy=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},vh="!",Ly=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let b=0;b<l.length;b++){let y=l[b];if(u===0){if(y===s&&(r||l.slice(b,b+i)===t)){c.push(l.slice(d,b)),d=b+i;continue}if(y==="/"){f=b;continue}}y==="["?u++:y==="]"&&u--}const h=c.length===0?l:l.substring(d),p=h.startsWith(vh),g=p?h.substring(1):h,x=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}};return n?l=>n({className:l,parseClassName:o}):o},Iy=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Fy=e=>({cache:Oy(e.cacheSize),parseClassName:Ly(e),...Py(e)}),By=/\s+/,zy=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(By);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,x=r(g?h.substring(0,p):h);if(!x){if(!g){l=u+(l.length>0?" "+l:l);continue}if(x=r(h),!x){l=u+(l.length>0?" "+l:l);continue}g=!1}const b=Iy(d).join(":"),y=f?b+vh:b,j=y+x;if(i.includes(j))continue;i.push(j);const w=s(x,g);for(let E=0;E<w.length;++E){const T=w[E];i.push(y+T)}l=u+(l.length>0?" "+l:l)}return l};function Vy(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=wh(t))&&(r&&(r+=" "),r+=n);return r}const wh=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=wh(e[r]))&&(n&&(n+=" "),n+=t);return n};function $y(e,...t){let n,r,s,i=o;function o(c){const u=t.reduce((d,f)=>f(d),e());return n=Fy(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=zy(c,n);return s(c,d),d}return function(){return i(Vy.apply(null,arguments))}}const Pe=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},kh=/^\[(?:([a-z-]+):)?(.+)\]$/i,Hy=/^\d+\/\d+$/,Uy=new Set(["px","full","screen"]),Wy=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qy=/\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$/,Gy=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ky=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yy=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yt=e=>rr(e)||Uy.has(e)||Hy.test(e),ln=e=>pr(e,"length",rb),rr=e=>!!e&&!Number.isNaN(Number(e)),ao=e=>pr(e,"number",rr),Mr=e=>!!e&&Number.isInteger(Number(e)),Xy=e=>e.endsWith("%")&&rr(e.slice(0,-1)),ae=e=>kh.test(e),cn=e=>Wy.test(e),Jy=new Set(["length","size","percentage"]),Qy=e=>pr(e,Jy,jh),Zy=e=>pr(e,"position",jh),eb=new Set(["image","url"]),tb=e=>pr(e,eb,ib),nb=e=>pr(e,"",sb),_r=()=>!0,pr=(e,t,n)=>{const r=kh.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},rb=e=>qy.test(e)&&!Gy.test(e),jh=()=>!1,sb=e=>Ky.test(e),ib=e=>Yy.test(e),ob=()=>{const e=Pe("colors"),t=Pe("spacing"),n=Pe("blur"),r=Pe("brightness"),s=Pe("borderColor"),i=Pe("borderRadius"),o=Pe("borderSpacing"),l=Pe("borderWidth"),c=Pe("contrast"),u=Pe("grayscale"),d=Pe("hueRotate"),f=Pe("invert"),h=Pe("gap"),p=Pe("gradientColorStops"),g=Pe("gradientColorStopPositions"),x=Pe("inset"),b=Pe("margin"),y=Pe("opacity"),j=Pe("padding"),w=Pe("saturate"),E=Pe("scale"),T=Pe("sepia"),S=Pe("skew"),A=Pe("space"),v=Pe("translate"),M=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",ae,t],P=()=>[ae,t],V=()=>["",Yt,ln],F=()=>["auto",rr,ae],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Y=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",ae],k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>[rr,ae];return{cacheSize:500,separator:":",theme:{colors:[_r],spacing:[Yt,ln],blur:["none","",cn,ae],brightness:_(),borderColor:[e],borderRadius:["none","","full",cn,ae],borderSpacing:P(),borderWidth:V(),contrast:_(),grayscale:L(),hueRotate:_(),invert:L(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[Xy,ln],inset:O(),margin:O(),opacity:_(),padding:P(),saturate:_(),scale:_(),sepia:L(),skew:_(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",ae]}],container:["container"],columns:[{columns:[cn]}],"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"],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(),ae]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Mr,ae]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ae]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Mr,ae]}],"grid-cols":[{"grid-cols":[_r]}],"col-start-end":[{col:["auto",{span:["full",Mr,ae]},ae]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[_r]}],"row-start-end":[{row:["auto",{span:[Mr,ae]},ae]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ae]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ae]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ae,t]}],"min-w":[{"min-w":[ae,t,"min","max","fit"]}],"max-w":[{"max-w":[ae,t,"none","full","min","max","fit","prose",{screen:[cn]},cn]}],h:[{h:[ae,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ae,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ae,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ae,t,"auto","min","max","fit"]}],"font-size":[{text:["base",cn,ln]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ao]}],"font-family":[{font:[_r]}],"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:["tighter","tight","normal","wide","wider","widest",ae]}],"line-clamp":[{"line-clamp":["none",rr,ao]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Yt,ae]}],"list-image":[{"list-image":["none",ae]}],"list-style-type":[{list:["none","disc","decimal",ae]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Yt,ln]}],"underline-offset":[{"underline-offset":["auto",Yt,ae]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),Zy]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Qy]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},tb]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...Y(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:Y()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...Y()]}],"outline-offset":[{"outline-offset":[Yt,ae]}],"outline-w":[{outline:[Yt,ln]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Yt,ln]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",cn,nb]}],"shadow-color":[{shadow:[_r]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",cn,ae]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ae]}],duration:[{duration:_()}],ease:[{ease:["linear","in","out","in-out",ae]}],delay:[{delay:_()}],animate:[{animate:["none","spin","ping","pulse","bounce",ae]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Mr,ae]}],"translate-x":[{"translate-x":[v]}],"translate-y":[{"translate-y":[v]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ae]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",ae]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",ae]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Yt,ln,ao]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},ab=$y(ob);function I(...e){return ab(yh(e))}function dt(e){if(e<1e3)return`#${String(e).padStart(3,"0")}`;const t=e%1e3,n=Math.floor(e/1e3),r=n===9?"X":String.fromCharCode(96+n);return`#${String(t).padStart(3,"0")}${r}`}const lb=Hx,Vc=Ux,$c=Wx,ra=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(rh,{ref:r,sideOffset:t,className:I("card-glass z-50 overflow-hidden rounded border bg-popover px-2 py-1 text-xxs text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));ra.displayName=rh.displayName;/**
3
+ * @license lucide-react v0.577.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const Sh=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
8
+ * @license lucide-react v0.577.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const cb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
13
+ * @license lucide-react v0.577.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const ub=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
18
+ * @license lucide-react v0.577.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const Hc=e=>{const t=ub(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
23
+ * @license lucide-react v0.577.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */var db={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"};/**
28
+ * @license lucide-react v0.577.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const fb=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
33
+ * @license lucide-react v0.577.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const hb=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>m.createElement("svg",{ref:c,...db,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Sh("lucide",s),...!i&&!fb(l)&&{"aria-hidden":"true"},...l},[...o.map(([u,d])=>m.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
38
+ * @license lucide-react v0.577.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const q=(e,t)=>{const n=m.forwardRef(({className:r,...s},i)=>m.createElement(hb,{ref:i,iconNode:t,className:Sh(`lucide-${cb(Hc(e))}`,`lucide-${e}`,r),...s}));return n.displayName=Hc(e),n};/**
43
+ * @license lucide-react v0.577.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const pb=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],di=q("arrow-down",pb);/**
48
+ * @license lucide-react v0.577.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const mb=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],gb=q("arrow-left",mb);/**
53
+ * @license lucide-react v0.577.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const xb=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],mr=q("arrow-right",xb);/**
58
+ * @license lucide-react v0.577.0 - ISC
59
+ *
60
+ * This source code is licensed under the ISC license.
61
+ * See the LICENSE file in the root directory of this source tree.
62
+ */const yb=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],bb=q("arrow-up-down",yb);/**
63
+ * @license lucide-react v0.577.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */const vb=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Nh=q("arrow-up",vb);/**
68
+ * @license lucide-react v0.577.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const wb=[["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"}]],Di=q("bot",wb);/**
73
+ * @license lucide-react v0.577.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const kb=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],sl=q("check",kb);/**
78
+ * @license lucide-react v0.577.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const jb=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gn=q("chevron-down",jb);/**
83
+ * @license lucide-react v0.577.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const Sb=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Zt=q("chevron-right",Sb);/**
88
+ * @license lucide-react v0.577.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const Nb=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cb=q("chevron-up",Nb);/**
93
+ * @license lucide-react v0.577.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const Eb=[["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"}]],Ch=q("circle-alert",Eb);/**
98
+ * @license lucide-react v0.577.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const Tb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xs=q("circle-check",Tb);/**
103
+ * @license lucide-react v0.577.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const Ab=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],il=q("circle-minus",Ab);/**
108
+ * @license lucide-react v0.577.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const Pb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],fi=q("circle-x",Pb);/**
113
+ * @license lucide-react v0.577.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const Mb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sa=q("circle",Mb);/**
118
+ * @license lucide-react v0.577.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const _b=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Yr=q("clock",_b);/**
123
+ * @license lucide-react v0.577.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const Rb=[["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"}]],Eh=q("cog",Rb);/**
128
+ * @license lucide-react v0.577.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const Db=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Th=q("columns-3",Db);/**
133
+ * @license lucide-react v0.577.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const Ob=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],Uc=q("corner-down-left",Ob);/**
138
+ * @license lucide-react v0.577.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const Lb=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ib=q("download",Lb);/**
143
+ * @license lucide-react v0.577.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const Fb=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Bb=q("ellipsis-vertical",Fb);/**
148
+ * @license lucide-react v0.577.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const zb=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ys=q("external-link",zb);/**
153
+ * @license lucide-react v0.577.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const Vb=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],$b=q("eye-off",Vb);/**
158
+ * @license lucide-react v0.577.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const Hb=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Oi=q("eye",Hb);/**
163
+ * @license lucide-react v0.577.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const Ub=[["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"}]],ia=q("file-text",Ub);/**
168
+ * @license lucide-react v0.577.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const Wb=[["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"}]],Ah=q("file",Wb);/**
173
+ * @license lucide-react v0.577.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const qb=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Gb=q("folder-open",qb);/**
178
+ * @license lucide-react v0.577.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const Kb=[["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"}]],Ph=q("folder",Kb);/**
183
+ * @license lucide-react v0.577.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const Yb=[["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"}]],xn=q("git-branch",Yb);/**
188
+ * @license lucide-react v0.577.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const Xb=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],oa=q("git-commit-horizontal",Xb);/**
193
+ * @license lucide-react v0.577.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const Jb=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],ar=q("git-fork",Jb);/**
198
+ * @license lucide-react v0.577.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const Qb=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],Wc=q("git-pull-request",Qb);/**
203
+ * @license lucide-react v0.577.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const Zb=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Mh=q("github",Zb);/**
208
+ * @license lucide-react v0.577.0 - ISC
209
+ *
210
+ * This source code is licensed under the ISC license.
211
+ * See the LICENSE file in the root directory of this source tree.
212
+ */const e0=[["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"}]],t0=q("globe",e0);/**
213
+ * @license lucide-react v0.577.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */const n0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],r0=q("info",n0);/**
218
+ * @license lucide-react v0.577.0 - ISC
219
+ *
220
+ * This source code is licensed under the ISC license.
221
+ * See the LICENSE file in the root directory of this source tree.
222
+ */const s0=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ol=q("layers",s0);/**
223
+ * @license lucide-react v0.577.0 - ISC
224
+ *
225
+ * This source code is licensed under the ISC license.
226
+ * See the LICENSE file in the root directory of this source tree.
227
+ */const i0=[["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"}]],_h=q("layout-dashboard",i0);/**
228
+ * @license lucide-react v0.577.0 - ISC
229
+ *
230
+ * This source code is licensed under the ISC license.
231
+ * See the LICENSE file in the root directory of this source tree.
232
+ */const o0=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],a0=q("lightbulb",o0);/**
233
+ * @license lucide-react v0.577.0 - ISC
234
+ *
235
+ * This source code is licensed under the ISC license.
236
+ * See the LICENSE file in the root directory of this source tree.
237
+ */const l0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Li=q("loader-circle",l0);/**
238
+ * @license lucide-react v0.577.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const c0=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],u0=q("lock",c0);/**
243
+ * @license lucide-react v0.577.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */const d0=[["path",{d:"M5 12h14",key:"1ays0h"}]],f0=q("minus",d0);/**
248
+ * @license lucide-react v0.577.0 - ISC
249
+ *
250
+ * This source code is licensed under the ISC license.
251
+ * See the LICENSE file in the root directory of this source tree.
252
+ */const h0=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Rh=q("package",h0);/**
253
+ * @license lucide-react v0.577.0 - ISC
254
+ *
255
+ * This source code is licensed under the ISC license.
256
+ * See the LICENSE file in the root directory of this source tree.
257
+ */const p0=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Dh=q("pencil",p0);/**
258
+ * @license lucide-react v0.577.0 - ISC
259
+ *
260
+ * This source code is licensed under the ISC license.
261
+ * See the LICENSE file in the root directory of this source tree.
262
+ */const m0=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],hi=q("play",m0);/**
263
+ * @license lucide-react v0.577.0 - ISC
264
+ *
265
+ * This source code is licensed under the ISC license.
266
+ * See the LICENSE file in the root directory of this source tree.
267
+ */const g0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],In=q("plus",g0);/**
268
+ * @license lucide-react v0.577.0 - ISC
269
+ *
270
+ * This source code is licensed under the ISC license.
271
+ * See the LICENSE file in the root directory of this source tree.
272
+ */const x0=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],aa=q("puzzle",x0);/**
273
+ * @license lucide-react v0.577.0 - ISC
274
+ *
275
+ * This source code is licensed under the ISC license.
276
+ * See the LICENSE file in the root directory of this source tree.
277
+ */const y0=[["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"}]],b0=q("refresh-cw",y0);/**
278
+ * @license lucide-react v0.577.0 - ISC
279
+ *
280
+ * This source code is licensed under the ISC license.
281
+ * See the LICENSE file in the root directory of this source tree.
282
+ */const v0=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],la=q("rocket",v0);/**
283
+ * @license lucide-react v0.577.0 - ISC
284
+ *
285
+ * This source code is licensed under the ISC license.
286
+ * See the LICENSE file in the root directory of this source tree.
287
+ */const w0=[["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"}]],k0=q("rotate-ccw",w0);/**
288
+ * @license lucide-react v0.577.0 - ISC
289
+ *
290
+ * This source code is licensed under the ISC license.
291
+ * See the LICENSE file in the root directory of this source tree.
292
+ */const j0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],Oh=q("rows-3",j0);/**
293
+ * @license lucide-react v0.577.0 - ISC
294
+ *
295
+ * This source code is licensed under the ISC license.
296
+ * See the LICENSE file in the root directory of this source tree.
297
+ */const S0=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],N0=q("save",S0);/**
298
+ * @license lucide-react v0.577.0 - ISC
299
+ *
300
+ * This source code is licensed under the ISC license.
301
+ * See the LICENSE file in the root directory of this source tree.
302
+ */const C0=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],E0=q("search",C0);/**
303
+ * @license lucide-react v0.577.0 - ISC
304
+ *
305
+ * This source code is licensed under the ISC license.
306
+ * See the LICENSE file in the root directory of this source tree.
307
+ */const T0=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Lh=q("settings",T0);/**
308
+ * @license lucide-react v0.577.0 - ISC
309
+ *
310
+ * This source code is licensed under the ISC license.
311
+ * See the LICENSE file in the root directory of this source tree.
312
+ */const A0=[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Ih=q("shield-alert",A0);/**
313
+ * @license lucide-react v0.577.0 - ISC
314
+ *
315
+ * This source code is licensed under the ISC license.
316
+ * See the LICENSE file in the root directory of this source tree.
317
+ */const P0=[["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:"m9 12 2 2 4-4",key:"dzmm74"}]],al=q("shield-check",P0);/**
318
+ * @license lucide-react v0.577.0 - ISC
319
+ *
320
+ * This source code is licensed under the ISC license.
321
+ * See the LICENSE file in the root directory of this source tree.
322
+ */const M0=[["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"}]],ll=q("shield",M0);/**
323
+ * @license lucide-react v0.577.0 - ISC
324
+ *
325
+ * This source code is licensed under the ISC license.
326
+ * See the LICENSE file in the root directory of this source tree.
327
+ */const _0=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],R0=q("sliders-horizontal",_0);/**
328
+ * @license lucide-react v0.577.0 - ISC
329
+ *
330
+ * This source code is licensed under the ISC license.
331
+ * See the LICENSE file in the root directory of this source tree.
332
+ */const D0=[["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"}]],cl=q("sparkles",D0);/**
333
+ * @license lucide-react v0.577.0 - ISC
334
+ *
335
+ * This source code is licensed under the ISC license.
336
+ * See the LICENSE file in the root directory of this source tree.
337
+ */const O0=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],L0=q("star",O0);/**
338
+ * @license lucide-react v0.577.0 - ISC
339
+ *
340
+ * This source code is licensed under the ISC license.
341
+ * See the LICENSE file in the root directory of this source tree.
342
+ */const I0=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ut=q("terminal",I0);/**
343
+ * @license lucide-react v0.577.0 - ISC
344
+ *
345
+ * This source code is licensed under the ISC license.
346
+ * See the LICENSE file in the root directory of this source tree.
347
+ */const F0=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],B0=q("timer",F0);/**
348
+ * @license lucide-react v0.577.0 - ISC
349
+ *
350
+ * This source code is licensed under the ISC license.
351
+ * See the LICENSE file in the root directory of this source tree.
352
+ */const z0=[["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"}]],Ii=q("trash-2",z0);/**
353
+ * @license lucide-react v0.577.0 - ISC
354
+ *
355
+ * This source code is licensed under the ISC license.
356
+ * See the LICENSE file in the root directory of this source tree.
357
+ */const V0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],wn=q("triangle-alert",V0);/**
358
+ * @license lucide-react v0.577.0 - ISC
359
+ *
360
+ * This source code is licensed under the ISC license.
361
+ * See the LICENSE file in the root directory of this source tree.
362
+ */const $0=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],H0=q("undo-2",$0);/**
363
+ * @license lucide-react v0.577.0 - ISC
364
+ *
365
+ * This source code is licensed under the ISC license.
366
+ * See the LICENSE file in the root directory of this source tree.
367
+ */const U0=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],W0=q("workflow",U0);/**
368
+ * @license lucide-react v0.577.0 - ISC
369
+ *
370
+ * This source code is licensed under the ISC license.
371
+ * See the LICENSE file in the root directory of this source tree.
372
+ */const q0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],mt=q("x",q0);/**
373
+ * @license lucide-react v0.577.0 - ISC
374
+ *
375
+ * This source code is licensed under the ISC license.
376
+ * See the LICENSE file in the root directory of this source tree.
377
+ */const G0=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fi=q("zap",G0);class Fh extends m.Component{constructor(){super(...arguments);Mt(this,"state",{hasError:!1,error:null});Mt(this,"handleReload",()=>{this.setState({hasError:!1,error:null})})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("[ErrorBoundary]",n,r.componentStack)}render(){var n;return this.state.hasError?a.jsx("div",{className:"flex h-full items-center justify-center p-8",children:a.jsxs("div",{className:"flex max-w-md flex-col items-center gap-4 text-center",children:[a.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:a.jsx(wn,{className:"h-6 w-6 text-destructive"})}),a.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:((n=this.state.error)==null?void 0:n.message)??"An unexpected error occurred."}),a.jsxs("button",{onClick:this.handleReload,className:"flex items-center gap-1.5 rounded bg-surface-light px-3 py-1.5 text-xs text-foreground transition-colors hover:bg-border",children:[a.jsx(k0,{className:"h-3.5 w-3.5"}),"Retry"]})]})}):this.props.children}}function kn(){return m.useEffect(()=>{document.documentElement.setAttribute("data-theme","neon-glass")},[]),{neonGlass:!0}}const qc={fontFamily:"Space Grotesk",fontScale:1.1,reduceMotion:!1,showBackgroundEffects:!0,showStatusBar:!0,compactMode:!1},ul="cc-settings",dl=[{family:"JetBrains Mono",category:"monospace",label:"JetBrains Mono"},{family:"Space Mono",category:"monospace",label:"Space Mono"},{family:"Fira Code",category:"monospace",label:"Fira Code"},{family:"IBM Plex Mono",category:"monospace",label:"IBM Plex Mono"},{family:"Source Code Pro",category:"monospace",label:"Source Code Pro"},{family:"Space Grotesk",category:"sans-serif",label:"Space Grotesk"},{family:"Inter",category:"sans-serif",label:"Inter"},{family:"Outfit",category:"sans-serif",label:"Outfit"},{family:"Sora",category:"sans-serif",label:"Sora"},{family:"Orbitron",category:"display",label:"Orbitron"},{family:"Exo 2",category:"display",label:"Exo 2"}],lo="cc-dynamic-font",Gc="cc-font-previews";function K0(e){if(e==="JetBrains Mono"){const s=document.getElementById(lo);s&&s.remove();return}const n=`https://fonts.googleapis.com/css2?family=${e.replace(/ /g,"+")}:wght@300;400;500;600;700&display=swap`;let r=document.getElementById(lo);if(r){if(r.href===n)return;r.href=n}else r=document.createElement("link"),r.id=lo,r.rel="stylesheet",r.href=n,document.head.appendChild(r)}function Y0(){if(document.getElementById(Gc))return;const t=`https://fonts.googleapis.com/css2?${dl.filter(r=>r.family!=="JetBrains Mono").map(r=>`family=${r.family.replace(/ /g,"+")}:wght@400`).join("&")}&display=swap`,n=document.createElement("link");n.id=Gc,n.rel="stylesheet",n.href=t,document.head.appendChild(n)}function Kc(){try{const e=localStorage.getItem(ul);if(e)return{...qc,...JSON.parse(e)}}catch{}return{...qc}}function X0(e){try{localStorage.setItem(ul,JSON.stringify(e))}catch{}}function co(e){var r;const t=document.documentElement,n=((r=dl.find(s=>s.family===e.fontFamily))==null?void 0:r.category)==="monospace"?"monospace":"sans-serif";t.style.setProperty("--font-family",`'${e.fontFamily}', ${n}`),K0(e.fontFamily),t.style.setProperty("--font-scale",e.fontScale.toString()),e.reduceMotion?t.setAttribute("data-reduce-motion","true"):t.removeAttribute("data-reduce-motion"),e.compactMode?t.setAttribute("data-compact","true"):t.removeAttribute("data-compact")}const Bh=m.createContext(null);function J0({children:e}){const[t,n]=m.useState(Kc),r=m.useCallback((s,i)=>{n(o=>{const l={...o,[s]:i};return X0(l),co(l),l})},[]);return m.useEffect(()=>{co(t)},[]),m.useEffect(()=>{const s=i=>{if(i.key===ul){const o=Kc();n(o),co(o)}};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]),a.jsx(Bh.Provider,{value:{settings:t,updateSetting:r},children:e})}function fl(){const e=m.useContext(Bh);if(!e)throw new Error("useSettings must be used within a SettingsProvider");return e}const Tt=m.forwardRef(({className:e,children:t,orientation:n="vertical",...r},s)=>a.jsxs(sh,{ref:s,className:I("relative overflow-hidden",e),...r,children:[a.jsx(qx,{className:"h-full w-full rounded-[inherit]",children:t}),(n==="vertical"||n==="both")&&a.jsx(ca,{orientation:"vertical"}),(n==="horizontal"||n==="both")&&a.jsx(ca,{orientation:"horizontal"}),a.jsx(Gx,{})]}));Tt.displayName=sh.displayName;const ca=m.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(ih,{ref:r,orientation:t,className:I("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-1.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-1.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(Kx,{className:"relative flex-1 rounded-full bg-border"})}));ca.displayName=ih.displayName;const Wt=Object.create(null);Wt.open="0";Wt.close="1";Wt.ping="2";Wt.pong="3";Wt.message="4";Wt.upgrade="5";Wt.noop="6";const ei=Object.create(null);Object.keys(Wt).forEach(e=>{ei[Wt[e]]=e});const ua={type:"error",data:"parser error"},zh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Vh=typeof ArrayBuffer=="function",$h=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,hl=({type:e,data:t},n,r)=>zh&&t instanceof Blob?n?r(t):Yc(t,r):Vh&&(t instanceof ArrayBuffer||$h(t))?n?r(t):Yc(new Blob([t]),r):r(Wt[e]+(t||"")),Yc=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function Xc(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let uo;function Q0(e,t){if(zh&&e.data instanceof Blob)return e.data.arrayBuffer().then(Xc).then(t);if(Vh&&(e.data instanceof ArrayBuffer||$h(e.data)))return t(Xc(e.data));hl(e,!1,n=>{uo||(uo=new TextEncoder),t(uo.encode(n))})}const Jc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Jc.length;e++)Hr[Jc.charCodeAt(e)]=e;const Z0=e=>{let t=e.length*.75,n=e.length,r,s=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(r=0;r<n;r+=4)i=Hr[e.charCodeAt(r)],o=Hr[e.charCodeAt(r+1)],l=Hr[e.charCodeAt(r+2)],c=Hr[e.charCodeAt(r+3)],d[s++]=i<<2|o>>4,d[s++]=(o&15)<<4|l>>2,d[s++]=(l&3)<<6|c&63;return u},ev=typeof ArrayBuffer=="function",pl=(e,t)=>{if(typeof e!="string")return{type:"message",data:Hh(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:tv(e.substring(1),t)}:ei[n]?e.length>1?{type:ei[n],data:e.substring(1)}:{type:ei[n]}:ua},tv=(e,t)=>{if(ev){const n=Z0(e);return Hh(n,t)}else return{base64:!0,data:e}},Hh=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Uh="",nv=(e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((i,o)=>{hl(i,!1,l=>{r[o]=l,++s===n&&t(r.join(Uh))})})},rv=(e,t)=>{const n=e.split(Uh),r=[];for(let s=0;s<n.length;s++){const i=pl(n[s],t);if(r.push(i),i.type==="error")break}return r};function sv(){return new TransformStream({transform(e,t){Q0(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let fo;function Ls(e){return e.reduce((t,n)=>t+n.length,0)}function Is(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function iv(e,t){fo||(fo=new TextDecoder);const n=[];let r=0,s=-1,i=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(r===0){if(Ls(n)<1)break;const c=Is(n,1);i=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(Ls(n)<2)break;const c=Is(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Ls(n)<8)break;const c=Is(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(ua);break}s=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Ls(n)<s)break;const c=Is(n,s);l.enqueue(pl(i?c:fo.decode(c),t)),r=0}if(s===0||s>e){l.enqueue(ua);break}}}})}const Wh=4;function $e(e){if(e)return ov(e)}function ov(e){for(var t in $e.prototype)e[t]=$e.prototype[t];return e}$e.prototype.on=$e.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};$e.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};$e.prototype.off=$e.prototype.removeListener=$e.prototype.removeAllListeners=$e.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,s=0;s<n.length;s++)if(r=n[s],r===t||r.fn===t){n.splice(s,1);break}return n.length===0&&delete this._callbacks["$"+e],this};$e.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,s=n.length;r<s;++r)n[r].apply(this,t)}return this};$e.prototype.emitReserved=$e.prototype.emit;$e.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};$e.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Bi=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Nt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),av="arraybuffer";function qh(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const lv=Nt.setTimeout,cv=Nt.clearTimeout;function zi(e,t){t.useNativeTimers?(e.setTimeoutFn=lv.bind(Nt),e.clearTimeoutFn=cv.bind(Nt)):(e.setTimeoutFn=Nt.setTimeout.bind(Nt),e.clearTimeoutFn=Nt.clearTimeout.bind(Nt))}const uv=1.33;function dv(e){return typeof e=="string"?fv(e):Math.ceil((e.byteLength||e.size)*uv)}function fv(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function Gh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function hv(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function pv(e){let t={},n=e.split("&");for(let r=0,s=n.length;r<s;r++){let i=n[r].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class mv extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class ml extends $e{constructor(t){super(),this.writable=!1,zi(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new mv(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=pl(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=hv(t);return n.length?"?"+n:""}}class gv extends ml{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};rv(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,nv(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Gh()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Kh=!1;try{Kh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const xv=Kh;function yv(){}class bv extends gv{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Vt extends $e{constructor(t,n,r){super(),this.createRequest=t,zi(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=qh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=Vt.requestsCount++,Vt.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=yv,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Vt.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Vt.requestsCount=0;Vt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Qc);else if(typeof addEventListener=="function"){const e="onpagehide"in Nt?"pagehide":"unload";addEventListener(e,Qc,!1)}}function Qc(){for(let e in Vt.requests)Vt.requests.hasOwnProperty(e)&&Vt.requests[e].abort()}const vv=(function(){const e=Yh({xdomain:!1});return e&&e.responseType!==null})();class wv extends bv{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=vv&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Vt(Yh,this.uri(),t)}}function Yh(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||xv))return new XMLHttpRequest}catch{}if(!t)try{return new Nt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Xh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class kv extends ml{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=Xh?{}:qh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;hl(r,this.supportsBinary,i=>{try{this.doWrite(r,i)}catch{}s&&Bi(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Gh()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const ho=Nt.WebSocket||Nt.MozWebSocket;class jv extends kv{createSocket(t,n,r){return Xh?new ho(t,n,r):n?new ho(t,n):new ho(t)}doWrite(t,n){this.ws.send(n)}}class Sv extends ml{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=iv(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),s=sv();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();const i=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),i())}).catch(l=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],s=n===t.length-1;this._writer.write(r).then(()=>{s&&Bi(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Nv={websocket:jv,webtransport:Sv,polling:wv},Cv=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ev=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function da(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=Cv.exec(e||""),i={},o=14;for(;o--;)i[Ev[o]]=s[o]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Tv(i,i.path),i.queryKey=Av(i,i.query),i}function Tv(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Av(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(n[s]=i)}),n}const fa=typeof addEventListener=="function"&&typeof removeEventListener=="function",ti=[];fa&&addEventListener("offline",()=>{ti.forEach(e=>e())},!1);class pn extends $e{constructor(t,n){if(super(),this.binaryType=av,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=da(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=da(n.host).host);zi(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=pv(this.opts.query)),fa&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ti.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Wh,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&pn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",pn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(n+=dv(s)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Bi(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(pn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),fa&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=ti.indexOf(this._offlineEventListener);r!==-1&&ti.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}pn.protocol=Wh;class Pv extends pn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;pn.priorWebsocketSuccess=!1;const s=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;pn.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function i(){r||(r=!0,d(),n.close(),n=null)}const o=f=>{const h=new Error("probe error: "+f);h.transport=n.name,i(),this.emitReserved("upgradeError",h)};function l(){o("transport closed")}function c(){o("socket closed")}function u(f){n&&f.name!==n.name&&i()}const d=()=>{n.removeListener("open",s),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};n.once("open",s),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Mv=class extends Pv{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(s=>Nv[s]).filter(s=>!!s)),super(t,r)}};function _v(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=da(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const Rv=typeof ArrayBuffer=="function",Dv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Jh=Object.prototype.toString,Ov=typeof Blob=="function"||typeof Blob<"u"&&Jh.call(Blob)==="[object BlobConstructor]",Lv=typeof File=="function"||typeof File<"u"&&Jh.call(File)==="[object FileConstructor]";function gl(e){return Rv&&(e instanceof ArrayBuffer||Dv(e))||Ov&&e instanceof Blob||Lv&&e instanceof File}function ni(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(ni(e[n]))return!0;return!1}if(gl(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ni(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ni(e[n]))return!0;return!1}function Iv(e){const t=[],n=e.data,r=e;return r.data=ha(n,t),r.attachments=t.length,{packet:r,buffers:t}}function ha(e,t){if(!e)return e;if(gl(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=ha(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=ha(e[r],t));return n}return e}function Fv(e,t){return e.data=pa(e.data,t),delete e.attachments,e}function pa(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=pa(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=pa(e[n],t));return e}const Bv=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var pe;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(pe||(pe={}));class zv{constructor(t){this.replacer=t}encode(t){return(t.type===pe.EVENT||t.type===pe.ACK)&&ni(t)?this.encodeAsBinary({type:t.type===pe.EVENT?pe.BINARY_EVENT:pe.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===pe.BINARY_EVENT||t.type===pe.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Iv(t),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}}class xl extends $e{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===pe.BINARY_EVENT;r||n.type===pe.BINARY_ACK?(n.type=r?pe.EVENT:pe.ACK,this.reconstructor=new Vv(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(gl(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(pe[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===pe.BINARY_EVENT||r.type===pe.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(i,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");const l=Number(o);if(!$v(l)||l<0)throw new Error("Illegal attachments");if(l>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=l}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(i,n)}else r.nsp="/";const s=t.charAt(n+1);if(s!==""&&Number(s)==s){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}r.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(xl.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case pe.CONNECT:return Zc(n);case pe.DISCONNECT:return n===void 0;case pe.CONNECT_ERROR:return typeof n=="string"||Zc(n);case pe.EVENT:case pe.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Bv.indexOf(n[0])===-1);case pe.ACK:case pe.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Vv{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=Fv(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const $v=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function Zc(e){return Object.prototype.toString.call(e)==="[object Object]"}const Hv=Object.freeze(Object.defineProperty({__proto__:null,Decoder:xl,Encoder:zv,get PacketType(){return pe}},Symbol.toStringTag,{value:"Module"}));function Rt(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Uv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Qh extends $e{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Rt(t,"open",this.onopen.bind(this)),Rt(t,"packet",this.onpacket.bind(this)),Rt(t,"error",this.onerror.bind(this)),Rt(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,s,i;if(Uv.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:pe.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,f=n.pop();this._registerAckCallback(d,f),o.id=d}const l=(s=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},s),o=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,s)=>{const i=(o,l)=>o?s(o):r(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...i)=>(this._queue[0],s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(s)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:pe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case pe.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case pe.EVENT:case pe.BINARY_EVENT:this.onevent(t);break;case pe.ACK:case pe.BINARY_ACK:this.onack(t);break;case pe.DISCONNECT:this.ondisconnect();break;case pe.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...s){r||(r=!0,n.packet({type:pe.ACK,id:t,data:s}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:pe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function gr(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}gr.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};gr.prototype.reset=function(){this.attempts=0};gr.prototype.setMin=function(e){this.ms=e};gr.prototype.setMax=function(e){this.max=e};gr.prototype.setJitter=function(e){this.jitter=e};class ma extends $e{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,zi(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new gr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const s=n.parser||Hv;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Mv(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Rt(n,"open",function(){r.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=Rt(n,"error",i);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Rt(t,"ping",this.onping.bind(this)),Rt(t,"data",this.ondata.bind(this)),Rt(t,"error",this.onerror.bind(this)),Rt(t,"close",this.onclose.bind(this)),Rt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Bi(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new Qh(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Rr={};function ri(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=_v(e,t.path||"/socket.io"),r=n.source,s=n.id,i=n.path,o=Rr[s]&&i in Rr[s].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new ma(r,t):(Rr[s]||(Rr[s]=new ma(r,t)),c=Rr[s]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(ri,{Manager:ma,Socket:Qh,io:ri,connect:ri});const Z=ri({autoConnect:!0,reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:1/0,reconnectionDelayMax:1e4});function jn(e){m.useEffect(()=>(Z.on("connect",e),()=>{Z.off("connect",e)}),[e]),m.useEffect(()=>{function t(){document.visibilityState==="visible"&&e()}return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[e])}function yl(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),o=m.useCallback(async()=>{try{const l=await fetch("/api/orbital/scopes");if(!l.ok)throw new Error(`HTTP ${l.status}`);const c=await l.json();t(c),i(null)}catch(l){i(l instanceof Error?l.message:"Failed to fetch scopes")}finally{r(!1)}},[]);return m.useEffect(()=>{o()},[o]),jn(o),m.useEffect(()=>{function l(d){t(f=>{const h=f.findIndex(p=>p.id===d.id);if(h>=0){const p=[...f];return p[h]=d,p}return[...f,d].sort((p,g)=>p.id-g.id)})}function c(d){t(f=>[...f,d].sort((h,p)=>h.id-p.id))}function u(d){t(f=>f.filter(h=>h.id!==d))}return Z.on("scope:updated",l),Z.on("scope:created",c),Z.on("scope:deleted",u),Z.on("workflow:changed",o),()=>{Z.off("scope:updated",l),Z.off("scope:created",c),Z.off("scope:deleted",u),Z.off("workflow:changed",o)}},[o]),{scopes:e,loading:n,error:s,refetch:o}}function Zh(e){if(typeof e!="object"||e===null)return!1;const t=e;return t.version===1&&typeof t.name=="string"&&Array.isArray(t.lists)&&Array.isArray(t.edges)&&t.lists.every(Wv)&&t.edges.every(Gv)&&(t.branchingMode===void 0||t.branchingMode==="trunk"||t.branchingMode==="worktree")}function Wv(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.label=="string"&&typeof t.order=="number"&&typeof t.color=="string"&&typeof t.hex=="string"&&typeof t.hasDirectory=="boolean"}const qv={guard:"blocker",gate:"advisor",lifecycle:"operator",observer:"silent"};function ep(e){return qv[e.category]}function Gv(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.from=="string"&&typeof t.to=="string"&&typeof t.direction=="string"&&typeof t.label=="string"&&typeof t.description=="string"}class tp{constructor(t){Mt(this,"config");Mt(this,"listMap");Mt(this,"edgeMap");Mt(this,"edgesByFrom");Mt(this,"statusOrder");Mt(this,"hookMap");Mt(this,"terminalStatuses");Mt(this,"allowedPrefixes");this.init(t)}reload(t){this.init(t)}init(t){if(this.config=t,!t.lists.length)throw new Error("WorkflowConfig must have at least 1 list");if(!t.edges.length)throw new Error("WorkflowConfig must have at least 1 edge");const n=t.lists.filter(r=>r.isEntryPoint);if(n.length!==1)throw new Error(`WorkflowConfig must have exactly 1 entry point, found ${n.length}`);this.listMap=new Map(t.lists.map(r=>[r.id,r])),this.edgeMap=new Map(t.edges.map(r=>[`${r.from}:${r.to}`,r])),this.edgesByFrom=new Map;for(const r of t.edges){const s=this.edgesByFrom.get(r.from);s?s.push(r):this.edgesByFrom.set(r.from,[r])}this.statusOrder=new Map(t.lists.map(r=>[r.id,r.order])),this.hookMap=new Map((t.hooks??[]).map(r=>[r.id,r])),this.terminalStatuses=new Set(t.terminalStatuses??[]),this.allowedPrefixes=t.allowedCommandPrefixes??[]}getConfig(){return this.config}getBranchingMode(){return this.config.branchingMode??"trunk"}getLists(){return[...this.config.lists].sort((t,n)=>t.order-n.order)}getList(t){return this.listMap.get(t)}getEntryPoint(){return this.config.lists.find(t=>t.isEntryPoint)}getBatchLists(){return this.config.lists.filter(t=>t.supportsBatch)}getSprintLists(){return this.config.lists.filter(t=>t.supportsSprint)}getBoardColumns(){return this.getLists().map(t=>({id:t.id,label:t.label,color:t.color}))}findEdge(t,n){return this.edgeMap.get(`${t}:${n}`)}isValidTransition(t,n){return this.edgeMap.has(`${t}:${n}`)}getValidTargets(t){return(this.edgesByFrom.get(t)??[]).map(n=>n.to)}getAllEdges(){return this.config.edges}getEdgesByDirection(t){return this.config.edges.filter(n=>n.direction===t)}validateTransition(t,n,r){if(!this.listMap.has(n))return{ok:!1,error:`Invalid status: '${n}'`,code:"INVALID_STATUS"};if(r==="bulk-sync"||r==="rollback")return{ok:!0};if(t===n)return{ok:!0};const s=this.findEdge(t,n);return s?r==="patch"&&s.dispatchOnly?{ok:!1,error:`Transition '${t}' -> '${n}' requires dispatch (use a skill command)`,code:"DISPATCH_REQUIRED"}:{ok:!0}:{ok:!1,error:`Transition '${t}' -> '${n}' is not allowed`,code:"INVALID_TRANSITION"}}isValidStatus(t){return this.listMap.has(t)}isTerminalStatus(t){return this.terminalStatuses.has(t)}buildCommand(t,n){return t.command?t.command.replace("{id}",String(n)):null}isAllowedCommand(t){return this.allowedPrefixes.some(n=>t.startsWith(n))}getBatchTargetStatus(t){const r=(this.edgesByFrom.get(t)??[]).find(s=>(s.direction==="forward"||s.direction==="shortcut")&&s.dispatchOnly);return r==null?void 0:r.to}getBatchCommand(t){const r=(this.edgesByFrom.get(t)??[]).find(s=>(s.direction==="forward"||s.direction==="shortcut")&&s.dispatchOnly);if(r!=null&&r.command)return r.command.replace(" {id}","").replace("{id}","")}inferStatus(t,n,r){var u;const s=(this.config.eventInference??[]).filter(d=>d.eventType===t);if(!s.length)return null;const i=s.filter(d=>d.conditions&&Object.keys(d.conditions).length>0),o=s.filter(d=>!d.conditions||Object.keys(d.conditions).length===0),l=i.find(d=>this.matchesConditions(d.conditions,r))??o[0]??null;if(!l)return null;if(((u=l.conditions)==null?void 0:u.dispatchResolution)===!0)return{dispatchResolution:!0,resolution:r.outcome==="failure"?"failed":"completed"};let c;if(l.targetStatus===""&&l.dataField){const d=String(r[l.dataField]??"");l.dataMap?c=l.dataMap[d]??l.dataMap._default??"":c=d}else c=l.targetStatus;if(!c)return null;if(l.forwardOnly){const d=this.statusOrder.get(n)??-1;if((this.statusOrder.get(c)??-1)<=d)return null}return c}matchesConditions(t,n){for(const[r,s]of Object.entries(t)){if(r==="dispatchResolution")continue;const i=n[r];if(Array.isArray(s)){if(!s.includes(i))return!1}else if(i!==s)return!1}return!0}getListByGitBranch(t){return this.config.lists.find(n=>n.gitBranch===t)}getGitBranch(t){var n;return(n=this.listMap.get(t))==null?void 0:n.gitBranch}getSessionKey(t){var n;return(n=this.listMap.get(t))==null?void 0:n.sessionKey}getActiveHooksForList(t){var n;return((n=this.listMap.get(t))==null?void 0:n.activeHooks)??[]}getAgentsForEdge(t,n){var r;return((r=this.findEdge(t,n))==null?void 0:r.agents)??[]}getStatusOrder(t){return this.statusOrder.get(t)??-1}isForwardMovement(t,n){return this.getStatusOrder(n)>this.getStatusOrder(t)}getHooksForEdge(t,n){var s;const r=this.findEdge(t,n);return(s=r==null?void 0:r.hooks)!=null&&s.length?r.hooks.map(i=>this.hookMap.get(i)).filter(i=>i!==void 0):[]}getAllHooks(){return this.config.hooks??[]}getHookEnforcement(t){return ep(t)}getHooksByCategory(t){return(this.config.hooks??[]).filter(n=>n.category===t)}generateCSSVariables(){return this.getLists().map(t=>`--status-${t.id}: ${t.color};`).join(`
378
+ `)}generateShellManifest(){const t=[],n=this.getLists();t.push("#!/bin/bash"),t.push("# Auto-generated by WorkflowEngine — DO NOT EDIT"),t.push(`# Generated: ${new Date().toISOString()}`),t.push(`# Workflow: "${this.config.name}" (version ${this.config.version})`),t.push(""),t.push("# ─── Branching mode (trunk or worktree) ───"),t.push(`WORKFLOW_BRANCHING_MODE="${this.getBranchingMode()}"`),t.push(""),t.push("# ─── Valid statuses (space-separated) ───"),t.push(`WORKFLOW_STATUSES="${n.map(s=>s.id).join(" ")}"`),t.push(""),t.push("# ─── Statuses that have a scopes/ subdirectory ───");const r=n.filter(s=>s.hasDirectory).map(s=>s.id);t.push(`WORKFLOW_DIR_STATUSES="${r.join(" ")}"`),t.push(""),t.push("# ─── Terminal statuses ───"),t.push(`WORKFLOW_TERMINAL_STATUSES="${[...this.terminalStatuses].join(" ")}"`),t.push(""),t.push("# ─── Entry point status ───"),t.push(`WORKFLOW_ENTRY_STATUS="${this.getEntryPoint().id}"`),t.push(""),t.push("# ─── Transition edges (from:to:sessionKey) ───"),t.push("WORKFLOW_EDGES=(");for(const s of this.config.edges){const i=this.listMap.get(s.to),o=(i==null?void 0:i.sessionKey)??"";t.push(` "${s.from}:${s.to}:${o}"`)}t.push(")"),t.push(""),t.push("# ─── Branch-to-transition mapping (gitBranch:from:to:sessionKey) ───"),t.push("WORKFLOW_BRANCH_MAP=(");for(const s of this.config.edges){const i=this.listMap.get(s.to);if(i!=null&&i.gitBranch){const o=i.sessionKey??"";t.push(` "${i.gitBranch}:${s.from}:${s.to}:${o}"`)}}t.push(")"),t.push(""),t.push("# ─── Commit session branch patterns (regex) ───"),t.push(`WORKFLOW_COMMIT_BRANCHES="${this.config.commitBranchPatterns??""}"`),t.push(""),t.push("# ─── Backward-compat direction aliases (alias:from:to:sessionKey) ───"),t.push("WORKFLOW_DIRECTION_ALIASES=(");for(const s of this.config.edges){if(s.direction!=="forward"||!s.dispatchOnly)continue;const i=this.listMap.get(s.to);if(!i)continue;if(i.group==="deployment"){const l=i.sessionKey??"";t.push(` "to-${s.to}:${s.from}:${s.to}:${l}"`)}}return t.push(")"),t.push(""),t.push("# ─── Helper functions ──────────────────────────────"),t.push(""),t.push("status_to_dir() {"),t.push(' local scope_status="$1"'),t.push(" for s in $WORKFLOW_DIR_STATUSES; do"),t.push(' [ "$s" = "$scope_status" ] && echo "$scope_status" && return 0'),t.push(" done"),t.push(' echo "$WORKFLOW_ENTRY_STATUS"'),t.push("}"),t.push(""),t.push("status_to_branch() {"),t.push(' local status="$1"'),t.push(' for entry in "${WORKFLOW_BRANCH_MAP[@]}"; do'),t.push(` IFS=':' read -r branch from to skey <<< "$entry"`),t.push(' [ "$to" = "$status" ] && echo "$branch" && return 0'),t.push(" done"),t.push(' echo ""'),t.push("}"),t.push(""),t.push("is_valid_status() {"),t.push(' local status="$1"'),t.push(" for s in $WORKFLOW_STATUSES; do"),t.push(' [ "$s" = "$status" ] && return 0'),t.push(" done"),t.push(" return 1"),t.push("}"),t.join(`
379
+ `)+`
380
+ `}}const np=m.createContext(null);function Kv({children:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!0),[i,o]=m.useState(null),l=m.useCallback(async()=>{const u=[500,1e3,2e3],d=new AbortController;for(let f=0;f<=3;f++)try{const h=await fetch("/api/orbital/workflow",{signal:d.signal});if(!h.ok)throw new Error(`Failed to load workflow: HTTP ${h.status}`);const p=await h.json(),g=p.data??p;if(!Zh(g))throw new Error("Invalid workflow config from server");n(new tp(g)),o(null),s(!1);return}catch(h){if(d.signal.aborted)return;if(f<3){await new Promise(p=>setTimeout(p,u[f]));continue}o(h instanceof Error?h.message:"Failed to load workflow"),s(!1)}},[]);return m.useEffect(()=>{l()},[l]),m.useEffect(()=>{const c=()=>{l()};return Z.on("workflow:changed",c),()=>{Z.off("workflow:changed",c)}},[l]),m.useEffect(()=>{const c=()=>{s(!0),l()};return Z.on("connect",c),()=>{Z.off("connect",c)}},[l]),m.useEffect(()=>{if(!t)return;const c=t.generateCSSVariables();for(const u of c.split(`
381
+ `)){const d=u.match(/^(--[\w-]+):\s*(.+);$/);d&&document.documentElement.style.setProperty(d[1],d[2])}},[t]),r?a.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading workflow..."})]})}):i||!t?a.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-sm text-center",children:[a.jsx("span",{className:"text-sm text-destructive",children:"Workflow Error"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:i??"Unknown error"}),a.jsx("button",{onClick:()=>{s(!0),l()},className:"mt-2 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90",children:"Retry"})]})}):a.jsx(np.Provider,{value:{engine:t},children:e})}function wt(){const e=m.useContext(np);if(!e)throw new Error("useWorkflow must be used within a WorkflowProvider");return e}const eu=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,tu=yh,rp=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return tu(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],f=i==null?void 0:i[u];if(d===null)return null;const h=eu(d)||eu(f);return s[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[x,b]=g;return Array.isArray(b)?b.includes({...i,...l}[x]):{...i,...l}[x]===b})?[...u,f,h]:u},[]);return tu(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Yv=rp("inline-flex items-center rounded border px-1.5 py-0.5 text-xxs font-normal transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-[#00c85322] text-[#00c853] glow-green",warning:"border-transparent bg-[#ffab0022] text-[#ffab00] glow-amber",error:"border-transparent bg-[#ff174422] text-[#ff1744] glow-red"}},defaultVariants:{variant:"default"}});function Q({className:e,variant:t,...n}){return a.jsx("div",{className:I(Yv({variant:t}),e),...n})}function Xv(e){const t=Jv(e),n=m.forwardRef((r,s)=>{const{children:i,...o}=r,l=m.Children.toArray(i),c=l.find(Zv);if(c){const u=c.props.children,d=l.map(f=>f===c?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...o,ref:s,children:m.isValidElement(u)?m.cloneElement(u,void 0,d):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}function Jv(e){const t=m.forwardRef((n,r)=>{const{children:s,...i}=n;if(m.isValidElement(s)){const o=tw(s),l=ew(i,s.props);return s.type!==m.Fragment&&(l.ref=r?oh(r,o):o),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Qv=Symbol("radix.slottable");function Zv(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Qv}function ew(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function tw(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vi="Popover",[sp]=Qx(Vi,[ch]),bs=ch(),[nw,Sn]=sp(Vi),ip=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,l=bs(t),c=m.useRef(null),[u,d]=m.useState(!1),[f,h]=ry({prop:r,defaultProp:s??!1,onChange:i,caller:Vi});return a.jsx(sy,{...l,children:a.jsx(nw,{scope:t,contentId:iy(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:m.useCallback(()=>d(!0),[]),onCustomAnchorRemove:m.useCallback(()=>d(!1),[]),modal:o,children:n})})};ip.displayName=Vi;var op="PopoverAnchor",rw=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Sn(op,n),i=bs(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return m.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(dh,{...i,...r,ref:t})});rw.displayName=op;var ap="PopoverTrigger",lp=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Sn(ap,n),i=bs(n),o=lh(t,s.triggerRef),l=a.jsx(uh.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":hp(s.open),...r,ref:o,onClick:Gr(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(dh,{asChild:!0,...i,children:l})});lp.displayName=ap;var bl="PopoverPortal",[sw,iw]=sp(bl,{forceMount:void 0}),cp=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=Sn(bl,t);return a.jsx(sw,{scope:t,forceMount:n,children:a.jsx(ah,{present:n||i.open,children:a.jsx(Yx,{asChild:!0,container:s,children:r})})})};cp.displayName=bl;var lr="PopoverContent",up=m.forwardRef((e,t)=>{const n=iw(lr,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=Sn(lr,e.__scopePopover);return a.jsx(ah,{present:r||i.open,children:i.modal?a.jsx(aw,{...s,ref:t}):a.jsx(lw,{...s,ref:t})})});up.displayName=lr;var ow=Xv("PopoverContent.RemoveScroll"),aw=m.forwardRef((e,t)=>{const n=Sn(lr,e.__scopePopover),r=m.useRef(null),s=lh(t,r),i=m.useRef(!1);return m.useEffect(()=>{const o=r.current;if(o)return Xx(o)},[]),a.jsx(Jx,{as:ow,allowPinchZoom:!0,children:a.jsx(dp,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gr(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Gr(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Gr(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),lw=m.forwardRef((e,t)=>{const n=Sn(lr,e.__scopePopover),r=m.useRef(!1),s=m.useRef(!1);return a.jsx(dp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),dp=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,h=Sn(lr,n),p=bs(n);return Zx(),a.jsx(ey,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(ty,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:a.jsx(ny,{"data-state":hp(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),fp="PopoverClose",cw=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Sn(fp,n);return a.jsx(uh.button,{type:"button",...r,ref:t,onClick:Gr(e.onClick,()=>s.onOpenChange(!1))})});cw.displayName=fp;var uw="PopoverArrow",dw=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=bs(n);return a.jsx(oy,{...s,...r,ref:t})});dw.displayName=uw;function hp(e){return e?"open":"closed"}var fw=ip,hw=lp,pw=cp,pp=up;const xr=fw,yr=hw,Vn=m.forwardRef(({className:e,align:t="start",sideOffset:n=4,...r},s)=>a.jsx(pw,{children:a.jsx(pp,{ref:s,align:t,sideOffset:n,className:I("z-50 min-w-[180px] rounded border border-border bg-popover p-2 text-popover-foreground shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2","data-[side=top]:slide-in-from-bottom-2",e),...r})}));Vn.displayName=pp.displayName;function mw(){const[e,t]=m.useState(null),[n,r]=m.useState(!1),[s,i]=m.useState(0),[o,l]=m.useState("idle"),[c,u]=m.useState(null),[d,f]=m.useState(!0),h=m.useCallback(async()=>{try{const b=await fetch("/api/orbital/version");if(!b.ok)throw new Error(`HTTP ${b.status}`);const y=await b.json();t(y)}catch{}finally{f(!1)}},[]),p=m.useCallback(async()=>{const b=await fetch("/api/orbital/version/check");if(!b.ok)throw new Error(`HTTP ${b.status}`);const y=await b.json();r(y.updateAvailable),i(y.behindCount)},[]);m.useEffect(()=>{h()},[]),jn(h),m.useEffect(()=>{const b=setInterval(async()=>{try{await p()}catch{}},3e5);return()=>clearInterval(b)},[]),m.useEffect(()=>{function b(j){l(j.stage)}function y(j){j.success?(l("done"),r(!1),i(0),h()):(l("error"),u(j.error??"Unknown error"))}return Z.on("version:updating",b),Z.on("version:updated",y),()=>{Z.off("version:updating",b),Z.off("version:updated",y)}},[]);const g=m.useCallback(async()=>{l("checking"),u(null);try{await p(),l("idle")}catch(b){l("error"),u(b.message)}},[p]),x=m.useCallback(async()=>{l("pulling"),u(null);try{const b=await fetch("/api/orbital/version/update",{method:"POST",headers:{"X-Orbital-Action":"update"}});if(!b.ok){const j=await b.json().catch(()=>({error:`HTTP ${b.status}`}));l("error"),u(j.error??"Update failed");return}const y=await b.json().catch(()=>null);y!=null&&y.success&&(l("done"),r(!1),i(0),h())}catch(b){l("error"),u(b.message)}},[h]);return{version:e,updateAvailable:n,behindCount:s,updateStage:o,updateError:c,loading:d,checkForUpdate:g,performUpdate:x}}function gw(){const{version:e,updateAvailable:t,behindCount:n,updateStage:r,updateError:s,loading:i,checkForUpdate:o,performUpdate:l}=mw();if(i)return null;if(!e)return a.jsx("button",{className:"version-badge flex items-center gap-1.5 rounded-lg px-2 py-1 text-[10px] font-mono text-muted-foreground/50",children:a.jsx("span",{children:"v?"})});const c=r==="checking"||r==="pulling"||r==="installing";return a.jsxs(xr,{children:[a.jsx(yr,{asChild:!0,children:a.jsxs("button",{className:"relative cursor-pointer",children:[a.jsxs(Q,{variant:t?"warning":"success",className:"version-badge font-mono text-[10px] transition-colors",children:["v",e.version]}),t&&a.jsx("span",{className:"version-pulse-dot absolute -top-1 -right-1 h-2 w-2 rounded-full bg-emerald-400"})]})}),a.jsx(Vn,{side:"top",align:"end",sideOffset:8,className:"w-64 filter-popover-glass",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs font-medium text-foreground",children:"Orbital Command"}),a.jsxs(Q,{variant:"outline",className:"font-mono text-[10px]",children:["v",e.version]})]}),a.jsxs("div",{className:"space-y-1.5 text-[11px] text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(oa,{className:"h-3 w-3"}),a.jsx("span",{className:"font-mono",children:e.commitSha})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(xn,{className:"h-3 w-3"}),a.jsx("span",{className:"font-mono",children:e.branch})]})]}),t&&r!=="done"&&a.jsxs("div",{className:"rounded-md border border-emerald-500/20 bg-emerald-500/5 px-2 py-1.5 text-[11px] text-emerald-400",children:[n," commit",n!==1?"s":""," behind remote"]}),r==="done"&&a.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-emerald-500/20 bg-emerald-500/5 px-2 py-1.5 text-[11px] text-emerald-400",children:[a.jsx(sl,{className:"h-3 w-3"}),"Updated. Restart server to apply."]}),r==="error"&&a.jsxs("div",{className:"flex items-start gap-1.5 rounded-md border border-destructive/20 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive",children:[a.jsx(Ch,{className:"h-3 w-3 mt-0.5 shrink-0"}),a.jsx("span",{children:s??"An unknown error occurred"})]}),c&&a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx(Li,{className:"h-3 w-3 animate-spin"}),a.jsxs("span",{children:[r==="checking"&&"Checking for updates...",r==="pulling"&&"Pulling latest changes...",r==="installing"&&"Installing dependencies..."]})]}),a.jsxs("div",{className:"flex gap-2 pt-1",children:[a.jsxs("button",{onClick:o,disabled:c,className:I("flex flex-1 items-center justify-center gap-1.5 rounded-md border border-border px-2 py-1 text-[11px]","text-muted-foreground hover:text-foreground hover:bg-surface-light transition-colors","disabled:opacity-40 disabled:cursor-not-allowed"),children:[a.jsx(b0,{className:I("h-3 w-3",r==="checking"&&"animate-spin")}),"Check"]}),t&&r!=="done"&&a.jsxs("button",{onClick:l,disabled:c,className:I("flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-[11px]","bg-emerald-500/10 border border-emerald-500/20 text-emerald-400","hover:bg-emerald-500/20 transition-colors","disabled:opacity-40 disabled:cursor-not-allowed"),children:[a.jsx(Ib,{className:"h-3 w-3"}),"Update"]})]})]})})]})}function xw(){const{scopes:e}=yl(),{engine:t}=wt();kn();const n=py(),r=m.useMemo(()=>t.getBoardColumns(),[t]),s=m.useMemo(()=>t.getEntryPoint().id,[t]),i=m.useMemo(()=>{const f=new Map;return r.forEach((h,p)=>f.set(h.id,p)),f},[r]),o=m.useMemo(()=>{const f=new Map;for(const h of r)f.set(h.id,h.color);return f},[r]),{inProgress:l,needsAttention:c}=m.useMemo(()=>{const f=[],h=[];for(const p of e)p.status!==s&&(t.isTerminalStatus(p.status)||(p.blocked_by.length>0?h.push(p):f.push(p)));return{inProgress:ru(f,i),needsAttention:ru(h,i)}},[e,s,t,i]),u=(f,h)=>{f.stopPropagation(),n(`/?highlight=${h}`)},d=l.size>0||c.size>0;return a.jsx("div",{className:I("fixed bottom-0 left-24 right-0 z-40 border-t border-border bg-surface/95 backdrop-blur-sm","ticker-glass"),children:a.jsxs("div",{className:"flex items-center px-4 py-2",children:[d&&a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-4 overflow-x-auto",children:[l.size>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"flex-shrink-0 text-xxs uppercase tracking-wider font-normal text-muted-foreground",children:"In Progress"}),a.jsx(nu,{groups:l,colorMap:o,onClick:u})]}),l.size>0&&c.size>0&&a.jsx("div",{className:"h-4 w-px flex-shrink-0 bg-border"}),c.size>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"flex-shrink-0 text-xxs uppercase tracking-wider font-normal text-warning-amber",children:"Needs Attention"}),a.jsx(nu,{groups:c,colorMap:o,onClick:u})]})]}),!d&&a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex-shrink-0 ml-4",children:a.jsx(gw,{})})]})})}function nu({groups:e,colorMap:t,onClick:n}){return a.jsx(a.Fragment,{children:Array.from(e.entries()).map(([r,s])=>{const i=t.get(r)??"220 70% 50%",o=yw(i);return s.map(l=>a.jsxs("button",{onClick:c=>n(c,l.id),className:"flex flex-shrink-0 items-center gap-1.5 rounded-md border px-2 py-0.5 text-xxs transition-colors hover:brightness-125 cursor-pointer",style:{backgroundColor:`${o}15`,borderColor:`${o}40`},children:[a.jsx("span",{className:"h-2 w-2 rounded-full flex-shrink-0",style:{backgroundColor:`hsl(${i})`}}),a.jsxs("span",{className:"max-w-[120px] truncate",children:[dt(l.id)," ",l.title]})]},l.id))})})}function ru(e,t){const n=new Map;for(const r of e){const s=n.get(r.status);s?s.push(r):n.set(r.status,[r])}return new Map(Array.from(n.entries()).sort(([r],[s])=>(t.get(r)??999)-(t.get(s)??999)))}function yw(e){const t=e.match(/[\d.]+/g);if(!t||t.length<3)return"#888888";const n=parseFloat(t[0]),r=parseFloat(t[1])/100,s=parseFloat(t[2])/100,i=r*Math.min(s,1-s),o=l=>{const c=(l+n/30)%12,u=s-i*Math.max(Math.min(c-3,9-c,1),-1);return Math.round(255*u).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}const Fs=28,su=1,bw="rgba(255, 255, 255, 0.12)",vw="rgba(255, 255, 255, 0.35)",po=180,ww=14,iu={x:-9999,y:-9999};function kw(){const e=m.useRef(null),t=m.useRef(iu),n=m.useRef(!1),r=m.useRef(0);return m.useEffect(()=>{const s=e.current;if(!s)return;const i=s.getContext("2d");if(!i)return;function o(){if(n.current=!1,!i||!s)return;i.clearRect(0,0,s.width,s.height);const f=t.current.x,h=t.current.y,p=po*po,g=Math.ceil(s.width/Fs)+1,x=Math.ceil(s.height/Fs)+1;for(let b=0;b<x;b++)for(let y=0;y<g;y++){const j=y*Fs,w=b*Fs,E=j-f,T=w-h,S=E*E+T*T;let A=j,v=w,M=bw,N=su;if(S<p){const O=Math.sqrt(S),P=1-O/po,V=P*P,F=V*ww;O>.1&&(A+=E/O*F,v+=T/O*F),M=vw,N=su+V*.6}i.beginPath(),i.arc(A,v,N,0,Math.PI*2),i.fillStyle=M,i.fill()}}function l(){n.current||(n.current=!0,r.current=requestAnimationFrame(o))}function c(){s&&(s.width=window.innerWidth,s.height=window.innerHeight,l())}function u(f){t.current={x:f.clientX,y:f.clientY},l()}function d(){t.current=iu,l()}return c(),l(),window.addEventListener("resize",c),window.addEventListener("mousemove",u),document.addEventListener("mouseleave",d),()=>{cancelAnimationFrame(r.current),window.removeEventListener("resize",c),window.removeEventListener("mousemove",u),document.removeEventListener("mouseleave",d)}},[]),a.jsx("canvas",{ref:e,className:"neon-grid-canvas",style:{pointerEvents:"none"}})}const jw=[{to:"/",icon:_h,label:"KANBAN"},{to:"/primitives",icon:aa,label:"PRIMITIVES"},{to:"/gates",icon:al,label:"SAFEGUARDS"},{to:"/repo",icon:ar,label:"REPO"},{to:"/sessions",icon:Yr,label:"SESSIONS"},{to:"/workflow",icon:W0,label:"WORKFLOW"}];function Sw(){const{settings:e}=fl();return kn(),a.jsxs("div",{className:"flex h-screen bg-background",children:[e.showBackgroundEffects&&a.jsx("div",{className:"neon-bg",children:a.jsx(kw,{})}),a.jsxs("aside",{className:"flex w-24 flex-col items-center border-r border-border bg-surface sidebar-glass",children:[a.jsx("div",{className:"flex h-20 items-center justify-center",children:a.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-xl text-white overflow-hidden",style:{background:"linear-gradient(135deg, #6FC985 0%, #5ABF87 6.25%, #45B588 12.5%, #2FAA89 18.75%, #15A089 25%, #009588 31.25%, #008A87 37.5%, #007F84 43.75%, #007480 50%, #00697A 56.25%, #005E74 62.5%, #00546C 68.75%, #004964 75%, #023F5B 81.25%, #0A3551 87.5%, #0E2B46 93.75%, #10223B 100%)"},children:a.jsx("img",{src:"/scanner-sweep.png",alt:"Orbital Command",className:"h-12 w-12 object-contain"})})}),a.jsx(Tt,{className:"flex-1",children:a.jsx("nav",{className:"flex flex-col items-center gap-3 px-4 py-2",children:jw.map(({to:t,icon:n,label:r})=>a.jsxs(Oc,{to:t,end:t==="/",className:({isActive:s})=>I("nav-item-square group relative flex h-16 w-16 flex-col items-center justify-center rounded-xl",s?"bg-surface-light text-foreground nav-icon-active-glow":"text-muted-foreground hover:bg-surface-light hover:text-foreground"),children:[a.jsx(n,{className:"h-6 w-6 transition-transform duration-200 group-hover:scale-110"}),a.jsx("span",{className:"nav-item-label whitespace-nowrap text-[9px] font-light max-h-0 opacity-0 group-hover:max-h-3 group-hover:mt-1 group-hover:opacity-100 transition-all duration-200 overflow-hidden tracking-wider",children:r})]},t))})}),a.jsx("div",{className:"px-4 py-3",children:a.jsxs(Oc,{to:"/settings",className:({isActive:t})=>I("nav-item-square group relative flex h-16 w-16 flex-col items-center justify-center rounded-xl",t?"bg-surface-light text-foreground nav-icon-active-glow":"text-muted-foreground hover:bg-surface-light hover:text-foreground"),children:[a.jsx(Lh,{className:"h-6 w-6 transition-transform duration-200 group-hover:scale-110"}),a.jsx("span",{className:"nav-item-label whitespace-nowrap text-[9px] font-light max-h-0 opacity-0 group-hover:max-h-3 group-hover:mt-1 group-hover:opacity-100 transition-all duration-200 overflow-hidden tracking-wider",children:"SETTINGS"})]})})]}),a.jsx("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden relative z-[1]",style:e.fontScale!==1?{zoom:e.fontScale}:void 0,children:a.jsx("div",{className:"flex flex-1 flex-col overflow-hidden p-4 pt-12 pb-12",children:a.jsx(Fh,{children:a.jsx(my,{})})})}),e.showStatusBar&&a.jsx(xw,{})]})}function k3(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const $i=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function br(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function vl(e){return"nodeType"in e}function ft(e){var t,n;return e?br(e)?e:vl(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function wl(e){const{Document:t}=ft(e);return e instanceof t}function vs(e){return br(e)?!1:e instanceof ft(e).HTMLElement}function mp(e){return e instanceof ft(e).SVGElement}function vr(e){return e?br(e)?e.document:vl(e)?wl(e)?e:vs(e)||mp(e)?e.ownerDocument:document:document:document}const en=$i?m.useLayoutEffect:m.useEffect;function Hi(e){const t=m.useRef(e);return en(()=>{t.current=e}),m.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function Nw(){const e=m.useRef(null),t=m.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=m.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function as(e,t){t===void 0&&(t=[e]);const n=m.useRef(e);return en(()=>{n.current!==e&&(n.current=e)},t),n}function ws(e,t){const n=m.useRef();return m.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function pi(e){const t=Hi(e),n=m.useRef(null),r=m.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function mi(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let mo={};function Ui(e,t){return m.useMemo(()=>{if(t)return t;const n=mo[e]==null?0:mo[e]+1;return mo[e]=n,e+"-"+n},[e,t])}function gp(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const l=Object.entries(o);for(const[c,u]of l){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const sr=gp(1),gi=gp(-1);function Cw(e){return"clientX"in e&&"clientY"in e}function kl(e){if(!e)return!1;const{KeyboardEvent:t}=ft(e.target);return t&&e instanceof t}function Ew(e){if(!e)return!1;const{TouchEvent:t}=ft(e.target);return t&&e instanceof t}function xi(e){if(Ew(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Cw(e)?{x:e.clientX,y:e.clientY}:null}const Fn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Fn.Translate.toString(e),Fn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),ou="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Tw(e){return e.matches(ou)?e:e.querySelector(ou)}const Aw={display:"none"};function Pw(e){let{id:t,value:n}=e;return Ie.createElement("div",{id:t,style:Aw},n)}function Mw(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ie.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function _w(){const[e,t]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const xp=m.createContext(null);function Rw(e){const t=m.useContext(xp);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Dw(){const[e]=m.useState(()=>new Set),t=m.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[m.useCallback(r=>{let{type:s,event:i}=r;e.forEach(o=>{var l;return(l=o[s])==null?void 0:l.call(o,i)})},[e]),t]}const Ow={draggable:`
382
+ To pick up a draggable item, press the space bar.
383
+ While dragging, use the arrow keys to move the item.
384
+ Press space again to drop the item in its new position, or press escape to cancel.
385
+ `},Lw={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Iw(e){let{announcements:t=Lw,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=Ow}=e;const{announce:i,announcement:o}=_w(),l=Ui("DndLiveRegion"),[c,u]=m.useState(!1);if(m.useEffect(()=>{u(!0)},[]),Rw(m.useMemo(()=>({onDragStart(f){let{active:h}=f;i(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;i(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;i(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!c)return null;const d=Ie.createElement(Ie.Fragment,null,Ie.createElement(Pw,{id:r,value:s.draggable}),Ie.createElement(Mw,{id:l,announcement:o}));return n?Xn.createPortal(d,n):d}var We;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(We||(We={}));function yi(){}function ga(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function yp(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ot=Object.freeze({x:0,y:0});function jl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fw(e,t){const n=xi(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Sl(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Bw(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function xa(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function zw(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function au(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const j3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=au(t,t.left,t.top),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=jl(au(c),s);i.push({id:l,data:{droppableContainer:o,value:u}})}}return i.sort(Sl)},S3=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=xa(t),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=xa(c),d=s.reduce((h,p,g)=>h+jl(u[g],p),0),f=Number((d/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:f}})}}return i.sort(Sl)};function Vw(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,l=i-n;if(r<s&&n<i){const c=t.width*t.height,u=e.width*e.height,d=o*l,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const bp=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:o}=i,l=n.get(o);if(l){const c=Vw(l,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Bw)};function $w(e,t){const{top:n,left:r,bottom:s,right:i}=t;return n<=e.y&&e.y<=s&&r<=e.x&&e.x<=i}const Hw=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const s=[];for(const i of t){const{id:o}=i,l=n.get(o);if(l&&$w(r,l)){const u=xa(l).reduce((f,h)=>f+jl(r,h),0),d=Number((u/4).toFixed(4));s.push({id:o,data:{droppableContainer:i,value:d}})}}return s.sort(Sl)};function Uw(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function vp(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ot}function Ww(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const qw=Ww(1);function wp(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Gw(e,t,n){const r=wp(t);if(!r)return e;const{scaleX:s,scaleY:i,x:o,y:l}=r,c=e.left-o-(1-s)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Kw={ignoreTransform:!1};function ks(e,t){t===void 0&&(t=Kw);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=ft(e).getComputedStyle(e);u&&(n=Gw(n,u,d))}const{top:r,left:s,width:i,height:o,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:o,bottom:l,right:c}}function lu(e){return ks(e,{ignoreTransform:!0})}function Yw(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Xw(e,t){return t===void 0&&(t=ft(e).getComputedStyle(e)),t.position==="fixed"}function Jw(e,t){t===void 0&&(t=ft(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function Nl(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(wl(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!vs(s)||mp(s)||n.includes(s))return n;const i=ft(e).getComputedStyle(s);return s!==e&&Jw(s,i)&&n.push(s),Xw(s,i)?n:r(s.parentNode)}return e?r(e):n}function kp(e){const[t]=Nl(e,1);return t??null}function go(e){return!$i||!e?null:br(e)?e:vl(e)?wl(e)||e===vr(e).scrollingElement?window:vs(e)?e:null:null}function jp(e){return br(e)?e.scrollX:e.scrollLeft}function Sp(e){return br(e)?e.scrollY:e.scrollTop}function ya(e){return{x:jp(e),y:Sp(e)}}var Ye;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ye||(Ye={}));function Np(e){return!$i||!e?!1:e===document.scrollingElement}function Cp(e){const t={x:0,y:0},n=Np(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const Qw={x:.2,y:.2};function Zw(e,t,n,r,s){let{top:i,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=Qw);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=Cp(e),p={x:0,y:0},g={x:0,y:0},x={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+x.height?(p.y=Ye.Backward,g.y=r*Math.abs((t.top+x.height-i)/x.height)):!d&&c>=t.bottom-x.height&&(p.y=Ye.Forward,g.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!h&&l>=t.right-x.width?(p.x=Ye.Forward,g.x=r*Math.abs((t.right-x.width-l)/x.width)):!f&&o<=t.left+x.width&&(p.x=Ye.Backward,g.x=r*Math.abs((t.left+x.width-o)/x.width)),{direction:p,speed:g}}function e1(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Ep(e){return e.reduce((t,n)=>sr(t,ya(n)),Ot)}function t1(e){return e.reduce((t,n)=>t+jp(n),0)}function n1(e){return e.reduce((t,n)=>t+Sp(n),0)}function Tp(e,t){if(t===void 0&&(t=ks),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);kp(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const r1=[["x",["left","right"],t1],["y",["top","bottom"],n1]];class Cl{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Nl(n),s=Ep(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of r1)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=l(r),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function s1(e){const{EventTarget:t}=ft(e);return e instanceof t?e:vr(e)}function xo(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var St;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(St||(St={}));function cu(e){e.preventDefault()}function i1(e){e.stopPropagation()}var Ne;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ne||(Ne={}));const Ap={start:[Ne.Space,Ne.Enter],cancel:[Ne.Esc],end:[Ne.Space,Ne.Enter,Ne.Tab]},o1=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ne.Right:return{...n,x:n.x+25};case Ne.Left:return{...n,x:n.x-25};case Ne.Down:return{...n,y:n.y+25};case Ne.Up:return{...n,y:n.y-25}}};class El{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xr(vr(n)),this.windowListeners=new Xr(ft(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(St.Resize,this.handleCancel),this.windowListeners.add(St.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(St.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Tp(r),n(Ot)}handleKeyDown(t){if(kl(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=Ap,coordinateGetter:o=o1,scrollBehavior:l="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:Ot;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=gi(f,d),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const x of g){const b=t.code,{isTop:y,isRight:j,isLeft:w,isBottom:E,maxScroll:T,minScroll:S}=Cp(x),A=e1(x),v={x:Math.min(b===Ne.Right?A.right-A.width/2:A.right,Math.max(b===Ne.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(b===Ne.Down?A.bottom-A.height/2:A.bottom,Math.max(b===Ne.Down?A.top:A.top+A.height/2,f.y))},M=b===Ne.Right&&!j||b===Ne.Left&&!w,N=b===Ne.Down&&!E||b===Ne.Up&&!y;if(M&&v.x!==f.x){const O=x.scrollLeft+h.x,P=b===Ne.Right&&O<=T.x||b===Ne.Left&&O>=S.x;if(P&&!h.y){x.scrollTo({left:O,behavior:l});return}P?p.x=x.scrollLeft-O:p.x=b===Ne.Right?x.scrollLeft-T.x:x.scrollLeft-S.x,p.x&&x.scrollBy({left:-p.x,behavior:l});break}else if(N&&v.y!==f.y){const O=x.scrollTop+h.y,P=b===Ne.Down&&O<=T.y||b===Ne.Up&&O>=S.y;if(P&&!h.x){x.scrollTo({top:O,behavior:l});return}P?p.y=x.scrollTop-O:p.y=b===Ne.Down?x.scrollTop-T.y:x.scrollTop-S.y,p.y&&x.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,sr(gi(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}El.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ap,onActivation:s}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function uu(e){return!!(e&&"distance"in e)}function du(e){return!!(e&&"delay"in e)}class Tl{constructor(t,n,r){var s;r===void 0&&(r=s1(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=vr(o),this.documentListeners=new Xr(this.document),this.listeners=new Xr(r),this.windowListeners=new Xr(ft(o)),this.initialCoordinates=(s=xi(i))!=null?s:Ot,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(St.Resize,this.handleCancel),this.windowListeners.add(St.DragStart,cu),this.windowListeners.add(St.VisibilityChange,this.handleCancel),this.windowListeners.add(St.ContextMenu,cu),this.documentListeners.add(St.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(du(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(uu(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(St.Click,i1,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(St.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=xi(t))!=null?n:Ot,u=gi(s,c);if(!r&&l){if(uu(l)){if(l.tolerance!=null&&xo(u,l.tolerance))return this.handleCancel();if(xo(u,l.distance))return this.handleStart()}if(du(l)&&xo(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ne.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const a1={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Wi extends Tl{constructor(t){const{event:n}=t,r=vr(n.target);super(t,a1,r)}}Wi.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const l1={move:{name:"mousemove"},end:{name:"mouseup"}};var ba;(function(e){e[e.RightClick=2]="RightClick"})(ba||(ba={}));class c1 extends Tl{constructor(t){super(t,l1,vr(t.event.target))}}c1.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ba.RightClick?!1:(r==null||r({event:n}),!0)}}];const yo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class u1 extends Tl{constructor(t){super(t,yo)}static setup(){return window.addEventListener(yo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(yo.move.name,t)};function t(){}}}u1.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Jr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Jr||(Jr={}));var bi;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(bi||(bi={}));function d1(e){let{acceleration:t,activator:n=Jr.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:l=bi.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=h1({delta:f,disabled:!i}),[g,x]=Nw(),b=m.useRef({x:0,y:0}),y=m.useRef({x:0,y:0}),j=m.useMemo(()=>{switch(n){case Jr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Jr.DraggableRect:return s}},[n,s,c]),w=m.useRef(null),E=m.useCallback(()=>{const S=w.current;if(!S)return;const A=b.current.x*y.current.x,v=b.current.y*y.current.y;S.scrollBy(A,v)},[]),T=m.useMemo(()=>l===bi.TreeOrder?[...u].reverse():u,[l,u]);m.useEffect(()=>{if(!i||!u.length||!j){x();return}for(const S of T){if((r==null?void 0:r(S))===!1)continue;const A=u.indexOf(S),v=d[A];if(!v)continue;const{direction:M,speed:N}=Zw(S,v,j,t,h);for(const O of["x","y"])p[O][M[O]]||(N[O]=0,M[O]=0);if(N.x>0||N.y>0){x(),w.current=S,g(E,o),b.current=N,y.current=M;return}}b.current={x:0,y:0},y.current={x:0,y:0},x()},[t,E,r,x,i,o,JSON.stringify(j),JSON.stringify(p),g,u,T,d,JSON.stringify(h)])}const f1={x:{[Ye.Backward]:!1,[Ye.Forward]:!1},y:{[Ye.Backward]:!1,[Ye.Forward]:!1}};function h1(e){let{delta:t,disabled:n}=e;const r=mi(t);return ws(s=>{if(n||!r||!s)return f1;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Ye.Backward]:s.x[Ye.Backward]||i.x===-1,[Ye.Forward]:s.x[Ye.Forward]||i.x===1},y:{[Ye.Backward]:s.y[Ye.Backward]||i.y===-1,[Ye.Forward]:s.y[Ye.Forward]||i.y===1}}},[n,t,r])}function p1(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return ws(s=>{var i;return t==null?null:(i=r??s)!=null?i:null},[r,t])}function m1(e,t){return m.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...i]},[]),[e,t])}var ls;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ls||(ls={}));var va;(function(e){e.Optimized="optimized"})(va||(va={}));const fu=new Map;function g1(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,o]=m.useState(null),{frequency:l,measure:c,strategy:u}=s,d=m.useRef(e),f=b(),h=as(f),p=m.useCallback(function(y){y===void 0&&(y=[]),!h.current&&o(j=>j===null?y:j.concat(y.filter(w=>!j.includes(w))))},[h]),g=m.useRef(null),x=ws(y=>{if(f&&!n)return fu;if(!y||y===fu||d.current!==e||i!=null){const j=new Map;for(let w of e){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){j.set(w.id,w.rect.current);continue}const E=w.node.current,T=E?new Cl(c(E),E):null;w.rect.current=T,T&&j.set(w.id,T)}return j}return y},[e,i,n,f,c]);return m.useEffect(()=>{d.current=e},[e]),m.useEffect(()=>{f||p()},[n,f]),m.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),m.useEffect(()=>{f||typeof l!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},l))},[l,f,p,...r]),{droppableRects:x,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(u){case ls.Always:return!1;case ls.BeforeDragging:return n;default:return!n}}}function Al(e,t){return ws(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function x1(e,t){return Al(e,t)}function y1(e){let{callback:t,disabled:n}=e;const r=Hi(t),s=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return m.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function qi(e){let{callback:t,disabled:n}=e;const r=Hi(t),s=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return m.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function b1(e){return new Cl(ks(e),e)}function hu(e,t,n){t===void 0&&(t=b1);const[r,s]=m.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=y1({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=qi({callback:i});return en(()=>{i(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function v1(e){const t=Al(e);return vp(e,t)}const pu=[];function w1(e){const t=m.useRef(e),n=ws(r=>e?r&&r!==pu&&e&&t.current&&e.parentNode===t.current.parentNode?r:Nl(e):pu,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function k1(e){const[t,n]=m.useState(null),r=m.useRef(e),s=m.useCallback(i=>{const o=go(i.target);o&&n(l=>l?(l.set(o,ya(o)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(e!==i){o(i);const l=e.map(c=>{const u=go(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,ya(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(i)};function o(l){l.forEach(c=>{const u=go(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>sr(i,o),Ot):Ep(e):Ot,[e,t])}function mu(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==Ot;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?gi(e,n.current):Ot}function j1(e){m.useEffect(()=>{if(!$i)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function S1(e,t){return m.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,t)},n},{}),[e,t])}function Pp(e){return m.useMemo(()=>e?Yw(e):null,[e])}const gu=[];function N1(e,t){t===void 0&&(t=ks);const[n]=e,r=Pp(n?ft(n):null),[s,i]=m.useState(gu);function o(){i(()=>e.length?e.map(c=>Np(c)?r:new Cl(t(c),c)):gu)}const l=qi({callback:o});return en(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),s}function Mp(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return vs(t)?t:e}function C1(e){let{measure:t}=e;const[n,r]=m.useState(null),s=m.useCallback(u=>{for(const{target:d}of u)if(vs(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),i=qi({callback:s}),o=m.useCallback(u=>{const d=Mp(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),r(d?t(d):null)},[t,i]),[l,c]=pi(o);return m.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const E1=[{sensor:Wi,options:{}},{sensor:El,options:{}}],T1={current:{}},si={draggable:{measure:lu},droppable:{measure:lu,strategy:ls.WhileDragging,frequency:va.Optimized},dragOverlay:{measure:ks}};class Qr extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const A1={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yi},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:si,measureDroppableContainers:yi,windowRect:null,measuringScheduled:!1},_p={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yi,draggableNodes:new Map,over:null,measureDroppableContainers:yi},js=m.createContext(_p),Rp=m.createContext(A1);function P1(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qr}}}function M1(e,t){switch(t.type){case We.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case We.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case We.DragEnd:case We.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case We.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Qr(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case We.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Qr(e.droppable.containers);return o.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case We.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Qr(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function _1(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=m.useContext(js),i=mi(r),o=mi(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&i&&o!=null){if(!kl(i)||document.activeElement===i.target)return;const l=s.get(o);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Tw(d);if(f){f.focus();break}}})}},[r,t,s,o,i]),null}function Dp(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function R1(e){return m.useMemo(()=>({draggable:{...si.draggable,...e==null?void 0:e.draggable},droppable:{...si.droppable,...e==null?void 0:e.droppable},dragOverlay:{...si.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function D1(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=m.useRef(!1),{x:o,y:l}=typeof s=="boolean"?{x:s,y:s}:s;en(()=>{if(!o&&!l||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=vp(d,r);if(o||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=kp(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,o,l,r,n])}const Gi=m.createContext({...Ot,scaleX:1,scaleY:1});var hn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(hn||(hn={}));const Op=m.memo(function(t){var n,r,s,i;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:d=E1,collisionDetection:f=bp,measuring:h,modifiers:p,...g}=t;const x=m.useReducer(M1,void 0,P1),[b,y]=x,[j,w]=Dw(),[E,T]=m.useState(hn.Uninitialized),S=E===hn.Initialized,{draggable:{active:A,nodes:v,translate:M},droppable:{containers:N}}=b,O=A!=null?v.get(A):null,P=m.useRef({initial:null,translated:null}),V=m.useMemo(()=>{var Ue;return A!=null?{id:A,data:(Ue=O==null?void 0:O.data)!=null?Ue:T1,rect:P}:null},[A,O]),F=m.useRef(null),[R,Y]=m.useState(null),[G,H]=m.useState(null),L=as(g,Object.values(g)),k=Ui("DndDescribedBy",o),_=m.useMemo(()=>N.getEnabled(),[N]),$=R1(h),{droppableRects:C,measureDroppableContainers:re,measuringScheduled:Te}=g1(_,{dragging:S,dependencies:[M.x,M.y],config:$.droppable}),K=p1(v,A),qe=m.useMemo(()=>G?xi(G):null,[G]),He=Ds(),et=x1(K,$.draggable.measure);D1({activeNode:A!=null?v.get(A):null,config:He.layoutShiftCompensation,initialRect:et,measure:$.draggable.measure});const U=hu(K,$.draggable.measure,et),ke=hu(K?K.parentElement:null),tt=m.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:C,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ht=N.getNodeFor((n=tt.current.over)==null?void 0:n.id),De=C1({measure:$.dragOverlay.measure}),ne=(r=De.nodeRef.current)!=null?r:K,ie=S?(s=De.rect)!=null?s:U:null,ce=!!(De.nodeRef.current&&De.rect),ue=v1(ce?null:U),xe=Pp(ne?ft(ne):null),ve=w1(S?ht??K:null),Ge=N1(ve),nt=Dp(p,{transform:{x:M.x-ue.x,y:M.y-ue.y,scaleX:1,scaleY:1},activatorEvent:G,active:V,activeNodeRect:U,containerNodeRect:ke,draggingNodeRect:ie,over:tt.current.over,overlayNodeRect:De.rect,scrollableAncestors:ve,scrollableAncestorRects:Ge,windowRect:xe}),Lt=qe?sr(qe,M):null,be=k1(ve),je=mu(be),D=mu(be,[U]),B=sr(nt,je),W=ie?qw(ie,nt):null,X=V&&W?f({active:V,collisionRect:W,droppableRects:C,droppableContainers:_,pointerCoordinates:Lt}):null,oe=zw(X,"id"),[he,Ae]=m.useState(null),Oe=ce?nt:sr(nt,D),At=Uw(Oe,(i=he==null?void 0:he.rect)!=null?i:null,U),Pt=m.useRef(null),Ke=m.useCallback((Ue,rt)=>{let{sensor:J,options:se}=rt;if(F.current==null)return;const Se=v.get(F.current);if(!Se)return;const ye=Ue.nativeEvent,Ft=new J({active:F.current,activeNode:Se,event:ye,options:se,context:tt,onAbort(Je){if(!v.get(Je))return;const{onDragAbort:Bt}=L.current,Gt={id:Je};Bt==null||Bt(Gt),j({type:"onDragAbort",event:Gt})},onPending(Je,on,Bt,Gt){if(!v.get(Je))return;const{onDragPending:Ar}=L.current,an={id:Je,constraint:on,initialCoordinates:Bt,offset:Gt};Ar==null||Ar(an),j({type:"onDragPending",event:an})},onStart(Je){const on=F.current;if(on==null)return;const Bt=v.get(on);if(!Bt)return;const{onDragStart:Gt}=L.current,Tr={activatorEvent:ye,active:{id:on,data:Bt.data,rect:P}};Xn.unstable_batchedUpdates(()=>{Gt==null||Gt(Tr),T(hn.Initializing),y({type:We.DragStart,initialCoordinates:Je,active:on}),j({type:"onDragStart",event:Tr}),Y(Pt.current),H(ye)})},onMove(Je){y({type:We.DragMove,coordinates:Je})},onEnd:Wn(We.DragEnd),onCancel:Wn(We.DragCancel)});Pt.current=Ft;function Wn(Je){return async function(){const{active:Bt,collisions:Gt,over:Tr,scrollAdjustedTranslate:Ar}=tt.current;let an=null;if(Bt&&Ar){const{cancelDrop:Pr}=L.current;an={activatorEvent:ye,active:Bt,collisions:Gt,delta:Ar,over:Tr},Je===We.DragEnd&&typeof Pr=="function"&&await Promise.resolve(Pr(an))&&(Je=We.DragCancel)}F.current=null,Xn.unstable_batchedUpdates(()=>{y({type:Je}),T(hn.Uninitialized),Ae(null),Y(null),H(null),Pt.current=null;const Pr=Je===We.DragEnd?"onDragEnd":"onDragCancel";if(an){const oo=L.current[Pr];oo==null||oo(an),j({type:Pr,event:an})}})}}},[v]),It=m.useCallback((Ue,rt)=>(J,se)=>{const Se=J.nativeEvent,ye=v.get(se);if(F.current!==null||!ye||Se.dndKit||Se.defaultPrevented)return;const Ft={active:ye};Ue(J,rt.options,Ft)===!0&&(Se.dndKit={capturedBy:rt.sensor},F.current=se,Ke(J,rt))},[v,Ke]),ct=m1(d,It);j1(d),en(()=>{U&&E===hn.Initializing&&T(hn.Initialized)},[U,E]),m.useEffect(()=>{const{onDragMove:Ue}=L.current,{active:rt,activatorEvent:J,collisions:se,over:Se}=tt.current;if(!rt||!J)return;const ye={active:rt,activatorEvent:J,collisions:se,delta:{x:B.x,y:B.y},over:Se};Xn.unstable_batchedUpdates(()=>{Ue==null||Ue(ye),j({type:"onDragMove",event:ye})})},[B.x,B.y]),m.useEffect(()=>{const{active:Ue,activatorEvent:rt,collisions:J,droppableContainers:se,scrollAdjustedTranslate:Se}=tt.current;if(!Ue||F.current==null||!rt||!Se)return;const{onDragOver:ye}=L.current,Ft=se.get(oe),Wn=Ft&&Ft.rect.current?{id:Ft.id,rect:Ft.rect.current,data:Ft.data,disabled:Ft.disabled}:null,Je={active:Ue,activatorEvent:rt,collisions:J,delta:{x:Se.x,y:Se.y},over:Wn};Xn.unstable_batchedUpdates(()=>{Ae(Wn),ye==null||ye(Je),j({type:"onDragOver",event:Je})})},[oe]),en(()=>{tt.current={activatorEvent:G,active:V,activeNode:K,collisionRect:W,collisions:X,droppableRects:C,draggableNodes:v,draggingNode:ne,draggingNodeRect:ie,droppableContainers:N,over:he,scrollableAncestors:ve,scrollAdjustedTranslate:B},P.current={initial:ie,translated:W}},[V,K,X,W,v,ne,ie,C,N,he,ve,B]),d1({...He,delta:M,draggingRect:W,pointerCoordinates:Lt,scrollableAncestors:ve,scrollableAncestorRects:Ge});const _s=m.useMemo(()=>({active:V,activeNode:K,activeNodeRect:U,activatorEvent:G,collisions:X,containerNodeRect:ke,dragOverlay:De,draggableNodes:v,droppableContainers:N,droppableRects:C,over:he,measureDroppableContainers:re,scrollableAncestors:ve,scrollableAncestorRects:Ge,measuringConfiguration:$,measuringScheduled:Te,windowRect:xe}),[V,K,U,G,X,ke,De,v,N,C,he,re,ve,Ge,$,Te,xe]),Rs=m.useMemo(()=>({activatorEvent:G,activators:ct,active:V,activeNodeRect:U,ariaDescribedById:{draggable:k},dispatch:y,draggableNodes:v,over:he,measureDroppableContainers:re}),[G,ct,V,U,y,k,v,he,re]);return Ie.createElement(xp.Provider,{value:w},Ie.createElement(js.Provider,{value:Rs},Ie.createElement(Rp.Provider,{value:_s},Ie.createElement(Gi.Provider,{value:At},u)),Ie.createElement(_1,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Ie.createElement(Iw,{...l,hiddenTextDescribedById:k}));function Ds(){const Ue=(R==null?void 0:R.autoScrollEnabled)===!1,rt=typeof c=="object"?c.enabled===!1:c===!1,J=S&&!Ue&&!rt;return typeof c=="object"?{...c,enabled:J}:{enabled:J}}}),O1=m.createContext(null),xu="button",L1="Draggable";function wr(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=Ui(L1),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=m.useContext(js),{role:p=xu,roleDescription:g="draggable",tabIndex:x=0}=s??{},b=(c==null?void 0:c.id)===t,y=m.useContext(b?Gi:O1),[j,w]=pi(),[E,T]=pi(),S=S1(o,t),A=as(n);en(()=>(f.set(t,{id:t,key:i,node:j,activatorNode:E,data:A}),()=>{const M=f.get(t);M&&M.key===i&&f.delete(t)}),[f,t]);const v=m.useMemo(()=>({role:p,tabIndex:x,"aria-disabled":r,"aria-pressed":b&&p===xu?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,p,x,b,g,d.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:v,isDragging:b,listeners:r?void 0:S,node:j,over:h,setNodeRef:w,setActivatorNodeRef:T,transform:y}}function I1(){return m.useContext(Rp)}const F1="Droppable",B1={timeout:25};function Bn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=Ui(F1),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=m.useContext(js),d=m.useRef({disabled:n}),f=m.useRef(!1),h=m.useRef(null),p=m.useRef(null),{disabled:g,updateMeasurementsFor:x,timeout:b}={...B1,...s},y=as(x??r),j=m.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),p.current=null},b)},[b]),w=qi({callback:j,disabled:g||!o}),E=m.useCallback((v,M)=>{w&&(M&&(w.unobserve(M),f.current=!1),v&&w.observe(v))},[w]),[T,S]=pi(E),A=as(t);return m.useEffect(()=>{!w||!T.current||(w.disconnect(),f.current=!1,w.observe(T.current))},[T,w]),m.useEffect(()=>(l({type:We.RegisterDroppable,element:{id:r,key:i,disabled:n,node:T,rect:h,data:A}}),()=>l({type:We.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==d.current.disabled&&(l({type:We.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,l]),{active:o,rect:h,isOver:(c==null?void 0:c.id)===r,node:T,over:c,setNodeRef:S}}function z1(e){let{animation:t,children:n}=e;const[r,s]=m.useState(null),[i,o]=m.useState(null),l=mi(n);return!n&&!r&&l&&s(l),en(()=>{if(!i)return;const c=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,r,i]),Ie.createElement(Ie.Fragment,null,n,r?m.cloneElement(r,{ref:o}):null)}const V1={x:0,y:0,scaleX:1,scaleY:1};function $1(e){let{children:t}=e;return Ie.createElement(js.Provider,{value:_p},Ie.createElement(Gi.Provider,{value:V1},t))}const H1={position:"fixed",touchAction:"none"},U1=e=>kl(e)?"transform 250ms ease":void 0,W1=m.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:l,style:c,transform:u,transition:d=U1}=e;if(!l)return null;const f=s?u:{...u,scaleX:1,scaleY:1},h={...H1,width:l.width,height:l.height,top:l.top,left:l.left,transform:Fn.Transform.toString(f),transformOrigin:s&&r?Fw(r,l):void 0,transition:typeof d=="function"?d(r):d,...c};return Ie.createElement(n,{className:o,style:h,ref:t},i)}),q1=e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[l,c]of Object.entries(i.active))c!==void 0&&(s[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,c));if(i!=null&&i.dragOverlay)for(const[l,c]of Object.entries(i.dragOverlay))c!==void 0&&r.node.style.setProperty(l,c);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[c,u]of Object.entries(s))n.node.style.setProperty(c,u);o!=null&&o.active&&n.node.classList.remove(o.active)}},G1=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Fn.Transform.toString(t)},{transform:Fn.Transform.toString(n)}]},K1={duration:250,easing:"ease",keyframes:G1,sideEffects:q1({styles:{active:{opacity:"0"}}})};function Y1(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return Hi((i,o)=>{if(t===null)return;const l=n.get(i);if(!l)return;const c=l.node.current;if(!c)return;const u=Mp(o);if(!u)return;const{transform:d}=ft(o).getComputedStyle(o),f=wp(d);if(!f)return;const h=typeof t=="function"?t:X1(t);return Tp(c,s.draggable.measure),h({active:{id:i,data:l.data,node:c,rect:s.draggable.measure(c)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:s,transform:f})})}function X1(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...K1,...e};return i=>{let{active:o,dragOverlay:l,transform:c,...u}=i;if(!t)return;const d={x:l.rect.left-o.rect.left,y:l.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/l.rect.height:1},h={x:c.x-d.x,y:c.y-d.y,...f},p=s({...u,active:o,dragOverlay:l,transform:{initial:c,final:h}}),[g]=p,x=p[p.length-1];if(JSON.stringify(g)===JSON.stringify(x))return;const b=r==null?void 0:r({active:o,dragOverlay:l,...u}),y=l.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(j=>{y.onfinish=()=>{b==null||b(),j()}})}}let yu=0;function J1(e){return m.useMemo(()=>{if(e!=null)return yu++,yu},[e])}const Lp=Ie.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:l="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:g,droppableContainers:x,dragOverlay:b,over:y,measuringConfiguration:j,scrollableAncestors:w,scrollableAncestorRects:E,windowRect:T}=I1(),S=m.useContext(Gi),A=J1(f==null?void 0:f.id),v=Dp(o,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:b.rect,over:y,overlayNodeRect:b.rect,scrollableAncestors:w,scrollableAncestorRects:E,transform:S,windowRect:T}),M=Al(h),N=Y1({config:r,draggableNodes:g,droppableContainers:x,measuringConfiguration:j}),O=M?b.setRef:void 0;return Ie.createElement($1,null,Ie.createElement(z1,{animation:N},f&&A?Ie.createElement(W1,{key:A,id:f.id,ref:O,as:l,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:M,style:{zIndex:u,...s},transform:v},n):null))}),wa="cc-card-display",bo={effort:!0,category:!0,priority:!0,tags:!0};function bu(){try{const e=localStorage.getItem(wa);if(!e)return bo;const t=JSON.parse(e);if(typeof t!="object"||t===null)return bo;const n=t;return{effort:typeof n.effort=="boolean"?n.effort:!0,category:typeof n.category=="boolean"?n.category:!0,priority:typeof n.priority=="boolean"?n.priority:!0,tags:typeof n.tags=="boolean"?n.tags:!0}}catch{return bo}}function Q1(){const[e,t]=m.useState(bu);m.useEffect(()=>{function i(o){o.key===wa&&t(bu())}return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[]);const n=m.useCallback(i=>{t(o=>{const l={...o,[i]:!o[i]};try{localStorage.setItem(wa,JSON.stringify(l))}catch{}return l})},[]),r=e.effort&&e.category&&e.priority&&e.tags,s=[e.effort,e.category,e.priority,e.tags].filter(i=>!i).length;return{display:e,toggle:n,isAllVisible:r,hiddenCount:s}}const Z1={activeScopes:new Set,abandonedScopes:new Map,recoverScope:async()=>{},dismissAbandoned:async()=>{}},Ip=m.createContext(Z1);function ek(){const{engine:e}=wt(),t=m.useMemo(()=>new Set(e.getConfig().terminalStatuses??[]),[e]),[n,r]=m.useState(new Set),[s,i]=m.useState(new Map),o=m.useRef(!0),l=m.useCallback(f=>{i(h=>{if(!h.has(f))return h;const p=new Map(h);return p.delete(f),p})},[]),c=m.useCallback(async()=>{try{const f=await fetch("/api/orbital/dispatch/active-scopes");if(!f.ok){console.warn("[Orbital] Failed to fetch active scopes:",f.status,f.statusText);return}const h=await f.json();if(!o.current)return;if(r(new Set(h.scope_ids)),h.abandoned_scopes){const p=new Map;for(const g of h.abandoned_scopes)p.set(g.scope_id,{from_status:g.from_status,abandoned_at:g.abandoned_at});i(p)}}catch{}},[]),u=m.useCallback(async(f,h)=>{try{const p=await fetch(`/api/orbital/dispatch/recover/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from_status:h})});if(!p.ok){const g=await p.json().catch(()=>({error:p.statusText}));console.error("[Orbital] Failed to recover scope:",g.error);return}l(f)}catch(p){console.error("[Orbital] Failed to recover scope:",p)}},[l]),d=m.useCallback(async f=>{try{const h=await fetch(`/api/orbital/dispatch/dismiss-abandoned/${f}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!h.ok){const p=await h.json().catch(()=>({error:h.statusText}));console.error("[Orbital] Failed to dismiss abandoned scope:",p.error);return}l(f)}catch(h){console.error("[Orbital] Failed to dismiss abandoned scope:",h)}},[l]);return m.useEffect(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]),m.useEffect(()=>{function f(x){if(x.type!=="DISPATCH"||x.data.resolved!=null)return;const b=[];if(x.scope_id!=null&&b.push(x.scope_id),Array.isArray(x.data.scope_ids))for(const y of x.data.scope_ids)b.includes(y)||b.push(y);if(b.length!==0){r(y=>{const j=b.filter(E=>!y.has(E));if(j.length===0)return y;const w=new Set(y);for(const E of j)w.add(E);return w});for(const y of b)l(y)}}function h(x){const b=[];if(x.scope_id!=null&&b.push(x.scope_id),Array.isArray(x.scope_ids)&&b.push(...x.scope_ids),b.length!==0)if(r(y=>{const j=b.filter(E=>y.has(E));if(j.length===0)return y;const w=new Set(y);for(const E of j)w.delete(E);return w}),x.outcome==="abandoned")c();else for(const y of b)l(y)}function p(x){if(t.has(x.status)){const b=x.id;r(y=>{if(!y.has(b))return y;const j=new Set(y);return j.delete(b),j}),l(b)}}function g(){c()}return Z.on("event:new",f),Z.on("dispatch:resolved",h),Z.on("scope:updated",p),Z.on("connect",g),()=>{Z.off("event:new",f),Z.off("dispatch:resolved",h),Z.off("scope:updated",p),Z.off("connect",g)}},[c,l,t]),{activeScopes:n,abandonedScopes:s,recoverScope:u,dismissAbandoned:d}}function tk(){return m.useContext(Ip)}const Pl=["critical","high","medium","low"],Ml=["feature","bugfix","refactor","infrastructure","docs"],Ki=["<1H","1-4H","4H+","TBD"],Fp=["has-blockers","blocks-others","no-deps"],Bp=[{id:"frontend-designer",label:"Frontend Designer",emoji:"🎨",color:"#EC4899"},{id:"architect",label:"Architect",emoji:"🏗️",color:"#536dfe"},{id:"rules-enforcer",label:"Rules Enforcer",emoji:"📋",color:"#6B7280"}];function nk(e){return Object.fromEntries(Bp.map(n=>[n.id,n.emoji]))}function rk(e){return Object.fromEntries(Bp.map(n=>[n.id,n.color]))}const sk=nk(),ik=rk();function ok(e){if(!e)return"TBD";const t=e.toLowerCase().trim(),n=t.match(/(\d+(?:\.\d+)?)\s*(?:-\s*\d+(?:\.\d+)?)?\s*hour/);if(n){const i=parseFloat(n[1]);return i<1?"<1H":i<=4?"1-4H":"4H+"}if(t.match(/(\d+)\s*(?:-\s*\d+)?\s*min/))return"<1H";const s=t.match(/\((\d+(?:\.\d+)?)\s*(?:-\s*\d+(?:\.\d+)?)?\s*(hour|min)/);if(s){const i=parseFloat(s[1]);return s[2].startsWith("min")||i<1?"<1H":i<=4?"1-4H":"4H+"}return t.includes("large")||t.includes("multi")?"4H+":t.includes("medium")||t.includes("half")?"1-4H":t.includes("small")?"<1H":"TBD"}function ak(e){const t=[];return e.blocked_by.length>0&&t.push("has-blockers"),e.blocks.length>0&&t.push("blocks-others"),e.blocked_by.length===0&&e.blocks.length===0&&t.push("no-deps"),t}function _l(e,t){switch(t){case"priority":return e.priority?[e.priority]:[];case"category":return e.category?[e.category]:[];case"tags":return e.tags;case"effort":return[ok(e.effort_estimate)];case"dependencies":return ak(e)}}function lk(e,t,n){return n.size===0?!0:_l(e,t).some(s=>n.has(s))}function vu(){return{priority:new Set,category:new Set,tags:new Set,effort:new Set,dependencies:new Set}}function ck(e){const[t,n]=m.useState(vu),r=m.useCallback((u,d)=>{n(f=>{const h={...f,[u]:new Set(f[u])};return h[u].has(d)?h[u].delete(d):h[u].add(d),h})},[]),s=m.useCallback(u=>{n(d=>({...d,[u]:new Set}))},[]),i=m.useCallback(()=>{n(vu())},[]),o=m.useMemo(()=>Object.values(t).some(u=>u.size>0),[t]),l=m.useMemo(()=>o?e.filter(u=>Object.keys(t).every(d=>lk(u,d,t[d]))):e,[e,t,o]),c=m.useMemo(()=>{const u=new Set;for(const y of e)for(const j of y.tags)u.add(j);const d=[...u].sort();function f(y,j){return e.filter(w=>_l(w,y).includes(j)).length}const h=Pl.map(y=>({value:y,label:y,count:f("priority",y)})),p=Ml.map(y=>({value:y,label:y,count:f("category",y)})),g=d.map(y=>({value:y,label:y,count:f("tags",y)})),x=Ki.map(y=>({value:y,label:y,count:f("effort",y)})),b=Fp.map(y=>({value:y,label:y==="has-blockers"?"Has blockers":y==="blocks-others"?"Blocks others":"No dependencies",count:f("dependencies",y)}));return{priority:h,category:p,tags:g,effort:x,dependencies:b}},[e]);return{filters:t,toggleFilter:r,clearField:s,clearAll:i,hasActiveFilters:o,filteredScopes:l,optionsWithCounts:c}}const Rl="cc-board-sort",Dl="cc-board-collapsed",zp={id:"asc",priority:"asc",effort:"asc",updated_at:"desc",created_at:"desc",title:"asc"},wu={critical:0,high:1,medium:2,low:3};function ku(e){if(!e)return 1/0;const t=Ki.indexOf(e);return t>=0?t:1/0}function vo(){try{const e=localStorage.getItem(Rl);if(e){const t=JSON.parse(e);if(t.field in zp)return{field:t.field,direction:t.direction==="desc"?"desc":"asc"}}}catch{}return{field:"id",direction:"asc"}}function ju(){try{const e=localStorage.getItem(Dl);if(e){const t=JSON.parse(e);if(Array.isArray(t))return new Set(t)}}catch{}return new Set}function uk(e,t){try{localStorage.setItem(Rl,JSON.stringify({field:e,direction:t}))}catch{}}function dk(e){try{localStorage.setItem(Dl,JSON.stringify([...e]))}catch{}}function Vp(e,t,n){return[...e].sort((s,i)=>{const o=fk(s,i,t);return n==="desc"?-o:o})}function fk(e,t,n){switch(n){case"id":return e.id-t.id;case"priority":{const r=e.priority?wu[e.priority]??1/0:1/0,s=t.priority?wu[t.priority]??1/0:1/0;return r-s}case"effort":return ku(e.effort_estimate)-ku(t.effort_estimate);case"updated_at":{const r=e.updated_at?new Date(e.updated_at).getTime():0,s=t.updated_at?new Date(t.updated_at).getTime():0;return r-s}case"created_at":{const r=e.created_at?new Date(e.created_at).getTime():0,s=t.created_at?new Date(t.created_at).getTime():0;return r-s}case"title":return e.title.localeCompare(t.title);default:return 0}}function hk(){const[e,t]=m.useState(()=>vo().field),[n,r]=m.useState(()=>vo().direction),[s,i]=m.useState(ju);m.useEffect(()=>{function c(u){if(u.key===Rl){const d=vo();t(d.field),r(d.direction)}u.key===Dl&&i(ju())}return window.addEventListener("storage",c),()=>window.removeEventListener("storage",c)},[]);const o=m.useCallback(c=>{t(u=>(r(d=>{const f=u===c?d==="asc"?"desc":"asc":zp[c];return uk(c,f),f}),c))},[]),l=m.useCallback(c=>{i(u=>{const d=new Set(u);return d.has(c)?d.delete(c):d.add(c),dk(d),d})},[]);return{sortField:e,sortDirection:n,setSort:o,collapsed:s,toggleCollapse:l}}const Ol="cc-view-mode",Ll="cc-swim-group",Il="cc-swim-collapsed";function Su(){try{const e=localStorage.getItem(Ol);if(e==="kanban"||e==="swimlane")return e}catch{}return"kanban"}function Nu(){try{const e=localStorage.getItem(Ll);if(e==="priority"||e==="category"||e==="tags"||e==="effort"||e==="dependencies")return e}catch{}return"priority"}function Cu(){try{const e=localStorage.getItem(Il);if(e){const t=JSON.parse(e);if(Array.isArray(t))return new Set(t)}}catch{}return new Set}function pk(e){try{localStorage.setItem(Ol,e)}catch{}}function mk(e){try{localStorage.setItem(Ll,e)}catch{}}function Eu(e){try{localStorage.setItem(Il,JSON.stringify([...e]))}catch{}}function gk(){const[e,t]=m.useState(Su),[n,r]=m.useState(Nu),[s,i]=m.useState(Cu);m.useEffect(()=>{function u(d){d.key===Ol&&t(Su()),d.key===Ll&&r(Nu()),d.key===Il&&i(Cu())}return window.addEventListener("storage",u),()=>window.removeEventListener("storage",u)},[]);const o=m.useCallback(u=>{t(u),pk(u)},[]),l=m.useCallback(u=>{r(u),mk(u),i(new Set),Eu(new Set)},[]),c=m.useCallback(u=>{i(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),Eu(f),f})},[]);return{viewMode:e,setViewMode:o,groupField:n,setGroupField:l,collapsedLanes:s,toggleLaneCollapse:c}}function $p(){const{settings:e}=fl();return m.useMemo(()=>e.fontScale===1?[]:[({transform:n})=>({...n,x:n.x/e.fontScale,y:n.y/e.fontScale})],[e.fontScale])}async function xk(e){try{const t=await fetch(`/api/orbital/dispatch/active?scope_id=${e}`);if(!t.ok)return!1;const{active:n}=await t.json();return n!=null}catch{return!1}}function wo(e){const t=String(e);if(t.startsWith("sprint-drop-"))return{type:"sprint-drop",sprintId:parseInt(t.slice(12))};if(t.startsWith("sprint-"))return{type:"sprint",sprintId:parseInt(t.slice(7))};if(typeof e=="number"||/^\d+$/.test(t))return{type:"scope",scopeId:Number(e)};if(t.startsWith("swim::")){const n=t.lastIndexOf("::");return{type:"column",status:t.slice(n+2)}}return{type:"column",status:t}}function yk({scopes:e,sprints:t,onAddToSprint:n}){const{engine:r}=wt(),[s,i]=m.useState({activeScope:null,activeSprint:null,overId:null,overIsValid:!1,overSprintId:null,pending:null,showModal:!1,showPopover:!1,showIdeaForm:!1,dispatching:!1,error:null,pendingSprintDispatch:null,pendingUnmetDeps:null,pendingDepSprintId:null}),o=m.useRef(null),l=m.useRef(null);m.useEffect(()=>{o.current=s.activeScope,l.current=s.activeSprint},[s.activeScope,s.activeSprint]);const c=m.useCallback(S=>{const A=wo(S.active.id);if(A){if(A.type==="scope"){const v=e.find(M=>M.id===A.scopeId);v&&i(M=>({...M,activeScope:v,activeSprint:null,overId:null,overIsValid:!1,overSprintId:null,error:null}))}else if(A.type==="sprint"){const v=t.find(M=>M.id===A.sprintId);v&&i(M=>({...M,activeScope:null,activeSprint:v,overId:null,overIsValid:!1,overSprintId:null,error:null}))}}},[e,t]),u=m.useCallback(S=>{var O;const A=(O=S.over)==null?void 0:O.id;if(!A){i(P=>({...P,overId:null,overIsValid:!1,overSprintId:null}));return}const v=wo(A);if(!v)return;const M=l.current,N=o.current;if(M){v.type==="column"&&v.status==="implementing"?i(P=>({...P,overId:"implementing",overIsValid:!0,overSprintId:null})):i(P=>({...P,overId:null,overIsValid:!1,overSprintId:null}));return}if(N)if(v.type==="sprint-drop"){const P=t.find(F=>F.id===v.sprintId),V=(P==null?void 0:P.status)==="assembling"&&N.status===P.target_column;i(F=>({...F,overId:null,overIsValid:!!V,overSprintId:v.sprintId}))}else if(v.type==="column"){const P=r.isValidTransition(N.status,v.status);i(V=>({...V,overId:v.status,overIsValid:P,overSprintId:null}))}else i(P=>({...P,overId:null,overIsValid:!1,overSprintId:null}))},[t,r]),d=m.useCallback(async S=>{var O;const A=(O=S.over)==null?void 0:O.id,v=o.current,M=l.current;if(i(P=>({...P,activeScope:null,activeSprint:null,overId:null,overIsValid:!1,overSprintId:null})),!A)return;const N=wo(A);if(N){if(M&&N.type==="column"&&N.status==="implementing"){i(P=>({...P,pendingSprintDispatch:M}));return}if(v&&N.type==="sprint-drop"){const P=t.find(F=>F.id===N.sprintId);if(P&&v.status!==P.target_column){i(F=>({...F,error:`Cannot add ${v.status} scope to ${P.target_column} ${P.group_type} — scope status must match ${P.group_type} column`}));return}const V=await n(N.sprintId,[v.id]);V&&V.unmet_dependencies.length>0&&i(F=>({...F,pendingUnmetDeps:V.unmet_dependencies,pendingDepSprintId:N.sprintId}));return}if(v&&N.type==="column"){if(v.status===N.status)return;const P=r.findEdge(v.status,N.status);if(!P)return;const V=P.command!=null?await xk(v.id):!1;P.confirmLevel==="full"?i(F=>({...F,pending:{scope:v,transition:P,hasActiveSession:V},showModal:!0,showPopover:!1})):i(F=>({...F,pending:{scope:v,transition:P,hasActiveSession:V},showPopover:!0,showModal:!1}))}}},[n,r,t]),f=m.useCallback(async()=>{const{pending:S}=s;if(!S)return;i(N=>({...N,dispatching:!0,error:null}));const{scope:A,transition:v}=S,M=r.buildCommand(v,A.id);try{if(M){const N=await fetch("/api/orbital/dispatch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope_id:A.id,command:M,transition:v.skipServerTransition?void 0:{from:v.from,to:v.to}})});if(!N.ok){const O=await N.json().catch(()=>({error:"Request failed"}));throw new Error(O.error??`HTTP ${N.status}`)}}else{const N=r.getEntryPoint().id;if(A.status===N&&v.direction==="forward"&&!v.command){const P=await fetch(`/api/orbital/ideas/${A.id}/promote`,{method:"POST"});if(!P.ok){const V=await P.json().catch(()=>({error:"Request failed"}));throw new Error(V.error??`HTTP ${P.status}`)}}else{const P=await fetch(`/api/orbital/scopes/${A.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:v.to})});if(!P.ok){const V=await P.json().catch(()=>({error:"Request failed"}));throw new Error(V.error??`Failed to update scope status: HTTP ${P.status}`)}}}i(N=>({...N,pending:null,showModal:!1,showPopover:!1,dispatching:!1}))}catch(N){i(O=>({...O,dispatching:!1,error:N instanceof Error?N.message:"Dispatch failed"}))}},[s,r]),h=m.useCallback(()=>{i(S=>({...S,pending:null,showModal:!1,showPopover:!1,dispatching:!1,error:null}))},[]),p=m.useCallback(()=>{i(S=>({...S,error:null}))},[]),g=m.useCallback(()=>{i(S=>({...S,showPopover:!1,showModal:!0}))},[]),x=m.useCallback(()=>{i(S=>({...S,showIdeaForm:!0}))},[]),b=m.useCallback(()=>{i(S=>({...S,showIdeaForm:!1}))},[]),y=m.useCallback(async(S,A)=>{i(v=>({...v,dispatching:!0,error:null}));try{const v=await fetch("/api/orbital/ideas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:S,description:A})});if(!v.ok){const M=await v.json().catch(()=>({error:"Request failed"}));throw new Error(M.error??`HTTP ${v.status}`)}i(M=>({...M,dispatching:!1,showIdeaForm:!1}))}catch(v){i(M=>({...M,dispatching:!1,error:v instanceof Error?v.message:"Failed to create idea"}))}},[]),j=m.useCallback(()=>{i(S=>({...S,pendingSprintDispatch:null}))},[]),w=m.useCallback(()=>{i(S=>({...S,pendingUnmetDeps:null,pendingDepSprintId:null}))},[]),E=m.useCallback(async S=>{s.pendingDepSprintId!=null&&await n(s.pendingDepSprintId,S),i(A=>({...A,pendingUnmetDeps:null,pendingDepSprintId:null}))},[s.pendingDepSprintId,n]),T=m.useCallback((S,A)=>{i(v=>({...v,pendingUnmetDeps:A,pendingDepSprintId:S}))},[]);return{state:s,onDragStart:c,onDragOver:u,onDragEnd:d,confirmTransition:f,cancelTransition:h,dismissError:p,openModalFromPopover:g,openIdeaForm:x,closeIdeaForm:b,submitIdea:y,dismissSprintDispatch:j,dismissUnmetDeps:w,resolveUnmetDeps:E,showUnmetDeps:T}}function bk(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),s=m.useCallback(async()=>{try{const p=await fetch("/api/orbital/sprints");if(!p.ok)return;const g=await p.json();t(g)}finally{r(!1)}},[]);m.useEffect(()=>{s()},[s]),jn(s),m.useEffect(()=>{function p(y){t(j=>[y,...j])}function g(y){t(j=>{const w=j.findIndex(E=>E.id===y.id);if(w>=0){const E=[...j];return E[w]=y,E}return[y,...j]})}function x({id:y}){t(j=>j.filter(w=>w.id!==y))}function b(y){t(j=>{const w=j.findIndex(E=>E.id===y.id);if(w>=0){const E=[...j];return E[w]=y,E}return j})}return Z.on("sprint:created",p),Z.on("sprint:updated",g),Z.on("sprint:deleted",x),Z.on("sprint:completed",b),()=>{Z.off("sprint:created",p),Z.off("sprint:updated",g),Z.off("sprint:deleted",x),Z.off("sprint:completed",b)}},[]);const i=m.useCallback(async(p,g)=>{const x=await fetch("/api/orbital/sprints",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p,...g})});return x.ok?x.json():null},[]),o=m.useCallback(async(p,g)=>(await fetch(`/api/orbital/sprints/${p}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:g})})).ok,[]),l=m.useCallback(async p=>(await fetch(`/api/orbital/sprints/${p}`,{method:"DELETE"})).ok,[]),c=m.useCallback(async(p,g)=>{const x=await fetch(`/api/orbital/sprints/${p}/scopes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope_ids:g})});return x.ok?x.json():null},[]),u=m.useCallback(async(p,g)=>(await fetch(`/api/orbital/sprints/${p}/scopes`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope_ids:g})})).ok,[]),d=m.useCallback(async p=>(await fetch(`/api/orbital/sprints/${p}/dispatch`,{method:"POST"})).json(),[]),f=m.useCallback(async p=>(await fetch(`/api/orbital/sprints/${p}/cancel`,{method:"POST"})).ok,[]),h=m.useCallback(async p=>{const g=await fetch(`/api/orbital/sprints/${p}/graph`);return g.ok?g.json():null},[]);return{sprints:e,loading:n,refetch:s,createSprint:i,renameSprint:o,deleteSprint:l,addScopes:c,removeScopes:u,dispatchSprint:d,cancelSprint:f,getGraph:h}}function vk(e,t,n,r){const[s,i]=m.useState(null),[o,l]=m.useState(!1);m.useEffect(()=>{if(!e)return;let d=!1;return l(!0),t(e.id).then(f=>{d||(i(f),l(!1))}),()=>{d=!0}},[e,t]);const c=m.useCallback(async()=>{e&&(await n(e.id),r(),i(null))},[e,n,r]),u=m.useCallback(()=>{r(),i(null)},[r]);return{graph:s,loading:o,showPreflight:e!=null,pendingSprint:e,onConfirm:c,onCancel:u}}function wk(e,t){const[n,r]=m.useState(!1),s=m.useCallback(async()=>{r(!0);try{const l=await fetch("/api/orbital/ideas/surprise",{method:"POST"});if(!l.ok){const c=await l.json().catch(()=>({error:"Request failed"}));throw new Error(c.error??`HTTP ${l.status}`)}e()}catch{}finally{r(!1)}},[e]),i=m.useCallback(async l=>{try{const c=await fetch(`/api/orbital/ideas/${l}/approve`,{method:"POST"});if(!c.ok)throw new Error(`HTTP ${c.status}`);t(null)}catch(c){console.error("[Orbital] Failed to approve idea:",c)}},[t]),o=m.useCallback(async l=>{try{const c=await fetch(`/api/orbital/ideas/${l}`,{method:"DELETE"});if(!c.ok)throw new Error(`HTTP ${c.status}`);t(null)}catch(c){console.error("[Orbital] Failed to reject idea:",c)}},[t]);return{surpriseLoading:n,handleSurprise:s,handleApproveGhost:i,handleRejectGhost:o}}function kk(e){return(e.split("/").pop()??"").replace(/\.md$/,"").toLowerCase()}function Tu(e,t){var r,s,i;const n=t.toLowerCase().trim();return!!(!n||e.title.toLowerCase().includes(n)||String(e.id).startsWith(n)||kk(e.file_path).includes(n)||(r=e.category)!=null&&r.toLowerCase().includes(n)||(s=e.priority)!=null&&s.toLowerCase().includes(n)||(i=e.effort_estimate)!=null&&i.toLowerCase().includes(n)||e.status.toLowerCase().includes(n)||e.tags.some(o=>o.toLowerCase().includes(n)))}function jk(e){const[t,n]=m.useState(""),[r,s]=m.useState("filter"),i=m.useDeferredValue(t),o=i.trim().length>0,l=t!==i,{displayScopes:c,dimmedIds:u,matchCount:d}=m.useMemo(()=>{if(!o)return{displayScopes:e,dimmedIds:new Set,matchCount:e.length};if(r==="filter"){const p=e.filter(g=>Tu(g,i));return{displayScopes:p,dimmedIds:new Set,matchCount:p.length}}const f=new Set;let h=0;for(const p of e)Tu(p,i)?h++:f.add(p.id);return{displayScopes:e,dimmedIds:f,matchCount:h}},[e,i,o,r]);return{query:t,setQuery:n,mode:r,setMode:s,hasSearch:o,isStale:l,displayScopes:c,dimmedIds:u,matchCount:d}}function Sk(){const[e,t]=xh(),n=e.get("highlight"),r=n!=null?Number(n):null,s=m.useCallback(()=>{t(i=>(i.delete("highlight"),i),{replace:!0})},[t]);return{highlightedScopeId:r,clearHighlight:s}}const Me=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:I("card-glass rounded border bg-card text-card-foreground shadow-none",e),...t}));Me.displayName="Card";const Ze=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:I("flex flex-col space-y-0.5 px-3 py-2",e),...t}));Ze.displayName="CardHeader";const at=m.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:I("text-sm font-light uppercase tracking-wider text-muted-foreground",e),...t}));at.displayName="CardTitle";const Nk=m.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:I("text-xs text-muted-foreground",e),...t}));Nk.displayName="CardDescription";const Fe=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:I("p-3 pt-0",e),...t}));Fe.displayName="CardContent";const Ck=m.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:I("flex items-center p-3 pt-0",e),...t}));Ck.displayName="CardFooter";const Ek={critical:"border-ask-red text-ask-red",high:"border-warning-amber text-warning-amber",medium:"border-accent-blue text-accent-blue",low:"border-muted-foreground/30 text-muted-foreground"},Tk={feature:"border-category-feature text-category-feature",bugfix:"border-category-bugfix text-category-bugfix",refactor:"border-category-refactor text-category-refactor",infrastructure:"border-category-infrastructure text-category-infrastructure",docs:"border-category-docs text-category-docs"},Ak={feature:"border-l-2 border-l-category-feature scope-cat-feature",bugfix:"border-l-2 border-l-category-bugfix scope-cat-bugfix",refactor:"border-l-2 border-l-category-refactor scope-cat-refactor",infrastructure:"border-l-2 border-l-category-infrastructure scope-cat-infrastructure",docs:"border-l-2 border-l-category-docs scope-cat-docs"},ko="inline-block rounded border px-1.5 py-0 text-[10px] uppercase bg-transparent";function Pk({scopeId:e,info:t,onRecover:n,onDismiss:r}){return a.jsxs(xr,{children:[a.jsx(yr,{asChild:!0,onClick:s=>s.stopPropagation(),children:a.jsx("button",{className:"flex items-center gap-0.5 text-amber-500 hover:text-amber-400 transition-colors",children:a.jsx(wn,{className:"h-3 w-3"})})}),a.jsxs(Vn,{className:"w-56 p-3",side:"top",align:"end",onClick:s=>s.stopPropagation(),children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Session ended without completing work."}),a.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.from_status&&a.jsxs("button",{className:"flex items-center gap-1.5 text-xs px-2 py-1.5 rounded bg-amber-500/10 text-amber-500 hover:bg-amber-500/20 transition-colors",onClick:()=>n(e,t.from_status),children:[a.jsx(H0,{className:"h-3 w-3"}),"Revert to ",t.from_status]}),a.jsxs("button",{className:"flex items-center gap-1.5 text-xs px-2 py-1.5 rounded bg-muted text-muted-foreground hover:bg-muted/80 transition-colors",onClick:()=>r(e),children:[a.jsx(mt,{className:"h-3 w-3"}),"Keep here"]})]})]})]})}function Mk(e){const t=e.toLowerCase().trim(),n=t.match(/^~?(\d+)(?:\s*-\s*\d+)?\s*min/);if(n)return`${n[1]}M`;const r=t.match(/^~?(\d+(?:\.\d+)?)(?:\s*-\s*\d+(?:\.\d+)?)?\s*hour/);if(r)return`${r[1]}H`;const s=t.match(/\((\d+(?:\.\d+)?)(?:\s*-\s*\d+(?:\.\d+)?)?\s*(hour|min)/);return s?`${s[1]}${s[2].startsWith("h")?"H":"M"}`:t.includes("large")||t.includes("multi")?"LG":t.includes("medium")||t.includes("half")?"MD":t.includes("small")?"SM":"TBD"}function cr({scope:e,onClick:t,isDragOverlay:n,cardDisplay:r,dimmed:s}){const{attributes:i,listeners:o,setNodeRef:l,transform:c,isDragging:u}=wr({id:e.id,disabled:n||s}),d=c?{transform:Fn.Translate.toString(c)}:void 0,{engine:f}=wt(),{activeScopes:h,abandonedScopes:p,recoverScope:g,dismissAbandoned:x}=tk(),b=f.getEntryPoint().id,y=e.status===b,j=y&&!!e.is_ghost,w=!y&&h.has(e.id),E=y?void 0:p.get(e.id),T=!!E&&!w;return a.jsx(Me,{ref:l,style:d,className:I("scope-card cursor-grab transition-[colors,opacity] duration-200 hover:bg-surface-light active:cursor-grabbing",j?"scope-card-ghost ghost-shimmer opacity-70":y?"border-l-2 border-dashed border-l-warning-amber/60":e.category?Ak[e.category]:"",w&&"scope-card-dispatched",T&&"scope-card-abandoned",u&&"opacity-30",s&&!u&&"opacity-30 cursor-default"),onClick:()=>{u||t==null||t(e)},...i,...o,children:a.jsxs(Fe,{className:"px-2.5 py-1.5",children:[a.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5",children:[j?a.jsxs("span",{className:"flex items-center gap-1 text-xxs text-purple-400",children:[a.jsx(cl,{className:"h-3 w-3"}),"ai suggestion"]}):y?a.jsxs("span",{className:"flex items-center gap-1 text-xxs text-warning-amber",children:[a.jsx(a0,{className:"h-3 w-3"}),"idea"]}):a.jsxs("span",{className:"font-mono text-xxs text-muted-foreground flex items-center gap-1",children:[w&&a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-pink-500 dispatch-pulse"}),T&&a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"}),dt(e.id)]}),!y&&a.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[T&&a.jsx(Pk,{scopeId:e.id,info:E,onRecover:g,onDismiss:x}),e.effort_estimate&&(r==null?void 0:r.effort)!==!1&&a.jsx("span",{className:I(ko,"effort-ghost border-muted-foreground/30 text-muted-foreground"),children:Mk(e.effort_estimate)}),e.category&&(r==null?void 0:r.category)!==!1&&a.jsx("span",{className:I(ko,Tk[e.category]??"border-muted-foreground/30 text-muted-foreground"),children:e.category}),e.priority&&(r==null?void 0:r.priority)!==!1&&a.jsx("span",{className:I(ko,Ek[e.priority]??"border-muted-foreground/30 text-muted-foreground"),children:e.priority})]})]}),a.jsx("h3",{className:"text-xs font-light leading-snug line-clamp-2",children:e.title}),!y&&e.tags.length>0&&(r==null?void 0:r.tags)!==!1&&a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[e.tags.slice(0,3).map(S=>a.jsx("span",{className:"glass-pill inline-block rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:S},S)),e.tags.length>3&&a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",e.tags.length-3]})]})]})})}const _k={assembling:"border-dashed border-cyan-500/40",dispatched:"border-solid border-amber-500/50 batch-group-dispatched",in_progress:"border-solid border-amber-500/40 batch-group-dispatched",completed:"border-solid border-green-500/40 opacity-60",failed:"border-solid border-red-500/40",cancelled:"border-solid border-muted-foreground/30 opacity-50"},Rk={assembling:"Assembling",dispatched:"Dispatched",in_progress:"Running",completed:"Complete",failed:"Failed",cancelled:"Cancelled"};function Dk(e){let t=0;for(const n of e.scopes){if(!n.effort_estimate)continue;const r=n.effort_estimate.toLowerCase().match(/(\d+(?:\.\d+)?)\s*hour/);r&&(t+=parseFloat(r[1]));const s=n.effort_estimate.toLowerCase().match(/(\d+)\s*min/);s&&(t+=parseInt(s[1])/60)}return t===0?"TBD":t<1?`${Math.round(t*60)}M`:`~${t.toFixed(0)}H`}function Ok({sprint:e,scopeLookup:t,onDelete:n,onDispatch:r,onRename:s,onScopeClick:i,cardDisplay:o,dimmedIds:l,looseCount:c,onAddAll:u,editingName:d,onEditingDone:f}){var k;const{engine:h}=wt(),p=e.status==="assembling",[g,x]=m.useState(d??!1),[b,y]=m.useState(e.name),j=m.useRef(null);m.useEffect(()=>{d&&(x(!0),y(""))},[d]),m.useEffect(()=>{var _;g&&((_=j.current)==null||_.focus())},[g]);const w=()=>{const _=b.trim();_&&_!==e.name&&s&&s(e.id,_),x(!1),y(_||e.name),f==null||f()},E=e.group_type==="batch",T=E?(()=>{var $;const _=h.getBatchTargetStatus(e.target_column);return _?(($=h.findEdge(e.target_column,_))==null?void 0:$.label)??"Dispatch":"Dispatch"})():void 0,{attributes:S,listeners:A,setNodeRef:v,transform:M,isDragging:N}=wr({id:`sprint-${e.id}`,disabled:E||!p||e.scope_ids.length===0}),{setNodeRef:O,isOver:P}=Bn({id:`sprint-drop-${e.id}`,disabled:!p}),V=M?{transform:Fn.Translate.toString(M)}:void 0,F=e.scope_ids.length,{progress:R}=e,Y=E&&p&&F>0&&r,G=E?Rh:ol,H=E?"text-amber-400":"text-cyan-400",L=E&&p?"border-muted-foreground/30":_k[e.status]??"border-muted-foreground/30";return a.jsxs("div",{ref:v,style:{...V,...E&&p?{borderColor:(((k=h.getList(e.target_column))==null?void 0:k.hex)??"")+"80"}:void 0},className:I("rounded-lg border bg-card/30 transition-all duration-200",L,N&&"opacity-30",!E&&p&&"cursor-grab active:cursor-grabbing"),...E?{}:S,...E?{}:A,children:[a.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 border-b border-inherit",children:[a.jsx(G,{className:I("h-3 w-3 shrink-0",H)}),g?a.jsx("input",{ref:j,className:"min-w-0 flex-1 h-5 rounded bg-muted/50 px-1.5 text-xs font-medium text-foreground border border-cyan-500/30 focus:outline-none focus:ring-1 focus:ring-cyan-500/50",placeholder:E?"Batch name...":"Sprint name...",value:b,onChange:_=>y(_.target.value),onKeyDown:_=>{_.key==="Enter"&&w(),_.key==="Escape"&&(x(!1),y(e.name),f==null||f())},onBlur:w,onClick:_=>_.stopPropagation()}):a.jsx("span",{className:I("text-xs font-medium text-foreground truncate flex-1",p&&"cursor-text"),onDoubleClick:()=>{p&&(x(!0),y(e.name))},children:e.name}),a.jsx("span",{className:I("rounded px-1 py-0.5 text-[10px] uppercase",e.status==="dispatched"||e.status==="in_progress"?"bg-amber-500/20 text-amber-400":e.status==="completed"?"bg-green-500/20 text-green-400":e.status==="failed"?"bg-red-500/20 text-red-400":"text-muted-foreground"),children:Rk[e.status]}),p&&(c??0)>0&&u&&a.jsxs("button",{onClick:_=>{_.stopPropagation(),u(e.id)},className:"shrink-0 flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",title:`Add all ${c} remaining scopes`,children:["+ All (",c,")"]}),Y&&a.jsxs("button",{onClick:_=>{_.stopPropagation(),r(e.id)},className:"shrink-0 flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] bg-cyan-600/80 text-black hover:bg-cyan-500/80 transition-colors",title:T??"Dispatch",children:[a.jsx(hi,{className:"h-2.5 w-2.5"}),T??"Dispatch"]}),p&&n&&a.jsx("button",{onClick:_=>{_.stopPropagation(),n(e.id)},className:"shrink-0 text-muted-foreground hover:text-red-400 transition-colors",children:a.jsx(mt,{className:"h-3 w-3"})})]}),a.jsxs("div",{ref:O,className:I("p-1.5 space-y-1 min-h-[40px] transition-colors duration-150",P&&p&&"bg-cyan-500/5 ring-1 ring-inset ring-cyan-500/30 rounded-b-lg"),children:[e.scope_ids.map(_=>{const $=t.get(_);if(!$){const C=e.scopes.find(re=>re.scope_id===_);return a.jsxs("div",{className:"rounded border border-muted-foreground/20 bg-card/50 px-2 py-1 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-mono",children:dt(_)}),C&&a.jsx("span",{className:"ml-2",children:C.title})]},_)}return a.jsx(cr,{scope:$,onClick:i,cardDisplay:o,dimmed:l==null?void 0:l.has(_)},_)}),F===0&&p&&P&&a.jsx("p",{className:"py-3 text-center text-[10px] text-muted-foreground/50",children:"Drop to add"})]}),a.jsxs("div",{className:"flex items-center justify-between border-t border-inherit px-2.5 py-1",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:E?T??"Batch":`Effort: ${Dk(e)}`}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[F," scope",F!==1?"s":""]}),e.status!=="assembling"&&F>0&&a.jsxs("div",{className:"flex items-center gap-1",children:[R.completed>0&&a.jsxs("span",{className:"text-[10px] text-green-400",children:[R.completed," done"]}),R.failed>0&&a.jsxs("span",{className:"text-[10px] text-red-400",children:[R.failed," fail"]}),R.in_progress>0&&a.jsxs("span",{className:"text-[10px] text-amber-400",children:[R.in_progress," active"]})]})]}),E&&e.dispatch_result&&a.jsxs("div",{className:"border-t border-inherit px-2.5 py-1 text-[10px] text-muted-foreground space-y-0.5",children:[e.dispatch_result.commit_sha&&a.jsx("span",{className:"font-mono",children:e.dispatch_result.commit_sha.slice(0,7)}),e.dispatch_result.pr_url&&a.jsxs("a",{href:e.dispatch_result.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-cyan-400 hover:underline ml-1",children:["PR #",e.dispatch_result.pr_number??""]})]})]})}function Lk({sprint:e}){return a.jsxs("div",{className:"w-72 rotate-1 opacity-90 shadow-xl shadow-black/40 rounded-lg border border-cyan-500/40 bg-card/80 p-2",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(ol,{className:"h-3 w-3 text-cyan-400"}),a.jsx("span",{className:"text-xs font-medium",children:e.name})]}),a.jsxs("div",{className:"space-y-0.5",children:[e.scopes.slice(0,3).map(t=>a.jsxs("div",{className:"rounded bg-muted/30 px-1.5 py-0.5 text-[10px] text-muted-foreground truncate",children:[dt(t.scope_id)," ",t.title]},t.scope_id)),e.scopes.length>3&&a.jsxs("p",{className:"text-[10px] text-muted-foreground text-center",children:["+",e.scopes.length-3," more"]})]})]})}const Ik=[{field:"id",label:"Scope ID"},{field:"priority",label:"Priority"},{field:"effort",label:"Effort"},{field:"updated_at",label:"Last Updated"},{field:"created_at",label:"Created"},{field:"title",label:"Alphabetical"}];function Au({sortField:e,sortDirection:t,onSetSort:n,collapsed:r,onToggleCollapse:s}){const i=t==="asc"?Cb:gn;return a.jsxs(xr,{children:[a.jsx(yr,{asChild:!0,children:a.jsx("button",{className:"ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-white/[0.06] hover:text-foreground","aria-label":"Column menu",children:a.jsx(Bb,{className:"h-3 w-3"})})}),a.jsxs(Vn,{className:"filter-popover-glass !bg-transparent w-44",align:"end",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("p",{className:"px-2 pb-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Sort by"}),Ik.map(o=>{const l=e===o.field;return a.jsxs("button",{onClick:()=>n(o.field),className:I("flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors","hover:bg-white/[0.06]",l&&"bg-white/[0.06]"),children:[a.jsx("span",{className:I("flex h-3 w-3 shrink-0 items-center justify-center rounded-full border",l?"border-primary bg-primary":"border-white/15"),children:l&&a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-white"})}),a.jsx("span",{className:I("flex-1 text-left",l&&"text-foreground"),children:o.label}),l&&a.jsx(i,{className:"h-3 w-3 text-muted-foreground"})]},o.field)})]}),a.jsx("div",{className:"my-1.5 border-t border-white/10"}),a.jsxs("button",{onClick:s,className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors hover:bg-white/[0.06]",children:[r?a.jsx(Oi,{className:"h-3 w-3 text-muted-foreground"}):a.jsx($b,{className:"h-3 w-3 text-muted-foreground"}),a.jsx("span",{children:r?"Expand column":"Collapse column"})]})]})]})}function Fk({id:e,label:t,color:n,scopes:r,sprints:s=[],scopeLookup:i=new Map,globalSprintScopeIds:o,onScopeClick:l,onDeleteSprint:c,onDispatchSprint:u,onRenameSprint:d,editingSprintId:f,onSprintEditingDone:h,isValidDrop:p,isDragActive:g,headerExtra:x,collapsed:b,onToggleCollapse:y,sortField:j,sortDirection:w,onSetSort:E,cardDisplay:T,dimmedIds:S,onAddAllToSprint:A}){kn();const{setNodeRef:v,isOver:M}=Bn({id:e}),N=o??new Set(s.flatMap(R=>R.scope_ids)),O=r.filter(R=>!N.has(R.id)),P=O.filter(R=>!R.is_ghost).map(R=>R.id),V=r.length,F=b;return a.jsx("div",{ref:v,className:I("flex h-full flex-shrink-0 flex-col rounded border bg-card/50 overflow-hidden transition-[width] duration-300 ease-in-out",F?"w-10 cursor-pointer items-center":"w-72","card-glass neon-border-blue",g&&M&&p&&"ring-2 ring-green-500/60 border-green-500/40 bg-green-500/5",g&&M&&!p&&"ring-2 ring-red-500/50 border-red-500/30 bg-red-500/5",g&&!M&&p&&"border-green-500/20"),onClick:F?y:void 0,children:F?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex items-center justify-center py-1.5",onClick:R=>R.stopPropagation(),children:j&&w&&E&&y&&a.jsx(Au,{sortField:j,sortDirection:w,onSetSort:E,collapsed:!0,onToggleCollapse:y})}),a.jsx("div",{className:"flex items-start justify-center overflow-hidden pt-2",children:a.jsxs("div",{className:"flex items-center gap-2 [writing-mode:vertical-lr]",children:[a.jsx("div",{className:I("h-2.5 w-2.5 rounded-full shrink-0","animate-glow-pulse"),style:{backgroundColor:`hsl(${n})`}}),a.jsx("span",{className:"text-xxs uppercase tracking-wider font-normal text-muted-foreground whitespace-nowrap",children:t})]})}),a.jsx("span",{className:"mt-2 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-normal text-muted-foreground",children:V})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 border-b px-2.5 py-1.5 cursor-pointer",onClick:y,children:[a.jsx("div",{className:I("h-2.5 w-2.5 rounded-full","animate-glow-pulse"),style:{backgroundColor:`hsl(${n})`}}),a.jsx("h2",{className:"text-xxs uppercase tracking-wider font-normal text-muted-foreground",children:t}),a.jsx("span",{className:"ml-auto rounded-full bg-muted px-2 py-0.5 text-xs font-normal text-muted-foreground",children:V}),x&&a.jsx("span",{onClick:R=>R.stopPropagation(),children:x}),j&&w&&E&&y&&a.jsx("span",{onClick:R=>R.stopPropagation(),children:a.jsx(Au,{sortField:j,sortDirection:w,onSetSort:E,collapsed:!1,onToggleCollapse:y})})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:a.jsxs("div",{className:"space-y-1.5",children:[s.map(R=>a.jsx(Ok,{sprint:R,scopeLookup:i,onDelete:c,onDispatch:u,onRename:d,onScopeClick:l,cardDisplay:T,dimmedIds:S,editingName:R.id===f,onEditingDone:h,looseCount:R.status==="assembling"?P.length:0,onAddAll:R.status==="assembling"&&A?Y=>A(Y,P):void 0},`sprint-${R.id}`)),O.filter(R=>!R.is_ghost).map(R=>a.jsx(cr,{scope:R,onClick:l,cardDisplay:T,dimmed:S==null?void 0:S.has(R.id)},R.id)),O.some(R=>R.is_ghost)&&O.some(R=>!R.is_ghost)&&a.jsx("div",{className:"my-2 border-t border-dashed border-purple-500/20"}),O.filter(R=>R.is_ghost).map(R=>a.jsx(cr,{scope:R,onClick:l,cardDisplay:T,dimmed:S==null?void 0:S.has(R.id)},R.id)),V===0&&g&&M&&p&&a.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground/50",children:"Drop here"})]})})]})})}var Bk=Symbol.for("react.lazy"),vi=gy[" use ".trim().toString()];function zk(e){return typeof e=="object"&&e!==null&&"then"in e}function Hp(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Bk&&"_payload"in e&&zk(e._payload)}function Up(e){const t=$k(e),n=m.forwardRef((r,s)=>{let{children:i,...o}=r;Hp(i)&&typeof vi=="function"&&(i=vi(i._payload));const l=m.Children.toArray(i),c=l.find(Uk);if(c){const u=c.props.children,d=l.map(f=>f===c?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...o,ref:s,children:m.isValidElement(u)?m.cloneElement(u,void 0,d):null})}return a.jsx(t,{...o,ref:s,children:i})});return n.displayName=`${e}.Slot`,n}var Vk=Up("Slot");function $k(e){const t=m.forwardRef((n,r)=>{let{children:s,...i}=n;if(Hp(s)&&typeof vi=="function"&&(s=vi(s._payload)),m.isValidElement(s)){const o=qk(s),l=Wk(i,s.props);return s.type!==m.Fragment&&(l.ref=r?oh(r,o):o),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Hk=Symbol("radix.slottable");function Uk(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Hk}function Wk(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function qk(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Gk=rp("inline-flex items-center justify-center whitespace-nowrap rounded text-xs font-normal ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 glow-blue",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-border bg-background hover:bg-surface-light hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-surface-light hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 px-3 py-1.5",sm:"h-7 rounded px-2.5",lg:"h-9 rounded px-5",icon:"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),fe=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?Vk:"button";return a.jsx(o,{className:I(Gk({variant:t,size:n,className:e})),ref:i,...s})});fe.displayName="Button";const Kk=[{key:"effort",label:"Effort"},{key:"category",label:"Category"},{key:"priority",label:"Priority"},{key:"tags",label:"Tags"}];function Yk({display:e,onToggle:t,hiddenCount:n}){return a.jsxs(xr,{children:[a.jsx(yr,{asChild:!0,children:a.jsxs(fe,{variant:"outline",size:"sm",className:"gap-1.5 backdrop-blur-sm bg-white/[0.03] border-white/10","aria-label":"Toggle card display fields",children:[a.jsx(R0,{className:"h-3 w-3"}),"Display",n>0&&a.jsx("span",{className:"ml-0.5 rounded-full bg-white/10 px-1.5 text-[10px]",children:n})]})}),a.jsx(Vn,{align:"end",className:"filter-popover-glass !bg-transparent w-40",children:a.jsx("div",{className:"space-y-0.5",children:Kk.map(({key:r,label:s})=>{const i=e[r];return a.jsxs("button",{onClick:()=>t(r),className:I("flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors","hover:bg-white/[0.06]",i&&"bg-white/[0.06]"),children:[a.jsx("span",{className:I("flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border",i?"border-primary bg-primary text-primary-foreground":"border-white/15"),children:i&&a.jsx("svg",{className:"h-2.5 w-2.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),a.jsx("span",{className:I("capitalize",i&&"text-foreground"),children:s})]},r)})})})]})}const Xk=[{value:"kanban",label:"Kanban",Icon:Th},{value:"swimlane",label:"Swimlane",Icon:Oh}],Jk=[{value:"priority",label:"Priority"},{value:"category",label:"Category"},{value:"tags",label:"Tags"},{value:"effort",label:"Effort"},{value:"dependencies",label:"Dependencies"}];function Qk({viewMode:e,groupField:t,onViewModeChange:n,onGroupFieldChange:r}){const s=e==="swimlane"?Oh:Th;return a.jsxs(xr,{children:[a.jsx(yr,{asChild:!0,children:a.jsxs(fe,{variant:"outline",size:"sm",className:"gap-1.5 backdrop-blur-sm bg-white/[0.03] border-white/10","aria-label":"Toggle view mode",children:[a.jsx(s,{className:"h-3 w-3"}),e==="swimlane"?"Swimlane":"Kanban"]})}),a.jsxs(Vn,{align:"end",className:"filter-popover-glass !bg-transparent w-44",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("p",{className:"px-2 pb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:"View"}),Xk.map(({value:i,label:o,Icon:l})=>a.jsxs("button",{onClick:()=>n(i),className:I("flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors","hover:bg-white/[0.06]",e===i&&"bg-white/[0.06]"),children:[a.jsx("span",{className:I("flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full border",e===i?"border-primary bg-primary":"border-white/15"),children:e===i&&a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary-foreground"})}),a.jsx(l,{className:"h-3 w-3 text-muted-foreground"}),a.jsx("span",{className:I(e===i&&"text-foreground"),children:o})]},i))]}),e==="swimlane"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"my-2 border-t border-white/[0.06]"}),a.jsxs("div",{className:"space-y-0.5",children:[a.jsx("p",{className:"px-2 pb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:"Group by"}),Jk.map(({value:i,label:o})=>a.jsxs("button",{onClick:()=>r(i),className:I("flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors","hover:bg-white/[0.06]",t===i&&"bg-white/[0.06]"),children:[a.jsx("span",{className:I("flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full border",t===i?"border-primary bg-primary":"border-white/15"),children:t===i&&a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary-foreground"})}),a.jsx("span",{className:I(t===i&&"text-foreground"),children:o})]},i))]})]})]})]})}function Zk({laneValue:e,status:t,scopes:n=[],onScopeClick:r,cardDisplay:s,dimmedIds:i,isDragActive:o,isValidDrop:l,isCollapsed:c}){const u=`swim::${e}::${t}`,{setNodeRef:d,isOver:f}=Bn({id:u});return c?null:a.jsx("div",{ref:d,className:I("swim-cell min-h-[48px] rounded border border-white/[0.04] p-1 transition-colors",o&&f&&l&&"ring-2 ring-green-500/60 border-green-500/40 bg-green-500/5",o&&f&&!l&&"ring-2 ring-red-500/50 border-red-500/30 bg-red-500/5",o&&!f&&l&&"border-green-500/20",n.length===0&&"border-dashed border-white/[0.06]"),children:a.jsxs("div",{className:"space-y-1.5",children:[n.filter(h=>!h.is_ghost).map(h=>a.jsx(cr,{scope:h,onClick:r,cardDisplay:s,dimmed:i==null?void 0:i.has(h.id)},h.id)),n.filter(h=>h.is_ghost).map(h=>a.jsx(cr,{scope:h,onClick:r,cardDisplay:s,dimmed:i==null?void 0:i.has(h.id)},h.id))]})})}function ej({lane:e,columns:t,collapsedColumns:n,isLaneCollapsed:r,onToggleLane:s,onScopeClick:i,cardDisplay:o,dimmedIds:l,isDragActive:c,validTargets:u}){return r?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:s,className:"swim-lane-header flex items-center gap-2 rounded-l px-3 py-1.5 text-left hover:bg-white/[0.04] transition-colors cursor-pointer sticky left-0 z-10 bg-background",children:[a.jsx("div",{className:I("h-full w-0.5 rounded-full shrink-0 self-stretch",e.color)}),a.jsx(Zt,{className:"h-3 w-3 text-muted-foreground shrink-0"}),a.jsx("span",{className:"text-xxs font-medium text-muted-foreground truncate capitalize",children:e.label}),a.jsx("span",{className:"ml-auto rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground shrink-0",children:e.count})]}),t.map(d=>a.jsx("div",{className:I(n.has(d.id)&&"hidden")},d.id))]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:s,className:"swim-lane-header flex items-start gap-2 rounded-l px-3 py-2 text-left hover:bg-white/[0.04] transition-colors cursor-pointer sticky left-0 z-10 bg-background",children:[a.jsx("div",{className:I("w-0.5 rounded-full shrink-0 min-h-[32px] self-stretch",e.color)}),a.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Zt,{className:"h-3 w-3 text-muted-foreground shrink-0 rotate-90 transition-transform"}),a.jsx("span",{className:"swim-lane-label text-xxs font-medium text-foreground/80 truncate capitalize",children:e.label})]}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.count," scope",e.count!==1?"s":""]})]})]}),t.map(d=>a.jsx(Zk,{laneValue:e.value,status:d.id,scopes:e.cells[d.id],onScopeClick:i,cardDisplay:o,dimmedIds:l,isDragActive:c,isValidDrop:u.has(d.id),isCollapsed:n.has(d.id)},d.id))]})}function tj({lanes:e,columns:t,collapsedColumns:n,collapsedLanes:r,onToggleLane:s,onToggleCollapse:i,onScopeClick:o,cardDisplay:l,dimmedIds:c,isDragActive:u,validTargets:d,sprints:f}){kn();const h=t.filter(x=>!n.has(x.id)),p=`140px ${h.map(()=>"200px").join(" ")}`,g=f.some(x=>x.group_type==="sprint"||x.group_type==="batch"&&x.status!=="completed");return a.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[g&&a.jsxs("div",{className:"mb-2 flex items-center gap-2 rounded border border-primary/20 bg-primary/5 px-3 py-1.5 text-xs text-muted-foreground",children:[a.jsx(r0,{className:"h-3.5 w-3.5 text-primary shrink-0"}),"Sprint groups are hidden in swimlane view"]}),a.jsxs("div",{className:"grid gap-px pb-4",style:{gridTemplateColumns:p,width:"max-content"},children:[a.jsx("div",{className:"sticky top-0 z-20 bg-background"}),h.map(x=>a.jsxs("button",{onClick:()=>i(x.id),className:I("sticky top-0 z-20 flex items-center gap-1.5 rounded-t border-b border-white/[0.06] bg-background px-2 py-1.5 text-left cursor-pointer hover:bg-white/[0.03] transition-colors","border-b-white/[0.08]"),children:[a.jsx("div",{className:I("h-2 w-2 rounded-full shrink-0","animate-glow-pulse"),style:{backgroundColor:`hsl(${x.color})`}}),a.jsx("span",{className:"text-xxs uppercase tracking-wider font-normal text-muted-foreground truncate",children:x.label})]},x.id)),e.map(x=>a.jsx(ej,{lane:x,columns:h,collapsedColumns:n,isLaneCollapsed:r.has(x.value),onToggleLane:()=>s(x.value),onScopeClick:o,cardDisplay:l,dimmedIds:c,isDragActive:u,validTargets:d},x.value)),e.length===0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{}),a.jsx("div",{className:I("col-span-full py-12 text-center text-xs text-muted-foreground"),children:"No scopes to display"})]})]})]})}function nj({activeScope:e,activeSprint:t,cardDisplay:n}){return a.jsxs(Lp,{dropAnimation:null,children:[e&&a.jsx("div",{className:"w-72 rotate-2 opacity-90 shadow-xl shadow-black/40",children:a.jsx(cr,{scope:e,cardDisplay:n})}),t&&a.jsx(Lk,{sprint:t})]})}const Nn=cy,rj=ay,Wp=m.forwardRef(({className:e,...t},n)=>a.jsx(fh,{ref:n,className:I("fixed inset-0 z-50 bg-black/70 dialog-overlay-glass data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Wp.displayName=fh.displayName;const rn=m.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(rj,{children:[a.jsx(Wp,{}),a.jsxs(hh,{ref:r,className:I("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-full border bg-background shadow-lg duration-200","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","card-glass rounded border-border bg-[#12121a]",e),...n,children:[t,a.jsxs(ly,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(mt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));rn.displayName=hh.displayName;function $n({className:e,...t}){return a.jsx("div",{className:I("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function kr({className:e,...t}){return a.jsx(uy,{className:I("text-sm font-normal leading-none tracking-tight",e),...t})}function jr({className:e,...t}){return a.jsx(dy,{className:I("text-sm text-muted-foreground",e),...t})}function sj({open:e,scope:t,transition:n,hasActiveSession:r,onConfirm:s,onCancel:i,onViewDetails:o}){var b;const l=m.useRef(null),[c,u]=m.useState(!1);if(m.useEffect(()=>{e&&(setTimeout(()=>{var y;return(y=l.current)==null?void 0:y.focus()},100),u(!1))},[e]),!t||!n)return null;const d=((b=n.command)==null?void 0:b.replace("{id}",String(t.id)))??null,f=n.direction==="forward"&&!n.command&&n.from!==n.to,h=t.status===n.from&&f,p=h?"/scope-create":d,g=h||d?"Launch":"Move";function x(){u(!0),s()}return a.jsx(Nn,{open:e,onOpenChange:y=>{y||i()},children:a.jsxs(rn,{className:"max-w-xs p-3 gap-0",children:[a.jsxs("div",{className:"mb-2.5 flex items-center gap-2",children:[a.jsx(Q,{variant:"outline",className:"text-xxs capitalize",children:n.from}),a.jsx(mr,{className:"h-3 w-3 text-muted-foreground"}),a.jsx(Q,{variant:"default",className:"text-xxs capitalize [color:#000]",children:n.to})]}),a.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:h?a.jsx("span",{className:"font-light",children:t.title}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-mono",children:dt(t.id)})," ",a.jsx("span",{className:"font-light",children:t.title})]})}),p&&a.jsxs("div",{className:"mb-3 flex items-center gap-1.5 rounded bg-black/40 px-2 py-1.5",children:[a.jsx(Ut,{className:"h-3 w-3 shrink-0 text-primary"}),a.jsx("code",{className:"text-xxs font-mono text-primary",children:p})]}),h&&a.jsx("p",{className:"mb-3 text-xxs text-muted-foreground",children:"Creates a scope document from this idea"}),r&&a.jsxs("div",{className:I("mb-3 flex items-start gap-1.5 rounded border px-2 py-1.5 text-xxs","border-warning-amber/30 bg-warning-amber/10 text-warning-amber"),children:[a.jsx(wn,{className:"mt-0.5 h-3 w-3 shrink-0"}),a.jsx("span",{children:"A CLI session is already running for this scope."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(fe,{ref:l,size:"sm",onClick:x,disabled:c,className:"flex-1",children:c?"Launching...":g}),a.jsx(fe,{size:"sm",variant:"ghost",onClick:i,disabled:c,children:"Cancel"})]}),(d||h)&&a.jsxs("button",{onClick:o,className:"mt-2 flex items-center gap-1 text-xxs text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(ys,{className:"h-2.5 w-2.5"}),"View Details"]})]})})}function ij({open:e,scope:t,transition:n,hasActiveSession:r,onConfirm:s,onCancel:i}){var x;const[o,l]=m.useState(new Set),[c,u]=m.useState(!1),d=(n==null?void 0:n.checklist)??[],f=d.length===0||o.size===d.length;if(m.useEffect(()=>{e&&(l(new Set),u(!1))},[e]),!t||!n)return null;const h=((x=n.command)==null?void 0:x.replace("{id}",String(t.id)))??null;function p(b){l(y=>{const j=new Set(y);return j.has(b)?j.delete(b):j.add(b),j})}async function g(){u(!0),s()}return a.jsx(Nn,{open:e,onOpenChange:b=>{b||i()},children:a.jsxs(rn,{className:"max-w-md p-0 gap-0",children:[a.jsxs($n,{className:"px-5 pt-4 pb-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Q,{variant:"outline",className:"text-xxs capitalize",children:n.from}),a.jsx(mr,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Q,{variant:"default",className:"text-xxs capitalize [color:#000]",children:n.to})]}),a.jsx(kr,{className:"text-sm font-normal",children:n.label}),a.jsx(jr,{className:"text-xs text-muted-foreground mt-1",children:n.description})]}),a.jsxs("div",{className:"px-5 pb-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"font-mono text-muted-foreground",children:dt(t.id)}),a.jsx("span",{className:"font-light truncate",children:t.title}),t.category&&a.jsx(Q,{variant:"secondary",className:"ml-auto text-xxs",children:t.category})]}),h&&a.jsxs("div",{className:"flex items-center gap-2 rounded border border-border bg-black/40 px-3 py-2",children:[a.jsx(Ut,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),a.jsx("code",{className:"text-xs font-mono text-primary",children:h})]}),d.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xxs font-medium text-muted-foreground uppercase tracking-wider",children:"Pre-launch checklist"}),d.map((b,y)=>a.jsxs("button",{onClick:()=>p(y),className:I("flex w-full items-center gap-2 rounded px-2.5 py-1.5 text-xs text-left transition-colors",o.has(y)?"bg-primary/10 text-foreground":"bg-muted/30 text-muted-foreground hover:bg-muted/50"),children:[a.jsx("div",{className:I("flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border transition-colors",o.has(y)?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/30"),children:o.has(y)&&a.jsx(sl,{className:"h-2.5 w-2.5"})}),a.jsx("span",{className:"font-light",children:b})]},y))]}),r&&a.jsxs("div",{className:I("flex items-start gap-2 rounded border px-3 py-2 text-xs","border-warning-amber/30 bg-warning-amber/10 text-warning-amber"),children:[a.jsx(wn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsx("span",{children:"A CLI session is already running for this scope. Launching will start a new one."})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx(fe,{onClick:g,disabled:!f||c,className:"flex-1",children:c?"Launching...":h?"Launch in iTerm":"Confirm Move"}),a.jsx(fe,{variant:"ghost",onClick:i,disabled:c,children:"Cancel"})]})]})]})})}var oj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aj=oj.reduce((e,t)=>{const n=Up(`Primitive.${t}`),r=m.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),lj="Separator",Pu="horizontal",cj=["horizontal","vertical"],qp=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=Pu,...s}=e,i=uj(r)?r:Pu,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(aj.div,{"data-orientation":i,...l,...s,ref:t})});qp.displayName=lj;function uj(e){return cj.includes(e)}var Gp=qp;const Xt=m.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},s)=>a.jsx(Gp,{ref:s,decorative:n,orientation:t,className:I("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Xt.displayName=Gp.displayName;function dj(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const fj=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hj=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pj={};function Mu(e,t){return(pj.jsx?hj:fj).test(e)}const mj=/[ \t\n\f\r]/g;function gj(e){return typeof e=="object"?e.type==="text"?_u(e.value):!1:_u(e)}function _u(e){return e.replace(mj,"")===""}class Ss{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ss.prototype.normal={};Ss.prototype.property={};Ss.prototype.space=void 0;function Kp(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ss(n,r,t)}function ka(e){return e.toLowerCase()}class gt{constructor(t,n){this.attribute=n,this.property=t}}gt.prototype.attribute="";gt.prototype.booleanish=!1;gt.prototype.boolean=!1;gt.prototype.commaOrSpaceSeparated=!1;gt.prototype.commaSeparated=!1;gt.prototype.defined=!1;gt.prototype.mustUseProperty=!1;gt.prototype.number=!1;gt.prototype.overloadedBoolean=!1;gt.prototype.property="";gt.prototype.spaceSeparated=!1;gt.prototype.space=void 0;let xj=0;const le=Hn(),Ve=Hn(),ja=Hn(),z=Hn(),Ee=Hn(),ir=Hn(),xt=Hn();function Hn(){return 2**++xj}const Sa=Object.freeze(Object.defineProperty({__proto__:null,boolean:le,booleanish:Ve,commaOrSpaceSeparated:xt,commaSeparated:ir,number:z,overloadedBoolean:ja,spaceSeparated:Ee},Symbol.toStringTag,{value:"Module"})),jo=Object.keys(Sa);class Fl extends gt{constructor(t,n,r,s){let i=-1;if(super(t,n),Ru(this,"space",s),typeof r=="number")for(;++i<jo.length;){const o=jo[i];Ru(this,jo[i],(r&Sa[o])===Sa[o])}}}Fl.prototype.defined=!0;function Ru(e,t,n){n&&(e[t]=n)}function Sr(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Fl(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[ka(r)]=r,n[ka(i.attribute)]=r}return new Ss(t,n,e.space)}const Yp=Sr({properties:{ariaActiveDescendant:null,ariaAtomic:Ve,ariaAutoComplete:null,ariaBusy:Ve,ariaChecked:Ve,ariaColCount:z,ariaColIndex:z,ariaColSpan:z,ariaControls:Ee,ariaCurrent:null,ariaDescribedBy:Ee,ariaDetails:null,ariaDisabled:Ve,ariaDropEffect:Ee,ariaErrorMessage:null,ariaExpanded:Ve,ariaFlowTo:Ee,ariaGrabbed:Ve,ariaHasPopup:null,ariaHidden:Ve,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ee,ariaLevel:z,ariaLive:null,ariaModal:Ve,ariaMultiLine:Ve,ariaMultiSelectable:Ve,ariaOrientation:null,ariaOwns:Ee,ariaPlaceholder:null,ariaPosInSet:z,ariaPressed:Ve,ariaReadOnly:Ve,ariaRelevant:null,ariaRequired:Ve,ariaRoleDescription:Ee,ariaRowCount:z,ariaRowIndex:z,ariaRowSpan:z,ariaSelected:Ve,ariaSetSize:z,ariaSort:null,ariaValueMax:z,ariaValueMin:z,ariaValueNow:z,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Xp(e,t){return t in e?e[t]:t}function Jp(e,t){return Xp(e,t.toLowerCase())}const yj=Sr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ir,acceptCharset:Ee,accessKey:Ee,action:null,allow:null,allowFullScreen:le,allowPaymentRequest:le,allowUserMedia:le,alt:null,as:null,async:le,autoCapitalize:null,autoComplete:Ee,autoFocus:le,autoPlay:le,blocking:Ee,capture:null,charSet:null,checked:le,cite:null,className:Ee,cols:z,colSpan:null,content:null,contentEditable:Ve,controls:le,controlsList:Ee,coords:z|ir,crossOrigin:null,data:null,dateTime:null,decoding:null,default:le,defer:le,dir:null,dirName:null,disabled:le,download:ja,draggable:Ve,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:le,formTarget:null,headers:Ee,height:z,hidden:ja,high:z,href:null,hrefLang:null,htmlFor:Ee,httpEquiv:Ee,id:null,imageSizes:null,imageSrcSet:null,inert:le,inputMode:null,integrity:null,is:null,isMap:le,itemId:null,itemProp:Ee,itemRef:Ee,itemScope:le,itemType:Ee,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:le,low:z,manifest:null,max:null,maxLength:z,media:null,method:null,min:null,minLength:z,multiple:le,muted:le,name:null,nonce:null,noModule:le,noValidate:le,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:le,optimum:z,pattern:null,ping:Ee,placeholder:null,playsInline:le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:le,referrerPolicy:null,rel:Ee,required:le,reversed:le,rows:z,rowSpan:z,sandbox:Ee,scope:null,scoped:le,seamless:le,selected:le,shadowRootClonable:le,shadowRootDelegatesFocus:le,shadowRootMode:null,shape:null,size:z,sizes:null,slot:null,span:z,spellCheck:Ve,src:null,srcDoc:null,srcLang:null,srcSet:null,start:z,step:null,style:null,tabIndex:z,target:null,title:null,translate:null,type:null,typeMustMatch:le,useMap:null,value:Ve,width:z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ee,axis:null,background:null,bgColor:null,border:z,borderColor:null,bottomMargin:z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:le,declare:le,event:null,face:null,frame:null,frameBorder:null,hSpace:z,leftMargin:z,link:null,longDesc:null,lowSrc:null,marginHeight:z,marginWidth:z,noResize:le,noHref:le,noShade:le,noWrap:le,object:null,profile:null,prompt:null,rev:null,rightMargin:z,rules:null,scheme:null,scrolling:Ve,standby:null,summary:null,text:null,topMargin:z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:le,disableRemotePlayback:le,prefix:null,property:null,results:z,security:null,unselectable:null},space:"html",transform:Jp}),bj=Sr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:xt,accentHeight:z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:z,amplitude:z,arabicForm:null,ascent:z,attributeName:null,attributeType:null,azimuth:z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:z,by:null,calcMode:null,capHeight:z,className:Ee,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:z,diffuseConstant:z,direction:null,display:null,dur:null,divisor:z,dominantBaseline:null,download:le,dx:null,dy:null,edgeMode:null,editable:null,elevation:z,enableBackground:null,end:null,event:null,exponent:z,externalResourcesRequired:null,fill:null,fillOpacity:z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ir,g2:ir,glyphName:ir,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:z,horizOriginX:z,horizOriginY:z,id:null,ideographic:z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:z,k:z,k1:z,k2:z,k3:z,k4:z,kernelMatrix:xt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:z,overlineThickness:z,paintOrder:null,panose1:null,path:null,pathLength:z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ee,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:z,pointsAtY:z,pointsAtZ:z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xt,rev:xt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xt,requiredFeatures:xt,requiredFonts:xt,requiredFormats:xt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:z,specularExponent:z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:z,strikethroughThickness:z,string:null,stroke:null,strokeDashArray:xt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:z,strokeOpacity:z,strokeWidth:null,style:null,surfaceScale:z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xt,tabIndex:z,tableValues:null,target:null,targetX:z,targetY:z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:z,underlineThickness:z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:z,values:null,vAlphabetic:z,vMathematical:z,vectorEffect:null,vHanging:z,vIdeographic:z,version:null,vertAdvY:z,vertOriginX:z,vertOriginY:z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Xp}),Qp=Sr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Zp=Sr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jp}),em=Sr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vj={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},wj=/[A-Z]/g,Du=/-[a-z]/g,kj=/^data[-\w.:]+$/i;function jj(e,t){const n=ka(t);let r=t,s=gt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&kj.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Du,Nj);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Du.test(i)){let o=i.replace(wj,Sj);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Fl}return new s(r,t)}function Sj(e){return"-"+e.toLowerCase()}function Nj(e){return e.charAt(1).toUpperCase()}const Cj=Kp([Yp,yj,Qp,Zp,em],"html"),Bl=Kp([Yp,bj,Qp,Zp,em],"svg");function Ej(e){return e.join(" ").trim()}var qn={},So,Ou;function Tj(){if(Ou)return So;Ou=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
386
+ `,u="/",d="*",f="",h="comment",p="declaration";function g(b,y){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];y=y||{};var j=1,w=1;function E(F){var R=F.match(t);R&&(j+=R.length);var Y=F.lastIndexOf(c);w=~Y?F.length-Y:w+F.length}function T(){var F={line:j,column:w};return function(R){return R.position=new S(F),M(),R}}function S(F){this.start=F,this.end={line:j,column:w},this.source=y.source}S.prototype.content=b;function A(F){var R=new Error(y.source+":"+j+":"+w+": "+F);if(R.reason=F,R.filename=y.source,R.line=j,R.column=w,R.source=b,!y.silent)throw R}function v(F){var R=F.exec(b);if(R){var Y=R[0];return E(Y),b=b.slice(Y.length),R}}function M(){v(n)}function N(F){var R;for(F=F||[];R=O();)R!==!1&&F.push(R);return F}function O(){var F=T();if(!(u!=b.charAt(0)||d!=b.charAt(1))){for(var R=2;f!=b.charAt(R)&&(d!=b.charAt(R)||u!=b.charAt(R+1));)++R;if(R+=2,f===b.charAt(R-1))return A("End of comment missing");var Y=b.slice(2,R-2);return w+=2,E(Y),b=b.slice(R),w+=2,F({type:h,comment:Y})}}function P(){var F=T(),R=v(r);if(R){if(O(),!v(s))return A("property missing ':'");var Y=v(i),G=F({type:p,property:x(R[0].replace(e,f)),value:Y?x(Y[0].replace(e,f)):f});return v(o),G}}function V(){var F=[];N(F);for(var R;R=P();)R!==!1&&(F.push(R),N(F));return F}return M(),V()}function x(b){return b?b.replace(l,f):f}return So=g,So}var Lu;function Aj(){if(Lu)return qn;Lu=1;var e=qn&&qn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qn,"__esModule",{value:!0}),qn.default=n;const t=e(Tj());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const o=(0,t.default)(r),l=typeof s=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?s(u,d,c):d&&(i=i||{},i[u]=d)}),i}return qn}var Dr={},Iu;function Pj(){if(Iu)return Dr;Iu=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},o=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(s,l):u=u.replace(r,l),u.replace(t,o))};return Dr.camelCase=c,Dr}var Or,Fu;function Mj(){if(Fu)return Or;Fu=1;var e=Or&&Or.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Aj()),n=Pj();function r(s,i){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(l,c){l&&c&&(o[(0,n.camelCase)(l,i)]=c)}),o}return r.default=r,Or=r,Or}var _j=Mj();const Rj=nl(_j),tm=nm("end"),zl=nm("start");function nm(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Dj(e){const t=zl(e),n=tm(e);if(t&&n)return{start:t,end:n}}function Zr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Bu(e.position):"start"in e||"end"in e?Bu(e):"line"in e||"column"in e?Na(e):""}function Na(e){return zu(e&&e.line)+":"+zu(e&&e.column)}function Bu(e){return Na(e&&e.start)+"-"+Na(e&&e.end)}function zu(e){return e&&typeof e=="number"?e:1}class lt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Zr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}lt.prototype.file="";lt.prototype.name="";lt.prototype.reason="";lt.prototype.message="";lt.prototype.stack="";lt.prototype.column=void 0;lt.prototype.line=void 0;lt.prototype.ancestors=void 0;lt.prototype.cause=void 0;lt.prototype.fatal=void 0;lt.prototype.place=void 0;lt.prototype.ruleId=void 0;lt.prototype.source=void 0;const Vl={}.hasOwnProperty,Oj=new Map,Lj=/[A-Z]/g,Ij=new Set(["table","tbody","thead","tfoot","tr"]),Fj=new Set(["td","th"]),rm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Bj(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Gj(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=qj(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Bl:Cj,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=sm(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function sm(e,t,n){if(t.type==="element")return zj(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Vj(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Hj(e,t,n);if(t.type==="mdxjsEsm")return $j(e,t);if(t.type==="root")return Uj(e,t,n);if(t.type==="text")return Wj(e,t)}function zj(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Bl,e.schema=s),e.ancestors.push(t);const i=om(e,t.tagName,!1),o=Kj(e,t);let l=Hl(e,t);return Ij.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!gj(c):!0})),im(e,o,i,t),$l(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Vj(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}cs(e,t.position)}function $j(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cs(e,t.position)}function Hj(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Bl,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:om(e,t.name,!0),o=Yj(e,t),l=Hl(e,t);return im(e,o,i,t),$l(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Uj(e,t,n){const r={};return $l(r,Hl(e,t)),e.create(t,e.Fragment,r,n)}function Wj(e,t){return t.value}function im(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $l(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function qj(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function Gj(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=zl(r);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Kj(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Vl.call(t.properties,s)){const i=Xj(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Fj.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Yj(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else cs(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else cs(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Hl(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Oj;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=sm(e,i,o);l!==void 0&&n.push(l)}return n}function Xj(e,t,n){const r=jj(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?dj(n):Ej(n)),r.property==="style"){let s=typeof n=="object"?n:Jj(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Qj(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?vj[r.property]||r.property:r.attribute,n]}}function Jj(e,t){try{return Rj(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new lt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=rm+"#cannot-parse-style-attribute",s}}function om(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=Mu(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=Mu(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Vl.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);cs(e)}function cs(e,t){const n=new lt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=rm+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Qj(e){const t={};let n;for(n in e)Vl.call(e,n)&&(t[Zj(n)]=e[n]);return t}function Zj(e){let t=e.replace(Lj,eS);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function eS(e){return"-"+e.toLowerCase()}const No={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},tS={};function Ul(e,t){const n=tS,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return am(e,r,s)}function am(e,t,n){if(nS(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Vu(e.children,t,n)}return Array.isArray(e)?Vu(e,t,n):""}function Vu(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=am(e[s],t,n);return r.join("")}function nS(e){return!!(e&&typeof e=="object")}const $u=document.createElement("i");function Wl(e){const t="&"+e+";";$u.innerHTML=t;const n=$u.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yt(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Ct(e,t){return e.length>0?(yt(e,e.length,0,t),e):t}const Hu={}.hasOwnProperty;function lm(e){const t={};let n=-1;for(;++n<e.length;)rS(t,e[n]);return t}function rS(e,t){let n;for(n in t){const s=(Hu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Hu.call(s,o)||(s[o]=[]);const l=i[o];sS(s[o],Array.isArray(l)?l:l?[l]:[])}}}function sS(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yt(e,0,0,r)}function cm(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Dt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ut=Cn(/[A-Za-z]/),it=Cn(/[\dA-Za-z]/),iS=Cn(/[#-'*+\--9=?A-Z^-~]/);function wi(e){return e!==null&&(e<32||e===127)}const Ca=Cn(/\d/),oS=Cn(/[\dA-Fa-f]/),aS=Cn(/[!-/:-@[-`{-~]/);function ee(e){return e!==null&&e<-2}function Ce(e){return e!==null&&(e<0||e===32)}function de(e){return e===-2||e===-1||e===32}const Yi=Cn(new RegExp("\\p{P}|\\p{S}","u")),zn=Cn(/\s/);function Cn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Nr(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&it(e.charCodeAt(n+1))&&it(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function ge(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return de(c)?(e.enter(n),l(c)):t(c)}function l(c){return de(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const lS={tokenize:cS};function cS(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ge(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ee(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const uS={tokenize:dS},Uu={tokenize:fS};function dS(e){const t=this,n=[];let r=0,s,i,o;return l;function l(w){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&j();const E=t.events.length;let T=E,S;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){S=t.events[T][1].end;break}y(r);let A=E;for(;A<t.events.length;)t.events[A][1].end={...S},A++;return yt(t.events,T+1,0,t.events.slice(E)),t.events.length=A,u(w)}return l(w)}function u(w){if(r===n.length){if(!s)return h(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Uu,d,f)(w)}function d(w){return s&&j(),y(r),h(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function h(w){return t.containerState={},e.attempt(Uu,p,g)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),h(w)}function g(w){if(w===null){s&&j(),y(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),x(w)}function x(w){if(w===null){b(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return ee(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),x)}function b(w,E){const T=t.sliceStream(w);if(E&&T.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(T),t.parser.lazy[w.start.line]){let S=s.events.length;for(;S--;)if(s.events[S][1].start.offset<o&&(!s.events[S][1].end||s.events[S][1].end.offset>o))return;const A=t.events.length;let v=A,M,N;for(;v--;)if(t.events[v][0]==="exit"&&t.events[v][1].type==="chunkFlow"){if(M){N=t.events[v][1].end;break}M=!0}for(y(r),S=A;S<t.events.length;)t.events[S][1].end={...N},S++;yt(t.events,v+1,0,t.events.slice(A)),t.events.length=S}}function y(w){let E=n.length;for(;E-- >w;){const T=n[E];t.containerState=T[1],T[0].exit.call(t,e)}n.length=w}function j(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function fS(e,t,n){return ge(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ur(e){if(e===null||Ce(e)||zn(e))return 1;if(Yi(e))return 2}function Xi(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Ea={name:"attention",resolveAll:hS,tokenize:pS};function hS(e,t){let n=-1,r,s,i,o,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};Wu(f,-c),Wu(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Ct(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Ct(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Ct(u,Xi(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Ct(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Ct(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,yt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function pS(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=ur(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=ur(c),f=!d||d===2&&s||n.includes(c),h=!s||s===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(s||!h)),u._close=!!(i===42?h:h&&(d||!f)),t(c)}}function Wu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mS={name:"autolink",tokenize:gS};function gS(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return ut(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||it(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||it(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||wi(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):iS(p)?(e.consume(p),u):n(p)}function d(p){return it(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||it(p))&&r++<63){const g=p===45?h:f;return e.consume(p),g}return n(p)}}const Ns={partial:!0,tokenize:xS};function xS(e,t,n){return r;function r(i){return de(i)?ge(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||ee(i)?t(i):n(i)}}const um={continuation:{tokenize:bS},exit:vS,name:"blockQuote",tokenize:yS};function yS(e,t,n){const r=this;return s;function s(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return de(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function bS(e,t,n){const r=this;return s;function s(o){return de(o)?ge(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(um,t,n)(o)}}function vS(e){e.exit("blockQuote")}const dm={name:"characterEscape",tokenize:wS};function wS(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return aS(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const fm={name:"characterReference",tokenize:kS};function kS(e,t,n){const r=this;let s=0,i,o;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=it,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=oS,d):(e.enter("characterReferenceValue"),i=7,o=Ca,d(f))}function d(f){if(f===59&&s){const h=e.exit("characterReferenceValue");return o===it&&!Wl(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&s++<i?(e.consume(f),d):n(f)}}const qu={partial:!0,tokenize:SS},Gu={concrete:!0,name:"codeFenced",tokenize:jS};function jS(e,t,n){const r=this,s={partial:!0,tokenize:T};let i=0,o=0,l;return c;function c(S){return u(S)}function u(S){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(S)}function d(S){return S===l?(o++,e.consume(S),d):o<3?n(S):(e.exit("codeFencedFenceSequence"),de(S)?ge(e,f,"whitespace")(S):f(S))}function f(S){return S===null||ee(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(qu,x,E)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||ee(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(S)):de(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ge(e,p,"whitespace")(S)):S===96&&S===l?n(S):(e.consume(S),h)}function p(S){return S===null||ee(S)?f(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||ee(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(S)):S===96&&S===l?n(S):(e.consume(S),g)}function x(S){return e.attempt(s,E,b)(S)}function b(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),y}function y(S){return i>0&&de(S)?ge(e,j,"linePrefix",i+1)(S):j(S)}function j(S){return S===null||ee(S)?e.check(qu,x,E)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||ee(S)?(e.exit("codeFlowValue"),j(S)):(e.consume(S),w)}function E(S){return e.exit("codeFenced"),t(S)}function T(S,A,v){let M=0;return N;function N(R){return S.enter("lineEnding"),S.consume(R),S.exit("lineEnding"),O}function O(R){return S.enter("codeFencedFence"),de(R)?ge(S,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):P(R)}function P(R){return R===l?(S.enter("codeFencedFenceSequence"),V(R)):v(R)}function V(R){return R===l?(M++,S.consume(R),V):M>=o?(S.exit("codeFencedFenceSequence"),de(R)?ge(S,F,"whitespace")(R):F(R)):v(R)}function F(R){return R===null||ee(R)?(S.exit("codeFencedFence"),A(R)):v(R)}}}function SS(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Co={name:"codeIndented",tokenize:CS},NS={partial:!0,tokenize:ES};function CS(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),ge(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):ee(u)?e.attempt(NS,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||ee(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function ES(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):ee(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):ge(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):ee(o)?s(o):n(o)}}const TS={name:"codeText",previous:PS,resolve:AS,tokenize:MS};function AS(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function PS(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function MS(e,t,n){let r=0,s,i;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),s=0,d(f)):ee(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ee(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),s++,d):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class _S{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Lr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Lr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Lr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Lr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Lr(this.left,n.reverse())}}}function Lr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function hm(e){const t={};let n=-1,r,s,i,o,l,c,u;const d=new _S(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,RS(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...d.get(s)[1].start},l=d.slice(s,n),l.unshift(r),d.splice(s,n-s+1,l))}}return yt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function RS(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,f,h=-1,p=n,g=0,x=0;const b=[x];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(x=h+1,b.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const y=l.slice(b[h],b[h+1]),j=i.pop();c.push([j,j+y.length-1]),e.splice(j,2,y)}for(c.reverse(),h=-1;++h<c.length;)u[g+c[h][0]]=g+c[h][1],g+=c[h][1]-c[h][0]-1;return u}const DS={resolve:LS,tokenize:IS},OS={partial:!0,tokenize:FS};function LS(e){return hm(e),e}function IS(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):ee(l)?e.check(OS,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function FS(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ge(e,i,"linePrefix")}function i(o){if(o===null||ee(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function pm(e,t,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),h):y===null||y===32||y===41||wi(y)?n(y):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(y))}function h(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||ee(y)?n(y):(e.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function x(y){return!d&&(y===null||y===41||Ce(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,x):y===41?(e.consume(y),d--,x):y===null||y===32||y===40||wi(y)?n(y):(e.consume(y),y===92?b:x)}function b(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function mm(e,t,n,r,s,i){const o=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):ee(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||ee(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!de(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function gm(e,t,n,r,s,i){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,c):n(h)}function c(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===o?(e.exit(i),c(o)):h===null?n(h):ee(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ge(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===o||h===null||ee(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===o||h===92?(e.consume(h),d):d(h)}}function es(e,t){let n;return r;function r(s){return ee(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):de(s)?ge(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const BS={name:"definition",tokenize:VS},zS={partial:!0,tokenize:$S};function VS(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return mm.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=Dt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Ce(p)?es(e,u)(p):u(p)}function u(p){return pm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(zS,f,f)(p)}function f(p){return de(p)?ge(e,h,"whitespace")(p):h(p)}function h(p){return p===null||ee(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function $S(e,t,n){return r;function r(l){return Ce(l)?es(e,s)(l):n(l)}function s(l){return gm(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return de(l)?ge(e,o,"whitespace")(l):o(l)}function o(l){return l===null||ee(l)?t(l):n(l)}}const HS={name:"hardBreakEscape",tokenize:US};function US(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return ee(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const WS={name:"headingAtx",resolve:qS,tokenize:GS};function qS(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},yt(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function GS(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Ce(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||ee(d)?(e.exit("atxHeading"),t(d)):de(d)?ge(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Ce(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const KS=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ku=["pre","script","style","textarea"],YS={concrete:!0,name:"htmlFlow",resolveTo:QS,tokenize:ZS},XS={partial:!0,tokenize:tN},JS={partial:!0,tokenize:eN};function QS(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ZS(e,t,n){const r=this;let s,i,o,l,c;return u;function u(C){return d(C)}function d(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),f}function f(C){return C===33?(e.consume(C),h):C===47?(e.consume(C),i=!0,x):C===63?(e.consume(C),s=3,r.interrupt?t:k):ut(C)?(e.consume(C),o=String.fromCharCode(C),b):n(C)}function h(C){return C===45?(e.consume(C),s=2,p):C===91?(e.consume(C),s=5,l=0,g):ut(C)?(e.consume(C),s=4,r.interrupt?t:k):n(C)}function p(C){return C===45?(e.consume(C),r.interrupt?t:k):n(C)}function g(C){const re="CDATA[";return C===re.charCodeAt(l++)?(e.consume(C),l===re.length?r.interrupt?t:P:g):n(C)}function x(C){return ut(C)?(e.consume(C),o=String.fromCharCode(C),b):n(C)}function b(C){if(C===null||C===47||C===62||Ce(C)){const re=C===47,Te=o.toLowerCase();return!re&&!i&&Ku.includes(Te)?(s=1,r.interrupt?t(C):P(C)):KS.includes(o.toLowerCase())?(s=6,re?(e.consume(C),y):r.interrupt?t(C):P(C)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):i?j(C):w(C))}return C===45||it(C)?(e.consume(C),o+=String.fromCharCode(C),b):n(C)}function y(C){return C===62?(e.consume(C),r.interrupt?t:P):n(C)}function j(C){return de(C)?(e.consume(C),j):N(C)}function w(C){return C===47?(e.consume(C),N):C===58||C===95||ut(C)?(e.consume(C),E):de(C)?(e.consume(C),w):N(C)}function E(C){return C===45||C===46||C===58||C===95||it(C)?(e.consume(C),E):T(C)}function T(C){return C===61?(e.consume(C),S):de(C)?(e.consume(C),T):w(C)}function S(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),c=C,A):de(C)?(e.consume(C),S):v(C)}function A(C){return C===c?(e.consume(C),c=null,M):C===null||ee(C)?n(C):(e.consume(C),A)}function v(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Ce(C)?T(C):(e.consume(C),v)}function M(C){return C===47||C===62||de(C)?w(C):n(C)}function N(C){return C===62?(e.consume(C),O):n(C)}function O(C){return C===null||ee(C)?P(C):de(C)?(e.consume(C),O):n(C)}function P(C){return C===45&&s===2?(e.consume(C),Y):C===60&&s===1?(e.consume(C),G):C===62&&s===4?(e.consume(C),_):C===63&&s===3?(e.consume(C),k):C===93&&s===5?(e.consume(C),L):ee(C)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(XS,$,V)(C)):C===null||ee(C)?(e.exit("htmlFlowData"),V(C)):(e.consume(C),P)}function V(C){return e.check(JS,F,$)(C)}function F(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),R}function R(C){return C===null||ee(C)?V(C):(e.enter("htmlFlowData"),P(C))}function Y(C){return C===45?(e.consume(C),k):P(C)}function G(C){return C===47?(e.consume(C),o="",H):P(C)}function H(C){if(C===62){const re=o.toLowerCase();return Ku.includes(re)?(e.consume(C),_):P(C)}return ut(C)&&o.length<8?(e.consume(C),o+=String.fromCharCode(C),H):P(C)}function L(C){return C===93?(e.consume(C),k):P(C)}function k(C){return C===62?(e.consume(C),_):C===45&&s===2?(e.consume(C),k):P(C)}function _(C){return C===null||ee(C)?(e.exit("htmlFlowData"),$(C)):(e.consume(C),_)}function $(C){return e.exit("htmlFlow"),t(C)}}function eN(e,t,n){const r=this;return s;function s(o){return ee(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function tN(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ns,t,n)}}const nN={name:"htmlText",tokenize:rN};function rN(e,t,n){const r=this;let s,i,o;return l;function l(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),c}function c(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),T):k===63?(e.consume(k),w):ut(k)?(e.consume(k),v):n(k)}function u(k){return k===45?(e.consume(k),d):k===91?(e.consume(k),i=0,g):ut(k)?(e.consume(k),j):n(k)}function d(k){return k===45?(e.consume(k),p):n(k)}function f(k){return k===null?n(k):k===45?(e.consume(k),h):ee(k)?(o=f,G(k)):(e.consume(k),f)}function h(k){return k===45?(e.consume(k),p):f(k)}function p(k){return k===62?Y(k):k===45?h(k):f(k)}function g(k){const _="CDATA[";return k===_.charCodeAt(i++)?(e.consume(k),i===_.length?x:g):n(k)}function x(k){return k===null?n(k):k===93?(e.consume(k),b):ee(k)?(o=x,G(k)):(e.consume(k),x)}function b(k){return k===93?(e.consume(k),y):x(k)}function y(k){return k===62?Y(k):k===93?(e.consume(k),y):x(k)}function j(k){return k===null||k===62?Y(k):ee(k)?(o=j,G(k)):(e.consume(k),j)}function w(k){return k===null?n(k):k===63?(e.consume(k),E):ee(k)?(o=w,G(k)):(e.consume(k),w)}function E(k){return k===62?Y(k):w(k)}function T(k){return ut(k)?(e.consume(k),S):n(k)}function S(k){return k===45||it(k)?(e.consume(k),S):A(k)}function A(k){return ee(k)?(o=A,G(k)):de(k)?(e.consume(k),A):Y(k)}function v(k){return k===45||it(k)?(e.consume(k),v):k===47||k===62||Ce(k)?M(k):n(k)}function M(k){return k===47?(e.consume(k),Y):k===58||k===95||ut(k)?(e.consume(k),N):ee(k)?(o=M,G(k)):de(k)?(e.consume(k),M):Y(k)}function N(k){return k===45||k===46||k===58||k===95||it(k)?(e.consume(k),N):O(k)}function O(k){return k===61?(e.consume(k),P):ee(k)?(o=O,G(k)):de(k)?(e.consume(k),O):M(k)}function P(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),s=k,V):ee(k)?(o=P,G(k)):de(k)?(e.consume(k),P):(e.consume(k),F)}function V(k){return k===s?(e.consume(k),s=void 0,R):k===null?n(k):ee(k)?(o=V,G(k)):(e.consume(k),V)}function F(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||Ce(k)?M(k):(e.consume(k),F)}function R(k){return k===47||k===62||Ce(k)?M(k):n(k)}function Y(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function G(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),H}function H(k){return de(k)?ge(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):L(k)}function L(k){return e.enter("htmlTextData"),o(k)}}const ql={name:"labelEnd",resolveAll:aN,resolveTo:lN,tokenize:cN},sN={tokenize:uN},iN={tokenize:dN},oN={tokenize:fN};function aN(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&yt(e,0,e.length,n),e}function lN(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Ct(l,e.slice(i+1,i+r+3)),l=Ct(l,[["enter",d,t]]),l=Ct(l,Xi(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=Ct(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=Ct(l,e.slice(o+1)),l=Ct(l,[["exit",c,t]]),yt(e,i,e.length,l),e}function cN(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(h){return i?i._inactive?f(h):(o=r.parser.defined.includes(Dt(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(sN,d,o?d:f)(h):h===91?e.attempt(iN,d,o?u:f)(h):o?d(h):f(h)}function u(h){return e.attempt(oN,d,f)(h)}function d(h){return t(h)}function f(h){return i._balanced=!0,n(h)}}function uN(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return Ce(f)?es(e,i)(f):i(f)}function i(f){return f===41?d(f):pm(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return Ce(f)?es(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?gm(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Ce(f)?es(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function dN(e,t,n){const r=this;return s;function s(l){return mm.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Dt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function fN(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const hN={name:"labelStartImage",resolveAll:ql.resolveAll,tokenize:pN};function pN(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const mN={name:"labelStartLink",resolveAll:ql.resolveAll,tokenize:gN};function gN(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Eo={name:"lineEnding",tokenize:xN};function xN(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ge(e,t,"linePrefix")}}const ii={name:"thematicBreak",tokenize:yN};function yN(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||ee(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),de(u)?ge(e,l,"whitespace")(u):l(u))}}const pt={continuation:{tokenize:kN},exit:SN,name:"list",tokenize:wN},bN={partial:!0,tokenize:NN},vN={partial:!0,tokenize:jN};function wN(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ca(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ii,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Ca(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ns,r.interrupt?n:d,e.attempt(bN,h,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return de(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function kN(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ns,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ge(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!de(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(vN,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,ge(e,e.attempt(pt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function jN(e,t,n){const r=this;return ge(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function SN(e){e.exit(this.containerState.type)}function NN(e,t,n){const r=this;return ge(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!de(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Yu={name:"setextUnderline",resolveTo:CN,tokenize:EN};function CN(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function EN(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),de(u)?ge(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||ee(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const TN={tokenize:AN};function AN(e){const t=this,n=e.attempt(Ns,r,e.attempt(this.parser.constructs.flowInitial,s,ge(e,e.attempt(this.parser.constructs.flow,s,e.attempt(DS,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const PN={resolveAll:ym()},MN=xm("string"),_N=xm("text");function xm(e){return{resolveAll:ym(e==="text"?RN:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=s[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function ym(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function RN(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const DN={42:pt,43:pt,45:pt,48:pt,49:pt,50:pt,51:pt,52:pt,53:pt,54:pt,55:pt,56:pt,57:pt,62:um},ON={91:BS},LN={[-2]:Co,[-1]:Co,32:Co},IN={35:WS,42:ii,45:[Yu,ii],60:YS,61:Yu,95:ii,96:Gu,126:Gu},FN={38:fm,92:dm},BN={[-5]:Eo,[-4]:Eo,[-3]:Eo,33:hN,38:fm,42:Ea,60:[mS,nN],91:mN,92:[HS,dm],93:ql,95:Ea,96:TS},zN={null:[Ea,PN]},VN={null:[42,95]},$N={null:[]},HN=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VN,contentInitial:ON,disable:$N,document:DN,flow:IN,flowInitial:LN,insideSpan:zN,string:FN,text:BN},Symbol.toStringTag,{value:"Module"}));function UN(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:A(T),check:A(S),consume:j,enter:w,exit:E,interrupt:A(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(O){return o=Ct(o,O),b(),o[o.length-1]!==null?[]:(v(t,0),u.events=Xi(i,u.events,u),u.events)}function h(O,P){return qN(p(O),P)}function p(O){return WN(o,O)}function g(){const{_bufferIndex:O,_index:P,line:V,column:F,offset:R}=r;return{_bufferIndex:O,_index:P,line:V,column:F,offset:R}}function x(O){s[O.line]=O.column,N()}function b(){let O;for(;r._index<o.length;){const P=o[r._index];if(typeof P=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<P.length;)y(P.charCodeAt(r._bufferIndex));else y(P)}}function y(O){d=d(O)}function j(O){ee(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,N()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=O}function w(O,P){const V=P||{};return V.type=O,V.start=g(),u.events.push(["enter",V,u]),l.push(V),V}function E(O){const P=l.pop();return P.end=g(),u.events.push(["exit",P,u]),P}function T(O,P){v(O,P.from)}function S(O,P){P.restore()}function A(O,P){return V;function V(F,R,Y){let G,H,L,k;return Array.isArray(F)?$(F):"tokenize"in F?$([F]):_(F);function _(K){return qe;function qe(He){const et=He!==null&&K[He],U=He!==null&&K.null,ke=[...Array.isArray(et)?et:et?[et]:[],...Array.isArray(U)?U:U?[U]:[]];return $(ke)(He)}}function $(K){return G=K,H=0,K.length===0?Y:C(K[H])}function C(K){return qe;function qe(He){return k=M(),L=K,K.partial||(u.currentConstruct=K),K.name&&u.parser.constructs.disable.null.includes(K.name)?Te():K.tokenize.call(P?Object.assign(Object.create(u),P):u,c,re,Te)(He)}}function re(K){return O(L,k),R}function Te(K){return k.restore(),++H<G.length?C(G[H]):Y}}}function v(O,P){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&yt(u.events,P,u.events.length-P,O.resolve(u.events.slice(P),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function M(){const O=g(),P=u.previous,V=u.currentConstruct,F=u.events.length,R=Array.from(l);return{from:F,restore:Y};function Y(){r=O,u.previous=P,u.currentConstruct=V,u.events.length=F,l=R,N()}}function N(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function WN(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function qN(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
387
+ `;break}case-3:{o=`\r
388
+ `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function GN(e){const r={constructs:lm([HN,...(e||{}).extensions||[]]),content:s(lS),defined:[],document:s(uS),flow:s(TN),lazy:{},string:s(MN),text:s(_N)};return r;function s(i){return o;function o(l){return UN(r,i,l)}}}function KN(e){for(;!hm(e););return e}const Xu=/[\0\t\n\r]/g;function YN(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const c=[];let u,d,f,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(Xu.lastIndex=f,u=Xu.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(f);break}if(p===10&&f===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<h&&(c.push(i.slice(f,h)),e+=h-f),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const XN=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JN(e){return e.replace(XN,QN)}function QN(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return cm(n.slice(i?2:1),i?16:10)}return Wl(n)||e}const bm={}.hasOwnProperty;function ZN(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),eC(n)(KN(GN(n).document().write(YN()(e,t,!0))))}function eC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(xe),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(ne),blockQuote:i(U),characterEscape:M,characterReference:M,codeFenced:i(ke),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ke,o),codeText:i(tt,o),codeTextData:M,data:M,codeFlowValue:M,definition:i(ht),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(De),hardBreakEscape:i(ie),hardBreakTrailing:i(ie),htmlFlow:i(ce,o),htmlFlowData:M,htmlText:i(ce,o),htmlTextData:M,image:i(ue),label:o,link:i(xe),listItem:i(Ge),listItemValue:h,listOrdered:i(ve,f),listUnordered:i(ve),paragraph:i(nt),reference:C,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ne),strong:i(Lt),thematicBreak:i(je)},exit:{atxHeading:c(),atxHeadingSequence:T,autolink:c(),autolinkEmail:et,autolinkProtocol:He,blockQuote:c(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:K,characterReference:qe,codeFenced:c(b),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:c(y),codeText:c(R),codeTextData:N,data:N,definition:c(),definitionDestinationString:E,definitionLabelString:j,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(P),hardBreakTrailing:c(P),htmlFlow:c(V),htmlFlowData:N,htmlText:c(F),htmlTextData:N,image:c(G),label:L,labelText:H,lineEnding:O,link:c(Y),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:re,resourceDestinationString:k,resourceTitleString:_,resource:$,setextHeading:c(v),setextHeadingLineSequence:A,setextHeadingText:S,strong:c(),thematicBreak:c()}};vm(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let B={type:"root",children:[]};const W={stack:[B],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:n},X=[];let oe=-1;for(;++oe<D.length;)if(D[oe][1].type==="listOrdered"||D[oe][1].type==="listUnordered")if(D[oe][0]==="enter")X.push(oe);else{const he=X.pop();oe=s(D,he,oe)}for(oe=-1;++oe<D.length;){const he=t[D[oe][0]];bm.call(he,D[oe][1].type)&&he[D[oe][1].type].call(Object.assign({sliceSerialize:D[oe][2].sliceSerialize},W),D[oe][1])}if(W.tokenStack.length>0){const he=W.tokenStack[W.tokenStack.length-1];(he[1]||Ju).call(W,void 0,he[0])}for(B.position={start:un(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:un(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},oe=-1;++oe<t.transforms.length;)B=t.transforms[oe](B)||B;return B}function s(D,B,W){let X=B-1,oe=-1,he=!1,Ae,Oe,At,Pt;for(;++X<=W;){const Ke=D[X];switch(Ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ke[0]==="enter"?oe++:oe--,Pt=void 0;break}case"lineEndingBlank":{Ke[0]==="enter"&&(Ae&&!Pt&&!oe&&!At&&(At=X),Pt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pt=void 0}if(!oe&&Ke[0]==="enter"&&Ke[1].type==="listItemPrefix"||oe===-1&&Ke[0]==="exit"&&(Ke[1].type==="listUnordered"||Ke[1].type==="listOrdered")){if(Ae){let It=X;for(Oe=void 0;It--;){const ct=D[It];if(ct[1].type==="lineEnding"||ct[1].type==="lineEndingBlank"){if(ct[0]==="exit")continue;Oe&&(D[Oe][1].type="lineEndingBlank",he=!0),ct[1].type="lineEnding",Oe=It}else if(!(ct[1].type==="linePrefix"||ct[1].type==="blockQuotePrefix"||ct[1].type==="blockQuotePrefixWhitespace"||ct[1].type==="blockQuoteMarker"||ct[1].type==="listItemIndent"))break}At&&(!Oe||At<Oe)&&(Ae._spread=!0),Ae.end=Object.assign({},Oe?D[Oe][1].start:Ke[1].end),D.splice(Oe||X,0,["exit",Ae,Ke[2]]),X++,W++}if(Ke[1].type==="listItemPrefix"){const It={type:"listItem",_spread:!1,start:Object.assign({},Ke[1].start),end:void 0};Ae=It,D.splice(X,0,["enter",It,Ke[2]]),X++,W++,At=void 0,Pt=!0}}}return D[B][1]._spread=he,W}function i(D,B){return W;function W(X){l.call(this,D(X),X),B&&B.call(this,X)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(D,B,W){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([B,W||void 0]),D.position={start:un(B.start),end:void 0}}function c(D){return B;function B(W){D&&D.call(this,W),u.call(this,W)}}function u(D,B){const W=this.stack.pop(),X=this.tokenStack.pop();if(X)X[0].type!==D.type&&(B?B.call(this,D,X[0]):(X[1]||Ju).call(this,D,X[0]));else throw new Error("Cannot close `"+D.type+"` ("+Zr({start:D.start,end:D.end})+"): it’s not open");W.position.end=un(D.end)}function d(){return Ul(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(D){if(this.data.expectingFirstListItemValue){const B=this.stack[this.stack.length-2];B.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function p(){const D=this.resume(),B=this.stack[this.stack.length-1];B.lang=D}function g(){const D=this.resume(),B=this.stack[this.stack.length-1];B.meta=D}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const D=this.resume(),B=this.stack[this.stack.length-1];B.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const D=this.resume(),B=this.stack[this.stack.length-1];B.value=D.replace(/(\r?\n|\r)$/g,"")}function j(D){const B=this.resume(),W=this.stack[this.stack.length-1];W.label=B,W.identifier=Dt(this.sliceSerialize(D)).toLowerCase()}function w(){const D=this.resume(),B=this.stack[this.stack.length-1];B.title=D}function E(){const D=this.resume(),B=this.stack[this.stack.length-1];B.url=D}function T(D){const B=this.stack[this.stack.length-1];if(!B.depth){const W=this.sliceSerialize(D).length;B.depth=W}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function A(D){const B=this.stack[this.stack.length-1];B.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function v(){this.data.setextHeadingSlurpLineEnding=void 0}function M(D){const W=this.stack[this.stack.length-1].children;let X=W[W.length-1];(!X||X.type!=="text")&&(X=be(),X.position={start:un(D.start),end:void 0},W.push(X)),this.stack.push(X)}function N(D){const B=this.stack.pop();B.value+=this.sliceSerialize(D),B.position.end=un(D.end)}function O(D){const B=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=B.children[B.children.length-1];W.position.end=un(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(B.type)&&(M.call(this,D),N.call(this,D))}function P(){this.data.atHardBreak=!0}function V(){const D=this.resume(),B=this.stack[this.stack.length-1];B.value=D}function F(){const D=this.resume(),B=this.stack[this.stack.length-1];B.value=D}function R(){const D=this.resume(),B=this.stack[this.stack.length-1];B.value=D}function Y(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const B=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=B,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function G(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const B=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=B,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function H(D){const B=this.sliceSerialize(D),W=this.stack[this.stack.length-2];W.label=JN(B),W.identifier=Dt(B).toLowerCase()}function L(){const D=this.stack[this.stack.length-1],B=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const X=D.children;W.children=X}else W.alt=B}function k(){const D=this.resume(),B=this.stack[this.stack.length-1];B.url=D}function _(){const D=this.resume(),B=this.stack[this.stack.length-1];B.title=D}function $(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function re(D){const B=this.resume(),W=this.stack[this.stack.length-1];W.label=B,W.identifier=Dt(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function Te(D){this.data.characterReferenceType=D.type}function K(D){const B=this.sliceSerialize(D),W=this.data.characterReferenceType;let X;W?(X=cm(B,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):X=Wl(B);const oe=this.stack[this.stack.length-1];oe.value+=X}function qe(D){const B=this.stack.pop();B.position.end=un(D.end)}function He(D){N.call(this,D);const B=this.stack[this.stack.length-1];B.url=this.sliceSerialize(D)}function et(D){N.call(this,D);const B=this.stack[this.stack.length-1];B.url="mailto:"+this.sliceSerialize(D)}function U(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function tt(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function ne(){return{type:"heading",depth:0,children:[]}}function ie(){return{type:"break"}}function ce(){return{type:"html",value:""}}function ue(){return{type:"image",title:null,url:"",alt:null}}function xe(){return{type:"link",title:null,url:"",children:[]}}function ve(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function Ge(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function nt(){return{type:"paragraph",children:[]}}function Lt(){return{type:"strong",children:[]}}function be(){return{type:"text",value:""}}function je(){return{type:"thematicBreak"}}}function un(e){return{line:e.line,column:e.column,offset:e.offset}}function vm(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?vm(e,r):tC(e,r)}}function tC(e,t){let n;for(n in t)if(bm.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Ju(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Zr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Zr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Zr({start:t.start,end:t.end})+") is still open")}function nC(e){const t=this;t.parser=n;function n(r){return ZN(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rC(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function sC(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
389
+ `}]}function iC(e,t){const n=t.value?t.value+`
390
+ `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function oC(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aC(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lC(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Nr(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function cC(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uC(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function wm(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function dC(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return wm(e,t);const s={src:Nr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function fC(e,t){const n={src:Nr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function hC(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function pC(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return wm(e,t);const s={href:Nr(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function mC(e,t){const n={href:Nr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gC(e,t,n){const r=e.all(t),s=n?xC(n):km(t),i={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(s||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
391
+ `}),d.type==="element"&&d.tagName==="p"&&!s?o.push(...d.children):o.push(d)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
392
+ `});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function xC(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=km(n[r])}return t}function km(e){const t=e.spread;return t??e.children.length>1}function yC(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function bC(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vC(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function wC(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kC(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=zl(t.children[1]),c=tm(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function jC(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],h={},p=o?o[c]:void 0;p&&(h.align=p);let g={type:"element",tagName:i,properties:h,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function SC(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Qu=9,Zu=32;function NC(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(ed(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(ed(t.slice(s),s>0,!1)),i.join("")}function ed(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===Qu||i===Zu;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===Qu||i===Zu;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function CC(e,t){const n={type:"text",value:NC(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function EC(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const TC={blockquote:rC,break:sC,code:iC,delete:oC,emphasis:aC,footnoteReference:lC,heading:cC,html:uC,imageReference:dC,image:fC,inlineCode:hC,linkReference:pC,link:mC,listItem:gC,list:yC,paragraph:bC,root:vC,strong:wC,table:kC,tableCell:SC,tableRow:jC,text:CC,thematicBreak:EC,toml:Bs,yaml:Bs,definition:Bs,footnoteDefinition:Bs};function Bs(){}const jm=-1,Ji=0,ts=1,ki=2,Gl=3,Kl=4,Yl=5,Xl=6,Sm=7,Nm=8,td=typeof self=="object"?self:globalThis,AC=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Ji:case jm:return n(o,s);case ts:{const l=n([],s);for(const c of o)l.push(r(c));return l}case ki:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case Gl:return n(new Date(o),s);case Kl:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case Yl:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case Xl:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case Sm:{const{name:l,message:c}=o;return n(new td[l](c),s)}case Nm:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new td[i](o),s)};return r},nd=e=>AC(new Map,e)(0),Gn="",{toString:PC}={},{keys:MC}=Object,Ir=e=>{const t=typeof e;if(t!=="object"||!e)return[Ji,t];const n=PC.call(e).slice(8,-1);switch(n){case"Array":return[ts,Gn];case"Object":return[ki,Gn];case"Date":return[Gl,Gn];case"RegExp":return[Kl,Gn];case"Map":return[Yl,Gn];case"Set":return[Xl,Gn];case"DataView":return[ts,n]}return n.includes("Array")?[ts,n]:n.includes("Error")?[Sm,n]:[ki,n]},zs=([e,t])=>e===Ji&&(t==="function"||t==="symbol"),_C=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=Ir(o);switch(l){case Ji:{let d=o;switch(c){case"bigint":l=Nm,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([jm],o)}return s([l,d],o)}case ts:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),s([c,[...h]],o)}const d=[],f=s([l,d],o);for(const h of o)d.push(i(h));return f}case ki:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],f=s([l,d],o);for(const h of MC(o))(e||!zs(Ir(o[h])))&&d.push([i(h),i(o[h])]);return f}case Gl:return s([l,o.toISOString()],o);case Kl:{const{source:d,flags:f}=o;return s([l,{source:d,flags:f}],o)}case Yl:{const d=[],f=s([l,d],o);for(const[h,p]of o)(e||!(zs(Ir(h))||zs(Ir(p))))&&d.push([i(h),i(p)]);return f}case Xl:{const d=[],f=s([l,d],o);for(const h of o)(e||!zs(Ir(h)))&&d.push(i(h));return f}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},rd=(e,{json:t,lossy:n}={})=>{const r=[];return _C(!(t||n),!!t,new Map,r)(e),r},ji=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nd(rd(e,t)):structuredClone(e):(e,t)=>nd(rd(e,t));function RC(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function DC(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function OC(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||RC,r=e.options.footnoteBackLabel||DC,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),h=Nr(f.toLowerCase());let p=0;const g=[],x=e.footnoteCounts.get(f);for(;x!==void 0&&++p<=x;){g.length>0&&g.push({type:"text",value:" "});let j=typeof n=="string"?n:n(c,p);typeof j=="string"&&(j={type:"text",value:j}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const j=b.children[b.children.length-1];j&&j.type==="text"?j.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ji(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
393
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
394
+ `}]}}const Qi=(function(e){if(e==null)return BC;if(typeof e=="function")return Zi(e);if(typeof e=="object")return Array.isArray(e)?LC(e):IC(e);if(typeof e=="string")return FC(e);throw new Error("Expected function, string, or object as test")});function LC(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Qi(e[n]);return Zi(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function IC(e){const t=e;return Zi(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function FC(e){return Zi(t);function t(n){return n&&n.type===e}}function Zi(e){return t;function t(n,r,s){return!!(zC(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function BC(){return!0}function zC(e){return e!==null&&typeof e=="object"&&"type"in e}const Cm=[],VC=!0,Ta=!1,$C="skip";function Em(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Qi(s),o=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=Cm,g,x,b;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=HC(n(c,d)),p[0]===Ta))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==$C)for(x=(r?y.children.length:-1)+o,b=d.concat(y);x>-1&&x<y.children.length;){const j=y.children[x];if(g=l(j,x,b)(),g[0]===Ta)return g;x=typeof g[1]=="number"?g[1]:x+o}}return p}}}function HC(e){return Array.isArray(e)?e:typeof e=="number"?[VC,e]:e==null?Cm:[e]}function Jl(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),Em(e,i,l,s);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return o(c,f,d)}}const Aa={}.hasOwnProperty,UC={};function WC(e,t){const n=t||UC,r=new Map,s=new Map,i=new Map,o={...TC,...n.handlers},l={all:u,applyData:GC,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:qC,wrap:YC};return Jl(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:s,h=String(d.identifier).toUpperCase();f.has(h)||f.set(h,d)}}),l;function c(d,f){const h=d.type,p=l.handlers[h];if(Aa.call(l.handlers,h)&&p)return p(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in d){const{children:x,...b}=d,y=ji(b);return y.children=l.all(d),y}return ji(d)}return(l.options.unknownHandler||KC)(l,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const g=l.one(h[p],d);if(g){if(p&&h[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=sd(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=sd(x.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function qC(e,t){e.position&&(t.position=Dj(e))}function GC(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,ji(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function KC(e,t){const n=t.data||{},r="value"in t&&!(Aa.call(n,"hProperties")||Aa.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function YC(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
395
+ `});++r<e.length;)r&&n.push({type:"text",value:`
396
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
397
+ `}),n}function sd(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function id(e,t){const n=WC(e,t),r=n.one(e,void 0),s=OC(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
398
+ `},s),i}function XC(e,t){return e&&"run"in e?async function(n,r){const s=id(n,{file:r,...t});await e.run(s,r)}:function(n,r){return id(n,{file:r,...e||t})}}function od(e){if(e)throw e}var To,ad;function JC(){if(ad)return To;ad=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},i=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!f)return!1;var h;for(h in u);return typeof h>"u"||e.call(u,h)},o=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return To=function c(){var u,d,f,h,p,g,x=arguments[0],b=1,y=arguments.length,j=!1;for(typeof x=="boolean"&&(j=x,x=arguments[1]||{},b=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});b<y;++b)if(u=arguments[b],u!=null)for(d in u)f=l(x,d),h=l(u,d),x!==h&&(j&&h&&(i(h)||(p=s(h)))?(p?(p=!1,g=f&&s(f)?f:[]):g=f&&i(f)?f:{},o(x,{name:d,newValue:c(j,g,h)})):typeof h<"u"&&o(x,{name:d,newValue:h}));return x},To}var QC=JC();const Ao=nl(QC);function Pa(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ZC(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const d=e[++i];let f=-1;if(c){o(c);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,d?e2(d,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function e2(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const zt={basename:t2,dirname:n2,extname:r2,join:s2,sep:"/"};function t2(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Cs(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function n2(e){if(Cs(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function r2(e){Cs(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function s2(...e){let t=-1,n;for(;++t<e.length;)Cs(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":i2(n)}function i2(e){Cs(e);const t=e.codePointAt(0)===47;let n=o2(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function o2(e,t){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Cs(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const a2={cwd:l2};function l2(){return"/"}function Ma(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function c2(e){if(typeof e=="string")e=new URL(e);else if(!Ma(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return u2(e)}function u2(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Po=["history","path","basename","stem","extname","dirname"];class Tm{constructor(t){let n;t?Ma(t)?n={path:t}:typeof t=="string"||d2(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":a2.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Po.length;){const i=Po[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)Po.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){_o(t,"basename"),Mo(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){ld(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Mo(t,"extname"),ld(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ma(t)&&(t=c2(t)),_o(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){_o(t,"stem"),Mo(t,"stem"),this.path=zt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new lt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Mo(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function _o(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ld(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function d2(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const f2=(function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),h2={}.hasOwnProperty;class Ql extends f2{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ZC()}copy(){const t=new Ql;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ao(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Oo("data",this.frozen),this.namespace[t]=n,this):h2.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Oo("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Vs(t),r=this.parser||this.Parser;return Ro("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ro("process",this.parser||this.Parser),Do("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=Vs(t),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,g=r.stringify(p,h);g2(g)?h.value=g:h.result=g,u(d,h)});function u(d,f){d||!f?o(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ro("processSync",this.parser||this.Parser),Do("processSync",this.compiler||this.Compiler),this.process(t,s),ud("processSync","process",n),r;function s(i,o){n=!0,od(i),r=o}}run(t,n,r){cd(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=Vs(n);s.run(t,c,u);function u(d,f,h){const p=f||t;d?l(d):o?o(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),ud("runSync","run",r),s;function i(o,l){od(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=Vs(n),s=this.compiler||this.Compiler;return Do("stringify",s),cd(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Oo("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=Ao(!0,s.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const x=r[h][1];Pa(x)&&Pa(p)&&(p=Ao(!0,x,p)),r[h]=[u,p,...g]}}}}const p2=new Ql().freeze();function Ro(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Do(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Oo(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cd(e){if(!Pa(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ud(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Vs(e){return m2(e)?e:new Tm(e)}function m2(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function g2(e){return typeof e=="string"||x2(e)}function x2(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const y2="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",dd=[],fd={allowDangerousHtml:!0},b2=/^(https?|ircs?|mailto|xmpp)$/i,v2=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function w2(e){const t=k2(e),n=j2(e);return S2(t.runSync(t.parse(n),n),e)}function k2(e){const t=e.rehypePlugins||dd,n=e.remarkPlugins||dd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fd}:fd;return p2().use(nC).use(n).use(XC,r).use(t)}function j2(e){const t=e.children||"",n=new Tm;return typeof t=="string"&&(n.value=t),n}function S2(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||N2;for(const d of v2)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+y2+d.id,void 0);return Jl(e,u),Bj(e,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in No)if(Object.hasOwn(No,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],x=No[p];(x===null||x.includes(d.tagName))&&(d.properties[p]=c(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function N2(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||b2.test(e.slice(0,t))?e:""}function hd(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function C2(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function E2(e,t,n){const s=Qi((n||{}).ignore||[]),i=T2(t);let o=-1;for(;++o<i.length;)Em(e,"text",l);function l(u,d){let f=-1,h;for(;++f<d.length;){const p=d[f],g=h?h.children:void 0;if(s(p,g?g.indexOf(p):void 0,h))return;h=p}if(h)return c(u,d)}function c(u,d){const f=d[d.length-1],h=i[o][0],p=i[o][1];let g=0;const b=f.children.indexOf(u);let y=!1,j=[];h.lastIndex=0;let w=h.exec(u.value);for(;w;){const E=w.index,T={index:w.index,input:w.input,stack:[...d,u]};let S=p(...w,T);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=E+1:(g!==E&&j.push({type:"text",value:u.value.slice(g,E)}),Array.isArray(S)?j.push(...S):S&&j.push(S),g=E+w[0].length,y=!0),!h.global)break;w=h.exec(u.value)}return y?(g<u.value.length&&j.push({type:"text",value:u.value.slice(g)}),f.children.splice(b,1,...j)):j=[u],b+j.length}}function T2(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([A2(s[0]),P2(s[1])])}return t}function A2(e){return typeof e=="string"?new RegExp(C2(e),"g"):e}function P2(e){return typeof e=="function"?e:function(){return e}}const Lo="phrasing",Io=["autolink","link","image","label"];function M2(){return{transforms:[F2],enter:{literalAutolink:R2,literalAutolinkEmail:Fo,literalAutolinkHttp:Fo,literalAutolinkWww:Fo},exit:{literalAutolink:I2,literalAutolinkEmail:L2,literalAutolinkHttp:D2,literalAutolinkWww:O2}}}function _2(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lo,notInConstruct:Io},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lo,notInConstruct:Io},{character:":",before:"[ps]",after:"\\/",inConstruct:Lo,notInConstruct:Io}]}}function R2(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fo(e){this.config.enter.autolinkProtocol.call(this,e)}function D2(e){this.config.exit.autolinkProtocol.call(this,e)}function O2(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function L2(e){this.config.exit.autolinkEmail.call(this,e)}function I2(e){this.exit(e)}function F2(e){E2(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,B2],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),z2]],{ignore:["link","linkReference"]})}function B2(e,t,n,r,s){let i="";if(!Am(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!V2(n)))return!1;const o=$2(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function z2(e,t,n,r){return!Am(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function V2(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function $2(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=hd(e,"(");let i=hd(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function Am(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||zn(n)||Yi(n))&&(!t||n!==47)}Pm.peek=J2;function H2(){this.buffer()}function U2(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function W2(){this.buffer()}function q2(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function G2(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function K2(e){this.exit(e)}function Y2(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Dt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function X2(e){this.exit(e)}function J2(){return"["}function Pm(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=s.move("]"),i}function Q2(){return{enter:{gfmFootnoteCallString:H2,gfmFootnoteCall:U2,gfmFootnoteDefinitionLabelString:W2,gfmFootnoteDefinition:q2},exit:{gfmFootnoteCallString:G2,gfmFootnoteCall:K2,gfmFootnoteDefinitionLabelString:Y2,gfmFootnoteDefinition:X2}}}function Z2(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Pm},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
399
+ `:" ")+i.indentLines(i.containerFlow(r,l.current()),t?Mm:eE))),u(),c}}function eE(e,t,n){return t===0?e:Mm(e,t,n)}function Mm(e,t,n){return(n?"":" ")+e}const tE=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_m.peek=oE;function nE(){return{canContainEols:["delete"],enter:{strikethrough:sE},exit:{strikethrough:iE}}}function rE(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:tE}],handlers:{delete:_m}}}function sE(e){this.enter({type:"delete",children:[]},e)}function iE(e){this.exit(e)}function _m(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function oE(){return"~"}function aE(e){return e.length}function lE(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||aE,i=[],o=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const x=[],b=[];let y=-1;for(e[d].length>u&&(u=e[d].length);++y<e[d].length;){const j=cE(e[d][y]);if(n.alignDelimiters!==!1){const w=s(j);b[y]=w,(c[y]===void 0||w>c[y])&&(c[y]=w)}x.push(j)}o[d]=x,l[d]=b}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)i[f]=pd(r[f]);else{const x=pd(r);for(;++f<u;)i[f]=x}f=-1;const h=[],p=[];for(;++f<u;){const x=i[f];let b="",y="";x===99?(b=":",y=":"):x===108?b=":":x===114&&(y=":");let j=n.alignDelimiters===!1?1:Math.max(1,c[f]-b.length-y.length);const w=b+"-".repeat(j)+y;n.alignDelimiters!==!1&&(j=b.length+j+y.length,j>c[f]&&(c[f]=j),p[f]=j),h[f]=w}o.splice(1,0,h),l.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const x=o[d],b=l[d];f=-1;const y=[];for(;++f<u;){const j=x[f]||"";let w="",E="";if(n.alignDelimiters!==!1){const T=c[f]-(b[f]||0),S=i[f];S===114?w=" ".repeat(T):S===99?T%2?(w=" ".repeat(T/2+.5),E=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),E=w):E=" ".repeat(T)}n.delimiterStart!==!1&&!f&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&j==="")&&(n.delimiterStart!==!1||f)&&y.push(" "),n.alignDelimiters!==!1&&y.push(w),y.push(j),n.alignDelimiters!==!1&&y.push(E),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&y.push("|")}g.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return g.join(`
400
+ `)}function cE(e){return e==null?"":String(e)}function pd(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function uE(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),dE);return s(),o}function dE(e,t,n){return">"+(n?"":" ")+e}function fE(e,t){return md(e,t.inConstruct,!0)&&!md(e,t.notInConstruct,!1)}function md(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function gd(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
401
+ `&&fE(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
402
+ `}function hE(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function pE(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function mE(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function gE(e,t,n,r){const s=mE(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(pE(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,xE);return f(),h}const l=n.createTracker(r),c=s.repeat(Math.max(hE(i,s)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
403
+ `,encode:["`"],...l.current()})),f()}return d+=l.move(`
404
+ `),i&&(d+=l.move(i+`
405
+ `)),d+=l.move(c),u(),d}function xE(e,t,n){return(n?"":" ")+e}function Zl(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function yE(e,t,n,r){const s=Zl(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
406
+ `,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),o(),u}function bE(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function us(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Si(e,t,n){const r=ur(e),s=ur(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Rm.peek=vE;function Rm(e,t,n,r){const s=bE(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),d=Si(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=us(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Si(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+us(f));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function vE(e,t,n){return n.options.emphasis||"*"}function wE(e,t){let n=!1;return Jl(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ta}),!!((!e.depth||e.depth<3)&&Ul(e)&&(t.options.setext||n))}function kE(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(wE(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:`
407
+ `,after:`
408
+ `});return f(),d(),h+`
409
+ `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
410
+ `))+1))}const o="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
411
+ `,...i.current()});return/^[\t ]/.test(u)&&(u=us(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}Dm.peek=jE;function Dm(e){return e.value||""}function jE(){return"<"}Om.peek=SE;function Om(e,t,n,r){const s=Zl(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),o(),u}function SE(){return"!"}Lm.peek=NE;function Lm(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function NE(){return"!"}Im.peek=CE;function Im(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return s+r+s}function CE(){return"`"}function Fm(e,t){const n=Ul(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Bm.peek=EE;function Bm(e,t,n,r){const s=Zl(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if(Fm(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),c()),u+=o.move(")"),l(),u}function EE(e,t,n){return Fm(e,n)?"<":"["}zm.peek=TE;function zm(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==f?c+=l.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function TE(){return"["}function ec(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function AE(e){const t=ec(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function PE(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Vm(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function ME(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?PE(n):ec(n);const l=e.ordered?o==="."?")":".":AE(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Vm(n)===o&&d){let f=-1;for(;++f<e.children.length;){const h=e.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function _E(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function RE(e,t,n,r){const s=_E(n);let i=n.bulletCurrent||ec(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(o))+f:(p?i:i+" ".repeat(o-i.length))+f}}function DE(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const OE=Qi(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function LE(e,t,n,r){return(e.children.some(function(o){return OE(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function IE(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$m.peek=FE;function $m(e,t,n,r){const s=IE(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(s+s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),d=Si(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=us(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Si(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+us(f));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function FE(e,t,n){return n.options.strong||"*"}function BE(e,t,n,r){return n.safe(e.value,r)}function zE(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function VE(e,t,n){const r=(Vm(n)+(n.options.ruleSpaces?" ":"")).repeat(zE(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Hm={blockquote:uE,break:gd,code:gE,definition:yE,emphasis:Rm,hardBreak:gd,heading:kE,html:Dm,image:Om,imageReference:Lm,inlineCode:Im,link:Bm,linkReference:zm,list:ME,listItem:RE,paragraph:DE,root:LE,strong:$m,text:BE,thematicBreak:VE};function $E(){return{enter:{table:HE,tableData:xd,tableHeader:xd,tableRow:WE},exit:{codeText:qE,table:UE,tableData:Bo,tableHeader:Bo,tableRow:Bo}}}function HE(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function UE(e){this.exit(e),this.data.inTable=void 0}function WE(e){this.enter({type:"tableRow",children:[]},e)}function Bo(e){this.exit(e)}function xd(e){this.enter({type:"tableCell",children:[]},e)}function qE(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,GE));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function GE(e,t){return t==="|"?t:e}function KE(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
412
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:c,tableRow:l}};function o(p,g,x,b){return u(d(p,x,b),p.align)}function l(p,g,x,b){const y=f(p,x,b),j=u([y]);return j.slice(0,j.indexOf(`
413
+ `))}function c(p,g,x,b){const y=x.enter("tableCell"),j=x.enter("phrasing"),w=x.containerPhrasing(p,{...b,before:i,after:i});return j(),y(),w}function u(p,g){return lE(p,{align:g,alignDelimiters:r,padding:n,stringLength:s})}function d(p,g,x){const b=p.children;let y=-1;const j=[],w=g.enter("table");for(;++y<b.length;)j[y]=f(b[y],g,x);return w(),j}function f(p,g,x){const b=p.children;let y=-1;const j=[],w=g.enter("tableRow");for(;++y<b.length;)j[y]=c(b[y],p,g,x);return w(),j}function h(p,g,x){let b=Hm.inlineCode(p,g,x);return x.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function YE(){return{exit:{taskListCheckValueChecked:yd,taskListCheckValueUnchecked:yd,paragraph:JE}}}function XE(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:QE}}}function yd(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function JE(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function QE(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=Hm.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function ZE(){return[M2(),Q2(),nE(),$E(),YE()]}function eT(e){return{extensions:[_2(),Z2(e),rE(),KE(e),XE()]}}const tT={tokenize:aT,partial:!0},Um={tokenize:lT,partial:!0},Wm={tokenize:cT,partial:!0},qm={tokenize:uT,partial:!0},nT={tokenize:dT,partial:!0},Gm={name:"wwwAutolink",tokenize:iT,previous:Ym},Km={name:"protocolAutolink",tokenize:oT,previous:Xm},sn={name:"emailAutolink",tokenize:sT,previous:Jm},qt={};function rT(){return{text:qt}}let Tn=48;for(;Tn<123;)qt[Tn]=sn,Tn++,Tn===58?Tn=65:Tn===91&&(Tn=97);qt[43]=sn;qt[45]=sn;qt[46]=sn;qt[95]=sn;qt[72]=[sn,Km];qt[104]=[sn,Km];qt[87]=[sn,Gm];qt[119]=[sn,Gm];function sT(e,t,n){const r=this;let s,i;return o;function o(f){return!_a(f)||!Jm.call(r,r.previous)||tc(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return _a(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(nT,d,u)(f):f===45||f===95||it(f)?(i=!0,e.consume(f),c):d(f)}function u(f){return e.consume(f),s=!0,c}function d(f){return i&&s&&ut(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function iT(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!Ym.call(r,r.previous)||tc(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(tT,e.attempt(Um,e.attempt(Wm,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function oT(e,t,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&Xm.call(r,r.previous)&&!tc(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(ut(f)&&s.length<5)return s+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return e.consume(f),c}return n(f)}function c(f){return f===47?(e.consume(f),i?u:(i=!0,c)):n(f)}function u(f){return f===null||wi(f)||Ce(f)||zn(f)||Yi(f)?n(f):e.attempt(Um,e.attempt(Wm,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function aT(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function lT(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(qm,c,l)(u):u===null||Ce(u)||zn(u)||u!==45&&Yi(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function c(u){return s||r||!i?n(u):t(u)}}function cT(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(qm,t,i)(o):o===null||Ce(o)||zn(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function uT(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),s):l===60||l===null||Ce(l)||zn(l)?t(l):n(l)}function s(l){return l===null||l===40||l===91||Ce(l)||zn(l)?t(l):r(l)}function i(l){return ut(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):ut(l)?(e.consume(l),o):n(l)}}function dT(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return it(i)?n(i):t(i)}}function Ym(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ce(e)}function Xm(e){return!ut(e)}function Jm(e){return!(e===47||_a(e))}function _a(e){return e===43||e===45||e===46||e===95||it(e)}function tc(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const fT={tokenize:vT,partial:!0};function hT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:xT,continuation:{tokenize:yT},exit:bT}},text:{91:{name:"gfmFootnoteCall",tokenize:gT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pT,resolveTo:mT}}}}function pT(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=Dt(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function mT(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function gT(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!o||f===null||f===91||Ce(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(Dt(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Ce(f)||(o=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function xT(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||Ce(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return i=Dt(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Ce(g)||(l=!0),o++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),s.includes(i)||s.push(i),ge(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function yT(e,t,n){return e.check(Ns,t,e.attempt(fT,t,n))}function bT(e){e.exit("gfmFootnoteDefinition")}function vT(e,t,n){const r=this;return ge(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function wT(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},f={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},h=[["enter",d,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",f,l]],p=l.parser.constructs.insideSpan.null;p&&yt(h,h.length,0,Xi(p,o.slice(u+1,c),l)),yt(h,h.length,0,[["exit",f,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",d,l]]),yt(o,u-1,c-u+3,h),c=u+h.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,d=this.events;let f=0;return h;function h(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const x=ur(u);if(g===126)return f>1?c(g):(o.consume(g),f++,p);if(f<2&&!n)return c(g);const b=o.exit("strikethroughSequenceTemporary"),y=ur(g);return b._open=!y||y===2&&!!x,b._close=!x||x===2&&!!y,l(g)}}}class kT{constructor(){this.map=[]}add(t,n,r){jT(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function jT(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function ST(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function NT(){return{flow:{null:{name:"table",tokenize:CT,resolveAll:ET}}}}function CT(e,t,n){const r=this;let s=0,i=0,o;return l;function l(N){let O=r.events.length-1;for(;O>-1;){const F=r.events[O][1].type;if(F==="lineEnding"||F==="linePrefix")O--;else break}const P=O>-1?r.events[O][1].type:null,V=P==="tableHead"||P==="tableRow"?S:c;return V===S&&r.parser.lazy[r.now().line]?n(N):V(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),u(N)}function u(N){return N===124||(o=!0,i+=1),d(N)}function d(N){return N===null?n(N):ee(N)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),p):n(N):de(N)?ge(e,d,"whitespace")(N):(i+=1,o&&(o=!1,s+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),f(N)))}function f(N){return N===null||N===124||Ce(N)?(e.exit("data"),d(N)):(e.consume(N),N===92?h:f)}function h(N){return N===92||N===124?(e.consume(N),f):f(N)}function p(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,de(N)?ge(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?b(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),x):T(N)}function x(N){return de(N)?ge(e,b,"whitespace")(N):b(N)}function b(N){return N===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),y):N===45?(i+=1,y(N)):N===null||ee(N)?E(N):T(N)}function y(N){return N===45?(e.enter("tableDelimiterFiller"),j(N)):T(N)}function j(N){return N===45?(e.consume(N),j):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(N))}function w(N){return de(N)?ge(e,E,"whitespace")(N):E(N)}function E(N){return N===124?g(N):N===null||ee(N)?!o||s!==i?T(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):T(N)}function T(N){return n(N)}function S(N){return e.enter("tableRow"),A(N)}function A(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),A):N===null||ee(N)?(e.exit("tableRow"),t(N)):de(N)?ge(e,A,"whitespace")(N):(e.enter("data"),v(N))}function v(N){return N===null||N===124||Ce(N)?(e.exit("data"),A(N)):(e.consume(N),N===92?M:v)}function M(N){return N===92||N===124?(e.consume(N),v):v(N)}}function ET(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,d,f;const h=new kT;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(bd(h,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",d,t]])),s=g.type==="tableDelimiterRow"?2:d?3:1):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],f=$s(h,t,i,s,void 0,f),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],f=$s(h,t,i,s,void 0,f)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(l=!0,c=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],f=$s(h,t,i,s,n,f)):o[1]!==0&&(f=$s(h,t,o,s,n,f)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&bd(h,t,c,u,d),h.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=ST(t.events,n))}return e}function $s(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},Yn(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=Yn(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=Yn(t.events,n[2]),d=Yn(t.events,n[3]),f={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const h=t.events[n[2]],p=t.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},Yn(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function bd(e,t,n,r,s){const i=[],o=Yn(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function Yn(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const TT={name:"tasklistCheck",tokenize:PT};function AT(){return{text:{91:TT}}}function PT(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Ce(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return ee(c)?t(c):de(c)?e.check({tokenize:MT},t,n)(c):n(c)}}function MT(e,t,n){return ge(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function _T(e){return lm([rT(),hT(),wT(e),NT(),AT()])}const RT={};function DT(e){const t=this,n=e||RT,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(_T(n)),i.push(ZE()),o.push(eT(n))}function OT({content:e,className:t}){return a.jsx("div",{className:I("space-y-4 text-[13px] leading-[1.7]",t),style:{fontFamily:"'Inter', system-ui, sans-serif"},children:a.jsx(w2,{remarkPlugins:[DT],components:{h1:({children:n})=>a.jsx("h1",{className:"text-base font-semibold text-foreground border-b border-border pb-2 mb-3",children:n}),h2:({children:n})=>a.jsx("h2",{className:"text-sm font-semibold text-foreground mt-6 mb-2 border-b border-border/50 pb-1.5",children:n}),h3:({children:n})=>a.jsx("h3",{className:"text-[13px] font-semibold text-foreground mt-5 mb-1.5",children:n}),h4:({children:n})=>a.jsx("h4",{className:"text-[13px] font-medium text-foreground/90 mt-4 mb-1",children:n}),p:({children:n})=>a.jsx("p",{className:"text-foreground/70 mb-2",children:n}),a:({href:n,children:r})=>a.jsx("a",{href:n,className:"text-accent-blue hover:text-accent-blue/80 underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:r}),ul:({children:n})=>a.jsx("ul",{className:"ml-5 space-y-1.5 list-disc text-foreground/70 marker:text-muted-foreground",children:n}),ol:({children:n})=>a.jsx("ol",{className:"ml-5 space-y-1.5 list-decimal text-foreground/70 marker:text-muted-foreground",children:n}),li:({children:n,...r})=>{var i,o;const s=(o=(i=r.node)==null?void 0:i.properties)==null?void 0:o.className;return s&&String(s).includes("task-list-item")?a.jsx("li",{className:"list-none ml-[-1.25rem] flex items-start gap-2",children:n}):a.jsx("li",{className:"pl-1",children:n})},input:({checked:n})=>a.jsx("input",{type:"checkbox",checked:n,readOnly:!0,className:"mt-1 h-3.5 w-3.5 rounded border-border accent-primary"}),code:({children:n,className:r})=>(r==null?void 0:r.startsWith("language-"))?a.jsx("code",{className:I("block rounded p-3 font-mono text-xxs overflow-x-auto","bg-[#0d0d14] border border-border/50",r),children:n}):a.jsx("code",{className:"bg-[#0d0d14] border border-border/30 rounded px-1.5 py-0.5 font-mono text-xxs text-accent-blue/90",children:n}),pre:({children:n})=>a.jsx("pre",{className:"overflow-x-auto my-3",children:n}),blockquote:({children:n})=>a.jsx("blockquote",{className:"border-l-2 border-accent-blue/40 pl-4 py-1 text-foreground/60 italic bg-surface/50 rounded-r",children:n}),table:({children:n})=>a.jsx("div",{className:"overflow-x-auto my-3 rounded border border-border",children:a.jsx("table",{className:"w-full text-xs",children:n})}),thead:({children:n})=>a.jsx("thead",{className:"bg-[#0d0d14] text-muted-foreground",children:n}),tr:({children:n})=>a.jsx("tr",{className:"border-b border-border/50 even:bg-surface/30",children:n}),th:({children:n})=>a.jsx("th",{className:"px-3 py-2 text-left text-xxs font-medium uppercase tracking-wider",children:n}),td:({children:n})=>a.jsx("td",{className:"px-3 py-2 text-foreground/70",children:n}),hr:()=>a.jsx("hr",{className:"border-border/50 my-4"}),strong:({children:n})=>a.jsx("strong",{className:"font-semibold text-foreground",children:n})},children:e})})}const Qm=6048e5,LT=864e5,Hs=43200,vd=1440,wd=Symbol.for("constructDateFrom");function tn(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&wd in e?e[wd](t):e instanceof Date?new e.constructor(t):new Date(t)}function Xe(e,t){return tn(t||e,e)}let IT={};function Es(){return IT}function ds(e,t){var l,c,u,d;const n=Es(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,s=Xe(e,t==null?void 0:t.in),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Ni(e,t){return ds(e,{...t,weekStartsOn:1})}function Zm(e,t){const n=Xe(e,t==null?void 0:t.in),r=n.getFullYear(),s=tn(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const i=Ni(s),o=tn(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const l=Ni(o);return n.getTime()>=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function Ci(e){const t=Xe(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function eo(e,...t){const n=tn.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function kd(e,t){const n=Xe(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function FT(e,t,n){const[r,s]=eo(n==null?void 0:n.in,e,t),i=kd(r),o=kd(s),l=+i-Ci(i),c=+o-Ci(o);return Math.round((l-c)/LT)}function BT(e,t){const n=Zm(e,t),r=tn(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ni(r)}function oi(e,t){const n=+Xe(e)-+Xe(t);return n<0?-1:n>0?1:n}function zT(e){return tn(e,Date.now())}function VT(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function $T(e){return!(!VT(e)&&typeof e!="number"||isNaN(+Xe(e)))}function HT(e,t,n){const[r,s]=eo(n==null?void 0:n.in,e,t),i=r.getFullYear()-s.getFullYear(),o=r.getMonth()-s.getMonth();return i*12+o}function UT(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function WT(e,t){return+Xe(e)-+Xe(t)}function qT(e,t){const n=Xe(e,t==null?void 0:t.in);return n.setHours(23,59,59,999),n}function GT(e,t){const n=Xe(e,t==null?void 0:t.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function KT(e,t){const n=Xe(e,t==null?void 0:t.in);return+qT(n,t)==+GT(n,t)}function YT(e,t,n){const[r,s,i]=eo(n==null?void 0:n.in,e,e,t),o=oi(s,i),l=Math.abs(HT(s,i));if(l<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-o*l);let c=oi(s,i)===-o;KT(r)&&l===1&&oi(r,i)===1&&(c=!1);const u=o*(l-+c);return u===0?0:u}function XT(e,t,n){const r=WT(e,t)/1e3;return UT(n==null?void 0:n.roundingMethod)(r)}function JT(e,t){const n=Xe(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const QT={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ZT=(e,t,n)=>{let r;const s=QT[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function zo(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const eA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},tA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},nA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},rA={date:zo({formats:eA,defaultWidth:"full"}),time:zo({formats:tA,defaultWidth:"full"}),dateTime:zo({formats:nA,defaultWidth:"full"})},sA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},iA=(e,t,n,r)=>sA[e];function Fr(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const oA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},aA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},lA={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},cA={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},uA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},dA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},fA=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},hA={ordinalNumber:fA,era:Fr({values:oA,defaultWidth:"wide"}),quarter:Fr({values:aA,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Fr({values:lA,defaultWidth:"wide"}),day:Fr({values:cA,defaultWidth:"wide"}),dayPeriod:Fr({values:uA,defaultWidth:"wide",formattingValues:dA,defaultFormattingWidth:"wide"})};function Br(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?mA(l,f=>f.test(o)):pA(l,f=>f.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}function pA(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function mA(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function gA(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const xA=/^(\d+)(th|st|nd|rd)?/i,yA=/\d+/i,bA={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},vA={any:[/^b/i,/^(a|c)/i]},wA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},kA={any:[/1/i,/2/i,/3/i,/4/i]},jA={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},SA={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},NA={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},CA={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},EA={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},TA={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},AA={ordinalNumber:gA({matchPattern:xA,parsePattern:yA,valueCallback:e=>parseInt(e,10)}),era:Br({matchPatterns:bA,defaultMatchWidth:"wide",parsePatterns:vA,defaultParseWidth:"any"}),quarter:Br({matchPatterns:wA,defaultMatchWidth:"wide",parsePatterns:kA,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Br({matchPatterns:jA,defaultMatchWidth:"wide",parsePatterns:SA,defaultParseWidth:"any"}),day:Br({matchPatterns:NA,defaultMatchWidth:"wide",parsePatterns:CA,defaultParseWidth:"any"}),dayPeriod:Br({matchPatterns:EA,defaultMatchWidth:"any",parsePatterns:TA,defaultParseWidth:"any"})},eg={code:"en-US",formatDistance:ZT,formatLong:rA,formatRelative:iA,localize:hA,match:AA,options:{weekStartsOn:0,firstWeekContainsDate:1}};function PA(e,t){const n=Xe(e,t==null?void 0:t.in);return FT(n,JT(n))+1}function MA(e,t){const n=Xe(e,t==null?void 0:t.in),r=+Ni(n)-+BT(n);return Math.round(r/Qm)+1}function tg(e,t){var d,f,h,p;const n=Xe(e,t==null?void 0:t.in),r=n.getFullYear(),s=Es(),i=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(h=s.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,o=tn((t==null?void 0:t.in)||e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=ds(o,t),c=tn((t==null?void 0:t.in)||e,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const u=ds(c,t);return+n>=+l?r+1:+n>=+u?r:r-1}function _A(e,t){var l,c,u,d;const n=Es(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,s=tg(e,t),i=tn((t==null?void 0:t.in)||e,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),ds(i,t)}function RA(e,t){const n=Xe(e,t==null?void 0:t.in),r=+ds(n,t)-+_A(n,t);return Math.round(r/Qm)+1}function we(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const dn={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return we(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):we(n+1,2)},d(e,t){return we(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return we(e.getHours()%12||12,t.length)},H(e,t){return we(e.getHours(),t.length)},m(e,t){return we(e.getMinutes(),t.length)},s(e,t){return we(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return we(s,t.length)}},Kn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},jd={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return dn.y(e,t)},Y:function(e,t,n,r){const s=tg(e,r),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return we(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):we(i,t.length)},R:function(e,t){const n=Zm(e);return we(n,t.length)},u:function(e,t){const n=e.getFullYear();return we(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return we(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return we(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return dn.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return we(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const s=RA(e,r);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):we(s,t.length)},I:function(e,t,n){const r=MA(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):we(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):dn.d(e,t)},D:function(e,t,n){const r=PA(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):we(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return we(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const s=e.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return we(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return we(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let s;switch(r===12?s=Kn.noon:r===0?s=Kn.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let s;switch(r>=17?s=Kn.evening:r>=12?s=Kn.afternoon:r>=4?s=Kn.morning:s=Kn.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return dn.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):dn.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):we(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):we(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):dn.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):dn.s(e,t)},S:function(e,t){return dn.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return Nd(r);case"XXXX":case"XX":return Pn(r);case"XXXXX":case"XXX":default:return Pn(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Nd(r);case"xxxx":case"xx":return Pn(r);case"xxxxx":case"xxx":default:return Pn(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Sd(r,":");case"OOOO":default:return"GMT"+Pn(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Sd(r,":");case"zzzz":default:return"GMT"+Pn(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return we(r,t.length)},T:function(e,t,n){return we(+e,t.length)}};function Sd(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+t+we(i,2)}function Nd(e,t){return e%60===0?(e>0?"-":"+")+we(Math.abs(e)/60,2):Pn(e,t)}function Pn(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),s=we(Math.trunc(r/60),2),i=we(r%60,2);return n+s+t+i}const Cd=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},ng=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},DA=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return Cd(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",Cd(r,t)).replace("{{time}}",ng(s,t))},OA={p:ng,P:DA},LA=/^D+$/,IA=/^Y+$/,FA=["D","DD","YY","YYYY"];function BA(e){return LA.test(e)}function zA(e){return IA.test(e)}function VA(e,t,n){const r=$A(e,t,n);if(console.warn(r),FA.includes(e))throw new RangeError(r)}function $A(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const HA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,UA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,WA=/^'([^]*?)'?$/,qA=/''/g,GA=/[a-zA-Z]/;function Et(e,t,n){var d,f,h,p;const r=Es(),s=r.locale??eg,i=r.firstWeekContainsDate??((f=(d=r.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,o=r.weekStartsOn??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.weekStartsOn)??0,l=Xe(e,n==null?void 0:n.in);if(!$T(l))throw new RangeError("Invalid time value");let c=t.match(UA).map(g=>{const x=g[0];if(x==="p"||x==="P"){const b=OA[x];return b(g,s.formatLong)}return g}).join("").match(HA).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const x=g[0];if(x==="'")return{isToken:!1,value:KA(g)};if(jd[x])return{isToken:!0,value:g};if(x.match(GA))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:g}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(g=>{if(!g.isToken)return g.value;const x=g.value;(zA(x)||BA(x))&&VA(x,t,String(e));const b=jd[x[0]];return b(l,x,s.localize,u)}).join("")}function KA(e){const t=e.match(WA);return t?t[1].replace(qA,"'"):e}function YA(e,t,n){const r=Es(),s=(n==null?void 0:n.locale)??r.locale??eg,i=2520,o=oi(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o}),[c,u]=eo(n==null?void 0:n.in,...o>0?[t,e]:[e,t]),d=XT(u,c),f=(Ci(u)-Ci(c))/1e3,h=Math.round((d-f)/60);let p;if(h<2)return n!=null&&n.includeSeconds?d<5?s.formatDistance("lessThanXSeconds",5,l):d<10?s.formatDistance("lessThanXSeconds",10,l):d<20?s.formatDistance("lessThanXSeconds",20,l):d<40?s.formatDistance("halfAMinute",0,l):d<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):h===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",h,l);if(h<45)return s.formatDistance("xMinutes",h,l);if(h<90)return s.formatDistance("aboutXHours",1,l);if(h<vd){const g=Math.round(h/60);return s.formatDistance("aboutXHours",g,l)}else{if(h<i)return s.formatDistance("xDays",1,l);if(h<Hs){const g=Math.round(h/vd);return s.formatDistance("xDays",g,l)}else if(h<Hs*2)return p=Math.round(h/Hs),s.formatDistance("aboutXMonths",p,l)}if(p=YT(u,c),p<12){const g=Math.round(h/Hs);return s.formatDistance("xMonths",g,l)}else{const g=p%12,x=Math.trunc(p/12);return g<3?s.formatDistance("aboutXYears",x,l):g<9?s.formatDistance("overXYears",x,l):s.formatDistance("almostXYears",x+1,l)}}function yn(e,t){return YA(e,zT(e),t)}const XA={createScope:"Created",reviewScope:"Reviewed",implementScope:"Implemented",verifyScope:"Verified",commit:"Committed",pushToMain:"Pushed to Main",pushToDev:"Pushed to Dev",pushToStaging:"PR to Staging",pushToProduction:"PR to Production"};function Us(e){return e?XA[e]??e:null}function JA({sessions:e,loading:t}){const[n,r]=m.useState(null),[s,i]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(!1),d=m.useCallback(async h=>{r(h),l(!0);try{const p=await fetch(`/api/orbital/sessions/${h.id}/content`);p.ok&&i(await p.json())}catch{}finally{l(!1)}},[]),f=m.useCallback(async()=>{const h=n==null?void 0:n.claude_session_id;if(h){u(!0);try{await fetch(`/api/orbital/sessions/${n.id}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({claude_session_id:h})})}catch{}finally{setTimeout(()=>u(!1),2e3)}}},[n]);if(t)return a.jsx("div",{className:"flex h-32 items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})});if(n){const h=Array.isArray(n.discoveries)?n.discoveries:[],p=Array.isArray(n.next_steps)?n.next_steps:[],g=!!n.claude_session_id,x=(s==null?void 0:s.meta)??null,b=(x==null?void 0:x.summary)??n.summary??null,y=b?Ed(b,100):null;return a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2 pb-3",children:[a.jsx(fe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{r(null),i(null)},children:a.jsx(gb,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xxs text-muted-foreground",children:n.started_at&&Et(new Date(n.started_at),"MMM d, yyyy")}),a.jsx("p",{className:"truncate text-sm font-light",children:y||"Untitled Session"})]})]}),a.jsx(Xt,{className:"mb-3"}),a.jsx(Tt,{className:"flex-1 -mr-2 pr-2",children:o?a.jsx("div",{className:"flex h-20 items-center justify-center",children:a.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):a.jsx("table",{className:"w-full text-xs",children:a.jsxs("tbody",{className:"[&_td]:border-b [&_td]:border-border/30 [&_td]:py-2 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap",children:[a.jsxs("tr",{children:[a.jsx("td",{children:"Scope"}),a.jsx("td",{children:n.scope_id})]}),Us(n.action)&&a.jsxs("tr",{children:[a.jsx("td",{children:"Action"}),a.jsx("td",{children:Us(n.action)})]}),a.jsxs("tr",{children:[a.jsx("td",{children:"Summary"}),a.jsx("td",{children:n.summary?Ed(n.summary,200):"—"})]}),a.jsxs("tr",{children:[a.jsx("td",{children:"Started"}),a.jsx("td",{children:n.started_at?Et(new Date(n.started_at),"MMM d, h:mm a"):"—"})]}),a.jsxs("tr",{children:[a.jsx("td",{children:"Ended"}),a.jsx("td",{children:n.ended_at?Et(new Date(n.ended_at),"MMM d, h:mm a"):"—"})]}),x&&a.jsxs(a.Fragment,{children:[x.branch&&x.branch!=="unknown"&&a.jsxs("tr",{children:[a.jsx("td",{children:"Branch"}),a.jsx("td",{className:"font-mono text-xxs",children:x.branch})]}),x.fileSize>0&&a.jsxs("tr",{children:[a.jsx("td",{children:"File size"}),a.jsx("td",{children:QA(x.fileSize)})]}),a.jsxs("tr",{children:[a.jsx("td",{children:"Plan"}),a.jsx("td",{className:"text-muted-foreground",children:x.slug})]})]}),n.handoff_file&&a.jsxs("tr",{children:[a.jsx("td",{children:"Handoff"}),a.jsx("td",{className:"font-mono text-xxs",children:n.handoff_file})]}),h.length>0&&a.jsxs("tr",{children:[a.jsx("td",{children:"Completed"}),a.jsx("td",{children:a.jsx("ul",{className:"space-y-0.5",children:h.map((j,w)=>a.jsxs("li",{className:"text-muted-foreground",children:[a.jsx("span",{className:"text-bid-green mr-1",children:"•"}),j]},w))})})]}),p.length>0&&a.jsxs("tr",{children:[a.jsx("td",{children:"Next steps"}),a.jsx("td",{children:a.jsx("ul",{className:"space-y-0.5",children:p.map((j,w)=>a.jsxs("li",{className:"text-muted-foreground",children:[a.jsx("span",{className:"text-accent-blue mr-1",children:"•"}),j]},w))})})]}),n.claude_session_id&&a.jsxs("tr",{children:[a.jsx("td",{children:"Session ID"}),a.jsx("td",{className:"font-mono text-xxs text-muted-foreground",children:n.claude_session_id})]})]})})}),a.jsxs("div",{className:"pt-3",children:[a.jsxs(fe,{className:"w-full",disabled:!g||c,onClick:f,title:g?"Open in iTerm":"No Claude Code session found",children:[a.jsx(Ut,{className:"mr-2 h-4 w-4"}),c?"Opening iTerm...":"Resume Session"]}),!g&&a.jsx("p",{className:"mt-1.5 text-center text-xs text-muted-foreground",children:"No matching Claude Code session found"})]})]})}return a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2 pb-3",children:[a.jsx("h3",{className:"text-xs font-normal",children:"Sessions"}),a.jsx(Q,{variant:"secondary",className:"text-xxs",children:e.length})]}),e.length===0?a.jsx("div",{className:"flex flex-1 items-center justify-center",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions recorded yet"})}):a.jsx(Tt,{className:"flex-1 -mr-2 pr-2",children:a.jsx("div",{className:"space-y-2",children:e.map(h=>{const p=Array.isArray(h.discoveries)?h.discoveries:[],g=Array.isArray(h.next_steps)?h.next_steps:[];return a.jsx(Me,{className:I("cursor-pointer transition-colors hover:border-primary/30",h.claude_session_id&&"border-l-2 border-l-primary/50","glow-blue-sm"),onClick:()=>d(h),children:a.jsxs(Fe,{className:"p-2.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-xxs text-muted-foreground",children:h.started_at&&Et(new Date(h.started_at),"MMM d")}),Us(h.action)&&a.jsx(Q,{variant:"outline",className:"text-xxs px-1 py-0 font-light",children:Us(h.action)})]}),a.jsx(Zt,{className:"h-3.5 w-3.5 text-muted-foreground/50"})]}),a.jsx("p",{className:"mt-1 truncate text-xs font-normal",children:h.summary||"Untitled Session"}),a.jsxs("div",{className:"mt-1.5 flex items-center gap-3 text-xxs text-muted-foreground",children:[p.length>0&&a.jsxs("span",{className:"text-bid-green",children:[p.length," completed"]}),g.length>0&&a.jsxs("span",{className:"text-accent-blue",children:[g.length," next"]}),h.claude_session_id&&a.jsx("span",{className:"text-primary/70",children:"resumable"})]})]})},h.id)})})})]})}function Ed(e,t){return e.length>t?e.slice(0,t)+"...":e}function QA(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ZA(e){const[t,n]=m.useState([]),[r,s]=m.useState(!1),i=m.useCallback(async()=>{if(e==null){n([]);return}s(!0);try{const o=await fetch(`/api/orbital/scopes/${e}/sessions`);o.ok&&n(await o.json())}catch{}finally{s(!1)}},[e]);return m.useEffect(()=>{i()},[i]),m.useEffect(()=>{function o(){i()}return Z.on("session:updated",o),()=>{Z.off("session:updated",o)}},[i]),{sessions:t,loading:r}}const Ws="h-6 rounded border border-border bg-muted/30 px-1.5 text-xxs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/50";function e5(e){return{title:e.title,status:e.status,priority:e.priority??"",effort_estimate:e.effort_estimate??"",category:e.category??"",tags:[...e.tags],blocked_by:[...e.blocked_by],blocks:[...e.blocks]}}function t5(e,t){return e.title===t.title&&e.status===t.status&&e.priority===t.priority&&e.effort_estimate===t.effort_estimate&&e.category===t.category&&JSON.stringify(e.tags)===JSON.stringify(t.tags)&&JSON.stringify(e.blocked_by)===JSON.stringify(t.blocked_by)&&JSON.stringify(e.blocks)===JSON.stringify(t.blocks)}function Td({label:e,ids:t,onRemove:n,onAdd:r}){const[s,i]=m.useState(!1),[o,l]=m.useState("");return a.jsxs("span",{className:"inline-flex items-center gap-1",children:[e,":",t.map(c=>a.jsxs("span",{className:"group inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5",children:[dt(c),a.jsx("button",{onClick:()=>n(c),className:"opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(mt,{className:"h-2.5 w-2.5"})})]},c)),s?a.jsx("input",{autoFocus:!0,className:"h-5 w-12 rounded bg-muted/50 px-1 text-xxs border border-primary/30 focus:outline-none",placeholder:"ID",value:o,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(r(o),i(!1),l("")),c.key==="Escape"&&i(!1)},onBlur:()=>i(!1)}):a.jsx("button",{onClick:()=>i(!0),className:"hover:text-foreground transition-colors",children:a.jsx(In,{className:"h-3 w-3"})})]})}function n5({scope:e,open:t,onClose:n}){const{engine:r}=wt(),{sessions:s,loading:i}=ZA((e==null?void 0:e.id)??null),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(!1),[h,p]=m.useState(null),[g,x]=m.useState(""),b=o&&c?!t5(o,c):!1;m.useEffect(()=>{if(e&&t){const v=e5(e);l(v),u(v),p(null),x("")}},[e==null?void 0:e.id,e==null?void 0:e.updated_at,t]);const y=m.useCallback(async()=>{if(!(!e||!o||!b||d)){f(!0),p(null);try{const v={};c&&(o.title!==c.title&&(v.title=o.title),o.status!==c.status&&(v.status=o.status),o.priority!==c.priority&&(v.priority=o.priority||null),o.effort_estimate!==c.effort_estimate&&(v.effort_estimate=o.effort_estimate||null),o.category!==c.category&&(v.category=o.category||null),JSON.stringify(o.tags)!==JSON.stringify(c.tags)&&(v.tags=o.tags),JSON.stringify(o.blocked_by)!==JSON.stringify(c.blocked_by)&&(v.blocked_by=o.blocked_by),JSON.stringify(o.blocks)!==JSON.stringify(c.blocks)&&(v.blocks=o.blocks));const M=await fetch(`/api/orbital/scopes/${e.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)});if(!M.ok){const N=await M.json().catch(()=>({error:"Save failed"}));p(N.error??`HTTP ${M.status}`);return}u({...o})}catch{p("Network error — could not save")}finally{f(!1)}}},[e,o,c,b,d]);function j(){if(b&&window.confirm("Save changes before closing?")){y().then(n);return}n()}function w(v){l(M=>M&&{...M,...v}),p(null)}function E(v){const M=v.trim().toLowerCase();!M||!o||(o.tags.includes(M)||w({tags:[...o.tags,M]}),x(""))}function T(v,M){const N=parseInt(M,10);isNaN(N)||N<=0||!o||o[v].includes(N)||w({[v]:[...o[v],N]})}if(!e||!o)return null;const S=r.getValidTargets(e.status),A=[e.status,...S.filter(v=>v!==e.status)];return a.jsx(Nn,{open:t,onOpenChange:v=>{v||j()},children:a.jsxs(rn,{className:"max-w-[min(72rem,calc(100vw_-_2rem))] h-[85vh] flex flex-col p-0 gap-0 overflow-hidden",children:[a.jsxs($n,{className:"px-4 pt-3 pb-2",children:[a.jsxs("div",{className:"flex items-start gap-3 pr-8",children:[a.jsx("span",{className:"font-mono text-xxs text-muted-foreground mt-1.5",children:dt(e.id)}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx(kr,{asChild:!0,children:a.jsx("input",{className:"w-full bg-transparent text-sm font-normal text-foreground border-none focus:outline-none focus:ring-0 placeholder:text-muted-foreground leading-tight",value:o.title,onChange:v=>w({title:v.target.value}),placeholder:"Scope title..."})}),a.jsx(jr,{asChild:!0,children:a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[a.jsx("select",{className:Ws,value:o.status,onChange:v=>w({status:v.target.value}),children:A.map(v=>a.jsx("option",{value:v,children:v},v))}),a.jsxs("select",{className:Ws,value:o.priority,onChange:v=>w({priority:v.target.value}),children:[a.jsx("option",{value:"",children:"priority"}),Pl.map(v=>a.jsx("option",{value:v,children:v},v))]}),a.jsxs("select",{className:Ws,value:o.effort_estimate,onChange:v=>w({effort_estimate:v.target.value}),children:[a.jsx("option",{value:"",children:"effort"}),Ki.map(v=>a.jsx("option",{value:v,children:v},v))]}),a.jsxs("select",{className:Ws,value:o.category,onChange:v=>w({category:v.target.value}),children:[a.jsx("option",{value:"",children:"category"}),Ml.map(v=>a.jsx("option",{value:v,children:v},v))]}),o.tags.map(v=>a.jsxs("span",{className:"group inline-flex items-center gap-0.5 glass-pill rounded bg-muted px-1.5 py-0.5 text-xxs text-muted-foreground",children:[v,a.jsx("button",{onClick:()=>w({tags:o.tags.filter(M=>M!==v)}),className:"opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(mt,{className:"h-2.5 w-2.5"})})]},v)),a.jsx("input",{className:"h-5 w-16 rounded bg-transparent text-xxs text-muted-foreground placeholder:text-muted-foreground/50 border-none focus:outline-none",placeholder:"+tag",value:g,onChange:v=>x(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),E(g))},onBlur:()=>{g.trim()&&E(g)}})]})})]})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-xxs text-muted-foreground",children:[a.jsx(Td,{label:"Blocked by",ids:o.blocked_by,onRemove:v=>w({blocked_by:o.blocked_by.filter(M=>M!==v)}),onAdd:v=>T("blocked_by",v)}),a.jsx(Td,{label:"Blocks",ids:o.blocks,onRemove:v=>w({blocks:o.blocks.filter(M=>M!==v)}),onAdd:v=>T("blocks",v)}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(ys,{className:"h-3 w-3"}),a.jsx("span",{className:"truncate max-w-[300px]",children:e.file_path})]})]})]}),a.jsx(Xt,{}),h&&a.jsxs("div",{className:"mx-4 mt-2 flex items-center gap-2 rounded border border-red-500/30 bg-red-500/10 px-3 py-1.5 text-xs text-red-400",children:[a.jsx("span",{className:"flex-1",children:h}),a.jsx("button",{onClick:()=>p(null),className:"shrink-0 hover:text-red-200 transition-colors",children:a.jsx(mt,{className:"h-3.5 w-3.5"})})]}),a.jsxs("div",{className:"flex flex-1 min-h-0",children:[a.jsx("div",{className:"flex-[6] min-w-0 border-r bg-[#0a0a12]",children:a.jsx(Tt,{className:"h-full",children:a.jsx("div",{className:"px-6 py-5",children:e.raw_content?a.jsx(OT,{content:e.raw_content}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No content available"})})})}),a.jsx("div",{className:"flex-[4] min-w-0",children:a.jsx("div",{className:"flex h-full flex-col p-4",children:a.jsx(JA,{sessions:s,loading:i})})})]}),b&&a.jsxs("div",{className:"mx-4 mb-2 flex items-center gap-2 rounded border border-border bg-card px-3 py-2",children:[a.jsx(Q,{variant:"outline",children:"Unsaved changes"}),a.jsx("div",{className:"flex-1"}),a.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>{l(c),p(null)},children:"Discard"}),a.jsx(fe,{size:"sm",onClick:()=>y(),disabled:d,children:d?"Saving...":"Save"}),h&&a.jsx("span",{className:"text-xs text-destructive ml-2",children:h})]})]})})}function r5({open:e,loading:t,onSubmit:n,onCancel:r,onSurprise:s,surpriseLoading:i}){const[o,l]=m.useState(""),[c,u]=m.useState(""),d=m.useRef(null);m.useEffect(()=>{e&&(l(""),u(""),setTimeout(()=>{var p;return(p=d.current)==null?void 0:p.focus()},100))},[e]);function f(){o.trim()&&n(o.trim(),c.trim())}function h(p){(p.metaKey||p.ctrlKey)&&p.key==="Enter"&&(p.preventDefault(),f())}return a.jsx(Nn,{open:e,onOpenChange:p=>{p||r()},children:a.jsxs(rn,{className:"max-w-lg p-5 gap-0",onKeyDown:h,children:[a.jsxs($n,{className:"mb-4",children:[a.jsx(kr,{className:"text-sm font-normal",children:"New Idea"}),a.jsx(jr,{className:"text-xxs text-muted-foreground",children:"Capture a feature idea for the icebox"})]}),a.jsx("input",{ref:d,className:"mb-3 w-full rounded bg-muted/50 px-3 py-2 text-sm text-foreground border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 placeholder:text-muted-foreground",placeholder:"Feature name...",value:o,onChange:p=>l(p.target.value)}),a.jsx("textarea",{className:"mb-4 w-full rounded bg-muted/50 px-3 py-2.5 text-xs text-foreground border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 resize-y placeholder:text-muted-foreground",placeholder:"Describe the idea... What problem does it solve? Any notes on approach?",rows:6,value:c,onChange:p=>u(p.target.value)}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(fe,{size:"sm",onClick:f,disabled:t||!o.trim(),className:"flex-1",children:t?"Creating...":"Create"}),a.jsx(fe,{size:"sm",variant:"ghost",onClick:r,disabled:t,children:"Cancel"}),a.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground/50",children:["⌘","+Enter"]})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t border-border",children:[a.jsx(fe,{size:"sm",variant:"outline",className:"w-full text-purple-400 border-purple-500/30 hover:bg-purple-500/10 hover:border-purple-500/50",onClick:s,disabled:i,children:i?a.jsxs(a.Fragment,{children:[a.jsx(Li,{className:"h-3.5 w-3.5 mr-2 animate-spin"}),"Generating ideas..."]}):a.jsxs(a.Fragment,{children:[a.jsx(cl,{className:"h-3.5 w-3.5 mr-2"}),"Surprise Me"]})}),a.jsx("p",{className:"mt-1.5 text-center text-[10px] text-muted-foreground",children:"AI analyzes the codebase and suggests feature ideas"})]})]})})}function s5({scope:e,open:t,onClose:n,onDelete:r,onApprove:s,onReject:i}){const[o,l]=m.useState(""),[c,u]=m.useState(""),[d,f]=m.useState(""),[h,p]=m.useState(""),[g,x]=m.useState(!1),[b,y]=m.useState(!1),j=m.useRef(null),w=!!(e!=null&&e.is_ghost),E=o!==d||c!==h;m.useEffect(()=>{if(e&&t){const v=e.title??"",M=e.raw_content??"";l(v),u(M),f(v),p(M),y(!1),w||setTimeout(()=>{var N;return(N=j.current)==null?void 0:N.focus()},100)}},[e==null?void 0:e.id,t]);const T=m.useCallback(async()=>{if(!(!e||!E||g||w)){x(!0);try{(await fetch(`/api/orbital/ideas/${e.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o,description:c})})).ok&&(f(o),p(c))}finally{x(!1)}}},[e,o,c,E,g,w]);m.useEffect(()=>{if(!E||!t||w)return;const v=setInterval(()=>{T()},1e4);return()=>clearInterval(v)},[E,t,T,w]);function S(){if(E&&!w&&window.confirm("Save changes before closing?")){T().then(n);return}n()}function A(){if(!b){y(!0);return}e&&r(e.id)}return e?a.jsx(Nn,{open:t,onOpenChange:v=>{v||S()},children:a.jsxs(rn,{className:"max-w-md p-0 gap-0 flex flex-col max-h-[70vh]",children:[a.jsx($n,{className:"px-4 pt-3 pb-2",children:a.jsxs("div",{className:"flex items-center gap-2 pr-8",children:[a.jsx("div",{className:"flex-1 min-w-0",children:w?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(cl,{className:"h-3.5 w-3.5 text-purple-400 shrink-0"}),a.jsx("span",{className:"text-sm font-normal text-foreground truncate",children:o})]}):a.jsx("input",{ref:j,className:"w-full bg-transparent text-sm font-normal text-foreground border-none focus:outline-none focus:ring-0 placeholder:text-muted-foreground",placeholder:"Idea title...",value:o,onChange:v=>l(v.target.value)})}),w?a.jsx("span",{className:"shrink-0 rounded border border-purple-500/30 bg-purple-500/10 px-1.5 py-0.5 text-[10px] text-purple-400 uppercase",children:"ai suggestion"}):b?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(fe,{size:"sm",variant:"destructive",className:"h-6 text-xxs",onClick:A,children:"Confirm"}),a.jsx(fe,{size:"sm",variant:"ghost",className:"h-6 text-xxs",onClick:()=>y(!1),children:"No"})]}):a.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-destructive",onClick:A,title:"Delete idea",children:a.jsx(Ii,{className:"h-3.5 w-3.5"})})]})}),a.jsx("div",{className:"flex-1 min-h-0 px-4 pb-4",children:w?a.jsx("div",{className:"w-full min-h-[200px] rounded bg-muted/20 px-3 py-2.5 text-xs text-foreground/80 border border-border/50 whitespace-pre-wrap",children:c||a.jsx("span",{className:"text-muted-foreground italic",children:"No description"})}):a.jsx("textarea",{className:"w-full h-full min-h-[200px] rounded bg-muted/30 px-3 py-2.5 text-xs text-foreground border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 resize-none placeholder:text-muted-foreground",placeholder:"Describe the idea... What problem does it solve? Any notes on approach?",value:c,onChange:v=>u(v.target.value)})}),w?a.jsxs("div",{className:"px-4 pb-3 flex items-center gap-2",children:[a.jsxs(fe,{size:"sm",className:"flex-1 bg-green-600/20 border border-green-500/30 text-green-400 hover:bg-green-600/30 hover:text-green-300",onClick:()=>s(e.id),children:[a.jsx(sl,{className:"h-3.5 w-3.5 mr-1.5"}),"Approve"]}),a.jsxs(fe,{size:"sm",variant:"ghost",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>i(e.id),children:[a.jsx(mt,{className:"h-3.5 w-3.5 mr-1.5"}),"Reject"]})]}):a.jsxs("div",{className:"px-4 pb-3 flex items-center justify-between text-xxs text-muted-foreground",children:[a.jsx("span",{children:g?"Saving...":E?"Unsaved changes":"Saved"}),a.jsx(fe,{size:"sm",variant:"ghost",className:"h-6",onClick:()=>T(),disabled:!E||g,children:"Save"})]})]})}):null}const i5={priority:"text-warning-amber",category:"text-accent-blue",tags:"text-info-cyan",effort:"text-muted-foreground",dependencies:"text-ask-red"};function o5({field:e,label:t,options:n,selected:r,onToggle:s,glowClass:i}){const{neonGlass:o}=kn(),l=r.size>0;return a.jsxs(xr,{children:[a.jsx(yr,{asChild:!0,children:a.jsxs(fe,{variant:"outline",size:"sm",className:I("gap-1.5 capitalize backdrop-blur-sm bg-white/[0.03] border-white/10",l&&"border-white/20 text-foreground",l&&o&&i),children:[t,l&&a.jsx("span",{className:"ml-0.5 rounded-full bg-white/10 px-1.5 text-[10px]",children:r.size}),a.jsx(gn,{className:"h-3 w-3 opacity-50"})]})}),a.jsx(Vn,{className:"filter-popover-glass !bg-transparent",children:a.jsx("div",{className:"space-y-0.5",children:n.map(c=>{const u=r.has(c.value);return a.jsxs("button",{onClick:()=>s(e,c.value),className:I("flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs transition-colors","hover:bg-white/[0.06]",u&&"bg-white/[0.06]"),children:[a.jsx("span",{className:I("flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border",u?I("border-primary bg-primary text-primary-foreground",i5[e]):"border-white/15"),children:u&&a.jsx("svg",{className:"h-2.5 w-2.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),a.jsx("span",{className:I("capitalize",u&&"text-foreground"),children:c.label}),a.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:c.count})]},c.value)})})})]})}function a5({query:e,mode:t,isStale:n,onQueryChange:r,onModeChange:s}){kn();const i=m.useRef(null);m.useEffect(()=>{function l(c){var u;c.key==="/"&&!(c.target instanceof HTMLInputElement)&&!(c.target instanceof HTMLTextAreaElement)&&(c.preventDefault(),(u=i.current)==null||u.focus())}return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[]);const o=m.useCallback(l=>{var c;l.key==="Escape"&&(e?r(""):(c=i.current)==null||c.blur())},[e,r]);return a.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",role:"search","aria-label":"Search scopes",children:[a.jsxs("div",{className:I("flex items-center gap-1.5 rounded-md border px-2 py-1 backdrop-blur-sm bg-white/[0.03] border-white/10 transition-colors","focus-within:border-white/20","focus-within:glow-blue"),children:[a.jsx(E0,{className:I("h-3 w-3 shrink-0 text-muted-foreground",n&&"animate-pulse")}),a.jsx("input",{ref:i,type:"text",value:e,onChange:l=>r(l.target.value.slice(0,100)),onKeyDown:o,placeholder:"Search scopes...",className:"w-32 bg-transparent text-xs text-foreground placeholder:text-muted-foreground/60 focus:outline-none","aria-label":"Search scopes"}),e&&a.jsx("button",{onClick:()=>r(""),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Clear search",children:a.jsx(mt,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:I("flex rounded-md border backdrop-blur-sm bg-white/[0.03] border-white/10 overflow-hidden"),children:[a.jsx("button",{onClick:()=>s("filter"),className:I("px-2 py-1 text-[10px] transition-colors",t==="filter"?"bg-white/10 text-foreground":"text-muted-foreground hover:text-foreground hover:bg-white/[0.04]"),"aria-pressed":t==="filter",children:"Filter"}),a.jsx("button",{onClick:()=>s("highlight"),className:I("px-2 py-1 text-[10px] transition-colors",t==="highlight"?"bg-white/10 text-foreground":"text-muted-foreground hover:text-foreground hover:bg-white/[0.04]"),"aria-pressed":t==="highlight",children:"Highlight"})]})]})}const Ad=[{field:"priority",label:"Priority",glowClass:"glow-amber"},{field:"category",label:"Category",glowClass:"glow-blue"},{field:"tags",label:"Tags",glowClass:"glow-blue"},{field:"effort",label:"Effort",glowClass:""},{field:"dependencies",label:"Deps",glowClass:"glow-red"}],Pd={priority:"Priority",category:"Category",tags:"Tag",effort:"Effort",dependencies:"Dep"},l5={feature:"#536dfe",bugfix:"#ff1744",refactor:"#8B5CF6",infrastructure:"#40c4ff",docs:"#6B7280"};function c5({filters:e,optionsWithCounts:t,onToggle:n,onClearField:r,onClearAll:s,hasActiveFilters:i,searchQuery:o="",searchMode:l="filter",searchIsStale:c,onSearchChange:u,onSearchModeChange:d}){kn();const f=[];for(const{field:h}of Ad){if(e[h].size===0)continue;const p=[];for(const g of e[h]){const x=t[h].find(b=>b.value===g);p.push({value:g,label:(x==null?void 0:x.label)??g})}f.push({field:h,values:p})}return a.jsxs("div",{className:"mb-4 space-y-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Ad.map(({field:h,label:p,glowClass:g})=>a.jsx(o5,{field:h,label:p,options:t[h],selected:e[h],onToggle:n,glowClass:g},h)),i&&a.jsx("button",{onClick:s,className:"ml-2 text-xxs text-muted-foreground hover:text-foreground transition-colors",children:"Clear all"}),u&&d&&a.jsx(a5,{query:o,mode:l,isStale:c,onQueryChange:u,onModeChange:d})]}),f.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:f.map(({field:h,values:p})=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground capitalize",children:[Pd[h],":"]}),p.map(({value:g,label:x})=>{const b=h==="category";return a.jsxs(Q,{variant:b?"outline":"secondary",className:I("gap-0.5 capitalize cursor-pointer hover:bg-secondary/60 py-0 px-1 text-[10px] font-light",!b&&"glass-pill",b&&"bg-[rgba(var(--neon-blue),0.08)]"),style:b?{borderColor:l5[g]}:void 0,onClick:()=>n(h,g),children:[x,a.jsx(mt,{className:"h-2 w-2 opacity-60"})]},g)}),p.length>1&&a.jsx("button",{onClick:()=>r(h),className:"rounded p-0.5 text-muted-foreground hover:bg-surface-light hover:text-foreground","aria-label":`Clear all ${Pd[h]} filters`,children:a.jsx(mt,{className:"h-2.5 w-2.5"})})]},h))})]})}function u5({open:e,sprint:t,graph:n,loading:r,onConfirm:s,onCancel:i}){const[o,l]=m.useState(!1);if(m.useEffect(()=>{e&&l(!1)},[e]),!t)return null;const c=new Map(t.scopes.map(h=>[h.scope_id,h])),u=(n==null?void 0:n.layers)??[],d=t.scope_ids.length,f=async()=>{l(!0),s()};return a.jsx(Nn,{open:e,onOpenChange:h=>!h&&i(),children:a.jsxs(rn,{className:"sm:max-w-lg",children:[a.jsxs($n,{children:[a.jsxs(kr,{className:"flex items-center gap-2 text-sm",children:[a.jsx(hi,{className:"h-4 w-4 text-cyan-400"}),"Dispatch Sprint: ",t.name]}),a.jsxs(jr,{className:"text-xs",children:[d," scope",d!==1?"s":""," will be dispatched in"," ",u.length," layer",u.length!==1?"s":""," with max"," ",t.concurrency_cap," concurrent agents."]})]}),a.jsx("div",{className:"my-3 space-y-3 max-h-64 overflow-y-auto",children:u.map((h,p)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs(Q,{variant:"outline",className:"text-[10px]",children:["Layer ",p]}),p===0&&a.jsx("span",{className:"text-[10px] text-cyan-400",children:"Launches first"}),p>0&&a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Waits for Layer ",p-1]})]}),a.jsx("div",{className:"ml-4 space-y-1",children:h.map(g=>{const x=c.get(g);return a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"font-mono text-muted-foreground w-8 shrink-0",children:dt(g)}),a.jsx("span",{className:"truncate flex-1",children:(x==null?void 0:x.title)??"Unknown"}),(x==null?void 0:x.effort_estimate)&&a.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:x.effort_estimate})]},g)})}),p<u.length-1&&a.jsx("div",{className:"flex justify-center my-1",children:a.jsx(mr,{className:"h-3 w-3 text-muted-foreground rotate-90"})})]},p))}),u.length===0&&!r&&a.jsxs("div",{className:"flex items-center gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-400",children:[a.jsx(wn,{className:"h-3.5 w-3.5 shrink-0"}),"Could not compute execution layers. Sprint may have issues."]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t",children:[a.jsx(fe,{variant:"ghost",size:"sm",onClick:i,disabled:o,children:"Cancel"}),a.jsx(fe,{size:"sm",onClick:f,disabled:o||r||u.length===0,className:"bg-cyan-600 hover:bg-cyan-700",children:o?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border border-white border-t-transparent"}),"Dispatching..."]}):a.jsxs(a.Fragment,{children:[a.jsx(hi,{className:"h-3 w-3 mr-1"})," Dispatch Sprint"]})})]})]})})}function d5({open:e,batch:t,onConfirm:n,onCancel:r}){const{engine:s}=wt(),[i,o]=m.useState(!1),[l,c]=m.useState("push");if(m.useEffect(()=>{e&&o(!1)},[e]),!t)return null;const u=t.scope_ids.length,d=s.getBatchTargetStatus(t.target_column),f=d?s.findEdge(t.target_column,d):void 0,h=(f==null?void 0:f.description)??"Will dispatch this batch",p=()=>{o(!0),n(l)};return a.jsx(Nn,{open:e,onOpenChange:g=>!g&&r(),children:a.jsxs(rn,{className:"sm:max-w-md p-0 gap-0 overflow-hidden",children:[a.jsxs($n,{className:"px-4 pt-3 pb-2",children:[a.jsxs(kr,{className:"flex items-center gap-2 text-sm",children:[a.jsx(Rh,{className:"h-4 w-4 text-amber-400"}),"Dispatch Batch: ",t.name]}),a.jsxs(jr,{className:"text-xs",children:[h," (",u," scope",u!==1?"s":"",")"]})]}),a.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1 bg-[#0a0a12] px-4 py-3",children:t.scopes.map(g=>a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("span",{className:"font-mono text-muted-foreground w-8 shrink-0",children:dt(g.scope_id)}),a.jsx("span",{className:"truncate flex-1",children:g.title})]},g.scope_id))}),a.jsxs("div",{className:"px-4 py-2 border-t border-border/50 space-y-1.5",children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Merge Mode"}),a.jsx("div",{className:"flex gap-2",children:["push","pr","direct"].map(g=>a.jsx("button",{onClick:()=>c(g),className:`rounded px-2 py-1 text-xs transition-colors ${l===g?"bg-cyan-600/80 text-black":"bg-muted text-muted-foreground hover:bg-accent"}`,children:g==="push"?"Push":g==="pr"?"PR":"Direct Merge"},g))})]}),a.jsxs("div",{className:"flex justify-end gap-2 px-4 py-2 border-t border-border/50",children:[a.jsx(fe,{variant:"ghost",size:"sm",onClick:r,disabled:i,children:"Cancel"}),a.jsx(fe,{size:"sm",onClick:p,disabled:i||u===0,className:"bg-cyan-600/80 hover:bg-cyan-500/80 transition-colors",children:i?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border border-white border-t-transparent"}),"Dispatching..."]}):a.jsxs(a.Fragment,{children:[a.jsx(hi,{className:"h-3 w-3 mr-1"})," Dispatch"]})})]})]})})}function f5({open:e,unmetDeps:t,onAddAll:n,onCancel:r}){const s=new Map;for(const i of t)for(const o of i.missing)s.has(o.scope_id)||s.set(o.scope_id,{title:o.title,status:o.status});return a.jsx(Nn,{open:e,onOpenChange:i=>!i&&r(),children:a.jsxs(rn,{className:"sm:max-w-md",children:[a.jsxs($n,{children:[a.jsxs(kr,{className:"flex items-center gap-2 text-sm",children:[a.jsx(wn,{className:"h-4 w-4 text-warning-amber"}),"Unmet Dependencies"]}),a.jsx(jr,{className:"text-xs",children:"Some scopes you added depend on scopes not yet in this sprint."})]}),a.jsx("div",{className:"space-y-3 my-2",children:t.map(i=>a.jsxs("div",{className:"text-xs",children:[a.jsx("span",{className:"font-mono text-muted-foreground",children:dt(i.scope_id)}),a.jsx("span",{className:"ml-1",children:"depends on:"}),a.jsx("div",{className:"ml-4 mt-1 space-y-1",children:i.missing.map(o=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono text-muted-foreground",children:dt(o.scope_id)}),a.jsx("span",{className:"truncate",children:o.title}),a.jsx(Q,{variant:"outline",className:"text-[10px] ml-auto shrink-0",children:o.status})]},o.scope_id))})]},i.scope_id))}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t",children:[a.jsxs(fe,{variant:"ghost",size:"sm",onClick:r,children:[a.jsx(mt,{className:"h-3 w-3 mr-1"})," Cancel"]}),a.jsxs(fe,{size:"sm",onClick:()=>n([...s.keys()]),children:[a.jsx(In,{className:"h-3 w-3 mr-1"})," Add All Dependencies"]})]})]})})}function h5({columnId:e,dispatching:t,onOpenIdeaForm:n,onCreateGroup:r}){const{engine:s}=wt(),i=s.getEntryPoint().id,o=s.getList(e),l=(o==null?void 0:o.supportsBatch)??!1,c=(o==null?void 0:o.supportsSprint)??!1;if(e===i&&n)return a.jsx(fe,{variant:"ghost",size:"icon",className:"ml-1 h-5 w-5",onClick:n,disabled:t,title:"Add idea",children:a.jsx(In,{className:"h-3 w-3"})});if((c||l)&&r){const d=l?"batch":"sprint",f=l?"Batch":"Sprint";return a.jsx(fe,{variant:"ghost",size:"icon",className:"ml-1 h-5 w-5",onClick:()=>r(`New ${f}`,{target_column:e,group_type:d}),title:`Create ${f.toLowerCase()}`,children:a.jsx(In,{className:"h-3 w-3"})})}return null}const p5=e=>{const t=Hw(e),n=t.find(r=>String(r.id).startsWith("sprint-drop-"));return n?[n]:t.length>0?t:bp(e)},m5={critical:"bg-ask-red",high:"bg-warning-amber",medium:"bg-accent-blue",low:"bg-muted-foreground/30"},g5={feature:"bg-category-feature",bugfix:"bg-category-bugfix",refactor:"bg-category-refactor",infrastructure:"bg-category-infrastructure",docs:"bg-category-docs"},x5={"has-blockers":"Has blockers","blocks-others":"Blocks others","no-deps":"No dependencies"},y5={priority:Pl,category:Ml,effort:Ki,dependencies:Fp,tags:[]};function b5(e,t){return e==="priority"?m5[t]??"bg-muted-foreground/30":e==="category"?g5[t]??"bg-primary/40":"bg-primary/40"}function v5(e,t){return e==="dependencies"?x5[t]??t:t}function w5(){return new Proxy({},{get(e,t){return t in e||(e[t]=[]),e[t]}})}function k5(e,t,n,r){const s=new Map,i=new Map;for(const d of e){const f=_l(d,t),h=f.length>0?f:["Unset"];for(const p of h){s.has(p)||(s.set(p,w5()),i.set(p,0));const g=s.get(p),x=d.status;g[x]?g[x].push(d):g.planning.push(d),i.set(p,(i.get(p)??0)+1)}}for(const d of s.values())for(const f of Object.keys(d))d[f]=Vp(d[f],n,r);const o=y5[t],l=[...s.keys()],c=[];for(const d of o)s.has(d)&&c.push(d);const u=l.filter(d=>d!=="Unset"&&!o.includes(d)).sort();return c.push(...u),s.has("Unset")&&c.push("Unset"),c.map(d=>({value:d,label:d==="Unset"?"Unset":v5(t,d),color:d==="Unset"?"bg-muted-foreground/20":b5(t,d),count:i.get(d)??0,cells:s.get(d)}))}function j5(){var ct,_s,Rs,Ds,Ue,rt;const{scopes:e,loading:t}=yl(),{engine:n}=wt(),r=ek(),{sortField:s,sortDirection:i,setSort:o,collapsed:l,toggleCollapse:c}=hk(),{viewMode:u,setViewMode:d,groupField:f,setGroupField:h,collapsedLanes:p,toggleLaneCollapse:g}=gk(),{display:x,toggle:b,hiddenCount:y}=Q1(),[j,w]=m.useState(null),E=m.useMemo(()=>e.find(J=>J.id===j)??null,[e,j]),[T,S]=m.useState(null),[A,v]=m.useState(null),M=m.useMemo(()=>n.getBoardColumns(),[n]),{sprints:N,createSprint:O,renameSprint:P,deleteSprint:V,addScopes:F,dispatchSprint:R,getGraph:Y}=bk(),[G,H]=m.useState(null),{filters:L,toggleFilter:k,clearField:_,clearAll:$,hasActiveFilters:C,filteredScopes:re,optionsWithCounts:Te}=ck(e),K=jk(re),{highlightedScopeId:qe,clearHighlight:He}=Sk(),et=m.useMemo(()=>{if(qe==null)return K.dimmedIds;const J=new Set;for(const se of K.displayScopes)se.id!==qe&&J.add(se.id);return J},[qe,K.dimmedIds,K.displayScopes]);m.useEffect(()=>{if(qe==null)return;const J=setTimeout(()=>{document.addEventListener("click",He,{once:!0})},100);return()=>{clearTimeout(J),document.removeEventListener("click",He)}},[qe,He]);const{state:U,onDragStart:ke,onDragOver:tt,onDragEnd:ht,confirmTransition:De,cancelTransition:ne,dismissError:ie,openModalFromPopover:ce,openIdeaForm:ue,closeIdeaForm:xe,submitIdea:ve,dismissSprintDispatch:Ge,dismissUnmetDeps:nt,resolveUnmetDeps:Lt,showUnmetDeps:be}=yk({scopes:K.displayScopes,sprints:N,onAddToSprint:F}),je=yp(ga(Wi,{activationConstraint:{distance:8}}),ga(El)),D=$p(),B=m.useMemo(()=>{const J=new Map;for(const se of e)J.set(se.id,se);return J},[e]),W=m.useMemo(()=>{var Se;const J={};for(const ye of M)J[ye.id]=[];const se=n.getEntryPoint().id;for(const ye of K.displayScopes)J[ye.status]?J[ye.status].push(ye):(Se=J[se])==null||Se.push(ye);for(const ye of Object.keys(J))J[ye]=Vp(J[ye],s,i);return J},[K.displayScopes,s,i,M,n]),X=m.useMemo(()=>{const J={};for(const se of N){if(se.group_type==="batch"&&se.status==="completed")continue;const Se=se.group_type==="sprint"&&se.status!=="assembling"?"implementing":se.target_column;(J[Se]??(J[Se]=[])).push(se)}return J},[N]),oe=m.useMemo(()=>{const J=new Set;for(const se of N)if(!(se.group_type==="batch"&&se.status==="completed"))for(const Se of se.scope_ids)J.add(Se);return J},[N]),he=m.useMemo(()=>u!=="swimlane"?[]:k5(K.displayScopes,f,s,i),[u,K.displayScopes,f,s,i]),Ae=m.useMemo(()=>U.activeScope?new Set(n.getValidTargets(U.activeScope.status)):U.activeSprint?new Set(["implementing"]):new Set,[U.activeScope,U.activeSprint,n]),Oe=vk(U.pendingSprintDispatch,Y,R,Ge),{surpriseLoading:At,handleSurprise:Pt,handleApproveGhost:Ke,handleRejectGhost:It}=wk(xe,S);return t?a.jsx("div",{className:"flex h-64 items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):a.jsx(Ip.Provider,{value:r,children:a.jsx(Op,{sensors:je,modifiers:D,collisionDetection:p5,onDragStart:ke,onDragOver:tt,onDragEnd:ht,children:a.jsxs("div",{className:"flex flex-1 min-h-0 flex-col",children:[a.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(_h,{className:"h-4 w-4 text-primary"}),a.jsx("h1",{className:"text-xl font-light",children:"Kanban"}),a.jsx(Q,{variant:"secondary",className:"ml-2",children:K.hasSearch?`${K.matchCount} / ${e.length} scopes`:C?`${re.length} / ${e.length} scopes`:`${e.length} scopes`})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Qk,{viewMode:u,groupField:f,onViewModeChange:d,onGroupFieldChange:h}),a.jsx(Yk,{display:x,onToggle:b,hiddenCount:y})]})]}),U.error&&a.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:[a.jsx("span",{className:"flex-1",children:U.error}),a.jsx("button",{onClick:ie,className:"shrink-0 hover:text-red-200 transition-colors",children:a.jsx(mt,{className:"h-3.5 w-3.5"})})]}),a.jsx(c5,{filters:L,optionsWithCounts:Te,onToggle:k,onClearField:_,onClearAll:$,hasActiveFilters:C,searchQuery:K.query,searchMode:K.mode,searchIsStale:K.isStale,onSearchChange:K.setQuery,onSearchModeChange:K.setMode}),u==="swimlane"?a.jsx(tj,{lanes:he,columns:M,collapsedColumns:l,collapsedLanes:p,onToggleLane:g,onToggleCollapse:c,onScopeClick:J=>J.status===n.getEntryPoint().id?S(J):w(J.id),cardDisplay:x,dimmedIds:et,isDragActive:!!(U.activeScope||U.activeSprint),validTargets:Ae,sprints:N}):a.jsx("div",{className:"min-h-0 flex-1 overflow-x-auto overflow-y-hidden",children:a.jsx("div",{className:"flex h-full w-max gap-2 pb-4",children:M.map(J=>a.jsx(Fk,{id:J.id,label:J.label,color:J.color,scopes:W[J.id]??[],sprints:X[J.id],scopeLookup:B,globalSprintScopeIds:oe,onScopeClick:se=>se.status===n.getEntryPoint().id?S(se):w(se.id),onDeleteSprint:V,onDispatchSprint:se=>v(se),onRenameSprint:(se,Se)=>P(se,Se),editingSprintId:G,onSprintEditingDone:()=>H(null),onAddAllToSprint:async(se,Se)=>{const ye=await F(se,Se);ye&&ye.unmet_dependencies.length>0&&be(se,ye.unmet_dependencies)},isDragActive:!!(U.activeScope||U.activeSprint),isValidDrop:Ae.has(J.id),sortField:s,sortDirection:i,onSetSort:o,collapsed:l.has(J.id),onToggleCollapse:()=>c(J.id),cardDisplay:x,dimmedIds:et,headerExtra:a.jsx(h5,{columnId:J.id,dispatching:U.dispatching,onOpenIdeaForm:ue,onCreateGroup:async(se,Se)=>{const ye=await O(se,Se);return ye&&H(ye.id),ye}})},J.id))})}),a.jsx(nj,{activeScope:U.activeScope,activeSprint:U.activeSprint,cardDisplay:x}),a.jsx(sj,{open:U.showPopover,scope:((ct=U.pending)==null?void 0:ct.scope)??null,transition:((_s=U.pending)==null?void 0:_s.transition)??null,hasActiveSession:((Rs=U.pending)==null?void 0:Rs.hasActiveSession)??!1,onConfirm:De,onCancel:ne,onViewDetails:ce}),a.jsx(ij,{open:U.showModal,scope:((Ds=U.pending)==null?void 0:Ds.scope)??null,transition:((Ue=U.pending)==null?void 0:Ue.transition)??null,hasActiveSession:((rt=U.pending)==null?void 0:rt.hasActiveSession)??!1,onConfirm:De,onCancel:ne}),a.jsx(n5,{scope:E,open:!!E,onClose:()=>w(null)}),a.jsx(r5,{open:U.showIdeaForm,loading:U.dispatching,onSubmit:ve,onCancel:xe,onSurprise:Pt,surpriseLoading:At}),a.jsx(s5,{scope:T,open:!!T,onClose:()=>S(null),onDelete:async J=>{try{const se=await fetch(`/api/orbital/ideas/${J}`,{method:"DELETE"});if(!se.ok)throw new Error(`HTTP ${se.status}`);S(null)}catch{S(null)}},onApprove:Ke,onReject:It}),a.jsx(u5,{open:Oe.showPreflight,sprint:Oe.pendingSprint,graph:Oe.graph,loading:Oe.loading,onConfirm:Oe.onConfirm,onCancel:Oe.onCancel}),a.jsx(d5,{open:A!=null,batch:N.find(J=>J.id===A)??null,onConfirm:()=>{A!=null&&R(A),v(null)},onCancel:()=>v(null)}),a.jsx(f5,{open:U.pendingUnmetDeps!=null,unmetDeps:U.pendingUnmetDeps??[],onAddAll:Lt,onCancel:nt})]})})})}const S5=fy,rg=m.forwardRef(({className:e,...t},n)=>a.jsx(ph,{ref:n,className:I("card-glass inline-flex h-8 items-center justify-center rounded bg-surface p-0.5 border border-border text-muted-foreground",e),...t}));rg.displayName=ph.displayName;const sg=m.forwardRef(({className:e,...t},n)=>a.jsx(mh,{ref:n,className:I("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-2.5 py-1 text-xxs uppercase tracking-wider font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-surface-light data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));sg.displayName=mh.displayName;const N5=m.forwardRef(({className:e,...t},n)=>a.jsx(gh,{ref:n,className:I("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));N5.displayName=gh.displayName;const ig={guard:{icon:al,bg:"bg-red-500/10",border:"border-red-500/30",text:"text-red-400",hex:"#ef4444"},gate:{icon:wn,bg:"bg-amber-500/10",border:"border-amber-500/30",text:"text-amber-400",hex:"#f59e0b"},lifecycle:{icon:Eh,bg:"bg-cyan-500/10",border:"border-cyan-500/30",text:"text-cyan-400",hex:"#06b6d4"},observer:{icon:Oi,bg:"bg-zinc-500/10",border:"border-zinc-500/30",text:"text-zinc-400",hex:"#71717a"}};function nc({hook:e,selected:t,onClick:n,onRemove:r}){const s=ig[e.category],i=s.icon;return a.jsxs("button",{type:"button",onClick:n,"data-pipeline-path":e.filePath??void 0,className:I("inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors",s.bg,s.border,s.text,"hover:brightness-125 cursor-pointer",t&&"glow-selected-pulse"),style:t?{"--glow-color":`${s.hex}A0`,"--glow-color-wide":`${s.hex}40`}:void 0,children:[a.jsx(i,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"truncate max-w-[120px]",children:e.id}),r&&a.jsx("span",{role:"button",onClick:o=>{o.stopPropagation(),r()},className:"ml-0.5 rounded-full p-0.5 hover:bg-red-500/20",children:a.jsx(mt,{className:"h-2.5 w-2.5"})})]})}function Ra({node:e,depth:t,selectedPath:n,expandedPaths:r,primitiveType:s,onSelect:i,onToggle:o,onContextAction:l,hookCategoryMap:c,agentTeamMap:u,dimmed:d}){var O,P;const f=e.type==="folder",h=r.has(e.path),p=e.path===n,g=(O=e.frontmatter)!=null&&O.name?String(e.frontmatter.name):e.name,x=f?"":`tree::${s}::${e.path}`,{attributes:b,listeners:y,setNodeRef:j,isDragging:w}=wr({id:x,disabled:f,data:{type:s,path:e.path,name:g}}),E=()=>{f?o(e.path):i(e)},T=f||c==null?void 0:c.get(e.path),S=T?ig[T]:void 0,A=S==null?void 0:S.icon,v=f||u==null?void 0:u.get(e.path),N=p&&!f?T?{guard:"#ef4444",gate:"#f59e0b",lifecycle:"#06b6d4",observer:"#71717a"}[T]:v?v.color:s==="skills"?"#22c55e":"#00bcd4":void 0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{ref:f?void 0:j,"data-tree-path":f?void 0:e.path,className:I("group flex w-full items-center rounded text-left text-xs transition-colors",p&&N?"glow-selected":p?"bg-[#00bcd4]/15 text-[#00bcd4]":"text-muted-foreground hover:bg-surface-light hover:text-foreground",w&&"opacity-40",d&&!p&&"opacity-50"),style:N?{"--glow-color":`${N}50`,backgroundColor:`${N}18`,color:N}:void 0,...f?{}:{...y,...b},children:[a.jsxs("button",{onClick:E,className:"flex flex-1 min-w-0 items-center gap-1.5 px-2 py-1",style:{paddingLeft:`${t*12+8}px`},children:[f?a.jsxs(a.Fragment,{children:[h?a.jsx(gn,{className:"h-3 w-3 shrink-0 opacity-60"}):a.jsx(Zt,{className:"h-3 w-3 shrink-0 opacity-60"}),h?a.jsx(Gb,{className:"h-3.5 w-3.5 shrink-0 text-warning-amber/70"}):a.jsx(Ph,{className:"h-3.5 w-3.5 shrink-0 text-warning-amber/70"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3"}),a.jsx(Ah,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),a.jsx("span",{className:"min-w-0 truncate",children:g}),S&&A&&a.jsxs("span",{className:I("inline-flex shrink-0 items-center gap-0.5 rounded border px-1 py-0 text-[9px] font-medium",S.bg,S.border,S.text),children:[a.jsx(A,{className:"h-2.5 w-2.5"}),T]}),v&&a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded border px-1 py-0 text-[9px] font-medium",style:{color:v.color,borderColor:`${v.color}4D`,backgroundColor:`${v.color}1A`},children:[a.jsx(Di,{className:"h-2.5 w-2.5"}),v.team]})]}),a.jsxs("div",{className:"mr-1 flex shrink-0 items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.jsx("button",{onClick:V=>{V.stopPropagation(),l("rename",e)},className:"rounded p-0.5 hover:bg-surface-light",title:"Rename",children:a.jsx(Dh,{className:"h-3 w-3"})}),e.type==="file"&&a.jsx("button",{onClick:V=>{V.stopPropagation(),l("delete",e)},className:"rounded p-0.5 hover:bg-ask-red/20 text-muted-foreground hover:text-ask-red",title:"Delete",children:a.jsx(Ii,{className:"h-3 w-3"})}),e.type==="folder"&&a.jsx("button",{onClick:V=>{V.stopPropagation(),l("new-file",e)},className:"rounded p-0.5 hover:bg-surface-light",title:"New file",children:a.jsx(In,{className:"h-3 w-3"})})]})]}),f&&h&&((P=e.children)==null?void 0:P.map(V=>a.jsx(Ra,{node:V,depth:t+1,selectedPath:n,expandedPaths:r,primitiveType:s,onSelect:i,onToggle:o,onContextAction:l,hookCategoryMap:c,agentTeamMap:u,dimmed:d},V.path)))]})}const C5=[{value:"agents",icon:Di,label:"Agents"},{value:"skills",icon:Ut,label:"Skills"},{value:"hooks",icon:Fi,label:"Hooks"}];function Md(e){const t=[];function n(r){for(const s of r)s.type==="file"&&t.push(s),s.children&&n(s.children)}return n(e),t.sort((r,s)=>{var l,c;const i=(l=r.frontmatter)!=null&&l.name?String(r.frontmatter.name):r.name,o=(c=s.frontmatter)!=null&&c.name?String(s.frontmatter.name):s.name;return i.localeCompare(o)})}function E5({tree:e,loading:t,selectedPath:n,type:r,onSelect:s,onRefresh:i,onTabChange:o,activePaths:l,hookCategoryMap:c,agentTeamMap:u}){const[d,f]=m.useState(new Set),[h,p]=m.useState(null),[g,x]=m.useState(null),[b,y]=m.useState(""),[j,w]=m.useState(null),[E,T]=m.useState("");m.useEffect(()=>{n&&requestAnimationFrame(()=>{const L=document.querySelector(`[data-tree-path="${CSS.escape(n)}"]`);L==null||L.scrollIntoView({behavior:"smooth",block:"nearest"})})},[n]);const S=r==="skills"?Md(e):e,{activeFiles:A,inactiveFiles:v}=m.useMemo(()=>{if(!l)return{activeFiles:null,inactiveFiles:null};const L=Md(e),k=[],_=[];for(const $ of L)l.has($.path)?k.push($):_.push($);return{activeFiles:k,inactiveFiles:_}},[e,l]),M=m.useCallback(L=>{f(k=>{const _=new Set(k);return _.has(L)?_.delete(L):_.add(L),_})},[]),N=m.useCallback((L,k)=>{L.preventDefault(),p({node:k,x:L.clientX,y:L.clientY})},[]),O=m.useCallback(()=>{p(null)},[]),P=m.useCallback(L=>{x(L),y(L.name),p(null)},[]),V=m.useCallback(async()=>{if(!g||!b.trim()||b===g.name){x(null);return}const L=g.path.includes("/")?g.path.slice(0,g.path.lastIndexOf("/")):"",k=L?`${L}/${b}`:b;try{if(!(await fetch(`/api/orbital/config/${r}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:g.path,newPath:k})})).ok)throw new Error("Rename failed");i()}catch{}x(null)},[g,b,r,i]),F=m.useCallback(async L=>{p(null);try{if(!(await fetch(`/api/orbital/config/${r}/file?path=${encodeURIComponent(L.path)}`,{method:"DELETE"})).ok)throw new Error("Delete failed");i()}catch{}},[r,i]),R=m.useCallback((L,k)=>{w({kind:L,parent:k}),T(""),p(null)},[]),Y=m.useCallback((L,k)=>{L==="rename"?P(k):L==="delete"?F(k):L==="new-file"?R("file",k.path):L==="new-folder"&&R("folder",k.path)},[P,F,R]),G=m.useCallback(async()=>{if(!j||!E.trim()){w(null);return}const L=j.parent?`${j.parent}/${E}`:E;try{if(j.kind==="folder"){if(!(await fetch(`/api/orbital/config/${r}/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:L})})).ok)throw new Error("Create folder failed")}else if(!(await fetch(`/api/orbital/config/${r}/file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:L,content:""})})).ok)throw new Error("Create file failed");i()}catch{}w(null)},[j,E,r,i]),H=(L,k)=>a.jsx("div",{onContextMenu:_=>N(_,L),children:a.jsx(Ra,{node:L,depth:0,selectedPath:n,expandedPaths:d,primitiveType:r,onSelect:s,onToggle:M,onContextAction:Y,hookCategoryMap:c,agentTeamMap:u,dimmed:k})},L.path);return a.jsxs("div",{className:"flex h-full flex-col",onClick:O,children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2 py-1.5",children:[a.jsx(S5,{value:r,onValueChange:L=>o(L),children:a.jsx(rg,{children:C5.map(({value:L,icon:k,label:_})=>a.jsxs(sg,{value:L,className:"gap-1.5",children:[a.jsx(k,{className:"h-3 w-3"}),_]},L))})}),a.jsx("button",{onClick:()=>R("file",""),className:"rounded p-1 text-muted-foreground hover:bg-surface-light hover:text-foreground transition-colors",title:"New file",children:a.jsx(In,{className:"h-3.5 w-3.5"})})]}),a.jsx(Tt,{className:"flex-1",children:a.jsxs("div",{className:"py-1",children:[t?a.jsx("div",{className:"flex h-20 items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):e.length===0?a.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground/60",children:"No files found"}):A&&v?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 pt-2 pb-1",children:[a.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500/70"}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-emerald-400/80",children:"Active"}),a.jsxs("span",{className:"text-[10px] text-muted-foreground/30",children:["(",A.length,")"]}),a.jsx("div",{className:"flex-1 border-t border-emerald-500/15"})]}),A.length===0?a.jsxs("div",{className:"px-3 py-2 text-[10px] text-muted-foreground/40 italic",children:["No active ",r]}):A.map(L=>H(L)),a.jsxs("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[a.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-muted-foreground/30"}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/40",children:"Inactive"}),a.jsxs("span",{className:"text-[10px] text-muted-foreground/20",children:["(",v.length,")"]}),a.jsx("div",{className:"flex-1 border-t border-border/20"})]}),v.length===0?a.jsxs("div",{className:"px-3 py-2 text-[10px] text-muted-foreground/40 italic",children:["All ",r," are active"]}):v.map(L=>H(L,!0))]}):S.map(L=>a.jsx("div",{onContextMenu:k=>N(k,L),children:a.jsx(Ra,{node:L,depth:0,selectedPath:n,expandedPaths:d,primitiveType:r,onSelect:s,onToggle:M,onContextAction:Y,hookCategoryMap:c,agentTeamMap:u})},L.path)),g&&a.jsx("div",{className:"px-3 py-1",children:a.jsx("input",{autoFocus:!0,value:b,onChange:L=>y(L.target.value),onKeyDown:L=>{L.key==="Enter"&&V(),L.key==="Escape"&&x(null)},onBlur:V,className:"w-full rounded border border-accent-blue/40 bg-surface px-2 py-0.5 text-xs text-foreground outline-none",placeholder:"New name"})}),j&&a.jsx("div",{className:"px-3 py-1",children:a.jsx("input",{autoFocus:!0,value:E,onChange:L=>T(L.target.value),onKeyDown:L=>{L.key==="Enter"&&G(),L.key==="Escape"&&w(null)},onBlur:G,className:"w-full rounded border border-accent-blue/40 bg-surface px-2 py-0.5 text-xs text-foreground outline-none",placeholder:j.kind==="folder"?"Folder name":"File name"})})]})}),h&&Xn.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40",onClick:O}),a.jsxs("div",{className:"fixed z-50 min-w-[140px] rounded border border-border bg-surface shadow-lg",style:{top:h.y,left:h.x},onClick:L=>L.stopPropagation(),children:[a.jsxs("button",{onClick:()=>P(h.node),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-surface-light transition-colors",children:[a.jsx(Dh,{className:"h-3 w-3"}),"Rename"]}),h.node.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>R("file",h.node.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-surface-light transition-colors",children:[a.jsx(Ah,{className:"h-3 w-3"}),"New File"]}),a.jsxs("button",{onClick:()=>R("folder",h.node.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-surface-light transition-colors",children:[a.jsx(Ph,{className:"h-3 w-3"}),"New Folder"]})]}),a.jsx("div",{className:"border-t border-border"}),h.node.type==="file"&&a.jsxs("button",{onClick:()=>F(h.node),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-ask-red hover:bg-surface-light transition-colors",children:[a.jsx(Ii,{className:"h-3 w-3"}),"Delete"]})]})]}),document.body)]})}function T5({filePath:e,content:t,setContent:n,frontmatter:r,setFrontmatterField:s,body:i,setBody:o,dirty:l,saving:c,loading:u,error:d,onSave:f}){const h=m.useCallback(x=>{(x.metaKey||x.ctrlKey)&&x.key==="s"&&(x.preventDefault(),l&&!c&&f())},[l,c,f]);if(m.useEffect(()=>(window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)),[h]),!e)return a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[a.jsx(ia,{className:"h-10 w-10 text-muted-foreground/30"}),a.jsx("p",{className:"text-sm text-muted-foreground/60",children:"Select a file to edit"})]})});if(u)return a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})});const p=Object.keys(r),g=p.length>0;return a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(ia,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate text-xs text-foreground",children:e}),l&&a.jsx(Q,{variant:"warning",className:"shrink-0 text-[10px] px-1 py-0",children:"unsaved"})]}),a.jsxs(fe,{variant:"default",size:"sm",disabled:!l||c,onClick:f,className:"shrink-0",children:[a.jsx(N0,{className:"mr-1.5 h-3.5 w-3.5"}),c?"Saving...":"Save"]})]}),d&&a.jsxs("div",{className:"flex items-center gap-2 border-b border-red-500/20 bg-red-500/10 px-3 py-1.5 text-xs text-ask-red",children:[a.jsx(Ch,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{children:d})]}),g&&a.jsxs("div",{className:"space-y-2 border-b border-border px-3 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xxs font-medium uppercase tracking-wider text-muted-foreground",children:"Frontmatter"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx("div",{className:"grid gap-2",children:p.map(x=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("label",{className:"w-28 shrink-0 text-right text-xxs text-muted-foreground",children:x}),a.jsx("input",{value:r[x]??"",onChange:b=>s(x,b.target.value),className:I("flex-1 rounded border border-border bg-surface px-2 py-1 text-xs text-foreground","outline-none focus:border-accent-blue/50 transition-colors")})]},x))})]}),a.jsxs("div",{className:"flex flex-1 flex-col min-h-0 p-3",children:[g&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("span",{className:"text-xxs font-medium uppercase tracking-wider text-muted-foreground",children:"Content"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx(L5,{value:i,onChange:o,filePath:e})]})]})}const _d="'JetBrains Mono', 'SF Mono', 'Fira Code', monospace";function A5(e){return e?e.endsWith(".sh")?"shell":e.endsWith(".md")?"markdown":e.endsWith(".yml")||e.endsWith(".yaml")?"yaml":e.endsWith(".json")||e.endsWith(".jsonc")?"json":"text":"text"}const me={comment:"#6B7280",keyword:"#e91e63",string:"#00c853",number:"#ffab00",variable:"#40c4ff",heading:"#00bcd4",bold:"#e0e0e0",operator:"#e91e63",key:"#40c4ff",builtin:"#536dfe",link:"#8B5CF6",punctuation:"#6B7280"};function P5(e,t){return t==="text"?[{text:e}]:t==="shell"?_5(e):t==="markdown"?R5(e):t==="yaml"?D5(e):t==="json"?O5(e):[{text:e}]}const M5=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","exit","local","export","readonly","source","set","unset","shift","break","continue","true","false"]);function _5(e){const t=[];if(e.trimStart().startsWith("#"))return[{text:e,color:me.comment,italic:!0}];let r=0;for(;r<e.length;){if(e[r]==="#"&&(r===0||/\s/.test(e[r-1]))){t.push({text:e.slice(r),color:me.comment,italic:!0});break}if(e[r]==='"'){const o=Da(e,r,'"');t.push({text:e.slice(r,o),color:me.string}),r=o;continue}if(e[r]==="'"){const o=Da(e,r,"'");t.push({text:e.slice(r,o),color:me.string}),r=o;continue}if(e[r]==="$"){if(e[r+1]==="{"){const o=e.indexOf("}",r+2),l=o===-1?e.length:o+1;t.push({text:e.slice(r,l),color:me.variable}),r=l}else if(e[r+1]==="(")t.push({text:"$(",color:me.variable}),r+=2;else{const o=e.slice(r).match(/^\$[A-Za-z_]\w*/);o?(t.push({text:o[0],color:me.variable}),r+=o[0].length):(t.push({text:"$",color:me.variable}),r++)}continue}if("|&;><".includes(e[r])){let o=e[r];r+1<e.length&&(e.slice(r,r+2)==="||"||e.slice(r,r+2)==="&&"||e.slice(r,r+2)===">>"||e.slice(r,r+2)==="<<")&&(o=e.slice(r,r+2)),t.push({text:o,color:me.operator}),r+=o.length;continue}const s=e.slice(r).match(/^[A-Za-z_]\w*/);if(s){const o=s[0];M5.has(o)?t.push({text:o,color:me.keyword,bold:!0}):t.push({text:o}),r+=o.length;continue}const i=e.slice(r).match(/^\d+/);if(i){t.push({text:i[0],color:me.number}),r+=i[0].length;continue}t.push({text:e[r]}),r++}return t}function R5(e){const t=e.trimStart();if(t.match(/^(#{1,6})\s/))return[{text:e,color:me.heading,bold:!0}];if(t.startsWith("```"))return[{text:e,color:me.builtin}];if(t.startsWith("<!--"))return[{text:e,color:me.comment,italic:!0}];if(/^(\s*[-*+]|\s*\d+\.)\s/.test(e)){const r=e.match(/^(\s*[-*+\d.]+\s)(.*)$/);if(r)return[{text:r[1],color:me.operator},...Rd(r[2])]}return Rd(e)}function Rd(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="`"){const r=e.indexOf("`",n+1);if(r!==-1){t.push({text:e.slice(n,r+1),color:me.builtin}),n=r+1;continue}}if(e.slice(n,n+2)==="**"){const r=e.indexOf("**",n+2);if(r!==-1){t.push({text:e.slice(n,r+2),color:me.bold,bold:!0}),n=r+2;continue}}if(e[n]==="["){const r=e.slice(n).match(/^\[([^\]]*)\]\(([^)]*)\)/);if(r){t.push({text:`[${r[1]}]`,color:me.heading}),t.push({text:`(${r[2]})`,color:me.link}),n+=r[0].length;continue}}t.push({text:e[n]}),n++}return t}function D5(e){if(e.trimStart().startsWith("#"))return[{text:e,color:me.comment,italic:!0}];const n=e.match(/^(\s*)([\w.-]+)(:)(.*)/);if(n){const r=[{text:n[1]},{text:n[2],color:me.key},{text:n[3],color:me.punctuation}],s=n[4];return s&&r.push(...Dd(s)),r}if(/^\s*-\s/.test(e)){const r=e.match(/^(\s*-\s)(.*)/);if(r)return[{text:r[1],color:me.operator},...Dd(r[2])]}return[{text:e}]}function Dd(e){const t=e.trim();if(!t)return[{text:e}];if(/^["']/.test(t))return[{text:e,color:me.string}];if(/^(true|false|null|yes|no)$/i.test(t))return[{text:e,color:me.keyword}];if(/^-?\d+(\.\d+)?$/.test(t))return[{text:e,color:me.number}];if(t.startsWith("#"))return[{text:e,color:me.comment,italic:!0}];const n=e.indexOf(" #");return n!==-1?[{text:e.slice(0,n)},{text:e.slice(n),color:me.comment,italic:!0}]:[{text:e,color:me.string}]}function O5(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const i=Da(e,n,'"'),o=e.slice(n,i),c=e.slice(i).trimStart().startsWith(":")?me.key:me.string;t.push({text:o,color:c}),n=i;continue}const r=e.slice(n).match(/^-?\d+(\.\d+)?([eE][+-]?\d+)?/);if(r){t.push({text:r[0],color:me.number}),n+=r[0].length;continue}const s=e.slice(n).match(/^(true|false|null)\b/);if(s){t.push({text:s[0],color:me.keyword}),n+=s[0].length;continue}if("{}[]:,".includes(e[n])){t.push({text:e[n],color:me.punctuation}),n++;continue}t.push({text:e[n]}),n++}return t}function Da(e,t,n){let r=t+1;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]===n)return r+1;r++}return e.length}function L5({value:e,onChange:t,filePath:n}){const r=m.useRef(null),s=m.useRef(null),i=m.useRef(null),o=m.useMemo(()=>A5(n),[n]),l=m.useMemo(()=>e.split(`
414
+ `),[e]),c=m.useMemo(()=>l.map(f=>P5(f,o)),[l,o]),u=m.useCallback(()=>{const f=r.current;s.current&&(s.current.scrollTop=(f==null?void 0:f.scrollTop)??0),i.current&&(i.current.scrollTop=(f==null?void 0:f.scrollTop)??0,i.current.scrollLeft=(f==null?void 0:f.scrollLeft)??0)},[]),d={fontFamily:_d,fontSize:"12px",lineHeight:"1.625",padding:"12px",tabSize:2};return a.jsxs("div",{className:"flex flex-1 overflow-hidden rounded border border-border bg-surface transition-colors focus-within:border-accent-blue/50",style:{fontFamily:_d},children:[a.jsx("div",{ref:s,"aria-hidden":!0,className:"select-none overflow-hidden border-r border-border py-3 pl-2 pr-3 text-right text-muted-foreground/40",style:{fontSize:"12px",lineHeight:"1.625"},children:l.map((f,h)=>a.jsx("div",{children:h+1},h))}),a.jsxs("div",{className:"relative flex-1 min-w-0 overflow-hidden",children:[a.jsx("pre",{ref:i,"aria-hidden":!0,className:"absolute inset-0 overflow-hidden whitespace-pre pointer-events-none m-0",style:d,children:c.map((f,h)=>a.jsx("div",{children:f.length===0?" ":f.map((p,g)=>a.jsx("span",{style:{color:p.color,fontWeight:p.bold?600:void 0,fontStyle:p.italic?"italic":void 0},children:p.text},g))},h))}),a.jsx("textarea",{ref:r,value:e,onChange:f=>t(f.target.value),onScroll:u,className:"relative z-10 w-full h-full resize-none bg-transparent outline-none",style:{...d,color:"transparent",caretColor:"hsl(0 0% 88%)",WebkitTextFillColor:"transparent"},spellCheck:!1})]})]})}function ai(e){const[t,n]=m.useState([]),[r,s]=m.useState(!0),i=m.useCallback(async()=>{try{const o=await fetch(`/api/orbital/config/${e}/tree`);if(!o.ok)throw new Error(`HTTP ${o.status}`);const l=await o.json();n(l.data??[])}catch{n([])}finally{s(!1)}},[e]);return m.useEffect(()=>{s(!0),i()},[i]),jn(i),m.useEffect(()=>{const o=`config:${e}:changed`,l=()=>{i()},c=o;return Z.on(c,l),()=>{Z.off(c,l)}},[e,i]),{tree:t,loading:r,refresh:i}}function og(e){const t=new Set;for(const n of e)if(n.type==="file"&&t.add(n.path),n.children)for(const r of og(n.children))t.add(r);return t}function Oa(e){const t=new Map;for(const n of e){if(n.type==="file"){const r=n.path.split("/");if(r.length>=2){const i=r[r.length-2].toLowerCase();t.has(i)||t.set(i,n.path)}const s=n.name.replace(/\.(md|sh)$/,"").toLowerCase();t.has(s)||t.set(s,n.path)}if(n.children){const r=Oa(n.children);for(const[s,i]of r)t.has(s)||t.set(s,i)}}return t}function Od(e){return e?e.replace(/^\//,"").replace(/\s+\{.*\}$/,"").toLowerCase():null}function Vo(e,t){return{id:e.id,label:e.label,category:e.category,enforcement:ep(e),filePath:t.get(e.id)??null,timing:e.timing,blocking:e.blocking??!1,description:e.description}}function ag(e){const{engine:t}=wt(),{tree:n}=ai("skills"),{tree:r}=ai("hooks"),{tree:s}=ai("agents");return m.useMemo(()=>{var L,k;const i=e?new tp(e):t,o=i.getLists(),l=i.getAllEdges(),c=i.getAllHooks(),u=Oa(n),d=Oa(s),f=og(r),h=".claude/hooks/",p=new Map;for(const _ of c){const $=_.target.startsWith(h)?_.target.slice(h.length):_.target;f.has($)&&p.set(_.id,$)}const g=new Map(c.map(_=>[_.id,_])),x=o.map(_=>_.id),b=new Map;for(const _ of o){const $=new Set(_.activeHooks??[]);for(const C of $)b.set(C,(b.get(C)??0)+1)}const y=new Map;for(const _ of x)y.set(_,new Set);for(const _ of l)for(const $ of _.hooks??[])(L=y.get(_.from))==null||L.add($),(k=y.get(_.to))==null||k.add($);for(const[,_]of y)for(const $ of _)b.set($,(b.get($)??0)+1);const j=Math.max(1,x.length-1),w=new Set;for(const[_,$]of b)$>=j&&w.add(_);const E=[];for(const _ of w){const $=g.get(_);$&&E.push(Vo($,p))}const T={guard:0,gate:1,lifecycle:2,observer:3};E.sort((_,$)=>T[_.category]-T[$.category]);const S=new Map,A=new Map;function v(_){var $,C;for(const re of _){if(re.type==="file"&&(($=re.frontmatter)!=null&&$["agent-mode"]&&S.set(re.path,String(re.frontmatter["agent-mode"])),Array.isArray((C=re.frontmatter)==null?void 0:C.orchestrates))){const Te=re.frontmatter.orchestrates.filter(K=>typeof K=="string");Te.length>0&&A.set(re.path,Te)}re.children&&v(re.children)}}v(n);function M(_){const $=u.get(_);return $?S.get($):void 0}const N=new Map;for(const[_,$]of u){const C=A.get($);C&&N.set(_,C)}function O(_,$){var Te;const C=$?$.path:d.get(_.toLowerCase())??null,re=(Te=$==null?void 0:$.frontmatter)!=null&&Te.name?String($.frontmatter.name):_.split("-").map(K=>K.charAt(0).toUpperCase()+K.slice(1)).join(" ");return{id:_,label:re,emoji:sk[_]??"",color:ik[_]??"",filePath:C}}const P={"red-team":"#ef4444","blue-team":"#3b82f6","green-team":"#22c55e"},V=new Set(["reference","workflows"]),F=[];function R(_,$){var C;for(const re of _)if(re.type==="folder")!V.has(re.name.toLowerCase())&&re.children&&R(re.children,re.name);else if($&&re.name.endsWith(".md")&&((C=re.frontmatter)!=null&&C.name)){const Te=re.name.replace(/\.md$/,"").toLowerCase(),K=O(Te,re);K.team=$,K.color=P[$.toLowerCase()]??(K.color||"#8B5CF6"),F.push(K)}}R(s,null),F.sort((_,$)=>_.team!==$.team?(_.team??"").localeCompare($.team??""):_.label.localeCompare($.label));const Y=new Map,G=new Map;for(const _ of l)Y.has(_.from)||Y.set(_.from,[]),Y.get(_.from).push(_),G.has(_.to)||G.set(_.to,[]),G.get(_.to).push(_);const H=o.map(_=>{const $=new Set;for(const U of _.activeHooks??[])w.has(U)||$.add(U);for(const U of Y.get(_.id)??[])for(const ke of U.hooks??[])w.has(ke)||$.add(ke);const C=[];for(const U of $){const ke=g.get(U);ke&&C.push(Vo(ke,p))}C.sort((U,ke)=>T[U.category]-T[ke.category]);const re=[],Te=G.get(_.id)??[],K=new Map;for(const U of Te){const ke=Od(U.command);if(!ke||M(ke)!=="team-review")continue;const ht=U.command??U.label;K.has(ht)||K.set(ht,{skillCommand:ht,skillPath:u.get(ke)??null,agents:[...F]})}const qe=[...K.values()],He=(Y.get(_.id)??[]).filter(U=>U.direction==="forward"||U.direction==="shortcut").map(U=>{const ke=Od(U.command),ht=(U.hooks??[]).filter(De=>!w.has(De)).map(De=>g.get(De)).filter(De=>De!==void 0).map(De=>Vo(De,p));return{edge:U,skillPath:ke?u.get(ke)??null:null,edgeHooks:ht}}),et=(Y.get(_.id)??[]).filter(U=>U.direction==="backward");return{list:_,stageHooks:C,alwaysOnAgents:re,reviewTeams:qe,forwardEdges:He,backwardEdges:et}});return{globalHooks:E,stages:H,skillPathMap:u,hookPathMap:p,agentPathMap:d,orchestratesMap:N}},[e,t,n,r,s])}function Ld({agent:e,mode:t,selected:n,onClick:r,onRemove:s}){const i=e.color||"#8B5CF6";return a.jsxs("button",{type:"button",onClick:r,"data-pipeline-path":e.filePath??void 0,className:I("inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors","hover:brightness-125 cursor-pointer",n&&"glow-selected-pulse"),style:{color:i,borderColor:`${i}4D`,backgroundColor:`${i}1A`,...n?{"--glow-color":`${i}A0`,"--glow-color-wide":`${i}40`}:{}},children:[e.emoji?a.jsx("span",{className:"text-xs",children:e.emoji}):a.jsx(Di,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"truncate max-w-[100px]",children:e.label}),t==="always-on"&&a.jsx("span",{className:"ml-0.5 h-1.5 w-1.5 rounded-full bg-green-500 shrink-0",title:"Auto-invoke"}),s&&a.jsx("span",{role:"button",onClick:o=>{o.stopPropagation(),s()},className:"ml-0.5 rounded-full p-0.5 hover:bg-red-500/20",children:a.jsx(mt,{className:"h-2.5 w-2.5"})})]})}function I5({hook:e,dragId:t,selected:n,onClick:r,onRemove:s,editable:i}){const{attributes:o,listeners:l,setNodeRef:c,isDragging:u}=wr({id:t,disabled:!i,data:{hookId:e.id}});return a.jsx("div",{ref:c,className:I("cursor-pointer",u&&"opacity-40"),onClick:r,...l,...o,children:a.jsx(nc,{hook:e,selected:n,onRemove:s})})}function F5({stage:e,selectedPath:t,onSelectItem:n,editable:r,onRemoveHook:s}){const{list:i,stageHooks:o,alwaysOnAgents:l,reviewTeams:c}=e,[u,d]=m.useState(!0),[f,h]=m.useState(!0),p=o.length>0,g=l.length>0||c.length>0,x=p||r,b=`drop::stage-hooks::${i.id}`,{setNodeRef:y,isOver:j}=Bn({id:b,disabled:!r});return a.jsxs(Me,{className:"overflow-hidden border-border/60",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("div",{className:"h-3 w-3 shrink-0 rounded-full",style:{backgroundColor:i.hex}}),a.jsx("span",{className:"text-xs font-semibold text-foreground uppercase tracking-wide",children:i.label}),a.jsx("span",{className:"text-[10px] text-muted-foreground/40 font-mono",children:i.id}),a.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[i.isEntryPoint&&a.jsxs(Q,{variant:"outline",className:"text-[9px] gap-0.5 px-1 py-0 border-amber-500/30 text-amber-400",children:[a.jsx(L0,{className:"h-2.5 w-2.5"})," entry"]}),i.gitBranch&&a.jsxs(Q,{variant:"outline",className:"text-[9px] gap-0.5 px-1 py-0 border-green-500/30 text-green-400",children:[a.jsx(xn,{className:"h-2.5 w-2.5"})," ",i.gitBranch]}),i.supportsBatch&&a.jsxs(Q,{variant:"outline",className:"text-[9px] gap-0.5 px-1 py-0 border-cyan-500/30 text-cyan-400",children:[a.jsx(ol,{className:"h-2.5 w-2.5"})," batch"]}),i.supportsSprint&&a.jsxs(Q,{variant:"outline",className:"text-[9px] gap-0.5 px-1 py-0 border-indigo-500/30 text-indigo-400",children:[a.jsx(B0,{className:"h-2.5 w-2.5"})," sprint"]})]})]}),x&&a.jsxs("div",{className:"border-t border-border/40",children:[a.jsxs("button",{type:"button",onClick:()=>d(!u),className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors",children:[u?a.jsx(gn,{className:"h-3 w-3"}):a.jsx(Zt,{className:"h-3 w-3"}),a.jsx(Fi,{className:"h-3 w-3"}),"Stage Hooks",a.jsxs("span",{className:"text-muted-foreground/50",children:["(",o.length,")"]})]}),u&&a.jsxs("div",{ref:y,className:I("flex flex-wrap gap-1 px-3 pb-2 min-h-[28px]",r&&"border border-dashed border-transparent rounded-md mx-2 mb-1 p-1",j&&"border-accent-blue bg-accent-blue/10"),children:[o.map(w=>a.jsx(I5,{hook:w,dragId:`pipeline::stage-hook::${i.id}::${w.id}`,selected:w.filePath!=null&&w.filePath===t,onClick:()=>w.filePath&&n("hooks",w.filePath),onRemove:r&&s?()=>s(i.id,w.id):void 0,editable:r},w.id)),r&&o.length===0&&a.jsx("span",{className:"text-[9px] text-muted-foreground/40 italic py-0.5",children:"drop hooks here"})]})]}),g&&a.jsxs("div",{className:"border-t border-border/40",children:[a.jsxs("button",{type:"button",onClick:()=>h(!f),className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors",children:[f?a.jsx(gn,{className:"h-3 w-3"}):a.jsx(Zt,{className:"h-3 w-3"}),a.jsx(Di,{className:"h-3 w-3"}),"Agents",a.jsxs("span",{className:"text-muted-foreground/50",children:["(",l.length+c.reduce((w,E)=>w+E.agents.length,0),")"]})]}),f&&a.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[l.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[9px] uppercase tracking-wider text-muted-foreground/50 mb-1",children:"Always-On"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(w=>a.jsx(Ld,{agent:w,mode:"always-on",selected:w.filePath!=null&&w.filePath===t,onClick:()=>w.filePath&&n("agents",w.filePath)},w.id))})]}),c.map(w=>a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center gap-1 text-[9px] uppercase tracking-wider text-muted-foreground/50 mb-1",children:a.jsxs("span",{children:[w.skillCommand," team:"]})}),a.jsx("div",{className:"flex flex-wrap gap-1",children:w.agents.map(E=>a.jsx(Ld,{agent:E,mode:"review",selected:E.filePath!=null&&E.filePath===t,onClick:()=>E.filePath&&n("agents",E.filePath)},E.id))})]},w.skillCommand))]})]}),!x&&!g&&a.jsx("div",{className:"border-t border-border/40 px-3 py-2",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/40 italic",children:"No stage-specific hooks or agents"})})]})}function B5({hook:e,dragId:t,selected:n,onClick:r,onRemove:s,editable:i}){const{attributes:o,listeners:l,setNodeRef:c,isDragging:u}=wr({id:t,disabled:!i,data:{hookId:e.id}});return a.jsx("div",{ref:c,className:I("cursor-pointer",u&&"opacity-40"),onClick:r,...l,...o,children:a.jsx(nc,{hook:e,selected:n,onRemove:s})})}const La={forward:{arrow:"text-green-500",label:"text-green-400",border:"border-green-500/20",bg:"bg-green-500/5"},backward:{arrow:"text-amber-500",label:"text-amber-400",border:"border-amber-500/20",bg:"bg-amber-500/5"},shortcut:{arrow:"text-indigo-500",label:"text-indigo-400",border:"border-indigo-500/20",bg:"bg-indigo-500/5"}};function z5({edgeData:e,selectedPath:t,onSelectItem:n,editable:r,onRemoveHook:s}){const{edge:i,skillPath:o,edgeHooks:l}=e,c=La[i.direction]??La.forward,u=`drop::edge-skill::${i.from}:${i.to}`,{setNodeRef:d,isOver:f}=Bn({id:u,disabled:!r}),h=`drop::edge-hooks::${i.from}:${i.to}`,{setNodeRef:p,isOver:g}=Bn({id:h,disabled:!r}),x=i.direction==="shortcut"?"SHORTCUT":"DEFAULT";return a.jsxs("div",{className:I("flex items-center rounded-lg border overflow-hidden",c.border,"bg-card"),children:[a.jsx("div",{className:I("shrink-0 self-stretch flex items-center px-2.5",c.bg),children:a.jsx("span",{className:I("text-[9px] font-semibold uppercase tracking-wider whitespace-nowrap",c.label),children:x})}),a.jsxs("div",{className:"flex items-center flex-1 min-w-0 border-l",style:{borderColor:"inherit"},children:[a.jsx("div",{ref:d,className:I("flex items-center gap-1.5 px-2 py-1 shrink-0",f&&"bg-green-500/10"),children:i.command?a.jsxs("button",{type:"button",onClick:()=>o&&n("skills",o),"data-pipeline-path":o??void 0,className:I("inline-flex items-center gap-1 text-[11px] font-semibold transition-colors whitespace-nowrap rounded-md px-1 -mx-1",c.label,o&&"hover:brightness-125 cursor-pointer",!o&&"cursor-default opacity-60",o!=null&&o===t&&"glow-selected-pulse"),style:o!=null&&o===t?{"--glow-color":"#22c55eA0","--glow-color-wide":"#22c55e40"}:void 0,children:[a.jsx(Ut,{className:"h-3 w-3 shrink-0"}),i.command.replace(/\s+\{.*\}$/,"")]}):a.jsx("span",{className:I("text-[10px] text-muted-foreground/40 italic whitespace-nowrap",r&&"border border-dashed border-muted-foreground/20 rounded px-1.5 py-0.5"),children:r?"drop skill":"no skill"})}),a.jsx("div",{className:I("w-px self-stretch",c.border.replace("border-","bg-"))}),a.jsxs("div",{ref:p,className:I("flex items-center gap-1 px-2 py-1 flex-1 min-w-0",g&&"bg-[#00bcd4]/10"),children:[a.jsx(Fi,{className:"h-3 w-3 shrink-0 text-muted-foreground/30"}),l.map(b=>a.jsx(B5,{hook:b,dragId:`pipeline::edge-hook::${i.from}:${i.to}::${b.id}`,selected:b.filePath!=null&&b.filePath===t,onClick:()=>b.filePath&&n("hooks",b.filePath),onRemove:r&&s?()=>s(i.from,i.to,b.id):void 0,editable:r},b.id)),l.length===0&&a.jsx("span",{className:I("text-[10px] text-muted-foreground/40 italic",r&&"border border-dashed border-muted-foreground/20 rounded px-1.5 py-0.5"),children:r?"drop hooks":"none"})]})]})]})}function V5({edges:e,selectedPath:t,onSelectItem:n,editable:r,onRemoveHook:s}){if(e.length===0)return null;const i=La.forward.arrow;return a.jsxs("div",{className:"flex flex-col items-center py-1",children:[a.jsx(di,{className:I("h-7 w-4",i)}),a.jsx("div",{className:"flex w-full flex-wrap justify-center gap-1 px-1 my-0.5",children:e.map(o=>a.jsx(z5,{edgeData:o,selectedPath:t,onSelectItem:n,editable:r,onRemoveHook:s},`${o.edge.from}:${o.edge.to}`))}),a.jsx(di,{className:I("h-7 w-4",i)})]})}function $5({hook:e,dragId:t,selected:n,onClick:r,onRemove:s,editable:i}){const{attributes:o,listeners:l,setNodeRef:c,isDragging:u}=wr({id:t,disabled:!i,data:{hookId:e.id}});return a.jsx("div",{ref:c,className:I("cursor-pointer",u&&"opacity-40"),onClick:r,...l,...o,children:a.jsx(nc,{hook:e,selected:n,onRemove:s})})}function H5({selectedPath:e,onSelectItem:t,editConfig:n,editable:r,onRemoveEdgeHook:s,onRemoveStageHook:i,onRemoveGlobalHook:o}){const l=ag(n),[c,u]=m.useState(!1);m.useEffect(()=>{e&&requestAnimationFrame(()=>{const g=document.querySelector(`[data-pipeline-path="${CSS.escape(e)}"]`);g==null||g.scrollIntoView({behavior:"smooth",block:"nearest"})})},[e]);const d=l.stages.flatMap(g=>g.backwardEdges),f=new Set([...l.globalHooks.map(g=>g.id),...l.stages.flatMap(g=>g.stageHooks.map(x=>x.id))]).size,h=new Set(l.stages.flatMap(g=>g.forwardEdges.filter(x=>x.edge.command).map(x=>x.edge.command))).size,p=new Set([...l.stages.flatMap(g=>g.alwaysOnAgents.map(x=>x.id)),...l.stages.flatMap(g=>g.reviewTeams.flatMap(x=>x.agents.map(b=>b.id)))]).size;return a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[a.jsx("span",{className:"text-xxs font-medium uppercase tracking-wider text-muted-foreground",children:"Workflow Pipeline"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs(Q,{variant:"secondary",className:"text-[10px]",children:[l.stages.length," stages"]}),h>0&&a.jsxs(Q,{variant:"secondary",className:"text-[10px]",children:[h," skills"]}),f>0&&a.jsxs(Q,{variant:"secondary",className:"text-[10px]",children:[f," hooks"]}),p>0&&a.jsxs(Q,{variant:"secondary",className:"text-[10px]",children:[p," agents"]})]})]}),a.jsx(Tt,{className:"flex-1",children:a.jsxs("div",{className:"p-3 space-y-0",children:[l.globalHooks.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs(Me,{className:"overflow-hidden border-border/60",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{className:"text-sm",children:"🌐"}),a.jsx("span",{className:"text-xs font-semibold text-foreground uppercase tracking-wide",children:"Global Hooks"}),a.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:"active in all stages"})]}),a.jsx("div",{className:"border-t border-border/40",children:a.jsx("div",{className:"flex flex-wrap gap-1 px-3 py-2",children:l.globalHooks.map(g=>a.jsx($5,{hook:g,dragId:`pipeline::global-hook::${g.id}`,selected:g.filePath!=null&&g.filePath===e,onClick:()=>g.filePath&&t("hooks",g.filePath),onRemove:r&&o?()=>o(g.id):void 0,editable:r},g.id))})})]}),a.jsxs("div",{className:"flex items-center gap-2 py-2 px-4",children:[a.jsx("div",{className:"flex-1 border-t border-border/40"}),a.jsx("span",{className:"text-[9px] text-muted-foreground/30 uppercase tracking-wider",children:"stages"}),a.jsx("div",{className:"flex-1 border-t border-border/40"})]})]}),l.stages.map((g,x)=>a.jsxs("div",{children:[a.jsx(F5,{stage:g,selectedPath:e,onSelectItem:t,editable:r,onRemoveHook:i}),g.forwardEdges.length>0&&a.jsx(V5,{edges:g.forwardEdges,selectedPath:e,onSelectItem:t,editable:r,onRemoveHook:s}),g.forwardEdges.length===0&&x<l.stages.length-1&&a.jsx("div",{className:"h-2"})]},g.list.id)),d.length>0&&a.jsxs("div",{className:"mt-3 border-t border-border/30 pt-2",children:[a.jsxs("button",{type:"button",onClick:()=>u(!c),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[10px] font-medium text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[c?a.jsx(gn,{className:"h-3 w-3"}):a.jsx(Zt,{className:"h-3 w-3"}),a.jsx(Uc,{className:"h-3 w-3"}),d.length," rework paths"]}),c&&a.jsx("div",{className:"space-y-1 px-2 pt-1",children:d.map(g=>a.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground/70 py-0.5",children:[a.jsx(Uc,{className:"h-2.5 w-2.5 text-amber-500/50"}),a.jsx("span",{className:"font-mono",children:g.from}),a.jsx("span",{className:"text-muted-foreground/30",children:"→"}),a.jsx("span",{className:"font-mono",children:g.to}),a.jsx("span",{className:"text-muted-foreground/40 truncate",children:g.label})]},`${g.from}:${g.to}`))})]}),a.jsx("div",{className:"mt-4 px-2 text-center",children:a.jsx("span",{className:"text-[9px] text-muted-foreground/30",children:r?"Drag items from the tree onto stages or edges":"Click any hook, agent, or skill to open in editor"})})]})})]})}function U5(e){const[t,n]=m.useState({past:[],present:structuredClone(e),future:[]}),r=m.useCallback(c=>{n(u=>({past:[...u.past,u.present].slice(-50),present:c,future:[]}))},[]),s=m.useCallback(()=>{n(c=>{if(c.past.length===0)return c;const u=[...c.past],d=u.pop();return{past:u,present:d,future:[c.present,...c.future]}})},[]),i=m.useCallback(()=>{n(c=>{if(c.future.length===0)return c;const u=[...c.future],d=u.shift();return{past:[...c.past,c.present],present:d,future:u}})},[]),o=m.useCallback(c=>{n({past:[],present:structuredClone(c),future:[]})},[]),l=m.useMemo(()=>t.past.length,[t.past.length]);return{present:t.present,canUndo:t.past.length>0,canRedo:t.future.length>0,changeCount:l,pushState:r,undo:s,redo:i,reset:o}}function W5(e){const t=[];if(!Zh(e))return t.push("Invalid config shape: must have version=1, name, lists[], edges[]"),{valid:!1,errors:t};e.branchingMode!==void 0&&e.branchingMode!=="trunk"&&e.branchingMode!=="worktree"&&t.push(`Invalid branchingMode: "${e.branchingMode}" (must be "trunk" or "worktree")`);const n=new Set;for(const i of e.lists)n.has(i.id)&&t.push(`Duplicate list ID: "${i.id}"`),n.add(i.id);const r=new Set;for(const i of e.edges){n.has(i.from)||t.push(`Edge references unknown list: from="${i.from}"`),n.has(i.to)||t.push(`Edge references unknown list: to="${i.to}"`),i.from===i.to&&t.push(`Self-referencing edge: "${i.from}" → "${i.to}"`);const o=`${i.from}:${i.to}`;r.has(o)&&t.push(`Duplicate edge: ${o}`),r.add(o)}const s=e.lists.filter(i=>i.isEntryPoint);if(s.length===0&&t.push("No entry point defined (isEntryPoint=true)"),s.length>1&&t.push(`Multiple entry points: ${s.map(i=>i.id).join(", ")}`),s.length===1&&t.length===0){const i=new Set(e.terminalStatuses??[]),o=new Set,l=[s[0].id];for(;l.length>0;){const c=l.shift();if(!o.has(c)){o.add(c);for(const u of e.edges)u.from===c&&!o.has(u.to)&&l.push(u.to)}}for(const c of e.lists)!i.has(c.id)&&!o.has(c.id)&&t.push(`List "${c.id}" is not reachable from entry point`)}return{valid:t.length===0,errors:t}}function q5(e){const[t,n]=m.useState(!1),[r,s]=m.useState(!1),[i,o]=m.useState(null),[l,c]=m.useState(!1),[u,d]=m.useState(null),[f,h]=m.useState(!1),[p,g]=m.useState(!1),[x,b]=m.useState(!1),[y,j]=m.useState(!1),w=U5(e),E=m.useMemo(()=>W5(w.present),[w.present]),T=m.useCallback(()=>{w.reset(e),n(!0)},[e,w]),S=m.useCallback(()=>{n(!1),h(!1),g(!1),b(!1),j(!1)},[]),A=m.useCallback(()=>{w.reset(e),S()},[e,w,S]),v=m.useCallback(H=>{const L=structuredClone(w.present);L.lists.push(H),w.pushState(L)},[w]),M=m.useCallback((H,L)=>{const k=structuredClone(w.present),_=k.lists.findIndex($=>$.id===H.id);if(_!==-1){if(H.id!==L.id)for(const $ of k.edges)$.from===H.id&&($.from=L.id),$.to===H.id&&($.to=L.id);k.lists[_]=L,w.pushState(k)}},[w]),N=m.useCallback(H=>{const L=structuredClone(w.present);L.lists=L.lists.filter(k=>k.id!==H),L.edges=L.edges.filter(k=>k.from!==H&&k.to!==H),w.pushState(L)},[w]),O=m.useCallback(H=>{const L=structuredClone(w.present);L.edges.push(H),w.pushState(L)},[w]),P=m.useCallback(H=>{w.pushState(structuredClone(H))},[w]),V=m.useCallback((H,L)=>{const k=structuredClone(w.present),_=`${H.from}:${H.to}`,$=k.edges.findIndex(C=>`${C.from}:${C.to}`===_);$!==-1&&(k.edges[$]=L,w.pushState(k))},[w]),F=m.useCallback((H,L)=>{const k=structuredClone(w.present);k.edges=k.edges.filter(_=>!(_.from===H&&_.to===L)),w.pushState(k)},[w]),R=m.useCallback(async()=>{if(!(!E.valid||r)){s(!0);try{const L=await(await fetch("/api/orbital/workflow",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w.present)})).json();if(!L.success)throw new Error(L.error??"Save failed");S()}catch(H){d(H instanceof Error?H.message:"Save failed")}finally{s(!1)}}},[E.valid,r,w.present,S]),Y=m.useCallback(async()=>{c(!0),d(null),o(null),h(!0);try{const L=await(await fetch("/api/orbital/workflow/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w.present)})).json();if(!L.success)throw new Error(L.error??"Preview failed");o(L.data??null)}catch(H){d(H instanceof Error?H.message:"Preview failed")}finally{c(!1)}},[w.present]),G=m.useCallback(async H=>{s(!0);try{const k=await(await fetch("/api/orbital/workflow/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:w.present,orphanMappings:H})})).json();if(!k.success)throw new Error(k.error??"Migration failed");h(!1),S()}catch(L){d(L instanceof Error?L.message:"Migration failed")}finally{s(!1)}},[w.present,S]);return{editMode:t,editConfig:w.present,canUndo:w.canUndo,canRedo:w.canRedo,changeCount:w.changeCount,validation:E,saving:r,previewPlan:i,previewLoading:l,previewError:u,showPreview:f,showAddList:p,showAddEdge:x,showConfigSettings:y,enterEditMode:T,exitEditMode:S,undo:w.undo,redo:w.redo,updateList:M,deleteList:N,addList:v,updateEdge:V,deleteEdge:F,addEdge:O,updateConfig:P,save:R,discard:A,preview:Y,applyMigration:G,setShowPreview:h,setShowAddList:g,setShowAddEdge:b,setShowConfigSettings:j}}function Id(e){const t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);if(!t)return{fields:{},body:e};const n={};for(const r of t[1].split(`
415
+ `)){const s=r.indexOf(":");if(s>0){const i=r.slice(0,s).trim(),o=r.slice(s+1).trim();n[i]=o}}return{fields:n,body:t[2]}}function G5(e,t){const n=Object.entries(e).filter(([,s])=>s!=="");return n.length===0?t:`---
416
+ ${n.map(([s,i])=>`${s}: ${i}`).join(`
417
+ `)}
418
+ ---
419
+ ${t}`}function K5(e,t){const[n,r]=m.useState(""),[s,i]=m.useState(""),[o,l]=m.useState({}),[c,u]=m.useState(""),[d,f]=m.useState(!1),[h,p]=m.useState(!1),[g,x]=m.useState(null),b=m.useRef(0);m.useEffect(()=>{if(!e||!t){r(""),i(""),l({}),u(""),x(null);return}const A=++b.current;f(!0),x(null),fetch(`/api/orbital/config/${e}/file?path=${encodeURIComponent(t)}`).then(async v=>{var P;if(!v.ok)throw new Error(`HTTP ${v.status}`);const M=await v.json();if(A!==b.current)return;const N=((P=M.data)==null?void 0:P.content)??"";r(N),i(N);const O=Id(N);l(O.fields),u(O.body)}).catch(v=>{A===b.current&&x(v instanceof Error?v.message:"Failed to load file")}).finally(()=>{A===b.current&&f(!1)})},[e,t]);const y=m.useCallback((A,v)=>{const M=G5(A,v);r(M)},[]),j=m.useCallback((A,v)=>{l(M=>{const N={...M,[A]:v};return u(O=>(y(N,O),O)),N})},[y]),w=m.useCallback(A=>{u(A),l(v=>(y(v,A),v))},[y]),E=m.useCallback(A=>{r(A);const v=Id(A);l(v.fields),u(v.body)},[]),T=m.useCallback(async()=>{if(!(!e||!t)){p(!0),x(null);try{const A=await fetch(`/api/orbital/config/${e}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,content:n})});if(!A.ok){const v=await A.json().catch(()=>({error:"Save failed"}));throw new Error(v.error??`HTTP ${A.status}`)}i(n)}catch(A){x(A instanceof Error?A.message:"Save failed")}finally{p(!1)}}},[e,t,n]);return{content:n,setContent:E,frontmatter:o,setFrontmatterField:j,body:c,setBody:w,dirty:n!==s,saving:h,loading:d,save:T,error:g}}function Y5(e){const t=e.split("/"),n=t[t.length-1];return t.length>=2&&/^(SKILL|AGENT)\.md$/i.test(n)?t[t.length-2].toLowerCase():n.replace(/\.(md|sh)$/,"").toLowerCase()}function X5(){const[e,t]=m.useState("agents"),[n,r]=m.useState(null),[s,i]=m.useState(null),{tree:o,loading:l,refresh:c}=ai(e),u=(n==null?void 0:n.type)??null,d=(n==null?void 0:n.path)??null,{content:f,setContent:h,frontmatter:p,setFrontmatterField:g,body:x,setBody:b,dirty:y,saving:j,loading:w,save:E,error:T}=K5(u,d),{engine:S}=wt(),A=S.getConfig(),v=q5(A),M=yp(ga(Wi,{activationConstraint:{distance:8}})),N=$p(),O=m.useCallback(ne=>{t(ne),r(null)},[]),P=m.useCallback(ne=>{ne.type==="file"&&r({type:e,path:ne.path})},[e]),V=m.useCallback((ne,ie)=>{t(ne),r({type:ne,path:ie})},[]),F=m.useCallback((ne,ie,ce)=>{v.editMode||v.enterEditMode();const ue=v.editConfig.edges.find(xe=>xe.from===ne&&xe.to===ie);ue&&v.updateEdge(ue,{...ue,hooks:(ue.hooks??[]).filter(xe=>xe!==ce)})},[v]),R=m.useCallback((ne,ie)=>{v.editMode||v.enterEditMode();const ce=v.editConfig.lists.find(ue=>ue.id===ne);ce&&v.updateList(ce,{...ce,activeHooks:(ce.activeHooks??[]).filter(ue=>ue!==ie)})},[v]),Y=m.useCallback(ne=>{var ce,ue;v.editMode||v.enterEditMode();const ie=structuredClone(v.editMode?v.editConfig:A);for(const xe of ie.lists)(ce=xe.activeHooks)!=null&&ce.includes(ne)&&(xe.activeHooks=xe.activeHooks.filter(ve=>ve!==ne));for(const xe of ie.edges)(ue=xe.hooks)!=null&&ue.includes(ne)&&(xe.hooks=xe.hooks.filter(ve=>ve!==ne));v.updateConfig(ie)},[v,A]),G=v.editMode?v.editConfig:void 0,H=ag(G),L=m.useMemo(()=>{const ne=new Map;for(const[ie,ce]of H.hookPathMap)ne.set(ce,ie);return ne},[H.hookPathMap]),k=m.useCallback(ne=>{if(String(ne.active.id).startsWith("pipeline::")){const ue=ne.active.data.current;i({type:"pipeline",name:(ue==null?void 0:ue.hookId)??"hook"});return}const ce=ne.active.data.current;ce!=null&&ce.type&&(ce!=null&&ce.name)&&i({type:ce.type,name:ce.name})},[]),_=m.useCallback(ne=>{var B,W;i(null);const{active:ie,over:ce}=ne;if(!ce)return;const ue=String(ie.id),xe=String(ce.id);if(xe==="drop::remove"){const X=ue.match(/^pipeline::edge-hook::(.+?):(.+?)::(.+)$/);if(X){const[,Ae,Oe,At]=X;F(Ae,Oe,At);return}const oe=ue.match(/^pipeline::stage-hook::(.+?)::(.+)$/);if(oe){const[,Ae,Oe]=oe;R(Ae,Oe);return}const he=ue.match(/^pipeline::global-hook::(.+)$/);if(he){const[,Ae]=he;Y(Ae);return}return}const ve=ue.match(/^tree::(hooks|skills|agents)::(.+)$/),Ge=xe.match(/^drop::(edge-hooks|stage-hooks|edge-skill)::(.+)$/);if(!ve||!Ge)return;const[,nt,Lt]=ve,[,be,je]=Ge,D=nt==="hooks"?L.get(Lt):Y5(Lt);if(D){if(v.editMode||v.enterEditMode(),be==="edge-hooks"&&nt==="hooks"){const[X,oe]=je.split(":"),he=v.editConfig.edges.find(Ae=>Ae.from===X&&Ae.to===oe);if(!he||(B=he.hooks)!=null&&B.includes(D))return;v.updateEdge(he,{...he,hooks:[...he.hooks??[],D]})}if(be==="stage-hooks"&&nt==="hooks"){const X=v.editConfig.lists.find(oe=>oe.id===je);if(!X||(W=X.activeHooks)!=null&&W.includes(D))return;v.updateList(X,{...X,activeHooks:[...X.activeHooks??[],D]})}if(be==="edge-skill"&&nt==="skills"){const[X,oe]=je.split(":"),he=v.editConfig.edges.find(Ae=>Ae.from===X&&Ae.to===oe);if(!he)return;v.updateEdge(he,{...he,command:`/${D} {id}`})}}},[v,F,R,Y,L]),$=m.useCallback(()=>{i(null)},[]),[C,re]=m.useState(!1),[Te,K]=m.useState(null),qe=m.useCallback(async()=>{if(!(!v.validation.valid||C)){re(!0),K(null);try{const ie=await(await fetch("/api/orbital/workflow",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(v.editConfig)})).json();if(!ie.success)throw new Error(ie.error??"Save failed");v.discard()}catch(ne){const ie=ne instanceof Error?ne.message:"Workflow save failed";console.error("Workflow save failed:",ne),K(ie)}finally{re(!1)}}},[v,C]),{activePaths:He,hookCategoryMap:et}=m.useMemo(()=>{const ne=new Set,ie=new Set,ce=new Set,ue=new Map,xe=[...H.globalHooks,...H.stages.flatMap(be=>be.stageHooks),...H.stages.flatMap(be=>be.forwardEdges.flatMap(je=>je.edgeHooks))];for(const be of xe)be.filePath&&(ne.add(be.filePath),ue.set(be.filePath,be.category));const ve=S.getAllHooks();for(const be of ve){const je=H.hookPathMap.get(be.id);je&&!ue.has(je)&&ue.set(je,be.category)}for(const be of H.stages)for(const je of be.forwardEdges)je.skillPath&&ie.add(je.skillPath);const{orchestratesMap:Ge,skillPathMap:nt}=H;if(Ge.size>0){const be=new Map;for(const[B,W]of nt)be.set(W,B);const je=new Set,D=[];for(const B of ie){const W=be.get(B);W&&Ge.has(W)&&(D.push(W),je.add(W))}for(;D.length>0;){const B=D.shift();for(const W of Ge.get(B)??[]){const X=nt.get(W);X&&ie.add(X),!je.has(W)&&Ge.has(W)&&(je.add(W),D.push(W))}}}for(const be of H.stages){for(const je of be.alwaysOnAgents)je.filePath&&ce.add(je.filePath);for(const je of be.reviewTeams)for(const D of je.agents)D.filePath&&ce.add(D.filePath)}return{activePaths:{hooks:ne,skills:ie,agents:ce}[e],hookCategoryMap:ue}},[H,e,S]),U=m.useMemo(()=>{if(e!=="agents")return;const ne={"red-team":"#ef4444","blue-team":"#3b82f6","green-team":"#22c55e"},ie=new Map;function ce(ue,xe){for(const ve of ue)if(ve.type==="folder"&&ve.children)ce(ve.children,ve.name);else if(ve.type==="file"&&xe){const Ge=ne[xe.toLowerCase()]??"#8B5CF6";ie.set(ve.path,{team:xe,color:Ge})}}return ce(o,null),ie},[e,o]),{setNodeRef:ke,isOver:tt}=Bn({id:"drop::remove"}),ht=(s==null?void 0:s.type)==="pipeline",De=m.useMemo(()=>{let ne=0;function ie(ce){for(const ue of ce)ue.type==="file"&&ne++,ue.children&&ie(ue.children)}return ie(o),ne},[o]);return a.jsxs(Op,{sensors:M,modifiers:N,onDragStart:k,onDragEnd:_,onDragCancel:$,children:[a.jsxs("div",{className:"flex flex-1 min-h-0 flex-col",children:[a.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[a.jsx(aa,{className:"h-4 w-4 text-primary"}),a.jsx("h1",{className:"text-xl font-light",children:"Primitives"}),a.jsxs(Q,{variant:"secondary",className:"ml-2",children:[De," ",e]})]}),v.editMode&&v.changeCount>0&&a.jsxs("div",{className:"mb-2 flex items-center gap-2 rounded border border-border bg-card px-3 py-2",children:[a.jsxs(Q,{variant:"outline",children:[v.changeCount," unsaved"]}),v.canUndo&&a.jsx(fe,{variant:"ghost",size:"sm",onClick:v.undo,children:"Undo"}),v.canRedo&&a.jsx(fe,{variant:"ghost",size:"sm",onClick:v.redo,children:"Redo"}),a.jsx("div",{className:"flex-1"}),a.jsx(fe,{variant:"ghost",size:"sm",onClick:v.discard,children:"Discard"}),a.jsx(fe,{size:"sm",onClick:qe,disabled:C||!v.validation.valid,children:C?"Saving...":"Save"}),Te&&a.jsx("span",{className:"text-xs text-destructive ml-2",children:Te})]}),a.jsxs("div",{className:"flex min-h-0 flex-1 gap-2",children:[a.jsxs("div",{ref:ke,className:I("flex w-[20%] min-w-[180px] flex-col rounded border bg-card card-glass neon-border-blue transition-colors",tt?"border-ask-red/60 bg-ask-red/5":"border-border"),children:[ht&&tt&&a.jsxs("div",{className:"flex items-center justify-center gap-1.5 border-b border-ask-red/30 bg-ask-red/10 px-2 py-1.5 text-[10px] text-ask-red",children:[a.jsx(Ii,{className:"h-3 w-3"})," Drop to remove"]}),a.jsx(E5,{tree:o,loading:l,selectedPath:d,type:e,onSelect:P,onRefresh:c,onTabChange:O,activePaths:He,hookCategoryMap:e==="hooks"?et:void 0,agentTeamMap:U})]}),a.jsx("div",{className:"flex w-[35%] min-w-[220px] flex-col rounded border border-border bg-card card-glass neon-border-blue",children:a.jsx(H5,{selectedPath:d,onSelectItem:V,editConfig:G,editable:!0,onRemoveEdgeHook:F,onRemoveStageHook:R,onRemoveGlobalHook:Y})}),a.jsx("div",{className:"flex w-[45%] min-w-[280px] flex-col rounded border border-border bg-card card-glass neon-border-blue",children:a.jsx(T5,{type:u,filePath:d,content:f,setContent:h,frontmatter:p,setFrontmatterField:g,body:x,setBody:b,dirty:y,saving:j,loading:w,error:T,onSave:E})})]})]}),a.jsx(Lp,{children:s&&a.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-[11px] font-medium bg-card shadow-lg border-accent-blue/50 text-foreground",children:[s.type==="hooks"&&a.jsx(Fi,{className:"h-3 w-3 text-amber-400"}),s.type==="skills"&&a.jsx(Ut,{className:"h-3 w-3 text-green-400"}),s.type==="agents"&&a.jsx(aa,{className:"h-3 w-3 text-purple-400"}),s.name]})})]})}function J5(e){const[t,n]=m.useState(null),[r,s]=m.useState(!1),i=m.useCallback(async()=>{if(e==null){n(null);return}s(!0);try{const o=await fetch(`/api/orbital/scopes/${e}/readiness`);o.ok&&n(await o.json())}catch{}finally{s(!1)}},[e]);return m.useEffect(()=>{i()},[i]),m.useEffect(()=>{function o(c){i()}function l(c){(c.scope_id===e||["VIOLATION","OVERRIDE","SCOPE_STATUS_CHANGED"].includes(c.type))&&i()}return Z.on("gate:updated",o),Z.on("event:new",l),()=>{Z.off("gate:updated",o),Z.off("event:new",l)}},[e,i]),{readiness:t,loading:r,refetch:i}}function Q5(e){const[t,n]=m.useState([]),[r,s]=m.useState([]),[i,o]=m.useState(!0),l=m.useCallback(async()=>{try{const c=e?`?scope_id=${e}`:"",[u,d]=await Promise.all([fetch(`/api/orbital/gates${c}`),fetch("/api/orbital/gates/stats")]);u.ok&&n(await u.json()),d.ok&&s(await d.json())}catch{}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),jn(l),m.useEffect(()=>{function c(u){n(d=>{const f=d.findIndex(h=>h.gate_name===u.gate_name&&h.scope_id===u.scope_id);if(f>=0){const h=[...d];return h[f]=u,h}return[...d,u]})}return Z.on("gate:updated",c),()=>{Z.off("gate:updated",c)}},[]),{gates:t,stats:r,loading:i,refetch:l}}function Z5(){const[e,t]=m.useState({byRule:[],byFile:[],overrides:[],totalViolations:0,totalOverrides:0}),[n,r]=m.useState(!0),s=m.useCallback(async()=>{try{const i=await fetch("/api/orbital/events/violations/summary");i.ok&&t(await i.json())}catch{}finally{r(!1)}},[]);return m.useEffect(()=>{s()},[s]),jn(s),m.useEffect(()=>{function i(o){(o.type==="VIOLATION"||o.type==="OVERRIDE")&&s()}return Z.on("event:new",i),()=>{Z.off("event:new",i)}},[s]),{...e,loading:n,refetch:s}}function lg(){const[e,t]=m.useState(null),[n,r]=m.useState([]),[s,i]=m.useState(!0),o=m.useCallback(async()=>{try{const[l,c]=await Promise.all([fetch("/api/orbital/enforcement/rules"),fetch("/api/orbital/events/violations/trend?days=30")]);l.ok&&t(await l.json()),c.ok&&r(await c.json())}catch{}finally{i(!1)}},[]);return m.useEffect(()=>{o()},[o]),jn(o),m.useEffect(()=>{function l(c){(c.type==="VIOLATION"||c.type==="OVERRIDE")&&o()}return Z.on("event:new",l),()=>{Z.off("event:new",l)}},[o]),{data:e,trend:n,loading:s,refetch:o}}const eP={pass:{icon:xs,color:"text-bid-green",label:"Pass",glow:"gate-glow-pass glow-green"},fail:{icon:fi,color:"text-ask-red",label:"Fail",glow:"gate-glow-fail glow-red"},running:{icon:Li,color:"text-accent-blue",label:"Running",animate:"animate-spin",glow:"glow-blue"},skipped:{icon:il,color:"text-muted-foreground",label:"Skipped",glow:""}};function cg({status:e,className:t}){const n=eP[e],r=n.icon;return a.jsxs("div",{className:I("flex items-center gap-1.5",t),children:[a.jsx(r,{className:I("h-4 w-4",n.color,n.animate,n.glow)}),a.jsx("span",{className:I("text-xs",n.color),children:n.label})]})}function ug(e){return e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}const Ia={blocker:"text-red-400 bg-red-500/10 border-red-500/20",advisor:"text-amber-400 bg-amber-500/10 border-amber-500/20",operator:"text-cyan-400 bg-cyan-500/10 border-cyan-500/20",silent:"text-zinc-400 bg-zinc-500/10 border-zinc-500/20"},tP={guard:"GUARD",gate:"GATE",lifecycle:"LIFECYCLE",observer:"OBSERVER"},nP={guard:ll,gate:Ih,lifecycle:Eh,observer:Oi};function rP(){var h;const{scopes:e}=yl(),{engine:t}=wt(),[n,r]=xh(),[s,i]=m.useState(()=>{const p=n.get("scope");return p?Number(p):null});m.useEffect(()=>{s!=null&&r({scope:String(s)},{replace:!0})},[s,r]);const o=m.useMemo(()=>e.filter(p=>!t.isTerminalStatus(p.status)&&p.status!=="icebox"&&!p.is_ghost).sort((p,g)=>p.id-g.id),[e,t]),l=m.useMemo(()=>{const p=new Map;for(const g of o){const x=p.get(g.status)??[];x.push(g),p.set(g.status,x)}return p},[o]),c=s??((h=o[0])==null?void 0:h.id)??null,{readiness:u,loading:d}=J5(c),f=o.find(p=>p.id===c);return a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto space-y-6",children:[a.jsxs("section",{children:[a.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[a.jsx(al,{className:"h-4 w-4 text-primary"}),a.jsx("h1",{className:"text-xl font-light",children:"Safeguards"}),u&&a.jsxs(Q,{variant:"secondary",children:[u.transitions.filter(p=>p.ready).length,"/",u.transitions.length," ready"]})]}),a.jsxs("div",{className:"mb-4 flex flex-wrap gap-1.5",children:[t.getLists().filter(p=>!t.isTerminalStatus(p.id)&&p.id!=="icebox"&&l.has(p.id)).map(p=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"mr-0.5 text-[10px] uppercase tracking-wider text-muted-foreground/50",children:p.label}),(l.get(p.id)??[]).map(g=>a.jsx("button",{onClick:()=>i(g.id),className:I("rounded border px-2 py-0.5 text-xs font-mono transition-all",g.id===c?"border-primary/50 bg-primary/10 text-primary":"border-border/50 bg-surface-light/30 text-muted-foreground hover:border-primary/30 hover:text-foreground"),children:String(g.id).padStart(3,"0")},g.id)),a.jsx("span",{className:"mx-1.5 text-border",children:"|"})]},p.id)),o.length===0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"No active scopes"})]}),o.length>0&&a.jsx(fP,{scopes:o,selectedId:c,onSelect:i}),c&&f&&a.jsxs("div",{className:"grid gap-5 lg:grid-cols-3",children:[a.jsx("div",{className:"lg:col-span-2 space-y-4",children:d?a.jsx("div",{className:"flex h-32 items-center justify-center",children:a.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):u&&u.transitions.length>0?u.transitions.map(p=>a.jsx(oP,{transition:p,scopeId:c},`${p.from}-${p.to}`)):a.jsx(Me,{children:a.jsxs(Fe,{className:"py-8 text-center",children:[a.jsx(xs,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground/50"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["No forward transitions from ",a.jsx("span",{className:"font-mono",children:f.status})]})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(sP,{scope:f}),u&&u.transitions.length>0&&u.transitions[0].gates.length>0&&a.jsx(iP,{gates:u.transitions[0].gates})]})]})]}),a.jsx(lP,{}),a.jsx(uP,{}),a.jsx(dP,{})]})}function sP({scope:e}){const t=String(e.id).padStart(3,"0"),n=e.title.length>30?e.title.slice(0,30)+"...":e.title;return a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-2",children:a.jsxs(at,{className:"text-sm font-mono",children:[t," ",n]})}),a.jsxs(Fe,{className:"space-y-2 text-xs",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Status"}),a.jsx(Q,{variant:"outline",className:"text-[10px]",children:e.status})]}),e.priority&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Priority"}),a.jsx("span",{children:e.priority})]}),e.blocked_by.length>0&&a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Blocked by"}),a.jsx("span",{className:"font-mono text-amber-400",children:e.blocked_by.map(r=>String(r).padStart(3,"0")).join(", ")})]}),Object.keys(e.sessions).length>0&&a.jsxs("div",{className:"pt-1 border-t border-border/50",children:[a.jsx("span",{className:"text-muted-foreground text-[10px] uppercase tracking-wider",children:"Sessions"}),Object.entries(e.sessions).map(([r,s])=>a.jsxs("div",{className:"flex justify-between mt-1",children:[a.jsx("span",{className:"text-muted-foreground",children:r}),a.jsxs("span",{className:"font-mono text-[10px]",children:[s.length," recorded"]})]},r))]})]})]})}function iP({gates:e}){return a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-2",children:a.jsx(at,{className:"text-sm",children:"CI Gates"})}),a.jsx(Fe,{className:"space-y-0.5",children:e.map(t=>a.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[a.jsx(cg,{status:t.status}),a.jsx("span",{className:"flex-1 text-[11px]",children:ug(t.gate_name)}),t.duration_ms!=null&&a.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[(t.duration_ms/1e3).toFixed(1),"s"]})]},t.gate_name))})]})}function oP({transition:e,scopeId:t}){var o;const[n,r]=m.useState(!1),s=((o=e.edge.command)==null?void 0:o.replace("{id}",String(t)))??null;async function i(){if(s){r(!0);try{await fetch("/api/orbital/dispatch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope_id:t,command:s,transition:{from:e.from,to:e.to}})})}catch{}finally{r(!1)}}}return a.jsxs(Me,{className:I("transition-all",e.ready?"border-bid-green/20":"border-border"),children:[a.jsxs(Ze,{className:"pb-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Q,{variant:"outline",className:"text-[10px] font-mono",children:e.from}),a.jsx(mr,{className:"h-3 w-3 text-muted-foreground"}),a.jsx(Q,{variant:"outline",className:"text-[10px] font-mono",children:e.to}),a.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:e.edge.label})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e.ready&&a.jsx(Q,{className:"bg-bid-green/10 text-bid-green border-bid-green/20 text-[10px]",children:"Ready"}),s&&e.edge.dispatchOnly&&a.jsxs(fe,{size:"sm",variant:e.ready?"default":"outline",className:"h-6 text-[11px] gap-1",disabled:!e.ready||n,onClick:i,children:[a.jsx(Ut,{className:"h-3 w-3"}),n?"Dispatching...":"Dispatch"]})]})]}),s&&a.jsx("code",{className:"text-[10px] font-mono text-muted-foreground/60 mt-1",children:s})]}),a.jsxs(Fe,{className:"space-y-3",children:[e.hooks.length>0&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/50 mb-1.5 block",children:"Workflow Hooks"}),a.jsx("div",{className:"space-y-1",children:e.hooks.map(l=>a.jsx(aP,{hook:l},l.id))})]}),e.edge.checklist&&e.edge.checklist.length>0&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/50 mb-1.5 block",children:"Checklist"}),a.jsx("div",{className:"space-y-1",children:e.edge.checklist.map((l,c)=>a.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[a.jsx(il,{className:"h-3 w-3 mt-0.5 flex-shrink-0 text-muted-foreground/40"}),a.jsx("span",{children:l})]},c))})]}),e.blockers.length>0&&a.jsxs("div",{className:"rounded border border-red-500/20 bg-red-500/5 p-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(wn,{className:"h-3 w-3 text-red-400"}),a.jsxs("span",{className:"text-[10px] font-medium text-red-400",children:[e.blockers.length," Blocker",e.blockers.length!==1?"s":""]})]}),e.blockers.map((l,c)=>a.jsx("p",{className:"text-[11px] text-red-400/80 ml-4.5",children:l},c))]})]})]})}function aP({hook:e}){const t=e.status==="pass"?a.jsx(xs,{className:"h-3.5 w-3.5 text-bid-green"}):e.status==="fail"?a.jsx(fi,{className:"h-3.5 w-3.5 text-red-400"}):a.jsx(il,{className:"h-3.5 w-3.5 text-muted-foreground/50"});return a.jsxs("div",{className:"flex items-center gap-2 rounded px-2 py-1 hover:bg-surface-light/50",children:[t,a.jsx("span",{className:"flex-1 text-xs",children:e.label}),a.jsx(Q,{variant:"outline",className:I("text-[9px] px-1.5 py-0 h-4 border",Ia[e.enforcement]),children:tP[e.category]}),e.reason&&a.jsx("span",{className:"text-[10px] text-muted-foreground/60 max-w-[200px] truncate",children:e.reason})]})}function lP(){const{data:e,loading:t}=lg();return t||!e||e.rules.length===0?null:a.jsxs("section",{children:[a.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[a.jsx(ll,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("h2",{className:"text-base font-light",children:"Rule Configuration"})]}),a.jsxs("div",{className:"mb-4 grid gap-4 lg:grid-cols-4",children:[a.jsxs("div",{className:"lg:col-span-3 flex flex-wrap items-center gap-3 rounded-lg border border-border/50 bg-surface-light/20 px-4 py-2 self-start",children:[a.jsx(qs,{count:e.summary.guards,label:"guards",color:"text-red-400"}),a.jsx(qs,{count:e.summary.gates,label:"gates",color:"text-amber-400"}),a.jsx(qs,{count:e.summary.lifecycle,label:"lifecycle",color:"text-cyan-400"}),a.jsx(qs,{count:e.summary.observers,label:"observers",color:"text-zinc-400"}),a.jsx("span",{className:"text-border",children:"|"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.totalEdges," edge",e.totalEdges!==1?"s":""]})]}),a.jsx(Me,{className:"flex items-center justify-center",children:a.jsx(Fe,{className:"p-2",children:a.jsx(hP,{summary:e.summary})})})]}),a.jsx(Me,{children:a.jsx(Fe,{className:"p-0",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-[10px] text-muted-foreground uppercase tracking-wider",children:[a.jsx("th",{className:"px-4 py-2 font-medium",children:"Hook"}),a.jsx("th",{className:"px-4 py-2 font-medium",children:"Category"}),a.jsx("th",{className:"px-4 py-2 font-medium",children:"Level"}),a.jsx("th",{className:"px-4 py-2 font-medium",children:"Edges"}),a.jsx("th",{className:"px-4 py-2 font-medium text-right",children:"Violations"}),a.jsx("th",{className:"px-4 py-2 font-medium text-right",children:"Overrides"}),a.jsx("th",{className:"px-4 py-2 font-medium text-right",children:"Last Fired"})]})}),a.jsx("tbody",{children:e.rules.map(n=>a.jsx(cP,{rule:n},n.hook.id))})]})})})})]})}function cP({rule:e}){var n;const t=nP[e.hook.category]??ll;return a.jsxs("tr",{className:"border-b border-border/30 last:border-0 hover:bg-surface-light/30",children:[a.jsx("td",{className:"px-4 py-2",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(t,{className:"h-3 w-3 text-muted-foreground/50"}),a.jsx("span",{className:"font-medium",children:e.hook.label})]})}),a.jsx("td",{className:"px-4 py-2",children:a.jsx(Q,{variant:"outline",className:I("text-[9px] border",Ia[e.enforcement]),children:e.hook.category})}),a.jsx("td",{className:"px-4 py-2",children:a.jsx("span",{className:I("text-[10px]",(n=Ia[e.enforcement])==null?void 0:n.split(" ")[0]),children:e.enforcement})}),a.jsx("td",{className:"px-4 py-2",children:e.edges.length>0?a.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.edges.slice(0,3).map((r,s)=>a.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[9px] text-muted-foreground font-mono",children:[r.from,a.jsx(mr,{className:"h-2 w-2"}),r.to]},s)),e.edges.length>3&&a.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["+",e.edges.length-3]})]}):a.jsx("span",{className:"text-[9px] text-muted-foreground",children:"-"})}),a.jsx("td",{className:"px-4 py-2 text-right font-mono",children:e.stats.violations>0?a.jsx("span",{className:"text-red-400",children:e.stats.violations}):a.jsx("span",{className:"text-muted-foreground/40",children:"0"})}),a.jsx("td",{className:"px-4 py-2 text-right font-mono",children:e.stats.overrides>0?a.jsx("span",{className:"text-amber-400",children:e.stats.overrides}):a.jsx("span",{className:"text-muted-foreground/40",children:"0"})}),a.jsx("td",{className:"px-4 py-2 text-right text-muted-foreground/60",children:e.stats.last_triggered?yn(new Date(e.stats.last_triggered),{addSuffix:!0}):"-"})]})}function uP(){const{byRule:e,overrides:t,totalViolations:n,totalOverrides:r,loading:s}=Z5(),{trend:i,loading:o}=lg(),[l,c]=m.useState([]),u=m.useCallback(async()=>{try{const h=await fetch("/api/orbital/events?type=VIOLATION&limit=15");h.ok&&c(await h.json())}catch{}},[]);m.useEffect(()=>{u()},[u]);const d=n+r>0?Math.round(r/(n+r)*100):0,f=s||o;return a.jsxs("section",{children:[a.jsxs("div",{className:"mb-3 flex items-center gap-3 flex-wrap",children:[a.jsx(Ih,{className:"h-4 w-4 text-red-400"}),a.jsx("h2",{className:"text-base font-light",children:"Enforcement Activity"}),a.jsxs("div",{className:"flex items-center gap-3 ml-auto text-xs",children:[a.jsxs("span",{children:[a.jsx("span",{className:"text-red-400 font-medium",children:n})," ",a.jsx("span",{className:"text-muted-foreground",children:"violations"})]}),a.jsxs("span",{children:[a.jsx("span",{className:"text-amber-400 font-medium",children:r})," ",a.jsx("span",{className:"text-muted-foreground",children:"overrides"})]}),a.jsxs("span",{className:I("font-medium",d>50?"text-amber-400":"text-muted-foreground"),children:[d,"% ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"override rate"})]})]})]}),f?a.jsx("div",{className:"flex h-20 items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(pP,{byRule:e,overrides:t}),a.jsx(mP,{trend:i})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-1",children:a.jsx(at,{className:"text-sm",children:"Recent Violations"})}),a.jsx(Fe,{className:l.length>0?"p-0":void 0,children:l.length===0?a.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:"No violations recorded"}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-[10px] text-muted-foreground uppercase tracking-wider",children:[a.jsx("th",{className:"px-3 py-1.5 font-medium",children:"Rule"}),a.jsx("th",{className:"px-3 py-1.5 font-medium",children:"Scope"}),a.jsx("th",{className:"px-3 py-1.5 font-medium",children:"Outcome"}),a.jsx("th",{className:"px-3 py-1.5 font-medium text-right",children:"Time"})]})}),a.jsx("tbody",{children:l.map(h=>{const p=h.data;return a.jsxs("tr",{className:"border-b border-border/30 last:border-0 hover:bg-surface-light/30",children:[a.jsx("td",{className:"px-3 py-1 font-mono text-red-400",children:(p==null?void 0:p.rule)??"-"}),a.jsx("td",{className:"px-3 py-1 font-mono text-muted-foreground",children:h.scope_id?String(h.scope_id).padStart(3,"0"):"-"}),a.jsx("td",{className:"px-3 py-1",children:a.jsx(Q,{variant:"outline",className:"text-[9px] border-red-500/30 text-red-400",children:(p==null?void 0:p.outcome)??"blocked"})}),a.jsx("td",{className:"px-3 py-1 text-right text-muted-foreground/60",children:h.timestamp?yn(new Date(h.timestamp),{addSuffix:!0}):"-"})]},h.id)})})]})})})]}),a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-1",children:a.jsx(at,{className:"text-sm",children:"Recent Overrides"})}),a.jsx(Fe,{children:t.length===0?a.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:"No overrides recorded"}):a.jsx("div",{className:"space-y-1.5",children:t.slice(0,8).map((h,p)=>a.jsxs("div",{className:"rounded border border-amber-500/20 bg-amber-500/5 px-2.5 py-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-[11px] font-medium text-amber-400",children:h.rule??"unknown"}),a.jsx("span",{className:"flex-shrink-0 text-[9px] text-muted-foreground/50",children:h.date?yn(new Date(h.date),{addSuffix:!0}):"-"})]}),h.reason&&a.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground line-clamp-1",children:h.reason})]},p))})})]})]})]})]})}function dP(){const{gates:e,stats:t,loading:n}=Q5(),r=t.reduce((l,c)=>l+c.passed,0),s=t.reduce((l,c)=>l+c.total,0),i=s>0?Math.round(r/s*100):0,o=e.filter(l=>l.status==="pass").length;return a.jsxs("section",{children:[a.jsxs("div",{className:"mb-3 flex items-center gap-3 flex-wrap",children:[a.jsx(xs,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("h2",{className:"text-base font-light",children:"CI Gates"}),e.length>0&&a.jsxs(Q,{variant:"secondary",className:"text-[10px]",children:[o,"/",e.length," passing"]}),s>0&&a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Pass rate"}),a.jsxs("span",{className:"text-sm font-medium",children:[i,"%"]}),a.jsx("div",{className:"h-1.5 w-16 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-bid-green transition-all",style:{width:`${i}%`}})})]})]}),n?a.jsx("div",{className:"flex h-20 items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-1",children:a.jsx(at,{className:"text-sm",children:"Latest Run"})}),a.jsx(Fe,{children:e.length===0?a.jsxs("p",{className:"text-xs text-muted-foreground text-center py-3",children:["No gate results yet. Run ",a.jsx("code",{className:"rounded bg-muted px-1",children:"/test-checks"})," to populate."]}):a.jsx("div",{className:"space-y-0.5",children:e.map(l=>a.jsxs("div",{className:"flex items-center gap-3 rounded px-2 py-0.5 hover:bg-surface-light/50",children:[a.jsx(cg,{status:l.status}),a.jsx("span",{className:"flex-1 text-[11px]",children:ug(l.gate_name)}),l.duration_ms!=null&&a.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[(l.duration_ms/1e3).toFixed(1),"s"]}),a.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[a.jsx(Yr,{className:"inline h-2.5 w-2.5 mr-0.5"}),yn(new Date(l.run_at),{addSuffix:!0})]})]},l.id))})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-1",children:a.jsx(at,{className:"text-sm",children:"Gate History"})}),a.jsx(Fe,{children:t.length===0?a.jsx(Fa,{height:120,message:"No history data"}):a.jsx(mn,{width:"100%",height:Math.max(120,t.length*18),children:a.jsxs(os,{data:t.map(l=>({name:l.gate_name.replace(/-/g," ").slice(0,12),passed:l.passed,failed:l.failed})),layout:"vertical",margin:{left:0,right:10,top:0,bottom:0},children:[a.jsx(On,{type:"number",hide:!0}),a.jsx(Ln,{dataKey:"name",type:"category",width:85,tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"}}),a.jsx(or,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"11px"}}),a.jsx(nr,{dataKey:"passed",stackId:"a",radius:[0,0,0,0],children:t.map((l,c)=>a.jsx(Kr,{fill:"#00c853"},c))}),a.jsx(nr,{dataKey:"failed",stackId:"a",radius:[0,4,4,0],children:t.map((l,c)=>a.jsx(Kr,{fill:"#ff1744"},c))})]})})})]}),a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-1",children:a.jsx(at,{className:"text-sm",children:"Gate Duration"})}),a.jsx(Fe,{children:e.some(l=>l.duration_ms!=null)?a.jsx(mn,{width:"100%",height:Math.max(120,e.filter(l=>l.duration_ms!=null).length*18),children:a.jsxs(os,{data:e.filter(l=>l.duration_ms!=null).map(l=>({name:l.gate_name.replace(/-/g," ").slice(0,12),seconds:Number((l.duration_ms/1e3).toFixed(1)),status:l.status})),layout:"vertical",margin:{left:0,right:10,top:0,bottom:0},children:[a.jsx(On,{type:"number",unit:"s",tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ln,{dataKey:"name",type:"category",width:85,tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"}}),a.jsx(or,{formatter:l=>[`${l}s`,"Duration"],contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"11px"}}),a.jsx(nr,{dataKey:"seconds",radius:[0,4,4,0],children:e.filter(l=>l.duration_ms!=null).map((l,c)=>a.jsx(Kr,{fill:l.status==="pass"?"#00c85340":l.status==="fail"?"#ff174440":"#06b6d440"},c))})]})}):a.jsx(Fa,{height:120,message:"No duration data"})})]})]})]})]})}function qs({count:e,label:t,color:n}){return a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:I("text-sm font-medium",n),children:e}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:t})]})}function fP({scopes:e}){const{engine:t}=wt(),n=t.getLists().filter(i=>!t.isTerminalStatus(i.id)&&i.id!=="icebox"),r=new Map;for(const i of e)r.set(i.status,(r.get(i.status)??0)+1);const s=n.filter(i=>r.has(i.id)).map(i=>({name:i.label,count:r.get(i.id)??0,color:i.hex}));return s.length===0?null:a.jsxs(Me,{className:"mb-4",children:[a.jsx(Ze,{className:"pb-1",children:a.jsx(at,{className:"text-sm",children:"Scope Distribution"})}),a.jsx(Fe,{children:a.jsx(mn,{width:"100%",height:100,children:a.jsxs(os,{data:s,margin:{left:0,right:10,top:5,bottom:0},children:[a.jsx(On,{dataKey:"name",tick:{fontSize:10,fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ln,{allowDecimals:!1,tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},width:20}),a.jsx(or,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"11px"}}),a.jsx(nr,{dataKey:"count",radius:[4,4,0,0],children:s.map((i,o)=>a.jsx(Kr,{fill:i.color,fillOpacity:.7},o))})]})})})]})}const Gs={guards:"#EF4444",gates:"#F59E0B",lifecycle:"#3B82F6",observers:"#71717A"};function hP({summary:e}){const t=[{name:"Guards",value:e.guards},{name:"Gates",value:e.gates},{name:"Lifecycle",value:e.lifecycle},{name:"Observers",value:e.observers}].filter(s=>s.value>0),n=[Gs.guards,Gs.gates,Gs.lifecycle,Gs.observers],r=t.reduce((s,i)=>s+i.value,0);return a.jsxs("div",{className:"relative",children:[a.jsx(mn,{width:120,height:120,children:a.jsxs(vy,{children:[a.jsx(wy,{data:t,cx:"50%",cy:"50%",innerRadius:32,outerRadius:50,paddingAngle:3,dataKey:"value",stroke:"none",children:t.map((s,i)=>a.jsx(Kr,{fill:n[i],fillOpacity:.8},i))}),a.jsx(or,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"11px"}})]})}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:a.jsx("span",{className:"text-lg font-light text-foreground",children:r})})]})}function Fa({height:e,message:t}){return a.jsxs("div",{className:"relative",children:[a.jsx("div",{style:{height:e},className:"opacity-30",children:a.jsx(mn,{width:"100%",height:e,children:a.jsxs(os,{data:[{name:"",value:0}],layout:"vertical",margin:{left:10,right:20,top:0,bottom:0},children:[a.jsx(ta,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.4}),a.jsx(On,{type:"number",domain:[0,10],tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ln,{dataKey:"name",type:"category",width:80,tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"}})]})})}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("span",{className:"text-xs text-muted-foreground",children:t})})]})}function pP({byRule:e,overrides:t}){const n=new Map;for(const i of t){const o=i.rule??"unknown";n.set(o,(n.get(o)??0)+1)}const r=e.map(i=>({name:String(i.rule??"unknown").slice(0,22),violations:i.count,overrides:n.get(String(i.rule))??0})),s=r.length===0;return a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-2",children:a.jsx(at,{className:"text-sm",children:"Violations vs Overrides by Rule"})}),a.jsx(Fe,{children:s?a.jsx(Fa,{height:120,message:"No violation data yet"}):a.jsx(mn,{width:"100%",height:Math.max(140,r.length*30),children:a.jsxs(os,{data:r,layout:"vertical",margin:{left:10,right:20,top:0,bottom:0},children:[a.jsx(On,{type:"number",hide:!0}),a.jsx(Ln,{dataKey:"name",type:"category",width:150,tick:{fontSize:10,fill:"hsl(var(--muted-foreground))"}}),a.jsx(or,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"11px"}}),a.jsx(ky,{verticalAlign:"top",height:24,iconSize:8,wrapperStyle:{fontSize:"10px",color:"hsl(var(--muted-foreground))"}}),a.jsx(nr,{dataKey:"violations",stackId:"a",fill:"#EF4444",fillOpacity:.8,radius:[0,0,0,0]}),a.jsx(nr,{dataKey:"overrides",stackId:"a",fill:"#F59E0B",fillOpacity:.8,radius:[0,4,4,0]})]})})})]})}function mP({trend:e}){const t=new Map;for(const s of e)t.set(s.day,(t.get(s.day)??0)+s.count);const n=[...t.entries()].map(([s,i])=>({day:s.slice(5),count:i})).slice(-30),r=n.length<2;return a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-2",children:a.jsx(at,{className:"text-sm",children:"Violation Trend (30d)"})}),a.jsx(Fe,{children:r?a.jsxs("div",{className:"relative",children:[a.jsx("div",{style:{height:120},className:"opacity-30",children:a.jsx(mn,{width:"100%",height:120,children:a.jsxs(Lc,{data:[{day:"",count:0}],margin:{left:0,right:10,top:5,bottom:0},children:[a.jsx(ta,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.4}),a.jsx(On,{dataKey:"day",tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ln,{domain:[0,10],tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},width:30})]})})}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("span",{className:"text-xs text-muted-foreground",children:"No trend data yet"})})]}):a.jsx(mn,{width:"100%",height:140,children:a.jsxs(Lc,{data:n,margin:{left:0,right:10,top:5,bottom:0},children:[a.jsx(ta,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",opacity:.3}),a.jsx(On,{dataKey:"day",tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"}}),a.jsx(Ln,{tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},width:30}),a.jsx(or,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",fontSize:"11px"}}),a.jsx(jy,{type:"monotone",dataKey:"count",stroke:"#EF4444",fill:"#EF444420",strokeWidth:1.5})]})})})]})}const Ks=50;function gP(){const[e,t]=m.useState(null),[n,r]=m.useState([]),[s,i]=m.useState([]),[o,l]=m.useState([]),[c,u]=m.useState(null),[d,f]=m.useState([]),[h,p]=m.useState(!0),[g,x]=m.useState(!0),b=m.useRef(0),y=m.useCallback(async()=>{try{const[T,S,A,v,M]=await Promise.all([fetch("/api/orbital/git/overview"),fetch(`/api/orbital/git/commits?limit=${Ks}&offset=0`),fetch("/api/orbital/git/branches"),fetch("/api/orbital/git/worktrees"),fetch("/api/orbital/git/drift")]);if(T.ok&&t(await T.json()),S.ok){const N=await S.json();r(N),b.current=N.length,x(N.length>=Ks)}A.ok&&i(await A.json()),v.ok&&l(await v.json()),M.ok&&f(await M.json())}catch{}finally{p(!1)}},[]),j=m.useCallback(async()=>{try{const T=await fetch("/api/orbital/github/status");T.ok&&u(await T.json())}catch{}},[]),w=m.useCallback(()=>{y(),j()},[y,j]),E=m.useCallback(async()=>{try{const T=await fetch(`/api/orbital/git/commits?limit=${Ks}&offset=${b.current}`);if(T.ok){const S=await T.json();r(A=>[...A,...S]),b.current+=S.length,x(S.length>=Ks)}}catch{}},[]);return m.useEffect(()=>{y(),j()},[y,j]),m.useEffect(()=>{function T(){y()}return Z.on("git:status:changed",T),()=>{Z.off("git:status:changed",T)}},[y]),{overview:e,commits:n,branches:s,worktrees:o,github:c,drift:d,loading:h,refetch:w,loadMoreCommits:E,hasMoreCommits:g}}function xP(){const[e,t]=m.useState(null),[n,r]=m.useState([]),[s,i]=m.useState([]),[o,l]=m.useState(!0),c=m.useCallback(async()=>{try{const[u,d,f]=await Promise.all([fetch("/api/orbital/pipeline/drift"),fetch("/api/orbital/deployments/frequency"),fetch("/api/orbital/deployments")]);u.ok&&t(await u.json()),d.ok&&r(await d.json()),f.ok&&i(await f.json())}catch{}finally{l(!1)}},[]);return m.useEffect(()=>{c()},[c]),jn(c),m.useEffect(()=>{function u(){c()}return Z.on("deploy:updated",u),()=>{Z.off("deploy:updated",u)}},[c]),{drift:e,frequency:n,deployments:s,loading:o,refetch:c}}function yP({overview:e,github:t}){var n;return a.jsx(Me,{className:"mb-6",children:a.jsxs(Fe,{className:"flex flex-wrap items-center gap-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xn,{className:"h-4 w-4 text-primary"}),a.jsx("code",{className:"font-mono text-sm",children:e.currentBranch}),e.dirty&&a.jsxs(Vc,{children:[a.jsx($c,{children:a.jsx(sa,{className:"h-2.5 w-2.5 fill-warning-amber text-warning-amber"})}),a.jsx(ra,{children:"Uncommitted changes"})]})]}),a.jsx(Q,{variant:"outline",className:"text-xs",children:e.branchingMode}),e.mainHead&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx("span",{children:"HEAD"}),a.jsx("code",{className:"font-mono text-xs",children:e.mainHead.sha.slice(0,7)}),a.jsx("span",{className:"max-w-[200px] truncate",children:e.mainHead.message})]}),e.aheadBehind&&(e.aheadBehind.ahead>0||e.aheadBehind.behind>0)&&a.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[a.jsx(bb,{className:"h-3 w-3 text-muted-foreground"}),e.aheadBehind.ahead>0&&a.jsxs("span",{className:"text-bid-green",children:[e.aheadBehind.ahead,"↑"]}),e.aheadBehind.behind>0&&a.jsxs("span",{className:"text-ask-red",children:[e.aheadBehind.behind,"↓"]})]}),e.branchingMode==="worktree"&&e.worktreeCount>0&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(ar,{className:"h-3 w-3"}),a.jsxs("span",{children:[e.worktreeCount," worktree",e.worktreeCount!==1?"s":""]})]}),e.branchingMode==="trunk"&&e.featureBranchCount>0&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(xn,{className:"h-3 w-3"}),a.jsxs("span",{children:[e.featureBranchCount," feature branch",e.featureBranchCount!==1?"es":""]})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[a.jsx(Mh,{className:"h-3.5 w-3.5 text-muted-foreground"}),t!=null&&t.connected?a.jsxs(Vc,{children:[a.jsx($c,{children:a.jsxs(Q,{variant:"secondary",className:"text-xs gap-1",children:[a.jsx(sa,{className:"h-1.5 w-1.5 fill-bid-green text-bid-green"}),((n=t.repo)==null?void 0:n.fullName)??"Connected"]})}),a.jsx(ra,{children:t.authUser?`Signed in as ${t.authUser}`:"Connected to GitHub"})]}):a.jsx(Q,{variant:"outline",className:"text-xs text-muted-foreground",children:"Not connected"})]})]})})}function bP({commit:e}){return a.jsxs("div",{className:"flex items-center gap-3 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light",children:[a.jsx("code",{className:"shrink-0 font-mono text-xs text-primary",children:e.shortSha}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:e.message}),e.branch&&a.jsx(Q,{variant:"outline",className:"shrink-0 text-xs font-normal",children:e.branch}),e.scopeId&&a.jsxs(Q,{variant:"secondary",className:"shrink-0 text-xs",children:["#",e.scopeId]}),a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.author}),a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground/60",children:yn(new Date(e.date),{addSuffix:!0})})]})}function vP({commits:e,branches:t,hasMore:n,onLoadMore:r}){const[s,i]=m.useState("all"),o=m.useMemo(()=>{const u=new Set(["main","master","dev","develop","staging","production"]);for(const d of t)!d.isRemote&&!d.name.startsWith("feat/")&&!d.name.startsWith("fix/")&&u.add(d.name);return u},[t]),l=m.useMemo(()=>s==="all"?e:s==="main"?e.filter(u=>!u.branch||o.has(u.branch)):e.filter(u=>u.branch&&!o.has(u.branch)),[e,s,o]),c=[{key:"all",label:"All"},{key:"main",label:"Main"},{key:"feature",label:"Feature"}];return a.jsxs(Me,{className:"lg:col-span-2",children:[a.jsx(Ze,{className:"pb-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(at,{className:"flex items-center gap-2 text-base",children:[a.jsx(oa,{className:"h-4 w-4 text-primary"}),"Commits",a.jsx(Q,{variant:"secondary",children:l.length})]}),a.jsx("div",{className:"flex gap-1",children:c.map(u=>a.jsx("button",{onClick:()=>i(u.key),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${s===u.key?"bg-surface-light text-foreground":"text-muted-foreground hover:text-foreground"}`,children:u.label},u.key))})]})}),a.jsx(Fe,{children:l.length===0?a.jsxs("div",{className:"py-8 text-center",children:[a.jsx(oa,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground/50"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No commits found."})]}):a.jsxs(a.Fragment,{children:[a.jsx(Tt,{className:"max-h-[600px]",children:a.jsx("div",{className:"space-y-0.5",children:l.map(u=>a.jsx(bP,{commit:u},u.sha))})}),n&&a.jsx("button",{onClick:r,className:"mt-3 w-full rounded border border-border py-2 text-xs text-muted-foreground transition-colors hover:bg-surface-light hover:text-foreground",children:"Load more commits"})]})})]})}function wP({branches:e}){const t=[...e].filter(n=>!n.isRemote).sort((n,r)=>n.isCurrent?-1:r.isCurrent?1:n.isStale!==r.isStale?n.isStale?1:-1:new Date(r.headDate).getTime()-new Date(n.headDate).getTime());return t.length===0?a.jsxs("div",{className:"py-6 text-center",children:[a.jsx(xn,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground/50"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"No branches found."})]}):a.jsx("div",{className:"space-y-0.5",children:t.map(n=>a.jsxs("div",{className:I("flex items-center gap-2 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light",n.isStale&&"opacity-50"),children:[a.jsx(xn,{className:I("h-3.5 w-3.5 shrink-0",n.isCurrent?"text-primary":"text-muted-foreground")}),a.jsx("span",{className:I("min-w-0 flex-1 truncate font-mono text-xs",n.isCurrent&&"text-foreground font-medium"),children:n.name}),n.scopeId&&a.jsxs(Q,{variant:"secondary",className:"shrink-0 text-xs",children:["#",n.scopeId]}),n.aheadBehind&&a.jsxs("div",{className:"flex shrink-0 items-center gap-1 text-xs",children:[n.aheadBehind.ahead>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-bid-green",children:[a.jsx(Nh,{className:"h-2.5 w-2.5"}),n.aheadBehind.ahead]}),n.aheadBehind.behind>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-ask-red",children:[a.jsx(di,{className:"h-2.5 w-2.5"}),n.aheadBehind.behind]})]}),a.jsx("code",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:n.headSha}),n.headDate&&a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground/60",children:yn(new Date(n.headDate),{addSuffix:!0})})]},n.name))})}function kP({worktrees:e}){return e.length===0?a.jsxs("div",{className:"py-6 text-center",children:[a.jsx(ar,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground/50"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"No active worktrees."})]}):a.jsx("div",{className:"space-y-1",children:e.map(t=>a.jsxs("div",{className:"rounded border border-border/50 px-3 py-2 transition-colors hover:bg-surface-light",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ar,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),a.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t.branch}),t.dirty&&a.jsx(sa,{className:"h-2 w-2 shrink-0 fill-warning-amber text-warning-amber"}),a.jsx("code",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:t.head})]}),t.scopeId&&a.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[a.jsxs(Q,{variant:"secondary",className:"text-xs",children:["#",t.scopeId]}),t.scopeTitle&&a.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:t.scopeTitle}),t.scopeStatus&&a.jsx(Q,{variant:"outline",className:I("shrink-0 text-xs capitalize"),children:t.scopeStatus})]}),t.aheadBehind&&(t.aheadBehind.ahead>0||t.aheadBehind.behind>0)&&a.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs",children:[t.aheadBehind.ahead>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-bid-green",children:[a.jsx(Nh,{className:"h-2.5 w-2.5"}),t.aheadBehind.ahead," ahead"]}),t.aheadBehind.behind>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-ask-red",children:[a.jsx(di,{className:"h-2.5 w-2.5"}),t.aheadBehind.behind," behind"]})]})]},t.path))})}function jP(e){return e===0?"text-bid-green":e<=5?"text-accent-blue":e<=20?"text-warning-amber":"text-ask-red"}function SP({branches:e,worktrees:t,drift:n,branchingMode:r}){const s=r==="worktree",[i,o]=m.useState("branches");return a.jsxs(Me,{children:[a.jsx(Ze,{className:"pb-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(at,{className:"flex items-center gap-2 text-base",children:[a.jsx(xn,{className:"h-4 w-4 text-primary"}),s?i==="branches"?"Branches":"Worktrees":"Branches",a.jsx(Q,{variant:"secondary",children:i==="branches"?e.filter(l=>!l.isRemote).length:t.length})]}),s&&a.jsxs("div",{className:"flex gap-1",children:[a.jsxs("button",{onClick:()=>o("branches"),className:I("rounded-md px-2.5 py-1 text-xs transition-colors",i==="branches"?"bg-surface-light text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.jsx(xn,{className:"inline h-3 w-3 mr-1"}),"Branches"]}),a.jsxs("button",{onClick:()=>o("worktrees"),className:I("rounded-md px-2.5 py-1 text-xs transition-colors",i==="worktrees"?"bg-surface-light text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.jsx(ar,{className:"inline h-3 w-3 mr-1"}),"Worktrees"]})]})]})}),a.jsxs(Fe,{children:[a.jsx(Tt,{className:"max-h-[400px]",children:i==="branches"?a.jsx(wP,{branches:e}):a.jsx(kP,{worktrees:t})}),n.length>0&&a.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[a.jsx("h4",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Branch Drift"}),a.jsx("div",{className:"space-y-1.5",children:n.map(l=>a.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[a.jsx("code",{className:"font-mono text-muted-foreground",children:l.from}),a.jsx(mr,{className:"h-3 w-3 text-muted-foreground/50"}),a.jsx("code",{className:"font-mono text-muted-foreground",children:l.to}),a.jsx(Q,{variant:"outline",className:I("ml-auto text-xs",jP(l.count)),children:l.count===0?"in sync":`${l.count} commit${l.count!==1?"s":""}`})]},`${l.from}-${l.to}`))})]})]})]})}function NP({error:e}){const t=e==null?void 0:e.includes("not installed");return a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:t?"The GitHub CLI (gh) is required to connect your repository.":"Authenticate with GitHub to see PRs, repo info, and more."}),a.jsxs("div",{className:"space-y-3",children:[t&&a.jsxs("div",{className:"rounded border border-border bg-surface-light p-3",children:[a.jsx("h4",{className:"mb-1.5 text-xs font-medium",children:"1. Install GitHub CLI"}),a.jsxs("div",{className:"flex items-center gap-2 rounded bg-background px-3 py-2 font-mono text-xs",children:[a.jsx(Ut,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("code",{children:"brew install gh"})]}),a.jsxs("p",{className:"mt-1.5 text-xs text-muted-foreground",children:["Or visit"," ",a.jsxs("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 text-primary hover:underline",children:["cli.github.com ",a.jsx(ys,{className:"h-2.5 w-2.5"})]})]})]}),a.jsxs("div",{className:"rounded border border-border bg-surface-light p-3",children:[a.jsxs("h4",{className:"mb-1.5 text-xs font-medium",children:[t?"2":"1",". Authenticate"]}),a.jsxs("div",{className:"flex items-center gap-2 rounded bg-background px-3 py-2 font-mono text-xs",children:[a.jsx(Ut,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("code",{children:"gh auth login"})]})]})]})]})}function CP({prs:e}){return e.length===0?a.jsxs("div",{className:"py-4 text-center",children:[a.jsx(Wc,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground/50"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"No open pull requests."})]}):a.jsx("div",{className:"space-y-0.5",children:e.map(t=>a.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light group",children:[a.jsx(Wc,{className:"h-4 w-4 shrink-0 text-bid-green"}),a.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["#",t.number]}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:t.title}),a.jsx(Q,{variant:"outline",className:"shrink-0 text-xs font-normal",children:t.branch}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"→"}),a.jsx(Q,{variant:"outline",className:"shrink-0 text-xs font-normal",children:t.baseBranch}),t.scopeIds.map(n=>a.jsxs(Q,{variant:"secondary",className:"shrink-0 text-xs",children:["#",n]},n)),a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:t.author}),a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground/60",children:yn(new Date(t.createdAt),{addSuffix:!0})}),a.jsx(ys,{className:"h-3 w-3 shrink-0 text-muted-foreground/40 opacity-0 group-hover:opacity-100 transition-opacity"})]},t.number))})}function EP({github:e}){var l;const[t,n]=m.useState(!0),[r,s]=m.useState([]),i=m.useCallback(async()=>{if(e!=null&&e.connected)try{const c=await fetch("/api/orbital/github/prs");c.ok&&s(await c.json())}catch{}},[e==null?void 0:e.connected]);m.useEffect(()=>{t&&(e!=null&&e.connected)&&i()},[t,e==null?void 0:e.connected,i]);const o=((l=e==null?void 0:e.repo)==null?void 0:l.visibility)==="public"?t0:u0;return a.jsxs(Me,{className:"mt-6",children:[a.jsx(Ze,{className:"cursor-pointer select-none",onClick:()=>n(!t),children:a.jsxs(at,{className:"flex items-center gap-2 text-base",children:[t?a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(Zt,{className:"h-4 w-4 text-muted-foreground"}),a.jsx(Mh,{className:"h-4 w-4 text-primary"}),"GitHub",(e==null?void 0:e.connected)&&e.repo&&a.jsxs(Q,{variant:"secondary",className:"ml-1 text-xs gap-1",children:[a.jsx(o,{className:"h-2.5 w-2.5"}),e.repo.fullName]}),e!=null&&e.openPRs?a.jsxs(Q,{variant:"outline",className:"text-xs",children:[e.openPRs," open PR",e.openPRs!==1?"s":""]}):null]})}),t&&a.jsx(Fe,{children:!e||!e.connected?a.jsx(NP,{error:(e==null?void 0:e.error)??null}):a.jsxs("div",{className:"space-y-4",children:[e.repo&&a.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[a.jsx("span",{className:"text-muted-foreground",children:"Repository"}),a.jsx("a",{href:e.repo.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.repo.fullName}),a.jsx("span",{className:"text-muted-foreground",children:"Default branch"}),a.jsx("code",{className:"font-mono",children:e.repo.defaultBranch}),a.jsx("span",{className:"text-muted-foreground",children:"Visibility"}),a.jsxs("span",{className:"flex items-center gap-1 capitalize",children:[a.jsx(o,{className:"h-3 w-3"}),e.repo.visibility]}),e.authUser&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-muted-foreground",children:"Signed in as"}),a.jsx("span",{children:e.authUser})]})]}),a.jsxs("div",{className:"border-t border-border pt-3",children:[a.jsxs("h4",{className:"mb-2 flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[a.jsx(Oi,{className:"h-3 w-3"}),"Open Pull Requests"]}),a.jsx(CP,{prs:r})]})]})})]})}const TP={deploying:{icon:Li,color:"text-accent-blue",label:"Deploying",animate:"animate-spin"},healthy:{icon:xs,color:"text-bid-green",label:"Healthy"},failed:{icon:fi,color:"text-ask-red",label:"Failed"},"rolled-back":{icon:fi,color:"text-warning-amber",label:"Rolled Back"}},Fd=20;function AP(e){const t=new Map;for(const n of e){const r=n.started_at?Et(new Date(n.started_at),"yyyy-MM-dd"):"Unknown",s=t.get(r);s?s.push(n):t.set(r,[n])}return t}function PP(e){if(!e.started_at||!e.completed_at)return null;const t=new Date(e.completed_at).getTime()-new Date(e.started_at).getTime();return t<1e3?"<1s":t<6e4?`${Math.round(t/1e3)}s`:`${Math.round(t/6e4)}m`}function MP({deployments:e}){const[t,n]=m.useState(!1),r=t?e:e.slice(0,Fd),s=AP(r);return a.jsxs(Me,{children:[a.jsx(Ze,{children:a.jsxs(at,{className:"text-base",children:["Deployment History",a.jsx(Q,{variant:"secondary",className:"ml-2",children:e.length})]})}),a.jsx(Fe,{children:e.length===0?a.jsxs("div",{className:"py-8 text-center",children:[a.jsx(la,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground/50"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No deployments recorded yet."})]}):a.jsxs("div",{className:"space-y-4",children:[[...s.entries()].map(([i,o])=>a.jsxs("div",{children:[a.jsx("div",{className:"sticky top-0 z-10 bg-card pb-1 pt-0.5",children:a.jsx("span",{className:"text-xxs font-medium uppercase tracking-wider text-muted-foreground",children:i==="Unknown"?"Unknown date":Et(new Date(i),"EEEE, MMM d")})}),a.jsx("div",{className:"space-y-0.5",children:o.map(l=>{const c=TP[l.status],u=c.icon,d=PP(l);return a.jsxs("div",{className:"flex items-center gap-4 rounded px-2.5 py-1.5 transition-colors hover:bg-surface-light",children:[a.jsx(u,{className:I("h-4 w-4 shrink-0",c.color,c.animate)}),a.jsx(Q,{variant:"outline",className:"capitalize shrink-0",children:l.environment}),a.jsx("span",{className:"text-xs font-normal shrink-0",children:c.label}),l.commit_sha&&a.jsx("code",{className:"font-mono text-xs text-muted-foreground shrink-0",children:l.commit_sha.slice(0,7)}),l.branch&&a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:l.branch}),d&&a.jsx("span",{className:"font-mono text-xs text-muted-foreground/60 shrink-0",children:d}),a.jsx("span",{className:"ml-auto text-xs text-muted-foreground/60 shrink-0",children:l.started_at?yn(new Date(l.started_at),{addSuffix:!0}):"—"})]},l.id)})})]},i)),!t&&e.length>Fd&&a.jsxs("button",{onClick:()=>n(!0),className:"w-full rounded border border-border py-2 text-xs text-muted-foreground transition-colors hover:bg-surface-light hover:text-foreground",children:["Show all ",e.length," deployments"]})]})})]})}function _P(){const{overview:e,commits:t,branches:n,worktrees:r,github:s,drift:i,loading:o,loadMoreCommits:l,hasMoreCommits:c}=gP(),{deployments:u}=xP(),[d,f]=m.useState(!0);return o?a.jsx("div",{className:"flex h-64 items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[a.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[a.jsx(ar,{className:"h-4 w-4 text-primary"}),a.jsx("h1",{className:"text-xl font-light",children:"Repo"}),e&&a.jsx(Q,{variant:"secondary",children:e.currentBranch})]}),e&&a.jsx(yP,{overview:e,github:s}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[a.jsx(vP,{commits:t,branches:n,hasMore:c,onLoadMore:l}),a.jsx(SP,{branches:n,worktrees:r,drift:i,branchingMode:(e==null?void 0:e.branchingMode)??"trunk"})]}),a.jsx(EP,{github:s}),u.length>0&&a.jsx("div",{className:"mt-6",children:d?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>f(!1),className:"mb-2 flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(gn,{className:"h-4 w-4"}),a.jsx(la,{className:"h-4 w-4"}),"Deploy History"]}),a.jsx(MP,{deployments:u})]}):a.jsx(Me,{className:"cursor-pointer select-none",onClick:()=>f(!0),children:a.jsx(Ze,{children:a.jsxs(at,{className:"flex items-center gap-2 text-base",children:[a.jsx(Zt,{className:"h-4 w-4 text-muted-foreground"}),a.jsx(la,{className:"h-4 w-4 text-primary"}),"Deploy History",a.jsx(Q,{variant:"secondary",children:u.length})]})})})})]})}const dg=m.createContext({});function RP(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const rc=m.createContext(null),fg=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function DP(e=!0){const t=m.useContext(rc);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=m.useId();m.useEffect(()=>{e&&s(i)},[e]);const o=m.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const sc=typeof window<"u",OP=sc?m.useLayoutEffect:m.useEffect,bt=e=>e;let hg=bt;function ic(e){let t;return()=>(t===void 0&&(t=e()),t)}const dr=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},Jt=e=>e*1e3,Qt=e=>e/1e3,LP={useManualTiming:!1};function IP(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(o)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const Ys=["read","resolveKeyframes","update","preRender","render","postRender"],FP=40;function pg(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Ys.reduce((y,j)=>(y[j]=IP(i),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=o,p=()=>{const y=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(y-s.timestamp,FP),1),s.timestamp=y,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},g=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Ys.reduce((y,j)=>{const w=o[j];return y[j]=(E,T=!1,S=!1)=>(n||g(),w.schedule(E,T,S)),y},{}),cancel:y=>{for(let j=0;j<Ys.length;j++)o[Ys[j]].cancel(y)},state:s,steps:o}}const{schedule:_e,cancel:bn,state:Qe,steps:$o}=pg(typeof requestAnimationFrame<"u"?requestAnimationFrame:bt,!0),mg=m.createContext({strict:!1}),Bd={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},fr={};for(const e in Bd)fr[e]={isEnabled:t=>Bd[e].some(n=>!!t[n])};function BP(e){for(const t in e)fr[t]={...fr[t],...e[t]}}const zP=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Ei(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||zP.has(e)}let gg=e=>!Ei(e);function VP(e){e&&(gg=t=>t.startsWith("on")?!Ei(t):e(t))}try{VP(require("@emotion/is-prop-valid").default)}catch{}function $P(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(gg(s)||n===!0&&Ei(s)||!t&&!Ei(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function HP(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const to=m.createContext({});function fs(e){return typeof e=="string"||Array.isArray(e)}function no(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const oc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ac=["initial",...oc];function ro(e){return no(e.animate)||ac.some(t=>fs(e[t]))}function xg(e){return!!(ro(e)||e.variants)}function UP(e,t){if(ro(e)){const{initial:n,animate:r}=e;return{initial:n===!1||fs(n)?n:void 0,animate:fs(r)?r:void 0}}return e.inherit!==!1?t:{}}function WP(e){const{initial:t,animate:n}=UP(e,m.useContext(to));return m.useMemo(()=>({initial:t,animate:n}),[zd(t),zd(n)])}function zd(e){return Array.isArray(e)?e.join(" "):e}const qP=Symbol.for("motionComponentSymbol");function Jn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function GP(e,t,n){return m.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Jn(n)&&(n.current=r))},[t])}const lc=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),KP="framerAppearId",yg="data-"+lc(KP),{schedule:cc}=pg(queueMicrotask,!1),bg=m.createContext({});function YP(e,t,n,r,s){var i,o;const{visualElement:l}=m.useContext(to),c=m.useContext(mg),u=m.useContext(rc),d=m.useContext(fg).reducedMotion,f=m.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=m.useContext(bg);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&XP(f.current,n,s,p);const g=m.useRef(!1);m.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const x=n[yg],b=m.useRef(!!x&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,x))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,x)));return OP(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),cc.render(h.render),b.current&&h.animationState&&h.animationState.animateChanges())}),m.useEffect(()=>{h&&(!b.current&&h.animationState&&h.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,x)}),b.current=!1))}),h}function XP(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:vg(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&Jn(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function vg(e){if(e)return e.options.allowProjection!==!1?e.projection:vg(e.parent)}function JP({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&BP(e);function l(u,d){let f;const h={...m.useContext(fg),...u,layoutId:QP(u)},{isStatic:p}=h,g=WP(u),x=r(u,p);if(!p&&sc){ZP();const b=eM(h);f=b.MeasureLayout,g.visualElement=YP(s,x,h,t,b.ProjectionNode)}return a.jsxs(to.Provider,{value:g,children:[f&&g.visualElement?a.jsx(f,{visualElement:g.visualElement,...h}):null,n(s,u,GP(x,g.visualElement,d),x,p,g.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=m.forwardRef(l);return c[qP]=s,c}function QP({layoutId:e}){const t=m.useContext(dg).id;return t&&e!==void 0?t+"-"+e:e}function ZP(e,t){m.useContext(mg).strict}function eM(e){const{drag:t,layout:n}=fr;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const tM=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function uc(e){return typeof e!="string"||e.includes("-")?!1:!!(tM.indexOf(e)>-1||/[A-Z]/u.test(e))}function Vd(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function dc(e,t,n,r){if(typeof t=="function"){const[s,i]=Vd(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=Vd(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Ba=e=>Array.isArray(e),nM=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),rM=e=>Ba(e)?e[e.length-1]||0:e,ot=e=>!!(e&&e.getVelocity);function li(e){const t=ot(e)?e.get():e;return nM(t)?t.toValue():t}function sM({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:iM(r,s,i,e),renderState:t()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const wg=e=>(t,n)=>{const r=m.useContext(to),s=m.useContext(rc),i=()=>sM(e,t,r,s);return n?i():RP(i)};function iM(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=li(i[h]);let{initial:o,animate:l}=e;const c=ro(e),u=xg(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!no(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p<h.length;p++){const g=dc(e,h[p]);if(g){const{transitionEnd:x,transition:b,...y}=g;for(const j in y){let w=y[j];if(Array.isArray(w)){const E=d?w.length-1:0;w=w[E]}w!==null&&(s[j]=w)}for(const j in x)s[j]=x[j]}}}return s}const Cr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Un=new Set(Cr),kg=e=>t=>typeof t=="string"&&t.startsWith(e),jg=kg("--"),oM=kg("var(--"),fc=e=>oM(e)?aM.test(e.split("/*")[0].trim()):!1,aM=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Sg=(e,t)=>t&&typeof e=="number"?t.transform(e):e,nn=(e,t,n)=>n>t?t:n<e?e:n,Er={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},hs={...Er,transform:e=>nn(0,1,e)},Xs={...Er,default:1},Ts=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),fn=Ts("deg"),$t=Ts("%"),te=Ts("px"),lM=Ts("vh"),cM=Ts("vw"),$d={...$t,parse:e=>$t.parse(e)/100,transform:e=>$t.transform(e*100)},uM={borderWidth:te,borderTopWidth:te,borderRightWidth:te,borderBottomWidth:te,borderLeftWidth:te,borderRadius:te,radius:te,borderTopLeftRadius:te,borderTopRightRadius:te,borderBottomRightRadius:te,borderBottomLeftRadius:te,width:te,maxWidth:te,height:te,maxHeight:te,top:te,right:te,bottom:te,left:te,padding:te,paddingTop:te,paddingRight:te,paddingBottom:te,paddingLeft:te,margin:te,marginTop:te,marginRight:te,marginBottom:te,marginLeft:te,backgroundPositionX:te,backgroundPositionY:te},dM={rotate:fn,rotateX:fn,rotateY:fn,rotateZ:fn,scale:Xs,scaleX:Xs,scaleY:Xs,scaleZ:Xs,skew:fn,skewX:fn,skewY:fn,distance:te,translateX:te,translateY:te,translateZ:te,x:te,y:te,z:te,perspective:te,transformPerspective:te,opacity:hs,originX:$d,originY:$d,originZ:te},Hd={...Er,transform:Math.round},hc={...uM,...dM,zIndex:Hd,size:te,fillOpacity:hs,strokeOpacity:hs,numOctaves:Hd},fM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hM=Cr.length;function pM(e,t,n){let r="",s=!0;for(let i=0;i<hM;i++){const o=Cr[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=Sg(l,hc[o]);if(!c){s=!1;const d=fM[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function pc(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(Un.has(c)){o=!0;continue}else if(jg(c)){s[c]=u;continue}else{const d=Sg(u,hc[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=pM(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;r.transformOrigin=`${c} ${u} ${d}`}}const mM={offset:"stroke-dashoffset",array:"stroke-dasharray"},gM={offset:"strokeDashoffset",array:"strokeDasharray"};function xM(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?mM:gM;e[i.offset]=te.transform(-r);const o=te.transform(t),l=te.transform(n);e[i.array]=`${o} ${l}`}function Ud(e,t,n){return typeof e=="string"?e:te.transform(t+n*e)}function yM(e,t,n){const r=Ud(t,e.x,e.width),s=Ud(n,e.y,e.height);return`${r} ${s}`}function mc(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},d,f){if(pc(e,u,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:g}=e;h.transform&&(g&&(p.transform=h.transform),delete h.transform),g&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=yM(g,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&xM(h,o,l,c,!1)}const gc=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Ng=()=>({...gc(),attrs:{}}),xc=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Cg(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const Eg=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Tg(e,t,n,r){Cg(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(Eg.has(s)?s:lc(s),t.attrs[s])}const Ti={};function bM(e){Object.assign(Ti,e)}function Ag(e,{layout:t,layoutId:n}){return Un.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ti[e]||e==="opacity")}function yc(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(ot(s[o])||t.style&&ot(t.style[o])||Ag(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function Pg(e,t,n){const r=yc(e,t,n);for(const s in e)if(ot(e[s])||ot(t[s])){const i=Cr.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function vM(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Wd=["x","y","width","height","cx","cy","r"],wM={useVisualState:wg({scrapeMotionValuesFromProps:Pg,createRenderState:Ng,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const l in s)if(Un.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<Wd.length;l++){const c=Wd[l];e[c]!==t[c]&&(o=!0)}o&&_e.read(()=>{vM(n,r),_e.render(()=>{mc(r,s,xc(n.tagName),e.transformTemplate),Tg(n,r)})})}})},kM={useVisualState:wg({scrapeMotionValuesFromProps:yc,createRenderState:gc})};function Mg(e,t,n){for(const r in t)!ot(t[r])&&!Ag(r,n)&&(e[r]=t[r])}function jM({transformTemplate:e},t){return m.useMemo(()=>{const n=gc();return pc(n,t,e),Object.assign({},n.vars,n.style)},[t])}function SM(e,t){const n=e.style||{},r={};return Mg(r,n,e),Object.assign(r,jM(e,t)),r}function NM(e,t){const n={},r=SM(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function CM(e,t,n,r){const s=m.useMemo(()=>{const i=Ng();return mc(i,t,xc(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Mg(i,e.style,e),s.style={...i,...s.style}}return s}function EM(e=!1){return(n,r,s,{latestValues:i},o)=>{const c=(uc(n)?CM:NM)(r,i,o,n),u=$P(r,typeof n=="string",e),d=n!==m.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=m.useMemo(()=>ot(f)?f.get():f,[f]);return m.createElement(n,{...d,children:h})}}function TM(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...uc(r)?wM:kM,preloadedFeatures:e,useRender:EM(s),createVisualElement:t,Component:r};return JP(o)}}function _g(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function so(e,t,n){const r=e.getProps();return dc(r,t,n!==void 0?n:r.custom,e)}const AM=ic(()=>window.ScrollTimeline!==void 0);class PM{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t,n){const r=this.animations.map(s=>{if(AM()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class MM extends PM{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function bc(e,t){return e?e[t]||e.default||e:void 0}const za=2e4;function Rg(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<za;)t+=n,r=e.next(t);return t>=za?1/0:t}function vc(e){return typeof e=="function"}function qd(e,t){e.timeline=t,e.onfinish=null}const wc=e=>Array.isArray(e)&&typeof e[0]=="number",_M={linearEasing:void 0};function RM(e,t){const n=ic(e);return()=>{var r;return(r=_M[t])!==null&&r!==void 0?r:n()}}const Ai=RM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Dg=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=e(dr(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function Og(e){return!!(typeof e=="function"&&Ai()||!e||typeof e=="string"&&(e in Va||Ai())||wc(e)||Array.isArray(e)&&e.every(Og))}const Ur=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Va={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ur([0,.65,.55,1]),circOut:Ur([.55,0,1,.45]),backIn:Ur([.31,.01,.66,-.59]),backOut:Ur([.33,1.53,.69,.99])};function Lg(e,t){if(e)return typeof e=="function"&&Ai()?Dg(e,t):wc(e)?Ur(e):Array.isArray(e)?e.map(n=>Lg(n,t)||Va.easeOut):Va[e]}const _t={x:!1,y:!1};function Ig(){return _t.x||_t.y}function DM(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function Fg(e,t){const n=DM(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function Gd(e){return t=>{t.pointerType==="touch"||Ig()||e(t)}}function OM(e,t,n={}){const[r,s,i]=Fg(e,n),o=Gd(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=Gd(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}const Bg=(e,t)=>t?e===t?!0:Bg(e,t.parentElement):!1,kc=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,LM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function IM(e){return LM.has(e.tagName)||e.tabIndex!==-1}const Wr=new WeakSet;function Kd(e){return t=>{t.key==="Enter"&&e(t)}}function Ho(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const FM=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Kd(()=>{if(Wr.has(n))return;Ho(n,"down");const s=Kd(()=>{Ho(n,"up")}),i=()=>Ho(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Yd(e){return kc(e)&&!Ig()}function BM(e,t,n={}){const[r,s,i]=Fg(e,n),o=l=>{const c=l.currentTarget;if(!Yd(l)||Wr.has(c))return;Wr.add(c);const u=t(l),d=(p,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!Yd(p)||!Wr.has(c))&&(Wr.delete(c),typeof u=="function"&&u(p,{success:g}))},f=p=>{d(p,n.useGlobalTarget||Bg(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(l=>{!IM(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>FM(u,s),s)}),i}function zM(e){return e==="x"||e==="y"?_t[e]?null:(_t[e]=!0,()=>{_t[e]=!1}):_t.x||_t.y?null:(_t.x=_t.y=!0,()=>{_t.x=_t.y=!1})}const zg=new Set(["width","height","top","left","right","bottom",...Cr]);let ci;function VM(){ci=void 0}const Ht={now:()=>(ci===void 0&&Ht.set(Qe.isProcessing||LP.useManualTiming?Qe.timestamp:performance.now()),ci),set:e=>{ci=e,queueMicrotask(VM)}};function jc(e,t){e.indexOf(t)===-1&&e.push(t)}function Sc(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Nc{constructor(){this.subscriptions=[]}add(t){return jc(this.subscriptions,t),()=>Sc(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Vg(e,t){return t?e*(1e3/t):0}const Xd=30,$M=e=>!isNaN(parseFloat(e));class HM{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Ht.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Ht.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=$M(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Nc);const r=this.events[t].add(n);return t==="change"?()=>{r(),_e.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ht.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Xd)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Xd);return Vg(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ps(e,t){return new HM(e,t)}function UM(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ps(n))}function WM(e,t){const n=so(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=rM(i[o]);UM(e,o,l)}}function qM(e){return!!(ot(e)&&e.add)}function $a(e,t){const n=e.getValue("willChange");if(qM(n))return n.add(t)}function $g(e){return e.props[yg]}const Hg=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,GM=1e-7,KM=12;function YM(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=Hg(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>GM&&++l<KM);return o}function As(e,t,n,r){if(e===t&&n===r)return bt;const s=i=>YM(i,0,1,e,n);return i=>i===0||i===1?i:Hg(s(i),t,r)}const Ug=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Wg=e=>t=>1-e(1-t),qg=As(.33,1.53,.69,.99),Cc=Wg(qg),Gg=Ug(Cc),Kg=e=>(e*=2)<1?.5*Cc(e):.5*(2-Math.pow(2,-10*(e-1))),Ec=e=>1-Math.sin(Math.acos(e)),Yg=Wg(Ec),Xg=Ug(Ec),Jg=e=>/^0[^.\s]+$/u.test(e);function XM(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Jg(e):!0}const ns=e=>Math.round(e*1e5)/1e5,Tc=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function JM(e){return e==null}const QM=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ac=(e,t)=>n=>!!(typeof n=="string"&&QM.test(n)&&n.startsWith(e)||t&&!JM(n)&&Object.prototype.hasOwnProperty.call(n,t)),Qg=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Tc);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},ZM=e=>nn(0,255,e),Uo={...Er,transform:e=>Math.round(ZM(e))},Rn={test:Ac("rgb","red"),parse:Qg("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Uo.transform(e)+", "+Uo.transform(t)+", "+Uo.transform(n)+", "+ns(hs.transform(r))+")"};function e_(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Ha={test:Ac("#"),parse:e_,transform:Rn.transform},Qn={test:Ac("hsl","hue"),parse:Qg("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+$t.transform(ns(t))+", "+$t.transform(ns(n))+", "+ns(hs.transform(r))+")"},st={test:e=>Rn.test(e)||Ha.test(e)||Qn.test(e),parse:e=>Rn.test(e)?Rn.parse(e):Qn.test(e)?Qn.parse(e):Ha.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Rn.transform(e):Qn.transform(e)},t_=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function n_(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Tc))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(t_))===null||n===void 0?void 0:n.length)||0)>0}const Zg="number",ex="color",r_="var",s_="var(",Jd="${}",i_=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ms(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(i_,c=>(st.test(c)?(r.color.push(i),s.push(ex),n.push(st.parse(c))):c.startsWith(s_)?(r.var.push(i),s.push(r_),n.push(c)):(r.number.push(i),s.push(Zg),n.push(parseFloat(c))),++i,Jd)).split(Jd);return{values:n,split:l,indexes:r,types:s}}function tx(e){return ms(e).values}function nx(e){const{split:t,types:n}=ms(e),r=t.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=t[o],s[o]!==void 0){const l=n[o];l===Zg?i+=ns(s[o]):l===ex?i+=st.transform(s[o]):i+=s[o]}return i}}const o_=e=>typeof e=="number"?0:e;function a_(e){const t=tx(e);return nx(e)(t.map(o_))}const vn={test:n_,parse:tx,createTransformer:nx,getAnimatableNone:a_},l_=new Set(["brightness","contrast","saturate","opacity"]);function c_(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Tc)||[];if(!r)return e;const s=n.replace(r,"");let i=l_.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const u_=/\b([a-z-]*)\(.*?\)/gu,Ua={...vn,getAnimatableNone:e=>{const t=e.match(u_);return t?t.map(c_).join(" "):e}},d_={...hc,color:st,backgroundColor:st,outlineColor:st,fill:st,stroke:st,borderColor:st,borderTopColor:st,borderRightColor:st,borderBottomColor:st,borderLeftColor:st,filter:Ua,WebkitFilter:Ua},Pc=e=>d_[e];function rx(e,t){let n=Pc(e);return n!==Ua&&(n=vn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const f_=new Set(["auto","none","0"]);function h_(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!f_.has(i)&&ms(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=rx(n,s)}const Qd=e=>e===Er||e===te,Zd=(e,t)=>parseFloat(e.split(", ")[t]),ef=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return Zd(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?Zd(i[1],e):0}},p_=new Set(["x","y","z"]),m_=Cr.filter(e=>!p_.has(e));function g_(e){const t=[];return m_.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const hr={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:ef(4,13),y:ef(5,14)};hr.translateX=hr.x;hr.translateY=hr.y;const Dn=new Set;let Wa=!1,qa=!1;function sx(){if(qa){const e=Array.from(Dn).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=g_(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}qa=!1,Wa=!1,Dn.forEach(e=>e.complete()),Dn.clear()}function ix(){Dn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(qa=!0)})}function x_(){ix(),sx()}class Mc{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Dn.add(this),Wa||(Wa=!0,_e.read(ix),_e.resolveKeyframes(sx))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i<t.length;i++)if(t[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),s&&o===void 0&&s.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Dn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Dn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const ox=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),y_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function b_(e){const t=y_.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function ax(e,t,n=1){const[r,s]=b_(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return ox(o)?parseFloat(o):o}return fc(s)?ax(s,t,n+1):s}const lx=e=>t=>t.test(e),v_={test:e=>e==="auto",parse:e=>e},cx=[Er,te,$t,fn,cM,lM,v_],tf=e=>cx.find(lx(e));class ux extends Mc{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),fc(u))){const d=ax(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!zg.has(r)||t.length!==2)return;const[s,i]=t,o=tf(s),l=tf(i);if(o!==l)if(Qd(o)&&Qd(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)XM(t[s])&&r.push(s);r.length&&h_(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=hr[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=hr[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,u])=>{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const nf=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(vn.test(e)||e==="0")&&!e.startsWith("url("));function w_(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function k_(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=nf(s,t),l=nf(i,t);return!o||!l?!1:w_(e)||(n==="spring"||vc(n))&&r}const j_=e=>e!==null;function io(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(j_),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const S_=40;class dx{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ht.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>S_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&x_(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Ht.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!k_(t,r,s,i))if(o)this.options.duration=0;else{c&&c(io(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Re=(e,t,n)=>e+(t-e)*n;function Wo(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function N_({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=Wo(c,l,e+1/3),i=Wo(c,l,e),o=Wo(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Pi(e,t){return n=>n>0?t:e}const qo=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},C_=[Ha,Rn,Qn],E_=e=>C_.find(t=>t.test(e));function rf(e){const t=E_(e);if(!t)return!1;let n=t.parse(e);return t===Qn&&(n=N_(n)),n}const sf=(e,t)=>{const n=rf(e),r=rf(t);if(!n||!r)return Pi(e,t);const s={...n};return i=>(s.red=qo(n.red,r.red,i),s.green=qo(n.green,r.green,i),s.blue=qo(n.blue,r.blue,i),s.alpha=Re(n.alpha,r.alpha,i),Rn.transform(s))},T_=(e,t)=>n=>t(e(n)),Ps=(...e)=>e.reduce(T_),Ga=new Set(["none","hidden"]);function A_(e,t){return Ga.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function P_(e,t){return n=>Re(e,t,n)}function _c(e){return typeof e=="number"?P_:typeof e=="string"?fc(e)?Pi:st.test(e)?sf:R_:Array.isArray(e)?fx:typeof e=="object"?st.test(e)?sf:M_:Pi}function fx(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>_c(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function M_(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=_c(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function __(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],l=e.indexes[o][s[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const R_=(e,t)=>{const n=vn.createTransformer(t),r=ms(e),s=ms(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Ga.has(e)&&!s.values.length||Ga.has(t)&&!r.values.length?A_(e,t):Ps(fx(__(r,s),s.values),n):Pi(e,t)};function hx(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Re(e,t,n):_c(e)(e,t)}const D_=5;function px(e,t,n){const r=Math.max(t-D_,0);return Vg(n-e(r),t-r)}const Le={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Go=.001;function O_({duration:e=Le.duration,bounce:t=Le.bounce,velocity:n=Le.velocity,mass:r=Le.mass}){let s,i,o=1-t;o=nn(Le.minDamping,Le.maxDamping,o),e=nn(Le.minDuration,Le.maxDuration,Qt(e)),o<1?(s=u=>{const d=u*o,f=d*e,h=d-n,p=Ka(u,o),g=Math.exp(-f);return Go-h/p*g},i=u=>{const f=u*o*e,h=f*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,g=Math.exp(-f),x=Ka(Math.pow(u,2),o);return(-s(u)+Go>0?-1:1)*((h-p)*g)/x}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Go+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=I_(s,i,l);if(e=Jt(e),isNaN(c))return{stiffness:Le.stiffness,damping:Le.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const L_=12;function I_(e,t,n){let r=n;for(let s=1;s<L_;s++)r=r-e(r)/t(r);return r}function Ka(e,t){return e*Math.sqrt(1-t*t)}const F_=["duration","bounce"],B_=["stiffness","damping","mass"];function of(e,t){return t.some(n=>e[n]!==void 0)}function z_(e){let t={velocity:Le.velocity,stiffness:Le.stiffness,damping:Le.damping,mass:Le.mass,isResolvedFromDuration:!1,...e};if(!of(e,B_)&&of(e,F_))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*nn(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Le.mass,stiffness:s,damping:i}}else{const n=O_(e);t={...t,...n,mass:Le.mass},t.isResolvedFromDuration=!0}return t}function mx(e=Le.visualDuration,t=Le.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=z_({...n,velocity:-Qt(n.velocity||0)}),g=h||0,x=u/(2*Math.sqrt(c*d)),b=o-i,y=Qt(Math.sqrt(c/d)),j=Math.abs(b)<5;r||(r=j?Le.restSpeed.granular:Le.restSpeed.default),s||(s=j?Le.restDelta.granular:Le.restDelta.default);let w;if(x<1){const T=Ka(y,x);w=S=>{const A=Math.exp(-x*y*S);return o-A*((g+x*y*b)/T*Math.sin(T*S)+b*Math.cos(T*S))}}else if(x===1)w=T=>o-Math.exp(-y*T)*(b+(g+y*b)*T);else{const T=y*Math.sqrt(x*x-1);w=S=>{const A=Math.exp(-x*y*S),v=Math.min(T*S,300);return o-A*((g+x*y*b)*Math.sinh(v)+T*b*Math.cosh(v))/T}}const E={calculatedDuration:p&&f||null,next:T=>{const S=w(T);if(p)l.done=T>=f;else{let A=0;x<1&&(A=T===0?Jt(g):px(w,T,S));const v=Math.abs(A)<=r,M=Math.abs(o-S)<=s;l.done=v&&M}return l.value=l.done?o:S,l},toString:()=>{const T=Math.min(Rg(E),za),S=Dg(A=>E.next(T*A).value,T,30);return T+"ms "+S}};return E}function af({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=v=>l!==void 0&&v<l||c!==void 0&&v>c,g=v=>l===void 0?c:c===void 0||Math.abs(l-v)<Math.abs(c-v)?l:c;let x=n*t;const b=f+x,y=o===void 0?b:o(b);y!==b&&(x=y-f);const j=v=>-x*Math.exp(-v/r),w=v=>y+j(v),E=v=>{const M=j(v),N=w(v);h.done=Math.abs(M)<=u,h.value=h.done?y:N};let T,S;const A=v=>{p(h.value)&&(T=v,S=mx({keyframes:[h.value,g(h.value)],velocity:px(w,v,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return A(0),{calculatedDuration:null,next:v=>{let M=!1;return!S&&T===void 0&&(M=!0,E(v),A(v)),T!==void 0&&v>=T?S.next(v-T):(!M&&E(v),h)}}}const V_=As(.42,0,1,1),$_=As(0,0,.58,1),gx=As(.42,0,.58,1),H_=e=>Array.isArray(e)&&typeof e[0]!="number",U_={linear:bt,easeIn:V_,easeInOut:gx,easeOut:$_,circIn:Ec,circInOut:Xg,circOut:Yg,backIn:Cc,backInOut:Gg,backOut:qg,anticipate:Kg},lf=e=>{if(wc(e)){hg(e.length===4);const[t,n,r,s]=e;return As(t,n,r,s)}else if(typeof e=="string")return U_[e];return e};function W_(e,t,n){const r=[],s=n||hx,i=e.length-1;for(let o=0;o<i;o++){let l=s(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||bt:t;l=Ps(c,l)}r.push(l)}return r}function q_(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(hg(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=W_(t,r,s),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const h=dr(e[f],e[f+1],d);return l[f](h)};return n?d=>u(nn(e[0],e[i-1],d)):u}function G_(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=dr(0,t,r);e.push(Re(n,1,s))}}function K_(e){const t=[0];return G_(t,e.length-1),t}function Y_(e,t){return e.map(n=>n*t)}function X_(e,t){return e.map(()=>t||gx).splice(0,e.length-1)}function Mi({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=H_(r)?r.map(lf):lf(r),i={done:!1,value:t[0]},o=Y_(n&&n.length===t.length?n:K_(t),e),l=q_(o,t,{ease:Array.isArray(s)?s:X_(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const J_=e=>{const t=({timestamp:n})=>e(n);return{start:()=>_e.update(t,!0),stop:()=>bn(t),now:()=>Qe.isProcessing?Qe.timestamp:Ht.now()}},Q_={decay:af,inertia:af,tween:Mi,keyframes:Mi,spring:mx},Z_=e=>e/100;class Rc extends dx{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Mc,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=vc(n)?n:Q_[n]||Mi;let c,u;l!==Mi&&typeof t[0]!="number"&&(c=Ps(Z_,hx(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});i==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=Rg(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:v}=this.options;return{done:!0,value:v[v.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:g,repeatDelay:x,onUpdate:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),j=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let w=this.currentTime,E=i;if(p){const v=Math.min(this.currentTime,d)/f;let M=Math.floor(v),N=v%1;!N&&v>=1&&(N=1),N===1&&M--,M=Math.min(M,p+1),!!(M%2)&&(g==="reverse"?(N=1-N,x&&(N-=x/f)):g==="mirror"&&(E=o)),w=nn(0,1,N)*f}const T=j?{done:!1,value:c[0]}:E.next(w);l&&(T.value=l(T.value));let{done:S}=T;!j&&u!==null&&(S=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return A&&s!==void 0&&(T.value=io(c,this.options,s)),b&&b(T.value),A&&this.finish(),T}get duration(){const{resolved:t}=this;return t?Qt(t.calculatedDuration):0}get time(){return Qt(this.currentTime)}set time(t){t=Jt(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Qt(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=J_,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const eR=new Set(["opacity","clipPath","filter","transform"]);function tR(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=Lg(l,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const nR=ic(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),_i=10,rR=2e4;function sR(e){return vc(e.type)||e.type==="spring"||!Og(e.ease)}function iR(e,t){const n=new Rc({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&i<rR;)r=n.sample(i),s.push(r.value),i+=_i;return{times:void 0,keyframes:s,duration:i-_i,ease:"linear"}}const xx={anticipate:Kg,backInOut:Gg,circInOut:Xg};function oR(e){return e in xx}class cf extends dx{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new ux(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&Ai()&&oR(i)&&(i=xx[i]),sR(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:g,...x}=this.options,b=iR(t,x);t=b.keyframes,t.length===1&&(t[1]=t[0]),r=b.duration,s=b.times,i=b.ease,o="keyframes"}const d=tR(l.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(qd(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(io(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Qt(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Qt(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Jt(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return bt;const{animation:r}=n;qd(r,t)}return bt}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,g=new Rc({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),x=Jt(this.time);u.setWithVelocity(g.sample(x-_i).value,g.sample(x).value,_i)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return nR()&&r&&eR.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const aR={type:"spring",stiffness:500,damping:25,restSpeed:10},lR=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),cR={type:"keyframes",duration:.8},uR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dR=(e,{keyframes:t})=>t.length>2?cR:Un.has(e)?e.startsWith("scale")?lR(t[1]):aR:uR;function fR({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Dc=(e,t,n,r={},s,i)=>o=>{const l=bc(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Jt(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};fR(l)||(d={...d,...dR(e,d)}),d.duration&&(d.duration=Jt(d.duration)),d.repeatDelay&&(d.repeatDelay=Jt(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=io(d.keyframes,l);if(h!==void 0)return _e.update(()=>{d.onUpdate(h),d.onComplete()}),new MM([])}return!i&&cf.supports(d)?new cf(d):new Rc(d)};function hR({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function yx(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(o=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&hR(d,f))continue;const g={delay:n,...bc(o||{},f)};let x=!1;if(window.MotionHandoffAnimation){const y=$g(e);if(y){const j=window.MotionHandoffAnimation(y,f,_e);j!==null&&(g.startTime=j,x=!0)}}$a(e,f),h.start(Dc(f,h,p,e.shouldReduceMotion&&zg.has(f)?{type:!1}:g,e,x));const b=h.animation;b&&u.push(b)}return l&&Promise.all(u).then(()=>{_e.update(()=>{l&&WM(e,l)})}),u}function Ya(e,t,n={}){var r;const s=so(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(yx(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return pR(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[o,l]:[l,o];return u().then(()=>d())}else return Promise.all([o(),l(n.delay)])}function pR(e,t,n=0,r=0,s=1,i){const o=[],l=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(mR).forEach((u,d)=>{u.notify("AnimationStart",t),o.push(Ya(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function mR(e,t){return e.sortNodePosition(t)}function gR(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Ya(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Ya(e,t,n);else{const s=typeof t=="function"?so(e,t,n.custom):t;r=Promise.all(yx(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const xR=ac.length;function bx(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?bx(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<xR;n++){const r=ac[n],s=e.props[r];(fs(s)||s===!1)&&(t[r]=s)}return t}const yR=[...oc].reverse(),bR=oc.length;function vR(e){return t=>Promise.all(t.map(({animation:n,options:r})=>gR(e,n,r)))}function wR(e){let t=vR(e),n=uf(),r=!0;const s=c=>(u,d)=>{var f;const h=so(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...x}=h;u={...u,...x,...g}}return u};function i(c){t=c(e)}function o(c){const{props:u}=e,d=bx(e.parent)||{},f=[],h=new Set;let p={},g=1/0;for(let b=0;b<bR;b++){const y=yR[b],j=n[y],w=u[y]!==void 0?u[y]:d[y],E=fs(w),T=y===c?j.isActive:null;T===!1&&(g=b);let S=w===d[y]&&w!==u[y]&&E;if(S&&r&&e.manuallyAnimateOnMount&&(S=!1),j.protectedKeys={...p},!j.isActive&&T===null||!w&&!j.prevProp||no(w)||typeof w=="boolean")continue;const A=kR(j.prevProp,w);let v=A||y===c&&j.isActive&&!S&&E||b>g&&E,M=!1;const N=Array.isArray(w)?w:[w];let O=N.reduce(s(y),{});T===!1&&(O={});const{prevResolvedValues:P={}}=j,V={...P,...O},F=G=>{v=!0,h.has(G)&&(M=!0,h.delete(G)),j.needsAnimating[G]=!0;const H=e.getValue(G);H&&(H.liveStyle=!1)};for(const G in V){const H=O[G],L=P[G];if(p.hasOwnProperty(G))continue;let k=!1;Ba(H)&&Ba(L)?k=!_g(H,L):k=H!==L,k?H!=null?F(G):h.add(G):H!==void 0&&h.has(G)?F(G):j.protectedKeys[G]=!0}j.prevProp=w,j.prevResolvedValues=O,j.isActive&&(p={...p,...O}),r&&e.blockInitialAnimation&&(v=!1),v&&(!(S&&A)||M)&&f.push(...N.map(G=>({animation:G,options:{type:y}})))}if(h.size){const b={};h.forEach(y=>{const j=e.getBaseTarget(y),w=e.getValue(y);w&&(w.liveStyle=!0),b[y]=j??null}),f.push({animation:b})}let x=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,x?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=o(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=uf(),r=!0}}}function kR(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!_g(t,e):!1}function An(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function uf(){return{animate:An(!0),whileInView:An(),whileHover:An(),whileTap:An(),whileDrag:An(),whileFocus:An(),exit:An()}}class En{constructor(t){this.isMounted=!1,this.node=t}update(){}}class jR extends En{constructor(t){super(t),t.animationState||(t.animationState=wR(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();no(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let SR=0;class NR extends En{constructor(){super(...arguments),this.id=SR++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const CR={animation:{Feature:jR},exit:{Feature:NR}};function gs(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Ms(e){return{point:{x:e.pageX,y:e.pageY}}}const ER=e=>t=>kc(t)&&e(t,Ms(t));function rs(e,t,n,r){return gs(e,t,ER(n),r)}const df=(e,t)=>Math.abs(e-t);function TR(e,t){const n=df(e.x,t.x),r=df(e.y,t.y);return Math.sqrt(n**2+r**2)}class vx{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Yo(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=TR(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:g}=f,{timestamp:x}=Qe;this.history.push({...g,timestamp:x});const{onStart:b,onMove:y}=this.handlers;h||(b&&b(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Ko(h,this.transformPagePoint),_e.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Yo(f.type==="pointercancel"?this.lastMoveEventInfo:Ko(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,b),g&&g(f,b)},!kc(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Ms(t),l=Ko(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=Qe;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Yo(l,this.history)),this.removeListeners=Ps(rs(this.contextWindow,"pointermove",this.handlePointerMove),rs(this.contextWindow,"pointerup",this.handlePointerUp),rs(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),bn(this.updatePoint)}}function Ko(e,t){return t?{point:t(e.point)}:e}function ff(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Yo({point:e},t){return{point:e,delta:ff(e,wx(t)),offset:ff(e,AR(t)),velocity:PR(t,.1)}}function AR(e){return e[0]}function wx(e){return e[e.length-1]}function PR(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=wx(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Jt(t)));)n--;if(!r)return{x:0,y:0};const i=Qt(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const kx=1e-4,MR=1-kx,_R=1+kx,jx=.01,RR=0-jx,DR=0+jx;function vt(e){return e.max-e.min}function OR(e,t,n){return Math.abs(e-t)<=n}function hf(e,t,n,r=.5){e.origin=r,e.originPoint=Re(t.min,t.max,e.origin),e.scale=vt(n)/vt(t),e.translate=Re(n.min,n.max,e.origin)-e.originPoint,(e.scale>=MR&&e.scale<=_R||isNaN(e.scale))&&(e.scale=1),(e.translate>=RR&&e.translate<=DR||isNaN(e.translate))&&(e.translate=0)}function ss(e,t,n,r){hf(e.x,t.x,n.x,r?r.originX:void 0),hf(e.y,t.y,n.y,r?r.originY:void 0)}function pf(e,t,n){e.min=n.min+t.min,e.max=e.min+vt(t)}function LR(e,t,n){pf(e.x,t.x,n.x),pf(e.y,t.y,n.y)}function mf(e,t,n){e.min=t.min-n.min,e.max=e.min+vt(t)}function is(e,t,n){mf(e.x,t.x,n.x),mf(e.y,t.y,n.y)}function IR(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Re(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Re(n,e,r.max):Math.min(e,n)),e}function gf(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function FR(e,{top:t,left:n,bottom:r,right:s}){return{x:gf(e.x,n,s),y:gf(e.y,t,r)}}function xf(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function BR(e,t){return{x:xf(e.x,t.x),y:xf(e.y,t.y)}}function zR(e,t){let n=.5;const r=vt(e),s=vt(t);return s>r?n=dr(t.min,t.max-r,e.min):r>s&&(n=dr(e.min,e.max-s,t.min)),nn(0,1,n)}function VR(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Xa=.35;function $R(e=Xa){return e===!1?e=0:e===!0&&(e=Xa),{x:yf(e,"left","right"),y:yf(e,"top","bottom")}}function yf(e,t,n){return{min:bf(e,t),max:bf(e,n)}}function bf(e,t){return typeof e=="number"?e:e[t]||0}const vf=()=>({translate:0,scale:1,origin:0,originPoint:0}),Zn=()=>({x:vf(),y:vf()}),wf=()=>({min:0,max:0}),Be=()=>({x:wf(),y:wf()});function jt(e){return[e("x"),e("y")]}function Sx({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function HR({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function UR(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Xo(e){return e===void 0||e===1}function Ja({scale:e,scaleX:t,scaleY:n}){return!Xo(e)||!Xo(t)||!Xo(n)}function Mn(e){return Ja(e)||Nx(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Nx(e){return kf(e.x)||kf(e.y)}function kf(e){return e&&e!=="0%"}function Ri(e,t,n){const r=e-n,s=t*r;return n+s}function jf(e,t,n,r,s){return s!==void 0&&(e=Ri(e,s,r)),Ri(e,n,r)+t}function Qa(e,t=0,n=1,r,s){e.min=jf(e.min,t,n,r,s),e.max=jf(e.max,t,n,r,s)}function Cx(e,{x:t,y:n}){Qa(e.x,t.translate,t.scale,t.originPoint),Qa(e.y,n.translate,n.scale,n.originPoint)}const Sf=.999999999999,Nf=1.0000000000001;function WR(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&tr(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Cx(e,o)),r&&Mn(i.latestValues)&&tr(e,i.latestValues))}t.x<Nf&&t.x>Sf&&(t.x=1),t.y<Nf&&t.y>Sf&&(t.y=1)}function er(e,t){e.min=e.min+t,e.max=e.max+t}function Cf(e,t,n,r,s=.5){const i=Re(e.min,e.max,s);Qa(e,t,n,i,r)}function tr(e,t){Cf(e.x,t.x,t.scaleX,t.scale,t.originX),Cf(e.y,t.y,t.scaleY,t.scale,t.originY)}function Ex(e,t){return Sx(UR(e.getBoundingClientRect(),t))}function qR(e,t,n){const r=Ex(e,n),{scroll:s}=t;return s&&(er(r.x,s.offset.x),er(r.y,s.offset.y)),r}const Tx=({current:e})=>e?e.ownerDocument.defaultView:null,GR=new WeakMap;class KR{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Be(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ms(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:g}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=zM(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),jt(b=>{let y=this.getAxisMotionValue(b).get()||0;if($t.test(y)){const{projection:j}=this.visualElement;if(j&&j.layout){const w=j.layout.layoutBox[b];w&&(y=vt(w)*(parseFloat(y)/100))}}this.originPoint[b]=y}),g&&_e.postRender(()=>g(d,f)),$a(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:g,onDrag:x}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:b}=f;if(p&&this.currentDirection===null){this.currentDirection=YR(b),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,b),this.updateAxis("y",f.point,b),this.visualElement.render(),x&&x(d,f)},l=(d,f)=>this.stop(d,f),c=()=>jt(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new vx(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Tx(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&_e.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Js(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=IR(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&Jn(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=FR(s.layoutBox,n):this.constraints=!1,this.elastic=$R(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&jt(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=VR(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Jn(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=qR(r,s.root,this.visualElement.getTransformPagePoint());let o=BR(s.layout.layoutBox,i);if(n){const l=n(HR(o));this.hasMutatedConstraints=!!l,l&&(o=Sx(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=jt(d=>{if(!Js(d,n,this.currentDirection))return;let f=c&&c[d]||{};o&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return $a(this.visualElement,t),r.start(Dc(t,r,0,n,this.visualElement,!1))}stopAnimation(){jt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){jt(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){jt(n=>{const{drag:r}=this.getProps();if(!Js(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(t[n]-Re(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Jn(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};jt(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=zR({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),jt(o=>{if(!Js(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Re(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;GR.set(this.visualElement,this);const t=this.visualElement.current,n=rs(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Jn(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),_e.read(r);const o=gs(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(jt(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())}));return()=>{o(),n(),i(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Xa,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Js(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function YR(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class XR extends En{constructor(t){super(t),this.removeGroupControls=bt,this.removeListeners=bt,this.controls=new KR(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||bt}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ef=e=>(t,n)=>{e&&_e.postRender(()=>e(t,n))};class JR extends En{constructor(){super(...arguments),this.removePointerDownListener=bt}onPointerDown(t){this.session=new vx(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Tx(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Ef(t),onStart:Ef(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&_e.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=rs(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ui={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Tf(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const zr={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(te.test(e))e=parseFloat(e);else return e;const n=Tf(e,t.target.x),r=Tf(e,t.target.y);return`${n}% ${r}%`}},QR={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=vn.parse(e);if(s.length>5)return r;const i=vn.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=Re(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class ZR extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;bM(eD),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),ui.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||_e.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),cc.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Ax(e){const[t,n]=DP(),r=m.useContext(dg);return a.jsx(ZR,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(bg),isPresent:t,safeToRemove:n})}const eD={borderRadius:{...zr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:zr,borderTopRightRadius:zr,borderBottomLeftRadius:zr,borderBottomRightRadius:zr,boxShadow:QR};function tD(e,t,n){const r=ot(e)?e:ps(e);return r.start(Dc("",r,t,n)),r.animation}function nD(e){return e instanceof SVGElement&&e.tagName!=="svg"}const rD=(e,t)=>e.depth-t.depth;class sD{constructor(){this.children=[],this.isDirty=!1}add(t){jc(this.children,t),this.isDirty=!0}remove(t){Sc(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(rD),this.isDirty=!1,this.children.forEach(t)}}function iD(e,t){const n=Ht.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(bn(r),e(i-t))};return _e.read(r,!0),()=>bn(r)}const Px=["TopLeft","TopRight","BottomLeft","BottomRight"],oD=Px.length,Af=e=>typeof e=="string"?parseFloat(e):e,Pf=e=>typeof e=="number"||te.test(e);function aD(e,t,n,r,s,i){s?(e.opacity=Re(0,n.opacity!==void 0?n.opacity:1,lD(r)),e.opacityExit=Re(t.opacity!==void 0?t.opacity:1,0,cD(r))):i&&(e.opacity=Re(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<oD;o++){const l=`border${Px[o]}Radius`;let c=Mf(t,l),u=Mf(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||Pf(c)===Pf(u)?(e[l]=Math.max(Re(Af(c),Af(u),r),0),($t.test(u)||$t.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=Re(t.rotate||0,n.rotate||0,r))}function Mf(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const lD=Mx(0,.5,Yg),cD=Mx(.5,.95,bt);function Mx(e,t,n){return r=>r<e?0:r>t?1:n(dr(e,t,r))}function _f(e,t){e.min=t.min,e.max=t.max}function kt(e,t){_f(e.x,t.x),_f(e.y,t.y)}function Rf(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Df(e,t,n,r,s){return e-=t,e=Ri(e,1/n,r),s!==void 0&&(e=Ri(e,1/s,r)),e}function uD(e,t=0,n=1,r=.5,s,i=e,o=e){if($t.test(t)&&(t=parseFloat(t),t=Re(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Re(i.min,i.max,r);e===i&&(l-=t),e.min=Df(e.min,t,n,l,s),e.max=Df(e.max,t,n,l,s)}function Of(e,t,[n,r,s],i,o){uD(e,t[n],t[r],t[s],t.scale,i,o)}const dD=["x","scaleX","originX"],fD=["y","scaleY","originY"];function Lf(e,t,n,r){Of(e.x,t,dD,n?n.x:void 0,r?r.x:void 0),Of(e.y,t,fD,n?n.y:void 0,r?r.y:void 0)}function If(e){return e.translate===0&&e.scale===1}function _x(e){return If(e.x)&&If(e.y)}function Ff(e,t){return e.min===t.min&&e.max===t.max}function hD(e,t){return Ff(e.x,t.x)&&Ff(e.y,t.y)}function Bf(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Rx(e,t){return Bf(e.x,t.x)&&Bf(e.y,t.y)}function zf(e){return vt(e.x)/vt(e.y)}function Vf(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class pD{constructor(){this.members=[]}add(t){jc(this.members,t),t.scheduleRender()}remove(t){if(Sc(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function mD(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const _n={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},qr=typeof window<"u"&&window.MotionDebug!==void 0,Jo=["","X","Y","Z"],gD={visibility:"hidden"},$f=1e3;let xD=0;function Qo(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Dx(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=$g(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",_e,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Dx(r)}function Ox({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=xD++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,qr&&(_n.totalNodes=_n.resolvedTargetDeltas=_n.recalculatedProjection=0),this.nodes.forEach(vD),this.nodes.forEach(ND),this.nodes.forEach(CD),this.nodes.forEach(wD),qr&&window.MotionDebug.record(_n)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new sD)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Nc),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=nD(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),e){let f;const h=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=iD(h,250),ui.hasAnimatedSinceResize&&(ui.hasAnimatedSinceResize=!1,this.nodes.forEach(Uf))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||MD,{onLayoutAnimationStart:b,onLayoutAnimationComplete:y}=d.getProps(),j=!this.targetLayout||!Rx(this.targetLayout,g)||p,w=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||w||h&&(j||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,w);const E={...bc(x,"layout"),onPlay:b,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E)}else h||Uf(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,bn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ED),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Dx(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Hf);return}this.isUpdating||this.nodes.forEach(jD),this.isUpdating=!1,this.nodes.forEach(SD),this.nodes.forEach(yD),this.nodes.forEach(bD),this.clearAllSnapshots();const l=Ht.now();Qe.delta=nn(0,1e3/60,l-Qe.timestamp),Qe.timestamp=l,Qe.isProcessing=!0,$o.update.process(Qe),$o.preRender.process(Qe),$o.render.process(Qe),Qe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,cc.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(kD),this.sharedNodes.forEach(TD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,_e.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){_e.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Be(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!_x(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&(l||Mn(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),_D(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return Be();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(RD))){const{scroll:d}=this.root;d&&(er(c.x,d.offset.x),er(c.y,d.offset.y))}return c}removeElementScroll(o){var l;const c=Be();if(kt(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:h}=d;d!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&kt(c,o),er(c.x,f.offset.x),er(c.y,f.offset.y))}return c}applyTransform(o,l=!1){const c=Be();kt(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&tr(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Mn(d.latestValues)&&tr(c,d.latestValues)}return Mn(this.latestValues)&&tr(c,this.latestValues),c}removeTransform(o){const l=Be();kt(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Mn(u.latestValues))continue;Ja(u.latestValues)&&u.updateSnapshot();const d=Be(),f=u.measurePageBox();kt(d,f),Lf(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Mn(this.latestValues)&&Lf(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Qe.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:h}=this.options;if(!(!this.layout||!(f||h))){if(this.resolvedRelativeTargetAt=Qe.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Be(),this.relativeTargetOrigin=Be(),is(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),kt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Be(),this.targetWithTransforms=Be()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),LR(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):kt(this.target,this.layout.layoutBox),Cx(this.target,this.targetDelta)):kt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Be(),this.relativeTargetOrigin=Be(),is(this.relativeTargetOrigin,this.target,p.target),kt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}qr&&_n.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Ja(this.parent.latestValues)||Nx(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Qe.timestamp&&(u=!1),u)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;kt(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;WR(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Be());const{target:g}=l;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Rf(this.prevProjectionDelta.x,this.projectionDelta.x),Rf(this.prevProjectionDelta.y,this.projectionDelta.y)),ss(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!Vf(this.projectionDelta.x,this.prevProjectionDelta.x)||!Vf(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g)),qr&&_n.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Zn(),this.projectionDelta=Zn(),this.projectionDeltaWithTransform=Zn()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=Zn();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=Be(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=p!==g,b=this.getStack(),y=!b||b.members.length<=1,j=!!(x&&!y&&this.options.crossfade===!0&&!this.path.some(PD));this.animationProgress=0;let w;this.mixTargetDelta=E=>{const T=E/1e3;Wf(f.x,o.x,T),Wf(f.y,o.y,T),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(is(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),AD(this.relativeTarget,this.relativeTargetOrigin,h,T),w&&hD(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Be()),kt(w,this.relativeTarget)),x&&(this.animationValues=d,aD(d,u,this.latestValues,T,j,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(bn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_e.update(()=>{ui.hasAnimatedSinceResize=!0,this.currentAnimation=tD(0,$f,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta($f),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&Lx(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Be();const f=vt(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=vt(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}kt(l,c),tr(l,d),ss(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new pD),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Qo("z",o,u,this.animationValues);for(let d=0;d<Jo.length;d++)Qo(`rotate${Jo[d]}`,o,u,this.animationValues),Qo(`skew${Jo[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return gD;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=li(o==null?void 0:o.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const x={};return this.options.layoutId&&(x.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,x.pointerEvents=li(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Mn(this.latestValues)&&(x.transform=d?d({},""):"none",this.hasProjected=!1),x}const h=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=mD(this.projectionDeltaWithTransform,this.treeScale,h),d&&(u.transform=d(h,u.transform));const{x:p,y:g}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${g.origin*100}% 0`,f.animationValues?u.opacity=f===this?(c=(l=h.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:u.opacity=f===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const x in Ti){if(h[x]===void 0)continue;const{correct:b,applyTo:y}=Ti[x],j=u.transform==="none"?h[x]:b(h[x],f);if(y){const w=y.length;for(let E=0;E<w;E++)u[y[E]]=j}else u[x]=j}return this.options.layoutId&&(u.pointerEvents=f===this?li(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Hf),this.root.sharedNodes.clear()}}}function yD(e){e.updateLayout()}function bD(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?jt(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=vt(h);h.min=r[f].min,h.max=h.min+p}):Lx(i,n.layoutBox,r)&&jt(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=vt(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Zn();ss(l,r,n.layoutBox);const c=Zn();o?ss(c,e.applyTransform(s,!0),n.measuredBox):ss(c,r,n.layoutBox);const u=!_x(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const g=Be();is(g,n.layoutBox,h.layoutBox);const x=Be();is(x,r,p.layoutBox),Rx(g,x)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function vD(e){qr&&_n.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function wD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function kD(e){e.clearSnapshot()}function Hf(e){e.clearMeasurements()}function jD(e){e.isLayoutDirty=!1}function SD(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Uf(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ND(e){e.resolveTargetDelta()}function CD(e){e.calcProjection()}function ED(e){e.resetSkewAndRotation()}function TD(e){e.removeLeadSnapshot()}function Wf(e,t,n){e.translate=Re(t.translate,0,n),e.scale=Re(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function qf(e,t,n,r){e.min=Re(t.min,n.min,r),e.max=Re(t.max,n.max,r)}function AD(e,t,n,r){qf(e.x,t.x,n.x,r),qf(e.y,t.y,n.y,r)}function PD(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const MD={duration:.45,ease:[.4,0,.1,1]},Gf=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Kf=Gf("applewebkit/")&&!Gf("chrome/")?Math.round:bt;function Yf(e){e.min=Kf(e.min),e.max=Kf(e.max)}function _D(e){Yf(e.x),Yf(e.y)}function Lx(e,t,n){return e==="position"||e==="preserve-aspect"&&!OR(zf(t),zf(n),.2)}function RD(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const DD=Ox({attachResizeListener:(e,t)=>gs(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Zo={current:void 0},Ix=Ox({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Zo.current){const e=new DD({});e.mount(window),e.setOptions({layoutScroll:!0}),Zo.current=e}return Zo.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),OD={pan:{Feature:JR},drag:{Feature:XR,ProjectionNode:Ix,MeasureLayout:Ax}};function Xf(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&_e.postRender(()=>i(t,Ms(t)))}class LD extends En{mount(){const{current:t}=this.node;t&&(this.unmount=OM(t,n=>(Xf(this.node,n,"Start"),r=>Xf(this.node,r,"End"))))}unmount(){}}class ID extends En{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ps(gs(this.node.current,"focus",()=>this.onFocus()),gs(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Jf(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&_e.postRender(()=>i(t,Ms(t)))}class FD extends En{mount(){const{current:t}=this.node;t&&(this.unmount=BM(t,n=>(Jf(this.node,n,"Start"),(r,{success:s})=>Jf(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Za=new WeakMap,ea=new WeakMap,BD=e=>{const t=Za.get(e.target);t&&t(e)},zD=e=>{e.forEach(BD)};function VD({root:e,...t}){const n=e||document;ea.has(n)||ea.set(n,{});const r=ea.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(zD,{root:e,...t})),r[s]}function $D(e,t,n){const r=VD(t);return Za.set(e,n),r.observe(e),()=>{Za.delete(e),r.unobserve(e)}}const HD={some:0,all:1};class UD extends En{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:HD[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return $D(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(WD(t,n))&&this.startObserver()}unmount(){}}function WD({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const qD={inView:{Feature:UD},tap:{Feature:FD},focus:{Feature:ID},hover:{Feature:LD}},GD={layout:{ProjectionNode:Ix,MeasureLayout:Ax}},el={current:null},Fx={current:!1};function KD(){if(Fx.current=!0,!!sc)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>el.current=e.matches;e.addListener(t),t()}else el.current=!1}const YD=[...cx,st,vn],XD=e=>YD.find(lx(e)),Qf=new WeakMap;function JD(e,t,n){for(const r in t){const s=t[r],i=n[r];if(ot(s))e.addValue(r,s);else if(ot(i))e.addValue(r,ps(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,ps(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Zf=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class QD{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Mc,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Ht.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,_e.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:d}=o;this.onUpdate=d,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=ro(n),this.isVariantNode=xg(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:f,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in h){const g=h[p];c[p]!==void 0&&ot(g)&&g.set(c[p],!1)}}mount(t){this.current=t,Qf.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),Fx.current||KD(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:el.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Qf.delete(this.current),this.projection&&this.projection.unmount(),bn(this.notifyUpdate),bn(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Un.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&_e.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in fr){const n=fr[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Be()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Zf.length;r++){const s=Zf[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=t[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=JD(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=ps(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(ox(s)||Jg(s))?s=parseFloat(s):!XD(s)&&vn.test(n)&&(s=rx(t,n)),this.setBaseTarget(t,ot(s)?s.get():s)),ot(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=dc(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ot(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Nc),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class Bx extends QD{constructor(){super(...arguments),this.KeyframeResolver=ux}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ot(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function ZD(e){return window.getComputedStyle(e)}class e3 extends Bx{constructor(){super(...arguments),this.type="html",this.renderInstance=Cg}readValueFromInstance(t,n){if(Un.has(n)){const r=Pc(n);return r&&r.default||0}else{const r=ZD(t),s=(jg(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Ex(t,n)}build(t,n,r){pc(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return yc(t,n,r)}}class t3 extends Bx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Be}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Un.has(n)){const r=Pc(n);return r&&r.default||0}return n=Eg.has(n)?n:lc(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Pg(t,n,r)}build(t,n,r){mc(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){Tg(t,n,r,s)}mount(t){this.isSVGTag=xc(t.tagName),super.mount(t)}}const n3=(e,t)=>uc(e)?new t3(t):new e3(t,{allowProjection:e!==m.Fragment}),r3=TM({...CR,...qD,...OD,...GD},n3),eh=HP(r3),s3={show:{transition:{staggerChildren:.04}}},i3={hidden:{opacity:0,y:10},show:{opacity:1,y:0,transition:{type:"spring",stiffness:300,damping:25}}},o3={createScope:"Created",reviewScope:"Reviewed",implementScope:"Implemented",verifyScope:"Verified",reviewGate:"Review Gate",fixReview:"Fix Review",commit:"Committed",pushToMain:"Pushed to Main",pushToDev:"Pushed to Dev",pushToStaging:"PR to Staging",pushToProduction:"PR to Production"};function zx(e){return o3[e]??e}function a3(){const[e,t]=m.useState([]),[n,r]=m.useState(!0),[s,i]=m.useState(null),[o,l]=m.useState(null),[c,u]=m.useState(!1),[d,f]=m.useState(!1);kn();const h=m.useRef(!1),p=m.useCallback(async b=>{i(b),l(null),u(!0);try{const y=await fetch(`/api/orbital/sessions/${b.id}/content`);y.ok&&l(await y.json())}catch{}finally{u(!1)}},[]),g=m.useCallback(async()=>{try{const b=await fetch("/api/orbital/sessions");b.ok&&t(await b.json())}catch{}finally{r(!1)}},[]);m.useEffect(()=>{g()},[g]),m.useEffect(()=>{!h.current&&e.length>0&&(h.current=!0,p(e[0]))},[e,p]),m.useEffect(()=>{const b=()=>g();return Z.on("session:updated",b),()=>{Z.off("session:updated",b)}},[g]);const x=m.useCallback(async()=>{const b=o==null?void 0:o.claude_session_id;if(!(!s||!b)){f(!0);try{await fetch(`/api/orbital/sessions/${s.id}/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({claude_session_id:b})})}catch{}finally{setTimeout(()=>f(!1),2e3)}}},[s,o]);return n?a.jsx("div",{className:"flex h-64 items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):a.jsxs("div",{className:"flex flex-1 min-h-0 flex-col",children:[a.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[a.jsx(Yr,{className:"h-4 w-4 text-primary"}),a.jsx("h1",{className:"text-xl font-light",children:"Sessions"}),a.jsxs(Q,{variant:"secondary",children:[e.length," sessions"]})]}),e.length===0?a.jsx("div",{className:"flex flex-1 items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Yr,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground/30"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No session history yet. Sessions are recorded from handoff files."})]})}):a.jsxs("div",{className:"flex flex-1 gap-0 overflow-hidden rounded-lg border border-border/50",children:[a.jsx("div",{className:"w-[40%] border-r border-border/50 overflow-hidden",children:a.jsx(Tt,{className:"h-full",children:a.jsxs("div",{className:"relative p-3",children:[a.jsx("div",{className:"absolute left-6 top-3 bottom-3 w-px bg-border"}),a.jsx(eh.div,{className:"space-y-1",variants:s3,initial:"hidden",animate:"show",children:e.map(b=>a.jsx(eh.div,{variants:i3,children:a.jsx(l3,{session:b,isSelected:(s==null?void 0:s.id)===b.id,neonGlass:!0,onClick:()=>p(b)})},b.id))})]})})}),a.jsx("div",{className:"w-[60%] overflow-hidden",children:s?a.jsx(c3,{session:s,detail:o,loading:c,resuming:d,onResume:x}):a.jsx("div",{className:"flex h-full items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx(Yr,{className:"mx-auto mb-3 h-10 w-10 text-muted-foreground/30"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a session to view details"})]})})})]})]})}function l3({session:e,isSelected:t,neonGlass:n,onClick:r}){var l;const s=e.scope_ids,i=Array.isArray(e.discoveries)?e.discoveries:[],o=Array.isArray(e.next_steps)?e.next_steps:[];return a.jsxs("div",{className:"relative pl-8 cursor-pointer",onClick:r,children:[a.jsx("div",{className:I("absolute left-1.5 top-3 h-2.5 w-2.5 rounded-full border-2",t?"border-primary bg-primary":"border-muted-foreground/40 bg-background",n&&"timeline-dot-glow glow-blue")}),a.jsxs("div",{className:I("rounded-md px-3 py-2 transition-colors",t?"bg-primary/10 border border-primary/30":"hover:bg-muted/50"),children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.started_at&&a.jsx("span",{className:"text-xxs text-muted-foreground",children:Et(new Date(e.started_at),"MMM d")}),s.slice(0,3).map(c=>a.jsx(Q,{variant:"outline",className:"font-mono text-xxs px-1 py-0",children:dt(c)},c)),s.length>3&&a.jsxs("span",{className:"text-xxs text-muted-foreground",children:["+",s.length-3]}),(l=e.actions)==null?void 0:l.slice(0,2).map(c=>a.jsx(Q,{variant:"secondary",className:"text-xxs px-1 py-0 font-light",children:zx(c)},c))]}),a.jsx("p",{className:I("mt-0.5 text-xs font-normal truncate",t?"text-foreground":"text-foreground/80"),children:e.summary?tl(e.summary,80):"Untitled Session"}),a.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xxs text-muted-foreground",children:[i.length>0&&a.jsxs("span",{className:"text-bid-green",children:[i.length," completed"]}),o.length>0&&a.jsxs("span",{className:"text-accent-blue",children:[o.length," next"]})]})]})]})}function c3({session:e,detail:t,loading:n,resuming:r,onResume:s}){var h;const i=e.scope_ids,o=Array.isArray(e.discoveries)?e.discoveries:[],l=Array.isArray(e.next_steps)?e.next_steps:[],c=(t==null?void 0:t.meta)??null,u=!!(t!=null&&t.claude_session_id),d=(c==null?void 0:c.summary)??e.summary??null,f=[];return i.length>0&&f.push(["Scopes",i.map(p=>dt(p)).join(", ")]),((h=e.actions)==null?void 0:h.length)>0&&f.push(["Actions",e.actions.map(zx).join(", ")]),e.summary&&f.push(["Summary",tl(e.summary,200)]),f.push(["Started",e.started_at?Et(new Date(e.started_at),"MMM d, h:mm a"):"—"]),f.push(["Ended",e.ended_at?Et(new Date(e.ended_at),"MMM d, h:mm a"):"—"]),c!=null&&c.branch&&c.branch!=="unknown"&&f.push(["Branch",c.branch,"font-mono text-xxs"]),c&&c.fileSize>0&&f.push(["File size",d3(c.fileSize)]),c&&f.push(["Plan",c.slug,"text-muted-foreground",`/api/orbital/open-file?path=scopes/${c.slug}.md`]),e.handoff_file&&f.push(["Handoff",e.handoff_file,"font-mono text-xxs"]),t!=null&&t.claude_session_id&&f.push(["Session ID",t.claude_session_id,"font-mono text-xxs text-muted-foreground"]),a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsxs("div",{className:"px-5 pt-4 pb-3",children:[a.jsxs("p",{className:"text-xxs text-muted-foreground",children:[e.started_at&&Et(new Date(e.started_at),"MMM d, yyyy — h:mm a"),i.length>0&&i.slice(0,4).map(p=>a.jsx("span",{className:"ml-1.5",children:a.jsx(Q,{variant:"outline",className:"font-mono text-xxs",children:dt(p)})},p)),i.length>4&&a.jsxs("span",{className:"ml-1 text-xxs",children:["+",i.length-4]})]}),a.jsx("h2",{className:"mt-1 text-sm font-light",children:d?tl(d,120):"Untitled Session"})]}),a.jsx(Xt,{}),a.jsx(Tt,{className:"flex-1",children:a.jsx("div",{className:"px-5 py-4",children:n?a.jsx("div",{className:"flex h-20 items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):a.jsxs(a.Fragment,{children:[a.jsxs("table",{className:"w-full table-fixed text-xs",children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:"w-28"}),a.jsx("col",{})]}),a.jsx("tbody",{className:"[&_td]:border-b [&_td]:border-border/30 [&_td]:py-2 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap [&_td:last-child]:break-all",children:f.map(([p,g,x,b])=>a.jsxs("tr",{children:[a.jsx("td",{children:p}),a.jsx("td",{className:x,children:b?a.jsxs("button",{onClick:()=>{fetch(b,{method:"POST"})},className:"inline-flex items-center gap-1.5 hover:text-accent-blue transition-colors",title:"Open file",children:[g,a.jsx(ys,{className:"h-3 w-3 opacity-50"})]}):g})]},p))})]}),a.jsx(th,{title:"Completed",items:o,color:"text-bid-green"}),a.jsx(th,{title:"Next Steps",items:l,color:"text-accent-blue"}),(t==null?void 0:t.stats)&&a.jsx(u3,{stats:t.stats}),e.handoff_file&&a.jsxs("div",{className:"mt-4 flex items-center gap-1.5 text-xxs text-muted-foreground/60",children:[a.jsx(ia,{className:"h-3 w-3"}),a.jsx("span",{className:"truncate",children:e.handoff_file})]})]})})}),!n&&a.jsxs("div",{className:"border-t border-border/50 px-5 py-3",children:[a.jsxs(fe,{className:"w-full",disabled:!u||r,onClick:s,title:u?"Open in iTerm":"No Claude Code session found",children:[a.jsx(Ut,{className:"mr-2 h-4 w-4"}),r?"Opening iTerm...":"Resume Session"]}),!u&&a.jsx("p",{className:"mt-1.5 text-center text-xxs text-muted-foreground",children:"No matching Claude Code session found"})]})]})}function u3({stats:e}){const{user:t,assistant:n,system:r,timing:s}=e,i=Object.entries(n.toolsUsed).sort((o,l)=>l[1]-o[1]);return a.jsxs("div",{className:"mt-5 space-y-4",children:[a.jsx(Xt,{}),a.jsxs(Vr,{title:"Timing",children:[s.durationMs>0&&a.jsx(ze,{label:"Duration",value:nh(s.durationMs)}),s.firstTimestamp&&a.jsx(ze,{label:"First event",value:Et(new Date(s.firstTimestamp),"MMM d, h:mm:ss a")}),s.lastTimestamp&&a.jsx(ze,{label:"Last event",value:Et(new Date(s.lastTimestamp),"MMM d, h:mm:ss a")})]}),a.jsxs(Vr,{title:"User",children:[a.jsx(ze,{label:"Messages",value:`${t.totalMessages-t.metaMessages-t.toolResults} direct, ${t.metaMessages} meta, ${t.toolResults} tool results`}),t.commands.length>0&&a.jsx(ze,{label:"Commands",value:t.commands.join(", "),cls:"font-mono"}),t.permissionModes.length>0&&a.jsx(ze,{label:"Permission modes",value:t.permissionModes.join(", ")}),t.version&&a.jsx(ze,{label:"Claude Code version",value:t.version,cls:"font-mono"}),t.cwd&&a.jsx(ze,{label:"Working directory",value:t.cwd,cls:"font-mono text-xxs"})]}),a.jsxs(Vr,{title:"Assistant",children:[a.jsx(ze,{label:"Responses",value:String(n.totalMessages)}),n.models.length>0&&a.jsx(ze,{label:"Models",value:n.models.join(", "),cls:"font-mono"}),a.jsx(ze,{label:"Input tokens",value:Qs(n.totalInputTokens)}),a.jsx(ze,{label:"Output tokens",value:Qs(n.totalOutputTokens)}),n.totalCacheReadTokens>0&&a.jsx(ze,{label:"Cache read tokens",value:Qs(n.totalCacheReadTokens)}),n.totalCacheCreationTokens>0&&a.jsx(ze,{label:"Cache creation tokens",value:Qs(n.totalCacheCreationTokens)}),i.length>0&&a.jsxs("tr",{children:[a.jsx("td",{className:"pr-3 text-muted-foreground whitespace-nowrap align-top",children:"Tools used"}),a.jsx("td",{children:a.jsx("div",{className:"flex flex-wrap gap-1",children:i.map(([o,l])=>a.jsxs(Q,{variant:"outline",className:"font-mono text-xxs px-1.5 py-0",children:[o," ",a.jsx("span",{className:"ml-1 text-muted-foreground",children:l})]},o))})})]})]}),r.totalMessages>0&&a.jsxs(Vr,{title:"System",children:[a.jsx(ze,{label:"Events",value:String(r.totalMessages)}),r.subtypes.length>0&&a.jsx(ze,{label:"Subtypes",value:r.subtypes.join(", ")}),r.stopReasons.length>0&&a.jsx(ze,{label:"Stop reasons",value:r.stopReasons.join(", ")}),r.totalDurationMs>0&&a.jsx(ze,{label:"Total processing",value:nh(r.totalDurationMs)}),r.hookCount>0&&a.jsx(ze,{label:"Hooks fired",value:`${r.hookCount}${r.hookErrors>0?` (${r.hookErrors} errors)`:""}`})]}),a.jsx(Vr,{title:"Raw Counts",children:Object.entries(e.typeCounts).sort((o,l)=>l[1]-o[1]).map(([o,l])=>a.jsx(ze,{label:o,value:String(l)},o))})]})}function Vr({title:e,children:t}){return a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-xxs font-medium uppercase tracking-wider text-foreground",children:e}),a.jsxs("table",{className:"w-full table-fixed text-xs",children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:"w-40"}),a.jsx("col",{})]}),a.jsx("tbody",{className:"[&_td]:border-b [&_td]:border-border/20 [&_td]:py-1.5 [&_td]:align-top [&_td:first-child]:pr-3 [&_td:first-child]:text-muted-foreground [&_td:first-child]:whitespace-nowrap",children:t})]})]})}function ze({label:e,value:t,cls:n}){return a.jsxs("tr",{children:[a.jsx("td",{children:e}),a.jsx("td",{className:n,children:t})]})}function th({title:e,items:t,color:n}){return t.length===0?null:a.jsxs("div",{className:"mt-5",children:[a.jsx("h4",{className:"mb-2 text-xxs font-medium uppercase tracking-wider text-foreground",children:e}),a.jsx("ul",{className:"space-y-1.5",children:t.map((r,s)=>a.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[a.jsx("span",{className:I("mt-0.5",n),children:"•"}),a.jsx("span",{children:r})]},s))})]})}function tl(e,t){return e.length>t?e.slice(0,t)+"...":e}function d3(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function nh(e){if(e<1e3)return`${e}ms`;const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;if(n<60)return`${n}m ${r}s`;const s=Math.floor(n/60),i=n%60;return`${s}h ${i}m`}function Qs(e){return e.toLocaleString()}function Zs({checked:e,onCheckedChange:t,disabled:n}){return a.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:n,onClick:()=>t(!e),className:I("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-200",e?"border-[rgba(0,188,212,0.4)] bg-[rgba(0,188,212,0.25)]":"border-[rgba(255,255,255,0.1)] bg-[rgba(255,255,255,0.05)]",n&&"cursor-not-allowed opacity-40"),children:a.jsx("span",{className:I("pointer-events-none block h-3.5 w-3.5 rounded-full transition-all duration-200",e?"translate-x-[18px] bg-[rgb(0,188,212)] shadow-[0_0_8px_rgba(0,188,212,0.5)]":"translate-x-[2px] bg-[rgba(255,255,255,0.4)]")})})}const f3={monospace:"Monospace","sans-serif":"Sans-Serif",display:"Display"},h3=["monospace","sans-serif","display"];function p3(){const{settings:e,updateSetting:t}=fl();m.useEffect(()=>{Y0()},[]);const n=()=>{const s=Math.max(.8,Math.round((e.fontScale-.05)*100)/100);t("fontScale",s)},r=()=>{const s=Math.min(1.3,Math.round((e.fontScale+.05)*100)/100);t("fontScale",s)};return a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex items-center gap-3 px-2 pb-4",children:[a.jsx(Lh,{className:"h-5 w-5 text-muted-foreground"}),a.jsx("h1",{className:"text-lg font-medium tracking-wide",children:"Settings"})]}),a.jsx(Tt,{className:"flex-1",children:a.jsxs("div",{className:"flex flex-col gap-6 pr-4 pb-8",children:[a.jsxs("section",{className:"card-glass rounded-xl p-5",children:[a.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-muted-foreground mb-5",children:"Appearance"}),a.jsxs("div",{className:"mb-5",children:[a.jsx("label",{className:"text-xs text-muted-foreground mb-3 block",children:"Font Family"}),h3.map(s=>{const i=dl.filter(o=>o.category===s);return a.jsxs("div",{className:"mb-4 last:mb-0",children:[a.jsx("span",{className:"text-xxs uppercase tracking-widest text-muted-foreground/60 mb-2 block",children:f3[s]}),a.jsx("div",{className:"grid grid-cols-2 gap-2 xl:grid-cols-3",children:i.map(o=>a.jsxs("button",{onClick:()=>t("fontFamily",o.family),className:I("group relative flex flex-col items-start rounded-lg border px-3 py-2.5 text-left transition-all duration-200",e.fontFamily===o.family?"border-[rgba(0,188,212,0.5)] bg-[rgba(0,188,212,0.08)] shadow-[0_0_12px_rgba(0,188,212,0.15)]":"border-[rgba(255,255,255,0.06)] bg-[rgba(255,255,255,0.02)] hover:border-[rgba(255,255,255,0.12)] hover:bg-[rgba(255,255,255,0.04)]"),children:[a.jsx("span",{className:"text-sm text-foreground truncate w-full",style:{fontFamily:`'${o.family}', ${s==="monospace"?"monospace":"sans-serif"}`},children:o.label}),a.jsx("span",{className:"text-xs text-muted-foreground/50 mt-0.5",style:{fontFamily:`'${o.family}', ${s==="monospace"?"monospace":"sans-serif"}`},children:"Aa Bb 0123"})]},o.family))})]},s)})]}),a.jsx(Xt,{className:"my-4"}),a.jsx($r,{label:"Font Size",description:"Scale text across the dashboard",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:n,disabled:e.fontScale<=.8,className:"flex h-7 w-7 items-center justify-center rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] text-muted-foreground transition-colors hover:border-[rgba(0,188,212,0.3)] hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed",children:a.jsx(f0,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"w-12 text-center text-sm tabular-nums",children:[Math.round(e.fontScale*100),"%"]}),a.jsx("button",{onClick:r,disabled:e.fontScale>=1.3,className:"flex h-7 w-7 items-center justify-center rounded-md border border-[rgba(255,255,255,0.08)] bg-[rgba(255,255,255,0.03)] text-muted-foreground transition-colors hover:border-[rgba(0,188,212,0.3)] hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed",children:a.jsx(In,{className:"h-3.5 w-3.5"})})]})}),a.jsx(Xt,{className:"my-4"}),a.jsx($r,{label:"Reduce Motion",description:"Disable animations and transitions",children:a.jsx(Zs,{checked:e.reduceMotion,onCheckedChange:s=>t("reduceMotion",s)})}),a.jsx(Xt,{className:"my-4"}),a.jsx($r,{label:"Background Effects",description:"Animated orbs and grid overlay",children:a.jsx(Zs,{checked:e.showBackgroundEffects,onCheckedChange:s=>t("showBackgroundEffects",s)})})]}),a.jsxs("section",{className:"card-glass rounded-xl p-5",children:[a.jsx("h2",{className:"text-sm font-medium uppercase tracking-wider text-muted-foreground mb-5",children:"Display"}),a.jsx($r,{label:"Status Bar",description:"Scope progress bar at bottom",children:a.jsx(Zs,{checked:e.showStatusBar,onCheckedChange:s=>t("showStatusBar",s)})}),a.jsx(Xt,{className:"my-4"}),a.jsx($r,{label:"Compact Mode",description:"Reduce spacing for denser layout",children:a.jsx(Zs,{checked:e.compactMode,onCheckedChange:s=>t("compactMode",s)})})]})]})})]})}function $r({label:e,description:t,children:n}){return a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-sm text-foreground",children:e}),a.jsx("div",{className:"text-xs text-muted-foreground/60",children:t})]}),a.jsx("div",{className:"flex-shrink-0",children:n})]})}const m3=m.lazy(()=>Ay(()=>import("./WorkflowVisualizer-BZ21PIIF.js"),__vite__mapDeps([0,1,2,3,4])));function g3(){return a.jsx(xy,{children:a.jsx(lb,{children:a.jsx(yy,{children:a.jsxs(Kt,{element:a.jsx(Sw,{}),children:[a.jsx(Kt,{index:!0,element:a.jsx(j5,{})}),a.jsx(Kt,{path:"primitives",element:a.jsx(X5,{})}),a.jsx(Kt,{path:"gates",element:a.jsx(rP,{})}),a.jsx(Kt,{path:"enforcement",element:a.jsx(by,{to:"/gates",replace:!0})}),a.jsx(Kt,{path:"repo",element:a.jsx(_P,{})}),a.jsx(Kt,{path:"sessions",element:a.jsx(a3,{})}),a.jsx(Kt,{path:"workflow",element:a.jsx(m.Suspense,{fallback:a.jsx("div",{className:"flex h-64 items-center justify-center",children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent"})}),children:a.jsx(m3,{})})}),a.jsx(Kt,{path:"settings",element:a.jsx(p3,{})})]})})})})}Cy.createRoot(document.getElementById("root")).render(a.jsx(Ie.StrictMode,{children:a.jsx(Fh,{children:a.jsx(J0,{children:a.jsx(Kv,{children:a.jsx(g3,{})})})})}));export{El as $,mr as A,Di as B,Eh as C,Ib as D,Oi as E,zw as F,xn as G,Nl as H,gi as I,Bn as J,Ne as K,Li as L,f0 as M,wr as N,k3 as O,Rh as P,kl as Q,Fn as R,L0 as S,wn as T,ks as U,yp as V,ga as W,mt as X,Op as Y,Fi as Z,j3 as _,al as a,Wi as a0,r0 as a1,Lh as a2,H0 as a3,fi as a4,wt as a5,yl as a6,q5 as a7,W0 as a8,Dh as a9,t0 as b,q as c,Ut as d,xs as e,gn as f,ep as g,Ii as h,N0 as i,In as j,Nn as k,rn as l,$n as m,kr as n,jr as o,Tt as p,Yr as q,ll as r,Zt as s,ys as t,sl as u,gb as v,I1 as w,Ui as x,en as y,S3 as z};