profclaw 2.0.0 → 2.3.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 (477) hide show
  1. package/.env.example +14 -2
  2. package/CHANGELOG.md +37 -0
  3. package/CONTRIBUTING.md +20 -0
  4. package/Dockerfile +39 -23
  5. package/README.md +174 -40
  6. package/dist/agents/agent-summary.d.ts +44 -0
  7. package/dist/agents/agent-summary.js +176 -0
  8. package/dist/agents/auto-memory.d.ts +59 -0
  9. package/dist/agents/auto-memory.js +310 -0
  10. package/dist/agents/checkpoint-manager.d.ts +76 -0
  11. package/dist/agents/checkpoint-manager.js +156 -0
  12. package/dist/agents/circuit-breaker.d.ts +54 -0
  13. package/dist/agents/circuit-breaker.js +153 -0
  14. package/dist/agents/context-compactor.d.ts +70 -0
  15. package/dist/agents/context-compactor.js +361 -0
  16. package/dist/agents/conversation-branch.d.ts +55 -0
  17. package/dist/agents/conversation-branch.js +115 -0
  18. package/dist/agents/error-recovery.d.ts +44 -0
  19. package/dist/agents/error-recovery.js +197 -0
  20. package/dist/agents/events.d.ts +76 -0
  21. package/dist/agents/events.js +8 -0
  22. package/dist/agents/executor.d.ts +35 -1
  23. package/dist/agents/executor.js +573 -124
  24. package/dist/agents/file-snapshots.d.ts +72 -0
  25. package/dist/agents/file-snapshots.js +182 -0
  26. package/dist/agents/index.d.ts +2 -0
  27. package/dist/agents/orchestrator.d.ts +183 -0
  28. package/dist/agents/orchestrator.js +495 -0
  29. package/dist/agents/permissions.d.ts +63 -0
  30. package/dist/agents/permissions.js +138 -0
  31. package/dist/agents/plan-mode.d.ts +71 -0
  32. package/dist/agents/plan-mode.js +186 -0
  33. package/dist/agents/prompt-suggestions.d.ts +33 -0
  34. package/dist/agents/prompt-suggestions.js +208 -0
  35. package/dist/agents/rate-limit-monitor.d.ts +56 -0
  36. package/dist/agents/rate-limit-monitor.js +224 -0
  37. package/dist/agents/result-store.d.ts +37 -0
  38. package/dist/agents/result-store.js +104 -0
  39. package/dist/agents/session-diff.d.ts +43 -0
  40. package/dist/agents/session-diff.js +258 -0
  41. package/dist/agents/tool-loader.d.ts +65 -0
  42. package/dist/agents/tool-loader.js +273 -0
  43. package/dist/agents/transcript.d.ts +96 -0
  44. package/dist/agents/transcript.js +267 -0
  45. package/dist/agents/worktree-manager.d.ts +80 -0
  46. package/dist/agents/worktree-manager.js +203 -0
  47. package/dist/auth/middleware.js +14 -0
  48. package/dist/chat/agentic-executor.d.ts +7 -0
  49. package/dist/chat/agentic-executor.js +253 -30
  50. package/dist/chat/conversations.d.ts +2 -0
  51. package/dist/chat/conversations.js +8 -0
  52. package/dist/chat/execution/executor.d.ts +8 -0
  53. package/dist/chat/execution/executor.js +157 -103
  54. package/dist/chat/execution/index.js +5 -1
  55. package/dist/chat/execution/tool-router.js +40 -14
  56. package/dist/chat/execution/tools/canvas.d.ts +2 -2
  57. package/dist/chat/execution/tools/code-tools.d.ts +66 -0
  58. package/dist/chat/execution/tools/code-tools.js +353 -0
  59. package/dist/chat/execution/tools/complete-task.d.ts +2 -2
  60. package/dist/chat/execution/tools/cron-tool.d.ts +26 -10
  61. package/dist/chat/execution/tools/cron-tool.js +48 -3
  62. package/dist/chat/execution/tools/decompose-task.d.ts +58 -0
  63. package/dist/chat/execution/tools/decompose-task.js +166 -0
  64. package/dist/chat/execution/tools/exec.d.ts +5 -2
  65. package/dist/chat/execution/tools/exec.js +294 -155
  66. package/dist/chat/execution/tools/feed-tools.d.ts +77 -0
  67. package/dist/chat/execution/tools/feed-tools.js +142 -0
  68. package/dist/chat/execution/tools/file-ops.d.ts +1 -1
  69. package/dist/chat/execution/tools/github.d.ts +2 -2
  70. package/dist/chat/execution/tools/index.d.ts +14 -2
  71. package/dist/chat/execution/tools/index.js +86 -12
  72. package/dist/chat/execution/tools/integrations.d.ts +8 -8
  73. package/dist/chat/execution/tools/multi-patch.d.ts +53 -0
  74. package/dist/chat/execution/tools/multi-patch.js +373 -0
  75. package/dist/chat/execution/tools/openai-image-gen.d.ts +2 -2
  76. package/dist/chat/execution/tools/plan-tools.d.ts +80 -0
  77. package/dist/chat/execution/tools/plan-tools.js +134 -0
  78. package/dist/chat/execution/tools/profclaw-ops.d.ts +6 -6
  79. package/dist/chat/execution/tools/repl-tool.d.ts +46 -0
  80. package/dist/chat/execution/tools/repl-tool.js +207 -0
  81. package/dist/chat/execution/tools/sessions-send.d.ts +2 -2
  82. package/dist/chat/execution/tools/slack-actions.d.ts +2 -2
  83. package/dist/chat/execution/tools/system.d.ts +4 -4
  84. package/dist/chat/execution/tools/todo-tool.d.ts +72 -0
  85. package/dist/chat/execution/tools/todo-tool.js +152 -0
  86. package/dist/chat/execution/tools/tool-search.d.ts +50 -0
  87. package/dist/chat/execution/tools/tool-search.js +155 -0
  88. package/dist/chat/execution/types.d.ts +21 -14
  89. package/dist/chat/execution/workflows/executor.d.ts +11 -0
  90. package/dist/chat/execution/workflows/executor.js +99 -1
  91. package/dist/chat/execution/workflows/types.d.ts +35 -2
  92. package/dist/chat/format/index.d.ts +1 -0
  93. package/dist/chat/format/index.js +1 -0
  94. package/dist/chat/format/markdown-convert.d.ts +23 -0
  95. package/dist/chat/format/markdown-convert.js +149 -0
  96. package/dist/chat/index.d.ts +1 -1
  97. package/dist/chat/index.js +1 -1
  98. package/dist/chat/message-handler.js +58 -6
  99. package/dist/chat/proactive/index.d.ts +62 -0
  100. package/dist/chat/proactive/index.js +147 -0
  101. package/dist/chat/prompt-adapter.js +2 -0
  102. package/dist/chat/providers/irc/index.d.ts +2 -2
  103. package/dist/chat/providers/telegram/index.d.ts +2 -0
  104. package/dist/chat/providers/telegram/index.js +21 -2
  105. package/dist/chat/system-prompts.d.ts +3 -3
  106. package/dist/chat/system-prompts.js +116 -61
  107. package/dist/chat/tools.d.ts +6 -6
  108. package/dist/cli/commands/auth.js +64 -1
  109. package/dist/cli/commands/chat.js +1327 -138
  110. package/dist/cli/commands/doctor.js +222 -16
  111. package/dist/cli/commands/history.d.ts +3 -0
  112. package/dist/cli/commands/history.js +138 -0
  113. package/dist/cli/commands/import.d.ts +44 -0
  114. package/dist/cli/commands/import.js +526 -0
  115. package/dist/cli/commands/init.d.ts +13 -0
  116. package/dist/cli/commands/init.js +381 -0
  117. package/dist/cli/commands/onboard.js +210 -30
  118. package/dist/cli/commands/plan.d.ts +13 -0
  119. package/dist/cli/commands/plan.js +184 -0
  120. package/dist/cli/commands/serve.d.ts +7 -0
  121. package/dist/cli/commands/serve.js +77 -18
  122. package/dist/cli/commands/setup.js +84 -3
  123. package/dist/cli/commands/status.js +54 -0
  124. package/dist/cli/commands/tools.js +13 -13
  125. package/dist/cli/commands/tui.js +26 -1
  126. package/dist/cli/index.js +19 -0
  127. package/dist/cli/ink/App.d.ts +13 -0
  128. package/dist/cli/ink/App.js +6 -0
  129. package/dist/cli/ink/ChatApp.d.ts +60 -0
  130. package/dist/cli/ink/ChatApp.js +325 -0
  131. package/dist/cli/ink/DashboardApp.d.ts +3 -0
  132. package/dist/cli/ink/DashboardApp.js +143 -0
  133. package/dist/cli/ink/components/AgentStatus.d.ts +17 -0
  134. package/dist/cli/ink/components/AgentStatus.js +33 -0
  135. package/dist/cli/ink/components/ChannelList.d.ts +17 -0
  136. package/dist/cli/ink/components/ChannelList.js +33 -0
  137. package/dist/cli/ink/components/ConnectionStatus.d.ts +19 -0
  138. package/dist/cli/ink/components/ConnectionStatus.js +50 -0
  139. package/dist/cli/ink/components/CostBar.d.ts +19 -0
  140. package/dist/cli/ink/components/CostBar.js +35 -0
  141. package/dist/cli/ink/components/HookStatus.d.ts +15 -0
  142. package/dist/cli/ink/components/HookStatus.js +7 -0
  143. package/dist/cli/ink/components/PermissionPrompt.d.ts +21 -0
  144. package/dist/cli/ink/components/PermissionPrompt.js +51 -0
  145. package/dist/cli/ink/components/PlanView.d.ts +23 -0
  146. package/dist/cli/ink/components/PlanView.js +26 -0
  147. package/dist/cli/ink/components/ProviderList.d.ts +16 -0
  148. package/dist/cli/ink/components/ProviderList.js +16 -0
  149. package/dist/cli/ink/components/SessionHeader.d.ts +15 -0
  150. package/dist/cli/ink/components/SessionHeader.js +15 -0
  151. package/dist/cli/ink/components/StreamingMessage.d.ts +20 -0
  152. package/dist/cli/ink/components/StreamingMessage.js +27 -0
  153. package/dist/cli/ink/components/SuggestionBar.d.ts +15 -0
  154. package/dist/cli/ink/components/SuggestionBar.js +28 -0
  155. package/dist/cli/ink/components/SystemHealth.d.ts +20 -0
  156. package/dist/cli/ink/components/SystemHealth.js +39 -0
  157. package/dist/cli/ink/components/TaskList.d.ts +17 -0
  158. package/dist/cli/ink/components/TaskList.js +59 -0
  159. package/dist/cli/ink/components/ToolCall.d.ts +17 -0
  160. package/dist/cli/ink/components/ToolCall.js +43 -0
  161. package/dist/cli/ink/index.d.ts +23 -0
  162. package/dist/cli/ink/index.js +15 -0
  163. package/dist/cli/ink/keybindings.d.ts +35 -0
  164. package/dist/cli/ink/keybindings.js +105 -0
  165. package/dist/cli/ink/markdown-renderer.d.ts +47 -0
  166. package/dist/cli/ink/markdown-renderer.js +380 -0
  167. package/dist/cli/ink/output-styles.d.ts +39 -0
  168. package/dist/cli/ink/output-styles.js +119 -0
  169. package/dist/cli/interactive/auto-serve.d.ts +38 -0
  170. package/dist/cli/interactive/auto-serve.js +209 -0
  171. package/dist/cli/interactive/index.d.ts +25 -0
  172. package/dist/cli/interactive/index.js +23 -0
  173. package/dist/cli/interactive/picker.d.ts +28 -0
  174. package/dist/cli/interactive/picker.js +153 -0
  175. package/dist/cli/interactive/renderer.d.ts +26 -0
  176. package/dist/cli/interactive/renderer.js +555 -0
  177. package/dist/cli/interactive/repl.d.ts +14 -0
  178. package/dist/cli/interactive/repl.js +1516 -0
  179. package/dist/cli/interactive/stream-client.d.ts +59 -0
  180. package/dist/cli/interactive/stream-client.js +506 -0
  181. package/dist/cli/interactive/types.d.ts +121 -0
  182. package/dist/cli/interactive/types.js +10 -0
  183. package/dist/cli/utils/api.d.ts +9 -0
  184. package/dist/cli/utils/api.js +58 -2
  185. package/dist/cron/natural-language.d.ts +54 -0
  186. package/dist/cron/natural-language.js +569 -0
  187. package/dist/cron/scheduler.d.ts +34 -4
  188. package/dist/cron/scheduler.js +141 -9
  189. package/dist/cron/templates.d.ts +1 -1
  190. package/dist/cron/templates.js +219 -0
  191. package/dist/feeds/feed-engine.d.ts +149 -0
  192. package/dist/feeds/feed-engine.js +600 -0
  193. package/dist/feeds/index.d.ts +9 -0
  194. package/dist/feeds/index.js +8 -0
  195. package/dist/gateway/router.js +6 -1
  196. package/dist/hooks/built-in/audit-log.d.ts +11 -0
  197. package/dist/hooks/built-in/audit-log.js +84 -0
  198. package/dist/hooks/built-in/cost-warning.d.ts +10 -0
  199. package/dist/hooks/built-in/cost-warning.js +59 -0
  200. package/dist/hooks/built-in/dangerous-tool.d.ts +32 -0
  201. package/dist/hooks/built-in/dangerous-tool.js +80 -0
  202. package/dist/hooks/built-in/index.d.ts +14 -0
  203. package/dist/hooks/built-in/index.js +20 -0
  204. package/dist/hooks/index.d.ts +3 -0
  205. package/dist/hooks/index.js +6 -0
  206. package/dist/hooks/loader.d.ts +17 -0
  207. package/dist/hooks/loader.js +142 -0
  208. package/dist/hooks/registry.d.ts +62 -0
  209. package/dist/hooks/registry.js +127 -0
  210. package/dist/integrations/web-search.js +6 -3
  211. package/dist/memory/index.d.ts +1 -0
  212. package/dist/memory/index.js +2 -0
  213. package/dist/memory/memory-service.js +14 -13
  214. package/dist/memory/observational.d.ts +62 -0
  215. package/dist/memory/observational.js +396 -0
  216. package/dist/middleware/content-filter.d.ts +22 -0
  217. package/dist/middleware/content-filter.js +69 -0
  218. package/dist/middleware/request-validator.d.ts +159 -0
  219. package/dist/middleware/request-validator.js +93 -0
  220. package/dist/plugins/sdk.d.ts +22 -0
  221. package/dist/plugins/sdk.js +17 -1
  222. package/dist/projects/types.d.ts +10 -10
  223. package/dist/providers/ai-sdk.d.ts +11 -0
  224. package/dist/providers/ai-sdk.js +78 -19
  225. package/dist/providers/core/models.js +67 -1
  226. package/dist/providers/core/types.d.ts +3 -0
  227. package/dist/providers/index.d.ts +1 -0
  228. package/dist/providers/index.js +1 -0
  229. package/dist/providers/smart-router.d.ts +118 -0
  230. package/dist/providers/smart-router.js +685 -0
  231. package/dist/providers/types.d.ts +16 -16
  232. package/dist/routes/agents.js +50 -0
  233. package/dist/routes/auth.js +8 -1
  234. package/dist/routes/chat.js +259 -14
  235. package/dist/routes/costs.js +32 -0
  236. package/dist/routes/cron.js +80 -5
  237. package/dist/routes/feeds.d.ts +10 -0
  238. package/dist/routes/feeds.js +168 -0
  239. package/dist/routes/mcp.js +21 -0
  240. package/dist/routes/memory.js +130 -0
  241. package/dist/routes/skills.js +129 -0
  242. package/dist/routes/teams.d.ts +9 -0
  243. package/dist/routes/teams.js +210 -0
  244. package/dist/routes/tools.js +14 -0
  245. package/dist/routes/users.js +2 -0
  246. package/dist/server/route-loader.js +3 -1
  247. package/dist/server/stream-bridge.d.ts +19 -0
  248. package/dist/server/stream-bridge.js +38 -0
  249. package/dist/server.js +310 -36
  250. package/dist/skills/marketplace.d.ts +87 -0
  251. package/dist/skills/marketplace.js +268 -0
  252. package/dist/storage/index.d.ts +14 -0
  253. package/dist/storage/index.js +64 -3
  254. package/dist/storage/schema.d.ts +4 -4
  255. package/dist/storage/schema.js +1 -1
  256. package/dist/teams/index.d.ts +110 -0
  257. package/dist/teams/index.js +365 -0
  258. package/dist/tickets/types.d.ts +39 -39
  259. package/dist/types/summary.d.ts +5 -5
  260. package/dist/utils/auto-update.d.ts +23 -0
  261. package/dist/utils/auto-update.js +157 -0
  262. package/dist/utils/offline-detect.d.ts +55 -0
  263. package/dist/utils/offline-detect.js +121 -0
  264. package/dist/utils/pid-file.d.ts +36 -0
  265. package/dist/utils/pid-file.js +125 -0
  266. package/dist/utils/prevent-sleep.d.ts +27 -0
  267. package/dist/utils/prevent-sleep.js +95 -0
  268. package/dist/utils/sanitizer.d.ts +57 -0
  269. package/dist/utils/sanitizer.js +174 -0
  270. package/docker-compose.yml +13 -137
  271. package/package.json +31 -6
  272. package/skills/deploy-cloudflare/SKILL.md +62 -0
  273. package/skills/deploy-vercel/SKILL.md +67 -0
  274. package/skills/docker-deploy/SKILL.md +158 -0
  275. package/skills/full-stack-builder/SKILL.md +92 -0
  276. package/skills/humanizer/SKILL.md +488 -0
  277. package/skills/profclaw-assistant/SKILL.md +85 -56
  278. package/ui/dist/assets/ActivityView-Da6HQ8ws.js +1 -0
  279. package/ui/dist/assets/AgentList-H58R0kX3.js +1 -0
  280. package/ui/dist/assets/AnalyticsDashboard-B28AeRsc.js +1 -0
  281. package/ui/dist/assets/AreaChart-DwLzeAQ8.js +1 -0
  282. package/ui/dist/assets/CartesianChart-piKQsTAR.js +36 -0
  283. package/ui/dist/assets/ChatView-Dbj8rxU5.js +10 -0
  284. package/ui/dist/assets/CostsDashboard-C6F5df0F.js +1 -0
  285. package/ui/dist/assets/EstimateSelect-wga0rUKX.js +1 -0
  286. package/ui/dist/assets/FeedDashboard-Ef6FEzEf.js +1 -0
  287. package/ui/dist/assets/FloatingChatbot-0yhkUeCq.js +2 -0
  288. package/ui/dist/assets/InviteCodeManagement-tUXfx4Bc.js +2 -0
  289. package/ui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  290. package/ui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  291. package/ui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  292. package/ui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  293. package/ui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  294. package/ui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  295. package/ui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  296. package/ui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  297. package/ui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  298. package/ui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  299. package/ui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  300. package/ui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  301. package/ui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  302. package/ui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  303. package/ui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  304. package/ui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  305. package/ui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  306. package/ui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  307. package/ui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  308. package/ui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  309. package/ui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  310. package/ui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  311. package/ui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  312. package/ui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  313. package/ui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  314. package/ui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  315. package/ui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  316. package/ui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  317. package/ui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  318. package/ui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  319. package/ui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  320. package/ui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  321. package/ui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  322. package/ui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  323. package/ui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  324. package/ui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  325. package/ui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  326. package/ui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  327. package/ui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  328. package/ui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  329. package/ui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  330. package/ui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  331. package/ui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  332. package/ui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  333. package/ui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  334. package/ui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  335. package/ui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  336. package/ui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  337. package/ui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  338. package/ui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  339. package/ui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  340. package/ui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  341. package/ui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  342. package/ui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  343. package/ui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  344. package/ui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  345. package/ui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  346. package/ui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  347. package/ui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  348. package/ui/dist/assets/MarketplacePage-DGrLtolR.js +1 -0
  349. package/ui/dist/assets/{ProjectDetail--gPfvATB.js → ProjectDetail-BgWvA6UP.js} +2 -2
  350. package/ui/dist/assets/ProjectIcon-TDuliqwg.js +1 -0
  351. package/ui/dist/assets/ProjectList-DXgM4187.js +1 -0
  352. package/ui/dist/assets/{Settings-1kaf7VHE.js → Settings-xA8Zhi3p.js} +3 -3
  353. package/ui/dist/assets/StatusIndicator-B8vfFAxg.js +1 -0
  354. package/ui/dist/assets/{SummaryDetail-DV3AmONk.js → SummaryDetail-eedRfTtF.js} +2 -2
  355. package/ui/dist/assets/SummaryList-CLNX2P84.js +1 -0
  356. package/ui/dist/assets/TaskDetail-BtWclNiR.js +1 -0
  357. package/ui/dist/assets/TaskList-JjODAgSc.js +1 -0
  358. package/ui/dist/assets/TeamsPage-CBK5iAyx.js +1 -0
  359. package/ui/dist/assets/TicketBoard-C9aJNNYp.js +1 -0
  360. package/ui/dist/assets/TicketDetail-CV5JmL31.js +1 -0
  361. package/ui/dist/assets/TicketList-68V4lzUz.js +1 -0
  362. package/ui/dist/assets/UserManagement-DKTb6UpE.js +2 -0
  363. package/ui/dist/assets/ViewSwitcher-BvdQht2Y.js +1 -0
  364. package/ui/dist/assets/alert-dialog-O6qBOv_f.js +1 -0
  365. package/ui/dist/assets/{archive-BsLa7brF.js → archive-CX7UvZpf.js} +1 -1
  366. package/ui/dist/assets/badge-BbfnwDJP.js +1 -0
  367. package/ui/dist/assets/{bug-CmZI7jqM.js → bug-3WX0394-.js} +1 -1
  368. package/ui/dist/assets/{calendar-Bf0t2B82.js → calendar-buq77TaS.js} +1 -1
  369. package/ui/dist/assets/{chevron-up-CoUsOvZj.js → chevron-up-4ymsBJRo.js} +1 -1
  370. package/ui/dist/assets/{circle-x-Dgw11LgT.js → circle-x-ByXtwR6Y.js} +1 -1
  371. package/ui/dist/assets/constants-CVdDh7p0.js +1 -0
  372. package/ui/dist/assets/{cpu-DiPMQICV.js → cpu-CiuoCeDY.js} +1 -1
  373. package/ui/dist/assets/{database-BwTfupDi.js → database-BWXSBg5a.js} +1 -1
  374. package/ui/dist/assets/dialog-lDg4NvMV.js +1 -0
  375. package/ui/dist/assets/dollar-sign-Dmijd6DP.js +1 -0
  376. package/ui/dist/assets/{ellipsis-UJx4Xnf6.js → ellipsis-vT-5SVIp.js} +1 -1
  377. package/ui/dist/assets/{ellipsis-vertical-DoULYEKn.js → ellipsis-vertical-B4tAX_bL.js} +1 -1
  378. package/ui/dist/assets/feature-markdown-DBo5Q7uq.js +289 -0
  379. package/ui/dist/assets/{file-code-B2UrJLwi.js → file-code-ChOWdKXf.js} +1 -1
  380. package/ui/dist/assets/{folder-open-BJi577JH.js → folder-open-CkOUbIiP.js} +1 -1
  381. package/ui/dist/assets/{funnel-PkaD_HSR.js → funnel-uZkoSPP-.js} +1 -1
  382. package/ui/dist/assets/{git-branch-C_K30am0.js → git-branch-CwvUxj7C.js} +1 -1
  383. package/ui/dist/assets/{git-commit-horizontal-IT6ecxWQ.js → git-commit-horizontal-lxPzCvhD.js} +1 -1
  384. package/ui/dist/assets/{globe-f-jjCa_g.js → globe-D_WpJdsj.js} +1 -1
  385. package/ui/dist/assets/{hash-DNEv8Elo.js → hash-CA0hJ7vh.js} +1 -1
  386. package/ui/dist/assets/{history-BQSBo_1Q.js → history-CEWMLELs.js} +1 -1
  387. package/ui/dist/assets/inbox-ehtOptTV.js +1 -0
  388. package/ui/dist/assets/{index-nS3EErDg.js → index-C1rhbml4.js} +3 -3
  389. package/ui/dist/assets/index-CR8gfCHv.js +1 -0
  390. package/ui/dist/assets/index-DVXMpWai.js +1 -0
  391. package/ui/dist/assets/index-DaDJMM2v.js +1 -0
  392. package/ui/dist/assets/index-Djdq_0xu.js +1 -0
  393. package/ui/dist/assets/index-M46Gcb8K.css +1 -0
  394. package/ui/dist/assets/index-sEBN7w8J.js +109 -0
  395. package/ui/dist/assets/layers-C6Mhf8Nk.js +1 -0
  396. package/ui/dist/assets/{layout-dashboard-CcKt1hXw.js → layout-dashboard-BRUM0kpT.js} +1 -1
  397. package/ui/dist/assets/{lightbulb-Jhp7FvbU.js → lightbulb-CN2q1O5l.js} +1 -1
  398. package/ui/dist/assets/{link-2-DdO7ostF.js → link-2-CC4E28yJ.js} +1 -1
  399. package/ui/dist/assets/markdown-renderer-C6ENbB0u.js +10 -0
  400. package/ui/dist/assets/markdown-renderer-CfVKi3_s.css +1 -0
  401. package/ui/dist/assets/{message-square-CBgH65X7.js → message-square-Bbb241am.js} +1 -1
  402. package/ui/dist/assets/package-CwT3IzFx.js +1 -0
  403. package/ui/dist/assets/{pencil-CYXCEPQh.js → pencil-CDmiHzoj.js} +1 -1
  404. package/ui/dist/assets/{play-d1ONaH0-.js → play-tjy5jMQX.js} +1 -1
  405. package/ui/dist/assets/popover-CFHZf3pE.js +1 -0
  406. package/ui/dist/assets/progress-BboUHuLf.js +1 -0
  407. package/ui/dist/assets/{rocket-DhvUetsk.js → rocket--8ZHgdXJ.js} +1 -1
  408. package/ui/dist/assets/select-n108rXny.js +1 -0
  409. package/ui/dist/assets/{send-P0r5D7td.js → send-Cu7MR2Qh.js} +1 -1
  410. package/ui/dist/assets/server-DmodxZp-.js +1 -0
  411. package/ui/dist/assets/{settings-2-ocj5uHGx.js → settings-2-CkRNqkxj.js} +1 -1
  412. package/ui/dist/assets/sheet-7aUJkyzU.js +1 -0
  413. package/ui/dist/assets/{shield-check-DfVdE34l.js → shield-check-ViI3nMKE.js} +1 -1
  414. package/ui/dist/assets/{shield-off-8l0J6R-8.js → shield-off-DN3tagkn.js} +1 -1
  415. package/ui/dist/assets/skeleton-C0E1Nfro.js +1 -0
  416. package/ui/dist/assets/{smartphone-77_g3SQn.js → smartphone-5FghiXpA.js} +1 -1
  417. package/ui/dist/assets/{square-Ckzsr3Rn.js → square-DiNSx8K7.js} +1 -1
  418. package/ui/dist/assets/star-DhdFVidS.js +1 -0
  419. package/ui/dist/assets/switch-CIgVbZqQ.js +1 -0
  420. package/ui/dist/assets/table-BC56FVMV.js +1 -0
  421. package/ui/dist/assets/{tag-C35mgoEv.js → tag-CH_vQliw.js} +1 -1
  422. package/ui/dist/assets/textarea-CxDiKFXZ.js +1 -0
  423. package/ui/dist/assets/{timer-DHJBS2w1.js → timer-CdGVTb60.js} +1 -1
  424. package/ui/dist/assets/tooltip-BuW9A5UO.js +1 -0
  425. package/ui/dist/assets/{trash-2-keO5tKPE.js → trash-2-CucZJL0N.js} +1 -1
  426. package/ui/dist/assets/trending-down-BCezC1z2.js +1 -0
  427. package/ui/dist/assets/{trending-up-BBv8KbrY.js → trending-up-C5OYX2k2.js} +1 -1
  428. package/ui/dist/assets/vendor-query-C0p7b53x.js +4 -0
  429. package/ui/dist/assets/vendor-react-Mc5_kfYG.js +12 -0
  430. package/ui/dist/assets/vendor-ui-CXPAUBFv.js +51 -0
  431. package/ui/dist/assets/{wand-sparkles-BusQ52ZK.js → wand-sparkles-BaH6pJnc.js} +1 -1
  432. package/ui/dist/assets/{wrench-02YaOSiK.js → wrench-CjxjP6ok.js} +1 -1
  433. package/ui/dist/index.html +5 -2
  434. package/ui/dist/assets/ActivityView-BeshZXmE.js +0 -1
  435. package/ui/dist/assets/AgentList-QVHeldPi.js +0 -1
  436. package/ui/dist/assets/AnalyticsDashboard-C9R97dXE.js +0 -1
  437. package/ui/dist/assets/AreaChart-B73gaiVQ.js +0 -1
  438. package/ui/dist/assets/CartesianChart-CXYL2R-A.js +0 -36
  439. package/ui/dist/assets/ChatView-qjZErlrp.js +0 -10
  440. package/ui/dist/assets/CostsDashboard-O4DCLy1i.js +0 -1
  441. package/ui/dist/assets/EstimateSelect-1hQf4Osk.js +0 -1
  442. package/ui/dist/assets/FloatingChatbot-BZBzrJxd.js +0 -2
  443. package/ui/dist/assets/InviteCodeManagement-LEoGqYeA.js +0 -2
  444. package/ui/dist/assets/ProjectIcon-Chd_ofsw.js +0 -1
  445. package/ui/dist/assets/ProjectList-BvUfVB6c.js +0 -4
  446. package/ui/dist/assets/StatusIndicator-pRfkNcdV.js +0 -1
  447. package/ui/dist/assets/SummaryList-B6kXiTxL.js +0 -1
  448. package/ui/dist/assets/TaskDetail-CV6CzbOS.js +0 -1
  449. package/ui/dist/assets/TaskList-DL7brQKd.js +0 -1
  450. package/ui/dist/assets/TicketBoard-CrkkFj7C.js +0 -1
  451. package/ui/dist/assets/TicketDetail-hnnYclpD.js +0 -1
  452. package/ui/dist/assets/TicketList-CsDAyQCL.js +0 -1
  453. package/ui/dist/assets/UserManagement-BGFQyTSr.js +0 -2
  454. package/ui/dist/assets/ViewSwitcher-CnL0OqA8.js +0 -1
  455. package/ui/dist/assets/alert-dialog-SKM6Gjz4.js +0 -7
  456. package/ui/dist/assets/badge-CVHH1a-v.js +0 -1
  457. package/ui/dist/assets/brain-6o_RHVpe.js +0 -1
  458. package/ui/dist/assets/constants-Q5Zivl-a.js +0 -1
  459. package/ui/dist/assets/dialog-BUqN9Psj.js +0 -1
  460. package/ui/dist/assets/index-BUmnwPQr.js +0 -1
  461. package/ui/dist/assets/index-BfF5G4Cw.js +0 -1
  462. package/ui/dist/assets/index-C8N375c2.js +0 -1
  463. package/ui/dist/assets/index-CuxnqVVz.css +0 -1
  464. package/ui/dist/assets/index-CzMM3QOk.js +0 -1
  465. package/ui/dist/assets/index-lJlNPFVJ.js +0 -67
  466. package/ui/dist/assets/layers-jFqVrWMD.js +0 -1
  467. package/ui/dist/assets/markdown-renderer-n1ToC4XQ.js +0 -36
  468. package/ui/dist/assets/popover-CrmZgoWu.js +0 -1
  469. package/ui/dist/assets/progress-uv4SPkL5.js +0 -1
  470. package/ui/dist/assets/select-CeQ8AHGy.js +0 -1
  471. package/ui/dist/assets/server-CVHTZB72.js +0 -1
  472. package/ui/dist/assets/sheet-DuQExSho.js +0 -1
  473. package/ui/dist/assets/skeleton-TFiFJ3nB.js +0 -1
  474. package/ui/dist/assets/switch-CAePkd6k.js +0 -1
  475. package/ui/dist/assets/table-ZjAZ7hkt.js +0 -1
  476. package/ui/dist/assets/textarea-DsVPnSgR.js +0 -1
  477. package/ui/dist/assets/tooltip-BYmQ331W.js +0 -1
@@ -1,4 +0,0 @@
1
- import{c as we,r as C,j as n,as as bt,ap as W,ao as _t,at as Ft,ar as oe,b9 as Gn,av as Pt,ba as Ln,aq as Hn,bb as zn,bc as On,bd as kt,V as It,ay as Bn,_ as $t,o as L,t as $,m as ie,S as We,k as _,L as ae,i as F,H as Mt,U as Q,O as K,A as z,J as Le,w as Vt,I as xe,be as qn,l as Et,C as ve,N as At,g as Un,n as Dt,u as X,$ as he,an as Kn,ai as ht,Q as Qn,p as ne,R as Wn,v as Xn,G as Jn,s as Yn,P as vt,F as Zn,D as es,x as ts,y as ns,z as de,aw as ss,ad as wt}from"./index-lJlNPFVJ.js";import{D as Tt,b as Gt,c as Lt,d as Ht,e as rs,f as os}from"./dialog-BUqN9Psj.js";import{C as zt,R as is}from"./rocket-DhvUetsk.js";import{L as as}from"./lightbulb-Jhp7FvbU.js";import{T as Ot,P as ls,a as Bt,b as jt}from"./ProjectIcon-Chd_ofsw.js";import{S as us,C as cs}from"./smartphone-77_g3SQn.js";import{G as ds}from"./globe-f-jjCa_g.js";import{W as gs}from"./wrench-02YaOSiK.js";import{P as ms}from"./progress-uv4SPkL5.js";import{S as ke}from"./switch-CAePkd6k.js";import{B as M}from"./badge-CVHH1a-v.js";import{u as ps,S as qt,a as Ut,b as Kt,c as Qt,d as Wt}from"./select-CeQ8AHGy.js";import{T as fs,a as xs,b as Ie,c as hs,d as vs,e as Ct}from"./table-ZjAZ7hkt.js";import{c as ws,T as js,a as Cs,b as Ss}from"./tooltip-BYmQ331W.js";import{T as ys}from"./tag-C35mgoEv.js";import{L as Ns}from"./link-2-DdO7ostF.js";import{E as Rs}from"./ellipsis-UJx4Xnf6.js";import{P as bs}from"./pencil-CYXCEPQh.js";import{A as _s}from"./archive-BsLa7brF.js";import{T as Fs}from"./trash-2-keO5tKPE.js";import"./chevron-up-CoUsOvZj.js";const Ps=[["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"}]],ks=we("arrow-up-down",Ps);const Is=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],$s=we("chevrons-left",Is);const Ms=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Vs=we("chevrons-right",Ms);const Es=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 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.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],As=we("folder-git-2",Es);var je="Checkbox",[Ds]=Pt(je),[Ts,Xe]=Ds(je);function Gs(e){const{__scopeCheckbox:r,checked:t,children:s,defaultChecked:o,disabled:i,form:a,name:c,onCheckedChange:d,required:g,value:f="on",internal_do_not_use_render:p}=e,[u,l]=_t({prop:t,defaultProp:o??!1,onChange:d,caller:je}),[h,m]=C.useState(null),[x,v]=C.useState(null),j=C.useRef(!1),R=h?!!a||!!h.closest("form"):!0,N={checked:u,disabled:i,setChecked:l,control:h,setControl:m,name:c,form:a,value:f,hasConsumerStoppedPropagationRef:j,required:g,defaultChecked:O(o)?!1:o,isFormControl:R,bubbleInput:x,setBubbleInput:v};return n.jsx(Ts,{scope:r,...N,children:Ls(p)?p(N):s})}var Xt="CheckboxTrigger",Jt=C.forwardRef(({__scopeCheckbox:e,onKeyDown:r,onClick:t,...s},o)=>{const{control:i,value:a,disabled:c,checked:d,required:g,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:u,isFormControl:l,bubbleInput:h}=Xe(Xt,e),m=Ft(o,f),x=C.useRef(d);return C.useEffect(()=>{const v=i?.form;if(v){const j=()=>p(x.current);return v.addEventListener("reset",j),()=>v.removeEventListener("reset",j)}},[i,p]),n.jsx(W.button,{type:"button",role:"checkbox","aria-checked":O(d)?"mixed":d,"aria-required":g,"data-state":nn(d),"data-disabled":c?"":void 0,disabled:c,value:a,...s,ref:m,onKeyDown:oe(r,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:oe(t,v=>{p(j=>O(j)?!0:!j),h&&l&&(u.current=v.isPropagationStopped(),u.current||v.stopPropagation())})})});Jt.displayName=Xt;var Je=C.forwardRef((e,r)=>{const{__scopeCheckbox:t,name:s,checked:o,defaultChecked:i,required:a,disabled:c,value:d,onCheckedChange:g,form:f,...p}=e;return n.jsx(Gs,{__scopeCheckbox:t,checked:o,defaultChecked:i,disabled:c,required:a,onCheckedChange:g,name:s,form:f,value:d,internal_do_not_use_render:({isFormControl:u})=>n.jsxs(n.Fragment,{children:[n.jsx(Jt,{...p,ref:r,__scopeCheckbox:t}),u&&n.jsx(tn,{__scopeCheckbox:t})]})})});Je.displayName=je;var Yt="CheckboxIndicator",Zt=C.forwardRef((e,r)=>{const{__scopeCheckbox:t,forceMount:s,...o}=e,i=Xe(Yt,t);return n.jsx(bt,{present:s||O(i.checked)||i.checked===!0,children:n.jsx(W.span,{"data-state":nn(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r,style:{pointerEvents:"none",...e.style}})})});Zt.displayName=Yt;var en="CheckboxBubbleInput",tn=C.forwardRef(({__scopeCheckbox:e,...r},t)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:a,required:c,disabled:d,name:g,value:f,form:p,bubbleInput:u,setBubbleInput:l}=Xe(en,e),h=Ft(t,l),m=ps(i),x=Gn(s);C.useEffect(()=>{const j=u;if(!j)return;const R=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(R,"checked").set,k=!o.current;if(m!==i&&b){const G=new Event("click",{bubbles:k});j.indeterminate=O(i),b.call(j,O(i)?!1:i),j.dispatchEvent(G)}},[u,m,i,o]);const v=C.useRef(O(i)?!1:i);return n.jsx(W.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??v.current,required:c,disabled:d,name:g,value:f,form:p,...r,tabIndex:-1,ref:h,style:{...r.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});tn.displayName=en;function Ls(e){return typeof e=="function"}function O(e){return e==="indeterminate"}function nn(e){return O(e)?"indeterminate":e?"checked":"unchecked"}var Ce="Tabs",[Hs]=Pt(Ce,[kt]),sn=kt(),[zs,Ye]=Hs(Ce),rn=C.forwardRef((e,r)=>{const{__scopeTabs:t,value:s,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:c,activationMode:d="automatic",...g}=e,f=Ln(c),[p,u]=_t({prop:s,onChange:o,defaultProp:i??"",caller:Ce});return n.jsx(zs,{scope:t,baseId:Hn(),value:p,onValueChange:u,orientation:a,dir:f,activationMode:d,children:n.jsx(W.div,{dir:f,"data-orientation":a,...g,ref:r})})});rn.displayName=Ce;var on="TabsList",an=C.forwardRef((e,r)=>{const{__scopeTabs:t,loop:s=!0,...o}=e,i=Ye(on,t),a=sn(t);return n.jsx(zn,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:s,children:n.jsx(W.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:r})})});an.displayName=on;var ln="TabsTrigger",un=C.forwardRef((e,r)=>{const{__scopeTabs:t,value:s,disabled:o=!1,...i}=e,a=Ye(ln,t),c=sn(t),d=gn(a.baseId,s),g=mn(a.baseId,s),f=s===a.value;return n.jsx(On,{asChild:!0,...c,focusable:!o,active:f,children:n.jsx(W.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":g,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...i,ref:r,onMouseDown:oe(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?a.onValueChange(s):p.preventDefault()}),onKeyDown:oe(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&a.onValueChange(s)}),onFocus:oe(e.onFocus,()=>{const p=a.activationMode!=="manual";!f&&!o&&p&&a.onValueChange(s)})})})});un.displayName=ln;var cn="TabsContent",dn=C.forwardRef((e,r)=>{const{__scopeTabs:t,value:s,forceMount:o,children:i,...a}=e,c=Ye(cn,t),d=gn(c.baseId,s),g=mn(c.baseId,s),f=s===c.value,p=C.useRef(f);return C.useEffect(()=>{const u=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(u)},[]),n.jsx(bt,{present:o||f,children:({present:u})=>n.jsx(W.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!u,id:g,tabIndex:0,...a,ref:r,style:{...e.style,animationDuration:p.current?"0s":void 0},children:u&&i})})});dn.displayName=cn;function gn(e,r){return`${e}-trigger-${r}`}function mn(e,r){return`${e}-content-${r}`}var Os=rn,pn=an,fn=un,xn=dn;const $e=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6"],ge=[{name:"clipboard-list",icon:zt},{name:"rocket",icon:is},{name:"lightbulb",icon:as},{name:"target",icon:Ot},{name:"smartphone",icon:us},{name:"globe",icon:ds},{name:"settings",icon:It},{name:"wrench",icon:gs},{name:"bar-chart-3",icon:Bn},{name:"palette",icon:ls},{name:"code",icon:cs},{name:"shield",icon:$t}];function Bs({open:e,onOpenChange:r,onSuccess:t}){const[s,o]=C.useState(""),[i,a]=C.useState(""),[c,d]=C.useState(""),[g,f]=C.useState($e[0]),[p,u]=C.useState(ge[0].name),[l,h]=C.useState(""),m=ge.find(N=>N.name===p)?.icon||zt,x=L({mutationFn:()=>ie.projects.create({key:s.toUpperCase(),name:i,description:c||void 0,color:g,icon:p}),onSuccess:()=>{$.success(`Project ${s.toUpperCase()} created`),r(!1),v(),t?.()},onError:N=>{N.message?.includes("already exists")?h("This project key is already taken"):$.error(N.message||"Failed to create project")}}),v=()=>{o(""),a(""),d(""),f($e[0]),u(ge[0].name),h("")},j=N=>{const b=N.toUpperCase().replace(/[^A-Z0-9]/g,"");o(b),h("")},R=N=>{if(N.preventDefault(),s.length<2){h("Key must be at least 2 characters");return}if(s.length>10){h("Key must be at most 10 characters");return}if(!/^[A-Z]/.test(s)){h("Key must start with a letter");return}i.trim()&&x.mutate()};return n.jsx(Tt,{open:e,onOpenChange:r,children:n.jsxs(Gt,{className:"sm:max-w-lg",children:[n.jsxs(Lt,{children:[n.jsxs(Ht,{className:"flex items-center gap-2",children:[n.jsx(We,{className:"h-5 w-5 text-primary"}),"Create New Project"]}),n.jsx(rs,{children:"Create a project to organize your tickets. Each project gets a unique key prefix (e.g., PROFCLAW-1, MOBILE-1)."})]}),n.jsxs("form",{onSubmit:R,className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium",children:["Project Key ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("input",{type:"text",value:s,onChange:N=>j(N.target.value),placeholder:"PROJ",maxLength:10,className:"w-32 field font-mono uppercase"}),n.jsx("span",{className:"text-muted-foreground",children:"-"}),n.jsx("span",{className:"text-muted-foreground font-mono",children:"123"})]}),l&&n.jsx("p",{className:"text-xs text-destructive",children:l}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"2-10 uppercase letters/numbers. This will be the prefix for all tickets in this project."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium",children:["Project Name ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx("input",{type:"text",value:i,onChange:N=>a(N.target.value),placeholder:"My Awesome Project",className:"w-full field"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Description"}),n.jsx("textarea",{value:c,onChange:N=>d(N.target.value),placeholder:"Optional description...",rows:2,className:"w-full field resize-none"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Icon"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:ge.map(({name:N,icon:b})=>n.jsx("button",{type:"button",onClick:()=>u(N),className:`w-9 h-9 rounded-lg flex items-center justify-center transition-all ${p===N?"bg-primary/20 ring-2 ring-primary":"bg-muted/50 hover:bg-muted"}`,children:n.jsx(b,{className:"h-5 w-5"})},N))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Color"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:$e.map(N=>n.jsx("button",{type:"button",onClick:()=>f(N),className:`w-7 h-7 rounded-full transition-all ${g===N?"ring-2 ring-offset-2 ring-offset-background ring-primary":""}`,style:{backgroundColor:N}},N))})]})]}),n.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg border border-border",children:[n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Preview"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:`${g}20`},children:n.jsx(m,{className:"h-5 w-5",style:{color:g}})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-mono font-bold px-2 py-0.5 rounded",style:{backgroundColor:`${g}20`,color:g},children:s||"PROJ"}),n.jsx("p",{className:"font-medium mt-0.5",children:i||"Project Name"})]})]})]}),n.jsxs(os,{children:[n.jsx(_,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),n.jsxs(_,{type:"submit",disabled:!s||!i.trim()||x.isPending,className:"gap-2",children:[x.isPending&&n.jsx(ae,{className:"h-4 w-4 animate-spin"}),"Create Project"]})]})]})]})})}const qs=Os,hn=C.forwardRef(({className:e,...r},t)=>n.jsx(pn,{ref:t,className:F("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...r}));hn.displayName=pn.displayName;const He=C.forwardRef(({className:e,...r},t)=>n.jsx(fn,{ref:t,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-lg px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/20 disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-gradient-to-br data-[state=active]:from-primary data-[state=active]:to-primary-hover data-[state=active]:text-white data-[state=active]:shadow-[0_0_15px_-3px_var(--primary-glow)] data-[state=active]:border-primary/20","hover:text-foreground hover:bg-muted/50 transition-colors",e),...r}));He.displayName=fn.displayName;const ze=C.forwardRef(({className:e,...r},t)=>n.jsx(xn,{ref:t,className:F("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...r}));ze.displayName=xn.displayName;const vn=[{value:"backlog",label:"Backlog",color:"#6b7280"},{value:"todo",label:"To Do",color:"#3b82f6"},{value:"in_progress",label:"In Progress",color:"#f59e0b"},{value:"in_review",label:"In Review",color:"#8b5cf6"},{value:"done",label:"Done",color:"#22c55e"},{value:"cancelled",label:"Cancelled",color:"#ef4444"}],wn=[{value:"critical",label:"Critical",color:"#ef4444"},{value:"high",label:"High",color:"#f97316"},{value:"medium",label:"Medium",color:"#eab308"},{value:"low",label:"Low",color:"#22c55e"},{value:"none",label:"None",color:"#6b7280"}],jn=[{value:"task",label:"Task",icon:"📋"},{value:"bug",label:"Bug",icon:"🐛"},{value:"feature",label:"Feature",icon:"✨"},{value:"epic",label:"Epic",icon:"🎯"},{value:"story",label:"Story",icon:"📖"},{value:"subtask",label:"Subtask",icon:"📎"},{value:"improvement",label:"Improvement",icon:"💡"}],St=[{key:"status",label:"Status",options:vn,defaultValue:"backlog"},{key:"priority",label:"Priority",options:wn,defaultValue:"medium"},{key:"type",label:"Type",options:jn,defaultValue:"task"}];function Us({items:e,mappings:r,onMappingsChange:t}){const s=C.useMemo(()=>{const p={status:new Set,priority:new Set,type:new Set};for(const u of e)u.status&&p.status.add(u.status),u.priority&&p.priority.add(u.priority),u.type&&p.type.add(u.type);return{status:Array.from(p.status).sort(),priority:Array.from(p.priority).sort(),type:Array.from(p.type).sort()}},[e]),o=C.useMemo(()=>{const p={status:{},priority:{},type:{}};for(const u of e)u.status&&(p.status[u.status]=(p.status[u.status]||0)+1),u.priority&&(p.priority[u.priority]=(p.priority[u.priority]||0)+1),u.type&&(p.type[u.type]=(p.type[u.type]||0)+1);return p},[e]),i=(p,u)=>!!r[p][u],a=C.useMemo(()=>({status:s.status.filter(p=>!i("status",p)).length,priority:s.priority.filter(p=>!i("priority",p)).length,type:s.type.filter(p=>!i("type",p)).length}),[s,r]),c=(p,u,l)=>{t({...r,[p]:{...r[p],[u]:l}})},d=()=>{const p={...r};for(const u of St){const l=u.key;for(const h of s[l])if(!p[l][h]){const m=u.options.find(x=>x.label.toLowerCase()===h.toLowerCase()||x.value.toLowerCase()===h.toLowerCase());p[l][h]=m?.value||u.defaultValue}}t(p)},g=()=>{t({status:{},priority:{},type:{}})},f=a.status+a.priority+a.type;return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"Field Mappings"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Map GitHub fields to profClaw values"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[f>0&&n.jsxs(_,{variant:"outline",size:"sm",onClick:d,className:"gap-2",children:[n.jsx(We,{className:"h-3.5 w-3.5"}),"Auto-map ",f," values"]}),n.jsxs(_,{variant:"ghost",size:"sm",onClick:g,className:"gap-2 text-muted-foreground",children:[n.jsx(Mt,{className:"h-3.5 w-3.5"}),"Reset"]})]})]}),f>0&&n.jsxs("div",{className:"flex items-center gap-2 p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg text-sm",children:[n.jsx(Q,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsxs("span",{className:"text-amber-700 dark:text-amber-400",children:[f," value",f!==1?"s":""," need",f===1?"s":""," mapping. Items with unmapped values will use defaults."]})]}),n.jsx("div",{className:"space-y-6",children:St.map(p=>{const u=s[p.key],l=a[p.key];return u.length===0?null:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"text-sm font-medium",children:p.label}),l>0?n.jsxs(M,{variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50 dark:bg-amber-900/20",children:[l," unmapped"]}):n.jsxs(M,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50 dark:bg-green-900/20",children:[n.jsx(K,{className:"h-3 w-3 mr-1"}),"All mapped"]})]}),n.jsx("div",{className:"rounded-2xl glass shadow-lg overflow-hidden",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"bg-muted/50",children:[n.jsx("th",{className:"text-left py-2 px-3 font-medium text-muted-foreground",children:"GitHub Value"}),n.jsx("th",{className:"w-10"}),n.jsx("th",{className:"text-left py-2 px-3 font-medium text-muted-foreground",children:"profClaw Value"}),n.jsx("th",{className:"text-right py-2 px-3 font-medium text-muted-foreground w-20",children:"Count"})]})}),n.jsx("tbody",{className:"divide-y divide-border",children:u.map(h=>{const m=i(p.key,h),x=r[p.key][h],v=p.options.find(j=>j.value===x);return n.jsxs("tr",{className:F("transition-colors",!m&&"bg-amber-50/50 dark:bg-amber-900/10"),children:[n.jsx("td",{className:"py-2 px-3",children:n.jsxs("div",{className:"flex items-center gap-2",children:[!m&&n.jsx(Q,{className:"h-3.5 w-3.5 text-amber-500"}),n.jsx("span",{className:"font-mono text-xs bg-muted px-2 py-0.5 rounded",children:h})]})}),n.jsx("td",{className:"text-center text-muted-foreground",children:n.jsx(z,{className:"h-4 w-4 mx-auto"})}),n.jsx("td",{className:"py-2 px-3",children:n.jsxs(qt,{value:x||"",onValueChange:j=>c(p.key,h,j),children:[n.jsx(Ut,{className:F("h-8 w-48",!m&&"border-amber-300 bg-amber-50 dark:bg-amber-900/20"),children:n.jsx(Kt,{placeholder:"Select mapping...",children:v&&n.jsxs("div",{className:"flex items-center gap-2",children:["color"in v&&n.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:v.color}}),"icon"in v&&n.jsx("span",{children:v.icon}),n.jsx("span",{children:v.label})]})})}),n.jsx(Qt,{children:p.options.map(j=>n.jsx(Wt,{value:j.value,children:n.jsxs("div",{className:"flex items-center gap-2",children:["color"in j&&n.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:j.color}}),"icon"in j&&n.jsx("span",{children:j.icon}),n.jsx("span",{children:j.label})]})},j.value))})]})}),n.jsx("td",{className:"py-2 px-3 text-right text-muted-foreground tabular-nums",children:o[p.key][h]||0})]},h)})})]})})]},p.key)})})]})}function H(e,r){return typeof e=="function"?e(r):e}function V(e,r){return t=>{r.setState(s=>({...s,[e]:H(t,s[e])}))}}function Se(e){return e instanceof Function}function Ks(e){return Array.isArray(e)&&e.every(r=>typeof r=="number")}function Qs(e,r){const t=[],s=o=>{o.forEach(i=>{t.push(i);const a=r(i);a!=null&&a.length&&s(a)})};return s(e),t}function S(e,r,t){let s=[],o;return i=>{let a;t.key&&t.debug&&(a=Date.now());const c=e(i);if(!(c.length!==s.length||c.some((f,p)=>s[p]!==f)))return o;s=c;let g;if(t.key&&t.debug&&(g=Date.now()),o=r(...c),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){const f=Math.round((Date.now()-a)*100)/100,p=Math.round((Date.now()-g)*100)/100,u=p/16,l=(h,m)=>{for(h=String(h);h.length<m;)h=" "+h;return h};console.info(`%c⏱ ${l(p,5)} /${l(f,5)} ms`,`
2
- font-size: .6rem;
3
- font-weight: bold;
4
- color: hsl(${Math.max(0,Math.min(120-120*u,120))}deg 100% 31%);`,t?.key)}return o}}function y(e,r,t,s){return{debug:()=>{var o;return(o=e?.debugAll)!=null?o:e[r]},key:!1,onChange:s}}function Ws(e,r,t,s){const o=()=>{var a;return(a=i.getValue())!=null?a:e.options.renderFallbackValue},i={id:`${r.id}_${t.id}`,row:r,column:t,getValue:()=>r.getValue(s),renderValue:o,getContext:S(()=>[e,t,r,i],(a,c,d,g)=>({table:a,column:c,row:d,cell:g,getValue:g.getValue,renderValue:g.renderValue}),y(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(i,t,r,e)},{}),i}function Xs(e,r,t,s){var o,i;const c={...e._getDefaultColumnDef(),...r},d=c.accessorKey;let g=(o=(i=c.id)!=null?i:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?o:typeof c.header=="string"?c.header:void 0,f;if(c.accessorFn?f=c.accessorFn:d&&(d.includes(".")?f=u=>{let l=u;for(const m of d.split(".")){var h;l=(h=l)==null?void 0:h[m]}return l}:f=u=>u[c.accessorKey]),!g)throw new Error;let p={id:`${String(g)}`,accessorFn:f,parent:s,depth:t,columnDef:c,columns:[],getFlatColumns:S(()=>[!0],()=>{var u;return[p,...(u=p.columns)==null?void 0:u.flatMap(l=>l.getFlatColumns())]},y(e.options,"debugColumns")),getLeafColumns:S(()=>[e._getOrderColumnsFn()],u=>{var l;if((l=p.columns)!=null&&l.length){let h=p.columns.flatMap(m=>m.getLeafColumns());return u(h)}return[p]},y(e.options,"debugColumns"))};for(const u of e._features)u.createColumn==null||u.createColumn(p,e);return p}const P="debugHeaders";function yt(e,r,t){var s;let i={id:(s=t.id)!=null?s:r.id,column:r,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],c=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(c),a.push(d)};return c(i),a},getContext:()=>({table:e,header:i,column:r})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(i,e)}),i}const Js={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s,o)=>{var i,a;const c=(i=s?.map(p=>t.find(u=>u.id===p)).filter(Boolean))!=null?i:[],d=(a=o?.map(p=>t.find(u=>u.id===p)).filter(Boolean))!=null?a:[],g=t.filter(p=>!(s!=null&&s.includes(p.id))&&!(o!=null&&o.includes(p.id)));return me(r,[...c,...g,...d],e)},y(e.options,P)),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s,o)=>(t=t.filter(i=>!(s!=null&&s.includes(i.id))&&!(o!=null&&o.includes(i.id))),me(r,t,e,"center")),y(e.options,P)),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(r,t,s)=>{var o;const i=(o=s?.map(a=>t.find(c=>c.id===a)).filter(Boolean))!=null?o:[];return me(r,i,e,"left")},y(e.options,P)),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(r,t,s)=>{var o;const i=(o=s?.map(a=>t.find(c=>c.id===a)).filter(Boolean))!=null?o:[];return me(r,i,e,"right")},y(e.options,P)),e.getFooterGroups=S(()=>[e.getHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getFlatHeaders=S(()=>[e.getHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getLeftFlatHeaders=S(()=>[e.getLeftHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getCenterFlatHeaders=S(()=>[e.getCenterHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getRightFlatHeaders=S(()=>[e.getRightHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getCenterLeafHeaders=S(()=>[e.getCenterFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),y(e.options,P)),e.getLeftLeafHeaders=S(()=>[e.getLeftFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),y(e.options,P)),e.getRightLeafHeaders=S(()=>[e.getRightFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),y(e.options,P)),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(r,t,s)=>{var o,i,a,c,d,g;return[...(o=(i=r[0])==null?void 0:i.headers)!=null?o:[],...(a=(c=t[0])==null?void 0:c.headers)!=null?a:[],...(d=(g=s[0])==null?void 0:g.headers)!=null?d:[]].map(f=>f.getLeafHeaders()).flat()},y(e.options,P))}};function me(e,r,t,s){var o,i;let a=0;const c=function(u,l){l===void 0&&(l=1),a=Math.max(a,l),u.filter(h=>h.getIsVisible()).forEach(h=>{var m;(m=h.columns)!=null&&m.length&&c(h.columns,l+1)},0)};c(e);let d=[];const g=(u,l)=>{const h={depth:l,id:[s,`${l}`].filter(Boolean).join("_"),headers:[]},m=[];u.forEach(x=>{const v=[...m].reverse()[0],j=x.column.depth===h.depth;let R,N=!1;if(j&&x.column.parent?R=x.column.parent:(R=x.column,N=!0),v&&v?.column===R)v.subHeaders.push(x);else{const b=yt(t,R,{id:[s,l,R.id,x?.id].filter(Boolean).join("_"),isPlaceholder:N,placeholderId:N?`${m.filter(k=>k.column===R).length}`:void 0,depth:l,index:m.length});b.subHeaders.push(x),m.push(b)}h.headers.push(x),x.headerGroup=h}),d.push(h),l>0&&g(m,l-1)},f=r.map((u,l)=>yt(t,u,{depth:a,index:l}));g(f,a-1),d.reverse();const p=u=>u.filter(h=>h.column.getIsVisible()).map(h=>{let m=0,x=0,v=[0];h.subHeaders&&h.subHeaders.length?(v=[],p(h.subHeaders).forEach(R=>{let{colSpan:N,rowSpan:b}=R;m+=N,v.push(b)})):m=1;const j=Math.min(...v);return x=x+j,h.colSpan=m,h.rowSpan=x,{colSpan:m,rowSpan:x}});return p((o=(i=d[0])==null?void 0:i.headers)!=null?o:[]),d}const Ze=(e,r,t,s,o,i,a)=>{let c={id:r,index:s,original:t,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(c._valuesCache.hasOwnProperty(d))return c._valuesCache[d];const g=e.getColumn(d);if(g!=null&&g.accessorFn)return c._valuesCache[d]=g.accessorFn(c.original,s),c._valuesCache[d]},getUniqueValues:d=>{if(c._uniqueValuesCache.hasOwnProperty(d))return c._uniqueValuesCache[d];const g=e.getColumn(d);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(c._uniqueValuesCache[d]=g.columnDef.getUniqueValues(c.original,s),c._uniqueValuesCache[d]):(c._uniqueValuesCache[d]=[c.getValue(d)],c._uniqueValuesCache[d])},renderValue:d=>{var g;return(g=c.getValue(d))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Qs(c.subRows,d=>d.subRows),getParentRow:()=>c.parentId?e.getRow(c.parentId,!0):void 0,getParentRows:()=>{let d=[],g=c;for(;;){const f=g.getParentRow();if(!f)break;d.push(f),g=f}return d.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],d=>d.map(g=>Ws(e,c,g,g.id)),y(e.options,"debugRows")),_getAllCellsByColumnId:S(()=>[c.getAllCells()],d=>d.reduce((g,f)=>(g[f.column.id]=f,g),{}),y(e.options,"debugRows"))};for(let d=0;d<e._features.length;d++){const g=e._features[d];g==null||g.createRow==null||g.createRow(c,e)}return c},Ys={createColumn:(e,r)=>{e._getFacetedRowModel=r.options.getFacetedRowModel&&r.options.getFacetedRowModel(r,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():r.getPreFilteredRowModel(),e._getFacetedUniqueValues=r.options.getFacetedUniqueValues&&r.options.getFacetedUniqueValues(r,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=r.options.getFacetedMinMaxValues&&r.options.getFacetedMinMaxValues(r,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Cn=(e,r,t)=>{var s,o;const i=t==null||(s=t.toString())==null?void 0:s.toLowerCase();return!!(!((o=e.getValue(r))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};Cn.autoRemove=e=>E(e);const Sn=(e,r,t)=>{var s;return!!(!((s=e.getValue(r))==null||(s=s.toString())==null)&&s.includes(t))};Sn.autoRemove=e=>E(e);const yn=(e,r,t)=>{var s;return((s=e.getValue(r))==null||(s=s.toString())==null?void 0:s.toLowerCase())===t?.toLowerCase()};yn.autoRemove=e=>E(e);const Nn=(e,r,t)=>{var s;return(s=e.getValue(r))==null?void 0:s.includes(t)};Nn.autoRemove=e=>E(e);const Rn=(e,r,t)=>!t.some(s=>{var o;return!((o=e.getValue(r))!=null&&o.includes(s))});Rn.autoRemove=e=>E(e)||!(e!=null&&e.length);const bn=(e,r,t)=>t.some(s=>{var o;return(o=e.getValue(r))==null?void 0:o.includes(s)});bn.autoRemove=e=>E(e)||!(e!=null&&e.length);const _n=(e,r,t)=>e.getValue(r)===t;_n.autoRemove=e=>E(e);const Fn=(e,r,t)=>e.getValue(r)==t;Fn.autoRemove=e=>E(e);const et=(e,r,t)=>{let[s,o]=t;const i=e.getValue(r);return i>=s&&i<=o};et.resolveFilterValue=e=>{let[r,t]=e,s=typeof r!="number"?parseFloat(r):r,o=typeof t!="number"?parseFloat(t):t,i=r===null||Number.isNaN(s)?-1/0:s,a=t===null||Number.isNaN(o)?1/0:o;if(i>a){const c=i;i=a,a=c}return[i,a]};et.autoRemove=e=>E(e)||E(e[0])&&E(e[1]);const T={includesString:Cn,includesStringSensitive:Sn,equalsString:yn,arrIncludes:Nn,arrIncludesAll:Rn,arrIncludesSome:bn,equals:_n,weakEquals:Fn,inNumberRange:et};function E(e){return e==null||e===""}const Zs={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:V("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,r)=>{e.getAutoFilterFn=()=>{const t=r.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);return typeof s=="string"?T.includesString:typeof s=="number"?T.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?T.equals:Array.isArray(s)?T.arrIncludes:T.weakEquals},e.getFilterFn=()=>{var t,s;return Se(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(s=r.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?t:T[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,s,o;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((s=r.options.enableColumnFilters)!=null?s:!0)&&((o=r.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=r.getState().columnFilters)==null||(t=t.find(s=>s.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,s;return(t=(s=r.getState().columnFilters)==null?void 0:s.findIndex(o=>o.id===e.id))!=null?t:-1},e.setFilterValue=t=>{r.setColumnFilters(s=>{const o=e.getFilterFn(),i=s?.find(f=>f.id===e.id),a=H(t,i?i.value:void 0);if(Nt(o,a,e)){var c;return(c=s?.filter(f=>f.id!==e.id))!=null?c:[]}const d={id:e.id,value:a};if(i){var g;return(g=s?.map(f=>f.id===e.id?d:f))!=null?g:[]}return s!=null&&s.length?[...s,d]:[d]})}},createRow:(e,r)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=r=>{const t=e.getAllLeafColumns(),s=o=>{var i;return(i=H(r,o))==null?void 0:i.filter(a=>{const c=t.find(d=>d.id===a.id);if(c){const d=c.getFilterFn();if(Nt(d,a.value,c))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=r=>{var t,s;e.setColumnFilters(r?[]:(t=(s=e.initialState)==null?void 0:s.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Nt(e,r,t){return(e&&e.autoRemove?e.autoRemove(r,t):!1)||typeof r>"u"||typeof r=="string"&&!r}const er=(e,r,t)=>t.reduce((s,o)=>{const i=o.getValue(e);return s+(typeof i=="number"?i:0)},0),tr=(e,r,t)=>{let s;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(s>i||s===void 0&&i>=i)&&(s=i)}),s},nr=(e,r,t)=>{let s;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(s<i||s===void 0&&i>=i)&&(s=i)}),s},sr=(e,r,t)=>{let s,o;return t.forEach(i=>{const a=i.getValue(e);a!=null&&(s===void 0?a>=a&&(s=o=a):(s>a&&(s=a),o<a&&(o=a)))}),[s,o]},rr=(e,r)=>{let t=0,s=0;if(r.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++t,s+=i)}),t)return s/t},or=(e,r)=>{if(!r.length)return;const t=r.map(i=>i.getValue(e));if(!Ks(t))return;if(t.length===1)return t[0];const s=Math.floor(t.length/2),o=t.sort((i,a)=>i-a);return t.length%2!==0?o[s]:(o[s-1]+o[s])/2},ir=(e,r)=>Array.from(new Set(r.map(t=>t.getValue(e))).values()),ar=(e,r)=>new Set(r.map(t=>t.getValue(e))).size,lr=(e,r)=>r.length,Me={sum:er,min:tr,max:nr,extent:sr,mean:rr,median:or,unique:ir,uniqueCount:ar,count:lr},ur={getDefaultColumnDef:()=>({aggregatedCell:e=>{var r,t;return(r=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?r:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:V("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,r)=>{e.toggleGrouping=()=>{r.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(s=>s!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,s;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((s=r.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=r.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=r.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=r.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);if(typeof s=="number")return Me.sum;if(Object.prototype.toString.call(s)==="[object Date]")return Me.extent},e.getAggregationFn=()=>{var t,s;if(!e)throw new Error;return Se(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(s=r.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?t:Me[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=r=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(r),e.resetGrouping=r=>{var t,s;e.setGrouping(r?[]:(t=(s=e.initialState)==null?void 0:s.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,r)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const s=r.getColumn(t);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[t]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,r,t,s)=>{e.getIsGrouped=()=>r.getIsGrouped()&&r.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&r.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}}};function cr(e,r,t){if(!(r!=null&&r.length)||!t)return e;const s=e.filter(i=>!r.includes(i.id));return t==="remove"?s:[...r.map(i=>e.find(a=>a.id===i)).filter(Boolean),...s]}const dr={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:V("columnOrder",e)}),createColumn:(e,r)=>{e.getIndex=S(t=>[le(r,t)],t=>t.findIndex(s=>s.id===e.id),y(r.options,"debugColumns")),e.getIsFirstColumn=t=>{var s;return((s=le(r,t)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=t=>{var s;const o=le(r,t);return((s=o[o.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=r=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(r),e.resetColumnOrder=r=>{var t;e.setColumnOrder(r?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(r,t,s)=>o=>{let i=[];if(!(r!=null&&r.length))i=o;else{const a=[...r],c=[...o];for(;c.length&&a.length;){const d=a.shift(),g=c.findIndex(f=>f.id===d);g>-1&&i.push(c.splice(g,1)[0])}i=[...i,...c]}return cr(i,t,s)},y(e.options,"debugTable"))}},Ve=()=>({left:[],right:[]}),gr={getInitialState:e=>({columnPinning:Ve(),...e}),getDefaultOptions:e=>({onColumnPinningChange:V("columnPinning",e)}),createColumn:(e,r)=>{e.pin=t=>{const s=e.getLeafColumns().map(o=>o.id).filter(Boolean);r.setColumnPinning(o=>{var i,a;if(t==="right"){var c,d;return{left:((c=o?.left)!=null?c:[]).filter(p=>!(s!=null&&s.includes(p))),right:[...((d=o?.right)!=null?d:[]).filter(p=>!(s!=null&&s.includes(p))),...s]}}if(t==="left"){var g,f;return{left:[...((g=o?.left)!=null?g:[]).filter(p=>!(s!=null&&s.includes(p))),...s],right:((f=o?.right)!=null?f:[]).filter(p=>!(s!=null&&s.includes(p)))}}return{left:((i=o?.left)!=null?i:[]).filter(p=>!(s!=null&&s.includes(p))),right:((a=o?.right)!=null?a:[]).filter(p=>!(s!=null&&s.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var o,i,a;return((o=s.columnDef.enablePinning)!=null?o:!0)&&((i=(a=r.options.enableColumnPinning)!=null?a:r.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(c=>c.id),{left:s,right:o}=r.getState().columnPinning,i=t.some(c=>s?.includes(c)),a=t.some(c=>o?.includes(c));return i?"left":a?"right":!1},e.getPinnedIndex=()=>{var t,s;const o=e.getIsPinned();return o?(t=(s=r.getState().columnPinning)==null||(s=s[o])==null?void 0:s.indexOf(e.id))!=null?t:-1:0}},createRow:(e,r)=>{e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),r.getState().columnPinning.left,r.getState().columnPinning.right],(t,s,o)=>{const i=[...s??[],...o??[]];return t.filter(a=>!i.includes(a.column.id))},y(r.options,"debugRows")),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),r.getState().columnPinning.left],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),y(r.options,"debugRows")),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),r.getState().columnPinning.right],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),y(r.options,"debugRows"))},createTable:e=>{e.setColumnPinning=r=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(r),e.resetColumnPinning=r=>{var t,s;return e.setColumnPinning(r?Ve():(t=(s=e.initialState)==null?void 0:s.columnPinning)!=null?t:Ve())},e.getIsSomeColumnsPinned=r=>{var t;const s=e.getState().columnPinning;if(!r){var o,i;return!!((o=s.left)!=null&&o.length||(i=s.right)!=null&&i.length)}return!!((t=s[r])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(r,t)=>(t??[]).map(s=>r.find(o=>o.id===s)).filter(Boolean),y(e.options,"debugColumns")),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(r,t)=>(t??[]).map(s=>r.find(o=>o.id===s)).filter(Boolean),y(e.options,"debugColumns")),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s)=>{const o=[...t??[],...s??[]];return r.filter(i=>!o.includes(i.id))},y(e.options,"debugColumns"))}};function mr(e){return e||(typeof document<"u"?document:null)}const pe={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ee=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),pr={getDefaultColumnDef:()=>pe,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ee(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:V("columnSizing",e),onColumnSizingInfoChange:V("columnSizingInfo",e)}),createColumn:(e,r)=>{e.getSize=()=>{var t,s,o;const i=r.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:pe.minSize,(s=i??e.columnDef.size)!=null?s:pe.size),(o=e.columnDef.maxSize)!=null?o:pe.maxSize)},e.getStart=S(t=>[t,le(r,t),r.getState().columnSizing],(t,s)=>s.slice(0,e.getIndex(t)).reduce((o,i)=>o+i.getSize(),0),y(r.options,"debugColumns")),e.getAfter=S(t=>[t,le(r,t),r.getState().columnSizing],(t,s)=>s.slice(e.getIndex(t)+1).reduce((o,i)=>o+i.getSize(),0),y(r.options,"debugColumns")),e.resetSize=()=>{r.setColumnSizing(t=>{let{[e.id]:s,...o}=t;return o})},e.getCanResize=()=>{var t,s;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((s=r.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>r.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,r)=>{e.getSize=()=>{let t=0;const s=o=>{if(o.subHeaders.length)o.subHeaders.forEach(s);else{var i;t+=(i=o.column.getSize())!=null?i:0}};return s(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const s=r.getColumn(e.column.id),o=s?.getCanResize();return i=>{if(!s||!o||(i.persist==null||i.persist(),Ae(i)&&i.touches&&i.touches.length>1))return;const a=e.getSize(),c=e?e.getLeafHeaders().map(v=>[v.column.id,v.column.getSize()]):[[s.id,s.getSize()]],d=Ae(i)?Math.round(i.touches[0].clientX):i.clientX,g={},f=(v,j)=>{typeof j=="number"&&(r.setColumnSizingInfo(R=>{var N,b;const k=r.options.columnResizeDirection==="rtl"?-1:1,G=(j-((N=R?.startOffset)!=null?N:0))*k,q=Math.max(G/((b=R?.startSize)!=null?b:0),-.999999);return R.columnSizingStart.forEach(J=>{let[Y,Z]=J;g[Y]=Math.round(Math.max(Z+Z*q,0)*100)/100}),{...R,deltaOffset:G,deltaPercentage:q}}),(r.options.columnResizeMode==="onChange"||v==="end")&&r.setColumnSizing(R=>({...R,...g})))},p=v=>f("move",v),u=v=>{f("end",v),r.setColumnSizingInfo(j=>({...j,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},l=mr(t),h={moveHandler:v=>p(v.clientX),upHandler:v=>{l?.removeEventListener("mousemove",h.moveHandler),l?.removeEventListener("mouseup",h.upHandler),u(v.clientX)}},m={moveHandler:v=>(v.cancelable&&(v.preventDefault(),v.stopPropagation()),p(v.touches[0].clientX),!1),upHandler:v=>{var j;l?.removeEventListener("touchmove",m.moveHandler),l?.removeEventListener("touchend",m.upHandler),v.cancelable&&(v.preventDefault(),v.stopPropagation()),u((j=v.touches[0])==null?void 0:j.clientX)}},x=fr()?{passive:!1}:!1;Ae(i)?(l?.addEventListener("touchmove",m.moveHandler,x),l?.addEventListener("touchend",m.upHandler,x)):(l?.addEventListener("mousemove",h.moveHandler,x),l?.addEventListener("mouseup",h.upHandler,x)),r.setColumnSizingInfo(v=>({...v,startOffset:d,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:c,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=r=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(r),e.setColumnSizingInfo=r=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(r),e.resetColumnSizing=r=>{var t;e.setColumnSizing(r?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=r=>{var t;e.setColumnSizingInfo(r?Ee():(t=e.initialState.columnSizingInfo)!=null?t:Ee())},e.getTotalSize=()=>{var r,t;return(r=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getLeftTotalSize=()=>{var r,t;return(r=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getCenterTotalSize=()=>{var r,t;return(r=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getRightTotalSize=()=>{var r,t;return(r=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0}}};let fe=null;function fr(){if(typeof fe=="boolean")return fe;let e=!1;try{const r={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,r),window.removeEventListener("test",t)}catch{e=!1}return fe=e,fe}function Ae(e){return e.type==="touchstart"}const xr={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:V("columnVisibility",e)}),createColumn:(e,r)=>{e.toggleVisibility=t=>{e.getCanHide()&&r.setColumnVisibility(s=>({...s,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,s;const o=e.columns;return(t=o.length?o.some(i=>i.getIsVisible()):(s=r.getState().columnVisibility)==null?void 0:s[e.id])!=null?t:!0},e.getCanHide=()=>{var t,s;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((s=r.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,r)=>{e._getAllVisibleCells=S(()=>[e.getAllCells(),r.getState().columnVisibility],t=>t.filter(s=>s.column.getIsVisible()),y(r.options,"debugRows")),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,s,o)=>[...t,...s,...o],y(r.options,"debugRows"))},createTable:e=>{const r=(t,s)=>S(()=>[s(),s().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),y(e.options,"debugColumns"));e.getVisibleFlatColumns=r("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=r("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=r("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=r("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=r("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var s;e.setColumnVisibility(t?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=t=>{var s;t=(s=t)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var s;e.toggleAllColumnsVisible((s=t.target)==null?void 0:s.checked)}}};function le(e,r){return r?r==="center"?e.getCenterVisibleLeafColumns():r==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const hr={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},vr={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:V("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:r=>{var t;const s=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[r.id])==null?void 0:t.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,r)=>{e.getCanGlobalFilter=()=>{var t,s,o,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((s=r.options.enableGlobalFilter)!=null?s:!0)&&((o=r.options.enableFilters)!=null?o:!0)&&((i=r.options.getColumnCanGlobalFilter==null?void 0:r.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>T.includesString,e.getGlobalFilterFn=()=>{var r,t;const{globalFilterFn:s}=e.options;return Se(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(r=(t=e.options.filterFns)==null?void 0:t[s])!=null?r:T[s]},e.setGlobalFilter=r=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(r)},e.resetGlobalFilter=r=>{e.setGlobalFilter(r?void 0:e.initialState.globalFilter)}}},wr={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:V("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let r=!1,t=!1;e._autoResetExpanded=()=>{var s,o;if(!r){e._queue(()=>{r=!0});return}if((s=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var o,i;e.setExpanded(s?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const a=i.split(".");s=Math.max(s,a.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,r)=>{e.toggleExpanded=t=>{r.setExpanded(s=>{var o;const i=s===!0?!0:!!(s!=null&&s[e.id]);let a={};if(s===!0?Object.keys(r.getRowModel().rowsById).forEach(c=>{a[c]=!0}):a=s,t=(o=t)!=null?o:!i,!i&&t)return{...a,[e.id]:!0};if(i&&!t){const{[e.id]:c,...d}=a;return d}return s})},e.getIsExpanded=()=>{var t;const s=r.getState().expanded;return!!((t=r.options.getIsRowExpanded==null?void 0:r.options.getIsRowExpanded(e))!=null?t:s===!0||s?.[e.id])},e.getCanExpand=()=>{var t,s,o;return(t=r.options.getRowCanExpand==null?void 0:r.options.getRowCanExpand(e))!=null?t:((s=r.options.enableExpanding)!=null?s:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let t=!0,s=e;for(;t&&s.parentId;)s=r.getRow(s.parentId,!0),t=s.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Oe=0,Be=10,De=()=>({pageIndex:Oe,pageSize:Be}),jr={getInitialState:e=>({...e,pagination:{...De(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:V("pagination",e)}),createTable:e=>{let r=!1,t=!1;e._autoResetPageIndex=()=>{var s,o;if(!r){e._queue(()=>{r=!0});return}if((s=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=s=>{const o=i=>H(s,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=s=>{var o;e.setPagination(s?De():(o=e.initialState.pagination)!=null?o:De())},e.setPageIndex=s=>{e.setPagination(o=>{let i=H(s,o.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,a)),{...o,pageIndex:i}})},e.resetPageIndex=s=>{var o,i;e.setPageIndex(s?Oe:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:Oe)},e.resetPageSize=s=>{var o,i;e.setPageSize(s?Be:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:Be)},e.setPageSize=s=>{e.setPagination(o=>{const i=Math.max(1,H(s,o.pageSize)),a=o.pageSize*o.pageIndex,c=Math.floor(a/i);return{...o,pageIndex:c,pageSize:i}})},e.setPageCount=s=>e.setPagination(o=>{var i;let a=H(s,(i=e.options.pageCount)!=null?i:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...o,pageCount:a}}),e.getPageOptions=S(()=>[e.getPageCount()],s=>{let o=[];return s&&s>0&&(o=[...new Array(s)].fill(null).map((i,a)=>a)),o},y(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:s<o-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},Te=()=>({top:[],bottom:[]}),Cr={getInitialState:e=>({rowPinning:Te(),...e}),getDefaultOptions:e=>({onRowPinningChange:V("rowPinning",e)}),createRow:(e,r)=>{e.pin=(t,s,o)=>{const i=s?e.getLeafRows().map(d=>{let{id:g}=d;return g}):[],a=o?e.getParentRows().map(d=>{let{id:g}=d;return g}):[],c=new Set([...a,e.id,...i]);r.setRowPinning(d=>{var g,f;if(t==="bottom"){var p,u;return{top:((p=d?.top)!=null?p:[]).filter(m=>!(c!=null&&c.has(m))),bottom:[...((u=d?.bottom)!=null?u:[]).filter(m=>!(c!=null&&c.has(m))),...Array.from(c)]}}if(t==="top"){var l,h;return{top:[...((l=d?.top)!=null?l:[]).filter(m=>!(c!=null&&c.has(m))),...Array.from(c)],bottom:((h=d?.bottom)!=null?h:[]).filter(m=>!(c!=null&&c.has(m)))}}return{top:((g=d?.top)!=null?g:[]).filter(m=>!(c!=null&&c.has(m))),bottom:((f=d?.bottom)!=null?f:[]).filter(m=>!(c!=null&&c.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:s,enablePinning:o}=r.options;return typeof s=="function"?s(e):(t=s??o)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:s,bottom:o}=r.getState().rowPinning,i=t.some(c=>s?.includes(c)),a=t.some(c=>o?.includes(c));return i?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var t,s;const o=e.getIsPinned();if(!o)return-1;const i=(t=o==="top"?r.getTopRows():r.getBottomRows())==null?void 0:t.map(a=>{let{id:c}=a;return c});return(s=i?.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=r=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(r),e.resetRowPinning=r=>{var t,s;return e.setRowPinning(r?Te():(t=(s=e.initialState)==null?void 0:s.rowPinning)!=null?t:Te())},e.getIsSomeRowsPinned=r=>{var t;const s=e.getState().rowPinning;if(!r){var o,i;return!!((o=s.top)!=null&&o.length||(i=s.bottom)!=null&&i.length)}return!!((t=s[r])!=null&&t.length)},e._getPinnedRows=(r,t,s)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(t??[]).map(a=>{const c=e.getRow(a,!0);return c.getIsAllParentsExpanded()?c:null}):(t??[]).map(a=>r.find(c=>c.id===a))).filter(Boolean).map(a=>({...a,position:s}))},e.getTopRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(r,t)=>e._getPinnedRows(r,t,"top"),y(e.options,"debugRows")),e.getBottomRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(r,t)=>e._getPinnedRows(r,t,"bottom"),y(e.options,"debugRows")),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(r,t,s)=>{const o=new Set([...t??[],...s??[]]);return r.filter(i=>!o.has(i.id))},y(e.options,"debugRows"))}},Sr={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:V("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=r=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(r),e.resetRowSelection=r=>{var t;return e.setRowSelection(r?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=r=>{e.setRowSelection(t=>{r=typeof r<"u"?r:!e.getIsAllRowsSelected();const s={...t},o=e.getPreGroupedRowModel().flatRows;return r?o.forEach(i=>{i.getCanSelect()&&(s[i.id]=!0)}):o.forEach(i=>{delete s[i.id]}),s})},e.toggleAllPageRowsSelected=r=>e.setRowSelection(t=>{const s=typeof r<"u"?r:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{qe(o,i.id,s,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(r,t)=>Object.keys(r).length?Ge(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable")),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(r,t)=>Object.keys(r).length?Ge(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable")),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(r,t)=>Object.keys(r).length?Ge(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const r=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let s=!!(r.length&&Object.keys(t).length);return s&&r.some(o=>o.getCanSelect()&&!t[o.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const r=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:t}=e.getState();let s=!!r.length;return s&&r.some(o=>!t[o.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var r;const t=Object.keys((r=e.getState().rowSelection)!=null?r:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const r=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:r.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>r=>{e.toggleAllRowsSelected(r.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>r=>{e.toggleAllPageRowsSelected(r.target.checked)}},createRow:(e,r)=>{e.toggleSelected=(t,s)=>{const o=e.getIsSelected();r.setRowSelection(i=>{var a;if(t=typeof t<"u"?t:!o,e.getCanSelect()&&o===t)return i;const c={...i};return qe(c,e.id,t,(a=s?.selectChildren)!=null?a:!0,r),c})},e.getIsSelected=()=>{const{rowSelection:t}=r.getState();return tt(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=r.getState();return Ue(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=r.getState();return Ue(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof r.options.enableRowSelection=="function"?r.options.enableRowSelection(e):(t=r.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof r.options.enableSubRowSelection=="function"?r.options.enableSubRowSelection(e):(t=r.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof r.options.enableMultiRowSelection=="function"?r.options.enableMultiRowSelection(e):(t=r.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return s=>{var o;t&&e.toggleSelected((o=s.target)==null?void 0:o.checked)}}}},qe=(e,r,t,s,o)=>{var i;const a=o.getRow(r,!0);t?(a.getCanMultiSelect()||Object.keys(e).forEach(c=>delete e[c]),a.getCanSelect()&&(e[r]=!0)):delete e[r],s&&(i=a.subRows)!=null&&i.length&&a.getCanSelectSubRows()&&a.subRows.forEach(c=>qe(e,c.id,t,s,o))};function Ge(e,r){const t=e.getState().rowSelection,s=[],o={},i=function(a,c){return a.map(d=>{var g;const f=tt(d,t);if(f&&(s.push(d),o[d.id]=d),(g=d.subRows)!=null&&g.length&&(d={...d,subRows:i(d.subRows)}),f)return d}).filter(Boolean)};return{rows:i(r.rows),flatRows:s,rowsById:o}}function tt(e,r){var t;return(t=r[e.id])!=null?t:!1}function Ue(e,r,t){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let o=!0,i=!1;return e.subRows.forEach(a=>{if(!(i&&!o)&&(a.getCanSelect()&&(tt(a,r)?i=!0:o=!1),a.subRows&&a.subRows.length)){const c=Ue(a,r);c==="all"?i=!0:(c==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const Ke=/([0-9]+)/gm,yr=(e,r,t)=>Pn(B(e.getValue(t)).toLowerCase(),B(r.getValue(t)).toLowerCase()),Nr=(e,r,t)=>Pn(B(e.getValue(t)),B(r.getValue(t))),Rr=(e,r,t)=>nt(B(e.getValue(t)).toLowerCase(),B(r.getValue(t)).toLowerCase()),br=(e,r,t)=>nt(B(e.getValue(t)),B(r.getValue(t))),_r=(e,r,t)=>{const s=e.getValue(t),o=r.getValue(t);return s>o?1:s<o?-1:0},Fr=(e,r,t)=>nt(e.getValue(t),r.getValue(t));function nt(e,r){return e===r?0:e>r?1:-1}function B(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Pn(e,r){const t=e.split(Ke).filter(Boolean),s=r.split(Ke).filter(Boolean);for(;t.length&&s.length;){const o=t.shift(),i=s.shift(),a=parseInt(o,10),c=parseInt(i,10),d=[a,c].sort();if(isNaN(d[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(d[1]))return isNaN(a)?-1:1;if(a>c)return 1;if(c>a)return-1}return t.length-s.length}const se={alphanumeric:yr,alphanumericCaseSensitive:Nr,text:Rr,textCaseSensitive:br,datetime:_r,basic:Fr},Pr={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:V("sorting",e),isMultiSortEvent:r=>r.shiftKey}),createColumn:(e,r)=>{e.getAutoSortingFn=()=>{const t=r.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const o of t){const i=o?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return se.datetime;if(typeof i=="string"&&(s=!0,i.split(Ke).length>1))return se.alphanumeric}return s?se.text:se.basic},e.getAutoSortDir=()=>{const t=r.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,s;if(!e)throw new Error;return Se(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(s=r.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?t:se[e.columnDef.sortingFn]},e.toggleSorting=(t,s)=>{const o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;r.setSorting(a=>{const c=a?.find(l=>l.id===e.id),d=a?.findIndex(l=>l.id===e.id);let g=[],f,p=i?t:o==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&s?c?f="toggle":f="add":a!=null&&a.length&&d!==a.length-1?f="replace":c?f="toggle":f="replace",f==="toggle"&&(i||o||(f="remove")),f==="add"){var u;g=[...a,{id:e.id,desc:p}],g.splice(0,g.length-((u=r.options.maxMultiSortColCount)!=null?u:Number.MAX_SAFE_INTEGER))}else f==="toggle"?g=a.map(l=>l.id===e.id?{...l,desc:p}:l):f==="remove"?g=a.filter(l=>l.id!==e.id):g=[{id:e.id,desc:p}];return g})},e.getFirstSortDir=()=>{var t,s;return((t=(s=e.columnDef.sortDescFirst)!=null?s:r.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var s,o;const i=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==i&&((s=r.options.enableSortingRemoval)==null||s)&&(!(t&&(o=r.options.enableMultiRemove)!=null)||o)?!1:a==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,s;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((s=r.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,s;return(t=(s=e.columnDef.enableMultiSort)!=null?s:r.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const s=(t=r.getState().sorting)==null?void 0:t.find(o=>o.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,s;return(t=(s=r.getState().sorting)==null?void 0:s.findIndex(o=>o.id===e.id))!=null?t:-1},e.clearSorting=()=>{r.setSorting(t=>t!=null&&t.length?t.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return s=>{t&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?r.options.isMultiSortEvent==null?void 0:r.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=r=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(r),e.resetSorting=r=>{var t,s;e.setSorting(r?[]:(t=(s=e.initialState)==null?void 0:s.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},kr=[Js,xr,dr,gr,Ys,Zs,hr,vr,Pr,ur,wr,jr,Cr,Sr,pr];function Ir(e){var r,t;const s=[...kr,...(r=e._features)!=null?r:[]];let o={_features:s};const i=o._features.reduce((u,l)=>Object.assign(u,l.getDefaultOptions==null?void 0:l.getDefaultOptions(o)),{}),a=u=>o.options.mergeOptions?o.options.mergeOptions(i,u):{...i,...u};let d={...{},...(t=e.initialState)!=null?t:{}};o._features.forEach(u=>{var l;d=(l=u.getInitialState==null?void 0:u.getInitialState(d))!=null?l:d});const g=[];let f=!1;const p={_features:s,options:{...i,...e},initialState:d,_queue:u=>{g.push(u),f||(f=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();f=!1}).catch(l=>setTimeout(()=>{throw l})))},reset:()=>{o.setState(o.initialState)},setOptions:u=>{const l=H(u,o.options);o.options=a(l)},getState:()=>o.options.state,setState:u=>{o.options.onStateChange==null||o.options.onStateChange(u)},_getRowId:(u,l,h)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(u,l,h))!=null?m:`${h?[h.id,l].join("."):l}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(u,l)=>{let h=(l?o.getPrePaginationRowModel():o.getRowModel()).rowsById[u];if(!h&&(h=o.getCoreRowModel().rowsById[u],!h))throw new Error;return h},_getDefaultColumnDef:S(()=>[o.options.defaultColumn],u=>{var l;return u=(l=u)!=null?l:{},{header:h=>{const m=h.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:h=>{var m,x;return(m=(x=h.renderValue())==null||x.toString==null?void 0:x.toString())!=null?m:null},...o._features.reduce((h,m)=>Object.assign(h,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...u}},y(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:S(()=>[o._getColumnDefs()],u=>{const l=function(h,m,x){return x===void 0&&(x=0),h.map(v=>{const j=Xs(o,v,x,m),R=v;return j.columns=R.columns?l(R.columns,j,x+1):[],j})};return l(u)},y(e,"debugColumns")),getAllFlatColumns:S(()=>[o.getAllColumns()],u=>u.flatMap(l=>l.getFlatColumns()),y(e,"debugColumns")),_getAllFlatColumnsById:S(()=>[o.getAllFlatColumns()],u=>u.reduce((l,h)=>(l[h.id]=h,l),{}),y(e,"debugColumns")),getAllLeafColumns:S(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(u,l)=>{let h=u.flatMap(m=>m.getLeafColumns());return l(h)},y(e,"debugColumns")),getColumn:u=>o._getAllFlatColumnsById()[u]};Object.assign(o,p);for(let u=0;u<o._features.length;u++){const l=o._features[u];l==null||l.createTable==null||l.createTable(o)}return o}function $r(){return e=>S(()=>[e.options.data],r=>{const t={rows:[],flatRows:[],rowsById:{}},s=function(o,i,a){i===void 0&&(i=0);const c=[];for(let g=0;g<o.length;g++){const f=Ze(e,e._getRowId(o[g],g,a),o[g],g,i,void 0,a?.id);if(t.flatRows.push(f),t.rowsById[f.id]=f,c.push(f),e.options.getSubRows){var d;f.originalSubRows=e.options.getSubRows(o[g],g),(d=f.originalSubRows)!=null&&d.length&&(f.subRows=s(f.originalSubRows,i+1,f))}}return c};return t.rows=s(r),t},y(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Mr(e){const r=[],t=s=>{var o;r.push(s),(o=s.subRows)!=null&&o.length&&s.getIsExpanded()&&s.subRows.forEach(t)};return e.rows.forEach(t),{rows:r,flatRows:e.flatRows,rowsById:e.rowsById}}function Vr(e,r,t){return t.options.filterFromLeafRows?Er(e,r,t):Ar(e,r,t)}function Er(e,r,t){var s;const o=[],i={},a=(s=t.options.maxLeafRowFilterDepth)!=null?s:100,c=function(d,g){g===void 0&&(g=0);const f=[];for(let u=0;u<d.length;u++){var p;let l=d[u];const h=Ze(t,l.id,l.original,l.index,l.depth,void 0,l.parentId);if(h.columnFilters=l.columnFilters,(p=l.subRows)!=null&&p.length&&g<a){if(h.subRows=c(l.subRows,g+1),l=h,r(l)&&!h.subRows.length){f.push(l),i[l.id]=l,o.push(l);continue}if(r(l)||h.subRows.length){f.push(l),i[l.id]=l,o.push(l);continue}}else l=h,r(l)&&(f.push(l),i[l.id]=l,o.push(l))}return f};return{rows:c(e),flatRows:o,rowsById:i}}function Ar(e,r,t){var s;const o=[],i={},a=(s=t.options.maxLeafRowFilterDepth)!=null?s:100,c=function(d,g){g===void 0&&(g=0);const f=[];for(let u=0;u<d.length;u++){let l=d[u];if(r(l)){var p;if((p=l.subRows)!=null&&p.length&&g<a){const m=Ze(t,l.id,l.original,l.index,l.depth,void 0,l.parentId);m.subRows=c(l.subRows,g+1),l=m}f.push(l),o.push(l),i[l.id]=l}}return f};return{rows:c(e),flatRows:o,rowsById:i}}function Dr(){return e=>S(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(r,t,s)=>{if(!r.rows.length||!(t!=null&&t.length)&&!s){for(let u=0;u<r.flatRows.length;u++)r.flatRows[u].columnFilters={},r.flatRows[u].columnFiltersMeta={};return r}const o=[],i=[];(t??[]).forEach(u=>{var l;const h=e.getColumn(u.id);if(!h)return;const m=h.getFilterFn();m&&o.push({id:u.id,filterFn:m,resolvedValue:(l=m.resolveFilterValue==null?void 0:m.resolveFilterValue(u.value))!=null?l:u.value})});const a=(t??[]).map(u=>u.id),c=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(u=>u.getCanGlobalFilter());s&&c&&d.length&&(a.push("__global__"),d.forEach(u=>{var l;i.push({id:u.id,filterFn:c,resolvedValue:(l=c.resolveFilterValue==null?void 0:c.resolveFilterValue(s))!=null?l:s})}));let g,f;for(let u=0;u<r.flatRows.length;u++){const l=r.flatRows[u];if(l.columnFilters={},o.length)for(let h=0;h<o.length;h++){g=o[h];const m=g.id;l.columnFilters[m]=g.filterFn(l,m,g.resolvedValue,x=>{l.columnFiltersMeta[m]=x})}if(i.length){for(let h=0;h<i.length;h++){f=i[h];const m=f.id;if(f.filterFn(l,m,f.resolvedValue,x=>{l.columnFiltersMeta[m]=x})){l.columnFilters.__global__=!0;break}}l.columnFilters.__global__!==!0&&(l.columnFilters.__global__=!1)}}const p=u=>{for(let l=0;l<a.length;l++)if(u.columnFilters[a[l]]===!1)return!1;return!0};return Vr(r.rows,p,e)},y(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Tr(e){return r=>S(()=>[r.getState().pagination,r.getPrePaginationRowModel(),r.options.paginateExpandedRows?void 0:r.getState().expanded],(t,s)=>{if(!s.rows.length)return s;const{pageSize:o,pageIndex:i}=t;let{rows:a,flatRows:c,rowsById:d}=s;const g=o*i,f=g+o;a=a.slice(g,f);let p;r.options.paginateExpandedRows?p={rows:a,flatRows:c,rowsById:d}:p=Mr({rows:a,flatRows:c,rowsById:d}),p.flatRows=[];const u=l=>{p.flatRows.push(l),l.subRows.length&&l.subRows.forEach(u)};return p.rows.forEach(u),p},y(r.options,"debugTable"))}function Gr(){return e=>S(()=>[e.getState().sorting,e.getPreSortedRowModel()],(r,t)=>{if(!t.rows.length||!(r!=null&&r.length))return t;const s=e.getState().sorting,o=[],i=s.filter(d=>{var g;return(g=e.getColumn(d.id))==null?void 0:g.getCanSort()}),a={};i.forEach(d=>{const g=e.getColumn(d.id);g&&(a[d.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const c=d=>{const g=d.map(f=>({...f}));return g.sort((f,p)=>{for(let l=0;l<i.length;l+=1){var u;const h=i[l],m=a[h.id],x=m.sortUndefined,v=(u=h?.desc)!=null?u:!1;let j=0;if(x){const R=f.getValue(h.id),N=p.getValue(h.id),b=R===void 0,k=N===void 0;if(b||k){if(x==="first")return b?-1:1;if(x==="last")return b?1:-1;j=b&&k?0:b?x:-x}}if(j===0&&(j=m.sortingFn(f,p,h.id)),j!==0)return v&&(j*=-1),m.invertSorting&&(j*=-1),j}return f.index-p.index}),g.forEach(f=>{var p;o.push(f),(p=f.subRows)!=null&&p.length&&(f.subRows=c(f.subRows))}),g};return{rows:c(t.rows),flatRows:o,rowsById:t.rowsById}},y(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Rt(e,r){return e?Lr(e)?C.createElement(e,r):e:null}function Lr(e){return Hr(e)||typeof e=="function"||zr(e)}function Hr(e){return typeof e=="function"&&(()=>{const r=Object.getPrototypeOf(e);return r.prototype&&r.prototype.isReactComponent})()}function zr(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Or(e){const r={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=C.useState(()=>({current:Ir(r)})),[s,o]=C.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...s,...e.state},onStateChange:a=>{o(a),e.onStateChange==null||e.onStateChange(a)}})),t.current}const Qe=C.forwardRef(({className:e,...r},t)=>n.jsx(Je,{ref:t,className:F("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...r,children:n.jsx(Zt,{className:F("flex items-center justify-center text-current"),children:n.jsx(K,{className:"h-4 w-4"})})}));Qe.displayName=Je.displayName;function Br(e,r){return e.map(t=>{const s=t.status?!!r.status[t.status]:!0,o=t.priority?!!r.priority[t.priority]:!0,i=t.type?!!r.type[t.type]:!0,a=[];return!s&&t.status&&a.push({field:"status",severity:"warning",message:`Status "${t.status}" is not mapped`,suggestion:"Will use default: backlog"}),!o&&t.priority&&a.push({field:"priority",severity:"warning",message:`Priority "${t.priority}" is not mapped`,suggestion:"Will use default: medium"}),!i&&t.type&&a.push({field:"type",severity:"warning",message:`Type "${t.type}" is not mapped`,suggestion:"Will use default: task"}),{id:t.id,source:t,target:{title:t.title,description:t.body||"",status:t.status&&r.status[t.status]||"backlog",priority:t.priority&&r.priority[t.priority]||"medium",type:t.type&&r.type[t.type]||"task",labels:t.labels,assignee:t.assignees[0]||null,createdAt:t.createdAt,updatedAt:t.updatedAt},mappingStatus:{status:s?"mapped":"unmapped",priority:o?"mapped":"unmapped",type:i?"mapped":"unmapped"},conflicts:a,selected:!0}})}function qr({items:e,mappings:r,selectedIds:t,onSelectionChange:s}){const[o,i]=C.useState([]),[a,c]=C.useState([]),[d,g]=C.useState(""),f=C.useMemo(()=>Br(e,r),[e,r]),p=C.useMemo(()=>[{id:"select",header:({table:m})=>n.jsx(Qe,{checked:m.getIsAllPageRowsSelected()||m.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:x=>{m.toggleAllPageRowsSelected(!!x);const v=new Set;x&&f.forEach(j=>v.add(j.id)),s(v)},"aria-label":"Select all"}),cell:({row:m})=>n.jsx(Qe,{checked:t.has(m.original.id),onCheckedChange:x=>{const v=new Set(t);x?v.add(m.original.id):v.delete(m.original.id),s(v)},"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,size:40},{id:"status-indicator",header:"",cell:({row:m})=>{const x=m.original.conflicts.length>0;return n.jsx(ws,{children:n.jsxs(js,{children:[n.jsx(Cs,{asChild:!0,children:n.jsx("div",{className:"flex items-center justify-center",children:x?n.jsx(Q,{className:"h-4 w-4 text-amber-500"}):n.jsx(K,{className:"h-4 w-4 text-green-500"})})}),n.jsx(Ss,{children:x?m.original.conflicts.map(v=>v.message).join(", "):"Ready to import"})]})})},size:40},{accessorKey:"source.title",header:({column:m})=>n.jsxs(_,{variant:"ghost",onClick:()=>m.toggleSorting(m.getIsSorted()==="asc"),className:"-ml-4",children:["Title",n.jsx(ks,{className:"ml-2 h-4 w-4"})]}),cell:({row:m})=>n.jsxs("div",{className:"max-w-[300px]",children:[n.jsx("p",{className:"font-medium truncate",title:m.original.source.title,children:m.original.source.title}),m.original.source.url&&n.jsxs("a",{href:m.original.source.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary inline-flex items-center gap-1",children:["#",m.original.source.issueNumber||"View",n.jsx(Le,{className:"h-3 w-3"})]})]})},{id:"status-mapping",header:"Status",cell:({row:m})=>{const x=m.original.source.status,v=m.original.target.status,j=m.original.mappingStatus.status==="mapped",R=vn.find(N=>N.value===v);return n.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:x?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded truncate max-w-[80px]",children:x}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground shrink-0"}),n.jsxs(M,{variant:j?"outline":"secondary",className:F("gap-1",!j&&"bg-amber-100 text-amber-700 border-amber-200"),children:[R&&n.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R.color}}),R?.label||v]})]}):n.jsx("span",{className:"text-muted-foreground",children:"—"})})}},{id:"priority-mapping",header:"Priority",cell:({row:m})=>{const x=m.original.source.priority,v=m.original.target.priority,j=m.original.mappingStatus.priority==="mapped",R=wn.find(N=>N.value===v);return n.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:x?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded truncate max-w-[60px]",children:x}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground shrink-0"}),n.jsxs(M,{variant:j?"outline":"secondary",className:F("gap-1",!j&&"bg-amber-100 text-amber-700 border-amber-200"),children:[R&&n.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R.color}}),R?.label||v]})]}):n.jsx("span",{className:"text-muted-foreground",children:"—"})})}},{id:"type-mapping",header:"Type",cell:({row:m})=>{const x=m.original.source.type,v=m.original.target.type,j=m.original.mappingStatus.type==="mapped",R=jn.find(N=>N.value===v);return n.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:x?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded truncate max-w-[60px]",children:x}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground shrink-0"}),n.jsxs(M,{variant:j?"outline":"secondary",className:F("gap-1",!j&&"bg-amber-100 text-amber-700 border-amber-200"),children:[R?.icon," ",R?.label||v]})]}):n.jsx("span",{className:"text-muted-foreground",children:"—"})})}},{accessorKey:"source.labels",header:"Labels",cell:({row:m})=>{const x=m.original.source.labels;return x.length===0?n.jsx("span",{className:"text-muted-foreground",children:"—"}):n.jsxs("div",{className:"flex flex-wrap gap-1 max-w-[150px]",children:[x.slice(0,2).map(v=>n.jsx(M,{variant:"secondary",className:"text-[10px]",children:v},v)),x.length>2&&n.jsxs(M,{variant:"outline",className:"text-[10px]",children:["+",x.length-2]})]})}},{accessorKey:"source.createdAt",header:"Created",cell:({row:m})=>{const x=new Date(m.original.source.createdAt);return n.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:x.toLocaleDateString()})}}],[f,t,s]),u=Or({data:f,columns:p,state:{sorting:o,columnFilters:a,globalFilter:d},onSortingChange:i,onColumnFiltersChange:c,onGlobalFilterChange:g,getCoreRowModel:$r(),getFilteredRowModel:Dr(),getPaginationRowModel:Tr(),getSortedRowModel:Gr(),initialState:{pagination:{pageSize:20}}}),l=f.filter(m=>m.conflicts.length>0).length,h=t.size;return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"relative max-w-sm",children:[n.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(xe,{placeholder:"Search items...",value:d??"",onChange:m=>g(m.target.value),className:"pl-9 h-9"})]}),n.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[n.jsxs("span",{children:[n.jsx("span",{className:"font-medium",children:h}),n.jsxs("span",{className:"text-muted-foreground",children:[" of ",f.length," selected"]})]}),l>0&&n.jsxs("span",{className:"flex items-center gap-1 text-amber-600",children:[n.jsx(Q,{className:"h-4 w-4"}),l," with warnings"]})]})]}),n.jsx("div",{className:"rounded-2xl glass shadow-lg overflow-hidden",children:n.jsxs(fs,{children:[n.jsx(xs,{children:u.getHeaderGroups().map(m=>n.jsx(Ie,{className:"bg-muted/50",children:m.headers.map(x=>n.jsx(hs,{style:{width:x.getSize()!==150?x.getSize():void 0},children:x.isPlaceholder?null:Rt(x.column.columnDef.header,x.getContext())},x.id))},m.id))}),n.jsx(vs,{children:u.getRowModel().rows.length?u.getRowModel().rows.map(m=>n.jsx(Ie,{"data-state":t.has(m.original.id)&&"selected",className:F(m.original.conflicts.length>0&&"bg-amber-50/50 dark:bg-amber-900/10"),children:m.getVisibleCells().map(x=>n.jsx(Ct,{children:Rt(x.column.columnDef.cell,x.getContext())},x.id))},m.id)):n.jsx(Ie,{children:n.jsx(Ct,{colSpan:p.length,className:"h-24 text-center",children:"No items found."})})})]})}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx("span",{children:"Show"}),n.jsxs(qt,{value:String(u.getState().pagination.pageSize),onValueChange:m=>u.setPageSize(Number(m)),children:[n.jsx(Ut,{className:"h-8 w-[70px]",children:n.jsx(Kt,{})}),n.jsx(Qt,{children:[10,20,50,100].map(m=>n.jsx(Wt,{value:String(m),children:m},m))})]}),n.jsx("span",{children:"per page"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.setPageIndex(0),disabled:!u.getCanPreviousPage(),children:n.jsx($s,{className:"h-4 w-4"})}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.previousPage(),disabled:!u.getCanPreviousPage(),children:n.jsx(qn,{className:"h-4 w-4"})}),n.jsxs("span",{className:"text-sm",children:["Page ",u.getState().pagination.pageIndex+1," of ",u.getPageCount()]}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.nextPage(),disabled:!u.getCanNextPage(),children:n.jsx(Et,{className:"h-4 w-4"})}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.setPageIndex(u.getPageCount()-1),disabled:!u.getCanNextPage(),children:n.jsx(Vs,{className:"h-4 w-4"})})]})]})]})}function Ur({summary:e,iterations:r,projectKey:t,enableSync:s}){const o=e.conflicts.errors>0,i=e.conflicts.warnings>0;return n.jsxs("div",{className:"space-y-4",children:[o?n.jsxs("div",{className:"flex items-center gap-3 p-4 bg-destructive/10 border border-destructive/20 rounded-lg",children:[n.jsx(Q,{className:"h-5 w-5 text-destructive"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-destructive",children:"Cannot proceed with import"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.conflicts.errors," error",e.conflicts.errors!==1?"s":""," must be resolved"]})]})]}):i?n.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/20 rounded-lg",children:[n.jsx(Q,{className:"h-5 w-5 text-amber-500"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-amber-700 dark:text-amber-400",children:"Ready with warnings"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.conflicts.warnings," item",e.conflicts.warnings!==1?"s":""," will use default values"]})]})]}):n.jsxs("div",{className:"flex items-center gap-3 p-4 bg-green-500/10 border border-green-500/20 rounded-lg",children:[n.jsx(ve,{className:"h-5 w-5 text-green-500"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-green-700 dark:text-green-400",children:"Ready to import"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"All fields mapped correctly"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-sm font-medium",children:"What will be created"}),n.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[n.jsxs("div",{className:"bg-card rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:n.jsx(At,{className:"h-4 w-4 text-primary"})}),n.jsx("span",{className:"text-2xl font-bold",children:e.itemsToCreate})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Tickets"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[t,"-1 → ",t,"-",e.itemsToCreate]})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 flex items-center justify-center",children:n.jsx(Ot,{className:"h-4 w-4 text-amber-500"})}),n.jsx("span",{className:"text-2xl font-bold",children:r.length})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Sprints"}),r.length>0&&n.jsxs("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:[r[0].title,r.length>1&&` +${r.length-1} more`]})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 flex items-center justify-center",children:n.jsx(ys,{className:"h-4 w-4 text-indigo-500"})}),n.jsx("span",{className:"text-2xl font-bold",children:e.unmappedValues.status.length+e.unmappedValues.priority.length+e.unmappedValues.type.length||"—"})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique labels"})]})]})]}),s&&n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[n.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium",children:"Bidirectional sync enabled"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Changes will sync between profClaw and GitHub"})]}),n.jsxs(M,{variant:"outline",className:"text-green-600",children:[n.jsx(ve,{className:"h-3 w-3 mr-1"}),"Active"]})]}),n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[n.jsx(Un,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium",children:"Original dates preserved"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Created/updated timestamps will be imported from GitHub"})]})]}),e.itemsToSkip>0&&n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/30 rounded-lg",children:[n.jsx(Q,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm",children:[n.jsx("span",{className:"font-medium",children:e.itemsToSkip})," items will be skipped"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"These items are deselected or have errors"})]})]}),(e.unmappedValues.status.length>0||e.unmappedValues.priority.length>0||e.unmappedValues.type.length>0)&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"text-sm font-medium text-amber-600",children:"Unmapped values (using defaults)"}),n.jsxs("div",{className:"space-y-1 text-xs",children:[e.unmappedValues.status.length>0&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground w-16",children:"Status:"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:e.unmappedValues.status.map(a=>n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded",children:a},a))}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground"}),n.jsx(M,{variant:"secondary",children:"backlog"})]}),e.unmappedValues.priority.length>0&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground w-16",children:"Priority:"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:e.unmappedValues.priority.map(a=>n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded",children:a},a))}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground"}),n.jsx(M,{variant:"secondary",children:"medium"})]}),e.unmappedValues.type.length>0&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground w-16",children:"Type:"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:e.unmappedValues.type.map(a=>n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded",children:a},a))}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground"}),n.jsx(M,{variant:"secondary",children:"task"})]})]})]})]})}const re=["connect","select","mapping","preview","configure","import"],Kr={connect:"Connect",select:"Select",mapping:"Map Fields",preview:"Preview",configure:"Configure",import:"Import"},Qr=["📋","🚀","💡","🎯","⚡","🔧","📱","🌐","🎨","📊"],Wr=["#6366f1","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#84cc16"],Xr=["read:project","repo","user:email"];function Jr({open:e,onOpenChange:r,onSuccess:t}){const s=Dt(),[o,i]=C.useState("connect"),[a,c]=C.useState("oauth"),[d,g]=C.useState(""),[f,p]=C.useState(!1),[u,l]=C.useState(null),[h,m]=C.useState(null),[x,v]=C.useState({status:{},priority:{},type:{}}),[j,R]=C.useState(new Set),[N,b]=C.useState(null),[k,G]=C.useState(""),[q,J]=C.useState(""),[Y,Z]=C.useState("📋"),[ee,st]=C.useState("#6366f1"),[rt,ot]=C.useState(!0),[ye,it]=C.useState(!0),[at,lt]=C.useState(!0),[ue,ut]=C.useState(null),{data:A,isLoading:kn}=X({queryKey:["auth-status"],queryFn:async()=>{const w=await fetch("/api/auth/me");return w.ok?w.json():{authenticated:!1}},enabled:e}),{data:ct,isLoading:In}=X({queryKey:["github-token-status"],queryFn:async()=>{const w=await fetch("/api/import/github/status");if(!w.ok)throw new Error("Failed to check token");return w.json()},enabled:e&&!A?.user?.hasGitHubToken}),ce=A?.user?.hasGitHubToken||ct?.hasToken,dt=A?.user?.connectedAccounts?.find(w=>w.provider==="github")?.username||ct?.username;C.useEffect(()=>{ce&&o==="connect"&&i("select")},[ce,o]);const{data:gt,isLoading:Ne,refetch:$n}=X({queryKey:["github-projects"],queryFn:async()=>{const w=await fetch("/api/import/github/projects");if(!w.ok)throw new Error("Failed to fetch projects");return w.json()},enabled:o==="select"}),{data:mt}=X({queryKey:["github-oauth-url"],queryFn:async()=>{const w=await fetch("/api/auth/github/url");return w.ok?w.json():null},enabled:e&&a==="oauth"}),Re=L({mutationFn:async w=>{const I=await fetch("/api/import/github/validate-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:w})});if(!I.ok){const U=await I.json();throw new Error(U.error||"Token validation failed")}return I.json()},onSuccess:w=>{$.success(`Connected as ${w.username}`),s.invalidateQueries({queryKey:["github-token-status"]}),s.invalidateQueries({queryKey:["auth-status"]}),i("select")},onError:w=>{$.error(w.message)}}),be=L({mutationFn:async w=>{const I=await fetch(`/api/import/github/projects/${encodeURIComponent(w)}/preview`);if(!I.ok)throw new Error("Failed to fetch project preview");return I.json()},onSuccess:w=>{m(w),v(w.fieldMappings),R(new Set(w.items.map(U=>U.id)));const I=w.project.title.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6);G(I),J(w.project.title),i("mapping")},onError:w=>{$.error(w.message)}}),_e=L({mutationFn:async()=>{const w=await fetch(`/api/import/github/projects/${encodeURIComponent(u)}/dry-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fieldMappings:x,selectedItemIds:Array.from(j)})});if(!w.ok)throw new Error("Dry run failed");return w.json()},onSuccess:w=>{b(w)},onError:w=>{$.error(w.message)}}),te=L({mutationFn:async()=>{const w=await fetch(`/api/import/github/projects/${encodeURIComponent(u)}/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectKey:k,projectName:q,icon:Y,color:ee,importIterations:rt,enableSync:ye,preserveTimestamps:at,selectedItemIds:Array.from(j),fieldMappings:x})});if(!w.ok){const I=await w.json();throw new Error(I.error||"Import failed")}return w.json()},onSuccess:w=>{ut(w),s.invalidateQueries({queryKey:["projects"]}),$.success("Project imported successfully!"),t?.()},onError:w=>{$.error(w.message)}}),pt=L({mutationFn:async()=>{const w=await fetch("/api/import/github/disconnect",{method:"DELETE"});if(!w.ok)throw new Error("Failed to disconnect");return w.json()},onSuccess:()=>{$.success("Disconnected from GitHub"),s.invalidateQueries({queryKey:["github-token-status"]}),s.invalidateQueries({queryKey:["auth-status"]}),i("connect"),g("")}});C.useEffect(()=>{e||setTimeout(()=>{i(ce?"select":"connect"),g(""),c("oauth"),p(!1),l(null),m(null),b(null),ut(null),G(""),J(""),Z("📋"),st("#6366f1"),ot(!0),it(!0),lt(!0),R(new Set),v({status:{},priority:{},type:{}})},200)},[e,ce]);const ft=re.indexOf(o),Mn=(ft+1)/re.length*100,xt=o!=="connect"&&o!=="import",Vn=()=>{switch(o){case"connect":return a==="oauth"||d.length>0;case"select":return u!==null;case"mapping":return!0;case"preview":return j.size>0;case"configure":return k.length>=2&&q.length>=1;default:return!1}},En=()=>{const w=re.indexOf(o);w>0&&i(re[w-1])},An=async()=>{switch(o){case"connect":a==="oauth"&&mt?.url?window.location.href=mt.url:Re.mutate(d);break;case"select":u&&be.mutate(u);break;case"mapping":i("preview");break;case"preview":await _e.mutateAsync(),i("configure");break;case"configure":i("import"),te.mutate();break}},Dn=w=>{navigator.clipboard.writeText(w),$.success("Copied to clipboard")},Tn=C.useMemo(()=>{if(N)return N.summary;const w=h?.items||[],I=j,U=new Set,Fe=new Set,Pe=new Set;for(const D of w)D.status&&!x.status[D.status]&&U.add(D.status),D.priority&&!x.priority[D.priority]&&Fe.add(D.priority),D.type&&!x.type[D.type]&&Pe.add(D.type);return{totalItems:w.length,itemsToCreate:I.size,itemsToSkip:w.length-I.size,iterations:h?.iterations.length||0,conflicts:{errors:0,warnings:U.size+Fe.size+Pe.size},unmappedValues:{status:Array.from(U),priority:Array.from(Fe),type:Array.from(Pe)}}},[h,j,x,N]);return n.jsx(Tt,{open:e,onOpenChange:r,children:n.jsxs(Gt,{className:"sm:max-w-4xl max-h-[90vh] flex flex-col",children:[n.jsx(Lt,{children:n.jsxs(Ht,{className:"flex items-center gap-2",children:[n.jsx(he,{className:"h-5 w-5"}),"Import from GitHub Projects"]})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"flex justify-between text-xs text-muted-foreground",children:re.map((w,I)=>n.jsx("span",{className:F("transition-colors",I<=ft?"text-primary font-medium":""),children:Kr[w]},w))}),n.jsx(ms,{value:Mn,className:"h-1"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto py-4 min-h-[400px]",children:[o==="connect"&&n.jsxs("div",{className:"space-y-6",children:[A?.authenticated&&A.user&&!A.user.hasGitHubToken&&n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 rounded-lg border border-primary/20",children:[A.user.avatarUrl?n.jsx("img",{src:A.user.avatarUrl,alt:A.user.name,className:"w-10 h-10 rounded-full"}):n.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center",children:n.jsx(Kn,{className:"h-5 w-5 text-muted-foreground"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"font-medium",children:A.user.name}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect GitHub to import your projects"})]})]}),n.jsxs("div",{className:"text-center py-4",children:[n.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-gray-800 to-gray-900 flex items-center justify-center mx-auto mb-4",children:n.jsx(he,{className:"h-8 w-8 text-white"})}),n.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Connect Your GitHub"}),n.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto",children:"Connect your GitHub account to import Projects, Issues, and more."})]}),n.jsxs("div",{className:"flex items-center justify-center gap-2 p-1 bg-muted rounded-lg max-w-xs mx-auto",children:[n.jsxs("button",{onClick:()=>c("oauth"),className:F("flex-1 py-2 px-4 rounded-md text-sm font-medium transition-all",a==="oauth"?"bg-background shadow-sm":"hover:bg-background/50 text-muted-foreground"),children:[n.jsx($t,{className:"h-4 w-4 inline-block mr-2"}),"OAuth"]}),n.jsxs("button",{onClick:()=>c("pat"),className:F("flex-1 py-2 px-4 rounded-md text-sm font-medium transition-all",a==="pat"?"bg-background shadow-sm":"hover:bg-background/50 text-muted-foreground"),children:[n.jsx(ht,{className:"h-4 w-4 inline-block mr-2"}),"Token"]})]}),a==="oauth"&&n.jsx("div",{className:"max-w-md mx-auto space-y-4",children:n.jsxs("div",{className:"bg-green-500/10 border border-green-500/20 rounded-lg p-4",children:[n.jsxs("h4",{className:"font-medium text-green-600 flex items-center gap-2 mb-2",children:[n.jsx(ve,{className:"h-4 w-4"}),"Recommended Method"]}),n.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"h-3 w-3 text-green-500"}),"One-click authentication"]}),n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"h-3 w-3 text-green-500"}),"Automatic token refresh"]}),n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"h-3 w-3 text-green-500"}),"Secure OAuth 2.0 flow"]})]})]})}),a==="pat"&&n.jsx("div",{className:"max-w-md mx-auto space-y-4",children:f?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[n.jsx("h4",{className:"font-medium text-sm",children:"Create a Personal Access Token"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"1"}),n.jsxs("a",{href:"https://github.com/settings/tokens?type=beta",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline font-medium inline-flex items-center gap-1",children:["Open GitHub Token Settings ",n.jsx(Le,{className:"h-3 w-3"})]})]}),n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"2"}),n.jsx("span",{children:'Click "Generate new token" and choose "Fine-grained token"'})]}),n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"3"}),n.jsxs("div",{className:"flex-1 space-y-2",children:[n.jsx("span",{children:"Enable these permissions:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:Xr.map(w=>n.jsxs("button",{onClick:()=>Dn(w),className:"inline-flex items-center gap-1 px-2 py-0.5 bg-background rounded text-xs font-mono border border-border hover:border-primary transition-colors",children:[w,n.jsx(Qn,{className:"h-3 w-3 opacity-50"})]},w))})]})]}),n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"4"}),n.jsx("span",{children:"Copy the token and paste it below"})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ne,{htmlFor:"pat",children:"Personal Access Token"}),n.jsx(xe,{id:"pat",type:"password",value:d,onChange:w=>g(w.target.value),placeholder:"github_pat_xxxxxxxxxxxxxxxxxxxxxxxx",className:"font-mono bg-muted/50",autoComplete:"off"})]})]}):n.jsxs(_,{variant:"outline",className:"w-full",onClick:()=>p(!0),children:[n.jsx(ht,{className:"h-4 w-4 mr-2"}),"I have a Personal Access Token"]})})]}),o==="select"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"Your GitHub Projects"}),dt&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connected as ",n.jsxs("span",{className:"font-medium",children:["@",dt]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_,{variant:"ghost",size:"sm",onClick:()=>$n(),disabled:Ne,children:n.jsx(Wn,{className:F("h-4 w-4",Ne&&"animate-spin")})}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>pt.mutate(),disabled:pt.isPending,children:"Disconnect"})]})]}),Ne||In||kn?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(ae,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):gt?.projects?.length===0?n.jsxs("div",{className:"text-center py-12",children:[n.jsx(As,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),n.jsx("p",{className:"text-muted-foreground",children:"No GitHub Projects found"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Make sure you have at least one Project V2 in your account"}),n.jsxs(_,{variant:"outline",size:"sm",className:"mt-4",onClick:()=>window.open("https://github.com/new/project","_blank"),children:["Create a GitHub Project ",n.jsx(Le,{className:"h-3 w-3 ml-2"})]})]}):n.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto",children:gt?.projects?.map(w=>n.jsx("button",{onClick:()=>l(w.id),className:F("w-full text-left p-4 rounded-lg border transition-all",u===w.id?"border-primary bg-primary/5":"border-border hover:border-primary/30 hover:bg-muted/50"),children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"font-medium truncate",children:w.title}),w.public?n.jsx(M,{variant:"outline",className:"text-[10px]",children:"Public"}):n.jsx(M,{variant:"secondary",className:"text-[10px]",children:"Private"})]}),w.shortDescription&&n.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:w.shortDescription}),n.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[n.jsxs("span",{children:[w.items.totalCount," items"]}),n.jsxs("span",{children:[w.fields.totalCount," fields"]}),w.creator&&n.jsxs("span",{children:["by ",w.creator.login]})]})]}),u===w.id&&n.jsx(K,{className:"h-5 w-5 text-primary shrink-0 ml-2"})]})},w.id))})]}),o==="mapping"&&h&&n.jsx(Us,{items:h.items,mappings:x,onMappingsChange:v}),o==="preview"&&h&&n.jsx(qr,{items:h.items,mappings:x,selectedIds:j,onSelectionChange:R}),o==="configure"&&n.jsx("div",{className:"space-y-6",children:n.jsxs(qs,{defaultValue:"project",className:"w-full",children:[n.jsxs(hn,{className:"grid w-full grid-cols-2",children:[n.jsxs(He,{value:"project",className:"gap-2",children:[n.jsx(It,{className:"h-4 w-4"}),"Project Settings"]}),n.jsxs(He,{value:"summary",className:"gap-2",children:[n.jsx(At,{className:"h-4 w-4"}),"Import Summary"]})]}),n.jsxs(ze,{value:"project",className:"space-y-4 mt-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ne,{htmlFor:"project-key",children:["Project Key ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx(xe,{id:"project-key",value:k,onChange:w=>G(w.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10)),placeholder:"PROJ",className:"font-mono uppercase bg-muted/50",maxLength:10}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used as ticket prefix (e.g., ",k||"PROJ","-1)"]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ne,{htmlFor:"project-name",children:["Project Name ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx(xe,{id:"project-name",value:q,onChange:w=>J(w.target.value),placeholder:"My Project",className:"bg-muted/50"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ne,{children:"Icon"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:Qr.map(w=>n.jsx("button",{type:"button",onClick:()=>Z(w),className:F("w-10 h-10 flex items-center justify-center rounded-lg border text-xl transition-all",Y===w?"border-primary bg-primary/10":"border-border hover:border-primary/30"),children:w},w))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ne,{children:"Color"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:Wr.map(w=>n.jsx("button",{type:"button",onClick:()=>st(w),className:F("w-10 h-10 rounded-lg border-2 transition-all",ee===w?"border-primary scale-110":"border-transparent"),style:{backgroundColor:w}},w))})]})]}),n.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Preview"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Bt,{icon:Y,color:ee,size:"lg"}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("span",{className:"text-xs font-mono font-bold px-2 py-0.5 rounded",style:{backgroundColor:`${ee}20`,color:ee},children:k||"KEY"})}),n.jsx("p",{className:"font-medium mt-1",children:q||"Project Name"})]})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"Import Iterations as Sprints"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:[h?.iterations.length||0," iterations will become sprints"]})]}),n.jsx(ke,{checked:rt,onCheckedChange:ot})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[n.jsxs("div",{children:[n.jsxs("p",{className:"font-medium text-sm flex items-center gap-2",children:[n.jsx(We,{className:"h-4 w-4 text-primary"}),"Enable Bidirectional Sync"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Keep tickets synchronized with GitHub issues"})]}),n.jsx(ke,{checked:ye,onCheckedChange:it})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"Preserve Original Timestamps"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Use GitHub's created/updated dates"})]}),n.jsx(ke,{checked:at,onCheckedChange:lt})]})]})]}),n.jsx(ze,{value:"summary",className:"mt-4",children:n.jsx(Ur,{summary:Tn,iterations:h?.iterations||[],projectKey:k,enableSync:ye})})]})}),o==="import"&&n.jsxs("div",{className:"space-y-6 py-8",children:[te.isPending&&n.jsxs("div",{className:"text-center",children:[n.jsx(ae,{className:"h-12 w-12 animate-spin text-primary mx-auto mb-4"}),n.jsx("p",{className:"font-medium",children:"Importing from GitHub..."}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Creating project, sprints, and tickets"})]}),te.isError&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-4",children:n.jsx(Xn,{className:"h-6 w-6 text-destructive"})}),n.jsx("p",{className:"font-medium text-destructive",children:"Import Failed"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:te.error?.message||"An error occurred"}),n.jsx(_,{variant:"outline",className:"mt-4",onClick:()=>te.mutate(),children:"Try Again"})]}),ue&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mx-auto mb-4",children:n.jsx(ve,{className:"h-8 w-8 text-green-500"})}),n.jsx("p",{className:"text-lg font-semibold",children:"Import Complete!"}),n.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6 max-w-md mx-auto",children:[n.jsxs("div",{className:"bg-card rounded-lg border border-border p-3 text-center",children:[n.jsx("p",{className:"text-2xl font-bold text-primary",children:"1"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Project"})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-3 text-center",children:[n.jsx("p",{className:"text-2xl font-bold text-amber-500",children:ue.summary.sprintsCreated}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Sprints"})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-3 text-center",children:[n.jsx("p",{className:"text-2xl font-bold text-green-500",children:ue.summary.ticketsCreated}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Tickets"})]})]}),n.jsxs("div",{className:"flex items-center justify-center gap-3 mt-6",children:[n.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"Close"}),n.jsx(_,{onClick:()=>{r(!1),window.location.href=`/projects/${ue.project.id}`},children:"View Project"})]})]})]})]}),o!=="import"&&n.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[n.jsxs(_,{variant:"ghost",onClick:En,disabled:!xt,className:F(!xt&&"invisible"),children:[n.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Back"]}),n.jsxs(_,{onClick:An,disabled:!Vn()||Re.isPending||be.isPending||_e.isPending||a==="pat"&&o==="connect"&&!f,className:"gap-2",children:[(Re.isPending||be.isPending||_e.isPending)&&n.jsx(ae,{className:"h-4 w-4 animate-spin"}),o==="connect"&&a==="oauth"?n.jsxs(n.Fragment,{children:[n.jsx(he,{className:"h-4 w-4"}),"Continue with GitHub"]}):o==="configure"?"Start Import":"Continue",n.jsx(z,{className:"h-4 w-4"})]})]})]})})}function Yr({projectId:e}){const{data:r,isLoading:t}=X({queryKey:["stats","project",e],queryFn:()=>ie.stats.projectStats(e),staleTime:6e4});if(t)return n.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(jt,{className:"h-3.5 w-3.5"}),n.jsx("span",{className:"animate-pulse",children:"..."})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(wt,{className:"h-3.5 w-3.5"}),n.jsx("span",{className:"animate-pulse",children:"..."})]})]});const s=r?.tickets?.total??0,o=r?.sprints?.total??0,i=r?.sprints?.active??0;return n.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(jt,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:[s," ",s===1?"ticket":"tickets"]})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(wt,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:i>0?n.jsxs(n.Fragment,{children:[i," active"]}):n.jsxs(n.Fragment,{children:[o," ",o===1?"sprint":"sprints"]})})]})]})}function Co(){const e=Yn(),r=Dt(),[t,s]=C.useState(""),[o,i]=C.useState(!1),[a,c]=C.useState(!1),[d,g]=C.useState(!1),{data:f,isLoading:p,error:u}=X({queryKey:["projects",{search:t,includeArchived:o}],queryFn:()=>ie.projects.list({search:t||void 0,includeArchived:o})}),l=L({mutationFn:x=>ie.projects.archive(x),onSuccess:()=>{$.success("Project archived"),r.invalidateQueries({queryKey:["projects"]})},onError:x=>{$.error(`Failed to archive: ${x.message}`)}}),h=L({mutationFn:x=>ie.projects.delete(x),onSuccess:()=>{$.success("Project deleted"),r.invalidateQueries({queryKey:["projects"]})},onError:x=>{$.error(`Failed to delete: ${x.message}`)}}),m=f?.projects||[];return p?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ae,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):u?n.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-4",children:[n.jsx("p",{className:"text-destructive",children:"Failed to load projects"}),n.jsx(_,{variant:"outline",onClick:()=>r.invalidateQueries({queryKey:["projects"]}),children:"Retry"})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),n.jsx("p",{className:"text-muted-foreground",children:"Manage your projects and ticket prefixes"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(_,{variant:"outline",onClick:()=>g(!0),className:"gap-2",children:[n.jsx(he,{className:"h-4 w-4"}),"Import"]}),n.jsxs(_,{onClick:()=>c(!0),className:"gap-2",children:[n.jsx(vt,{className:"h-4 w-4"}),"New Project"]})]})]}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"relative flex-1 max-w-md",children:[n.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx("input",{type:"text",placeholder:"Search projects...",value:t,onChange:x=>s(x.target.value),className:"w-full field pl-10 pr-4"})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:o,onChange:x=>i(x.target.checked),className:"rounded"}),"Show archived"]})]}),m.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-64 bg-muted/30 rounded-xl border border-dashed border-border",children:[n.jsx(Zn,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),n.jsx("p",{className:"text-muted-foreground mb-4",children:"No projects yet"}),n.jsxs(_,{onClick:()=>c(!0),variant:"outline",className:"gap-2",children:[n.jsx(vt,{className:"h-4 w-4"}),"Create your first project"]})]}):n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:m.map(x=>n.jsxs("div",{onClick:()=>e(`/projects/${x.id}`),className:F("group relative bg-card rounded-xl border border-border p-5 cursor-pointer transition-all","hover:border-primary/50 hover:shadow-lg hover:shadow-primary/5",x.status==="archived"&&"opacity-60"),children:[n.jsxs("div",{className:"flex items-start justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Bt,{icon:x.icon,color:x.color,size:"md"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-mono font-bold px-2 py-0.5 rounded",style:{backgroundColor:`${x.color}20`,color:x.color},children:x.key}),x.status==="archived"&&n.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(Archived)"})]})]}),n.jsxs(es,{children:[n.jsx(ts,{asChild:!0,children:n.jsx("button",{onClick:v=>v.stopPropagation(),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1.5 hover:bg-muted rounded-lg",children:n.jsx(Rs,{className:"h-4 w-4 text-muted-foreground"})})}),n.jsxs(ns,{align:"end",className:"w-48",children:[n.jsxs(de,{onClick:v=>{v.stopPropagation(),e(`/projects/${x.id}/settings`)},children:[n.jsx(bs,{className:"h-4 w-4 mr-2"}),"Edit Project"]}),n.jsx(ss,{}),x.status==="archived"?n.jsxs(de,{onClick:v=>{v.stopPropagation(),$.info("Unarchive coming soon")},children:[n.jsx(Mt,{className:"h-4 w-4 mr-2"}),"Restore Project"]}):n.jsxs(de,{onClick:v=>{v.stopPropagation(),l.mutate(x.id)},className:"text-amber-600",children:[n.jsx(_s,{className:"h-4 w-4 mr-2"}),"Archive Project"]}),n.jsxs(de,{onClick:v=>{v.stopPropagation(),window.confirm(`Delete project "${x.name}"? This cannot be undone.`)&&h.mutate(x.id)},className:"text-destructive",children:[n.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Delete Project"]})]})]})]}),n.jsx("h3",{className:"font-semibold mb-1",children:x.name}),n.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:x.description||"No description"}),n.jsx(Yr,{projectId:x.id}),n.jsx(Et,{className:"absolute right-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]},x.id))}),n.jsx(Bs,{open:a,onOpenChange:c,onSuccess:()=>{r.invalidateQueries({queryKey:["projects"]})}}),n.jsx(Jr,{open:d,onOpenChange:g,onSuccess:()=>{r.invalidateQueries({queryKey:["projects"]})}})]})}export{Co as ProjectList};
@@ -1 +0,0 @@
1
- import{j as s,i as l}from"./index-lJlNPFVJ.js";function h({status:e,label:a,size:n="md",pulse:r=!0,showLabel:d=!0,className:t}){const o={online:{color:"bg-green-500",shadow:"shadow-[0_0_10px_oklch(0.6_0.2_150)]",defaultLabel:"Online"},processing:{color:"bg-blue-500",shadow:"shadow-[0_0_10px_oklch(0.6_0.2_250)]",defaultLabel:"Processing"},error:{color:"bg-red-500",shadow:"shadow-[0_0_10px_oklch(0.6_0.2_20)]",defaultLabel:"Error"},offline:{color:"bg-slate-400",shadow:"shadow-none",defaultLabel:"Offline"}}[e],c={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-3 w-3"};return s.jsxs("div",{className:l("flex items-center gap-2",t),children:[s.jsx("div",{className:l(c[n],"rounded-full",o.color,o.shadow,r&&e!=="offline"&&"animate-pulse")}),d&&s.jsx("span",{className:l("text-[10px] font-bold uppercase tracking-widest",e==="offline"?"text-muted-foreground":"text-foreground/80"),children:a||o.defaultLabel})]})}export{h as S};
@@ -1 +0,0 @@
1
- import{r as m,u as f,j as e,b as l,f as i,d as N,e as v,w,I as b,L as C,N as x,h as S,B as L,l as A,m as k}from"./index-lJlNPFVJ.js";import{B as r}from"./badge-CVHH1a-v.js";import{S as F,a as y,b as B,c as I,d as h}from"./select-CeQ8AHGy.js";import{C as q}from"./cpu-DiPMQICV.js";import"./chevron-up-CoUsOvZj.js";function V(){const[t,u]=m.useState("all"),[a,j]=m.useState(""),{data:g,isLoading:p,error:n}=f({queryKey:["summaries",{agent:t==="all"?void 0:t,limit:50}],queryFn:()=>k.summaries.list({agent:t==="all"?void 0:t,limit:50})}),c=g?.summaries??[],d=Array.from(new Set(c.map(s=>s.agent))),o=c.filter(s=>a?s.title.toLowerCase().includes(a.toLowerCase())||s.whatChanged.toLowerCase().includes(a.toLowerCase()):!0);return n?e.jsx(l,{children:e.jsx(i,{className:"p-6",children:e.jsxs("p",{className:"text-center text-destructive",children:["Error loading summaries: ",n.message]})})}):e.jsx("div",{className:"space-y-4",children:e.jsxs(l,{children:[e.jsx(N,{children:e.jsx(v,{children:"AI Summaries"})}),e.jsxs(i,{children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(w,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(b,{placeholder:"Search summaries...",value:a,onChange:s=>j(s.target.value),className:"pl-8"})]}),d.length>0&&e.jsxs(F,{value:t,onValueChange:u,children:[e.jsx(y,{className:"w-[180px]",children:e.jsx(B,{placeholder:"Filter by agent"})}),e.jsxs(I,{children:[e.jsx(h,{value:"all",children:"All Agents"}),d.map(s=>e.jsx(h,{value:s,children:s},s))]})]})]}),p?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):o.length===0?e.jsxs("div",{className:"flex h-40 flex-col items-center justify-center",children:[e.jsx(x,{className:"h-12 w-12 text-muted-foreground mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"No summaries found"})]}):e.jsx("div",{className:"space-y-3",children:o.map(s=>e.jsx(S,{to:`/summaries/${s.id}`,className:"block",children:e.jsx(l,{className:"glass rounded-[16px] hover-lift transition-liquid group border-white/5",children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-semibold truncate group-hover:text-primary transition-colors",children:s.title}),e.jsxs(r,{className:"bg-indigo-500/10 text-indigo-400 border-indigo-500/20",children:[e.jsx(L,{className:"h-3 w-3 mr-1"}),s.agent]}),s.model&&e.jsxs(r,{variant:"outline",className:"text-xs border-white/10",children:[e.jsx(q,{className:"h-3 w-3 mr-1"}),s.model]})]}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:s.whatChanged}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[s.filesChanged?.length>0&&e.jsxs(r,{variant:"outline",className:"text-[10px] border-white/10",children:[e.jsx(x,{className:"h-3 w-3 mr-1"}),s.filesChanged.length," files"]}),s.blockers?.length>0&&e.jsxs(r,{className:"text-[10px] bg-red-500/10 text-red-400 border-red-500/20",children:[s.blockers.length," blockers"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:new Date(s.createdAt).toLocaleDateString()}),e.jsx(A,{className:"h-4 w-4 text-muted-foreground group-hover:translate-x-1 transition-transform"})]})]})})})},s.id))})]})]})})}export{V as SummaryList};
@@ -1 +0,0 @@
1
- import{u as b,E as w,s as k,n as y,o as g,t as o,m as f,j as e,h as m,k as c,G as T,l as _,i as N,L as x,H as A,J as S,K as C,M as P}from"./index-lJlNPFVJ.js";import{S as L}from"./StatusIndicator-pRfkNcdV.js";import{H as j}from"./hash-DNEv8Elo.js";import{S as D}from"./square-Ckzsr3Rn.js";import{P as F}from"./play-d1ONaH0-.js";import{C as q}from"./calendar-Bf0t2B82.js";import{H as E}from"./history-BQSBo_1Q.js";const M="http://localhost:3000";function I(t){return b({queryKey:["tasks",t],queryFn:async()=>{const a=await fetch(`${M}/api/tasks/${t}`);if(!a.ok)throw new Error("Task not found");return(await a.json()).task},enabled:!!t})}function U(){const{id:t}=w(),a=k(),r=y(),{data:s,isLoading:n,error:v}=I(t||""),d=g({mutationFn:()=>f.tasks.cancel(t),onSuccess:()=>{o.success("Task cancelled"),r.invalidateQueries({queryKey:["tasks"]})},onError:l=>{o.error(l.message||"Failed to cancel task")}}),i=g({mutationFn:()=>f.tasks.retry(t),onSuccess:l=>{o.success("Task queued for retry"),r.invalidateQueries({queryKey:["tasks"]}),a(`/tasks/${l.task.id}`)},onError:l=>{o.error(l.message||"Failed to retry task")}});return n?e.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[e.jsx("div",{className:"h-8 w-32 glass animate-pulse rounded-lg"}),e.jsx("div",{className:"h-64 glass animate-pulse rounded-[24px]"})]}):v||!s?e.jsxs("div",{className:"max-w-5xl mx-auto glass rounded-[24px] p-20 text-center",children:[e.jsx(j,{className:"h-16 w-16 mx-auto text-red-500 mb-4 opacity-20"}),e.jsx("h3",{className:"text-xl font-bold",children:"Task Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"The task you're looking for doesn't exist or has been archived."}),e.jsx(m,{to:"/tasks",children:e.jsx(c,{variant:"outline",className:"rounded-xl px-6",children:"Back to Tasks"})})]}):e.jsxs("div",{className:"max-w-6xl mx-auto flex flex-col gap-8",children:[e.jsxs("nav",{className:"flex items-center gap-2",children:[e.jsx(m,{to:"/tasks",className:"p-2 hover:bg-white/5 rounded-full transition-colors group",children:e.jsx(T,{className:"h-4 w-4 group-hover:-translate-x-1 transition-transform"})}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:[e.jsx(m,{to:"/tasks",className:"hover:text-foreground transition-colors",children:"Tasks"}),e.jsx(_,{className:"h-3 w-3"}),e.jsx("span",{className:"text-foreground truncate max-w-[200px]",children:s.title})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 items-start",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[e.jsxs("div",{className:"glass rounded-[32px] p-8 relative overflow-hidden",children:[e.jsx("div",{className:N("absolute -top-24 -right-24 w-64 h-64 rounded-full blur-[100px] opacity-10",s.status==="completed"?"bg-green-500":s.status==="failed"?"bg-red-500":"bg-blue-500")}),e.jsxs("div",{className:"flex items-start justify-between mb-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(L,{status:s.status==="completed"?"online":s.status==="failed"?"error":s.status==="in_progress"?"processing":"offline",label:s.status,size:"md"}),e.jsxs("span",{className:"text-xs font-mono text-muted-foreground opacity-50",children:["#",s.id.split("-")[0]]})]}),e.jsx("h1",{className:"text-3xl font-extrabold tracking-tight leading-tight",children:s.title})]}),e.jsxs("div",{className:"flex gap-2",children:[(s.status==="failed"||s.status==="completed")&&e.jsx(c,{variant:"outline",size:"icon",onClick:()=>i.mutate(),disabled:i.isPending,title:"Retry task",children:i.isPending?e.jsx(x,{className:"h-4 w-4 animate-spin"}):e.jsx(A,{className:"h-4 w-4"})}),(s.status==="in_progress"||s.status==="pending")&&e.jsxs(c,{variant:"destructive",onClick:()=>d.mutate(),disabled:d.isPending,children:[d.isPending?e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(D,{className:"mr-2 h-4 w-4 fill-current"}),"Cancel"]}),(s.status==="failed"||s.status==="completed")&&e.jsxs(c,{onClick:()=>i.mutate(),disabled:i.isPending,children:[i.isPending?e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(F,{className:"mr-2 h-4 w-4 fill-current"}),"Run Again"]})]})]}),e.jsx("p",{className:"text-muted-foreground leading-relaxed mb-6",children:s.description||"No description provided for this task."}),e.jsxs("div",{className:"flex flex-wrap gap-4 pt-6 border-t border-white/5",children:[e.jsx(u,{label:"Source",value:s.source,icon:S,...s.sourceUrl?{href:s.sourceUrl}:{}}),e.jsx(u,{label:"Priority",value:`P${s.priority}`,icon:j}),e.jsx(u,{label:"Created",value:new Date(s.createdAt).toLocaleDateString(),icon:q})]})]}),e.jsxs("div",{className:"glass rounded-[24px] overflow-hidden shadow-inner",children:[e.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 bg-primary/5",children:[e.jsx("div",{className:"h-8 w-8 rounded-lg glass-heavy flex items-center justify-center shadow-sm",children:e.jsx(C,{className:"h-4 w-4 text-primary"})}),e.jsx("h3",{className:"text-sm font-black uppercase tracking-[0.2em] text-foreground/80",children:"Instruction Prompt"})]}),e.jsx("div",{className:"p-6 recessed-card font-mono text-xs leading-relaxed text-foreground/80 overflow-x-auto whitespace-pre-wrap selection:bg-primary/20",children:s.prompt})]})]}),e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"glass rounded-[28px] p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(E,{className:"h-4 w-4 text-indigo-400"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-widest",children:"Task Timeline"})]}),e.jsxs("div",{className:"relative pl-6 space-y-8 before:absolute before:left-[11px] before:top-2 before:bottom-2 before:w-[2px] before:bg-white/5",children:[e.jsx(p,{title:"Task Created",time:new Date(s.createdAt).toLocaleTimeString(),status:"completed"}),s.startedAt&&e.jsx(p,{title:"Optimization Started",time:new Date(s.startedAt).toLocaleTimeString(),status:"completed"}),e.jsx(p,{title:s.status==="pending"?"Queued":s.status==="in_progress"?"In Progress":s.status==="completed"?"Success":"Failed",time:s.completedAt?new Date(s.completedAt).toLocaleTimeString():"Current Step",status:s.status==="completed"?"completed":s.status==="failed"?"error":"processing"})]})]}),e.jsxs("div",{className:"glass rounded-[28px] p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(P,{className:"h-4 w-4 text-emerald-400"}),e.jsx("h3",{className:"text-sm font-bold uppercase tracking-widest",children:"Work Metrics"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(h,{label:"Status",value:s.status.toUpperCase()}),e.jsx(h,{label:"Duration",value:s.completedAt?`${((new Date(s.completedAt).getTime()-new Date(s.startedAt||s.createdAt).getTime())/1e3).toFixed(1)}s`:"--"}),e.jsx(h,{label:"Assigned Agent",value:s.assignedAgent??"Unassigned"})]})]})]})]})]})}function u({label:t,value:a,icon:r,href:s}){const n=e.jsxs("div",{className:"flex items-center gap-2 group/meta cursor-default",children:[e.jsx("div",{className:"h-8 w-8 rounded-lg glass-heavy flex items-center justify-center border-white/5",children:e.jsx(r,{className:"h-3.5 w-3.5 text-muted-foreground group-hover/meta:text-[var(--primary)] transition-colors"})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"premium-label",children:t}),e.jsx("span",{className:"text-[11px] font-bold truncate max-w-[120px]",children:a})]})]});return s?e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80 transition-opacity",children:n}):n}function p({title:t,time:a,status:r}){return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:N("absolute -left-[23px] top-1.5 h-3.5 w-3.5 rounded-full border-2 border-background z-10",r==="completed"?"bg-green-500 shadow-[0_0_8px_oklch(0.6_0.2_150)]":r==="error"?"bg-red-500 shadow-[0_0_8px_oklch(0.6_0.2_20)]":"bg-blue-500 shadow-[0_0_8px_oklch(0.6_0.2_250)] animate-pulse")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-bold",children:t}),e.jsx("span",{className:"text-[10px] text-muted-foreground font-medium",children:a})]})]})}function h({label:t,value:a}){return e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-white/5 last:border-0",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t}),e.jsx("span",{className:"text-[11px] font-extrabold uppercase tracking-tight",children:a})]})}export{U as TaskDetail};
@@ -1 +0,0 @@
1
- import{r as d,n as K,o as J,t as D,m as Q,j as e,k as p,P as X,p as S,I as R,q as W,s as Y,u as Z,v as M,w as ee,a as O,g as q,C as U,X as se,L as ae,D as te,x as re,y as le,z as ie}from"./index-lJlNPFVJ.js";import{B as _}from"./badge-CVHH1a-v.js";import{S as T,a as P,b as k,c as A,d as i}from"./select-CeQ8AHGy.js";import{T as ne,a as oe,b as B,c as f,d as ce,e as v}from"./table-ZjAZ7hkt.js";import{D as de,a as xe,b as ue,c as me,d as he,e as ge,f as pe}from"./dialog-BUqN9Psj.js";import{T as H}from"./textarea-DsVPnSgR.js";import{P as E}from"./play-d1ONaH0-.js";import{F as je}from"./funnel-PkaD_HSR.js";import{E as Ne}from"./ellipsis-UJx4Xnf6.js";import"./chevron-up-CoUsOvZj.js";function fe(){const[u,j]=d.useState(!1),[N,r]=d.useState(""),[n,l]=d.useState(""),[t,b]=d.useState(""),[o,m]=d.useState("manual"),[c,h]=d.useState("3"),F=K(),{mutate:w,isPending:C}=J({mutationFn:a=>Q.tasks.create(a),onSuccess:()=>{D.success("Task created successfully!"),F.invalidateQueries({queryKey:["tasks"]}),j(!1),r(""),l(""),b(""),m("manual"),h("3")},onError:a=>{D.error(`Failed to create task: ${a.message}`)}}),L=a=>{if(a.preventDefault(),!N.trim()){D.error("Title is required");return}if(!t.trim()){D.error("Prompt is required");return}w({title:N,description:n||void 0,prompt:t,source:o,priority:parseInt(c),labels:[]})};return e.jsxs(de,{open:u,onOpenChange:j,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(p,{children:[e.jsx(X,{className:"mr-2 h-4 w-4"}),"Create Task"]})}),e.jsx(ue,{className:"sm:max-w-[525px] glass rounded-[24px] border-white/10",children:e.jsxs("form",{onSubmit:L,children:[e.jsxs(me,{children:[e.jsx(he,{className:"text-xl font-bold",children:"Create New Task"}),e.jsx(ge,{className:"text-muted-foreground",children:"Create a new task for the AI agents to execute"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"title",className:"text-sm font-semibold",children:"Title *"}),e.jsx(R,{id:"title",value:N,onChange:a=>r(a.target.value),placeholder:"Fix bug in authentication",className:"bg-white/5 border-white/10 rounded-xl"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"description",className:"text-sm font-semibold",children:"Description"}),e.jsx(H,{id:"description",value:n,onChange:a=>l(a.target.value),placeholder:"Optional description...",rows:3,className:"bg-white/5 border-white/10 rounded-xl resize-none"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"prompt",className:"text-sm font-semibold",children:"AI Prompt *"}),e.jsx(H,{id:"prompt",value:t,onChange:a=>b(a.target.value),placeholder:"Detailed instructions for the AI agent...",rows:4,className:"bg-white/5 border-white/10 rounded-xl resize-none"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"source",className:"text-sm font-semibold",children:"Source"}),e.jsxs(T,{value:o,onValueChange:m,children:[e.jsx(P,{id:"source",className:"bg-white/5 border-white/10 rounded-xl",children:e.jsx(k,{})}),e.jsxs(A,{className:"glass-heavy rounded-xl border-white/10",children:[e.jsx(i,{value:"manual",children:"Manual"}),e.jsx(i,{value:"github_issue",children:"GitHub Issue"}),e.jsx(i,{value:"jira",children:"Jira"}),e.jsx(i,{value:"linear",children:"Linear"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(S,{htmlFor:"priority",className:"text-sm font-semibold",children:"Priority"}),e.jsxs(T,{value:c,onValueChange:h,children:[e.jsx(P,{id:"priority",className:"bg-white/5 border-white/10 rounded-xl",children:e.jsx(k,{})}),e.jsxs(A,{className:"glass-heavy rounded-xl border-white/10",children:[e.jsx(i,{value:"1",children:"Critical (P1)"}),e.jsx(i,{value:"2",children:"High (P2)"}),e.jsx(i,{value:"3",children:"Medium (P3)"}),e.jsx(i,{value:"4",children:"Low (P4)"})]})]})]})]})]}),e.jsxs(pe,{className:"gap-2",children:[e.jsx(p,{type:"button",variant:"outline",onClick:()=>j(!1),children:"Cancel"}),e.jsx(p,{type:"submit",disabled:C,children:C?"Creating...":"Create Task"})]})]})})]})}const ve=[{value:"all",label:"All Status",icon:O},{value:"pending",label:"Pending",icon:q},{value:"in_progress",label:"Running",icon:E},{value:"completed",label:"Completed",icon:U},{value:"failed",label:"Failed",icon:M}],be=["all","github","jira","linear","manual","webhook"],we=["all","openclaw","claude-code","auto"];function ze(){const[u,j]=W(),N=Y(),r=u.get("status")||"all",n=u.get("source")||"all",l=u.get("agent")||"all",[t,b]=d.useState(u.get("q")||""),[o,m]=d.useState(0),c=20,h=(s,x)=>{const g=new URLSearchParams(u);x==="all"||x===""?g.delete(s):g.set(s,x),j(g),m(0)},F=()=>{j({}),b(""),m(0)},w=r!=="all"||n!=="all"||l!=="all"||t,{data:C,isLoading:L,error:a}=Z({queryKey:["tasks",{status:r==="all"?void 0:r,limit:c,offset:o*c}],queryFn:()=>Q.tasks.list({status:r==="all"?void 0:r,limit:c,offset:o*c})}),V=C?.tasks??[],z=C?.total??0,y=d.useMemo(()=>V.filter(s=>{const x=!t||s.title.toLowerCase().includes(t.toLowerCase())||s.description?.toLowerCase().includes(t.toLowerCase()),g=n==="all"||s.source.toLowerCase()===n,I=l==="all"||s.assignedAgent?.toLowerCase()===l||l==="auto"&&!s.assignedAgent;return x&&g&&I}),[V,t,n,l]),$=s=>{const g={completed:{variant:"success",icon:U},failed:{variant:"destructive",icon:M},running:{variant:"info",icon:E},pending:{variant:"secondary",icon:q},in_progress:{variant:"info",icon:E}}[s]||{variant:"secondary",icon:q},{variant:I,icon:G}=g;return e.jsxs(_,{variant:I,className:"gap-1.5 px-2 py-0.5 font-medium",children:[e.jsx(G,{className:"h-3 w-3"}),e.jsx("span",{className:"capitalize",children:s.replace("_"," ")})]})};return a?e.jsxs("div",{className:"glass rounded-[28px] p-12 text-center",children:[e.jsx(M,{className:"h-12 w-12 mx-auto text-red-400 mb-4"}),e.jsx("p",{className:"text-lg font-bold text-red-400",children:"Error loading tasks"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a.message})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:[z," total tasks • ",y.length," showing"]})]}),e.jsx(fe,{})]}),e.jsxs("div",{className:"glass rounded-[20px] p-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(R,{placeholder:"Search tasks...",value:t,onChange:s=>{b(s.target.value),h("q",s.target.value)},className:"pl-10 bg-white/5 border-white/10 rounded-xl h-10"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(T,{value:r,onValueChange:s=>h("status",s),children:[e.jsx(P,{className:"w-[140px] bg-white/5 border-white/10 rounded-xl",children:e.jsx(k,{placeholder:"Status"})}),e.jsx(A,{className:"glass-heavy rounded-xl border-white/10",children:ve.map(s=>e.jsx(i,{value:s.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(s.icon,{className:"h-3.5 w-3.5"}),s.label]})},s.value))})]}),e.jsxs(T,{value:n,onValueChange:s=>h("source",s),children:[e.jsx(P,{className:"w-[130px] bg-white/5 border-white/10 rounded-xl",children:e.jsx(k,{placeholder:"Source"})}),e.jsx(A,{className:"glass-heavy rounded-xl border-white/10",children:be.map(s=>e.jsx(i,{value:s,className:"capitalize",children:s==="all"?"All Sources":s},s))})]}),e.jsxs(T,{value:l,onValueChange:s=>h("agent",s),children:[e.jsx(P,{className:"w-[140px] bg-white/5 border-white/10 rounded-xl",children:e.jsx(k,{placeholder:"Agent"})}),e.jsx(A,{className:"glass-heavy rounded-xl border-white/10",children:we.map(s=>e.jsx(i,{value:s,className:"capitalize",children:s==="all"?"All Agents":s},s))})]}),w&&e.jsxs(p,{variant:"ghost",size:"sm",onClick:F,className:"rounded-xl text-muted-foreground hover:text-foreground",children:[e.jsx(se,{className:"h-4 w-4 mr-1"}),"Clear"]})]})]}),w&&e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3 pt-3 border-t border-white/5",children:[e.jsx(je,{className:"h-4 w-4 text-muted-foreground"}),r!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-blue-500/10 text-blue-400 text-xs font-medium",children:["Status: ",r]}),n!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-indigo-500/10 text-indigo-400 text-xs font-medium capitalize",children:["Source: ",n]}),l!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-green-500/10 text-green-400 text-xs font-medium capitalize",children:["Agent: ",l]}),t&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-orange-500/10 text-orange-400 text-xs font-medium",children:['Search: "',t,'"']})]})]}),e.jsx("div",{className:"glass-heavy rounded-[24px] overflow-hidden border border-white/10 shadow-float",children:L?e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ae,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):y.length===0?e.jsxs("div",{className:"p-12 text-center",children:[e.jsx(O,{className:"h-12 w-12 mx-auto text-muted-foreground/40 mb-4"}),e.jsx("p",{className:"text-lg font-bold text-muted-foreground",children:"No tasks found"}),e.jsx("p",{className:"text-sm text-muted-foreground/60 mt-1",children:w?"Try adjusting your filters":"Create a task to get started"})]}):e.jsxs(ne,{children:[e.jsx(oe,{className:"bg-muted/30",children:e.jsxs(B,{className:"hover:bg-transparent border-white/5",children:[e.jsx(f,{className:"w-[400px]",children:"Task"}),e.jsx(f,{className:"w-[140px]",children:"Status"}),e.jsx(f,{children:"Agent"}),e.jsx(f,{children:"Source"}),e.jsx(f,{className:"text-right",children:"Created"}),e.jsx(f,{className:"w-[50px]"})]})}),e.jsx(ce,{children:y.map(s=>e.jsxs(B,{className:"group cursor-pointer hover:bg-white/5 border-white/5",onClick:()=>N(`/tasks/${s.id}`),children:[e.jsx(v,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:e.jsx(O,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-semibold text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:s.description})]})]})}),e.jsx(v,{children:$(s.status)}),e.jsx(v,{children:s.assignedAgent?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-gradient-to-br from-indigo-500 to-purple-500 flex items-center justify-center text-[10px] uppercase text-white font-bold",children:s.assignedAgent[0]}),e.jsx("span",{className:"text-sm capitalize",children:s.assignedAgent})]}):e.jsx("span",{className:"text-sm text-muted-foreground italic",children:"Unassigned"})}),e.jsx(v,{children:e.jsx(_,{variant:"outline",className:"capitalize bg-muted/50",children:s.source})}),e.jsx(v,{className:"text-right text-muted-foreground text-sm font-mono",children:new Date(s.createdAt).toLocaleDateString()}),e.jsx(v,{onClick:x=>x.stopPropagation(),children:e.jsxs(te,{children:[e.jsx(re,{asChild:!0,children:e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ne,{className:"h-4 w-4"})})}),e.jsx(le,{align:"end",children:e.jsx(ie,{onClick:()=>N(`/tasks/${s.id}`),children:"View Details"})})]})})]},s.id))})]})}),y.length>0&&e.jsxs("div",{className:"flex items-center justify-between border-t border-white/10 pt-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Page ",o+1," • Showing ",Math.min(y.length,c)," of ",z]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{variant:"outline",size:"sm",onClick:()=>m(o-1),disabled:o===0,className:"rounded-xl border-white/10",children:"Previous"}),e.jsx(p,{variant:"outline",size:"sm",onClick:()=>m(o+1),disabled:(o+1)*c>=z,className:"rounded-xl border-white/10",children:"Next"})]})]})]})}export{ze as TaskList};
@@ -1 +0,0 @@
1
- import{c as O,r as m,S as I,C as k,j as e,i as x,h as R,B as _,s as $,n as z,q as U,u as S,o as V,m as N,a1 as G,v as W,D as H,x as J,k as Q,a5 as X,y as Y,z as w,aw as B,w as Z,I as ee,L as P,P as se}from"./index-lJlNPFVJ.js";import{d as re,a as ae}from"./element-adapter-DL0DQilL.js";import{a as L,B as te}from"./bug-CmZI7jqM.js";import{C,L as oe,I as ne}from"./layers-jFqVrWMD.js";import{V as ce,C as ie}from"./ViewSwitcher-CnL0OqA8.js";import{P as le}from"./play-d1ONaH0-.js";import{F as q}from"./folder-open-BJi577JH.js";import"./defineProperty-CoXUr7_6.js";import"./textarea-DsVPnSgR.js";import"./badge-CVHH1a-v.js";import"./dialog-BUqN9Psj.js";import"./select-CeQ8AHGy.js";import"./chevron-up-CoUsOvZj.js";import"./EstimateSelect-1hQf4Osk.js";import"./hash-DNEv8Elo.js";import"./brain-6o_RHVpe.js";import"./wand-sparkles-BusQ52ZK.js";import"./link-2-DdO7ostF.js";import"./lightbulb-Jhp7FvbU.js";const de=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],me=O("grip-vertical",de),M={task:{icon:k,color:"text-blue-400"},bug:{icon:te,color:"text-red-400"},feature:{icon:I,color:"text-cyan-400"},epic:{icon:oe,color:"text-orange-400"},story:{icon:L,color:"text-green-400"},subtask:{icon:C,color:"text-gray-400"},enhancement:{icon:I,color:"text-indigo-400"},documentation:{icon:L,color:"text-cyan-400"}},xe={urgent:"bg-red-500",high:"bg-orange-500",medium:"bg-yellow-500",low:"bg-blue-500",none:"bg-gray-400"};function pe({ticket:r,isDragging:i}){const l=m.useRef(null),[g,o]=m.useState(!1);m.useEffect(()=>{const n=l.current;if(n)return re({element:n,getInitialData:()=>({ticketId:r.id,status:r.status}),onDragStart:()=>o(!0),onDrop:()=>o(!1)})},[r.id,r.status]);const p=M[r.type]?.icon||C,a=M[r.type]?.color||"text-gray-400",h=r.projectKey||"PROFCLAW";return e.jsxs("div",{ref:l,className:x("group relative rounded-xl bg-[var(--card)] border border-[var(--border)] p-3 cursor-grab active:cursor-grabbing transition-all duration-200",(g||i)&&"opacity-50 scale-95 rotate-2","hover:border-[var(--primary)]/30 hover:shadow-lg hover:shadow-[var(--primary)]/5"),children:[e.jsx("div",{className:"absolute left-1 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-50 transition-opacity",children:e.jsx(me,{className:"h-4 w-4 text-[var(--muted-foreground)]"})}),e.jsx("div",{className:x("absolute top-0 left-3 w-6 h-1 rounded-b-full",xe[r.priority]),title:r.priority}),e.jsxs(R,{to:`/tickets/${r.id}`,className:"block space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[10px] font-mono text-[var(--muted-foreground)]",children:[h,"-",r.sequence]}),e.jsx(p,{className:x("h-3.5 w-3.5 shrink-0",a)})]}),e.jsx("h4",{className:"text-sm font-medium leading-tight line-clamp-2 group-hover:text-[var(--primary)] transition-colors",children:r.title}),e.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[r.assigneeAgent&&e.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-[var(--primary)]/80 px-1.5 py-0.5 rounded bg-[var(--primary)]/10",children:[e.jsx(_,{className:"h-2.5 w-2.5"}),r.assigneeAgent]}),r.labels.slice(0,1).map(n=>e.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-[var(--muted)]/50 text-[var(--muted-foreground)] truncate max-w-[60px]",children:n},n))]}),r.createdBy==="ai"&&e.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wider text-blue-400",children:"AI"})]})]})]})}const E=[{status:"backlog",label:"Backlog",icon:ne,color:"text-gray-400",bgColor:"bg-gray-500/10"},{status:"todo",label:"Todo",icon:C,color:"text-blue-400",bgColor:"bg-blue-500/10"},{status:"in_progress",label:"In Progress",icon:le,color:"text-amber-400",bgColor:"bg-amber-500/10"},{status:"in_review",label:"In Review",icon:G,color:"text-indigo-400",bgColor:"bg-indigo-500/10"},{status:"done",label:"Done",icon:k,color:"text-green-400",bgColor:"bg-green-500/10"}];function ue({status:r,label:i,icon:l,color:g,bgColor:o,tickets:p,onDrop:a}){const h=m.useRef(null),[n,u]=m.useState(!1);return m.useEffect(()=>{const c=h.current;if(c)return ae({element:c,getData:()=>({status:r}),canDrop:({source:j})=>j.data.status!==r,onDragEnter:()=>u(!0),onDragLeave:()=>u(!1),onDrop:({source:j})=>{u(!1);const y=j.data.ticketId;y&&a(y,r)}})},[r,a]),e.jsxs("div",{ref:h,className:x("flex flex-col min-w-[280px] max-w-[320px] rounded-2xl border transition-all duration-200",n?"border-[var(--primary)] bg-[var(--primary)]/5 scale-[1.02]":"border-[var(--border)] bg-[var(--card)]/50"),children:[e.jsxs("div",{className:x("flex items-center justify-between px-4 py-3 rounded-t-2xl",o),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{className:x("h-4 w-4",g)}),e.jsx("span",{className:"text-sm font-semibold",children:i}),e.jsx("span",{className:"flex items-center justify-center h-5 min-w-5 px-1.5 rounded-full bg-[var(--background)]/50 text-[10px] font-bold",children:p.length})]}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg opacity-0 group-hover:opacity-100",children:e.jsx(se,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"flex-1 p-2 space-y-2 overflow-y-auto max-h-[calc(100vh-280px)] scrollbar-thin",children:p.length===0?e.jsxs("div",{className:x("flex flex-col items-center justify-center py-8 px-4 rounded-xl border-2 border-dashed transition-colors",n?"border-[var(--primary)] bg-[var(--primary)]/5":"border-[var(--border)]/50"),children:[e.jsx(l,{className:x("h-8 w-8 mb-2 opacity-30",g)}),e.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:n?"Drop here":"No tickets"})]}):p.map(c=>e.jsx(pe,{ticket:c},c.id))})]})}function Ee(){const r=$(),i=z(),[l,g]=U(),[o,p]=m.useState(l.get("q")||""),[a,h]=m.useState(l.get("projectId")||void 0),{data:n}=S({queryKey:["projects"],queryFn:()=>N.projects.list({limit:50})}),u=n?.projects||[],c=u.find(s=>s.id===a),j=s=>{h(s);const t=new URLSearchParams(l);s?t.set("projectId",s):t.delete("projectId"),g(t)},{data:y,isLoading:F,error:D}=S({queryKey:["tickets","board",{search:o||void 0,projectId:a}],queryFn:()=>N.tickets.list({search:o||void 0,projectId:a||void 0,limit:200})}),b=V({mutationFn:({id:s,status:t})=>N.tickets.update(s,{status:t}),onMutate:async({id:s,status:t})=>{await i.cancelQueries({queryKey:["tickets","board"]});const d=i.getQueryData(["tickets","board",{search:o||void 0,projectId:a}]);return i.setQueryData(["tickets","board",{search:o||void 0,projectId:a}],f=>f?.tickets?{...f,tickets:f.tickets.map(v=>v.id===s?{...v,status:t}:v)}:f),{previousData:d}},onError:(s,t,d)=>{d?.previousData&&i.setQueryData(["tickets","board",{search:o||void 0,projectId:a}],d.previousData)},onSettled:()=>{i.invalidateQueries({queryKey:["tickets"]})}}),A=m.useCallback((s,t)=>{b.mutate({id:s,status:t})},[b]),T=y?.tickets??[],K=E.reduce((s,t)=>(s[t.status]=T.filter(d=>d.status===t.status).map(d=>({...d,createdBy:d.createdBy??"human"})),s),{});return D?e.jsxs("div",{className:"premium-card rounded-[28px] p-12 text-center",children:[e.jsx(W,{className:"h-12 w-12 mx-auto text-red-400 mb-4"}),e.jsx("p",{className:"text-lg font-bold text-red-400",children:"Error loading board"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:D.message})]}):e.jsxs("div",{className:"space-y-6 h-full",children:[e.jsxs("header",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Ticket Board"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:a?`Showing ${c?.name||"Project"} tickets`:"Showing all tickets across projects"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(H,{children:[e.jsx(J,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2 h-9",children:[e.jsx(q,{className:"h-4 w-4"}),c?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:c.icon}),e.jsx("span",{className:"max-w-[120px] truncate",children:c.name})]}):"All Projects",e.jsx(X,{className:"h-3 w-3"})]})}),e.jsxs(Y,{align:"end",className:"w-56",children:[e.jsx(w,{onClick:()=>j(void 0),children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4"}),"All Projects"]})}),e.jsx(B,{}),u.map(s=>e.jsxs(w,{onClick:()=>j(s.id),children:[e.jsx("span",{className:"mr-2",children:s.icon}),e.jsx("span",{className:"truncate",children:s.name}),s.id===a&&e.jsx(k,{className:"h-4 w-4 ml-auto text-primary"})]},s.id)),u.length>0&&c&&e.jsxs(e.Fragment,{children:[e.jsx(B,{}),e.jsx(w,{onClick:()=>r(`/projects/${a}`),children:e.jsx("span",{className:"text-primary",children:"Go to Project Board →"})})]})]})]}),e.jsxs("div",{className:"relative w-48 sm:w-64",children:[e.jsx(Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ee,{placeholder:"Search tickets...",value:o,onChange:s=>p(s.target.value),className:"pl-10 h-9"})]}),e.jsx(ce,{view:"board",onChange:s=>{if(s==="list"){const t=a?`?projectId=${a}`:"";r(`/tickets${t}`)}}}),e.jsx(ie,{})]})]}),F?e.jsx("div",{className:"premium-card rounded-[28px] p-12 flex items-center justify-center",children:e.jsx(P,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4 -mx-4 px-4 scrollbar-thin",children:E.map(s=>e.jsx(ue,{...s,tickets:K[s.status]??[],onDrop:A},s.status))}),b.isPending&&e.jsxs("div",{className:"fixed bottom-4 right-4 flex items-center gap-2 px-4 py-2 rounded-xl glass-heavy text-sm",children:[e.jsx(P,{className:"h-4 w-4 animate-spin"}),"Updating..."]})]})}export{Ee as TicketBoard};
@@ -1 +0,0 @@
1
- import{c as ye,r as l,ao as ds,j as e,ap as ve,aq as ms,ar as xs,as as us,at as hs,au as ps,av as js,n as be,u as K,o as q,m as f,X as G,k as h,P as te,I as we,O as gs,i as H,L as D,t as x,a5 as fs,l as Ns,h as V,Q as ze,A as Ae,w as ys,E as vs,s as bs,G as Le,v as ws,D as oe,x as de,y as me,z as Q,J as Re,aw as ks,an as xe,B as ue,a1 as Qe,C as J,T as De,S as Fe}from"./index-lJlNPFVJ.js";import{B}from"./badge-CVHH1a-v.js";import{T as Ee}from"./textarea-DsVPnSgR.js";import{S as X,a as Y,b as Z,c as ee,d as P}from"./select-CeQ8AHGy.js";import{D as Ve,b as He,c as Ge,d as Ue,e as We,f as Je}from"./dialog-BUqN9Psj.js";import{A as Cs,a as Ss,b as Ts,c as Ps,d as As,e as Ls,f as Rs,g as Ds}from"./alert-dialog-SKM6Gjz4.js";import{P as Fs,a as Es,b as Is}from"./popover-CrmZgoWu.js";import{T as Xe}from"./tag-C35mgoEv.js";import{a as Ie}from"./EstimateSelect-1hQf4Osk.js";import{L as fe}from"./link-2-DdO7ostF.js";import{P as qs}from"./pencil-CYXCEPQh.js";import{E as Ms}from"./ellipsis-vertical-DoULYEKn.js";import{T as Os}from"./trash-2-keO5tKPE.js";import{G as qe}from"./git-branch-C_K30am0.js";import{G as _s}from"./git-commit-horizontal-IT6ecxWQ.js";import{M as Me}from"./message-square-CBgH65X7.js";import{H as he}from"./history-BQSBo_1Q.js";import{B as pe}from"./brain-6o_RHVpe.js";import{S as Oe}from"./send-P0r5D7td.js";import{I as Ye,C as se,L as je}from"./layers-jFqVrWMD.js";import{P as Ne}from"./play-d1ONaH0-.js";import{C as $s}from"./calendar-Bf0t2B82.js";import{L as Bs}from"./lightbulb-Jhp7FvbU.js";import{a as _e,B as Ks}from"./bug-CmZI7jqM.js";import"./chevron-up-CoUsOvZj.js";import"./hash-DNEv8Elo.js";const zs=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$e=ye("ban",zs);const Qs=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],Be=ye("folder-input",Qs);const Vs=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],ge=ye("link",Vs);var ne="Collapsible",[Hs]=js(ne),[Gs,ke]=Hs(ne),Ze=l.forwardRef((a,o)=>{const{__scopeCollapsible:m,open:c,defaultOpen:u,disabled:y,onOpenChange:j,...L}=a,[g,N]=ds({prop:c,defaultProp:u??!1,onChange:j,caller:ne});return e.jsx(Gs,{scope:m,disabled:y,contentId:ms(),open:g,onOpenToggle:l.useCallback(()=>N(F=>!F),[N]),children:e.jsx(ve.div,{"data-state":Se(g),"data-disabled":y?"":void 0,...L,ref:o})})});Ze.displayName=ne;var es="CollapsibleTrigger",ss=l.forwardRef((a,o)=>{const{__scopeCollapsible:m,...c}=a,u=ke(es,m);return e.jsx(ve.button,{type:"button","aria-controls":u.contentId,"aria-expanded":u.open||!1,"data-state":Se(u.open),"data-disabled":u.disabled?"":void 0,disabled:u.disabled,...c,ref:o,onClick:xs(a.onClick,u.onOpenToggle)})});ss.displayName=es;var Ce="CollapsibleContent",ts=l.forwardRef((a,o)=>{const{forceMount:m,...c}=a,u=ke(Ce,a.__scopeCollapsible);return e.jsx(us,{present:m||u.open,children:({present:y})=>e.jsx(Us,{...c,ref:o,present:y})})});ts.displayName=Ce;var Us=l.forwardRef((a,o)=>{const{__scopeCollapsible:m,present:c,children:u,...y}=a,j=ke(Ce,m),[L,g]=l.useState(c),N=l.useRef(null),F=hs(o,N),d=l.useRef(0),w=d.current,r=l.useRef(0),M=r.current,k=j.open||L,R=l.useRef(k),C=l.useRef(void 0);return l.useEffect(()=>{const v=requestAnimationFrame(()=>R.current=!1);return()=>cancelAnimationFrame(v)},[]),ps(()=>{const v=N.current;if(v){C.current=C.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const O=v.getBoundingClientRect();d.current=O.height,r.current=O.width,R.current||(v.style.transitionDuration=C.current.transitionDuration,v.style.animationName=C.current.animationName),g(c)}},[j.open,c]),e.jsx(ve.div,{"data-state":Se(j.open),"data-disabled":j.disabled?"":void 0,id:j.contentId,hidden:!k,...y,ref:F,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":M?`${M}px`:void 0,...a.style},children:k&&u})});function Se(a){return a?"open":"closed"}var Ws=Ze;const Ke=["#EF4444","#F97316","#EAB308","#22C55E","#06B6D4","#3B82F6","#8B5CF6","#EC4899"];function Js({ticketId:a,projectId:o,selectedLabels:m=[],onChange:c,disabled:u=!1,className:y}){const[j,L]=l.useState(!1),[g,N]=l.useState(""),[F,d]=l.useState(!1),[w,r]=l.useState(""),[M,k]=l.useState(Ke[0]),R=be(),{data:C,isLoading:v}=K({queryKey:["labels",o],queryFn:()=>f.labels.list(o,{includeGlobal:!0}),enabled:!!o}),{data:O}=K({queryKey:["ticket-labels",a],queryFn:()=>f.labels.getTicketLabels(a),enabled:!!a}),_=q({mutationFn:i=>f.labels.setTicketLabels(a,i),onSuccess:()=>{R.invalidateQueries({queryKey:["ticket-labels",a]}),R.invalidateQueries({queryKey:["tickets"]})}}),n=q({mutationFn:()=>f.labels.create(o,{name:w,color:M}),onSuccess:i=>{R.invalidateQueries({queryKey:["labels",o]});const p=i.label,I=b.map(z=>z.id);c?c([...b,p]):_.mutate([...I,p.id]),d(!1),N(""),r(""),L(!1)}}),A=C?.labels??[],b=O?.labels??m,S=new Set(b.map(i=>i.id)),E=A.filter(i=>i.name.toLowerCase().includes(g.toLowerCase())||i.description?.toLowerCase().includes(g.toLowerCase())),ie=i=>{const p=new Set(S);p.has(i.id)?p.delete(i.id):p.add(i.id);const I=A.filter(z=>p.has(z.id));c?c(I):_.mutate([...p])},$=i=>{const p=new Set(S);p.delete(i);const I=A.filter(z=>p.has(z.id));c?c(I):_.mutate([...p])};return e.jsxs("div",{className:H("flex flex-wrap items-center gap-1",y),children:[b.map(i=>e.jsxs(B,{variant:"outline",className:"gap-1 pr-1",style:{backgroundColor:`${i.color}20`,borderColor:i.color,color:i.color},children:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:i.color}}),i.name,!u&&e.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),$(i.id)},className:"ml-1 rounded-full hover:bg-muted/50",children:e.jsx(G,{className:"h-3 w-3"})})]},i.id)),!u&&e.jsxs(Fs,{open:j,onOpenChange:i=>{L(i),i||(d(!1),N(""))},children:[e.jsx(Es,{asChild:!0,children:e.jsxs(h,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-muted-foreground hover:text-foreground",children:[e.jsx(te,{className:"h-3 w-3"}),e.jsx(Xe,{className:"h-3 w-3"})]})}),e.jsxs(Is,{className:"w-64 p-0",align:"start",children:[e.jsx("div",{className:"p-2",children:e.jsx(we,{type:"text",placeholder:"Search labels...",value:g,onChange:i=>N(i.target.value),className:"h-8 text-xs px-2"})}),e.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:v?e.jsx("div",{className:"p-2 text-center text-sm text-muted-foreground",children:"Loading..."}):E.length===0&&!g?e.jsx("div",{className:"p-2 text-center text-sm text-muted-foreground",children:"No labels found"}):e.jsxs(e.Fragment,{children:[E.map(i=>e.jsxs("button",{type:"button",onClick:()=>ie(i),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-muted",children:[e.jsx("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:i.color}}),e.jsx("span",{className:"flex-1 text-left",children:i.name}),S.has(i.id)&&e.jsx(gs,{className:"h-4 w-4 text-primary"})]},i.id)),g&&e.jsx("div",{className:"mt-1 border-t pt-1",children:F?e.jsxs("div",{className:"p-2 space-y-2",children:[e.jsx("div",{className:"flex gap-1.5",children:Ke.map(i=>e.jsx("button",{type:"button",onClick:()=>k(i),className:H("h-4 w-4 rounded-full transition-transform hover:scale-110",M===i&&"ring-1 ring-primary ring-offset-1 ring-offset-background"),style:{backgroundColor:i}},i))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(h,{size:"sm",className:"h-7 text-[10px] flex-1",onClick:()=>n.mutate(),disabled:n.isPending,children:n.isPending?e.jsx(D,{className:"h-3 w-3 animate-spin"}):"Create"}),e.jsx(h,{size:"sm",variant:"ghost",className:"h-7 text-[10px]",onClick:()=>{d(!1),N("")},children:"Cancel"})]})]}):e.jsxs("button",{type:"button",onClick:()=>{d(!0),r(g)},className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-primary hover:bg-primary/5",children:[e.jsx(te,{className:"h-3 w-3"}),e.jsxs("span",{children:['Create "',g,'"']})]})})]})})]})]})]})}const Xs=Ws,Ys=ss,Zs=ts,ae=[{value:"blocks",label:"Blocks",icon:$e,color:"text-red-400",description:"This ticket blocks another"},{value:"blocked_by",label:"Blocked by",icon:$e,color:"text-orange-400",description:"This ticket is blocked by another"},{value:"relates_to",label:"Relates to",icon:fe,color:"text-blue-400",description:"Related tickets"},{value:"duplicates",label:"Duplicates",icon:ze,color:"text-purple-400",description:"This ticket duplicates another"},{value:"start_before",label:"Start before",icon:Ae,color:"text-cyan-400",description:"Must start before another ticket"},{value:"finish_before",label:"Finish before",icon:Ae,color:"text-emerald-400",description:"Must finish before another ticket"}];function et(a){return ae.find(o=>o.value===a)||ae[2]}function st({ticketId:a,relations:o=[]}){const m=be(),[c,u]=l.useState(!0),[y,j]=l.useState(!1),[L,g]=l.useState("relates_to"),[N,F]=l.useState(""),[d,w]=l.useState(null),{data:r,isLoading:M}=K({queryKey:["tickets-search",N],queryFn:()=>f.tickets.list({search:N,limit:10}),enabled:N.length>=2,staleTime:1e4}),k=r?.tickets?.filter(n=>n.id!==a)||[],R=q({mutationFn:({targetTicketId:n,type:A})=>f.tickets.addRelation(a,n,A),onSuccess:()=>{m.invalidateQueries({queryKey:["ticket",a]}),j(!1),F(""),w(null),x.success("Relation added")},onError:n=>{x.error(`Failed to add relation: ${n.message}`)}}),C=q({mutationFn:n=>f.tickets.removeRelation(a,n),onSuccess:()=>{m.invalidateQueries({queryKey:["ticket",a]}),x.success("Relation removed")},onError:n=>{x.error(`Failed to remove relation: ${n.message}`)}}),v=()=>{if(!d){x.error("Please select a ticket");return}R.mutate({targetTicketId:d,type:L})},O=o.reduce((n,A)=>{const b=A.relationType;return n[b]||(n[b]=[]),n[b].push(A),n},{}),_=o.length;return e.jsxs("div",{className:"glass rounded-[20px] p-4",children:[e.jsxs(Xs,{open:c,onOpenChange:u,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ys,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-2 text-sm font-semibold hover:text-primary transition-colors",children:[c?e.jsx(fs,{className:"h-4 w-4"}):e.jsx(Ns,{className:"h-4 w-4"}),e.jsx(fe,{className:"h-4 w-4"}),"Relations",_>0&&e.jsx(B,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:_})]})}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>j(!0),className:"h-7 w-7 p-0 rounded-lg",children:e.jsx(te,{className:"h-4 w-4"})})]}),e.jsx(Zs,{className:"pt-3 space-y-3",children:_===0?e.jsxs("div",{className:"text-center py-4",children:[e.jsx(fe,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/40"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relations"}),e.jsxs(h,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"mt-2 h-7 text-xs gap-1",children:[e.jsx(te,{className:"h-3 w-3"}),"Add relation"]})]}):Object.entries(O).map(([n,A])=>{const b=et(n);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:H("flex items-center gap-1.5 text-xs font-medium",b.color),children:[e.jsx(b.icon,{className:"h-3 w-3"}),b.label]}),e.jsx("div",{className:"space-y-1",children:A.map(S=>{const E=S.sourceTicketId===a?S.targetTicket:S.sourceTicket;return E?e.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 rounded-lg bg-white/5 group",children:[e.jsx(V,{to:`/tickets/${E.id}`,className:"flex-1 min-w-0 hover:text-primary transition-colors",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:[E.projectKey||"PROFCLAW","-",E.sequence]}),e.jsx("span",{className:"text-xs truncate",children:E.title})]})}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>C.mutate(S.id),disabled:C.isPending,className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",children:C.isPending?e.jsx(D,{className:"h-3 w-3 animate-spin"}):e.jsx(G,{className:"h-3 w-3 text-muted-foreground hover:text-red-400"})})]},S.id):null})})]},n)})})]}),e.jsx(Ve,{open:y,onOpenChange:j,children:e.jsxs(He,{className:"sm:max-w-[425px]",children:[e.jsxs(Ge,{children:[e.jsx(Ue,{children:"Add Relation"}),e.jsx(We,{children:"Link this ticket to another ticket."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Relation Type"}),e.jsxs(X,{value:L,onValueChange:n=>g(n),children:[e.jsx(Y,{children:e.jsx(Z,{})}),e.jsx(ee,{children:ae.map(n=>e.jsx(P,{value:n.value,children:e.jsxs("span",{className:H("flex items-center gap-2",n.color),children:[e.jsx(n.icon,{className:"h-4 w-4"}),n.label]})},n.value))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:ae.find(n=>n.value===L)?.description})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Search Ticket"}),e.jsxs("div",{className:"relative",children:[e.jsx(ys,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(we,{placeholder:"Search by title or ID...",value:N,onChange:n=>F(n.target.value),className:"pl-9"})]})]}),N.length>=2&&e.jsx("div",{className:"bg-muted/30 rounded-lg divide-y divide-border/20 max-h-48 overflow-y-auto",children:M?e.jsx("div",{className:"p-4 text-center",children:e.jsx(D,{className:"h-4 w-4 animate-spin mx-auto"})}):k.length===0?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No tickets found"}):k.map(n=>e.jsx("button",{type:"button",onClick:()=>w(n.id),className:H("w-full text-left p-3 hover:bg-muted/50 transition-colors",d===n.id&&"bg-primary/10"),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:[n.projectKey||"PROFCLAW","-",n.sequence]}),e.jsx("span",{className:"text-sm truncate",children:n.title})]})},n.id))}),d&&e.jsxs("div",{className:"p-3 rounded-lg bg-primary/10 border border-primary/20",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Selected:"}),e.jsx("p",{className:"text-sm font-medium",children:k.find(n=>n.id===d)?.title||"Ticket selected"})]})]}),e.jsxs(Je,{children:[e.jsx(h,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),e.jsxs(h,{onClick:v,disabled:!d||R.isPending,children:[R.isPending&&e.jsx(D,{className:"h-4 w-4 mr-2 animate-spin"}),"Add Relation"]})]})]})})]})}const tt=[{value:"backlog",label:"Backlog",icon:Ye},{value:"todo",label:"Todo",icon:se},{value:"in_progress",label:"In Progress",icon:Ne},{value:"in_review",label:"In Review",icon:Qe},{value:"done",label:"Done",icon:J},{value:"cancelled",label:"Cancelled",icon:G}];function At(){const{id:a}=vs(),o=bs(),m=be(),[c,u]=l.useState(""),[y,j]=l.useState("comments"),[L,g]=l.useState(!1),[N,F]=l.useState(!1),[d,w]=l.useState({title:"",description:"",priority:"medium",type:"task",estimate:null}),{data:r,isLoading:M,error:k}=K({queryKey:["ticket",a],queryFn:()=>f.tickets.get(a,!0),enabled:!!a}),{data:R}=K({queryKey:["projects"],queryFn:()=>f.projects.list({limit:50})}),{data:C,isLoading:v}=K({queryKey:["ticket-similar",a],queryFn:()=>f.tickets.ai.similar(a,5),enabled:!!a&&!!r}),{data:O,isLoading:_}=K({queryKey:["ticket-summary",a],queryFn:()=>f.tickets.ai.summary(a),enabled:!!a&&!!r,staleTime:3e5}),{data:n}=K({queryKey:["ai-status"],queryFn:()=>f.tickets.ai.status(),staleTime:6e4}),A=n?.available??!1,b=q({mutationFn:s=>f.tickets.transition(a,s),onSuccess:()=>{m.invalidateQueries({queryKey:["ticket",a]}),m.invalidateQueries({queryKey:["tickets"]}),x.success("Status updated")},onError:s=>{x.error(`Failed to update status: ${s.message}`)}}),S=q({mutationFn:s=>f.tickets.update(a,s),onSuccess:()=>{m.invalidateQueries({queryKey:["ticket",a]}),m.invalidateQueries({queryKey:["tickets"]}),g(!1),x.success("Ticket updated")},onError:s=>{x.error(`Failed to update ticket: ${s.message}`)}}),E=q({mutationFn:()=>f.tickets.delete(a),onSuccess:()=>{m.invalidateQueries({queryKey:["tickets"]}),x.success("Ticket deleted"),o("/tickets")},onError:s=>{x.error(`Failed to delete ticket: ${s.message}`)}}),ie=q({mutationFn:s=>f.tickets.update(a,{projectId:s}),onSuccess:()=>{m.invalidateQueries({queryKey:["ticket",a]}),m.invalidateQueries({queryKey:["tickets"]}),x.success("Ticket moved to project")},onError:s=>{x.error(`Failed to move ticket: ${s.message}`)}}),$=q({mutationFn:s=>f.tickets.addComment(a,s),onSuccess:()=>{m.invalidateQueries({queryKey:["ticket",a]}),u(""),x.success("Comment added")},onError:s=>{x.error(`Failed to add comment: ${s.message}`)}}),i=q({mutationFn:s=>f.tickets.ai.respond(a,s),onSuccess:s=>{s.posted&&s.comment?(m.invalidateQueries({queryKey:["ticket",a]}),x.success("AI response posted")):s.response?(I(s.response),U(s.confidence),x.success(`AI generated response (${Math.round(s.confidence*100)}% confidence)`)):s.skipped&&x.info(s.reason||"AI chose not to respond")},onError:s=>{x.error(`AI response failed: ${s.message}`)}}),[p,I]=l.useState(null),[z,U]=l.useState(0),as=async()=>{p&&(await $.mutateAsync(p),I(null),U(0))},ns=()=>{c.trim()&&$.mutate(c)},is=()=>{r&&(w({title:r.title,description:r.description||"",priority:r.priority,type:r.type,estimate:r.estimate??null}),g(!0))},ls=()=>{S.mutate({...d,estimate:d.estimate??void 0,estimateUnit:d.estimate!==null?"points":void 0})},Te=s=>{ie.mutate(s)},rs=async()=>{if(r)try{const s=await f.tickets.create({title:`${r.title} (Copy)`,description:r.description,type:r.type,priority:r.priority,labels:r.labels,projectId:r.projectId});x.success("Ticket duplicated"),o(`/tickets/${s.ticket.id}`)}catch{x.error("Failed to duplicate ticket")}},cs=s=>{const le={done:{variant:"success",icon:J},cancelled:{variant:"destructive",icon:G},in_progress:{variant:"info",icon:Ne},in_review:{variant:"warning",icon:Qe},todo:{variant:"secondary",icon:se},backlog:{variant:"secondary",icon:Ye}}[s],{variant:re,icon:ce}=le;return e.jsxs(B,{variant:re,className:"gap-1 text-sm px-3 py-1",children:[e.jsx(ce,{className:"h-4 w-4"}),s.replace("_"," ")]})},Pe=s=>{const le={task:{icon:J,color:"text-blue-500"},bug:{icon:Ks,color:"text-red-500"},feature:{icon:Fe,color:"text-cyan-500"},enhancement:{icon:Fe,color:"text-indigo-500"},documentation:{icon:_e,color:"text-cyan-500"},epic:{icon:je,color:"text-orange-500"},story:{icon:_e,color:"text-green-500"},subtask:{icon:se,color:"text-gray-500"}}[s],{icon:re,color:ce}=le;return e.jsxs("span",{className:`flex items-center gap-1.5 text-sm ${ce}`,children:[e.jsx(re,{className:"h-4 w-4"}),s]})},os=s=>({urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-500",none:"text-gray-400"})[s]||"text-gray-400";if(M)return e.jsx("div",{className:"glass rounded-[28px] p-12 flex items-center justify-center",children:e.jsx(D,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(k||!r)return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(h,{variant:"ghost",onClick:()=>o("/tickets"),className:"gap-2",children:[e.jsx(Le,{className:"h-4 w-4"}),"Back to Tickets"]}),e.jsxs("div",{className:"glass rounded-[28px] p-12 text-center",children:[e.jsx(ws,{className:"h-12 w-12 mx-auto text-red-400 mb-4"}),e.jsx("p",{className:"text-lg font-bold text-red-400",children:k?"Error loading ticket":"Ticket not found"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:k?k.message:`No ticket found with ID: ${a}`})]})]});const t=r,W=R?.projects||[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(h,{variant:"ghost",onClick:()=>o("/tickets"),className:"gap-2",children:[e.jsx(Le,{className:"h-4 w-4"}),"Back to Tickets"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(h,{variant:"outline",size:"sm",onClick:is,className:"gap-2",children:[e.jsx(qs,{className:"h-4 w-4"}),"Edit"]}),e.jsxs(oe,{children:[e.jsx(de,{asChild:!0,children:e.jsxs(h,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(Be,{className:"h-4 w-4"}),"Move to Project"]})}),e.jsx(me,{align:"end",className:"w-56",children:W.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No projects available"}):W.map(s=>e.jsxs(Q,{onClick:()=>Te(s.id),disabled:s.id===t.projectId,children:[e.jsx("span",{className:"mr-2",children:s.icon}),s.name,s.id===t.projectId&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"(current)"})]},s.id))})]}),e.jsxs(oe,{children:[e.jsx(de,{asChild:!0,children:e.jsx(h,{variant:"outline",size:"icon",className:"h-9 w-9",children:e.jsx(Ms,{className:"h-4 w-4"})})}),e.jsxs(me,{align:"end",children:[e.jsxs(Q,{onClick:rs,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),"Duplicate Ticket"]}),e.jsxs(Q,{onClick:()=>{const s=t.externalLinks?.find(T=>T.platform==="jira");s?.externalUrl?window.open(s.externalUrl,"_blank"):x.info("No Jira link found. Link this ticket to Jira first.")},children:[e.jsx(Re,{className:"h-4 w-4 mr-2"}),"Open in Jira"]}),e.jsx(ks,{}),e.jsxs(Q,{className:"text-red-500 focus:text-red-500",onClick:()=>F(!0),children:[e.jsx(Os,{className:"h-4 w-4 mr-2"}),"Delete Ticket"]})]})]})]})]}),e.jsx(Ve,{open:L,onOpenChange:g,children:e.jsxs(He,{className:"sm:max-w-[500px]",children:[e.jsxs(Ge,{children:[e.jsx(Ue,{children:"Edit Ticket"}),e.jsx(We,{children:"Make changes to the ticket details."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Title"}),e.jsx(we,{value:d.title,onChange:s=>w(T=>({...T,title:s.target.value})),placeholder:"Ticket title"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Description"}),e.jsx(Ee,{value:d.description,onChange:s=>w(T=>({...T,description:s.target.value})),placeholder:"Ticket description",rows:4})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Priority"}),e.jsxs(X,{value:d.priority,onValueChange:s=>w(T=>({...T,priority:s})),children:[e.jsx(Y,{children:e.jsx(Z,{})}),e.jsxs(ee,{children:[e.jsx(P,{value:"urgent",children:"Urgent"}),e.jsx(P,{value:"high",children:"High"}),e.jsx(P,{value:"medium",children:"Medium"}),e.jsx(P,{value:"low",children:"Low"}),e.jsx(P,{value:"none",children:"None"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Type"}),e.jsxs(X,{value:d.type,onValueChange:s=>w(T=>({...T,type:s})),children:[e.jsx(Y,{children:e.jsx(Z,{})}),e.jsxs(ee,{children:[e.jsx(P,{value:"task",children:"Task"}),e.jsx(P,{value:"bug",children:"Bug"}),e.jsx(P,{value:"feature",children:"Feature"}),e.jsx(P,{value:"enhancement",children:"Enhancement"}),e.jsx(P,{value:"epic",children:"Epic"}),e.jsx(P,{value:"story",children:"Story"}),e.jsx(P,{value:"subtask",children:"Subtask"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Estimate"}),e.jsx(Ie,{value:d.estimate,onChange:s=>w(T=>({...T,estimate:s})),placeholder:"Points"})]})]})]}),e.jsxs(Je,{children:[e.jsx(h,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),e.jsxs(h,{onClick:ls,disabled:S.isPending,children:[S.isPending&&e.jsx(D,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Changes"]})]})]})}),e.jsx(Cs,{open:N,onOpenChange:F,children:e.jsxs(Ss,{children:[e.jsxs(Ts,{children:[e.jsx(Ps,{children:"Delete Ticket"}),e.jsxs(As,{children:['Are you sure you want to delete "',t.title,'"? This action cannot be undone.']})]}),e.jsxs(Ls,{children:[e.jsx(Rs,{children:"Cancel"}),e.jsxs(Ds,{onClick:()=>E.mutate(),className:"bg-red-500 hover:bg-red-600",children:[E.isPending&&e.jsx(D,{className:"h-4 w-4 mr-2 animate-spin"}),"Delete"]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{className:"glass rounded-[20px] p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-mono text-muted-foreground bg-white/5 px-2 py-1 rounded-md",children:[t.projectKey||"PROFCLAW","-",t.sequence]}),!t.projectId&&e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider text-amber-400 px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20",children:"No Project"}),Pe(t.type)]}),cs(t.status)]}),e.jsx("h1",{className:"text-2xl font-bold mb-4",children:t.title}),t.description&&e.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.description})}),(t.linkedPRs.length>0||t.linkedCommits.length>0||t.linkedBranch)&&e.jsxs("div",{className:"flex flex-wrap gap-4 mt-4 pt-4 border-t border-white/5",children:[t.linkedBranch&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(qe,{className:"h-3.5 w-3.5"}),t.linkedBranch]}),t.linkedPRs.length>0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(qe,{className:"h-3.5 w-3.5"}),t.linkedPRs.length," PR(s)"]}),t.linkedCommits.length>0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(_s,{className:"h-3.5 w-3.5"}),t.linkedCommits.length," commit(s)"]})]})]}),e.jsxs("div",{className:"glass rounded-[20px] overflow-hidden",children:[e.jsxs("div",{className:"flex border-b border-white/5",children:[e.jsxs("button",{onClick:()=>j("comments"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors ${y==="comments"?"bg-white/5 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Me,{className:"h-4 w-4"}),"Comments (",t.comments?.length||0,")"]}),e.jsxs("button",{onClick:()=>j("history"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors ${y==="history"?"bg-white/5 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(he,{className:"h-4 w-4"}),"History (",t.history?.length||0,")"]}),e.jsxs("button",{onClick:()=>j("links"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors ${y==="links"?"bg-white/5 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ge,{className:"h-4 w-4"}),"Links (",t.externalLinks?.length||0,")"]})]}),e.jsxs("div",{className:"p-4",children:[y==="comments"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/20 flex items-center justify-center shrink-0",children:e.jsx(xe,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Ee,{placeholder:"Add a comment...",value:c,onChange:s=>u(s.target.value),className:"min-h-20"}),e.jsxs("div",{className:"flex justify-end mt-2 gap-2",children:[A&&t.comments&&t.comments.length>0&&e.jsxs(h,{size:"sm",variant:"outline",onClick:()=>i.mutate({}),disabled:i.isPending,className:"gap-2",children:[i.isPending?e.jsx(D,{className:"h-4 w-4 animate-spin"}):e.jsx(pe,{className:"h-4 w-4"}),"AI Respond"]}),e.jsxs(h,{size:"sm",variant:"black",onClick:ns,disabled:!c.trim()||$.isPending,className:"gap-2",children:[$.isPending?e.jsx(D,{className:"h-4 w-4 animate-spin"}):e.jsx(Oe,{className:"h-4 w-4"}),"Comment"]})]})]})]}),p&&e.jsxs("div",{className:"rounded-xl bg-primary/5 border border-primary/20 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-primary",children:[e.jsx(pe,{className:"h-4 w-4"}),"AI Generated Response",e.jsxs(B,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:[Math.round(z*100),"% confidence"]})]}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>{I(null),U(0)},className:"h-6 w-6 p-0 rounded-lg",children:e.jsx(G,{className:"h-3 w-3"})})]}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:p}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(h,{size:"sm",variant:"outline",onClick:()=>{u(p),I(null),U(0)},className:"gap-1 rounded-xl border-white/10 text-xs",children:"Edit First"}),e.jsxs(h,{size:"sm",onClick:as,disabled:$.isPending,className:"gap-1 rounded-xl text-xs",children:[$.isPending?e.jsx(D,{className:"h-3 w-3 animate-spin"}):e.jsx(Oe,{className:"h-3 w-3"}),"Post Response"]})]})]}),t.comments&&t.comments.length>0?e.jsx("div",{className:"space-y-4 pt-4 border-t border-white/5",children:t.comments.map(s=>e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:`h-8 w-8 rounded-full flex items-center justify-center flex-shrink-0 ${s.author.type==="ai","bg-blue-500/20"}`,children:s.author.type==="ai"?e.jsx(ue,{className:"h-4 w-4 text-blue-500"}):e.jsx(xe,{className:"h-4 w-4 text-blue-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:s.author.name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(s.createdAt).toLocaleString()}),s.source!=="profclaw"&&e.jsx(B,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:s.source})]}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:s.content})]})]},s.id))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Me,{className:"h-8 w-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No comments yet"})]})]}),y==="history"&&e.jsx("div",{className:"space-y-3",children:t.history&&t.history.length>0?t.history.map(s=>e.jsxs("div",{className:"flex items-start gap-3 py-2",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-white/5 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(he,{className:"h-3 w-3 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:s.changedBy.name}),e.jsx("span",{className:"text-muted-foreground",children:" changed "}),e.jsx("span",{className:"font-medium",children:s.field}),s.oldValue&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:" from "}),e.jsx("span",{className:"text-red-400/80",children:s.oldValue})]}),s.newValue&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:" to "}),e.jsx("span",{className:"text-green-400/80",children:s.newValue})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(s.timestamp).toLocaleString()})]})]},s.id)):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(he,{className:"h-8 w-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No history yet"})]})}),y==="links"&&e.jsx("div",{className:"space-y-3",children:t.externalLinks&&t.externalLinks.length>0?t.externalLinks.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-white/5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-white/5 flex items-center justify-center",children:e.jsx(ge,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm capitalize",children:s.platform}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.externalId})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{variant:s.syncEnabled?"success":"secondary",className:"text-[10px]",children:s.syncDirection}),s.externalUrl&&e.jsx("a",{href:s.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"p-2 hover:bg-white/5 rounded-lg transition-colors",children:e.jsx(Re,{className:"h-4 w-4 text-muted-foreground"})})]})]},s.id)):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ge,{className:"h-8 w-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No external links yet"})]})})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"glass rounded-[20px] p-4",children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Status"}),e.jsxs(X,{value:t.status,onValueChange:s=>b.mutate(s),disabled:b.isPending,children:[e.jsx(Y,{className:"w-full bg-white/5 border-white/10 rounded-xl",children:e.jsx(Z,{})}),e.jsx(ee,{className:"glass-heavy rounded-xl border-white/10",children:tt.map(s=>e.jsx(P,{value:s.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(s.icon,{className:"h-4 w-4"}),s.label]})},s.value))})]})]}),e.jsxs("div",{className:"glass rounded-[20px] p-4 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Details"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Project"}),t.projectId?e.jsx(V,{to:`/projects/${t.projectId}`,className:"text-sm font-medium text-primary hover:underline",children:t.projectName||t.projectKey||"View Project"}):e.jsx("span",{className:"text-sm text-muted-foreground italic",children:"No project"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Priority"}),e.jsx("span",{className:`text-sm font-medium capitalize ${os(t.priority)}`,children:t.priority})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Type"}),Pe(t.type)]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Created By"}),e.jsx("span",{className:"flex items-center gap-1.5 text-sm",children:t.createdBy==="ai"?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-3.5 w-3.5 text-indigo-400"}),"AI"]}):e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"h-3.5 w-3.5 text-blue-400"}),"Human"]})})]}),t.assigneeAgent&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Assigned Agent"}),e.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-primary",children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),t.assigneeAgent]})]}),t.aiAgent&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"AI Agent"}),e.jsx("span",{className:"text-sm",children:t.aiAgent})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Estimate"}),e.jsx(Ie,{value:t.estimate??null,onChange:s=>{S.mutate({estimate:s??void 0,estimateUnit:s!==null?"points":void 0})},compact:!0,placeholder:"—",className:"w-[90px] h-8 text-xs"})]}),t.dueDate&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Due Date"}),e.jsxs("span",{className:"flex items-center gap-1.5 text-sm",children:[e.jsx($s,{className:"h-3.5 w-3.5"}),new Date(t.dueDate).toLocaleDateString()]})]})]})]}),e.jsxs("div",{className:"glass rounded-[20px] p-4 space-y-3",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Xe,{className:"h-4 w-4"}),"Labels"]}),t.projectId?e.jsx(Js,{ticketId:t.id,projectId:t.projectId}):e.jsxs("div",{className:"text-center py-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Assign to a project to add labels"}),e.jsxs(oe,{children:[e.jsx(de,{asChild:!0,children:e.jsxs(h,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",children:[e.jsx(Be,{className:"h-3 w-3"}),"Select Project"]})}),e.jsx(me,{align:"center",className:"w-48",children:W.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No projects available"}):W.map(s=>e.jsxs(Q,{onClick:()=>Te(s.id),className:"text-sm",children:[e.jsx("span",{className:"mr-2",children:s.icon}),s.name]},s.id))})]})]})]}),e.jsx(st,{ticketId:t.id,relations:t.relations||[]}),t.parent&&e.jsxs("div",{className:"glass rounded-[20px] p-4 space-y-3",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4 text-amber-400"}),"Parent Ticket"]}),e.jsxs(V,{to:`/tickets/${t.parent.id}`,className:"block p-3 rounded-xl bg-white/5 hover:bg-white/10 transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:[t.parent.projectKey||"PROFCLAW","-",t.parent.sequence]}),t.parent.type==="epic"&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 font-medium",children:"EPIC"})]}),e.jsx("p",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:t.parent.title})]})]}),t.children&&t.children.length>0&&e.jsxs("div",{className:"glass rounded-[20px] p-4 space-y-3",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4 text-primary"}),"Child Tickets (",t.children.length,")",e.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:[t.children.filter(s=>s.status==="done").length,"/",t.children.length," done"]})]}),e.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-green-500 to-emerald-400 transition-all",style:{width:`${t.children.filter(s=>s.status==="done").length/t.children.length*100}%`}})}),e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:t.children.map(s=>e.jsxs(V,{to:`/tickets/${s.id}`,className:"flex items-center gap-3 p-2 rounded-lg bg-white/5 hover:bg-white/10 transition-colors group",children:[e.jsx("div",{className:`flex-shrink-0 ${s.status==="done"?"text-green-500":s.status==="in_progress"?"text-blue-500":"text-muted-foreground"}`,children:s.status==="done"?e.jsx(J,{className:"h-4 w-4"}):s.status==="in_progress"?e.jsx(Ne,{className:"h-4 w-4"}):e.jsx(se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-xs font-mono text-muted-foreground mb-0.5",children:[s.projectKey||"PROFCLAW","-",s.sequence]}),e.jsx("p",{className:`text-sm truncate group-hover:text-primary transition-colors ${s.status==="done"?"line-through text-muted-foreground":""}`,children:s.title})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground capitalize",children:s.type})]},s.id))})]}),e.jsxs("div",{className:"glass rounded-[20px] p-4 space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Timestamps"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Created"}),e.jsx("span",{className:"text-xs",children:new Date(t.createdAt).toLocaleString()})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Updated"}),e.jsx("span",{className:"text-xs",children:new Date(t.updatedAt).toLocaleString()})]}),t.startedAt&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Started"}),e.jsx("span",{className:"text-xs",children:new Date(t.startedAt).toLocaleString()})]}),t.completedAt&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Completed"}),e.jsx("span",{className:"text-xs",children:new Date(t.completedAt).toLocaleString()})]})]})]}),A&&e.jsxs("div",{className:"glass rounded-[20px] p-4 space-y-3",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Bs,{className:"h-4 w-4 text-primary"}),"AI Summary"]}),_?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(D,{className:"h-3 w-3 animate-spin"}),"Generating summary..."]}):O?.summary?e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:O.summary}):e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Summary not available"})]}),e.jsxs("div",{className:"glass rounded-[20px] p-4 space-y-3",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(pe,{className:"h-4 w-4 text-primary"}),"Similar Tickets"]}),v?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(D,{className:"h-3 w-3 animate-spin"}),"Finding similar tickets..."]}):C?.similar&&C.similar.length>0?e.jsx("div",{className:"space-y-2",children:C.similar.map(s=>e.jsxs(V,{to:`/tickets/${s.id}`,className:"block p-2 rounded-lg bg-white/5 hover:bg-white/10 transition-colors group",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx(De,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:[s.projectKey||"PROFCLAW","-",s.sequence]})]}),e.jsx("p",{className:"text-xs font-medium truncate group-hover:text-primary transition-colors",children:s.title})]}),e.jsxs(B,{variant:"outline",className:"text-[10px] px-1.5 py-0 flex-shrink-0 tabular-nums",children:[Math.round(s.similarity*100),"%"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[e.jsx(B,{variant:s.status==="done"?"success":s.status==="in_progress"?"info":"secondary",className:"text-[9px] px-1 py-0",children:s.status.replace("_"," ")}),e.jsx("span",{className:"text-[10px] text-muted-foreground capitalize",children:s.type})]})]},s.id))}):e.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[e.jsx(De,{className:"h-6 w-6 mx-auto mb-1 opacity-40"}),e.jsx("p",{className:"text-xs",children:"No similar tickets found"})]})]})]})]})]})}export{At as TicketDetail};