@hienlh/ppm 0.9.81 → 0.9.83

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 (1754) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/CLAUDE.md +12 -0
  3. package/assets/skills/ppm-guide/SKILL.md +61 -0
  4. package/bun.lock +9 -1
  5. package/dist/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  6. package/dist/web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  7. package/dist/web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  8. package/dist/web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  9. package/dist/web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  10. package/dist/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  11. package/dist/web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  12. package/dist/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  13. package/dist/web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  14. package/dist/web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  15. package/dist/web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  16. package/dist/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  17. package/dist/web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  18. package/dist/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  19. package/dist/web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  20. package/dist/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  21. package/dist/web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  22. package/dist/web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  23. package/dist/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  24. package/dist/web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  25. package/dist/web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  26. package/dist/web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  27. package/dist/web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  28. package/dist/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  29. package/dist/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  30. package/dist/web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  31. package/dist/web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  32. package/dist/web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  33. package/dist/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  34. package/dist/web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  35. package/dist/web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  36. package/dist/web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  37. package/dist/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  38. package/dist/web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  39. package/dist/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  40. package/dist/web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  41. package/dist/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  42. package/dist/web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  43. package/dist/web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  44. package/dist/web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  45. package/dist/web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  46. package/dist/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  47. package/dist/web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  48. package/dist/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  49. package/dist/web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  50. package/dist/web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  51. package/dist/web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  52. package/dist/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  53. package/dist/web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  54. package/dist/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  55. package/dist/web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  56. package/dist/web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  57. package/dist/web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  58. package/dist/web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  59. package/dist/web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  60. package/dist/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  61. package/dist/web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  62. package/dist/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  63. package/dist/web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  64. package/dist/web/assets/chat-tab-DBJJz0Dm.js +10 -0
  65. package/dist/web/assets/{code-editor-CKhVVTIi.js → code-editor-BvSFsrGo.js} +1 -1
  66. package/dist/web/assets/{database-viewer-VT17cuX4.js → database-viewer-0P_zRC9w.js} +1 -1
  67. package/dist/web/assets/{diff-viewer-D6gXDpSU.js → diff-viewer-BmBJq4gO.js} +1 -1
  68. package/dist/web/assets/{extension-webview-CAQUbBuw.js → extension-webview-Cx0GpRyC.js} +1 -1
  69. package/dist/web/assets/{git-graph-CdRJbH07.js → git-graph-BAlhf058.js} +1 -1
  70. package/dist/web/assets/index-BDAqXmpQ.js +30 -0
  71. package/dist/web/assets/index-BYXjCNlK.css +2 -0
  72. package/dist/web/assets/keybindings-store-L7UlPjK0.js +1 -0
  73. package/dist/web/assets/markdown-renderer-CYs_lrjt.js +326 -0
  74. package/dist/web/assets/{port-forwarding-tab-1vSZG1Ga.js → port-forwarding-tab-CSHJ7gxM.js} +1 -1
  75. package/dist/web/assets/{postgres-viewer-Bn8hKEnP.js → postgres-viewer-DlCLiEGU.js} +1 -1
  76. package/dist/web/assets/{settings-tab-CpG9UbHr.js → settings-tab-Dcr7lDcJ.js} +1 -1
  77. package/dist/web/assets/{sql-query-editor-yvUfZVDr.js → sql-query-editor-Dxx-QZaI.js} +1 -1
  78. package/dist/web/assets/{sqlite-viewer-BSFIa0hd.js → sqlite-viewer-B0052fC-.js} +1 -1
  79. package/dist/web/assets/{terminal-tab-CbIBTfPE.js → terminal-tab-yfmxGQ5e.js} +1 -1
  80. package/dist/web/assets/{use-monaco-theme-x9tJcwlL.js → use-monaco-theme-7qyyJae5.js} +1 -1
  81. package/dist/web/index.html +2 -2
  82. package/dist/web/sw.js +1 -1
  83. package/docs/codebase-summary.md +78 -0
  84. package/docs/project-changelog.md +29 -0
  85. package/docs/system-architecture.md +2 -0
  86. package/package.json +5 -2
  87. package/scripts/check-ppm-dir-usage.sh +21 -0
  88. package/scripts/generate-ppm-guide.ts +92 -0
  89. package/src/cli/commands/cloud.ts +1 -0
  90. package/src/cli/commands/init.ts +2 -1
  91. package/src/cli/commands/logs.ts +11 -11
  92. package/src/cli/commands/report.ts +3 -2
  93. package/src/cli/commands/restart.ts +22 -23
  94. package/src/cli/commands/skills-cmd.ts +123 -0
  95. package/src/cli/commands/status.ts +7 -8
  96. package/src/cli/commands/stop.ts +18 -19
  97. package/src/index.ts +3 -0
  98. package/src/lib/account-crypto.ts +12 -7
  99. package/src/providers/claude-agent-sdk.ts +148 -12
  100. package/src/server/index.ts +8 -8
  101. package/src/server/routes/chat.ts +4 -2
  102. package/src/server/routes/port-forwarding.ts +118 -67
  103. package/src/server/routes/upgrade.ts +3 -5
  104. package/src/server/ws/chat.ts +16 -0
  105. package/src/services/cloud-ws.service.ts +2 -2
  106. package/src/services/cloud.service.ts +20 -19
  107. package/src/services/cloudflared.service.ts +13 -13
  108. package/src/services/config.service.ts +5 -7
  109. package/src/services/db.service.ts +5 -6
  110. package/src/services/extension-rpc-handlers.ts +2 -2
  111. package/src/services/extension.service.ts +9 -12
  112. package/src/services/ppm-dir.ts +14 -0
  113. package/src/services/slash-discovery/builtin-commands.ts +53 -0
  114. package/src/services/slash-discovery/builtin-handlers.ts +65 -0
  115. package/src/services/slash-discovery/definition-source.ts +27 -0
  116. package/src/services/slash-discovery/discover-skill-roots.ts +128 -0
  117. package/src/services/slash-discovery/fuzzy-search.ts +76 -0
  118. package/src/services/slash-discovery/index.ts +42 -0
  119. package/src/services/slash-discovery/resolve-overrides.ts +41 -0
  120. package/src/services/slash-discovery/skill-loader.ts +156 -0
  121. package/src/services/slash-discovery/types.ts +51 -0
  122. package/src/services/slash-items.service.ts +4 -182
  123. package/src/services/supervisor-state.ts +14 -15
  124. package/src/services/supervisor-stopped-page.ts +2 -4
  125. package/src/services/supervisor.ts +23 -16
  126. package/src/services/tunnel.service.ts +4 -5
  127. package/src/services/upgrade.service.ts +2 -3
  128. package/src/types/chat.ts +3 -1
  129. package/src/web/components/chat/chat-tab.tsx +4 -1
  130. package/src/web/components/chat/message-input.tsx +48 -6
  131. package/src/web/components/chat/message-list.tsx +2 -2
  132. package/src/web/components/chat/slash-command-picker.tsx +21 -12
  133. package/src/web/components/layout/upgrade-banner.tsx +48 -2
  134. package/src/web/components/shared/markdown-renderer.tsx +2 -0
  135. package/src/web/hooks/use-chat.ts +3 -1
  136. package/src/web/hooks/use-url-sync.ts +6 -4
  137. package/src/web/main.tsx +1 -0
  138. package/.opencode/.ckignore +0 -27
  139. package/.opencode/.env.example +0 -98
  140. package/.opencode/agents/analytics-analyst.md +0 -168
  141. package/.opencode/agents/attraction-specialist.md +0 -152
  142. package/.opencode/agents/brainstormer.md +0 -114
  143. package/.opencode/agents/campaign-debugger.md +0 -149
  144. package/.opencode/agents/campaign-manager.md +0 -185
  145. package/.opencode/agents/code-reviewer.md +0 -163
  146. package/.opencode/agents/code-simplifier.md +0 -59
  147. package/.opencode/agents/community-manager.md +0 -181
  148. package/.opencode/agents/content-creator.md +0 -166
  149. package/.opencode/agents/content-reviewer.md +0 -170
  150. package/.opencode/agents/continuity-specialist.md +0 -149
  151. package/.opencode/agents/copywriter.md +0 -118
  152. package/.opencode/agents/database-admin.md +0 -98
  153. package/.opencode/agents/debugger.md +0 -143
  154. package/.opencode/agents/docs-manager.md +0 -127
  155. package/.opencode/agents/email-wizard.md +0 -166
  156. package/.opencode/agents/fullstack-developer.md +0 -101
  157. package/.opencode/agents/funnel-architect.md +0 -176
  158. package/.opencode/agents/git-manager.md +0 -399
  159. package/.opencode/agents/journal-writer.md +0 -119
  160. package/.opencode/agents/lead-qualifier.md +0 -146
  161. package/.opencode/agents/mcp-manager.md +0 -99
  162. package/.opencode/agents/planner.md +0 -114
  163. package/.opencode/agents/project-manager.md +0 -130
  164. package/.opencode/agents/researcher.md +0 -44
  165. package/.opencode/agents/sale-enabler.md +0 -161
  166. package/.opencode/agents/scout-external.md +0 -146
  167. package/.opencode/agents/scout.md +0 -112
  168. package/.opencode/agents/seo-specialist.md +0 -185
  169. package/.opencode/agents/social-media-manager.md +0 -163
  170. package/.opencode/agents/tester.md +0 -111
  171. package/.opencode/agents/ui-ux-designer.md +0 -241
  172. package/.opencode/agents/upsell-maximizer.md +0 -147
  173. package/.opencode/commands/ckm-analyze-report.md +0 -66
  174. package/.opencode/commands/ckm-analyze.md +0 -63
  175. package/.opencode/commands/ckm-ask.md +0 -55
  176. package/.opencode/commands/ckm-brand-update.md +0 -122
  177. package/.opencode/commands/ckm-campaign-analyze.md +0 -54
  178. package/.opencode/commands/ckm-campaign-create.md +0 -215
  179. package/.opencode/commands/ckm-campaign-email.md +0 -63
  180. package/.opencode/commands/ckm-campaign-status.md +0 -38
  181. package/.opencode/commands/ckm-campaign.md +0 -64
  182. package/.opencode/commands/ckm-competitor.md +0 -69
  183. package/.opencode/commands/ckm-dashboard-check.md +0 -97
  184. package/.opencode/commands/ckm-dashboard.md +0 -90
  185. package/.opencode/commands/ckm-docs-init.md +0 -27
  186. package/.opencode/commands/ckm-docs-llms.md +0 -12
  187. package/.opencode/commands/ckm-docs-summarize.md +0 -22
  188. package/.opencode/commands/ckm-docs-update.md +0 -36
  189. package/.opencode/commands/ckm-email-flow.md +0 -169
  190. package/.opencode/commands/ckm-email-sequence.md +0 -170
  191. package/.opencode/commands/ckm-email.md +0 -64
  192. package/.opencode/commands/ckm-funnel.md +0 -77
  193. package/.opencode/commands/ckm-hub.md +0 -50
  194. package/.opencode/commands/ckm-init.md +0 -214
  195. package/.opencode/commands/ckm-journal.md +0 -18
  196. package/.opencode/commands/ckm-kanban.md +0 -65
  197. package/.opencode/commands/ckm-persona.md +0 -61
  198. package/.opencode/commands/ckm-plan-archive.md +0 -56
  199. package/.opencode/commands/ckm-plan-ci.md +0 -32
  200. package/.opencode/commands/ckm-plan-cro.md +0 -68
  201. package/.opencode/commands/ckm-plan-fast.md +0 -65
  202. package/.opencode/commands/ckm-plan-hard.md +0 -91
  203. package/.opencode/commands/ckm-plan-parallel.md +0 -128
  204. package/.opencode/commands/ckm-plan-two.md +0 -44
  205. package/.opencode/commands/ckm-plan-validate.md +0 -116
  206. package/.opencode/commands/ckm-plan.md +0 -29
  207. package/.opencode/commands/ckm-play-create.md +0 -15
  208. package/.opencode/commands/ckm-play-goals.md +0 -15
  209. package/.opencode/commands/ckm-play-next.md +0 -15
  210. package/.opencode/commands/ckm-play-status.md +0 -15
  211. package/.opencode/commands/ckm-play.md +0 -27
  212. package/.opencode/commands/ckm-preview.md +0 -83
  213. package/.opencode/commands/ckm-seo-audit.md +0 -125
  214. package/.opencode/commands/ckm-seo-keywords.md +0 -135
  215. package/.opencode/commands/ckm-seo-pseo.md +0 -66
  216. package/.opencode/commands/ckm-seo.md +0 -67
  217. package/.opencode/commands/ckm-skill-add.md +0 -41
  218. package/.opencode/commands/ckm-skill-create.md +0 -34
  219. package/.opencode/commands/ckm-skill-fix-logs.md +0 -28
  220. package/.opencode/commands/ckm-skill-optimize-auto.md +0 -30
  221. package/.opencode/commands/ckm-skill-optimize.md +0 -39
  222. package/.opencode/commands/ckm-skill-plan.md +0 -50
  223. package/.opencode/commands/ckm-skill-update.md +0 -35
  224. package/.opencode/commands/ckm-slides-create.md +0 -8
  225. package/.opencode/commands/ckm-social-schedule.md +0 -54
  226. package/.opencode/commands/ckm-social.md +0 -69
  227. package/.opencode/commands/ckm-storage-list.md +0 -90
  228. package/.opencode/commands/ckm-storage-sync.md +0 -92
  229. package/.opencode/commands/ckm-storage-upload.md +0 -80
  230. package/.opencode/commands/ckm-storage-url.md +0 -66
  231. package/.opencode/commands/ckm-test-ui.md +0 -91
  232. package/.opencode/commands/ckm-test-workflow.md +0 -106
  233. package/.opencode/commands/ckm-use-mcp.md +0 -34
  234. package/.opencode/commands/ckm-video-create.md +0 -326
  235. package/.opencode/commands/ckm-video-script-create.md +0 -395
  236. package/.opencode/commands/ckm-video-storyboard-create.md +0 -214
  237. package/.opencode/commands/ckm-watzup.md +0 -9
  238. package/.opencode/commands/ckm-worktree.md +0 -125
  239. package/.opencode/commands/ckm-write-audit.md +0 -97
  240. package/.opencode/commands/ckm-write-blog-youtube.md +0 -158
  241. package/.opencode/commands/ckm-write-blog.md +0 -85
  242. package/.opencode/commands/ckm-write-cro.md +0 -42
  243. package/.opencode/commands/ckm-write-enhance.md +0 -13
  244. package/.opencode/commands/ckm-write-fast.md +0 -12
  245. package/.opencode/commands/ckm-write-formula.md +0 -116
  246. package/.opencode/commands/ckm-write-good.md +0 -16
  247. package/.opencode/commands/ckm-write-publish.md +0 -74
  248. package/.opencode/commands/ckm-youtube-blog.md +0 -136
  249. package/.opencode/commands/ckm-youtube-infographic.md +0 -156
  250. package/.opencode/commands/ckm-youtube-social.md +0 -169
  251. package/.opencode/package.json +0 -8
  252. package/.opencode/plugin/context-injector.ts +0 -84
  253. package/.opencode/plugin/lib/ck-config-utils.cjs +0 -816
  254. package/.opencode/plugin/lib/colors.cjs +0 -95
  255. package/.opencode/plugin/lib/context-builder.cjs +0 -600
  256. package/.opencode/plugin/lib/privacy-checker.cjs +0 -297
  257. package/.opencode/plugin/lib/project-detector.cjs +0 -430
  258. package/.opencode/plugin/lib/scout-checker.cjs +0 -172
  259. package/.opencode/plugin/privacy-block.ts +0 -32
  260. package/.opencode/plugin/scout-block/broad-pattern-detector.cjs +0 -266
  261. package/.opencode/plugin/scout-block/error-formatter.cjs +0 -156
  262. package/.opencode/plugin/scout-block/path-extractor.cjs +0 -238
  263. package/.opencode/plugin/scout-block/pattern-matcher.cjs +0 -184
  264. package/.opencode/plugin/scout-block/vendor/ignore.cjs +0 -627
  265. package/.opencode/plugin/scout-block.ts +0 -40
  266. package/.opencode/scripts/README.md +0 -153
  267. package/.opencode/scripts/ck-help.py +0 -1164
  268. package/.opencode/scripts/commands_data.yaml +0 -363
  269. package/.opencode/scripts/fix-shebang-permissions.sh +0 -50
  270. package/.opencode/scripts/requirements.txt +0 -1
  271. package/.opencode/scripts/resolve_env.py +0 -329
  272. package/.opencode/scripts/scan_commands.py +0 -98
  273. package/.opencode/scripts/scan_skills.py +0 -186
  274. package/.opencode/scripts/set-active-plan.cjs +0 -50
  275. package/.opencode/scripts/skills_data.yaml +0 -370
  276. package/.opencode/scripts/test-ck-help.py +0 -218
  277. package/.opencode/scripts/validate-docs.cjs +0 -342
  278. package/.opencode/scripts/win_compat.py +0 -57
  279. package/.opencode/scripts/worktree.cjs +0 -822
  280. package/.opencode/scripts/worktree.test.cjs +0 -759
  281. package/.opencode/skills/ab-test-setup/SKILL.md +0 -512
  282. package/.opencode/skills/ads-management/SKILL.md +0 -134
  283. package/.opencode/skills/ads-management/references/ad-copy-templates.md +0 -82
  284. package/.opencode/skills/ads-management/references/audience-targeting.md +0 -97
  285. package/.opencode/skills/ads-management/references/campaign-setup-and-bidding.md +0 -88
  286. package/.opencode/skills/ads-management/references/competitor-analysis-and-tools.md +0 -67
  287. package/.opencode/skills/ads-management/references/creative-asset-generation.md +0 -110
  288. package/.opencode/skills/ads-management/references/measurement-and-attribution.md +0 -63
  289. package/.opencode/skills/ads-management/references/optimization-playbook.md +0 -83
  290. package/.opencode/skills/ads-management/references/platform-specs.md +0 -64
  291. package/.opencode/skills/ads-management/scripts/.env.example +0 -13
  292. package/.opencode/skills/ads-management/scripts/google-ads-manager.py +0 -294
  293. package/.opencode/skills/ads-management/scripts/meta-ads-manager.py +0 -360
  294. package/.opencode/skills/affiliate-marketing/SKILL.md +0 -96
  295. package/.opencode/skills/affiliate-marketing/references/case-studies.md +0 -66
  296. package/.opencode/skills/affiliate-marketing/references/compliance-legal.md +0 -78
  297. package/.opencode/skills/affiliate-marketing/references/fraud-prevention.md +0 -81
  298. package/.opencode/skills/affiliate-marketing/references/kol-koc-partnerships.md +0 -86
  299. package/.opencode/skills/affiliate-marketing/references/outreach-templates.md +0 -72
  300. package/.opencode/skills/affiliate-marketing/references/platform-selection.md +0 -82
  301. package/.opencode/skills/affiliate-marketing/references/program-structure.md +0 -74
  302. package/.opencode/skills/agent-browser/SKILL.md +0 -297
  303. package/.opencode/skills/agent-browser/references/.gitkeep +0 -0
  304. package/.opencode/skills/agent-browser/references/agent-browser-vs-chrome-devtools.md +0 -112
  305. package/.opencode/skills/agent-browser/references/browserbase-cloud-setup.md +0 -161
  306. package/.opencode/skills/ai-artist/SKILL.md +0 -122
  307. package/.opencode/skills/ai-artist/data/awesome-prompts.csv +0 -3592
  308. package/.opencode/skills/ai-artist/data/domains.csv +0 -16
  309. package/.opencode/skills/ai-artist/data/image-styles.csv +0 -21
  310. package/.opencode/skills/ai-artist/data/lighting.csv +0 -19
  311. package/.opencode/skills/ai-artist/data/llm-patterns.csv +0 -17
  312. package/.opencode/skills/ai-artist/data/nano-banana-templates.csv +0 -17
  313. package/.opencode/skills/ai-artist/data/platforms.csv +0 -11
  314. package/.opencode/skills/ai-artist/data/quality-modifiers.csv +0 -26
  315. package/.opencode/skills/ai-artist/data/styles.csv +0 -26
  316. package/.opencode/skills/ai-artist/data/subjects.csv +0 -17
  317. package/.opencode/skills/ai-artist/data/techniques.csv +0 -19
  318. package/.opencode/skills/ai-artist/data/use-cases.csv +0 -16
  319. package/.opencode/skills/ai-artist/references/advanced-techniques.md +0 -184
  320. package/.opencode/skills/ai-artist/references/awesome-nano-banana-pro-prompts.md +0 -8575
  321. package/.opencode/skills/ai-artist/references/character-consistency.md +0 -160
  322. package/.opencode/skills/ai-artist/references/domain-code.md +0 -66
  323. package/.opencode/skills/ai-artist/references/domain-data.md +0 -72
  324. package/.opencode/skills/ai-artist/references/domain-marketing.md +0 -66
  325. package/.opencode/skills/ai-artist/references/domain-patterns.md +0 -33
  326. package/.opencode/skills/ai-artist/references/domain-writing.md +0 -68
  327. package/.opencode/skills/ai-artist/references/image-generation-workflow.md +0 -124
  328. package/.opencode/skills/ai-artist/references/image-prompting.md +0 -141
  329. package/.opencode/skills/ai-artist/references/llm-prompting.md +0 -165
  330. package/.opencode/skills/ai-artist/references/nano-banana-pro-examples.md +0 -132
  331. package/.opencode/skills/ai-artist/references/nano-banana.md +0 -59
  332. package/.opencode/skills/ai-artist/references/reasoning-techniques.md +0 -201
  333. package/.opencode/skills/ai-artist/references/validation-workflow.md +0 -117
  334. package/.opencode/skills/ai-artist/scripts/core.py +0 -201
  335. package/.opencode/skills/ai-artist/scripts/extract_prompts.py +0 -102
  336. package/.opencode/skills/ai-artist/scripts/generate.py +0 -371
  337. package/.opencode/skills/ai-artist/scripts/prompt_builder.py +0 -234
  338. package/.opencode/skills/ai-artist/scripts/search.py +0 -111
  339. package/.opencode/skills/ai-multimodal/.env.example +0 -230
  340. package/.opencode/skills/ai-multimodal/SKILL.md +0 -108
  341. package/.opencode/skills/ai-multimodal/assets/demo-minimax/minimax-music-midnight-glow.mp3 +0 -0
  342. package/.opencode/skills/ai-multimodal/assets/demo-minimax/minimax-speech-demo.mp3 +0 -0
  343. package/.opencode/skills/ai-multimodal/assets/demo-minimax/minimax-speech-vietnamese.mp3 +0 -0
  344. package/.opencode/skills/ai-multimodal/assets/demo-minimax/minimax-video-kitsune.mp4 +0 -0
  345. package/.opencode/skills/ai-multimodal/references/audio-processing.md +0 -387
  346. package/.opencode/skills/ai-multimodal/references/image-generation.md +0 -1002
  347. package/.opencode/skills/ai-multimodal/references/minimax-generation.md +0 -141
  348. package/.opencode/skills/ai-multimodal/references/music-generation.md +0 -311
  349. package/.opencode/skills/ai-multimodal/references/video-analysis.md +0 -515
  350. package/.opencode/skills/ai-multimodal/references/video-generation.md +0 -457
  351. package/.opencode/skills/ai-multimodal/references/vision-understanding.md +0 -492
  352. package/.opencode/skills/ai-multimodal/scripts/.coverage +0 -0
  353. package/.opencode/skills/ai-multimodal/scripts/check_setup.py +0 -316
  354. package/.opencode/skills/ai-multimodal/scripts/document_converter.py +0 -395
  355. package/.opencode/skills/ai-multimodal/scripts/gemini_batch_process.py +0 -1187
  356. package/.opencode/skills/ai-multimodal/scripts/media_optimizer.py +0 -506
  357. package/.opencode/skills/ai-multimodal/scripts/minimax_api_client.py +0 -189
  358. package/.opencode/skills/ai-multimodal/scripts/minimax_cli.py +0 -178
  359. package/.opencode/skills/ai-multimodal/scripts/minimax_generate.py +0 -278
  360. package/.opencode/skills/ai-multimodal/scripts/requirements.txt +0 -26
  361. package/.opencode/skills/analytics/SKILL.md +0 -132
  362. package/.opencode/skills/analytics/package.json +0 -19
  363. package/.opencode/skills/analytics/references/analysis-workflows.md +0 -104
  364. package/.opencode/skills/analytics/references/attribution-models.md +0 -75
  365. package/.opencode/skills/analytics/references/ga-admin-api.md +0 -219
  366. package/.opencode/skills/analytics/references/ga-data-api.md +0 -344
  367. package/.opencode/skills/analytics/references/marketing-kpis.md +0 -63
  368. package/.opencode/skills/analytics/references/report-templates.md +0 -411
  369. package/.opencode/skills/analytics/scripts/ga-auth-setup.cjs +0 -283
  370. package/.opencode/skills/analytics/scripts/ga-config-loader.cjs +0 -320
  371. package/.opencode/skills/analytics/scripts/ga-list-accounts.cjs +0 -277
  372. package/.opencode/skills/analytics/scripts/ga-run-report.cjs +0 -334
  373. package/.opencode/skills/analyze/SKILL.md +0 -80
  374. package/.opencode/skills/analyze/references/report.md +0 -62
  375. package/.opencode/skills/ask/SKILL.md +0 -60
  376. package/.opencode/skills/assets-organizing/SKILL.md +0 -164
  377. package/.opencode/skills/assets-organizing/references/asset-types.md +0 -1478
  378. package/.opencode/skills/assets-organizing/references/directory-structure.md +0 -178
  379. package/.opencode/skills/assets-organizing/references/naming-conventions.md +0 -85
  380. package/.opencode/skills/backend-development/SKILL.md +0 -98
  381. package/.opencode/skills/backend-development/references/backend-api-design.md +0 -495
  382. package/.opencode/skills/backend-development/references/backend-architecture.md +0 -454
  383. package/.opencode/skills/backend-development/references/backend-authentication.md +0 -338
  384. package/.opencode/skills/backend-development/references/backend-code-quality.md +0 -659
  385. package/.opencode/skills/backend-development/references/backend-debugging.md +0 -904
  386. package/.opencode/skills/backend-development/references/backend-devops.md +0 -494
  387. package/.opencode/skills/backend-development/references/backend-mindset.md +0 -387
  388. package/.opencode/skills/backend-development/references/backend-performance.md +0 -397
  389. package/.opencode/skills/backend-development/references/backend-security.md +0 -290
  390. package/.opencode/skills/backend-development/references/backend-technologies.md +0 -256
  391. package/.opencode/skills/backend-development/references/backend-testing.md +0 -429
  392. package/.opencode/skills/banner-design/SKILL.md +0 -192
  393. package/.opencode/skills/banner-design/references/banner-sizes-and-styles.md +0 -118
  394. package/.opencode/skills/better-auth/SKILL.md +0 -207
  395. package/.opencode/skills/better-auth/references/advanced-features.md +0 -553
  396. package/.opencode/skills/better-auth/references/database-integration.md +0 -577
  397. package/.opencode/skills/better-auth/references/email-password-auth.md +0 -416
  398. package/.opencode/skills/better-auth/references/oauth-providers.md +0 -430
  399. package/.opencode/skills/better-auth/scripts/.coverage +0 -0
  400. package/.opencode/skills/better-auth/scripts/better_auth_init.py +0 -521
  401. package/.opencode/skills/better-auth/scripts/requirements.txt +0 -15
  402. package/.opencode/skills/bootstrap/SKILL.md +0 -105
  403. package/.opencode/skills/bootstrap/references/shared-phases.md +0 -59
  404. package/.opencode/skills/bootstrap/references/workflow-auto.md +0 -52
  405. package/.opencode/skills/bootstrap/references/workflow-fast.md +0 -50
  406. package/.opencode/skills/bootstrap/references/workflow-full.md +0 -60
  407. package/.opencode/skills/bootstrap/references/workflow-parallel.md +0 -59
  408. package/.opencode/skills/brainstorm/SKILL.md +0 -79
  409. package/.opencode/skills/brand/SKILL.md +0 -97
  410. package/.opencode/skills/brand/references/approval-checklist.md +0 -169
  411. package/.opencode/skills/brand/references/asset-organization.md +0 -157
  412. package/.opencode/skills/brand/references/brand-guideline-template.md +0 -140
  413. package/.opencode/skills/brand/references/color-palette-management.md +0 -186
  414. package/.opencode/skills/brand/references/consistency-checklist.md +0 -94
  415. package/.opencode/skills/brand/references/logo-usage-rules.md +0 -185
  416. package/.opencode/skills/brand/references/messaging-framework.md +0 -85
  417. package/.opencode/skills/brand/references/typography-specifications.md +0 -214
  418. package/.opencode/skills/brand/references/update.md +0 -118
  419. package/.opencode/skills/brand/references/visual-identity.md +0 -96
  420. package/.opencode/skills/brand/references/voice-framework.md +0 -88
  421. package/.opencode/skills/brand/scripts/extract-colors.cjs +0 -341
  422. package/.opencode/skills/brand/scripts/inject-brand-context.cjs +0 -349
  423. package/.opencode/skills/brand/scripts/sync-brand-to-tokens.cjs +0 -266
  424. package/.opencode/skills/brand/scripts/validate-asset.cjs +0 -387
  425. package/.opencode/skills/brand/templates/brand-guidelines-starter.md +0 -275
  426. package/.opencode/skills/campaign/SKILL.md +0 -73
  427. package/.opencode/skills/campaign/references/analyze.md +0 -50
  428. package/.opencode/skills/campaign/references/budget-allocation.md +0 -85
  429. package/.opencode/skills/campaign/references/campaign-brief.md +0 -79
  430. package/.opencode/skills/campaign/references/create.md +0 -211
  431. package/.opencode/skills/campaign/references/email.md +0 -59
  432. package/.opencode/skills/campaign/references/launch-checklist.md +0 -70
  433. package/.opencode/skills/campaign/references/optimization-framework.md +0 -103
  434. package/.opencode/skills/campaign/references/status.md +0 -34
  435. package/.opencode/skills/chrome-devtools/SKILL.md +0 -475
  436. package/.opencode/skills/chrome-devtools/references/cdp-domains.md +0 -694
  437. package/.opencode/skills/chrome-devtools/references/performance-guide.md +0 -940
  438. package/.opencode/skills/chrome-devtools/references/puppeteer-reference.md +0 -953
  439. package/.opencode/skills/chrome-devtools/scripts/README.md +0 -272
  440. package/.opencode/skills/chrome-devtools/scripts/__tests__/error-handling.test.js +0 -102
  441. package/.opencode/skills/chrome-devtools/scripts/__tests__/selector.test.js +0 -210
  442. package/.opencode/skills/chrome-devtools/scripts/aria-snapshot.js +0 -362
  443. package/.opencode/skills/chrome-devtools/scripts/click.js +0 -83
  444. package/.opencode/skills/chrome-devtools/scripts/connect-chrome.js +0 -146
  445. package/.opencode/skills/chrome-devtools/scripts/console.js +0 -79
  446. package/.opencode/skills/chrome-devtools/scripts/evaluate.js +0 -53
  447. package/.opencode/skills/chrome-devtools/scripts/fill.js +0 -76
  448. package/.opencode/skills/chrome-devtools/scripts/import-cookies.js +0 -205
  449. package/.opencode/skills/chrome-devtools/scripts/inject-auth.js +0 -229
  450. package/.opencode/skills/chrome-devtools/scripts/install-deps.sh +0 -181
  451. package/.opencode/skills/chrome-devtools/scripts/install.sh +0 -83
  452. package/.opencode/skills/chrome-devtools/scripts/lib/browser.js +0 -318
  453. package/.opencode/skills/chrome-devtools/scripts/lib/selector.js +0 -178
  454. package/.opencode/skills/chrome-devtools/scripts/navigate.js +0 -54
  455. package/.opencode/skills/chrome-devtools/scripts/network.js +0 -106
  456. package/.opencode/skills/chrome-devtools/scripts/package.json +0 -16
  457. package/.opencode/skills/chrome-devtools/scripts/performance.js +0 -149
  458. package/.opencode/skills/chrome-devtools/scripts/screenshot.js +0 -198
  459. package/.opencode/skills/chrome-devtools/scripts/select-ref.js +0 -131
  460. package/.opencode/skills/chrome-devtools/scripts/snapshot.js +0 -135
  461. package/.opencode/skills/chrome-devtools/scripts/ws-debug.js +0 -44
  462. package/.opencode/skills/chrome-devtools/scripts/ws-full-debug.js +0 -107
  463. package/.opencode/skills/cip-design/.env.example +0 -6
  464. package/.opencode/skills/cip-design/SKILL.md +0 -161
  465. package/.opencode/skills/cip-design/data/deliverables.csv +0 -51
  466. package/.opencode/skills/cip-design/data/industries.csv +0 -21
  467. package/.opencode/skills/cip-design/data/mockup-contexts.csv +0 -21
  468. package/.opencode/skills/cip-design/data/styles.csv +0 -21
  469. package/.opencode/skills/cip-design/references/deliverable-guide.md +0 -95
  470. package/.opencode/skills/cip-design/references/prompt-engineering.md +0 -84
  471. package/.opencode/skills/cip-design/references/style-guide.md +0 -68
  472. package/.opencode/skills/cip-design/scripts/core.py +0 -215
  473. package/.opencode/skills/cip-design/scripts/generate.py +0 -488
  474. package/.opencode/skills/cip-design/scripts/render-html.py +0 -424
  475. package/.opencode/skills/cip-design/scripts/search.py +0 -127
  476. package/.opencode/skills/ck-autoresearch/SKILL.md +0 -153
  477. package/.opencode/skills/ck-autoresearch/references/autonomous-loop-protocol.md +0 -193
  478. package/.opencode/skills/ck-autoresearch/references/git-memory-pattern.md +0 -109
  479. package/.opencode/skills/ck-autoresearch/references/guard-and-noise.md +0 -140
  480. package/.opencode/skills/ck-autoresearch/references/metric-library.md +0 -200
  481. package/.opencode/skills/ck-autoresearch/references/results-logging.md +0 -74
  482. package/.opencode/skills/ck-debug/SKILL.md +0 -123
  483. package/.opencode/skills/ck-debug/references/defense-in-depth.md +0 -124
  484. package/.opencode/skills/ck-debug/references/frontend-verification.md +0 -103
  485. package/.opencode/skills/ck-debug/references/investigation-methodology.md +0 -101
  486. package/.opencode/skills/ck-debug/references/log-and-ci-analysis.md +0 -97
  487. package/.opencode/skills/ck-debug/references/performance-diagnostics.md +0 -113
  488. package/.opencode/skills/ck-debug/references/reporting-standards.md +0 -122
  489. package/.opencode/skills/ck-debug/references/root-cause-tracing.md +0 -122
  490. package/.opencode/skills/ck-debug/references/systematic-debugging.md +0 -102
  491. package/.opencode/skills/ck-debug/references/task-management-debugging.md +0 -155
  492. package/.opencode/skills/ck-debug/references/verification.md +0 -123
  493. package/.opencode/skills/ck-debug/scripts/find-polluter.sh +0 -63
  494. package/.opencode/skills/ck-debug/scripts/find-polluter.test.md +0 -102
  495. package/.opencode/skills/ck-loop/SKILL.md +0 -149
  496. package/.opencode/skills/ck-loop/references/autonomous-loop-protocol.md +0 -193
  497. package/.opencode/skills/ck-loop/references/git-memory-pattern.md +0 -109
  498. package/.opencode/skills/ck-loop/references/guard-and-noise.md +0 -140
  499. package/.opencode/skills/ck-loop/references/metric-library.md +0 -200
  500. package/.opencode/skills/ck-loop/references/results-logging.md +0 -74
  501. package/.opencode/skills/ck-plan/SKILL.md +0 -198
  502. package/.opencode/skills/ck-plan/references/archive-workflow.md +0 -53
  503. package/.opencode/skills/ck-plan/references/codebase-understanding.md +0 -62
  504. package/.opencode/skills/ck-plan/references/output-standards.md +0 -145
  505. package/.opencode/skills/ck-plan/references/plan-organization.md +0 -183
  506. package/.opencode/skills/ck-plan/references/red-team-personas.md +0 -69
  507. package/.opencode/skills/ck-plan/references/red-team-workflow.md +0 -77
  508. package/.opencode/skills/ck-plan/references/research-phase.md +0 -49
  509. package/.opencode/skills/ck-plan/references/scope-challenge.md +0 -90
  510. package/.opencode/skills/ck-plan/references/solution-design.md +0 -63
  511. package/.opencode/skills/ck-plan/references/task-management.md +0 -134
  512. package/.opencode/skills/ck-plan/references/validate-question-framework.md +0 -80
  513. package/.opencode/skills/ck-plan/references/validate-workflow.md +0 -65
  514. package/.opencode/skills/ck-plan/references/workflow-modes.md +0 -155
  515. package/.opencode/skills/ck-predict/SKILL.md +0 -119
  516. package/.opencode/skills/ck-scenario/SKILL.md +0 -113
  517. package/.opencode/skills/ck-security/SKILL.md +0 -144
  518. package/.opencode/skills/ck-security/references/stride-owasp-checklist.md +0 -128
  519. package/.opencode/skills/ckm-storage/SKILL.md +0 -23
  520. package/.opencode/skills/ckm-storage/references/list.md +0 -87
  521. package/.opencode/skills/ckm-storage/references/sync.md +0 -89
  522. package/.opencode/skills/ckm-storage/references/upload.md +0 -77
  523. package/.opencode/skills/ckm-storage/references/url.md +0 -63
  524. package/.opencode/skills/claude-code/SKILL.md +0 -64
  525. package/.opencode/skills/claude-code/references/advanced-features.md +0 -399
  526. package/.opencode/skills/claude-code/references/agent-skills.md +0 -399
  527. package/.opencode/skills/claude-code/references/api-reference.md +0 -498
  528. package/.opencode/skills/claude-code/references/best-practices.md +0 -447
  529. package/.opencode/skills/claude-code/references/cicd-integration.md +0 -428
  530. package/.opencode/skills/claude-code/references/common-workflows.md +0 -119
  531. package/.opencode/skills/claude-code/references/configuration.md +0 -480
  532. package/.opencode/skills/claude-code/references/enterprise-features.md +0 -472
  533. package/.opencode/skills/claude-code/references/getting-started.md +0 -252
  534. package/.opencode/skills/claude-code/references/hooks-and-plugins.md +0 -444
  535. package/.opencode/skills/claude-code/references/hooks-comprehensive.md +0 -622
  536. package/.opencode/skills/claude-code/references/ide-integration.md +0 -316
  537. package/.opencode/skills/claude-code/references/mcp-integration.md +0 -386
  538. package/.opencode/skills/claude-code/references/slash-commands.md +0 -489
  539. package/.opencode/skills/claude-code/references/troubleshooting.md +0 -456
  540. package/.opencode/skills/code-review/SKILL.md +0 -147
  541. package/.opencode/skills/code-review/references/adversarial-review.md +0 -223
  542. package/.opencode/skills/code-review/references/checklist-workflow.md +0 -100
  543. package/.opencode/skills/code-review/references/checklists/api.md +0 -52
  544. package/.opencode/skills/code-review/references/checklists/base.md +0 -100
  545. package/.opencode/skills/code-review/references/checklists/web-app.md +0 -54
  546. package/.opencode/skills/code-review/references/code-review-reception.md +0 -209
  547. package/.opencode/skills/code-review/references/codebase-scan-workflow.md +0 -30
  548. package/.opencode/skills/code-review/references/edge-case-scouting.md +0 -119
  549. package/.opencode/skills/code-review/references/input-mode-resolution.md +0 -135
  550. package/.opencode/skills/code-review/references/parallel-review-workflow.md +0 -76
  551. package/.opencode/skills/code-review/references/requesting-code-review.md +0 -105
  552. package/.opencode/skills/code-review/references/spec-compliance-review.md +0 -43
  553. package/.opencode/skills/code-review/references/task-management-reviews.md +0 -155
  554. package/.opencode/skills/code-review/references/verification-before-completion.md +0 -139
  555. package/.opencode/skills/coding-level/SKILL.md +0 -59
  556. package/.opencode/skills/competitor/SKILL.md +0 -95
  557. package/.opencode/skills/competitor/references/alternatives.md +0 -245
  558. package/.opencode/skills/content-hub/SKILL.md +0 -83
  559. package/.opencode/skills/content-hub/assets/hub.css +0 -693
  560. package/.opencode/skills/content-hub/assets/hub.js +0 -514
  561. package/.opencode/skills/content-hub/assets/template.html +0 -185
  562. package/.opencode/skills/content-hub/scripts/lib/ai-bridge.cjs +0 -165
  563. package/.opencode/skills/content-hub/scripts/lib/brand-context.cjs +0 -118
  564. package/.opencode/skills/content-hub/scripts/lib/port-finder.cjs +0 -43
  565. package/.opencode/skills/content-hub/scripts/lib/process-mgr.cjs +0 -102
  566. package/.opencode/skills/content-hub/scripts/lib/router.cjs +0 -276
  567. package/.opencode/skills/content-hub/scripts/lib/scanner.cjs +0 -278
  568. package/.opencode/skills/content-hub/scripts/server.cjs +0 -140
  569. package/.opencode/skills/content-hub/scripts/start-all.sh +0 -58
  570. package/.opencode/skills/content-marketing/SKILL.md +0 -87
  571. package/.opencode/skills/content-marketing/references/blog-post-templates.md +0 -108
  572. package/.opencode/skills/content-marketing/references/content-audit-checklist.md +0 -76
  573. package/.opencode/skills/content-marketing/references/content-strategy-framework.md +0 -72
  574. package/.opencode/skills/content-marketing/references/editorial-calendar-template.md +0 -59
  575. package/.opencode/skills/context-engineering/SKILL.md +0 -110
  576. package/.opencode/skills/context-engineering/references/context-compression.md +0 -84
  577. package/.opencode/skills/context-engineering/references/context-degradation.md +0 -93
  578. package/.opencode/skills/context-engineering/references/context-fundamentals.md +0 -75
  579. package/.opencode/skills/context-engineering/references/context-optimization.md +0 -82
  580. package/.opencode/skills/context-engineering/references/evaluation.md +0 -89
  581. package/.opencode/skills/context-engineering/references/memory-systems.md +0 -88
  582. package/.opencode/skills/context-engineering/references/multi-agent-patterns.md +0 -90
  583. package/.opencode/skills/context-engineering/references/project-development.md +0 -97
  584. package/.opencode/skills/context-engineering/references/runtime-awareness.md +0 -202
  585. package/.opencode/skills/context-engineering/references/tool-design.md +0 -86
  586. package/.opencode/skills/context-engineering/scripts/compression_evaluator.py +0 -349
  587. package/.opencode/skills/context-engineering/scripts/context_analyzer.py +0 -317
  588. package/.opencode/skills/cook/README.md +0 -86
  589. package/.opencode/skills/cook/SKILL.md +0 -115
  590. package/.opencode/skills/cook/references/intent-detection.md +0 -101
  591. package/.opencode/skills/cook/references/review-cycle.md +0 -75
  592. package/.opencode/skills/cook/references/subagent-patterns.md +0 -75
  593. package/.opencode/skills/cook/references/workflow-steps.md +0 -166
  594. package/.opencode/skills/copywriting/SKILL.md +0 -88
  595. package/.opencode/skills/copywriting/references/copy-formulas.md +0 -150
  596. package/.opencode/skills/copywriting/references/cta-patterns.md +0 -168
  597. package/.opencode/skills/copywriting/references/email-copy.md +0 -193
  598. package/.opencode/skills/copywriting/references/headline-templates.md +0 -140
  599. package/.opencode/skills/copywriting/references/landing-page-copy.md +0 -175
  600. package/.opencode/skills/copywriting/references/power-words.md +0 -189
  601. package/.opencode/skills/copywriting/references/social-media-copy.md +0 -222
  602. package/.opencode/skills/copywriting/references/workflow-cro.md +0 -83
  603. package/.opencode/skills/copywriting/references/workflow-enhance.md +0 -32
  604. package/.opencode/skills/copywriting/references/workflow-fast.md +0 -29
  605. package/.opencode/skills/copywriting/references/workflow-good.md +0 -39
  606. package/.opencode/skills/copywriting/references/writing-styles.md +0 -247
  607. package/.opencode/skills/copywriting/scripts/extract-writing-styles.py +0 -308
  608. package/.opencode/skills/copywriting/templates/copy-brief.md +0 -49
  609. package/.opencode/skills/creativity/SKILL.md +0 -189
  610. package/.opencode/skills/creativity/data/creative-reasoning.csv +0 -31
  611. package/.opencode/skills/creativity/data/music.csv +0 -18
  612. package/.opencode/skills/creativity/data/platforms.csv +0 -19
  613. package/.opencode/skills/creativity/data/styles.csv +0 -56
  614. package/.opencode/skills/creativity/data/voiceover.csv +0 -13
  615. package/.opencode/skills/creativity/references/audio-music.md +0 -74
  616. package/.opencode/skills/creativity/references/color-psychology.md +0 -68
  617. package/.opencode/skills/creativity/references/creative-styles-part1.md +0 -31
  618. package/.opencode/skills/creativity/references/creative-styles-part2.md +0 -36
  619. package/.opencode/skills/creativity/references/visual-trends.md +0 -84
  620. package/.opencode/skills/creativity/references/voiceover-styles.md +0 -107
  621. package/.opencode/skills/creativity/scripts/core.py +0 -179
  622. package/.opencode/skills/creativity/scripts/creative_brief.py +0 -470
  623. package/.opencode/skills/creativity/scripts/search.py +0 -62
  624. package/.opencode/skills/dashboard/SKILL.md +0 -108
  625. package/.opencode/skills/dashboard/references/check.md +0 -93
  626. package/.opencode/skills/databases/SKILL.md +0 -236
  627. package/.opencode/skills/databases/analytics.md +0 -198
  628. package/.opencode/skills/databases/db-design.md +0 -188
  629. package/.opencode/skills/databases/incremental-etl.md +0 -213
  630. package/.opencode/skills/databases/references/mongodb-aggregation.md +0 -447
  631. package/.opencode/skills/databases/references/mongodb-atlas.md +0 -465
  632. package/.opencode/skills/databases/references/mongodb-crud.md +0 -408
  633. package/.opencode/skills/databases/references/mongodb-indexing.md +0 -442
  634. package/.opencode/skills/databases/references/postgresql-administration.md +0 -594
  635. package/.opencode/skills/databases/references/postgresql-performance.md +0 -527
  636. package/.opencode/skills/databases/references/postgresql-psql-cli.md +0 -467
  637. package/.opencode/skills/databases/references/postgresql-queries.md +0 -475
  638. package/.opencode/skills/databases/scripts/.coverage +0 -0
  639. package/.opencode/skills/databases/scripts/db_backup.py +0 -502
  640. package/.opencode/skills/databases/scripts/db_migrate.py +0 -425
  641. package/.opencode/skills/databases/scripts/db_performance_check.py +0 -456
  642. package/.opencode/skills/databases/scripts/requirements.txt +0 -20
  643. package/.opencode/skills/databases/stacks/bigquery.md +0 -231
  644. package/.opencode/skills/databases/stacks/d1_cloudflare.md +0 -137
  645. package/.opencode/skills/databases/stacks/mysql.md +0 -216
  646. package/.opencode/skills/databases/stacks/postgres.md +0 -235
  647. package/.opencode/skills/databases/stacks/sqlite.md +0 -244
  648. package/.opencode/skills/databases/transactional.md +0 -176
  649. package/.opencode/skills/debugging/SKILL.md +0 -87
  650. package/.opencode/skills/debugging/references/defense-in-depth.md +0 -124
  651. package/.opencode/skills/debugging/references/root-cause-tracing.md +0 -122
  652. package/.opencode/skills/debugging/references/systematic-debugging.md +0 -102
  653. package/.opencode/skills/debugging/references/verification.md +0 -123
  654. package/.opencode/skills/debugging/scripts/find-polluter.sh +0 -63
  655. package/.opencode/skills/debugging/scripts/find-polluter.test.md +0 -102
  656. package/.opencode/skills/deploy/SKILL.md +0 -157
  657. package/.opencode/skills/deploy/references/platform-config-templates.md +0 -35
  658. package/.opencode/skills/deploy/references/platforms/aws.md +0 -58
  659. package/.opencode/skills/deploy/references/platforms/cloudflare.md +0 -41
  660. package/.opencode/skills/deploy/references/platforms/coolify.md +0 -32
  661. package/.opencode/skills/deploy/references/platforms/digitalocean.md +0 -45
  662. package/.opencode/skills/deploy/references/platforms/dokploy.md +0 -29
  663. package/.opencode/skills/deploy/references/platforms/flyio.md +0 -54
  664. package/.opencode/skills/deploy/references/platforms/gcp.md +0 -45
  665. package/.opencode/skills/deploy/references/platforms/github-pages.md +0 -56
  666. package/.opencode/skills/deploy/references/platforms/heroku.md +0 -31
  667. package/.opencode/skills/deploy/references/platforms/netlify.md +0 -39
  668. package/.opencode/skills/deploy/references/platforms/railway.md +0 -38
  669. package/.opencode/skills/deploy/references/platforms/render.md +0 -39
  670. package/.opencode/skills/deploy/references/platforms/tose.md +0 -35
  671. package/.opencode/skills/deploy/references/platforms/vercel.md +0 -37
  672. package/.opencode/skills/deploy/references/platforms/vultr.md +0 -27
  673. package/.opencode/skills/design/SKILL.md +0 -302
  674. package/.opencode/skills/design/data/cip/deliverables.csv +0 -51
  675. package/.opencode/skills/design/data/cip/industries.csv +0 -21
  676. package/.opencode/skills/design/data/cip/mockup-contexts.csv +0 -21
  677. package/.opencode/skills/design/data/cip/styles.csv +0 -21
  678. package/.opencode/skills/design/data/icon/styles.csv +0 -16
  679. package/.opencode/skills/design/data/logo/colors.csv +0 -56
  680. package/.opencode/skills/design/data/logo/industries.csv +0 -56
  681. package/.opencode/skills/design/data/logo/styles.csv +0 -56
  682. package/.opencode/skills/design/references/banner-sizes-and-styles.md +0 -118
  683. package/.opencode/skills/design/references/cip-deliverable-guide.md +0 -95
  684. package/.opencode/skills/design/references/cip-design.md +0 -121
  685. package/.opencode/skills/design/references/cip-prompt-engineering.md +0 -84
  686. package/.opencode/skills/design/references/cip-style-guide.md +0 -68
  687. package/.opencode/skills/design/references/design-routing.md +0 -207
  688. package/.opencode/skills/design/references/icon-design.md +0 -122
  689. package/.opencode/skills/design/references/logo-color-psychology.md +0 -101
  690. package/.opencode/skills/design/references/logo-design.md +0 -92
  691. package/.opencode/skills/design/references/logo-prompt-engineering.md +0 -158
  692. package/.opencode/skills/design/references/logo-style-guide.md +0 -109
  693. package/.opencode/skills/design/references/slides-copywriting-formulas.md +0 -84
  694. package/.opencode/skills/design/references/slides-create.md +0 -4
  695. package/.opencode/skills/design/references/slides-html-template.md +0 -295
  696. package/.opencode/skills/design/references/slides-layout-patterns.md +0 -137
  697. package/.opencode/skills/design/references/slides-strategies.md +0 -94
  698. package/.opencode/skills/design/references/slides.md +0 -42
  699. package/.opencode/skills/design/references/social-photos-design.md +0 -329
  700. package/.opencode/skills/design/scripts/cip/core.py +0 -215
  701. package/.opencode/skills/design/scripts/cip/generate.py +0 -488
  702. package/.opencode/skills/design/scripts/cip/render-html.py +0 -424
  703. package/.opencode/skills/design/scripts/cip/search.py +0 -127
  704. package/.opencode/skills/design/scripts/icon/generate.py +0 -487
  705. package/.opencode/skills/design/scripts/logo/core.py +0 -175
  706. package/.opencode/skills/design/scripts/logo/generate.py +0 -363
  707. package/.opencode/skills/design/scripts/logo/search.py +0 -114
  708. package/.opencode/skills/design-system/SKILL.md +0 -244
  709. package/.opencode/skills/design-system/data/slide-backgrounds.csv +0 -11
  710. package/.opencode/skills/design-system/data/slide-charts.csv +0 -26
  711. package/.opencode/skills/design-system/data/slide-color-logic.csv +0 -14
  712. package/.opencode/skills/design-system/data/slide-copy.csv +0 -26
  713. package/.opencode/skills/design-system/data/slide-layout-logic.csv +0 -16
  714. package/.opencode/skills/design-system/data/slide-layouts.csv +0 -26
  715. package/.opencode/skills/design-system/data/slide-strategies.csv +0 -16
  716. package/.opencode/skills/design-system/data/slide-typography.csv +0 -15
  717. package/.opencode/skills/design-system/references/component-specs.md +0 -236
  718. package/.opencode/skills/design-system/references/component-tokens.md +0 -214
  719. package/.opencode/skills/design-system/references/primitive-tokens.md +0 -203
  720. package/.opencode/skills/design-system/references/semantic-tokens.md +0 -215
  721. package/.opencode/skills/design-system/references/states-and-variants.md +0 -241
  722. package/.opencode/skills/design-system/references/tailwind-integration.md +0 -251
  723. package/.opencode/skills/design-system/references/token-architecture.md +0 -224
  724. package/.opencode/skills/design-system/scripts/embed-tokens.cjs +0 -99
  725. package/.opencode/skills/design-system/scripts/fetch-background.py +0 -317
  726. package/.opencode/skills/design-system/scripts/generate-slide.py +0 -753
  727. package/.opencode/skills/design-system/scripts/generate-tokens.cjs +0 -205
  728. package/.opencode/skills/design-system/scripts/html-token-validator.py +0 -327
  729. package/.opencode/skills/design-system/scripts/search-slides.py +0 -218
  730. package/.opencode/skills/design-system/scripts/slide-token-validator.py +0 -35
  731. package/.opencode/skills/design-system/scripts/slide_search_core.py +0 -453
  732. package/.opencode/skills/design-system/scripts/validate-tokens.cjs +0 -251
  733. package/.opencode/skills/design-system/templates/design-tokens-starter.json +0 -143
  734. package/.opencode/skills/devops/.env.example +0 -76
  735. package/.opencode/skills/devops/SKILL.md +0 -288
  736. package/.opencode/skills/devops/references/browser-rendering.md +0 -305
  737. package/.opencode/skills/devops/references/cloudflare-d1-kv.md +0 -123
  738. package/.opencode/skills/devops/references/cloudflare-platform.md +0 -271
  739. package/.opencode/skills/devops/references/cloudflare-r2-storage.md +0 -280
  740. package/.opencode/skills/devops/references/cloudflare-workers-advanced.md +0 -312
  741. package/.opencode/skills/devops/references/cloudflare-workers-apis.md +0 -309
  742. package/.opencode/skills/devops/references/cloudflare-workers-basics.md +0 -418
  743. package/.opencode/skills/devops/references/docker-basics.md +0 -297
  744. package/.opencode/skills/devops/references/docker-compose.md +0 -292
  745. package/.opencode/skills/devops/references/gcloud-platform.md +0 -297
  746. package/.opencode/skills/devops/references/gcloud-services.md +0 -304
  747. package/.opencode/skills/devops/references/kubernetes-basics.md +0 -99
  748. package/.opencode/skills/devops/references/kubernetes-helm-advanced.md +0 -75
  749. package/.opencode/skills/devops/references/kubernetes-helm.md +0 -81
  750. package/.opencode/skills/devops/references/kubernetes-kubectl.md +0 -74
  751. package/.opencode/skills/devops/references/kubernetes-security-advanced.md +0 -98
  752. package/.opencode/skills/devops/references/kubernetes-security.md +0 -95
  753. package/.opencode/skills/devops/references/kubernetes-troubleshooting-advanced.md +0 -74
  754. package/.opencode/skills/devops/references/kubernetes-troubleshooting.md +0 -49
  755. package/.opencode/skills/devops/references/kubernetes-workflows-advanced.md +0 -75
  756. package/.opencode/skills/devops/references/kubernetes-workflows.md +0 -78
  757. package/.opencode/skills/devops/scripts/cloudflare_deploy.py +0 -269
  758. package/.opencode/skills/devops/scripts/docker_optimize.py +0 -331
  759. package/.opencode/skills/devops/scripts/requirements.txt +0 -20
  760. package/.opencode/skills/docs/SKILL.md +0 -23
  761. package/.opencode/skills/docs/references/init-workflow.md +0 -32
  762. package/.opencode/skills/docs/references/init.md +0 -23
  763. package/.opencode/skills/docs/references/llms.md +0 -8
  764. package/.opencode/skills/docs/references/summarize-workflow.md +0 -18
  765. package/.opencode/skills/docs/references/summarize.md +0 -18
  766. package/.opencode/skills/docs/references/update-workflow.md +0 -59
  767. package/.opencode/skills/docs/references/update.md +0 -32
  768. package/.opencode/skills/docs-seeker/.env.example +0 -15
  769. package/.opencode/skills/docs-seeker/SKILL.md +0 -100
  770. package/.opencode/skills/docs-seeker/package.json +0 -25
  771. package/.opencode/skills/docs-seeker/references/advanced.md +0 -79
  772. package/.opencode/skills/docs-seeker/references/context7-patterns.md +0 -68
  773. package/.opencode/skills/docs-seeker/references/errors.md +0 -68
  774. package/.opencode/skills/docs-seeker/scripts/analyze-llms-txt.js +0 -211
  775. package/.opencode/skills/docs-seeker/scripts/detect-topic.js +0 -172
  776. package/.opencode/skills/docs-seeker/scripts/fetch-docs.js +0 -213
  777. package/.opencode/skills/docs-seeker/scripts/utils/env-loader.js +0 -94
  778. package/.opencode/skills/docs-seeker/workflows/library-search.md +0 -87
  779. package/.opencode/skills/docs-seeker/workflows/repo-analysis.md +0 -91
  780. package/.opencode/skills/docs-seeker/workflows/topic-search.md +0 -77
  781. package/.opencode/skills/elevenlabs/.env.example +0 -3
  782. package/.opencode/skills/elevenlabs/README.md +0 -57
  783. package/.opencode/skills/elevenlabs/SKILL.md +0 -97
  784. package/.opencode/skills/elevenlabs/references/available-models.md +0 -720
  785. package/.opencode/skills/elevenlabs/references/conversational-ai-agents-guide.md +0 -168
  786. package/.opencode/skills/elevenlabs/references/sound-effects-and-music-generation-guide.md +0 -131
  787. package/.opencode/skills/elevenlabs/references/text-to-speech-guide.md +0 -132
  788. package/.opencode/skills/elevenlabs/references/voice-cloning-guide.md +0 -94
  789. package/.opencode/skills/elevenlabs/references/voice-design-prompting-guide.md +0 -96
  790. package/.opencode/skills/elevenlabs/requirements.txt +0 -1
  791. package/.opencode/skills/elevenlabs/scripts/elevenlabs-sound-effects-generator.py +0 -108
  792. package/.opencode/skills/elevenlabs/scripts/elevenlabs-text-to-speech-generator.py +0 -184
  793. package/.opencode/skills/elevenlabs/scripts/elevenlabs-voice-cloner.py +0 -127
  794. package/.opencode/skills/elevenlabs/scripts/elevenlabs-voice-manager.py +0 -194
  795. package/.opencode/skills/email/SKILL.md +0 -56
  796. package/.opencode/skills/email/references/automation-flows.md +0 -429
  797. package/.opencode/skills/email/references/deliverability-checklist.md +0 -73
  798. package/.opencode/skills/email/references/email-templates.md +0 -127
  799. package/.opencode/skills/email/references/flow.md +0 -165
  800. package/.opencode/skills/email/references/sequence.md +0 -166
  801. package/.opencode/skills/email/references/subject-line-formulas.md +0 -67
  802. package/.opencode/skills/find-skills/SKILL.md +0 -137
  803. package/.opencode/skills/fix/SKILL.md +0 -75
  804. package/.opencode/skills/fix/references/complexity-assessment.md +0 -61
  805. package/.opencode/skills/fix/references/diagnosis-protocol.md +0 -133
  806. package/.opencode/skills/fix/references/mode-selection.md +0 -46
  807. package/.opencode/skills/fix/references/parallel-exploration.md +0 -77
  808. package/.opencode/skills/fix/references/prevention-gate.md +0 -87
  809. package/.opencode/skills/fix/references/review-cycle.md +0 -77
  810. package/.opencode/skills/fix/references/skill-activation-matrix.md +0 -65
  811. package/.opencode/skills/fix/references/task-orchestration.md +0 -110
  812. package/.opencode/skills/fix/references/workflow-ci.md +0 -28
  813. package/.opencode/skills/fix/references/workflow-deep.md +0 -91
  814. package/.opencode/skills/fix/references/workflow-logs.md +0 -36
  815. package/.opencode/skills/fix/references/workflow-quick.md +0 -59
  816. package/.opencode/skills/fix/references/workflow-standard.md +0 -86
  817. package/.opencode/skills/fix/references/workflow-test.md +0 -36
  818. package/.opencode/skills/fix/references/workflow-types.md +0 -33
  819. package/.opencode/skills/fix/references/workflow-ui.md +0 -37
  820. package/.opencode/skills/form-cro/SKILL.md +0 -429
  821. package/.opencode/skills/free-tool-strategy/SKILL.md +0 -580
  822. package/.opencode/skills/frontend-design/SKILL.md +0 -81
  823. package/.opencode/skills/frontend-design/references/ai-multimodal-overview.md +0 -165
  824. package/.opencode/skills/frontend-design/references/analysis-best-practices.md +0 -80
  825. package/.opencode/skills/frontend-design/references/analysis-prompts.md +0 -141
  826. package/.opencode/skills/frontend-design/references/analysis-techniques.md +0 -118
  827. package/.opencode/skills/frontend-design/references/animejs.md +0 -396
  828. package/.opencode/skills/frontend-design/references/anti-slop-rules.md +0 -103
  829. package/.opencode/skills/frontend-design/references/asset-generation.md +0 -337
  830. package/.opencode/skills/frontend-design/references/bento-motion-engine.md +0 -142
  831. package/.opencode/skills/frontend-design/references/design-extraction-overview.md +0 -71
  832. package/.opencode/skills/frontend-design/references/extraction-best-practices.md +0 -141
  833. package/.opencode/skills/frontend-design/references/extraction-output-templates.md +0 -162
  834. package/.opencode/skills/frontend-design/references/extraction-prompts.md +0 -127
  835. package/.opencode/skills/frontend-design/references/magicui-components.md +0 -129
  836. package/.opencode/skills/frontend-design/references/performance-guardrails.md +0 -169
  837. package/.opencode/skills/frontend-design/references/premium-design-patterns.md +0 -93
  838. package/.opencode/skills/frontend-design/references/redesign-audit-checklist.md +0 -114
  839. package/.opencode/skills/frontend-design/references/technical-accessibility.md +0 -119
  840. package/.opencode/skills/frontend-design/references/technical-best-practices.md +0 -97
  841. package/.opencode/skills/frontend-design/references/technical-optimization.md +0 -44
  842. package/.opencode/skills/frontend-design/references/technical-overview.md +0 -90
  843. package/.opencode/skills/frontend-design/references/technical-workflows.md +0 -150
  844. package/.opencode/skills/frontend-design/references/visual-analysis-overview.md +0 -95
  845. package/.opencode/skills/frontend-design/references/workflow-3d.md +0 -102
  846. package/.opencode/skills/frontend-design/references/workflow-describe.md +0 -87
  847. package/.opencode/skills/frontend-design/references/workflow-immersive.md +0 -87
  848. package/.opencode/skills/frontend-design/references/workflow-quick.md +0 -57
  849. package/.opencode/skills/frontend-design/references/workflow-screenshot.md +0 -63
  850. package/.opencode/skills/frontend-design/references/workflow-video.md +0 -74
  851. package/.opencode/skills/frontend-development/SKILL.md +0 -403
  852. package/.opencode/skills/frontend-development/resources/common-patterns.md +0 -331
  853. package/.opencode/skills/frontend-development/resources/complete-examples.md +0 -872
  854. package/.opencode/skills/frontend-development/resources/component-patterns.md +0 -502
  855. package/.opencode/skills/frontend-development/resources/data-fetching.md +0 -767
  856. package/.opencode/skills/frontend-development/resources/file-organization.md +0 -502
  857. package/.opencode/skills/frontend-development/resources/loading-and-error-states.md +0 -501
  858. package/.opencode/skills/frontend-development/resources/performance.md +0 -406
  859. package/.opencode/skills/frontend-development/resources/routing-guide.md +0 -364
  860. package/.opencode/skills/frontend-development/resources/styling-guide.md +0 -428
  861. package/.opencode/skills/frontend-development/resources/typescript-standards.md +0 -418
  862. package/.opencode/skills/funnel/SKILL.md +0 -82
  863. package/.opencode/skills/gamification-marketing/SKILL.md +0 -95
  864. package/.opencode/skills/gamification-marketing/references/analytics-events.md +0 -84
  865. package/.opencode/skills/gamification-marketing/references/campaign-templates.md +0 -80
  866. package/.opencode/skills/gamification-marketing/references/case-studies.md +0 -60
  867. package/.opencode/skills/gamification-marketing/references/challenge-configs.md +0 -86
  868. package/.opencode/skills/gamification-marketing/references/database-schema.md +0 -98
  869. package/.opencode/skills/gamification-marketing/references/implementation-guide.md +0 -57
  870. package/.opencode/skills/gamification-marketing/references/kpi-tracking.md +0 -53
  871. package/.opencode/skills/gamification-marketing/references/mechanics-selection.md +0 -81
  872. package/.opencode/skills/gamification-marketing/references/psychology-frameworks.md +0 -96
  873. package/.opencode/skills/git/SKILL.md +0 -101
  874. package/.opencode/skills/git/references/branch-management.md +0 -88
  875. package/.opencode/skills/git/references/commit-standards.md +0 -45
  876. package/.opencode/skills/git/references/gh-cli-guide.md +0 -109
  877. package/.opencode/skills/git/references/safety-protocols.md +0 -69
  878. package/.opencode/skills/git/references/workflow-commit.md +0 -56
  879. package/.opencode/skills/git/references/workflow-merge.md +0 -48
  880. package/.opencode/skills/git/references/workflow-pr.md +0 -58
  881. package/.opencode/skills/git/references/workflow-push.md +0 -52
  882. package/.opencode/skills/gkg/SKILL.md +0 -94
  883. package/.opencode/skills/gkg/references/cli-commands.md +0 -106
  884. package/.opencode/skills/gkg/references/http-api.md +0 -102
  885. package/.opencode/skills/gkg/references/language-support.md +0 -57
  886. package/.opencode/skills/gkg/references/mcp-tools.md +0 -99
  887. package/.opencode/skills/google-adk-python/SKILL.md +0 -246
  888. package/.opencode/skills/google-adk-python/references/agent-types-and-architecture.md +0 -128
  889. package/.opencode/skills/google-adk-python/references/callbacks-plugins-observability.md +0 -117
  890. package/.opencode/skills/google-adk-python/references/deployment-cloud-run-vertex-gke.md +0 -138
  891. package/.opencode/skills/google-adk-python/references/evaluation-testing-cli.md +0 -112
  892. package/.opencode/skills/google-adk-python/references/multi-agent-and-a2a-protocol.md +0 -145
  893. package/.opencode/skills/google-adk-python/references/sessions-state-memory-artifacts.md +0 -131
  894. package/.opencode/skills/google-adk-python/references/tools-and-mcp-integration.md +0 -146
  895. package/.opencode/skills/hub/SKILL.md +0 -55
  896. package/.opencode/skills/init/SKILL.md +0 -219
  897. package/.opencode/skills/journal/SKILL.md +0 -22
  898. package/.opencode/skills/kanban/SKILL.md +0 -69
  899. package/.opencode/skills/kit-builder/SKILL.md +0 -85
  900. package/.opencode/skills/kit-builder/references/agent-guide.md +0 -79
  901. package/.opencode/skills/kit-builder/references/best-practices.md +0 -117
  902. package/.opencode/skills/kit-builder/references/command-guide.md +0 -91
  903. package/.opencode/skills/kit-builder/references/marketing-checklist.md +0 -121
  904. package/.opencode/skills/kit-builder/references/skill-guide.md +0 -74
  905. package/.opencode/skills/kit-builder/references/workflow-guide.md +0 -113
  906. package/.opencode/skills/kit-builder/scripts/init_component.py +0 -260
  907. package/.opencode/skills/kit-builder/templates/agent-template.md +0 -48
  908. package/.opencode/skills/kit-builder/templates/command-template.md +0 -37
  909. package/.opencode/skills/kit-builder/templates/skill-template.md +0 -53
  910. package/.opencode/skills/kit-builder/templates/workflow-template.md +0 -80
  911. package/.opencode/skills/launch-strategy/SKILL.md +0 -348
  912. package/.opencode/skills/llms/SKILL.md +0 -120
  913. package/.opencode/skills/llms/references/llms-txt-specification.md +0 -87
  914. package/.opencode/skills/llms/scripts/generate-llms-txt.py +0 -350
  915. package/.opencode/skills/logo-design/SKILL.md +0 -156
  916. package/.opencode/skills/logo-design/data/colors.csv +0 -56
  917. package/.opencode/skills/logo-design/data/industries.csv +0 -56
  918. package/.opencode/skills/logo-design/data/styles.csv +0 -56
  919. package/.opencode/skills/logo-design/references/color-psychology.md +0 -101
  920. package/.opencode/skills/logo-design/references/prompt-engineering.md +0 -158
  921. package/.opencode/skills/logo-design/references/style-guide.md +0 -109
  922. package/.opencode/skills/logo-design/scripts/core.py +0 -175
  923. package/.opencode/skills/logo-design/scripts/generate.py +0 -363
  924. package/.opencode/skills/logo-design/scripts/search.py +0 -114
  925. package/.opencode/skills/markdown-novel-viewer/SKILL.md +0 -285
  926. package/.opencode/skills/markdown-novel-viewer/assets/directory-browser.css +0 -215
  927. package/.opencode/skills/markdown-novel-viewer/assets/novel-theme.css +0 -872
  928. package/.opencode/skills/markdown-novel-viewer/assets/reader.js +0 -357
  929. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-base.css +0 -54
  930. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-components.css +0 -188
  931. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-content.css +0 -178
  932. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-header.css +0 -217
  933. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-mermaid.css +0 -153
  934. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-overlays.css +0 -202
  935. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-responsive.css +0 -285
  936. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-sidebar.css +0 -358
  937. package/.opencode/skills/markdown-novel-viewer/assets/styles/novel-theme-variables.css +0 -56
  938. package/.opencode/skills/markdown-novel-viewer/assets/template.html +0 -85
  939. package/.opencode/skills/markdown-novel-viewer/bun.lock +0 -38
  940. package/.opencode/skills/markdown-novel-viewer/package.json +0 -15
  941. package/.opencode/skills/markdown-novel-viewer/scripts/lib/http-server.cjs +0 -434
  942. package/.opencode/skills/markdown-novel-viewer/scripts/lib/markdown-renderer.cjs +0 -335
  943. package/.opencode/skills/markdown-novel-viewer/scripts/lib/plan-navigator.cjs +0 -509
  944. package/.opencode/skills/markdown-novel-viewer/scripts/lib/port-finder.cjs +0 -48
  945. package/.opencode/skills/markdown-novel-viewer/scripts/lib/process-mgr.cjs +0 -150
  946. package/.opencode/skills/markdown-novel-viewer/scripts/server.cjs +0 -411
  947. package/.opencode/skills/marketing-dashboard/.env.example +0 -15
  948. package/.opencode/skills/marketing-dashboard/README.md +0 -363
  949. package/.opencode/skills/marketing-dashboard/SKILL.md +0 -84
  950. package/.opencode/skills/marketing-dashboard/app/.env.example +0 -2
  951. package/.opencode/skills/marketing-dashboard/app/README.md +0 -5
  952. package/.opencode/skills/marketing-dashboard/app/index.html +0 -13
  953. package/.opencode/skills/marketing-dashboard/app/package.json +0 -31
  954. package/.opencode/skills/marketing-dashboard/app/postcss.config.js +0 -5
  955. package/.opencode/skills/marketing-dashboard/app/public/vite.svg +0 -1
  956. package/.opencode/skills/marketing-dashboard/app/src/App.vue +0 -9
  957. package/.opencode/skills/marketing-dashboard/app/src/assets/vue.svg +0 -1
  958. package/.opencode/skills/marketing-dashboard/app/src/components/assets/AssetCard.vue +0 -338
  959. package/.opencode/skills/marketing-dashboard/app/src/components/assets/AssetGrid.vue +0 -673
  960. package/.opencode/skills/marketing-dashboard/app/src/components/assets/AssetPreview.vue +0 -530
  961. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/CodePreview.vue +0 -402
  962. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/ImagePreview.vue +0 -282
  963. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/InfographicPreview.vue +0 -167
  964. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/JsonVisualizer.vue +0 -548
  965. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/MarkdownPreview.vue +0 -774
  966. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/SlidePreview.vue +0 -341
  967. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/SocialPostPreview.vue +0 -505
  968. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/StoryboardPreview.vue +0 -311
  969. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/TranscriptPreview.vue +0 -350
  970. package/.opencode/skills/marketing-dashboard/app/src/components/assets/previews/VideoPreview.vue +0 -351
  971. package/.opencode/skills/marketing-dashboard/app/src/components/brand/ColorPalette.vue +0 -131
  972. package/.opencode/skills/marketing-dashboard/app/src/components/brand/ComponentShowcase.vue +0 -188
  973. package/.opencode/skills/marketing-dashboard/app/src/components/brand/LogoGallery.vue +0 -167
  974. package/.opencode/skills/marketing-dashboard/app/src/components/brand/SpacingScale.vue +0 -33
  975. package/.opencode/skills/marketing-dashboard/app/src/components/brand/TypographyPreview.vue +0 -97
  976. package/.opencode/skills/marketing-dashboard/app/src/components/brand/VoiceSummary.vue +0 -92
  977. package/.opencode/skills/marketing-dashboard/app/src/components/common/LoadingSpinner.vue +0 -75
  978. package/.opencode/skills/marketing-dashboard/app/src/components/common/Modal.vue +0 -60
  979. package/.opencode/skills/marketing-dashboard/app/src/components/common/Toast.vue +0 -119
  980. package/.opencode/skills/marketing-dashboard/app/src/components/layout/AppHeader.vue +0 -17
  981. package/.opencode/skills/marketing-dashboard/app/src/components/layout/AppLayout.vue +0 -16
  982. package/.opencode/skills/marketing-dashboard/app/src/components/layout/AppSidebar.vue +0 -103
  983. package/.opencode/skills/marketing-dashboard/app/src/config.js +0 -1
  984. package/.opencode/skills/marketing-dashboard/app/src/main.js +0 -12
  985. package/.opencode/skills/marketing-dashboard/app/src/router/index.js +0 -33
  986. package/.opencode/skills/marketing-dashboard/app/src/stores/assets.js +0 -108
  987. package/.opencode/skills/marketing-dashboard/app/src/stores/brand.js +0 -94
  988. package/.opencode/skills/marketing-dashboard/app/src/style.css +0 -72
  989. package/.opencode/skills/marketing-dashboard/app/src/views/AssetsView.vue +0 -109
  990. package/.opencode/skills/marketing-dashboard/app/src/views/BrandView.vue +0 -82
  991. package/.opencode/skills/marketing-dashboard/app/src/views/SettingsView.vue +0 -108
  992. package/.opencode/skills/marketing-dashboard/app/tailwind.config.js +0 -34
  993. package/.opencode/skills/marketing-dashboard/app/vite.config.js +0 -19
  994. package/.opencode/skills/marketing-dashboard/build.sh +0 -43
  995. package/.opencode/skills/marketing-dashboard/server/.env.example +0 -2
  996. package/.opencode/skills/marketing-dashboard/server/__tests__/ai.test.js +0 -456
  997. package/.opencode/skills/marketing-dashboard/server/__tests__/assets.test.js +0 -286
  998. package/.opencode/skills/marketing-dashboard/server/__tests__/brand-security.test.js +0 -183
  999. package/.opencode/skills/marketing-dashboard/server/__tests__/security-file-serving.test.js +0 -159
  1000. package/.opencode/skills/marketing-dashboard/server/__tests__/test-db.js +0 -31
  1001. package/.opencode/skills/marketing-dashboard/server/coverage_output.txt +0 -7
  1002. package/.opencode/skills/marketing-dashboard/server/db/database.js +0 -61
  1003. package/.opencode/skills/marketing-dashboard/server/db/schema.sql +0 -26
  1004. package/.opencode/skills/marketing-dashboard/server/index.js +0 -105
  1005. package/.opencode/skills/marketing-dashboard/server/lib/ai-bridge.cjs +0 -201
  1006. package/.opencode/skills/marketing-dashboard/server/lib/brand-context.cjs +0 -118
  1007. package/.opencode/skills/marketing-dashboard/server/lib/scanner.cjs +0 -440
  1008. package/.opencode/skills/marketing-dashboard/server/middleware/auth.js +0 -48
  1009. package/.opencode/skills/marketing-dashboard/server/package.json +0 -31
  1010. package/.opencode/skills/marketing-dashboard/server/routes/assets.js +0 -269
  1011. package/.opencode/skills/marketing-dashboard/server/routes/brand.js +0 -143
  1012. package/.opencode/skills/marketing-dashboard/server/vitest.config.js +0 -23
  1013. package/.opencode/skills/marketing-dashboard/start-production.sh +0 -55
  1014. package/.opencode/skills/marketing-dashboard/start.sh +0 -63
  1015. package/.opencode/skills/marketing-dashboard/stop.sh +0 -54
  1016. package/.opencode/skills/marketing-dashboard/temp/enhance/enhance-1766508537903.md +0 -7
  1017. package/.opencode/skills/marketing-ideas/SKILL.md +0 -569
  1018. package/.opencode/skills/marketing-planning/SKILL.md +0 -122
  1019. package/.opencode/skills/marketing-planning/references/brand-context.md +0 -54
  1020. package/.opencode/skills/marketing-planning/references/output-standards.md +0 -117
  1021. package/.opencode/skills/marketing-planning/references/plan-organization.md +0 -109
  1022. package/.opencode/skills/marketing-planning/references/research-phase.md +0 -39
  1023. package/.opencode/skills/marketing-planning/references/strategy-design.md +0 -61
  1024. package/.opencode/skills/marketing-psychology/SKILL.md +0 -455
  1025. package/.opencode/skills/marketing-research/SKILL.md +0 -172
  1026. package/.opencode/skills/mcp-builder/LICENSE.txt +0 -202
  1027. package/.opencode/skills/mcp-builder/SKILL.md +0 -332
  1028. package/.opencode/skills/mcp-builder/reference/evaluation.md +0 -602
  1029. package/.opencode/skills/mcp-builder/reference/mcp_best_practices.md +0 -915
  1030. package/.opencode/skills/mcp-builder/reference/node_mcp_server.md +0 -916
  1031. package/.opencode/skills/mcp-builder/reference/python_mcp_server.md +0 -752
  1032. package/.opencode/skills/mcp-builder/scripts/connections.py +0 -151
  1033. package/.opencode/skills/mcp-builder/scripts/evaluation.py +0 -373
  1034. package/.opencode/skills/mcp-builder/scripts/example_evaluation.xml +0 -22
  1035. package/.opencode/skills/mcp-builder/scripts/requirements.txt +0 -2
  1036. package/.opencode/skills/mcp-management/README.md +0 -219
  1037. package/.opencode/skills/mcp-management/SKILL.md +0 -213
  1038. package/.opencode/skills/mcp-management/assets/tools.json +0 -3146
  1039. package/.opencode/skills/mcp-management/references/configuration.md +0 -114
  1040. package/.opencode/skills/mcp-management/references/gemini-cli-integration.md +0 -215
  1041. package/.opencode/skills/mcp-management/references/mcp-protocol.md +0 -116
  1042. package/.opencode/skills/mcp-management/scripts/.env.example +0 -10
  1043. package/.opencode/skills/mcp-management/scripts/cli.ts +0 -195
  1044. package/.opencode/skills/mcp-management/scripts/dist/analyze-tools.js +0 -70
  1045. package/.opencode/skills/mcp-management/scripts/dist/cli.js +0 -160
  1046. package/.opencode/skills/mcp-management/scripts/dist/mcp-client.js +0 -183
  1047. package/.opencode/skills/mcp-management/scripts/mcp-client.ts +0 -230
  1048. package/.opencode/skills/mcp-management/scripts/package.json +0 -20
  1049. package/.opencode/skills/mcp-management/scripts/tsconfig.json +0 -15
  1050. package/.opencode/skills/media-processing/SKILL.md +0 -95
  1051. package/.opencode/skills/media-processing/references/common-workflows.md +0 -132
  1052. package/.opencode/skills/media-processing/references/ffmpeg-encoding.md +0 -358
  1053. package/.opencode/skills/media-processing/references/ffmpeg-filters.md +0 -503
  1054. package/.opencode/skills/media-processing/references/ffmpeg-streaming.md +0 -403
  1055. package/.opencode/skills/media-processing/references/format-compatibility.md +0 -375
  1056. package/.opencode/skills/media-processing/references/imagemagick-batch.md +0 -612
  1057. package/.opencode/skills/media-processing/references/imagemagick-editing.md +0 -623
  1058. package/.opencode/skills/media-processing/references/rmbg-background-removal.md +0 -66
  1059. package/.opencode/skills/media-processing/references/troubleshooting.md +0 -109
  1060. package/.opencode/skills/media-processing/scripts/README.md +0 -111
  1061. package/.opencode/skills/media-processing/scripts/batch-remove-background.sh +0 -124
  1062. package/.opencode/skills/media-processing/scripts/batch_resize.py +0 -342
  1063. package/.opencode/skills/media-processing/scripts/media_convert.py +0 -311
  1064. package/.opencode/skills/media-processing/scripts/remove-background.sh +0 -96
  1065. package/.opencode/skills/media-processing/scripts/remove-bg-node.js +0 -158
  1066. package/.opencode/skills/media-processing/scripts/requirements.txt +0 -24
  1067. package/.opencode/skills/media-processing/scripts/video_optimize.py +0 -414
  1068. package/.opencode/skills/mermaidjs-v11/SKILL.md +0 -119
  1069. package/.opencode/skills/mermaidjs-v11/references/cli-usage.md +0 -228
  1070. package/.opencode/skills/mermaidjs-v11/references/configuration.md +0 -232
  1071. package/.opencode/skills/mermaidjs-v11/references/diagram-types.md +0 -315
  1072. package/.opencode/skills/mermaidjs-v11/references/examples.md +0 -344
  1073. package/.opencode/skills/mermaidjs-v11/references/integration.md +0 -310
  1074. package/.opencode/skills/mintlify/SKILL.md +0 -123
  1075. package/.opencode/skills/mintlify/references/ai-features-and-integrations-reference.md +0 -756
  1076. package/.opencode/skills/mintlify/references/api-documentation-components-reference.md +0 -873
  1077. package/.opencode/skills/mintlify/references/deployment-and-continuous-integration-reference.md +0 -674
  1078. package/.opencode/skills/mintlify/references/docs-json-configuration-reference.md +0 -724
  1079. package/.opencode/skills/mintlify/references/mdx-components-reference.md +0 -551
  1080. package/.opencode/skills/mintlify/references/navigation-structure-and-organization-reference.md +0 -775
  1081. package/.opencode/skills/mobile-development/SKILL.md +0 -215
  1082. package/.opencode/skills/mobile-development/references/mobile-android.md +0 -604
  1083. package/.opencode/skills/mobile-development/references/mobile-best-practices.md +0 -545
  1084. package/.opencode/skills/mobile-development/references/mobile-debugging.md +0 -1089
  1085. package/.opencode/skills/mobile-development/references/mobile-frameworks.md +0 -465
  1086. package/.opencode/skills/mobile-development/references/mobile-ios.md +0 -496
  1087. package/.opencode/skills/mobile-development/references/mobile-mindset.md +0 -544
  1088. package/.opencode/skills/onboarding-cro/SKILL.md +0 -437
  1089. package/.opencode/skills/paid-ads/SKILL.md +0 -555
  1090. package/.opencode/skills/payment-integration/README.md +0 -217
  1091. package/.opencode/skills/payment-integration/SKILL.md +0 -156
  1092. package/.opencode/skills/payment-integration/references/creem/api.md +0 -139
  1093. package/.opencode/skills/payment-integration/references/creem/checkouts.md +0 -99
  1094. package/.opencode/skills/payment-integration/references/creem/licensing.md +0 -136
  1095. package/.opencode/skills/payment-integration/references/creem/overview.md +0 -65
  1096. package/.opencode/skills/payment-integration/references/creem/sdk.md +0 -161
  1097. package/.opencode/skills/payment-integration/references/creem/subscriptions.md +0 -129
  1098. package/.opencode/skills/payment-integration/references/creem/webhooks.md +0 -120
  1099. package/.opencode/skills/payment-integration/references/implementation-workflows.md +0 -43
  1100. package/.opencode/skills/payment-integration/references/multi-provider-order-management-patterns.md +0 -821
  1101. package/.opencode/skills/payment-integration/references/paddle/api.md +0 -116
  1102. package/.opencode/skills/payment-integration/references/paddle/best-practices.md +0 -130
  1103. package/.opencode/skills/payment-integration/references/paddle/overview.md +0 -57
  1104. package/.opencode/skills/payment-integration/references/paddle/paddle-js.md +0 -106
  1105. package/.opencode/skills/payment-integration/references/paddle/sdk.md +0 -131
  1106. package/.opencode/skills/payment-integration/references/paddle/subscriptions.md +0 -118
  1107. package/.opencode/skills/payment-integration/references/paddle/webhooks.md +0 -112
  1108. package/.opencode/skills/payment-integration/references/polar/benefits.md +0 -396
  1109. package/.opencode/skills/payment-integration/references/polar/best-practices.md +0 -902
  1110. package/.opencode/skills/payment-integration/references/polar/checkouts.md +0 -266
  1111. package/.opencode/skills/payment-integration/references/polar/overview.md +0 -184
  1112. package/.opencode/skills/payment-integration/references/polar/products.md +0 -244
  1113. package/.opencode/skills/payment-integration/references/polar/sdk.md +0 -436
  1114. package/.opencode/skills/payment-integration/references/polar/subscriptions.md +0 -340
  1115. package/.opencode/skills/payment-integration/references/polar/webhooks.md +0 -405
  1116. package/.opencode/skills/payment-integration/references/sepay/api.md +0 -140
  1117. package/.opencode/skills/payment-integration/references/sepay/best-practices.md +0 -939
  1118. package/.opencode/skills/payment-integration/references/sepay/overview.md +0 -138
  1119. package/.opencode/skills/payment-integration/references/sepay/qr-codes.md +0 -228
  1120. package/.opencode/skills/payment-integration/references/sepay/sdk.md +0 -213
  1121. package/.opencode/skills/payment-integration/references/sepay/webhooks.md +0 -208
  1122. package/.opencode/skills/payment-integration/references/stripe/stripe-best-practices.md +0 -32
  1123. package/.opencode/skills/payment-integration/references/stripe/stripe-cli.md +0 -148
  1124. package/.opencode/skills/payment-integration/references/stripe/stripe-js.md +0 -116
  1125. package/.opencode/skills/payment-integration/references/stripe/stripe-sdks.md +0 -84
  1126. package/.opencode/skills/payment-integration/references/stripe/stripe-upgrade.md +0 -175
  1127. package/.opencode/skills/payment-integration/scripts/.env.example +0 -20
  1128. package/.opencode/skills/payment-integration/scripts/checkout-helper.js +0 -244
  1129. package/.opencode/skills/payment-integration/scripts/package.json +0 -17
  1130. package/.opencode/skills/payment-integration/scripts/polar-webhook-verify.js +0 -202
  1131. package/.opencode/skills/payment-integration/scripts/sepay-webhook-verify.js +0 -193
  1132. package/.opencode/skills/payment-integration/scripts/test-scripts.js +0 -237
  1133. package/.opencode/skills/persona/SKILL.md +0 -66
  1134. package/.opencode/skills/plan/SKILL.md +0 -53
  1135. package/.opencode/skills/plan/references/archive.md +0 -52
  1136. package/.opencode/skills/plan/references/ci.md +0 -28
  1137. package/.opencode/skills/plan/references/cro.md +0 -64
  1138. package/.opencode/skills/plan/references/fast.md +0 -61
  1139. package/.opencode/skills/plan/references/hard.md +0 -87
  1140. package/.opencode/skills/plan/references/parallel.md +0 -124
  1141. package/.opencode/skills/plan/references/two.md +0 -40
  1142. package/.opencode/skills/plan/references/validate.md +0 -112
  1143. package/.opencode/skills/plans-kanban/SKILL.md +0 -170
  1144. package/.opencode/skills/plans-kanban/assets/dashboard-template.html +0 -119
  1145. package/.opencode/skills/plans-kanban/assets/dashboard.css +0 -1594
  1146. package/.opencode/skills/plans-kanban/assets/dashboard.js +0 -596
  1147. package/.opencode/skills/plans-kanban/package.json +0 -13
  1148. package/.opencode/skills/plans-kanban/scripts/lib/dashboard-renderer.cjs +0 -884
  1149. package/.opencode/skills/plans-kanban/scripts/lib/http-server.cjs +0 -310
  1150. package/.opencode/skills/plans-kanban/scripts/lib/plan-metadata-extractor.cjs +0 -489
  1151. package/.opencode/skills/plans-kanban/scripts/lib/plan-parser.cjs +0 -175
  1152. package/.opencode/skills/plans-kanban/scripts/lib/plan-scanner.cjs +0 -272
  1153. package/.opencode/skills/plans-kanban/scripts/lib/port-finder.cjs +0 -48
  1154. package/.opencode/skills/plans-kanban/scripts/lib/process-mgr.cjs +0 -126
  1155. package/.opencode/skills/plans-kanban/scripts/server.cjs +0 -253
  1156. package/.opencode/skills/play/SKILL.md +0 -111
  1157. package/.opencode/skills/play/references/blocked.md +0 -55
  1158. package/.opencode/skills/play/references/create.md +0 -48
  1159. package/.opencode/skills/play/references/gate.md +0 -38
  1160. package/.opencode/skills/play/references/goals.md +0 -53
  1161. package/.opencode/skills/play/references/learn.md +0 -48
  1162. package/.opencode/skills/play/references/list.md +0 -34
  1163. package/.opencode/skills/play/references/next.md +0 -51
  1164. package/.opencode/skills/play/references/reset.md +0 -34
  1165. package/.opencode/skills/play/references/status.md +0 -56
  1166. package/.opencode/skills/play/references/templates.md +0 -38
  1167. package/.opencode/skills/play/scripts/goals.cjs +0 -229
  1168. package/.opencode/skills/play/scripts/graph.cjs +0 -331
  1169. package/.opencode/skills/play/scripts/manifest.cjs +0 -474
  1170. package/.opencode/skills/play/scripts/metrics-bridge.cjs +0 -355
  1171. package/.opencode/skills/play/scripts/metrics-email.cjs +0 -182
  1172. package/.opencode/skills/play/scripts/metrics-social.cjs +0 -151
  1173. package/.opencode/skills/play/scripts/smart-suggest.cjs +0 -292
  1174. package/.opencode/skills/play/scripts/template-loader.cjs +0 -359
  1175. package/.opencode/skills/play/templates/_schema.json +0 -150
  1176. package/.opencode/skills/play/templates/campaign-sprint.json +0 -195
  1177. package/.opencode/skills/play/templates/content-engine.json +0 -348
  1178. package/.opencode/skills/play/templates/product-hunt-launch.json +0 -210
  1179. package/.opencode/skills/play/templates/saas-launch.json +0 -224
  1180. package/.opencode/skills/preview/SKILL.md +0 -87
  1181. package/.opencode/skills/preview/references/generation-modes.md +0 -192
  1182. package/.opencode/skills/preview/references/html-css-patterns.md +0 -1717
  1183. package/.opencode/skills/preview/references/html-design-guidelines.md +0 -393
  1184. package/.opencode/skills/preview/references/html-libraries.md +0 -592
  1185. package/.opencode/skills/preview/references/html-responsive-nav.md +0 -212
  1186. package/.opencode/skills/preview/references/html-slide-patterns.md +0 -1401
  1187. package/.opencode/skills/preview/references/view-mode.md +0 -42
  1188. package/.opencode/skills/preview/templates/architecture.html +0 -650
  1189. package/.opencode/skills/preview/templates/data-table.html +0 -590
  1190. package/.opencode/skills/preview/templates/mermaid-flowchart.html +0 -768
  1191. package/.opencode/skills/preview/templates/slide-deck.html +0 -968
  1192. package/.opencode/skills/pricing-strategy/SKILL.md +0 -714
  1193. package/.opencode/skills/problem-solving/SKILL.md +0 -99
  1194. package/.opencode/skills/problem-solving/references/attribution.md +0 -69
  1195. package/.opencode/skills/problem-solving/references/collision-zone-thinking.md +0 -79
  1196. package/.opencode/skills/problem-solving/references/inversion-exercise.md +0 -91
  1197. package/.opencode/skills/problem-solving/references/meta-pattern-recognition.md +0 -87
  1198. package/.opencode/skills/problem-solving/references/scale-game.md +0 -95
  1199. package/.opencode/skills/problem-solving/references/simplification-cascades.md +0 -80
  1200. package/.opencode/skills/problem-solving/references/when-stuck.md +0 -72
  1201. package/.opencode/skills/project-management/SKILL.md +0 -136
  1202. package/.opencode/skills/project-management/references/documentation-triggers.md +0 -60
  1203. package/.opencode/skills/project-management/references/hydration-workflow.md +0 -89
  1204. package/.opencode/skills/project-management/references/progress-tracking.md +0 -120
  1205. package/.opencode/skills/project-management/references/reporting-patterns.md +0 -94
  1206. package/.opencode/skills/project-management/references/task-operations.md +0 -87
  1207. package/.opencode/skills/project-organization/SKILL.md +0 -228
  1208. package/.opencode/skills/project-organization/references/directory-patterns.md +0 -176
  1209. package/.opencode/skills/project-organization/references/markdown-body-templates.md +0 -311
  1210. package/.opencode/skills/project-organization/references/naming-conventions.md +0 -140
  1211. package/.opencode/skills/react-best-practices/AGENTS.md +0 -2249
  1212. package/.opencode/skills/react-best-practices/README.md +0 -123
  1213. package/.opencode/skills/react-best-practices/SKILL.md +0 -125
  1214. package/.opencode/skills/react-best-practices/metadata.json +0 -15
  1215. package/.opencode/skills/react-best-practices/rules/_sections.md +0 -46
  1216. package/.opencode/skills/react-best-practices/rules/_template.md +0 -28
  1217. package/.opencode/skills/react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  1218. package/.opencode/skills/react-best-practices/rules/advanced-use-latest.md +0 -49
  1219. package/.opencode/skills/react-best-practices/rules/async-api-routes.md +0 -38
  1220. package/.opencode/skills/react-best-practices/rules/async-defer-await.md +0 -80
  1221. package/.opencode/skills/react-best-practices/rules/async-dependencies.md +0 -36
  1222. package/.opencode/skills/react-best-practices/rules/async-parallel.md +0 -28
  1223. package/.opencode/skills/react-best-practices/rules/async-suspense-boundaries.md +0 -99
  1224. package/.opencode/skills/react-best-practices/rules/bundle-barrel-imports.md +0 -59
  1225. package/.opencode/skills/react-best-practices/rules/bundle-conditional.md +0 -31
  1226. package/.opencode/skills/react-best-practices/rules/bundle-defer-third-party.md +0 -49
  1227. package/.opencode/skills/react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  1228. package/.opencode/skills/react-best-practices/rules/bundle-preload.md +0 -50
  1229. package/.opencode/skills/react-best-practices/rules/client-event-listeners.md +0 -74
  1230. package/.opencode/skills/react-best-practices/rules/client-swr-dedup.md +0 -56
  1231. package/.opencode/skills/react-best-practices/rules/js-batch-dom-css.md +0 -82
  1232. package/.opencode/skills/react-best-practices/rules/js-cache-function-results.md +0 -80
  1233. package/.opencode/skills/react-best-practices/rules/js-cache-property-access.md +0 -28
  1234. package/.opencode/skills/react-best-practices/rules/js-cache-storage.md +0 -70
  1235. package/.opencode/skills/react-best-practices/rules/js-combine-iterations.md +0 -32
  1236. package/.opencode/skills/react-best-practices/rules/js-early-exit.md +0 -50
  1237. package/.opencode/skills/react-best-practices/rules/js-hoist-regexp.md +0 -45
  1238. package/.opencode/skills/react-best-practices/rules/js-index-maps.md +0 -37
  1239. package/.opencode/skills/react-best-practices/rules/js-length-check-first.md +0 -49
  1240. package/.opencode/skills/react-best-practices/rules/js-min-max-loop.md +0 -82
  1241. package/.opencode/skills/react-best-practices/rules/js-set-map-lookups.md +0 -24
  1242. package/.opencode/skills/react-best-practices/rules/js-tosorted-immutable.md +0 -57
  1243. package/.opencode/skills/react-best-practices/rules/rendering-activity.md +0 -26
  1244. package/.opencode/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  1245. package/.opencode/skills/react-best-practices/rules/rendering-conditional-render.md +0 -40
  1246. package/.opencode/skills/react-best-practices/rules/rendering-content-visibility.md +0 -38
  1247. package/.opencode/skills/react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  1248. package/.opencode/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  1249. package/.opencode/skills/react-best-practices/rules/rendering-svg-precision.md +0 -28
  1250. package/.opencode/skills/react-best-practices/rules/rerender-defer-reads.md +0 -39
  1251. package/.opencode/skills/react-best-practices/rules/rerender-dependencies.md +0 -45
  1252. package/.opencode/skills/react-best-practices/rules/rerender-derived-state.md +0 -29
  1253. package/.opencode/skills/react-best-practices/rules/rerender-functional-setstate.md +0 -74
  1254. package/.opencode/skills/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  1255. package/.opencode/skills/react-best-practices/rules/rerender-memo.md +0 -44
  1256. package/.opencode/skills/react-best-practices/rules/rerender-transitions.md +0 -40
  1257. package/.opencode/skills/react-best-practices/rules/server-after-nonblocking.md +0 -73
  1258. package/.opencode/skills/react-best-practices/rules/server-cache-lru.md +0 -41
  1259. package/.opencode/skills/react-best-practices/rules/server-cache-react.md +0 -26
  1260. package/.opencode/skills/react-best-practices/rules/server-parallel-fetching.md +0 -79
  1261. package/.opencode/skills/react-best-practices/rules/server-serialization.md +0 -38
  1262. package/.opencode/skills/referral-program-building/SKILL.md +0 -81
  1263. package/.opencode/skills/referral-program-building/references/email-templates.md +0 -75
  1264. package/.opencode/skills/referral-program-building/references/fraud-prevention.md +0 -95
  1265. package/.opencode/skills/referral-program-building/references/metrics-tracking.md +0 -64
  1266. package/.opencode/skills/referral-program-building/references/platform-selection.md +0 -80
  1267. package/.opencode/skills/referral-program-building/references/reward-structures.md +0 -82
  1268. package/.opencode/skills/referral-program-building/references/technical-implementation.md +0 -98
  1269. package/.opencode/skills/remotion/SKILL.md +0 -45
  1270. package/.opencode/skills/remotion/rules/3d.md +0 -86
  1271. package/.opencode/skills/remotion/rules/animations.md +0 -29
  1272. package/.opencode/skills/remotion/rules/assets/charts-bar-chart.tsx +0 -173
  1273. package/.opencode/skills/remotion/rules/assets/text-animations-typewriter.tsx +0 -100
  1274. package/.opencode/skills/remotion/rules/assets/text-animations-word-highlight.tsx +0 -108
  1275. package/.opencode/skills/remotion/rules/assets.md +0 -78
  1276. package/.opencode/skills/remotion/rules/audio.md +0 -172
  1277. package/.opencode/skills/remotion/rules/calculate-metadata.md +0 -104
  1278. package/.opencode/skills/remotion/rules/can-decode.md +0 -75
  1279. package/.opencode/skills/remotion/rules/charts.md +0 -58
  1280. package/.opencode/skills/remotion/rules/compositions.md +0 -146
  1281. package/.opencode/skills/remotion/rules/display-captions.md +0 -126
  1282. package/.opencode/skills/remotion/rules/extract-frames.md +0 -229
  1283. package/.opencode/skills/remotion/rules/fonts.md +0 -152
  1284. package/.opencode/skills/remotion/rules/get-audio-duration.md +0 -58
  1285. package/.opencode/skills/remotion/rules/get-video-dimensions.md +0 -68
  1286. package/.opencode/skills/remotion/rules/get-video-duration.md +0 -58
  1287. package/.opencode/skills/remotion/rules/gifs.md +0 -138
  1288. package/.opencode/skills/remotion/rules/images.md +0 -130
  1289. package/.opencode/skills/remotion/rules/import-srt-captions.md +0 -67
  1290. package/.opencode/skills/remotion/rules/lottie.md +0 -68
  1291. package/.opencode/skills/remotion/rules/measuring-dom-nodes.md +0 -35
  1292. package/.opencode/skills/remotion/rules/measuring-text.md +0 -143
  1293. package/.opencode/skills/remotion/rules/sequencing.md +0 -106
  1294. package/.opencode/skills/remotion/rules/tailwind.md +0 -11
  1295. package/.opencode/skills/remotion/rules/text-animations.md +0 -20
  1296. package/.opencode/skills/remotion/rules/timing.md +0 -179
  1297. package/.opencode/skills/remotion/rules/transcribe-captions.md +0 -19
  1298. package/.opencode/skills/remotion/rules/transitions.md +0 -122
  1299. package/.opencode/skills/remotion/rules/trimming.md +0 -53
  1300. package/.opencode/skills/remotion/rules/videos.md +0 -171
  1301. package/.opencode/skills/repomix/SKILL.md +0 -251
  1302. package/.opencode/skills/repomix/references/configuration.md +0 -211
  1303. package/.opencode/skills/repomix/references/usage-patterns.md +0 -232
  1304. package/.opencode/skills/repomix/scripts/.coverage +0 -0
  1305. package/.opencode/skills/repomix/scripts/README.md +0 -179
  1306. package/.opencode/skills/repomix/scripts/repomix_batch.py +0 -455
  1307. package/.opencode/skills/repomix/scripts/repos.example.json +0 -15
  1308. package/.opencode/skills/repomix/scripts/requirements.txt +0 -15
  1309. package/.opencode/skills/research/SKILL.md +0 -176
  1310. package/.opencode/skills/retro/SKILL.md +0 -138
  1311. package/.opencode/skills/retro/references/metrics-guide.md +0 -133
  1312. package/.opencode/skills/retro/references/report-template.md +0 -110
  1313. package/.opencode/skills/scout/SKILL.md +0 -82
  1314. package/.opencode/skills/scout/references/external-scouting.md +0 -140
  1315. package/.opencode/skills/scout/references/internal-scouting.md +0 -119
  1316. package/.opencode/skills/scout/references/task-management-scouting.md +0 -125
  1317. package/.opencode/skills/security-scan/SKILL.md +0 -141
  1318. package/.opencode/skills/security-scan/references/secret-patterns.md +0 -77
  1319. package/.opencode/skills/security-scan/references/vulnerability-patterns.md +0 -105
  1320. package/.opencode/skills/seo/SKILL.md +0 -95
  1321. package/.opencode/skills/seo/references/audit.md +0 -121
  1322. package/.opencode/skills/seo/references/backlink-analysis-framework.md +0 -192
  1323. package/.opencode/skills/seo/references/browser-seo-audit-workflow.md +0 -180
  1324. package/.opencode/skills/seo/references/canonical-url-strategy.md +0 -286
  1325. package/.opencode/skills/seo/references/content-gap-analysis-framework.md +0 -255
  1326. package/.opencode/skills/seo/references/core-web-vitals-remediation.md +0 -279
  1327. package/.opencode/skills/seo/references/directory-submission-list.md +0 -280
  1328. package/.opencode/skills/seo/references/google-search-console-api-guide.md +0 -745
  1329. package/.opencode/skills/seo/references/internal-linking-automation.md +0 -685
  1330. package/.opencode/skills/seo/references/keyword-clustering-methodology.md +0 -175
  1331. package/.opencode/skills/seo/references/keyword-research-workflow.md +0 -63
  1332. package/.opencode/skills/seo/references/keywords.md +0 -131
  1333. package/.opencode/skills/seo/references/link-building-campaign-framework.md +0 -246
  1334. package/.opencode/skills/seo/references/meta-tag-templates.md +0 -229
  1335. package/.opencode/skills/seo/references/mobile-seo-checklist.md +0 -557
  1336. package/.opencode/skills/seo/references/on-page-seo-checklist-2025.md +0 -328
  1337. package/.opencode/skills/seo/references/outreach-email-templates.md +0 -335
  1338. package/.opencode/skills/seo/references/pseo-best-practices.md +0 -366
  1339. package/.opencode/skills/seo/references/pseo-scale-architecture.md +0 -801
  1340. package/.opencode/skills/seo/references/pseo-template-syntax.md +0 -329
  1341. package/.opencode/skills/seo/references/pseo-templates.md +0 -85
  1342. package/.opencode/skills/seo/references/pseo-url-structure-guide.md +0 -562
  1343. package/.opencode/skills/seo/references/pseo.md +0 -62
  1344. package/.opencode/skills/seo/references/readability-scoring-guide.md +0 -304
  1345. package/.opencode/skills/seo/references/reviewweb-api.md +0 -69
  1346. package/.opencode/skills/seo/references/reviewweb-content-api.md +0 -89
  1347. package/.opencode/skills/seo/references/robots-txt-best-practices-2025.md +0 -479
  1348. package/.opencode/skills/seo/references/schema-generation.md +0 -102
  1349. package/.opencode/skills/seo/references/schema-templates/article-schema.json +0 -25
  1350. package/.opencode/skills/seo/references/schema-templates/faq-schema.json +0 -47
  1351. package/.opencode/skills/seo/references/schema-templates/howto-schema.json +0 -66
  1352. package/.opencode/skills/seo/references/schema-templates/localbusiness-schema.json +0 -64
  1353. package/.opencode/skills/seo/references/schema-templates/organization-schema.json +0 -49
  1354. package/.opencode/skills/seo/references/schema-templates/product-schema.json +0 -49
  1355. package/.opencode/skills/seo/references/search-console-query-patterns.md +0 -606
  1356. package/.opencode/skills/seo/references/semantic-seo-framework.md +0 -480
  1357. package/.opencode/skills/seo/references/seo-audit-workflow.md +0 -90
  1358. package/.opencode/skills/seo/references/sitemap-best-practices.md +0 -391
  1359. package/.opencode/skills/seo/references/technical-seo-checklist.md +0 -74
  1360. package/.opencode/skills/seo/scripts/analyze-keywords.cjs +0 -575
  1361. package/.opencode/skills/seo/scripts/audit-core-web-vitals.cjs +0 -496
  1362. package/.opencode/skills/seo/scripts/env-loader.cjs +0 -213
  1363. package/.opencode/skills/seo/scripts/env-loader.test.cjs +0 -231
  1364. package/.opencode/skills/seo/scripts/generate-schema.cjs +0 -119
  1365. package/.opencode/skills/seo/scripts/generate-sitemap.cjs +0 -66
  1366. package/.opencode/skills/seo/scripts/gsc-auth.cjs +0 -352
  1367. package/.opencode/skills/seo/scripts/gsc-config-loader.cjs +0 -238
  1368. package/.opencode/skills/seo/scripts/gsc-query.cjs +0 -499
  1369. package/.opencode/skills/seo/scripts/pseo-generator.cjs +0 -464
  1370. package/.opencode/skills/seo/scripts/validate-schema.cjs +0 -421
  1371. package/.opencode/skills/sequential-thinking/.env.example +0 -8
  1372. package/.opencode/skills/sequential-thinking/README.md +0 -183
  1373. package/.opencode/skills/sequential-thinking/SKILL.md +0 -97
  1374. package/.opencode/skills/sequential-thinking/package.json +0 -31
  1375. package/.opencode/skills/sequential-thinking/references/advanced-strategies.md +0 -79
  1376. package/.opencode/skills/sequential-thinking/references/advanced-techniques.md +0 -76
  1377. package/.opencode/skills/sequential-thinking/references/core-patterns.md +0 -95
  1378. package/.opencode/skills/sequential-thinking/references/examples-api.md +0 -88
  1379. package/.opencode/skills/sequential-thinking/references/examples-architecture.md +0 -94
  1380. package/.opencode/skills/sequential-thinking/references/examples-debug.md +0 -90
  1381. package/.opencode/skills/sequential-thinking/scripts/format-thought.js +0 -159
  1382. package/.opencode/skills/sequential-thinking/scripts/process-thought.js +0 -236
  1383. package/.opencode/skills/shader/SKILL.md +0 -115
  1384. package/.opencode/skills/shader/references/glsl-cellular-voronoi-worley-noise-patterns.md +0 -142
  1385. package/.opencode/skills/shader/references/glsl-colors-rgb-hsb-gradients-mixing-color-spaces.md +0 -143
  1386. package/.opencode/skills/shader/references/glsl-fbm-fractional-brownian-motion-turbulence-octaves.md +0 -146
  1387. package/.opencode/skills/shader/references/glsl-fundamentals-data-types-vectors-precision-coordinates.md +0 -104
  1388. package/.opencode/skills/shader/references/glsl-noise-random-perlin-simplex-cellular-voronoi.md +0 -115
  1389. package/.opencode/skills/shader/references/glsl-pattern-symmetry-truchet-domain-warping.md +0 -134
  1390. package/.opencode/skills/shader/references/glsl-patterns-tiling-fract-matrices-transformations.md +0 -133
  1391. package/.opencode/skills/shader/references/glsl-procedural-textures-clouds-marble-wood-terrain.md +0 -144
  1392. package/.opencode/skills/shader/references/glsl-shader-builtin-functions-complete-api-reference.md +0 -112
  1393. package/.opencode/skills/shader/references/glsl-shapes-polygon-star-polar-sdf-combinations.md +0 -124
  1394. package/.opencode/skills/shader/references/glsl-shapes-sdf-circles-rectangles-polar-distance-fields.md +0 -106
  1395. package/.opencode/skills/shader/references/glsl-shaping-functions-step-smoothstep-curves-interpolation.md +0 -141
  1396. package/.opencode/skills/ship/SKILL.md +0 -119
  1397. package/.opencode/skills/ship/references/auto-detect.md +0 -103
  1398. package/.opencode/skills/ship/references/pr-template.md +0 -90
  1399. package/.opencode/skills/ship/references/ship-workflow.md +0 -241
  1400. package/.opencode/skills/shopify/README.md +0 -66
  1401. package/.opencode/skills/shopify/SKILL.md +0 -323
  1402. package/.opencode/skills/shopify/references/app-development.md +0 -470
  1403. package/.opencode/skills/shopify/references/extensions.md +0 -493
  1404. package/.opencode/skills/shopify/references/themes.md +0 -498
  1405. package/.opencode/skills/shopify/scripts/.coverage +0 -0
  1406. package/.opencode/skills/shopify/scripts/requirements.txt +0 -19
  1407. package/.opencode/skills/shopify/scripts/shopify_init.py +0 -423
  1408. package/.opencode/skills/skill-creator/LICENSE.txt +0 -202
  1409. package/.opencode/skills/skill-creator/SKILL.md +0 -121
  1410. package/.opencode/skills/skill-creator/agents/analyzer.md +0 -274
  1411. package/.opencode/skills/skill-creator/agents/comparator.md +0 -202
  1412. package/.opencode/skills/skill-creator/agents/grader.md +0 -223
  1413. package/.opencode/skills/skill-creator/assets/eval_review.html +0 -146
  1414. package/.opencode/skills/skill-creator/eval-viewer/generate_review.py +0 -471
  1415. package/.opencode/skills/skill-creator/eval-viewer/viewer.html +0 -1325
  1416. package/.opencode/skills/skill-creator/references/benchmark-optimization-guide.md +0 -86
  1417. package/.opencode/skills/skill-creator/references/distribution-guide.md +0 -79
  1418. package/.opencode/skills/skill-creator/references/eval-infrastructure-guide.md +0 -129
  1419. package/.opencode/skills/skill-creator/references/eval-schemas.md +0 -121
  1420. package/.opencode/skills/skill-creator/references/mcp-skills-integration.md +0 -71
  1421. package/.opencode/skills/skill-creator/references/metadata-quality-criteria.md +0 -76
  1422. package/.opencode/skills/skill-creator/references/plugin-marketplace-hosting.md +0 -104
  1423. package/.opencode/skills/skill-creator/references/plugin-marketplace-overview.md +0 -89
  1424. package/.opencode/skills/skill-creator/references/plugin-marketplace-schema.md +0 -93
  1425. package/.opencode/skills/skill-creator/references/plugin-marketplace-sources.md +0 -103
  1426. package/.opencode/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +0 -76
  1427. package/.opencode/skills/skill-creator/references/script-quality-criteria.md +0 -106
  1428. package/.opencode/skills/skill-creator/references/skill-anatomy-and-requirements.md +0 -76
  1429. package/.opencode/skills/skill-creator/references/skill-creation-workflow.md +0 -95
  1430. package/.opencode/skills/skill-creator/references/skill-design-patterns.md +0 -75
  1431. package/.opencode/skills/skill-creator/references/skillmark-benchmark-criteria.md +0 -102
  1432. package/.opencode/skills/skill-creator/references/structure-organization-criteria.md +0 -114
  1433. package/.opencode/skills/skill-creator/references/testing-and-iteration.md +0 -78
  1434. package/.opencode/skills/skill-creator/references/token-efficiency-criteria.md +0 -74
  1435. package/.opencode/skills/skill-creator/references/troubleshooting-guide.md +0 -80
  1436. package/.opencode/skills/skill-creator/references/validation-checklist.md +0 -83
  1437. package/.opencode/skills/skill-creator/references/writing-effective-instructions.md +0 -88
  1438. package/.opencode/skills/skill-creator/references/yaml-frontmatter-reference.md +0 -91
  1439. package/.opencode/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
  1440. package/.opencode/skills/skill-creator/scripts/debug.zip +0 -0
  1441. package/.opencode/skills/skill-creator/scripts/encoding_utils.py +0 -36
  1442. package/.opencode/skills/skill-creator/scripts/generate_report.py +0 -326
  1443. package/.opencode/skills/skill-creator/scripts/improve_description.py +0 -248
  1444. package/.opencode/skills/skill-creator/scripts/init_skill.py +0 -308
  1445. package/.opencode/skills/skill-creator/scripts/package_skill.py +0 -115
  1446. package/.opencode/skills/skill-creator/scripts/quick_validate.py +0 -69
  1447. package/.opencode/skills/skill-creator/scripts/run_eval.py +0 -310
  1448. package/.opencode/skills/skill-creator/scripts/run_loop.py +0 -332
  1449. package/.opencode/skills/skill-creator/scripts/utils.py +0 -47
  1450. package/.opencode/skills/slides/SKILL.md +0 -42
  1451. package/.opencode/skills/slides/references/copywriting-formulas.md +0 -84
  1452. package/.opencode/skills/slides/references/create.md +0 -4
  1453. package/.opencode/skills/slides/references/html-template.md +0 -295
  1454. package/.opencode/skills/slides/references/layout-patterns.md +0 -137
  1455. package/.opencode/skills/slides/references/slide-strategies.md +0 -94
  1456. package/.opencode/skills/social/SKILL.md +0 -75
  1457. package/.opencode/skills/social/references/engagement-templates.md +0 -58
  1458. package/.opencode/skills/social/references/facebook-workflow.md +0 -175
  1459. package/.opencode/skills/social/references/hook-writing.md +0 -190
  1460. package/.opencode/skills/social/references/linkedin-workflow.md +0 -162
  1461. package/.opencode/skills/social/references/platform-specs.md +0 -58
  1462. package/.opencode/skills/social/references/posting-best-practices.md +0 -61
  1463. package/.opencode/skills/social/references/rate-limits-errors.md +0 -191
  1464. package/.opencode/skills/social/references/schedule.md +0 -50
  1465. package/.opencode/skills/social/references/thread-templates.md +0 -72
  1466. package/.opencode/skills/social/references/threads-workflow.md +0 -198
  1467. package/.opencode/skills/social/references/tiktok-workflow.md +0 -194
  1468. package/.opencode/skills/social/references/unified-api-services.md +0 -153
  1469. package/.opencode/skills/social/references/x-twitter-workflow.md +0 -111
  1470. package/.opencode/skills/social/references/youtube-workflow.md +0 -179
  1471. package/.opencode/skills/social/scripts/schedule-post.js +0 -222
  1472. package/.opencode/skills/social/scripts/validate-post-content.js +0 -195
  1473. package/.opencode/skills/stitch/SKILL.md +0 -171
  1474. package/.opencode/skills/stitch/data/mcp-config-snippet.json +0 -11
  1475. package/.opencode/skills/stitch/references/design-to-code-pipeline.md +0 -128
  1476. package/.opencode/skills/stitch/references/quota-management.md +0 -64
  1477. package/.opencode/skills/stitch/references/stitch-mcp-setup.md +0 -95
  1478. package/.opencode/skills/stitch/references/stitch-sdk-api.md +0 -136
  1479. package/.opencode/skills/stitch/scripts/package.json +0 -17
  1480. package/.opencode/skills/stitch/scripts/stitch-export.ts +0 -173
  1481. package/.opencode/skills/stitch/scripts/stitch-generate.ts +0 -182
  1482. package/.opencode/skills/stitch/scripts/stitch-quota.ts +0 -123
  1483. package/.opencode/skills/storage/SKILL.md +0 -93
  1484. package/.opencode/skills/storage/scripts/s3-client.cjs +0 -357
  1485. package/.opencode/skills/tanstack/SKILL.md +0 -144
  1486. package/.opencode/skills/tanstack/references/tanstack-ai.md +0 -97
  1487. package/.opencode/skills/tanstack/references/tanstack-form.md +0 -125
  1488. package/.opencode/skills/tanstack/references/tanstack-start.md +0 -100
  1489. package/.opencode/skills/team/SKILL.md +0 -361
  1490. package/.opencode/skills/team/references/agent-teams-controls-and-modes.md +0 -129
  1491. package/.opencode/skills/team/references/agent-teams-examples-and-best-practices.md +0 -220
  1492. package/.opencode/skills/team/references/agent-teams-official-docs.md +0 -221
  1493. package/.opencode/skills/template-skill/SKILL.md +0 -9
  1494. package/.opencode/skills/test/SKILL.md +0 -40
  1495. package/.opencode/skills/test/references/report-format.md +0 -58
  1496. package/.opencode/skills/test/references/test-execution-workflow.md +0 -103
  1497. package/.opencode/skills/test/references/ui-testing-workflow.md +0 -65
  1498. package/.opencode/skills/test/references/ui.md +0 -87
  1499. package/.opencode/skills/test/references/workflow.md +0 -102
  1500. package/.opencode/skills/test/scripts/scan-components.py +0 -281
  1501. package/.opencode/skills/threejs/SKILL.md +0 -144
  1502. package/.opencode/skills/threejs/data/api-reference.csv +0 -61
  1503. package/.opencode/skills/threejs/data/categories.csv +0 -14
  1504. package/.opencode/skills/threejs/data/examples-all.csv +0 -557
  1505. package/.opencode/skills/threejs/data/use-cases.csv +0 -21
  1506. package/.opencode/skills/threejs/references/00-fundamentals.md +0 -487
  1507. package/.opencode/skills/threejs/references/01-getting-started.md +0 -177
  1508. package/.opencode/skills/threejs/references/02-loaders.md +0 -169
  1509. package/.opencode/skills/threejs/references/03-textures.md +0 -170
  1510. package/.opencode/skills/threejs/references/04-cameras.md +0 -195
  1511. package/.opencode/skills/threejs/references/05-lights.md +0 -183
  1512. package/.opencode/skills/threejs/references/06-animations.md +0 -214
  1513. package/.opencode/skills/threejs/references/07-math.md +0 -260
  1514. package/.opencode/skills/threejs/references/08-interaction.md +0 -267
  1515. package/.opencode/skills/threejs/references/09-postprocessing.md +0 -240
  1516. package/.opencode/skills/threejs/references/10-controls.md +0 -259
  1517. package/.opencode/skills/threejs/references/11-materials-advanced.md +0 -270
  1518. package/.opencode/skills/threejs/references/11-materials.md +0 -519
  1519. package/.opencode/skills/threejs/references/12-performance.md +0 -269
  1520. package/.opencode/skills/threejs/references/13-node-materials.md +0 -298
  1521. package/.opencode/skills/threejs/references/14-physics-vr.md +0 -304
  1522. package/.opencode/skills/threejs/references/15-specialized-loaders.md +0 -333
  1523. package/.opencode/skills/threejs/references/16-webgpu.md +0 -302
  1524. package/.opencode/skills/threejs/references/17-shader.md +0 -641
  1525. package/.opencode/skills/threejs/references/18-geometry.md +0 -547
  1526. package/.opencode/skills/threejs/scripts/core.py +0 -236
  1527. package/.opencode/skills/threejs/scripts/extract_examples.py +0 -688
  1528. package/.opencode/skills/threejs/scripts/generate_csv_from_json.py +0 -135
  1529. package/.opencode/skills/threejs/scripts/search.py +0 -77
  1530. package/.opencode/skills/ui-styling/LICENSE.txt +0 -202
  1531. package/.opencode/skills/ui-styling/SKILL.md +0 -324
  1532. package/.opencode/skills/ui-styling/canvas-fonts/ArsenalSC-OFL.txt +0 -93
  1533. package/.opencode/skills/ui-styling/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  1534. package/.opencode/skills/ui-styling/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  1535. package/.opencode/skills/ui-styling/canvas-fonts/BigShoulders-OFL.txt +0 -93
  1536. package/.opencode/skills/ui-styling/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  1537. package/.opencode/skills/ui-styling/canvas-fonts/Boldonse-OFL.txt +0 -93
  1538. package/.opencode/skills/ui-styling/canvas-fonts/Boldonse-Regular.ttf +0 -0
  1539. package/.opencode/skills/ui-styling/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  1540. package/.opencode/skills/ui-styling/canvas-fonts/BricolageGrotesque-OFL.txt +0 -93
  1541. package/.opencode/skills/ui-styling/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  1542. package/.opencode/skills/ui-styling/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  1543. package/.opencode/skills/ui-styling/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  1544. package/.opencode/skills/ui-styling/canvas-fonts/CrimsonPro-OFL.txt +0 -93
  1545. package/.opencode/skills/ui-styling/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  1546. package/.opencode/skills/ui-styling/canvas-fonts/DMMono-OFL.txt +0 -93
  1547. package/.opencode/skills/ui-styling/canvas-fonts/DMMono-Regular.ttf +0 -0
  1548. package/.opencode/skills/ui-styling/canvas-fonts/EricaOne-OFL.txt +0 -94
  1549. package/.opencode/skills/ui-styling/canvas-fonts/EricaOne-Regular.ttf +0 -0
  1550. package/.opencode/skills/ui-styling/canvas-fonts/GeistMono-Bold.ttf +0 -0
  1551. package/.opencode/skills/ui-styling/canvas-fonts/GeistMono-OFL.txt +0 -93
  1552. package/.opencode/skills/ui-styling/canvas-fonts/GeistMono-Regular.ttf +0 -0
  1553. package/.opencode/skills/ui-styling/canvas-fonts/Gloock-OFL.txt +0 -93
  1554. package/.opencode/skills/ui-styling/canvas-fonts/Gloock-Regular.ttf +0 -0
  1555. package/.opencode/skills/ui-styling/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  1556. package/.opencode/skills/ui-styling/canvas-fonts/IBMPlexMono-OFL.txt +0 -93
  1557. package/.opencode/skills/ui-styling/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  1558. package/.opencode/skills/ui-styling/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  1559. package/.opencode/skills/ui-styling/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  1560. package/.opencode/skills/ui-styling/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  1561. package/.opencode/skills/ui-styling/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  1562. package/.opencode/skills/ui-styling/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  1563. package/.opencode/skills/ui-styling/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  1564. package/.opencode/skills/ui-styling/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  1565. package/.opencode/skills/ui-styling/canvas-fonts/InstrumentSans-OFL.txt +0 -93
  1566. package/.opencode/skills/ui-styling/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  1567. package/.opencode/skills/ui-styling/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  1568. package/.opencode/skills/ui-styling/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  1569. package/.opencode/skills/ui-styling/canvas-fonts/Italiana-OFL.txt +0 -93
  1570. package/.opencode/skills/ui-styling/canvas-fonts/Italiana-Regular.ttf +0 -0
  1571. package/.opencode/skills/ui-styling/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  1572. package/.opencode/skills/ui-styling/canvas-fonts/JetBrainsMono-OFL.txt +0 -93
  1573. package/.opencode/skills/ui-styling/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  1574. package/.opencode/skills/ui-styling/canvas-fonts/Jura-Light.ttf +0 -0
  1575. package/.opencode/skills/ui-styling/canvas-fonts/Jura-Medium.ttf +0 -0
  1576. package/.opencode/skills/ui-styling/canvas-fonts/Jura-OFL.txt +0 -93
  1577. package/.opencode/skills/ui-styling/canvas-fonts/LibreBaskerville-OFL.txt +0 -93
  1578. package/.opencode/skills/ui-styling/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  1579. package/.opencode/skills/ui-styling/canvas-fonts/Lora-Bold.ttf +0 -0
  1580. package/.opencode/skills/ui-styling/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  1581. package/.opencode/skills/ui-styling/canvas-fonts/Lora-Italic.ttf +0 -0
  1582. package/.opencode/skills/ui-styling/canvas-fonts/Lora-OFL.txt +0 -93
  1583. package/.opencode/skills/ui-styling/canvas-fonts/Lora-Regular.ttf +0 -0
  1584. package/.opencode/skills/ui-styling/canvas-fonts/NationalPark-Bold.ttf +0 -0
  1585. package/.opencode/skills/ui-styling/canvas-fonts/NationalPark-OFL.txt +0 -93
  1586. package/.opencode/skills/ui-styling/canvas-fonts/NationalPark-Regular.ttf +0 -0
  1587. package/.opencode/skills/ui-styling/canvas-fonts/NothingYouCouldDo-OFL.txt +0 -93
  1588. package/.opencode/skills/ui-styling/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  1589. package/.opencode/skills/ui-styling/canvas-fonts/Outfit-Bold.ttf +0 -0
  1590. package/.opencode/skills/ui-styling/canvas-fonts/Outfit-OFL.txt +0 -93
  1591. package/.opencode/skills/ui-styling/canvas-fonts/Outfit-Regular.ttf +0 -0
  1592. package/.opencode/skills/ui-styling/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  1593. package/.opencode/skills/ui-styling/canvas-fonts/PixelifySans-OFL.txt +0 -93
  1594. package/.opencode/skills/ui-styling/canvas-fonts/PoiretOne-OFL.txt +0 -93
  1595. package/.opencode/skills/ui-styling/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  1596. package/.opencode/skills/ui-styling/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  1597. package/.opencode/skills/ui-styling/canvas-fonts/RedHatMono-OFL.txt +0 -93
  1598. package/.opencode/skills/ui-styling/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  1599. package/.opencode/skills/ui-styling/canvas-fonts/Silkscreen-OFL.txt +0 -93
  1600. package/.opencode/skills/ui-styling/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  1601. package/.opencode/skills/ui-styling/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  1602. package/.opencode/skills/ui-styling/canvas-fonts/SmoochSans-OFL.txt +0 -93
  1603. package/.opencode/skills/ui-styling/canvas-fonts/Tektur-Medium.ttf +0 -0
  1604. package/.opencode/skills/ui-styling/canvas-fonts/Tektur-OFL.txt +0 -93
  1605. package/.opencode/skills/ui-styling/canvas-fonts/Tektur-Regular.ttf +0 -0
  1606. package/.opencode/skills/ui-styling/canvas-fonts/WorkSans-Bold.ttf +0 -0
  1607. package/.opencode/skills/ui-styling/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  1608. package/.opencode/skills/ui-styling/canvas-fonts/WorkSans-Italic.ttf +0 -0
  1609. package/.opencode/skills/ui-styling/canvas-fonts/WorkSans-OFL.txt +0 -93
  1610. package/.opencode/skills/ui-styling/canvas-fonts/WorkSans-Regular.ttf +0 -0
  1611. package/.opencode/skills/ui-styling/canvas-fonts/YoungSerif-OFL.txt +0 -93
  1612. package/.opencode/skills/ui-styling/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  1613. package/.opencode/skills/ui-styling/references/canvas-design-system.md +0 -320
  1614. package/.opencode/skills/ui-styling/references/shadcn-accessibility.md +0 -471
  1615. package/.opencode/skills/ui-styling/references/shadcn-components.md +0 -424
  1616. package/.opencode/skills/ui-styling/references/shadcn-theming.md +0 -373
  1617. package/.opencode/skills/ui-styling/references/tailwind-customization.md +0 -483
  1618. package/.opencode/skills/ui-styling/references/tailwind-responsive.md +0 -382
  1619. package/.opencode/skills/ui-styling/references/tailwind-utilities.md +0 -455
  1620. package/.opencode/skills/ui-styling/scripts/.coverage +0 -0
  1621. package/.opencode/skills/ui-styling/scripts/requirements.txt +0 -17
  1622. package/.opencode/skills/ui-styling/scripts/shadcn_add.py +0 -292
  1623. package/.opencode/skills/ui-styling/scripts/tailwind_config_gen.py +0 -456
  1624. package/.opencode/skills/ui-ux-pro-max/SKILL.md +0 -662
  1625. package/.opencode/skills/ui-ux-pro-max/data/_sync_all.py +0 -414
  1626. package/.opencode/skills/ui-ux-pro-max/data/app-interface.csv +0 -31
  1627. package/.opencode/skills/ui-ux-pro-max/data/charts.csv +0 -26
  1628. package/.opencode/skills/ui-ux-pro-max/data/colors.csv +0 -162
  1629. package/.opencode/skills/ui-ux-pro-max/data/design.csv +0 -1776
  1630. package/.opencode/skills/ui-ux-pro-max/data/draft.csv +0 -1779
  1631. package/.opencode/skills/ui-ux-pro-max/data/google-fonts.csv +0 -1924
  1632. package/.opencode/skills/ui-ux-pro-max/data/icons.csv +0 -106
  1633. package/.opencode/skills/ui-ux-pro-max/data/landing.csv +0 -35
  1634. package/.opencode/skills/ui-ux-pro-max/data/products.csv +0 -162
  1635. package/.opencode/skills/ui-ux-pro-max/data/react-performance.csv +0 -45
  1636. package/.opencode/skills/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
  1637. package/.opencode/skills/ui-ux-pro-max/data/styles.csv +0 -85
  1638. package/.opencode/skills/ui-ux-pro-max/data/typography.csv +0 -74
  1639. package/.opencode/skills/ui-ux-pro-max/data/ui-reasoning.csv +0 -162
  1640. package/.opencode/skills/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
  1641. package/.opencode/skills/ui-ux-pro-max/scripts/core.py +0 -247
  1642. package/.opencode/skills/ui-ux-pro-max/scripts/design_system.py +0 -1067
  1643. package/.opencode/skills/ui-ux-pro-max/scripts/search.py +0 -114
  1644. package/.opencode/skills/use-mcp/SKILL.md +0 -39
  1645. package/.opencode/skills/video/SKILL.md +0 -72
  1646. package/.opencode/skills/video/references/audio-directive-guide.md +0 -274
  1647. package/.opencode/skills/video/references/create.md +0 -322
  1648. package/.opencode/skills/video/references/production-workflow.md +0 -135
  1649. package/.opencode/skills/video/references/quality-review-workflow.md +0 -566
  1650. package/.opencode/skills/video/references/script-create.md +0 -391
  1651. package/.opencode/skills/video/references/script-templates.md +0 -107
  1652. package/.opencode/skills/video/references/storyboard-create.md +0 -210
  1653. package/.opencode/skills/video/references/storyboard-format.md +0 -255
  1654. package/.opencode/skills/video/references/thumbnail-design-guide.md +0 -367
  1655. package/.opencode/skills/video/references/veo-prompt-guide.md +0 -360
  1656. package/.opencode/skills/video/references/video-art-directions.md +0 -64
  1657. package/.opencode/skills/video/references/video-optimization.md +0 -95
  1658. package/.opencode/skills/video/references/video-seo-optimization.md +0 -399
  1659. package/.opencode/skills/video/references/video-types-specs.md +0 -66
  1660. package/.opencode/skills/video/scripts/analyze-video.cjs +0 -321
  1661. package/.opencode/skills/video/scripts/create-storyboard.cjs +0 -476
  1662. package/.opencode/skills/video/scripts/extract-captions.cjs +0 -355
  1663. package/.opencode/skills/video/scripts/generate-video.cjs +0 -331
  1664. package/.opencode/skills/video/scripts/optimize-for-platform.cjs +0 -428
  1665. package/.opencode/skills/video/templates/explainer.json +0 -73
  1666. package/.opencode/skills/video/templates/product-demo.json +0 -69
  1667. package/.opencode/skills/video/templates/short-form.json +0 -111
  1668. package/.opencode/skills/video/templates/testimonial.json +0 -73
  1669. package/.opencode/skills/watzup/SKILL.md +0 -13
  1670. package/.opencode/skills/web-design-guidelines/SKILL.md +0 -39
  1671. package/.opencode/skills/web-frameworks/SKILL.md +0 -327
  1672. package/.opencode/skills/web-frameworks/references/nextjs-app-router.md +0 -465
  1673. package/.opencode/skills/web-frameworks/references/nextjs-data-fetching.md +0 -459
  1674. package/.opencode/skills/web-frameworks/references/nextjs-optimization.md +0 -511
  1675. package/.opencode/skills/web-frameworks/references/nextjs-server-components.md +0 -495
  1676. package/.opencode/skills/web-frameworks/references/remix-icon-integration.md +0 -603
  1677. package/.opencode/skills/web-frameworks/references/turborepo-caching.md +0 -551
  1678. package/.opencode/skills/web-frameworks/references/turborepo-pipelines.md +0 -517
  1679. package/.opencode/skills/web-frameworks/references/turborepo-setup.md +0 -542
  1680. package/.opencode/skills/web-frameworks/scripts/.coverage +0 -0
  1681. package/.opencode/skills/web-frameworks/scripts/__init__.py +0 -0
  1682. package/.opencode/skills/web-frameworks/scripts/nextjs_init.py +0 -547
  1683. package/.opencode/skills/web-frameworks/scripts/requirements.txt +0 -16
  1684. package/.opencode/skills/web-frameworks/scripts/turborepo_migrate.py +0 -394
  1685. package/.opencode/skills/web-testing/SKILL.md +0 -99
  1686. package/.opencode/skills/web-testing/references/accessibility-testing.md +0 -84
  1687. package/.opencode/skills/web-testing/references/api-testing.md +0 -78
  1688. package/.opencode/skills/web-testing/references/ci-cd-testing-workflows.md +0 -121
  1689. package/.opencode/skills/web-testing/references/component-testing.md +0 -94
  1690. package/.opencode/skills/web-testing/references/contract-testing.md +0 -146
  1691. package/.opencode/skills/web-testing/references/cross-browser-checklist.md +0 -72
  1692. package/.opencode/skills/web-testing/references/database-testing.md +0 -139
  1693. package/.opencode/skills/web-testing/references/e2e-testing-playwright.md +0 -119
  1694. package/.opencode/skills/web-testing/references/functional-testing-checklist.md +0 -88
  1695. package/.opencode/skills/web-testing/references/interactive-testing-patterns.md +0 -89
  1696. package/.opencode/skills/web-testing/references/load-testing-k6.md +0 -93
  1697. package/.opencode/skills/web-testing/references/mobile-gesture-testing.md +0 -85
  1698. package/.opencode/skills/web-testing/references/performance-core-web-vitals.md +0 -124
  1699. package/.opencode/skills/web-testing/references/playwright-component-testing.md +0 -115
  1700. package/.opencode/skills/web-testing/references/pre-release-checklist.md +0 -75
  1701. package/.opencode/skills/web-testing/references/security-checklists.md +0 -81
  1702. package/.opencode/skills/web-testing/references/security-testing-overview.md +0 -92
  1703. package/.opencode/skills/web-testing/references/shadow-dom-testing.md +0 -70
  1704. package/.opencode/skills/web-testing/references/test-data-management.md +0 -131
  1705. package/.opencode/skills/web-testing/references/test-flakiness-mitigation.md +0 -86
  1706. package/.opencode/skills/web-testing/references/testing-pyramid-strategy.md +0 -76
  1707. package/.opencode/skills/web-testing/references/unit-integration-testing.md +0 -138
  1708. package/.opencode/skills/web-testing/references/visual-regression.md +0 -92
  1709. package/.opencode/skills/web-testing/references/vulnerability-payloads.md +0 -93
  1710. package/.opencode/skills/web-testing/scripts/analyze-test-results.js +0 -280
  1711. package/.opencode/skills/web-testing/scripts/init-playwright.js +0 -233
  1712. package/.opencode/skills/worktree/SKILL.md +0 -130
  1713. package/.opencode/skills/worktree/scripts/worktree.cjs +0 -979
  1714. package/.opencode/skills/worktree/scripts/worktree.test.cjs +0 -857
  1715. package/.opencode/skills/write/SKILL.md +0 -28
  1716. package/.opencode/skills/write/references/audit.md +0 -93
  1717. package/.opencode/skills/write/references/blog-youtube.md +0 -164
  1718. package/.opencode/skills/write/references/blog.md +0 -95
  1719. package/.opencode/skills/write/references/cro.md +0 -38
  1720. package/.opencode/skills/write/references/enhance.md +0 -9
  1721. package/.opencode/skills/write/references/fast.md +0 -8
  1722. package/.opencode/skills/write/references/formula.md +0 -112
  1723. package/.opencode/skills/write/references/good.md +0 -29
  1724. package/.opencode/skills/write/references/publish.md +0 -70
  1725. package/.opencode/skills/youtube/SKILL.md +0 -50
  1726. package/.opencode/skills/youtube/references/api-content.md +0 -96
  1727. package/.opencode/skills/youtube/references/api-media.md +0 -66
  1728. package/.opencode/skills/youtube/references/blog.md +0 -132
  1729. package/.opencode/skills/youtube/references/infographic.md +0 -152
  1730. package/.opencode/skills/youtube/references/social.md +0 -165
  1731. package/.opencode/skills/youtube/scripts/test_vidcap.py +0 -172
  1732. package/.opencode/skills/youtube/scripts/vidcap.py +0 -302
  1733. package/.opencode/skills/youtube-thumbnail-design/SKILL.md +0 -186
  1734. package/.opencode/skills/youtube-thumbnail-design/data/niches.csv +0 -13
  1735. package/.opencode/skills/youtube-thumbnail-design/data/styles.csv +0 -18
  1736. package/.opencode/skills/youtube-thumbnail-design/references/thumbnail-styles.md +0 -170
  1737. package/.opencode/skills/youtube-thumbnail-design/scripts/core.py +0 -150
  1738. package/.opencode/skills/youtube-thumbnail-design/scripts/generate.py +0 -441
  1739. package/.opencode/skills/youtube-thumbnail-design/scripts/search.py +0 -115
  1740. package/.opencode/workflows/analytics-workflow.md +0 -264
  1741. package/.opencode/workflows/campaign-workflow.md +0 -228
  1742. package/.opencode/workflows/content-workflow.md +0 -275
  1743. package/.opencode/workflows/development-rules.md +0 -42
  1744. package/.opencode/workflows/documentation-management.md +0 -121
  1745. package/.opencode/workflows/marketing-workflow.md +0 -198
  1746. package/.opencode/workflows/orchestration-protocol.md +0 -16
  1747. package/.opencode/workflows/primary-workflow.md +0 -45
  1748. package/.opencode/workflows/sales-workflow.md +0 -193
  1749. package/.opencode/workflows/seo-workflow.md +0 -248
  1750. package/dist/web/assets/chat-tab-B3ut-s33.js +0 -10
  1751. package/dist/web/assets/index-BFXOaZuI.js +0 -30
  1752. package/dist/web/assets/index-Dxq-L2b4.css +0 -2
  1753. package/dist/web/assets/keybindings-store-A-4OusX7.js +0 -1
  1754. package/dist/web/assets/markdown-renderer-Br_NykOI.js +0 -69
@@ -0,0 +1,10 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-client-BfBM3I7n.js","assets/chunk-CFjPhJqf.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import"./react-dom-Bpkvzu3U.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./arrow-up-BYhx9ckd.js";import{n as i,t as a}from"./x-D2_KzIET.js";import{t as o}from"./chevron-right-4zq1jPv6.js";import{n as s,t as c}from"./markdown-renderer-CYs_lrjt.js";import{t as l}from"./columns-2-BoZAN-iw.js";import{t as u}from"./square-oPKIkJiw.js";import{t as d}from"./tag-CXMT0QB6.js";import{t as f}from"./preload-helper-Bf_JiD2A.js";import{t as p}from"./jsx-runtime-kMwlnEGE.js";import"./dist-DIV6WgAG.js";import{n as m,r as h,t as g}from"./utils-BNytJOb1.js";import{i as _,r as v,t as y}from"./api-client-BfBM3I7n.js";import{a as b,c as x,f as ee,g as S,i as C,l as w,m as T,o as E,p as D,r as O,s as k,t as A,u as j}from"./api-settings-Bn-bIxD1.js";import{$ as M,A as N,At as P,B as te,C as F,Ct as I,D as L,Dt as R,E as z,Ft as B,It as V,J as H,K as U,Lt as W,M as G,Mt as ne,O as K,Ot as q,Pt as re,Q as ie,T as J,Tt as Y,X,Y as ae,Z as oe,_t as se,bt as ce,c as le,ct as ue,d as de,dt as fe,et as pe,f as me,ft as he,h as ge,ht as _e,i as ve,it as ye,j as be,jt as xe,k as Se,l as Ce,m as we,nt as Te,ot as Ee,p as De,pt as Z,q as Oe,r as ke,rt as Ae,s as je,st as Me,t as Ne,tt as Pe,u as Fe,ut as Ie,vt as Le,wt as Re}from"./index-BDAqXmpQ.js";import"./chunk-GEFDOKGD-D-pKjlVd.js";import"./src-BqX54PbV.js";import"./chunk-7R4GIKGN-Dv-4cAYn.js";import"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import"./chunk-PU5JKC2W-ek7k4QVB.js";import"./chunk-MX3YWQON-BpS_PtKp.js";import"./chunk-YBOYWFTD-rQG3QH5s.js";import"./chunk-PQ6SQG4A-TF58UVMU.js";import"./chunk-KYZI473N-Bb0MCaIO.js";import"./chunk-O4XLMI2P-nDhi_cVu.js";import"./chunk-GLR3WWYH-DKikpoJM.js";import"./chunk-XPW4576I-BPQQBakK.js";var ze=n(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Be=n(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ve=n(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),He=n(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ue=n(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),We=n(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Ge=n(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Ke=n(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),qe=n(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),Je=n(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Ye=n(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),Xe=n(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Ze=n(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Qe=n(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),$e=n(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),et=n(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),tt=n(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),nt=n(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),rt=n(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Q=e(t(),1);function it({url:e,onMessage:t,autoConnect:n=!0}){let r=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let i=new Ne(e);return r.current=i,t&&i.onMessage(t),n&&i.connect(),()=>{i.disconnect(),r.current=null}},[e,n]),{send:(0,Q.useCallback)(e=>{r.current?.send(e)},[]),connect:(0,Q.useCallback)(()=>{r.current?.connect()},[]),disconnect:(0,Q.useCallback)(()=>{r.current?.disconnect()},[])}}var at=null;function ot(){return at||=new AudioContext,at}function st(e,t,n,r,i=`sine`){let a=ot(),o=a.createOscillator(),s=a.createGain();o.type=i,o.frequency.value=e,s.gain.setValueAtTime(r,n),s.gain.exponentialRampToValueAtTime(.001,n+t),o.connect(s),s.connect(a.destination),o.start(n),o.stop(n+t)}function ct(){let e=ot().currentTime;st(523,.15,e,.15),st(659,.2,e+.12,.15)}function lt(){let e=ot().currentTime;st(880,.12,e,.18,`square`),st(698,.12,e+.15,.18,`square`),st(880,.15,e+.3,.15,`square`)}function ut(){let e=ot().currentTime;st(440,.12,e,.12),st(523,.12,e+.1,.12),st(659,.18,e+.2,.12)}var dt={done:ct,approval_request:lt,question:ut};function ft(e){try{dt[e]?.()}catch{}}var pt={hasTeams:!1,teamNames:[],messageCount:0,unreadCount:0};function mt(e){if(document.hidden)return!1;let{panels:t,focusedPanelId:n}=H.getState(),r=t[n];if(!r)return!1;let i=r.tabs.find(e=>e.id===r.activeTabId);return i?.type===`chat`&&i.metadata?.sessionId===e}function ht(e,t=`claude`,n=``){let[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(`idle`),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[ee,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(``),O=(0,Q.useRef)([]),k=(0,Q.useRef)(null),A=(0,Q.useRef)(`idle`),j=(0,Q.useRef)(null),M=(0,Q.useRef)(()=>{}),N=(0,Q.useRef)(null),P=(0,Q.useRef)(e);P.current=e;let F=(0,Q.useRef)(n);F.current=n;let I=(0,Q.useRef)(null),L=(0,Q.useRef)({teamNames:new Set,messages:[]}),R=(0,Q.useRef)(0),[z,B]=(0,Q.useState)(pt),[V,U]=(0,Q.useState)([]),W=(0,Q.useCallback)(()=>{let e=L.current;B({hasTeams:e.teamNames.size>0,teamNames:Array.from(e.teamNames),messageCount:e.messages.length,unreadCount:R.current}),U([...e.messages])},[]),G=(0,Q.useCallback)(()=>{R.current=0,W()},[W]),ne=s!==`idle`,K=(0,Q.useCallback)((e,t)=>{let n=O.current.findIndex(e=>e.type===`tool_use`&&(e.tool===`Agent`||e.tool===`Task`)&&e.toolUseId===t);if(n===-1)return!1;let r=O.current[n];if(r.type!==`tool_use`)return!1;let i=[...r.children??[],e];return O.current[n]={...r,children:i},!0},[]),q=(0,Q.useCallback)(()=>{let e=D.current,t=[...O.current],n=k.current;i(r=>{let i=r[r.length-1];return i?.role===`assistant`&&!i.id.startsWith(`final-`)?[...r.slice(0,-1),{...i,content:e,events:t,...n}]:[...r,{id:`streaming-${Date.now()}`,role:`assistant`,content:e,events:t,timestamp:new Date().toISOString(),...n}]})},[]),re=(0,Q.useCallback)(e=>{let t=e,n=t?.type;if(n)switch(n){case`account_info`:k.current={accountId:t.accountId,accountLabel:t.accountLabel},S(null);break;case`account_retry`:t.accountId&&t.accountLabel&&(k.current={accountId:t.accountId,accountLabel:t.accountLabel}),O.current.push(t),q();break;case`status_update`:{let e=t.accountLabel?` (${t.accountLabel})`:``;S(`${t.message}${e}`);break}case`text`:{let e=t.parentToolUseId;if(e&&K(t,e)){q();break}D.current+=t.content,O.current.push(t),q();break}case`thinking`:{let e=t.parentToolUseId;if(e&&K(t,e)){q();break}O.current.push(t),q();break}case`tool_use`:{let e=t.parentToolUseId;if(e&&K(t,e)){q();break}O.current.push(t),q();break}case`tool_result`:{let e=t.parentToolUseId;if(e&&K(t,e)){q();break}O.current.push(t),q();break}case`approval_request`:if(O.current.push(t),m({requestId:t.requestId,tool:t.tool,input:t.input}),P.current&&!mt(P.current)){let e=t.tool===`AskUserQuestion`?`question`:`approval_request`;te.getState().addNotification(P.current,e,F.current),ft(e);let n=P.current,r=t.tool===`AskUserQuestion`;I.current=X[r?`info`:`warning`](r?`AI has a question`:`${t.tool} needs permission`,{description:F.current||`Session ${n.slice(0,8)}`,duration:1/0,action:{label:`Go to session`,onClick:()=>{let{panels:e}=H.getState();for(let[t,r]of Object.entries(e)){let e=r.tabs.find(e=>e.metadata?.sessionId===n);if(e){H.getState().setActiveTab(e.id,t);break}}}}})}break;case`error`:{O.current.push(t);let e=[...O.current];i(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,events:e}]:[...n,{id:`error-${Date.now()}`,role:`system`,content:t.message,events:[t],timestamp:new Date().toISOString()}]});break}case`team_detected`:{let e=t.teamName;e&&(L.current.teamNames.add(e),y.get(`/api/teams/${encodeURIComponent(e)}`).then(e=>{if(e?.messages){let t=L.current.messages,n=e.messages.filter(e=>!t.some(t=>t.timestamp===e.timestamp&&t.from===e.from));t.push(...n),t.sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime())}W()}).catch(()=>{}),W());break}case`team_inbox`:{let e=t.messages;Array.isArray(e)&&(L.current.messages.push(...e),R.current+=e.length,W());break}case`team_updated`:W();break;case`done`:{if(A.current===`idle`)break;t.contextWindowPct!=null&&g(t.contextWindowPct),P.current&&!mt(P.current)&&(te.getState().addNotification(P.current,`done`,F.current),ft(`done`));let e=D.current,n=[...O.current],r=t.lastMessageUuid;i(t=>{let i=t[t.length-1];return i?.role===`assistant`?[...t.slice(0,-1),{...i,id:`final-${Date.now()}`,content:e||i.content,events:n.length>0?n:i.events,...r&&{sdkUuid:r}}]:t}),D.current=``,O.current=[],k.current=null,S(null);break}}},[K,q]),ie=(0,Q.useCallback)(e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type!==`ping`){if(t.type===`title_updated`){w(t.title??null);return}if(t.type===`compact_status`){let e=t.status;e===`compacting`?x(`compacting`):e===`done`&&(x(null),N.current?.());return}if(t.type===`phase_changed`){let e=t.phase;c(e),A.current=e,f(e===`connecting`?t.elapsed??0:0);return}if(t.type===`session_state`){E(!0);let e=t,n=e.phase;c(n),A.current=n,e.sessionTitle&&w(e.sessionTitle),e.pendingApproval&&m({requestId:e.pendingApproval.requestId,tool:e.pendingApproval.tool,input:e.pendingApproval.input}),n===`idle`&&(N.current?.(),u(!1));return}if(t.type===`turn_events`){let e=t.events;if(!e?.length){u(!1);return}i(e=>{let t=e.findLastIndex(e=>e.role===`user`);return t>=0?e.slice(0,t+1):e}),D.current=``,O.current=[],k.current=null;let n=0,r=()=>{let t=Math.min(n+100,e.length);for(let r=n;r<t;r++)re(e[r]);n=t,n<e.length?requestAnimationFrame(r):u(!1)};requestAnimationFrame(r);return}re(t)}},[re]),{send:J,connect:Y}=it({url:e&&n?`/ws/project/${encodeURIComponent(n)}/chat/${e}`:``,onMessage:ie,autoConnect:!!e&&!!n});M.current=J,(0,Q.useEffect)(()=>{let r=!1;return c(`idle`),A.current=`idle`,m(null),I.current!=null&&(X.dismiss(I.current),I.current=null),x(null),D.current=``,O.current=[],E(!1),L.current={teamNames:new Set,messages:[]},R.current=0,B(pt),U([]),e&&n?(o(!0),fetch(`${_(n)}/chat/sessions/${e}/messages?providerId=${t}`,{headers:{Authorization:`Bearer ${v()}`}}).then(e=>e.json()).then(e=>{r||A.current!==`idle`||(e.ok&&Array.isArray(e.data)&&e.data.length>0?i(e.data):i([]))}).catch(()=>{!r&&A.current===`idle`&&i([])}).finally(()=>{r||o(!1)})):i([]),()=>{r=!0}},[e,t,n]);let ae=(0,Q.useCallback)((e,t)=>{if(!e.trim())return;let n=A.current!==`idle`;if(n){let e=D.current,t=[...O.current];i(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,id:`final-${Date.now()}`,content:e||r.content,events:t.length>0?t:r.events}]:n})}i(t=>[...t,{id:`user-${Date.now()}`,role:`user`,content:e,timestamp:new Date().toISOString()}]),D.current=``,O.current=[],j.current=null,n?(c(`thinking`),A.current=`thinking`):(c(`initializing`),A.current=`initializing`),m(null),I.current!=null&&(X.dismiss(I.current),I.current=null),J(JSON.stringify({type:`message`,content:e,permissionMode:t?.permissionMode,priority:t?.priority,images:t?.images}))},[J]),oe=(0,Q.useCallback)((e,t,n)=>{if(J(JSON.stringify({type:`approval_response`,requestId:e,approved:t,data:n})),t&&n){let t=O.current.find(t=>t.type===`approval_request`&&t.requestId===e&&t.tool===`AskUserQuestion`);if(t){let e=t.input;e&&typeof e==`object`&&(e.answers=n)}i(e=>[...e])}m(null),I.current!=null&&(X.dismiss(I.current),I.current=null)},[J]),se=(0,Q.useCallback)(()=>{if(A.current===`idle`)return;J(JSON.stringify({type:`cancel`}));let e=D.current,t=[...O.current];i(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,id:`final-${Date.now()}`,content:e||r.content,events:t.length>0?t:r.events}]:n}),D.current=``,O.current=[],j.current=null,c(`idle`),A.current=`idle`,m(null),I.current!=null&&(X.dismiss(I.current),I.current=null)},[J]),ce=(0,Q.useCallback)(()=>{E(!1),u(!0),Y()},[Y]),le=(0,Q.useCallback)(()=>{!e||!n||(o(!0),fetch(`${_(n)}/chat/sessions/${e}/messages?providerId=${t}`,{headers:{Authorization:`Bearer ${v()}`}}).then(e=>e.json()).then(e=>{e.ok&&Array.isArray(e.data)&&e.data.length>0&&(i(e.data),D.current=``,O.current=[])}).catch(()=>{}).finally(()=>o(!1)))},[e,t,n]);return N.current=le,{messages:r,messagesLoading:a,isStreaming:ne,phase:s,isReconnecting:l,connectingElapsed:d,pendingApproval:p,contextWindowPct:h,compactStatus:b,statusMessage:ee,sessionTitle:C,teamActivity:z,teamMessages:V,markTeamRead:G,sendMessage:ae,respondToApproval:oe,cancelStreaming:se,reconnect:ce,refetchMessages:le,isConnected:T}}var gt=12e4;function _t(e,t=`claude`){let[n,r]=(0,Q.useState)({}),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(null),l=(0,Q.useCallback)((n=!1)=>{if(!e)return;a(!0);let i=n?`&refresh=1`:``;fetch(`${_(e)}/chat/usage?providerId=${t}${i}`,{headers:{Authorization:`Bearer ${v()}`}}).then(e=>e.json()).then(e=>{e.ok&&e.data&&(r(t=>({...t,...e.data})),e.data.lastFetchedAt&&s(e.data.lastFetchedAt))}).catch(()=>{}).finally(()=>a(!1))},[e,t]);return(0,Q.useEffect)(()=>(l(),c.current=setInterval(()=>l(),gt),()=>{c.current&&clearInterval(c.current)}),[l]),{usageInfo:n,usageLoading:i,lastFetchedAt:o,refreshUsage:(0,Q.useCallback)(()=>l(!0),[l])}}var vt={damping:.7,stiffness:.05,mass:1.25},yt=70,bt=1e3/60,xt=350,St=!1;globalThis.document?.addEventListener(`mousedown`,()=>{St=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{St=!1}),globalThis.document?.addEventListener(`click`,()=>{St=!1});var Ct=(e={})=>{let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(e.initial!==!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);s.current=e;let c=(0,Q.useCallback)(()=>{if(!St)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,Q.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,Q.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,Q.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){g.current&&(g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop)},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=yt}}},[]),f=(0,Q.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=Et(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/bt;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:Et(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,Q.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,Q.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;if(d.animation?.ignoreEscapes){d.scrollTop=r;return}i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0)},1)},[u,l,c,d]),h=(0,Q.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=wt(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=wt(e=>{if(d.resizeObserver?.disconnect(),!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=Et(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:xt})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function wt(e,t){let n=(0,Q.useCallback)(t=>(n.current=t,e(t)),t);return n}var Tt=new Map;function Et(...e){let t={...vt},n=!1;for(let r of e){if(r===`instant`){n=!0;continue}typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let r=JSON.stringify(t);return Tt.has(r)||Tt.set(r,Object.freeze(t)),n?`instant`:Tt.get(r)}var Dt=(0,Q.createContext)(null),Ot=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function kt({instance:e,children:t,resize:n,initial:r,mass:i,damping:a,stiffness:o,targetScrollTop:s,contextRef:c,...l}){let u=(0,Q.useRef)(null),d=Ct({mass:i,damping:a,stiffness:o,resize:n,initial:r,targetScrollTop:Q.useCallback((e,t)=>(y?.targetScrollTop??s)?.(e,t)??e,[s])}),{scrollRef:f,contentRef:p,scrollToBottom:m,stopScroll:h,isAtBottom:g,escapedFromLock:_,state:v}=e??d,y=(0,Q.useMemo)(()=>({scrollToBottom:m,stopScroll:h,scrollRef:f,isAtBottom:g,escapedFromLock:_,contentRef:p,state:v,get targetScrollTop(){return u.current},set targetScrollTop(e){u.current=e}}),[m,g,p,f,h,_,v]);return(0,Q.useImperativeHandle)(c,()=>y,[y]),Ot(()=>{f.current&&getComputedStyle(f.current).overflow===`visible`&&(f.current.style.overflow=`auto`)},[]),Q.createElement(Dt.Provider,{value:y},Q.createElement(`div`,{...l},typeof t==`function`?t(y):t))}(function(e){function t({children:e,scrollClassName:t,...n}){let r=At();return Q.createElement(`div`,{ref:r.scrollRef,style:{height:`100%`,width:`100%`,scrollbarGutter:`stable both-edges`},className:t},Q.createElement(`div`,{...n,ref:r.contentRef},typeof e==`function`?e(r):e))}e.Content=t})(kt||={});function At(){let e=(0,Q.useContext)(Dt);if(!e)throw Error(`use-stick-to-bottom component context must be used within a StickToBottom component`);return e}var $=p();function jt(e){let t=e.type===`approval_request`;return{toolName:e.type===`tool_use`?e.tool:t?e.tool??`Tool`:`Tool`,input:e.type===`tool_use`?e.input:t?e.input??{}:{}}}function Mt({tool:e,result:t,completed:n,projectName:r}){let[a,s]=(0,Q.useState)(!1);if(e.type===`error`)return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded bg-red-500/10 border border-red-500/20 px-2 py-1.5 text-xs text-red-400`,children:[(0,$.jsx)(xe,{className:`size-3`}),(0,$.jsx)(`span`,{children:e.message})]});let{toolName:c,input:l}=jt(e),u=t?.type===`tool_result`,d=u&&!!t.isError,f=c===`AskUserQuestion`&&!!l?.answers,p=(c===`Agent`||c===`Task`)&&e.type===`tool_use`,m=p?e.children:void 0,h=m&&m.length>0;return(0,$.jsxs)(`div`,{className:`rounded border text-xs ${p?`border-accent/30 bg-accent/5`:`border-border bg-background`}`,children:[(0,$.jsxs)(`button`,{onClick:()=>s(!a),className:`flex items-center gap-2 px-2 py-1.5 w-full text-left hover:bg-surface transition-colors min-w-0`,children:[a?(0,$.jsx)(i,{className:`size-3 shrink-0`}):(0,$.jsx)(o,{className:`size-3 shrink-0`}),d?(0,$.jsx)(Be,{className:`size-3 text-red-400 shrink-0`}):u||f||n?(0,$.jsx)(P,{className:`size-3 text-green-400 shrink-0`}):(0,$.jsx)(Z,{className:`size-3 text-yellow-400 shrink-0 animate-spin`}),(0,$.jsx)(`span`,{className:`truncate text-text-primary`,children:(0,$.jsx)(Nt,{name:c,input:l})}),h&&(0,$.jsxs)(`span`,{className:`ml-auto text-[10px] text-text-subtle shrink-0`,children:[m.length,` steps`]})]}),a&&(0,$.jsxs)(`div`,{className:`px-2 pb-2 space-y-1.5`,children:[(e.type===`tool_use`||e.type===`approval_request`)&&(0,$.jsx)(Pt,{name:c,input:l,projectName:r}),h&&(0,$.jsx)(Rt,{events:m,projectName:r}),u&&(0,$.jsx)(It,{toolName:c,output:t.output})]})]})}function Nt({name:e,input:t}){let n=e=>String(e??``);switch(e){case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:return(0,$.jsxs)($.Fragment,{children:[e,` `,(0,$.jsx)(`span`,{className:`text-text-subtle`,children:g(n(t.file_path))})]});case`Bash`:return(0,$.jsxs)($.Fragment,{children:[e,` `,(0,$.jsx)(`span`,{className:`font-mono text-text-subtle`,children:Bt(n(t.command),60)})]});case`Glob`:return(0,$.jsxs)($.Fragment,{children:[e,` `,(0,$.jsx)(`span`,{className:`font-mono text-text-subtle`,children:n(t.pattern)})]});case`Grep`:return(0,$.jsxs)($.Fragment,{children:[e,` `,(0,$.jsx)(`span`,{className:`font-mono text-text-subtle`,children:Bt(n(t.pattern),40)})]});case`WebSearch`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pe,{className:`size-3 inline`}),` `,e,` `,(0,$.jsx)(`span`,{className:`text-text-subtle`,children:Bt(n(t.query),50)})]});case`WebFetch`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_e,{className:`size-3 inline`}),` `,e,` `,(0,$.jsx)(`span`,{className:`text-text-subtle`,children:Bt(n(t.url),50)})]});case`ToolSearch`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pe,{className:`size-3 inline`}),` `,e,` `,(0,$.jsx)(`span`,{className:`text-text-subtle`,children:Bt(n(t.query),50)})]});case`Agent`:case`Task`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{className:`size-3 inline`}),` `,e,` `,(0,$.jsx)(`span`,{className:`text-text-subtle`,children:Bt(n(t.description||t.prompt),60)})]});case`TodoWrite`:{let n=Array.isArray(t.todos)?t.todos:[],r=n.filter(e=>e.status===`completed`).length;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qe,{className:`size-3 inline`}),` `,e,` `,(0,$.jsxs)(`span`,{className:`text-text-subtle`,children:[r,`/`,n.length,` done`]})]})}case`AskUserQuestion`:{let n=Array.isArray(t.questions)?t.questions:[],r=!!t.answers;return(0,$.jsxs)($.Fragment,{children:[e,` `,(0,$.jsxs)(`span`,{className:`text-text-subtle`,children:[n.length,` question`,n.length===1?``:`s`,r?` ✓`:``]})]})}default:return(0,$.jsx)($.Fragment,{children:e})}}function Pt({name:e,input:t,projectName:n}){let r=e=>String(e??``),{openTab:i}=U(),a=e=>{n&&i({type:`editor`,title:g(e),metadata:{filePath:e,projectName:n},projectId:n,closable:!0})},o=(e,t,r)=>{i({type:`git-diff`,title:`Diff ${g(e)}`,metadata:{filePath:e,projectName:n,original:t,modified:r},projectId:n??null,closable:!0})};switch(e){case`Bash`:return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[!!t.description&&(0,$.jsx)(`p`,{className:`text-text-subtle italic`,children:r(t.description)}),(0,$.jsx)(`pre`,{className:`font-mono text-text-secondary overflow-x-auto whitespace-pre-wrap break-all`,children:r(t.command)})]});case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:{let n=r(t.file_path);return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`font-mono text-text-secondary break-all hover:text-primary hover:underline text-left flex items-center gap-1`,onClick:()=>a(n),title:`Open file in editor`,children:[(0,$.jsx)(Re,{className:`size-3 shrink-0`}),n]}),e===`Edit`&&(!!t.old_string||!!t.new_string)&&(0,$.jsxs)(`button`,{type:`button`,className:`text-text-subtle hover:text-primary hover:underline text-left flex items-center gap-1`,onClick:()=>o(n,r(t.old_string),r(t.new_string)),title:`View diff in new tab`,children:[(0,$.jsx)(l,{className:`size-3 shrink-0`}),`View Diff`]}),e===`Write`&&!!t.content&&(0,$.jsx)(`pre`,{className:`font-mono text-text-subtle overflow-x-auto max-h-32 whitespace-pre-wrap`,children:Bt(r(t.content),300)})]})}case`Glob`:return(0,$.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[r(t.pattern),t.path?` in ${r(t.path)}`:``]});case`Grep`:return(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[`/`,r(t.pattern),`/`]}),!!t.path&&(0,$.jsxs)(`p`,{className:`text-text-subtle`,children:[`in `,r(t.path)]})]});case`TodoWrite`:return(0,$.jsx)(Ft,{todos:t.todos??[]});case`Agent`:case`Task`:return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[!!t.description&&(0,$.jsx)(`p`,{className:`text-text-secondary font-medium`,children:r(t.description)}),!!t.subagent_type&&(0,$.jsxs)(`p`,{className:`text-text-subtle`,children:[`Type: `,r(t.subagent_type)]}),!!t.prompt&&(0,$.jsx)(zt,{content:r(t.prompt),maxHeight:`max-h-48`})]});case`ToolSearch`:return(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsx)(`p`,{className:`font-mono text-text-secondary`,children:r(t.query)}),!!t.max_results&&(0,$.jsxs)(`p`,{className:`text-text-subtle`,children:[`Max results: `,r(t.max_results)]})]});case`WebFetch`:return(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsxs)(`a`,{href:r(t.url),target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-primary hover:underline break-all flex items-center gap-1`,children:[(0,$.jsx)(_e,{className:`size-3 shrink-0`}),r(t.url)]}),!!t.prompt&&(0,$.jsx)(`p`,{className:`text-text-subtle`,children:Bt(r(t.prompt),100)})]});case`AskUserQuestion`:{let e=t.questions??[],n=t.answers??{};return(0,$.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsxs)(`p`,{className:`text-text-primary font-medium`,children:[e.header?`${e.header}: `:``,e.question]}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.options.map((t,r)=>(0,$.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-xs border ${(n[e.question]??``).split(`, `).includes(t.label)?`border-accent bg-accent/20 text-text-primary`:`border-border text-text-subtle`}`,children:t.label},r))}),n[e.question]&&(0,$.jsxs)(`p`,{className:`text-foreground text-xs`,children:[`Answer: `,n[e.question]]})]},t))})}default:return(0,$.jsx)(`pre`,{className:`overflow-x-auto text-text-secondary font-mono whitespace-pre-wrap break-all`,children:JSON.stringify(t,null,2)})}}function Ft({todos:e}){return(0,$.jsx)(`div`,{className:`space-y-0.5`,children:e.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0 mt-0.5 ${e.status===`completed`?`text-green-400`:e.status===`in_progress`?`text-yellow-400`:`text-text-subtle`}`,children:e.status===`completed`?`✓`:e.status===`in_progress`?`▶`:`○`}),(0,$.jsx)(`span`,{className:e.status===`completed`?`line-through text-text-subtle`:`text-text-secondary`,children:e.content})]},t))})}function It({toolName:e,output:t}){let[n,r]=(0,Q.useState)(!1),i=(0,Q.useMemo)(()=>{if(e!==`Agent`&&e!==`Task`)return null;try{let e=JSON.parse(t);if(Array.isArray(e)){let t=e.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
3
+
4
+ `);if(t)return t}if(typeof e==`string`)return e}catch{if(t&&!t.startsWith(`[{`))return t}return null},[e,t]);return i?(0,$.jsxs)(`div`,{className:`border-t border-border pt-1.5 space-y-1`,children:[(0,$.jsx)(zt,{content:i,maxHeight:`max-h-60`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:`flex items-center gap-1 text-[10px] text-text-subtle hover:text-text-secondary transition-colors`,children:[(0,$.jsx)(s,{className:`size-3`}),n?`Hide`:`Show`,` raw`]}),n&&(0,$.jsx)(`pre`,{className:`overflow-x-auto text-text-subtle font-mono max-h-40 whitespace-pre-wrap break-all text-[10px]`,children:t})]}):(0,$.jsx)(Lt,{output:t})}function Lt({output:e}){let t=e.split(`
5
+ `).length,n=t>3||e.length>200,[r,a]=(0,Q.useState)(n);return(0,$.jsxs)(`div`,{className:`border-t border-border pt-1.5`,children:[n&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(!r),className:`flex items-center gap-1 text-[10px] text-text-subtle hover:text-text-secondary transition-colors mb-1`,children:[r?(0,$.jsx)(o,{className:`size-3`}):(0,$.jsx)(i,{className:`size-3`}),`Output (`,t,` lines)`]}),(0,$.jsx)(`pre`,{className:`overflow-x-auto text-text-subtle font-mono whitespace-pre-wrap break-all ${r?`max-h-16 overflow-hidden`:`max-h-60`}`,children:e})]})}function Rt({events:e,projectName:t}){let n=[],r=``;for(let t of e)if(t.type===`text`)r+=t.content;else if(t.type===`tool_use`)r&&=(n.push({kind:`text`,content:r}),``),n.push({kind:`tool`,tool:t});else if(t.type===`tool_result`){let e=t.toolUseId,r=e?n.find(t=>t.kind===`tool`&&t.tool.type===`tool_use`&&t.tool.toolUseId===e&&!t.result):n.findLast(e=>e.kind===`tool`&&!e.result);r&&(r.result=t)}return r&&n.push({kind:`text`,content:r}),(0,$.jsx)(`div`,{className:`border-l-2 border-accent/20 pl-2 space-y-1 mt-1`,children:n.map((e,n)=>e.kind===`text`?(0,$.jsx)(`div`,{className:`text-text-secondary text-[11px]`,children:(0,$.jsx)(zt,{content:e.content,maxHeight:`max-h-24`})},`st-${n}`):(0,$.jsx)(Mt,{tool:e.tool,result:e.result,completed:!!e.result,projectName:t},`sc-${n}`))})}function zt({content:e,maxHeight:t=`max-h-48`}){return(0,$.jsx)(c,{content:e,className:`text-text-secondary overflow-auto ${t}`})}function Bt(e,t=50){return e?e.length>t?e.slice(0,t)+`…`:e:``}var Vt=5,Ht=20;function Ut(e){try{let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<7?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}catch{return``}}function Wt({projectName:e,onSelectSession:t}){let[n,r]=(0,Q.useState)([]),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),l=(0,Q.useCallback)(async()=>{if(e){o(!0);try{r((await y.get(`${_(e)}/chat/sessions?limit=${Ht}`)).sessions.slice(0,Ht))}catch{}finally{o(!1)}}},[e]);(0,Q.useEffect)(()=>{l()},[l]);let u=(0,Q.useCallback)(async(t,n)=>{if(t.stopPropagation(),!e)return;let i=`${_(e)}/chat/sessions/${n.id}/pin`;try{n.pinned?await y.del(i):await y.put(i),r(e=>e.map(e=>e.id===n.id?{...e,pinned:!e.pinned}:e).sort((e,t)=>e.pinned&&!t.pinned?-1:!e.pinned&&t.pinned?1:new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()))}catch{}},[e]),d=n.filter(e=>e.pinned),f=n.filter(e=>!e.pinned),p=s?f:f.slice(0,Vt),m=f.length>Vt;function h(e){return(0,$.jsxs)(`button`,{onClick:()=>t(e),className:`group flex items-center gap-2.5 w-full px-3 py-2.5 text-left hover:bg-surface-elevated active:bg-surface-elevated transition-colors border-b border-border/50 last:border-0`,children:[(0,$.jsx)(fe,{className:`size-3.5 shrink-0 text-text-subtle`}),(0,$.jsx)(`span`,{className:`flex-1 min-w-0 text-xs font-medium truncate text-text-primary`,children:e.title||`Untitled`}),e.updatedAt&&(0,$.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:Ut(e.updatedAt)}),(0,$.jsx)(`span`,{role:`button`,tabIndex:0,onClick:t=>u(t,e),className:`p-1 rounded transition-colors shrink-0 ${e.pinned?`text-primary hover:text-primary/70`:`text-text-subtle can-hover:opacity-0 can-hover:group-hover:opacity-100 hover:text-text-primary`}`,"aria-label":e.pinned?`Unpin session`:`Pin session`,children:e.pinned?(0,$.jsx)(Me,{className:`size-3`}):(0,$.jsx)(Ee,{className:`size-3`})})]},e.id)}return(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-6 text-text-secondary overflow-y-auto`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,$.jsx)(V,{className:`size-10 text-text-subtle`}),(0,$.jsx)(`p`,{className:`text-sm`,children:`Send a message to start a new conversation`})]}),!a&&d.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 w-full max-w-sm px-4`,children:[(0,$.jsx)(`p`,{className:`text-xs text-text-subtle text-center`,children:`Pinned`}),(0,$.jsx)(`div`,{className:`w-full rounded-md border border-border bg-surface overflow-hidden`,children:d.map(h)})]}),!a&&p.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 w-full max-w-sm px-4`,children:[(0,$.jsx)(`p`,{className:`text-xs text-text-subtle text-center`,children:`Recent chats`}),(0,$.jsx)(`div`,{className:`w-full rounded-md border border-border bg-surface overflow-hidden`,children:p.map(h)}),m&&(0,$.jsxs)(`button`,{onClick:()=>c(!s),className:`flex items-center justify-center gap-1 text-[11px] text-text-subtle hover:text-text-primary transition-colors py-1`,children:[s?(0,$.jsx)(ne,{className:`size-3`}):(0,$.jsx)(i,{className:`size-3`}),s?`Show less`:`Show more (${f.length-Vt})`]})]})]})}function Gt(e){let[t,n]=(0,Q.useState)({}),[r,i]=(0,Q.useState)({}),[a,o]=(0,Q.useState)(0),s=(0,Q.useCallback)((e,t)=>{n(n=>({...n,[e]:[t]})),i(t=>({...t,[e]:``}))},[]),c=(0,Q.useCallback)((e,t)=>{n(n=>{let r=n[e]||[];return{...n,[e]:r.includes(t)?r.filter(e=>e!==t):[...r,t]}})},[]),l=(0,Q.useCallback)((e,t)=>{i(n=>({...n,[e]:t})),t&&n(t=>({...t,[e]:[]}))},[]),u=(0,Q.useCallback)(e=>(t[e]?.length??0)>0||(r[e]?.trim().length??0)>0,[t,r]);return{answers:t,customInputs:r,activeTab:a,setActiveTab:o,handleSingleSelect:s,handleMultiSelect:c,handleCustomInput:l,hasAnswer:u,allAnswered:(0,Q.useMemo)(()=>e.every((e,t)=>u(t)),[e,u]),getFinalAnswer:(0,Q.useCallback)(e=>r[e]?.trim()||(t[e]??[]).join(`, `),[t,r]),goToNextTab:(0,Q.useCallback)(()=>o(t=>Math.min(t+1,e.length-1)),[e.length]),goToPrevTab:(0,Q.useCallback)(()=>o(e=>Math.max(e-1,0)),[])}}function Kt(e){let[t,n]=(0,Q.useState)(0),r=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>n(0),[e.activeTab]),(0,Q.useEffect)(()=>{if(!e.enabled)return;let i=r=>{let i=document.activeElement===e.customInputRef.current;if(!i&&r.key>=`1`&&r.key<=`9`){r.preventDefault();let t=parseInt(r.key)-1;t<e.totalOptions-1&&(n(t),e.onSelectOption(t));return}if(!i&&(r.key===`o`||r.key===`O`||r.key===`0`)){r.preventDefault(),e.customInputRef.current?.focus(),n(e.totalOptions-1);return}if(r.key===`Tab`&&e.questions.length>1){r.preventDefault(),r.shiftKey?e.goToPrevTab():e.goToNextTab();return}if(!i){if(r.key===`ArrowLeft`){r.preventDefault(),e.goToPrevTab();return}if(r.key===`ArrowRight`){r.preventDefault(),e.goToNextTab();return}if(r.key===`ArrowUp`){r.preventDefault(),n(e=>Math.max(0,e-1));return}if(r.key===`ArrowDown`){r.preventDefault(),n(t=>Math.min(e.totalOptions-1,t+1));return}if(r.key===` `){r.preventDefault(),e.onSelectOption(t);return}}if(r.key===`Enter`){r.preventDefault(),e.allAnswered?e.onSubmit():e.hasAnswer(e.activeTab)&&e.goToNextTab();return}r.key===`Escape`&&i&&e.customInputRef.current?.blur()},a=r.current;return a&&(a.addEventListener(`keydown`,i),a.setAttribute(`tabindex`,`0`),a.contains(document.activeElement)||a.focus()),()=>{a?.removeEventListener(`keydown`,i)}},[e,t]),{focusedOption:t,setFocusedOption:n,containerRef:r}}function qt({questions:e,onSubmit:t,onSkip:n}){let r=(0,Q.useRef)(null),i=Gt(e),a=e[i.activeTab],o=a?a.options.length+1:0,s=e.length>1,c=(0,Q.useCallback)(()=>{if(!i.allAnswered)return;let n={};e.forEach((e,t)=>{n[e.question]=i.getFinalAnswer(t)}),t(n)},[i.allAnswered,i.getFinalAnswer,e,t]),l=(0,Q.useCallback)(e=>{if(!(!a||e<0))if(e<a.options.length){let t=a.options[e]?.label;if(!t)return;a.multiSelect?i.handleMultiSelect(i.activeTab,t):i.handleSingleSelect(i.activeTab,t)}else e===a.options.length&&r.current?.focus()},[a,i]),u=Kt({questions:e,activeTab:i.activeTab,totalOptions:o,allAnswered:i.allAnswered,hasAnswer:i.hasAnswer,onSelectOption:l,goToNextTab:i.goToNextTab,goToPrevTab:i.goToPrevTab,onSubmit:c,customInputRef:r,enabled:!0}),d=(0,Q.useCallback)(e=>{l(e),u.setFocusedOption(e)},[l,u.setFocusedOption]);return(0,$.jsxs)(`div`,{ref:u.containerRef,className:`rounded-lg border-2 border-primary/30 bg-primary/5 p-3 space-y-3 outline-none animate-in slide-in-from-bottom-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-sm font-medium text-text-primary`,children:[(0,$.jsxs)(`span`,{children:[`AI has `,s?`${e.length} questions`:`a question`]}),(0,$.jsxs)(`span`,{className:`text-[10px] text-text-secondary font-normal`,children:[s?`←→ tabs · `:``,`↑↓ options · 1-`,Math.min(o-1,9),` select · Enter submit`]})]}),s&&(0,$.jsx)(`div`,{className:`flex gap-1 p-1 bg-background rounded-md overflow-x-auto border border-border`,children:e.map((e,t)=>(0,$.jsxs)(`button`,{className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs whitespace-nowrap transition-all ${i.activeTab===t?`bg-primary text-primary-foreground`:i.hasAnswer(t)?`text-primary bg-transparent`:`text-text-secondary hover:bg-surface-elevated`}`,onClick:()=>{i.setActiveTab(t),u.setFocusedOption(0)},tabIndex:-1,children:[(0,$.jsx)(`span`,{className:`flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold ${i.activeTab===t?`bg-white/20`:i.hasAnswer(t)?`bg-primary/20 text-primary`:`bg-surface-elevated text-text-secondary`}`,children:i.hasAnswer(t)?`✓`:t+1}),(0,$.jsx)(`span`,{className:`max-w-[100px] overflow-hidden text-ellipsis`,children:e.header||`Q${t+1}`})]},t))}),a&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[!s&&a.header&&(0,$.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-text-secondary`,children:a.header}),(0,$.jsx)(`div`,{className:`text-sm text-text-primary`,children:a.question}),a.multiSelect&&(0,$.jsx)(`div`,{className:`text-[11px] text-text-secondary`,children:`Select multiple`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[a.options.map((e,t)=>{let n=(i.answers[i.activeTab]||[]).includes(e.label),r=u.focusedOption===t;return(0,$.jsxs)(`button`,{onClick:()=>d(t),className:`text-left flex items-start gap-2.5 rounded px-2.5 py-2 text-xs border transition-all ${n?`border-primary bg-primary/10 text-text-primary`:`border-border bg-background text-text-secondary hover:border-primary/40 hover:bg-primary/5`} ${r?`ring-2 ring-primary/40 ring-offset-1 ring-offset-background`:``}`,children:[(0,$.jsx)(`span`,{className:`flex items-center justify-center w-4.5 h-4.5 rounded text-[10px] font-semibold shrink-0 mt-px ${n?`bg-primary/20 text-primary`:`bg-surface-elevated text-text-secondary`}`,children:t+1}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5 flex-1`,children:[(0,$.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.label}),e.description&&(0,$.jsx)(`span`,{className:`text-[11px] text-text-secondary`,children:e.description})]})]},t)}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2.5 py-2 text-xs border border-dashed transition-all border-border bg-transparent ${u.focusedOption===o-1?`ring-2 ring-primary/40 ring-offset-1 ring-offset-background`:``}`,children:[(0,$.jsx)(`span`,{className:`flex items-center justify-center w-4.5 h-4.5 rounded bg-surface-elevated text-text-secondary text-[10px] font-semibold shrink-0 mt-px`,children:`O`}),(0,$.jsx)(`input`,{ref:r,type:`text`,className:`flex-1 px-2 py-1 text-xs bg-surface border border-border rounded text-text-primary outline-none placeholder:text-text-subtle focus:border-primary`,placeholder:`Other (press O to type)...`,value:i.customInputs[i.activeTab]||``,onChange:e=>i.handleCustomInput(i.activeTab,e.target.value),onFocus:()=>u.setFocusedOption(o-1)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2 justify-end pt-1`,children:[s&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`px-3 py-1.5 text-xs rounded border border-border bg-background text-text-primary hover:bg-surface-elevated disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,onClick:i.goToPrevTab,disabled:i.activeTab===0,tabIndex:-1,children:`← Prev`}),(0,$.jsx)(`button`,{className:`px-3 py-1.5 text-xs rounded border border-border bg-background text-text-primary hover:bg-surface-elevated disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,onClick:i.goToNextTab,disabled:i.activeTab===e.length-1,tabIndex:-1,children:`Next →`})]}),(0,$.jsx)(`button`,{onClick:n,className:`px-4 py-1.5 rounded border border-border bg-background text-text-secondary text-xs hover:bg-surface-elevated transition-colors`,tabIndex:-1,children:`Skip`}),(0,$.jsxs)(`button`,{onClick:c,disabled:!i.allAnswered,className:`px-4 py-1.5 rounded bg-primary text-primary-foreground text-xs font-medium hover:bg-primary/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,tabIndex:-1,children:[`Submit `,i.allAnswered?`✓`:`(${e.filter((e,t)=>i.hasAnswer(t)).length}/${e.length})`]})]})]})}function Jt({messages:e,messagesLoading:t,pendingApproval:n,onApprovalResponse:r,isStreaming:i,phase:a,onSelectSession:o,connectingElapsed:s,statusMessage:c,compactStatus:l,projectName:u,onFork:d}){if(t)return(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,$.jsx)(V,{className:`size-10 text-text-subtle animate-pulse`}),(0,$.jsx)(`p`,{className:`text-sm`,children:`Loading messages...`})]});if(e.length===0&&!i)return(0,$.jsx)(Wt,{projectName:u||``,onSelectSession:o||(()=>{})});let f=(0,Q.useMemo)(()=>e.filter(e=>{let t=e.content&&e.content.trim().length>0,n=e.events&&e.events.length>0;return e.role===`user`?t:t||n}),[e]);return(0,$.jsx)(`div`,{className:`relative flex-1 overflow-hidden flex flex-col min-h-0`,children:(0,$.jsxs)(kt,{className:`flex-1 overflow-y-auto overflow-x-hidden`,resize:`smooth`,initial:`instant`,children:[(0,$.jsxs)(kt.Content,{className:`p-4 space-y-4`,children:[f.map((e,t)=>(0,$.jsx)(Xt,{message:e,isStreaming:i&&e.id.startsWith(`streaming-`),projectName:u,onFork:e.role===`user`&&d?()=>{let n=t>0?f[t-1]:void 0;d(e.content,n?.sdkUuid??n?.id)}:void 0},e.id)),n&&(n.tool===`AskUserQuestion`?(0,$.jsx)(Sn,{approval:n,onRespond:r}):(0,$.jsx)(xn,{approval:n,onRespond:r})),i&&(0,$.jsx)(_n,{lastMessage:e[e.length-1],phase:a,elapsed:s,statusMessage:c}),!i&&l===`compacting`&&(0,$.jsx)(_n,{lastMessage:void 0,phase:`thinking`,elapsed:void 0,statusMessage:`Compacting messages...`})]}),(0,$.jsx)(Yt,{})]})})}function Yt(){let{isAtBottom:e,scrollToBottom:t}=At();return e?null:(0,$.jsxs)(`button`,{onClick:()=>t(),className:`absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-3 py-1 rounded-full bg-surface-elevated border border-border text-xs text-text-secondary hover:text-foreground shadow-lg transition-all`,children:[(0,$.jsx)(i,{className:`size-3`}),`Scroll to bottom`]})}function Xt({message:e,isStreaming:t,projectName:n,onFork:r}){return e.role===`user`?(0,$.jsx)(an,{content:e.content,projectName:n,onFork:r}):e.role===`system`?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:[(0,$.jsx)(xe,{className:`size-4 shrink-0`}),(0,$.jsx)(`p`,{children:e.content})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.events&&e.events.length>0?(0,$.jsx)(mn,{events:e.events,isStreaming:t,projectName:n}):e.content&&(0,$.jsx)(`div`,{className:`text-sm text-text-primary`,children:(0,$.jsx)(bn,{content:e.content,projectName:n})}),e.accountLabel&&(0,$.jsxs)(`p`,{className:`text-[10px] select-none`,style:{color:`var(--color-text-subtle)`},children:[`via `,e.accountLabel]})]})}var Zt=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`]),Qt={"system-reminder":`Context`,claudeMd:`CLAUDE.md`,gitStatus:`Git Status`,currentDate:`Date`,fast_mode_info:`Fast Mode`,"available-deferred-tools":`Tools`,"task-notification":`Task Result`,environment_details:`Environment`};function $t(e){let t=[],n=/<(system-reminder|available-deferred-tools|antml:[\w-]+|fast_mode_info|claudeMd|gitStatus|currentDate|task-notification|environment_details)[^>]*>([\s\S]*?)<\/\1>/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];t.push({name:e,label:Qt[e]??e.replace(/^antml:/,``).replace(/-/g,` `),content:r[2].trim()})}return{cleanText:e.replace(n,``).trim(),tags:t}}function en(e){let t=e.match(/^\[Attached file: (.+?)\]\n\n?/);if(t)return{files:[t[1]],text:e.slice(t[0].length)};let n=e.match(/^\[Attached files:\n([\s\S]+?)\]\n\n?/);return n?{files:n[1].split(`
6
+ `).map(e=>e.trim()).filter(Boolean),text:e.slice(n[0].length)}:{files:[],text:e}}function tn(e,t){let n=g(e);return`/api/project/${encodeURIComponent(t??`_`)}/chat/uploads/${encodeURIComponent(n)}`}function nn(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Zt.has(e.slice(t).toLowerCase())}var rn=new Set([`task-notification`,`environment_details`]);function an({content:e,projectName:t,onFork:n}){let{files:r,text:a,tags:o}=(0,Q.useMemo)(()=>{let t=en(e),{cleanText:n,tags:r}=$t(t.text);return{files:t.files,text:n,tags:r}},[e]),s=o.some(e=>rn.has(e.name)),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let e=f.current;if(!e)return;let t=()=>d(e.scrollHeight>e.clientHeight+2);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[a]),(0,$.jsxs)(`div`,{className:m(`group/user relative rounded-lg px-3 py-2 text-sm border shadow-sm`,s?`bg-surface/40 border-border/40 text-text-secondary`:`bg-primary/10 border-primary/15 text-text-primary`),children:[o.length>0&&(0,$.jsx)(on,{tags:o}),r.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map((e,n)=>nn(e)?(0,$.jsx)(pn,{filePath:e,projectName:t},n):(0,$.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border/60 bg-background/40 px-1.5 py-0.5 text-[11px] text-text-secondary`,children:[(0,$.jsx)(ce,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate max-w-32`,children:g(e)})]},n))}),a&&(0,$.jsx)(`div`,{ref:f,className:m(`whitespace-pre-wrap break-words transition-all duration-200`,!c&&`line-clamp-2`,c&&`max-h-[50vh] overflow-y-auto`),children:s?(0,$.jsx)(dn,{text:a,projectName:t}):a}),(u||c)&&(0,$.jsx)(`button`,{onClick:()=>l(!c),className:m(`flex items-center gap-1 text-xs mt-1 transition-colors`,s?`text-text-subtle hover:text-text-secondary`:`text-primary/70 hover:text-primary`),children:c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ne,{className:`size-3`}),`Show less`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{className:`size-3`}),`Show more`]})}),!s&&n&&(0,$.jsx)(`button`,{onClick:n,title:`Retry from this message (fork session)`,className:`absolute top-1.5 right-1.5 can-hover:opacity-0 can-hover:group-hover/user:opacity-100 transition-opacity size-5 flex items-center justify-center rounded text-text-subtle hover:text-text-primary`,children:(0,$.jsx)(Te,{className:`size-3`})})]})}function on({tags:e}){return(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,$.jsx)(sn,{tag:e},t))})}function sn({tag:e}){let[t,n]=(0,Q.useState)(!1);return e.name===`task-notification`?(0,$.jsx)(ln,{content:e.content}):(0,$.jsxs)(`div`,{className:`text-xs`,children:[(0,$.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1 rounded-full border border-border/60 bg-surface/50 px-2 py-0.5 text-text-subtle hover:text-text-secondary hover:bg-surface transition-colors`,children:[(0,$.jsx)(d,{className:`size-2.5`}),(0,$.jsx)(`span`,{children:e.label}),(0,$.jsx)(o,{className:m(`size-2.5 transition-transform`,t&&`rotate-90`)})]}),t&&(0,$.jsx)(`div`,{className:`mt-1 rounded border border-border/40 bg-surface/30 px-2 py-1.5 text-[11px] text-text-subtle/80 whitespace-pre-wrap max-h-40 overflow-y-auto leading-relaxed`,children:e.content})]})}function cn(e,t){return e.match(RegExp(`<${t}>([\\s\\S]*?)</${t}>`))?.[1]?.trim()||void 0}function ln({content:e}){let[t,n]=(0,Q.useState)(!1),r=cn(e,`status`),i=cn(e,`summary`),a=cn(e,`output-file`),s=cn(e,`result`);return(0,$.jsxs)(`div`,{className:`text-xs`,children:[(0,$.jsxs)(`button`,{onClick:()=>n(!t),className:`flex items-center gap-1.5 rounded-full border border-border/60 bg-surface/50 px-2 py-0.5 text-text-subtle hover:text-text-secondary hover:bg-surface transition-colors`,children:[r===`completed`?(0,$.jsx)(P,{className:`size-2.5 text-green-500`}):(0,$.jsx)(Be,{className:`size-2.5 text-yellow-500`}),(0,$.jsx)(`span`,{className:`truncate max-w-80`,children:i??`Task notification`}),(0,$.jsx)(o,{className:m(`size-2.5 transition-transform shrink-0`,t&&`rotate-90`)})]}),t&&(0,$.jsxs)(`div`,{className:`mt-1 rounded border border-border/40 bg-surface/30 px-2 py-1.5 space-y-1.5`,children:[i&&(0,$.jsx)(`p`,{className:`text-[11px] text-text-secondary`,children:i}),a&&(0,$.jsx)(un,{path:a}),s&&(0,$.jsx)(`div`,{className:`text-[11px] text-text-subtle/80 max-h-60 overflow-y-auto leading-relaxed`,children:(0,$.jsx)(bn,{content:s})})]})]})}function un({path:e,projectName:t}){return(0,$.jsxs)(`button`,{type:`button`,onClick:(0,Q.useCallback)(()=>{let n=U.getState().openTab,r=t??Oe.getState().activeProject?.name,i=g(e),a={filePath:e};r&&(a.projectName=r),y.get(`/api/fs/read?path=${encodeURIComponent(e)}`).then(()=>{n({type:`editor`,title:i,metadata:a,projectId:null,closable:!0})}).catch(()=>{n({type:`editor`,title:i,metadata:a,projectId:null,closable:!0})})},[e,t]),className:`inline-flex items-center gap-1 rounded border border-border/50 bg-surface/50 px-1.5 py-0.5 font-mono text-[10px] text-text-secondary hover:text-text-primary hover:bg-surface transition-colors cursor-pointer`,children:[(0,$.jsx)(ce,{className:`size-2.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate max-w-60`,children:g(e)}),(0,$.jsx)(Re,{className:`size-2 shrink-0 opacity-50`})]})}function dn({text:e,projectName:t}){return(0,$.jsx)($.Fragment,{children:(0,Q.useMemo)(()=>{let t=/(\/(?:[\w.\-]+\/)+[\w.\-]+)/g,n=[],r=0,i;for(;(i=t.exec(e))!==null;)i.index>r&&n.push({kind:`text`,value:e.slice(r,i.index)}),n.push({kind:`path`,value:i[1]}),r=i.index+i[0].length;return r<e.length&&n.push({kind:`text`,value:e.slice(r)}),n},[e]).map((e,n)=>e.kind===`path`?(0,$.jsx)(un,{path:e.value,projectName:t},n):(0,$.jsx)(`span`,{children:e.value},n))})}function fn(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{let t=!1,r,a=v();return fetch(e,{headers:a?{Authorization:`Bearer ${a}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{t||(r=URL.createObjectURL(e),n(r))}).catch(()=>{t||i(!0)}),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),{blobUrl:t,error:r}}function pn({filePath:e,projectName:t}){let{blobUrl:n,error:r}=fn(tn(e,t)),i=ke(e=>e.open),a=g(e);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n&&i(n,a),className:`flex items-center gap-1 rounded-md border border-border/60 bg-background/40 px-1.5 py-0.5 text-[11px] text-text-secondary hover:bg-surface transition-colors cursor-pointer`,children:[n?(0,$.jsx)(`img`,{src:n,alt:a,className:`size-4 rounded-sm object-cover shrink-0`}):r?(0,$.jsx)(Ge,{className:`size-3 shrink-0`}):(0,$.jsx)(`div`,{className:`size-4 rounded-sm bg-surface animate-pulse shrink-0`}),(0,$.jsx)(`span`,{className:`truncate max-w-32`,children:a})]})}function mn({events:e,isStreaming:t,projectName:n}){let r=[],i=``,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n.type===`thinking`){i&&=(r.push({kind:`text`,content:i}),``),a+=n.content;continue}if(a&&=(r.push({kind:`thinking`,content:a}),``),n.type===`account_retry`){i&&=(r.push({kind:`text`,content:i}),``);let e=n.accountLabel??`another account`,t=n.reason??`Auth failed`;r.push({kind:`text`,content:`\n\n> ↻ ${t} — retrying with **${e}**...\n\n`});continue}n.type===`text`?i+=n.content:n.type===`tool_use`?(i&&=(r.push({kind:`text`,content:i}),``),r.push({kind:`tool`,tool:n})):n.type===`tool_result`||(i&&=(r.push({kind:`text`,content:i}),``),r.push({kind:`tool`,tool:n}))}a&&r.push({kind:`thinking`,content:a}),i&&r.push({kind:`text`,content:i});let o=e.filter(e=>e.type===`tool_result`);for(let e of o){let t=e.toolUseId;if(t){let n=r.find(e=>e.kind===`tool`&&e.tool.type===`tool_use`&&e.tool.toolUseId===t);if(n){n.result=e;continue}}let n=r.find(e=>e.kind===`tool`&&!e.result);n&&(n.result=e)}for(let e of r)if(e.kind===`tool`&&!e.result&&e.tool.type===`tool_use`){let t=e.tool.result;t&&(e.result={type:`tool_result`,output:t.output,isError:t.isError})}for(let e=0;e<r.length;e++){let n=r[e];if(n.kind===`tool`&&!n.result){let i=!1;if(n.tool.type===`tool_use`&&n.tool.tool===`Read`){let t=n.tool.input?.file_path;t&&(i=r.slice(e+1).some(e=>e.kind===`tool`&&e.result&&e.tool.type===`tool_use`&&e.tool.tool===`Edit`&&e.tool.input?.file_path===t))}n.completed=i||!t}}return(0,$.jsx)($.Fragment,{children:r.map((e,i)=>{if(e.kind===`thinking`)return(0,$.jsx)(hn,{content:e.content,isStreaming:t&&i===r.length-1},`think-${i}`);if(e.kind===`text`){let a=t&&i===r.length-1;return(0,$.jsx)(`div`,{className:`text-sm text-text-primary`,children:(0,$.jsx)(gn,{content:e.content,animate:a,projectName:n})},`text-${i}`)}return(0,$.jsx)(Mt,{tool:e.tool,result:e.result,completed:e.completed,projectName:n},`tool-${i}`)})})}function hn({content:e,isStreaming:t}){let[n,r]=(0,Q.useState)(t),i=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{!t&&e.length>0&&r(!1)},[t,e.length]),(0,Q.useEffect)(()=>{t&&n&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,t,n]),(0,$.jsxs)(`div`,{className:`rounded border border-border/50 bg-surface/30 text-xs`,children:[(0,$.jsxs)(`button`,{onClick:()=>r(!n),className:`flex items-center gap-2 px-2 py-1.5 w-full text-left hover:bg-surface transition-colors text-text-subtle`,children:[t?(0,$.jsx)(Z,{className:`size-3 animate-spin`}):(0,$.jsx)(o,{className:`size-3 transition-transform ${n?`rotate-90`:``}`}),(0,$.jsxs)(`span`,{children:[`Thinking`,t?`...`:``]}),!t&&(0,$.jsx)(`span`,{className:`text-text-subtle/50 ml-auto`,children:e.length>100?`${Math.round(e.length/4)} tokens`:``})]}),n&&(0,$.jsx)(`div`,{ref:i,className:`max-h-60 overflow-y-auto`,children:(0,$.jsx)(`div`,{className:`px-2 pb-2 text-text-subtle/80 whitespace-pre-wrap text-[11px] leading-relaxed`,children:e})})]})}function gn({content:e,animate:t,projectName:n}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bn,{content:e,projectName:n,isStreaming:t}),t&&(0,$.jsx)(`span`,{className:`text-text-subtle text-sm animate-pulse`,children:`Thinking...`})]})}function _n({lastMessage:e,phase:t,elapsed:n,statusMessage:r}){let i=!e||e.role!==`assistant`,a=e?.events?.length?e.events[e.events.length-1].type===`tool_result`:!1;return!r&&!i&&!a?null:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-text-subtle`,children:[(0,$.jsx)(Z,{className:`size-3 animate-spin`}),(0,$.jsxs)(`span`,{children:[r||(t===`initializing`?`Initializing`:t===`connecting`?`Connecting`:t===`thinking`?`Thinking`:`Processing`),i&&(n??0)>0&&(0,$.jsxs)(`span`,{className:`text-text-subtle/60`,children:[`... (`,n,`s)`]})]})]}),t===`connecting`&&(n??0)>=30&&(0,$.jsx)(`p`,{className:`text-xs text-yellow-500/80 ml-5`,children:`Taking longer than usual — may be rate-limited or API slow. Try sending a new message to retry.`})]})}var vn=/<teammate-message[^>]*>[\s\S]*?<\/teammate-message>/g;function yn(e){return e.replace(vn,``).replace(/\n{3,}/g,`
7
+
8
+ `).trim()}function bn({content:e,projectName:t,isStreaming:n}){let r=yn(e);return r?(0,$.jsx)(c,{content:r,projectName:t,codeActions:!0,isStreaming:n}):null}function xn({approval:e,onRespond:t}){return(0,$.jsxs)(`div`,{className:`rounded-lg border-2 border-yellow-500/40 bg-yellow-500/10 p-3 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-yellow-400 text-sm font-medium`,children:[(0,$.jsx)($e,{className:`size-4`}),(0,$.jsx)(`span`,{children:`Tool Approval Required`})]}),(0,$.jsx)(`div`,{className:`text-xs text-text-primary`,children:(0,$.jsx)(`span`,{className:`font-medium`,children:e.tool})}),(0,$.jsx)(`pre`,{className:`text-xs font-mono text-text-secondary overflow-x-auto bg-background rounded p-2 border border-border`,children:JSON.stringify(e.input,null,2)}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`button`,{onClick:()=>t(e.requestId,!0),className:`px-4 py-1.5 rounded bg-green-600 text-white text-xs font-medium hover:bg-green-500 transition-colors`,children:`Allow`}),(0,$.jsx)(`button`,{onClick:()=>t(e.requestId,!1),className:`px-4 py-1.5 rounded bg-red-600 text-white text-xs font-medium hover:bg-red-500 transition-colors`,children:`Deny`})]})]})}function Sn({approval:e,onRespond:t}){return(0,$.jsx)(qt,{questions:e.input.questions??[],onSubmit:n=>t(e.requestId,!0,n),onSkip:()=>t(e.requestId,!1)})}function Cn(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function wn(e){let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(``),a=(0,Q.useRef)(null),o=(0,Q.useRef)(``),s=typeof window<`u`&&Cn()!==null;return{isListening:t,interimText:r,start:(0,Q.useCallback)(t=>{let r=Cn();if(!r)return;a.current?.abort();let s=new r;s.lang=e?.lang??`vi-VN`,s.continuous=!0,s.interimResults=!0,o.current=``,s.onresult=e=>{let n=``,r=``;for(let t=0;t<e.results.length;t++){let i=e.results[t];i.isFinal?r+=i[0].transcript:n+=i[0].transcript}r&&(o.current=r);let a=(o.current+` `+n).trim();i(n),t(a,n.length===0&&o.current.length>0)},s.onend=()=>{n(!1),i(``),o.current&&t(o.current.trim(),!0)},s.onerror=e=>{e.error!==`no-speech`&&e.error!==`aborted`&&console.warn(`[voice-input] error:`,e.error),n(!1),i(``)},a.current=s,s.start(),n(!0)},[e?.lang]),stop:(0,Q.useCallback)(()=>{a.current?.stop(),a.current=null,n(!1),i(``)},[]),supported:s}}var Tn=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),En=new Set([`application/pdf`]),Dn=[`text/`,`application/json`,`application/xml`,`application/javascript`,`application/typescript`,`application/x-yaml`,`application/toml`,`application/x-sh`],On=new Set(`.ts,.tsx,.js,.jsx,.mjs,.cjs,.py,.rb,.go,.rs,.java,.kt,.swift,.c,.cpp,.h,.hpp,.cs,.json,.yaml,.yml,.toml,.xml,.md,.mdx,.txt,.csv,.tsv,.html,.css,.scss,.less,.sass,.sh,.bash,.zsh,.fish,.sql,.graphql,.gql,.env,.ini,.cfg,.conf,.dockerfile,.makefile,.vue,.svelte,.astro,.ipynb`.split(`,`));function kn(e){return Tn.has(e.type)}function An(e){if(Tn.has(e.type)||En.has(e.type)||Dn.some(t=>e.type.startsWith(t)))return!0;let t=jn(e.name);return!!(t&&On.has(t))}function jn(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t).toLowerCase()}function Mn({attachments:e,onRemove:t}){return e.length===0?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-2 md:px-4 pt-2`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-border bg-surface px-2 py-1 text-xs text-text-secondary max-w-48`,children:[e.previewUrl?(0,$.jsx)(`img`,{src:e.previewUrl,alt:e.name,className:`size-5 rounded object-cover shrink-0`}):e.isImage?(0,$.jsx)(Ge,{className:`size-3.5 shrink-0 text-text-subtle`}):(0,$.jsx)(ce,{className:`size-3.5 shrink-0 text-text-subtle`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),e.status===`uploading`?(0,$.jsx)(Z,{className:`size-3 shrink-0 animate-spin text-text-subtle`}):e.status===`error`?(0,$.jsx)(`span`,{className:`text-red-500 shrink-0`,title:`Upload failed`,children:`!`}):null,(0,$.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),className:`shrink-0 rounded-sm p-0.5 hover:bg-border/50 transition-colors`,"aria-label":`Remove ${e.name}`,children:(0,$.jsx)(a,{className:`size-3`})})]},e.id))})}var Nn=[{id:`default`,label:`Ask before edits`,icon:Ue,description:`Claude will ask for approval before making each edit`},{id:`acceptEdits`,label:`Edit automatically`,icon:s,description:`Claude will edit files without asking first`},{id:`plan`,label:`Plan mode`,icon:He,description:`Claude will present a plan before editing`},{id:`bypassPermissions`,label:`Bypass permissions`,icon:et,description:`Claude will not ask before running commands`}];function Pn(e){return Nn.find(t=>t.id===e)?.label??`Unknown`}function Fn(e){return Nn.find(t=>t.id===e)?.icon??Ue}function In({value:e,onChange:t,open:n,onOpenChange:r}){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!i.current.contains(e.target)&&r(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n,r]),(0,Q.useEffect)(()=>{n&&(a.current=Nn.findIndex(t=>t.id===e),a.current<0&&(a.current=0))},[n,e]);let o=(0,Q.useCallback)(e=>{if(e.key===`Escape`){r(!1);return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;a.current=(a.current+t+Nn.length)%Nn.length,(i.current?.querySelector(`[data-idx="${a.current}"]`))?.focus()}if(e.key===`Enter`){e.preventDefault();let n=Nn[a.current];n&&(t(n.id),r(!1))}},[t,r]);return n?(0,$.jsxs)(`div`,{ref:i,role:`listbox`,"aria-label":`Permission modes`,onKeyDown:o,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`absolute bottom-full left-0 mb-1 z-50 w-72 md:w-80 rounded-lg border border-border bg-surface shadow-lg`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-text-secondary`,children:`Modes`}),(0,$.jsx)(`kbd`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-surface-elevated text-text-subtle border border-border`,children:`Shift + Tab`})]}),(0,$.jsx)(`div`,{className:`py-1`,children:Nn.map((n,i)=>{let a=n.icon,o=n.id===e;return(0,$.jsxs)(`button`,{"data-idx":i,role:`option`,"aria-selected":o,tabIndex:0,onClick:()=>{t(n.id),r(!1)},className:`w-full flex items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-surface-elevated focus:bg-surface-elevated focus:outline-none ${o?`bg-surface-elevated`:``}`,children:[(0,$.jsx)(a,{className:`size-4 mt-0.5 shrink-0 text-text-secondary`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-text-primary`,children:n.label}),(0,$.jsx)(`div`,{className:`text-xs text-text-subtle leading-snug`,children:n.description})]}),o&&(0,$.jsx)(re,{className:`size-4 mt-0.5 shrink-0 text-primary`})]},n.id)})})]}):null}function Ln(e){let t=[];function n(e){for(let r of e)t.push(r),r.children&&n(r.children)}return n(e),t}function Rn({items:e,filter:t,onSelect:n,onClose:r,visible:i}){let[a,o]=(0,Q.useState)(0),s=(0,Q.useRef)(null),c=(()=>{if(!t)return e.slice(0,50);let n=t.toLowerCase();return e.filter(e=>e.path.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)).slice(0,50)})();(0,Q.useEffect)(()=>{o(0)},[t]),(0,Q.useEffect)(()=>{let e=s.current;e&&e.children[a]?.scrollIntoView({block:`nearest`})},[a]);let l=(0,Q.useCallback)(e=>{if(!i||c.length===0)return!1;switch(e.key){case`ArrowUp`:return e.preventDefault(),o(e=>e>0?e-1:c.length-1),!0;case`ArrowDown`:return e.preventDefault(),o(e=>e<c.length-1?e+1:0),!0;case`Enter`:case`Tab`:return e.preventDefault(),c[a]&&n(c[a]),!0;case`Escape`:return e.preventDefault(),r(),!0}return!1},[i,c,a,n,r]);return(0,Q.useEffect)(()=>{if(!i)return;let e=e=>{l(e)&&e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i,l]),!i||c.length===0?null:(0,$.jsx)(`div`,{className:`max-h-52 overflow-y-auto border-b border-border bg-surface`,children:(0,$.jsx)(`div`,{ref:s,className:`py-1`,children:c.map((e,t)=>(0,$.jsxs)(`button`,{className:`flex items-center gap-2 w-full px-3 py-1.5 text-left transition-colors ${t===a?`bg-primary/10 text-primary`:`hover:bg-surface-hover text-text-primary`}`,onMouseEnter:()=>o(t),onClick:()=>n(e),children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:e.type===`directory`?(0,$.jsx)(se,{className:`size-4 text-amber-500`}):(0,$.jsx)(Le,{className:`size-4 text-blue-400`})}),(0,$.jsx)(`span`,{className:`text-sm truncate`,children:e.path})]},e.path))})})}var zn=(0,Q.memo)(function({onSend:e,isStreaming:t,onCancel:n,disabled:i,projectName:a,onSlashStateChange:o,onSlashItemsLoaded:s,slashSelected:c,onFileStateChange:l,onFileItemsLoaded:d,fileSelected:f,externalFiles:p,initialValue:m,autoFocus:g,permissionMode:b,onModeChange:x,providerId:ee,onProviderChange:S}){let[C,w]=(0,Q.useState)(m??``),[T,E]=(0,Q.useState)([]),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(`next`),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),te=(0,Q.useRef)(null),F=(0,Q.useRef)([]),I=(0,Q.useRef)(!1),L=(0,Q.useRef)(void 0),R=(0,Q.useRef)(0),z=(0,Q.useRef)([]),B=wn(),V=(0,Q.useRef)(``),H=(0,Q.useCallback)(e=>{let t=V.current;w(t?t+` `+e:e),requestAnimationFrame(()=>{let e=window.matchMedia(`(min-width: 768px)`).matches?N.current:P.current;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,160)+`px`)})},[]),U=(0,Q.useCallback)(()=>{B.isListening?B.stop():(V.current=C.trim(),B.start(H))},[B.isListening,B.start,B.stop,C,H]);(0,Q.useEffect)(()=>{let e=()=>{B.supported&&U()};return window.addEventListener(`toggle-voice-input`,e),()=>window.removeEventListener(`toggle-voice-input`,e)},[B.supported,U]),(0,Q.useEffect)(()=>{m&&(w(m),setTimeout(()=>{let e=N.current;e&&(e.focus(),e.selectionStart=e.selectionEnd=e.value.length)},50))},[m]),(0,Q.useEffect)(()=>{g&&setTimeout(()=>{(window.matchMedia(`(min-width: 768px)`).matches?N.current:P.current)?.focus()},100)},[]),(0,Q.useEffect)(()=>{if(!a){F.current=[],s?.([],!1);return}y.get(`${_(a)}/chat/slash-items`).then(e=>{F.current=e,I.current=!1,s?.(e,!1)}).catch(()=>{F.current=[],s?.([],!1)})},[a]),(0,Q.useEffect)(()=>()=>{L.current&&clearTimeout(L.current)},[]),(0,Q.useEffect)(()=>{if(!a){z.current=[],d?.([]);return}y.get(`${_(a)}/files/tree?depth=5`).then(e=>{let t=Ln(e);z.current=t,d?.(t)}).catch(()=>{z.current=[],d?.([])})},[a]),(0,Q.useEffect)(()=>{if(!c)return;let e=N.current,t=e?.selectionStart??C.length,n=C.slice(0,t),r=C.slice(t),i=n.replace(/(?:^|\s)\/\S*$/,e=>`${e.startsWith(`/`)?``:e[0]}/${c.name} `);w(i+r),o?.(!1,``),l?.(!1,``),e&&(e.focus(),setTimeout(()=>{e.selectionStart=e.selectionEnd=i.length},0))},[c]),(0,Q.useEffect)(()=>{if(!f)return;let e=N.current;if(!e)return;let t=e.selectionStart,n=C.slice(0,t),r=C.slice(t),i=n.match(/@(\S*)$/);if(i){let t=n.length-i[0].length;w(n.slice(0,t)+`@${f.path} `+r);let a=t+f.path.length+2;setTimeout(()=>{e.selectionStart=e.selectionEnd=a,e.focus()},0)}else{let t=C+`@${f.path} `;w(t),setTimeout(()=>{e.selectionStart=e.selectionEnd=t.length,e.focus()},0)}l?.(!1,``)},[f]),(0,Q.useEffect)(()=>{!p||p.length===0||G(p)},[p]);let W=(0,Q.useCallback)(async e=>{if(!a)return null;try{let t=new FormData;t.append(`files`,e);let n={},r=v();r&&(n.Authorization=`Bearer ${r}`);let i=await(await fetch(`${_(a)}/chat/upload`,{method:`POST`,headers:n,body:t})).json();return i.ok&&Array.isArray(i.data)&&i.data.length>0?i.data[0].path:null}catch{return null}},[a]),G=(0,Q.useCallback)(e=>{for(let t of e){if(!An(t)){w(e=>e+(e.length>0&&!e.endsWith(` `)?` `:``)+t.name);continue}let e=h(),n=kn(t),r=n?URL.createObjectURL(t):void 0,i={id:e,name:t.name,file:t,isImage:n,previewUrl:r,status:`uploading`};E(e=>[...e,i]),W(t).then(t=>{E(n=>n.map(n=>n.id===e?{...n,serverPath:t??void 0,status:t?`ready`:`error`}:n))})}(P.current??N.current)?.focus()},[W]),ne=(0,Q.useCallback)(e=>{E(t=>{let n=t.find(t=>t.id===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.id!==e)})},[]),K=(0,Q.useCallback)(()=>{let n=C.trim(),r=T.filter(e=>e.status===`ready`);if(!n&&r.length===0){A(!1);return}o?.(!1,``),l?.(!1,``),B.isListening&&B.stop(),e(n,r,t?j:void 0),w(``);for(let e of T)e.previewUrl&&URL.revokeObjectURL(e.previewUrl);E([]),A(!1),M(`next`),N.current&&(N.current.style.height=`auto`),P.current&&(P.current.style.height=`auto`)},[C,T,e,o,l,t,j]),q=(0,Q.useCallback)(()=>{if(!i){if(T.some(e=>e.status===`uploading`)){(C.trim()||T.some(e=>e.status!==`error`))&&A(!0);return}K()}},[C,T,i,K]);(0,Q.useEffect)(()=>{k&&(T.some(e=>e.status===`uploading`)||K())},[k,T,K]);let re=(0,Q.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),q();return}if(e.shiftKey&&e.key===`Tab`){e.preventDefault();let t=[`default`,`acceptEdits`,`plan`,`bypassPermissions`],n=t[(t.indexOf(b??`bypassPermissions`)+1)%t.length];x?.(n)}},[q,b,x]),ie=(0,Q.useCallback)(e=>{if(L.current&&clearTimeout(L.current),!a||!e)return;let t=++R.current;L.current=setTimeout(()=>{y.get(`${_(a)}/chat/slash-items?q=${encodeURIComponent(e)}`).then(e=>{t===R.current&&(F.current=e,I.current=!0,s?.(e,!0))}).catch(()=>{t===R.current&&(I.current=!1)})},150)},[a,s]),J=(0,Q.useCallback)((e,t)=>{let n=e.slice(0,t),r=n.match(/(?:^|\s)\/(\S*)$/);if(r&&F.current.length>0){let e=r[1]??``;o?.(!0,e),l?.(!1,``),e&&ie(e);return}L.current&&clearTimeout(L.current),I.current&&=!1;let i=n.match(/@(\S*)$/);if(i&&z.current.length>0){l?.(!0,i[1]??``),o?.(!1,``);return}o?.(!1,``),l?.(!1,``)},[o,l,ie]),Y=(0,Q.useCallback)((e,t)=>{w(e),J(e,t)},[J]),X=(0,Q.useCallback)(e=>{let t=e?.target??N.current;t&&(t.style.height=`auto`,t.style.height=Math.min(t.scrollHeight,160)+`px`)},[]),ae=(0,Q.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t)if(e.kind===`file`){let t=e.getAsFile();t&&n.push(t)}n.length>0&&(e.preventDefault(),G(n))},[G]),oe=(0,Q.useCallback)(e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length>0&&G(t)},[G]),se=(0,Q.useCallback)(e=>{e.preventDefault()},[]),ce=(0,Q.useCallback)(()=>{te.current?.click()},[]),le=(0,Q.useCallback)(e=>{let t=Array.from(e.target.files??[]);t.length>0&&G(t),e.target.value=``},[G]),ue=C.trim().length>0||T.some(e=>e.status!==`error`),de=t&&!ue;return(0,$.jsxs)(`div`,{className:`p-2 md:p-3 bg-background`,children:[(0,$.jsxs)(`div`,{className:`border border-border rounded-xl md:rounded-2xl bg-surface shadow-sm cursor-text`,onClick:e=>{i||e.target instanceof HTMLTextAreaElement||(window.matchMedia(`(min-width: 768px)`).matches?N.current:P.current)?.focus()},children:[(0,$.jsx)(Mn,{attachments:T,onRemove:ne}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-2 md:hidden relative`,children:[(0,$.jsx)(Bn,{mode:b??`bypassPermissions`,onClick:()=>O(e=>!e)}),(0,$.jsx)(In,{value:b??`bypassPermissions`,onChange:e=>x?.(e),open:D,onOpenChange:O}),S&&a&&(0,$.jsx)(Ce,{value:ee??`claude`,onChange:S,projectName:a}),t&&(0,$.jsx)(Hn,{value:j,onChange:M})]}),(0,$.jsxs)(`div`,{className:`flex items-end gap-1 md:hidden px-2 py-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ce()},disabled:i,className:`flex items-center justify-center size-7 shrink-0 rounded-full text-text-subtle hover:text-text-primary transition-colors disabled:opacity-50`,"aria-label":`Attach file`,children:(0,$.jsx)(Ze,{className:`size-4`})}),(0,$.jsx)(`textarea`,{ref:P,value:C,onChange:e=>{Y(e.target.value,e.target.selectionStart),X(e)},onKeyDown:re,onPaste:ae,onDrop:oe,onDragOver:se,placeholder:t?`Follow-up...`:`Ask anything...`,disabled:i,rows:1,className:`flex-1 resize-none bg-transparent py-1.5 text-sm text-foreground placeholder:text-text-subtle focus:outline-none disabled:opacity-50 max-h-20`}),B.supported&&(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),U()},disabled:i,className:`flex items-center justify-center size-7 shrink-0 rounded-full transition-colors disabled:opacity-50 ${B.isListening?`bg-red-600 text-white animate-pulse`:`text-text-subtle hover:text-text-primary`}`,"aria-label":B.isListening?`Stop voice input`:`Start voice input`,children:B.isListening?(0,$.jsx)(Ye,{className:`size-4`}):(0,$.jsx)(Ie,{className:`size-4`})}),de?(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:`flex items-center justify-center size-7 shrink-0 rounded-full bg-red-600 text-white hover:bg-red-500 transition-colors`,"aria-label":`Stop`,children:(0,$.jsx)(u,{className:`size-3`})}):(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k?A(!1):q()},disabled:i||!ue,className:`flex items-center justify-center size-7 shrink-0 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-30 transition-colors`,"aria-label":k?`Cancel queued send`:`Send`,children:k?(0,$.jsx)(Z,{className:`size-3.5 animate-spin`}):(0,$.jsx)(r,{className:`size-3.5`})})]}),(0,$.jsxs)(`div`,{className:`hidden md:block`,children:[(0,$.jsx)(`textarea`,{ref:N,value:C,onChange:e=>{Y(e.target.value,e.target.selectionStart),X(e)},onKeyDown:re,onPaste:ae,onDrop:oe,onDragOver:se,placeholder:t?`Follow-up or Stop...`:`Ask anything...`,disabled:i,rows:1,className:`w-full resize-none bg-transparent px-4 pt-3 pb-1 text-sm text-foreground placeholder:text-text-subtle focus:outline-none disabled:opacity-50 max-h-40`}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ce()},disabled:i,className:`flex items-center justify-center size-8 rounded-full text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors disabled:opacity-50`,"aria-label":`Attach file`,children:(0,$.jsx)(Ze,{className:`size-4`})}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Bn,{mode:b??`bypassPermissions`,onClick:()=>O(e=>!e)}),(0,$.jsx)(In,{value:b??`bypassPermissions`,onChange:e=>x?.(e),open:D,onOpenChange:O})]}),S&&a&&(0,$.jsx)(Ce,{value:ee??`claude`,onChange:S,projectName:a}),t&&(0,$.jsx)(Hn,{value:j,onChange:M})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[B.supported&&(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),U()},disabled:i,className:`flex items-center justify-center size-8 rounded-full transition-colors disabled:opacity-50 ${B.isListening?`bg-red-600 text-white animate-pulse`:`text-text-subtle hover:text-text-primary hover:bg-surface-elevated`}`,"aria-label":B.isListening?`Stop voice input`:`Start voice input`,children:B.isListening?(0,$.jsx)(Ye,{className:`size-4`}):(0,$.jsx)(Ie,{className:`size-4`})}),de?(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),n?.()},className:`flex items-center justify-center size-8 rounded-full bg-red-600 text-white hover:bg-red-500 transition-colors`,"aria-label":`Stop response`,children:(0,$.jsx)(u,{className:`size-3.5`})}):(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),k?A(!1):q()},disabled:i||!ue,className:`flex items-center justify-center size-8 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":k?`Cancel queued send`:`Send message`,children:k?(0,$.jsx)(Z,{className:`size-4 animate-spin`}):(0,$.jsx)(r,{className:`size-4`})})]})]})]})]}),(0,$.jsx)(`input`,{ref:te,type:`file`,multiple:!0,className:`hidden`,onChange:le})]})});function Bn({mode:e,onClick:t}){let n=Fn(e),r=Pn(e);return(0,$.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[11px] text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors border border-transparent hover:border-border`,"aria-label":`Permission mode: ${r}`,children:[(0,$.jsx)(n,{className:`size-3`}),(0,$.jsx)(`span`,{className:`max-w-[100px] truncate`,children:r})]})}var Vn=[{value:`now`,label:`Interrupt`,Icon:rt},{value:`next`,label:`Queue`,Icon:Ke},{value:`later`,label:`Later`,Icon:q}];function Hn({value:e,onChange:t}){let n=(0,Q.useCallback)(()=>{let n=[`next`,`later`,`now`];t(n[(n.indexOf(e)+1)%n.length])},[e,t]),r=Vn.find(t=>t.value===e)??Vn[1],i=r.Icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),n()},className:`inline-flex items-center gap-1 px-2 py-1 rounded-md text-[11px] text-text-subtle hover:text-text-primary hover:bg-surface-elevated transition-colors border border-transparent hover:border-border`,"aria-label":`Message priority: ${r.label}`,title:`Priority: ${r.label} (click to cycle)`,children:[(0,$.jsx)(i,{className:`size-3`}),(0,$.jsx)(`span`,{children:r.label})]})}function Un({items:e,filter:t,onSelect:n,onClose:r,visible:i,ranked:a}){let[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l=a?e:e.filter(e=>{let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)});(0,Q.useEffect)(()=>{s(0)},[t]),(0,Q.useEffect)(()=>{let e=c.current;e&&e.children[o]?.scrollIntoView({block:`nearest`})},[o]);let u=(0,Q.useCallback)(e=>{if(!i||l.length===0)return!1;switch(e.key){case`ArrowUp`:return e.preventDefault(),s(e=>e>0?e-1:l.length-1),!0;case`ArrowDown`:return e.preventDefault(),s(e=>e<l.length-1?e+1:0),!0;case`Enter`:case`Tab`:return e.preventDefault(),l[o]&&n(l[o]),!0;case`Escape`:return e.preventDefault(),r(),!0}return!1},[i,l,o,n,r]);return(0,Q.useEffect)(()=>{if(!i)return;let e=e=>{u(e)&&e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i,u]),!i||l.length===0?null:(0,$.jsx)(`div`,{className:`max-h-52 overflow-y-auto border-b border-border bg-surface`,children:(0,$.jsx)(`div`,{ref:c,className:`py-1`,children:l.map((e,t)=>(0,$.jsxs)(`button`,{className:`flex items-start gap-3 w-full px-3 py-2 text-left transition-colors ${t===o?`bg-primary/10 text-primary`:`hover:bg-surface-hover text-text-primary`}`,onMouseEnter:()=>s(t),onClick:()=>n(e),children:[(0,$.jsx)(`span`,{className:`shrink-0 mt-0.5`,children:e.type===`builtin`?(0,$.jsx)(rt,{className:`size-4 text-emerald-500`}):e.type===`skill`?(0,$.jsx)(tt,{className:`size-4 text-amber-500`}):(0,$.jsx)(M,{className:`size-4 text-blue-500`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-sm`,children:[`/`,e.name]}),e.argumentHint&&(0,$.jsx)(`span`,{className:`text-xs text-text-subtle`,children:e.argumentHint}),(0,$.jsx)(`span`,{className:`text-xs text-text-subtle capitalize ml-auto`,children:e.scope===`bundled`?`PPM`:e.scope===`user`?`global`:e.type})]}),e.description&&(0,$.jsx)(`p`,{className:`text-xs text-text-subtle mt-0.5 line-clamp-2`,children:e.description})]})]},`${e.type}-${e.name}`))})})}var Wn=`ppm-hienlh`;function Gn({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(`idle`);function y(){f(null),m(``),v(`idle`),u(null)}function b(){t(!1),y(),i(``),o(``),u(null)}async function x(){g(!0),u(null);try{let{url:e,state:t}=await j();f(t),v(`waiting`),window.open(e,`_blank`)}catch(e){u(e.message)}g(!1)}async function ee(){if(!(!p.trim()||!d)){g(!0),u(null);try{let e=p.trim();e.includes(`#`)&&(e=e.split(`#`)[0]??e),await C(e,d),b(),n(`Account connected via OAuth!`)}catch(e){u(e.message)}g(!1)}}async function S(){if(r.trim()){c(!0),u(null);try{await A({apiKey:r.trim(),label:a.trim()||void 0}),b(),n(`Account added!`)}catch(e){u(e.message)}c(!1)}}let w=r.trim()?r.trim().startsWith(`sk-ant-oat`)?`OAuth token (Claude Max/Pro)`:r.trim().startsWith(`sk-ant-api`)?`API key`:`Unknown format`:``;return(0,$.jsx)(z,{open:e,onOpenChange:e=>{e||b()},children:(0,$.jsxs)(L,{className:`sm:max-w-md`,children:[(0,$.jsxs)(N,{children:[(0,$.jsx)(be,{className:`text-sm`,children:`Add Claude Account`}),(0,$.jsx)(K,{className:`text-xs leading-relaxed`,children:`Connect via OAuth (recommended) or paste a token manually.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium`,children:`Recommended: Login with Claude`}),_===`idle`?(0,$.jsx)(G,{size:`sm`,className:`w-full h-8 text-xs`,onClick:x,disabled:h,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`size-3 animate-spin mr-1`}),` Opening...`]}):`Login with Claude`}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Authorize in the opened tab, then paste the code:`}),(0,$.jsx)(J,{placeholder:`Paste code here...`,value:p,onChange:e=>m(e.target.value),className:`text-xs h-8 font-mono`,autoFocus:!0}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(G,{size:`sm`,className:`flex-1 h-7 text-xs`,onClick:ee,disabled:!p.trim()||h,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`size-3 animate-spin mr-1`}),` Connecting...`]}):`Connect`}),(0,$.jsx)(G,{size:`sm`,variant:`ghost`,className:`h-7 text-xs`,onClick:y,children:`Cancel`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`flex-1 border-t`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`or paste token`}),(0,$.jsx)(`div`,{className:`flex-1 border-t`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(F,{htmlFor:`add-token`,className:`text-xs`,children:`Token`}),(0,$.jsx)(J,{id:`add-token`,type:`password`,placeholder:`sk-ant-...`,value:r,onChange:e=>i(e.target.value),className:`text-xs h-8 font-mono`}),w&&(0,$.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Detected: `,w]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(F,{htmlFor:`add-label`,className:`text-xs`,children:`Label (optional)`}),(0,$.jsx)(J,{id:`add-label`,placeholder:`e.g. Personal, Work`,value:a,onChange:e=>o(e.target.value),className:`text-xs h-8`})]})]}),l&&(0,$.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-red-500/10 text-red-600`,children:l}),(0,$.jsxs)(Se,{children:[(0,$.jsx)(G,{size:`sm`,variant:`outline`,className:`text-xs h-7`,onClick:b,children:`Cancel`}),(0,$.jsx)(G,{size:`sm`,className:`text-xs h-7`,onClick:S,disabled:!r.trim()||s,children:s?`Adding...`:`Add Token`})]})]})})}function Kn({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:i}){let a=n.filter(e=>e.hasRefreshToken),[o,s]=(0,Q.useState)(new Set),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1);e&&!g&&(s(r?new Set([r]):new Set(a.map(e=>e.id))),_(!0)),!e&&g&&_(!1);function y(){t(!1),l(``),d(!1),p(!1)}async function b(e){if(o.size===0)return;h(!0);let t=c.trim()||Wn;try{let n={"Content-Type":`application/json`},r=v();r&&(n.Authorization=`Bearer ${r}`);let a=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...o],includeRefreshToken:u,refreshBeforeExport:f})});if(!a.ok){let e=await a.json();throw Error(e.error??`Export failed: ${a.status}`)}let s=await a.text();if(e)try{await navigator.clipboard.writeText(s),i?.(`Backup copied to clipboard!`)}catch{Jn(s),i?.(`Backup downloaded.`)}else Jn(s),i?.(`Backup downloaded.`);y()}catch{}h(!1)}let x=o.size>0&&!m;return(0,$.jsx)(z,{open:e,onOpenChange:e=>{e||y()},children:(0,$.jsxs)(L,{className:`sm:max-w-md`,children:[(0,$.jsxs)(N,{children:[(0,$.jsxs)(be,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(he,{className:`size-3.5`}),` Export Accounts`]}),(0,$.jsx)(K,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,$.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>s(o.size===a.length?new Set:new Set(a.map(e=>e.id))),children:o.size===a.length?`Deselect all`:`Select all`})]}),a.length===0?(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,$.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:a.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:o.has(e.id),onChange:t=>{let n=new Set(o);t.target.checked?n.add(e.id):n.delete(e.id),s(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,$.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(F,{className:`text-xs`,children:[`Password `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(J,{type:`password`,placeholder:`Leave empty for default`,value:c,onChange:e=>l(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:u,onChange:e=>d(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,$.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:f,onChange:e=>p(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,$.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),u?(0,$.jsxs)(`div`,{className:`rounded-md border border-red-500/30 bg-red-500/5 p-2.5`,children:[(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-red-600`,children:`Full transfer — source accounts will expire`}),(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):f?(0,$.jsx)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-2.5`,children:(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-amber-600`,children:`Refresh before export — invalidates previous shares`})}):(0,$.jsx)(`div`,{className:`rounded-md border border-green-500/30 bg-green-500/5 p-2.5`,children:(0,$.jsx)(`p`,{className:`text-[10px] font-medium text-green-600`,children:`Share current token (safe)`})}),(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,$.jsxs)(Se,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,$.jsx)(G,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:y,children:`Cancel`}),(0,$.jsxs)(G,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!x,onClick:()=>b(!0),children:[(0,$.jsx)(R,{className:`size-3 mr-1`}),` Copy`]}),(0,$.jsx)(G,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!x,onClick:()=>b(!1),children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function qn({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null);function d(){t(!1),i(``),o(``),u(null)}async function f(){if(r.trim()){c(!0),u(null);try{let e=await D({data:r.trim(),password:a.trim()||Wn});d(),n(`Imported ${e.imported} account(s)`)}catch(e){u(e.message||`Import failed`)}c(!1)}}return(0,$.jsx)(z,{open:e,onOpenChange:e=>{e||d()},children:(0,$.jsxs)(L,{className:`sm:max-w-md`,children:[(0,$.jsxs)(N,{children:[(0,$.jsxs)(be,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(he,{className:`size-3.5`}),` Import Accounts`]}),(0,$.jsx)(K,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(F,{className:`text-xs`,children:`Backup data`}),(0,$.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(F,{className:`text-xs`,children:[`Password `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(J,{type:`password`,placeholder:`Leave empty for default`,value:a,onChange:e=>o(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),l&&(0,$.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-red-500/10 text-red-600`,children:l}),(0,$.jsxs)(Se,{children:[(0,$.jsx)(G,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:d,children:`Cancel`}),(0,$.jsx)(G,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||s,onClick:f,children:s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}function Jn(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}var Yn=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function Xn(e){return Yn?.addEventListener(`change`,e),()=>Yn?.removeEventListener(`change`,e)}function Zn(){return Yn?.matches??!0}function Qn(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(!0);return(0,Q.useEffect)(()=>{r(!0),E().then(t).finally(()=>r(!1))},[]),n?(0,$.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,$.jsxs)(de,{value:e.strategy,onValueChange:async e=>{t(await S({strategy:e}))},children:[(0,$.jsx)(we,{className:`w-full h-9 text-xs`,children:(0,$.jsx)(ge,{})}),(0,$.jsxs)(me,{children:[(0,$.jsx)(De,{value:`round-robin`,children:`Round-robin`}),(0,$.jsx)(De,{value:`fill-first`,children:`Fill-first`}),(0,$.jsx)(De,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,$.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,$.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await S({maxRetry:n}))}}),(0,$.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,$.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,$.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function $n({open:e,onOpenChange:t}){let n=(0,Q.useSyncExternalStore)(Xn,Zn);return e?n?(0,$.jsx)(z,{open:e,onOpenChange:t,children:(0,$.jsxs)(L,{className:`sm:max-w-sm`,children:[(0,$.jsx)(N,{children:(0,$.jsxs)(be,{className:`text-sm flex items-center gap-2`,children:[(0,$.jsx)(pe,{className:`size-4`}),` Rotation & Retry`]})}),(0,$.jsx)(Qn,{})]})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,$.jsxs)(`div`,{className:m(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,$.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,$.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,$.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,$.jsx)(pe,{className:`size-4`}),` Rotation & Retry`]}),(0,$.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,$.jsx)(a,{className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,$.jsx)(Qn,{})})]})]}):null}var er=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],tr=Array.from({length:24},(e,t)=>t);function nr(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function rr(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function ir(e){return tr.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function ar(e){return e===0?`bg-surface-elevated`:e<.3?`bg-green-500/30`:e<.5?`bg-green-500/60`:e<.7?`bg-amber-500/50`:e<.9?`bg-amber-500/80`:`bg-red-500/80`}function or(e){return e<.3?`bg-green-500`:e<.7?`bg-amber-500`:`bg-red-500`}function sr({accountId:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!0),[a,o]=(0,Q.useState)(`5h`);(0,Q.useEffect)(()=>{i(!0),ee(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let s=(0,Q.useMemo)(()=>t?nr(t,a):null,[t,a]),c=(0,Q.useMemo)(()=>s?rr(s):[],[s]),l=(0,Q.useMemo)(()=>s?ir(s):[],[s]),u=Math.max(...c,.01);if(Math.max(...l,.01),r)return(0,$.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,$.jsx)(Z,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,$.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let d=t.length,f=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,$.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,$.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,$.jsx)(`button`,{onClick:()=>o(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,$.jsx)(`button`,{onClick:()=>o(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${a===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,$.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,a===`5h`?`5-hour`:`weekly`,` limit usage over `,f,`d (`,d,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,$.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:er.map((e,t)=>{let n=c[t]??0;return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,$.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded-sm transition-all ${or(n)}`,style:{width:`${Math.round(n/u*100)}%`}})}),(0,$.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,$.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:tr.map(e=>{let t=l[e]??0;return(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,$.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${ar(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),s&&(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[er.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),tr.map(n=>{let r=s[t][n];return(0,$.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${ar(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,$.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,$.jsx)(`span`,{className:`w-4 shrink-0`}),tr.map(e=>(0,$.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,$.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,$.jsx)(`span`,{children:`Low`}),(0,$.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-green-500/30`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-green-500/60`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-amber-500/50`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-amber-500/80`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-red-500/80`})]}),(0,$.jsx)(`span`,{children:`High`}),(0,$.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,$.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,$.jsx)(`span`,{children:`No data`})]})]})}function cr(e){return e>=90?`text-red-500`:e>=70?`text-amber-500`:`text-green-500`}function lr(e){return e>=90?`bg-red-500`:e>=70?`bg-amber-500`:`bg-green-500`}function ur(e){if(!e)return null;let t=null;if(e.resetsInMinutes!=null)t=e.resetsInMinutes;else if(e.resetsInHours!=null)t=Math.round(e.resetsInHours*60);else if(e.resetsAt){let n=new Date(e.resetsAt).getTime()-Date.now();t=n>0?Math.ceil(n/6e4):0}if(t==null)return null;if(t<=0)return`now`;let n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?i>0?`${n}d ${r}h ${i}m`:r>0?`${n}d ${r}h`:`${n}d`:r>0?i>0?`${r}h ${i}m`:`${r}h`:`${i}m`}function dr({label:e,bucket:t}){if(!t)return null;let n=Math.round(t.utilization*100),r=ur(t);return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:e}),r&&(0,$.jsxs)(`span`,{className:`text-[10px] text-text-subtle`,title:`Resets in`,children:[`↻ `,r]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-border overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all ${lr(n)}`,style:{width:`${Math.min(n,100)}%`}})}),(0,$.jsxs)(`span`,{className:`text-xs font-medium tabular-nums w-10 text-right ${cr(n)}`,children:[n,`%`]})]})]})}function fr(e){let t=e-Date.now();if(t<=0)return`expired`;let n=Math.ceil(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return i>0?`${i}d ${r%24}h`:r>0?`${r}h ${n%60}m`:`${n}m`}function pr(e){if(!e)return{label:`unknown`,tip:`No account info available`,color:`text-text-subtle`};if(!e.expiresAt)return{label:`key`,tip:`API key (no expiry)`,color:`text-text-subtle`};let t=e.expiresAt*1e3<Date.now();return t&&e.hasRefreshToken?{label:`expired`,tip:`Token expired but has refresh token — will auto-renew`,color:`text-amber-500`}:t?{label:`expired`,tip:`Token expired, no refresh token`,color:`text-red-500`}:e.hasRefreshToken?{label:`long-lived`,tip:`OAuth token with refresh — long-lived`,color:`text-green-500`}:{label:`temp`,tip:`Temporary token without refresh — will expire`,color:`text-amber-500`}}function mr(e){if(!e)return null;let t=Math.round((Date.now()-e)/1e3);if(t<5)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60),i=n%60;return r<24?i>0?`${r}h ${i}m ago`:`${r}h ago`:`${Math.floor(r/24)}d ago`}function hr({entry:e,isActive:t,accountInfo:n,onToggle:r,onDelete:i,onExport:a,onViewProfile:o,flash:s,fullscreen:c}){let{usage:l}=e,u=l.session||l.weekly||l.weeklyOpus||l.weeklySonnet,d=n?.status??e.accountStatus,f=!!(n&&!n.hasRefreshToken&&n.expiresAt&&n.expiresAt<Math.floor(Date.now()/1e3));return(0,$.jsxs)(`div`,{className:`rounded-md border p-2 transition-colors duration-500 ${c?`flex flex-col gap-1.5 overflow-hidden`:`space-y-1.5 min-w-[200px] shrink-0 snap-start`} ${f?`opacity-50`:``} ${s?`bg-primary/10 border-primary/40`:``} ${t?`border-primary/30 bg-primary/5`:`border-border/50`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium truncate flex-1 min-w-0`,children:e.accountLabel??e.accountId.slice(0,8)}),f&&(0,$.jsx)(`span`,{className:`text-[9px] text-red-500 shrink-0 font-medium`,children:`Expired`}),!e.isOAuth&&!f&&(0,$.jsx)(`span`,{className:`text-[9px] text-text-subtle shrink-0`,children:`API key`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[!f&&o&&n?.profileData&&(0,$.jsx)(`button`,{className:`p-1 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors`,onClick:()=>o(n.profileData,e.accountId),title:`View profile`,children:(0,$.jsx)(I,{className:`size-3`})}),!f&&a&&e.isOAuth&&(0,$.jsx)(`button`,{className:`p-1 rounded cursor-pointer text-text-subtle hover:text-blue-500 hover:bg-surface-elevated transition-colors`,onClick:()=>a(e.accountId),title:`Export this account`,children:(0,$.jsx)(Y,{className:`size-3`})}),!f&&r&&(0,$.jsx)(Fe,{checked:d!==`disabled`,onCheckedChange:()=>r(e.accountId,d),disabled:d===`cooldown`,className:`scale-[0.6] cursor-pointer`}),i&&(0,$.jsx)(`button`,{className:`p-1 rounded cursor-pointer text-text-subtle hover:text-red-500 hover:bg-surface-elevated transition-colors`,onClick:()=>i(e.accountId,e.accountLabel??e.accountId.slice(0,8)),title:`Remove account`,children:(0,$.jsx)(ie,{className:`size-3`})})]})]}),u?(0,$.jsxs)(`div`,{className:c?`flex-1 flex flex-col justify-evenly min-h-0`:`space-y-1.5`,children:[(0,$.jsx)(dr,{label:`5-Hour Session`,bucket:l.session}),(0,$.jsx)(dr,{label:`Weekly`,bucket:l.weekly}),(0,$.jsx)(dr,{label:`Weekly (Opus)`,bucket:l.weeklyOpus}),(0,$.jsx)(dr,{label:`Weekly (Sonnet)`,bucket:l.weeklySonnet})]}):(0,$.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:e.isOAuth?`No usage data yet`:`Usage tracking not available for API keys`}),(()=>{let e=pr(n);return(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[9px] text-text-subtle flex-wrap`,children:[l.lastFetchedAt&&(0,$.jsxs)(`span`,{title:`Last usage data update`,children:[`↻ `,mr(new Date(l.lastFetchedAt).getTime())]}),n?.expiresAt&&n.expiresAt*1e3>Date.now()&&(0,$.jsxs)(`span`,{title:`Token expires in`,children:[`⏱ `,fr(n.expiresAt*1e3)]}),(0,$.jsxs)(`span`,{className:e.color,title:e.tip,children:[`© `,e.label]})]})})()]})}function gr({usage:e,visible:t,onClose:n,onReload:r,loading:i,lastFetchedAt:o}){let[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)([]),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(new Set),[y,b]=(0,Q.useState)(null),[ee,S]=(0,Q.useState)(!1),[C,E]=(0,Q.useState)(!1),[D,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(null),[te,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(null),B=(0,Q.useRef)(void 0),V=(0,Q.useRef)([]);function H(e){B.current&&clearTimeout(B.current),z(e),B.current=setTimeout(()=>z(null),4e3)}function U(e){W(),e&&H(e)}async function W(){let e=s.length>0;e?g(!0):m(!0);let[t,n,r]=await Promise.allSettled([w(),k(),x()]);if(t.status===`fulfilled`){let n=t.value;if(e&&V.current.length>0){let e=new Set,t=new Map(V.current.map(e=>[e.accountId,e]));for(let r of n){let n=t.get(r.accountId);if(!n){e.add(r.accountId);continue}let i=n.usage,a=r.usage;(i.session?.utilization!==a.session?.utilization||i.weekly?.utilization!==a.weekly?.utilization||i.weeklyOpus?.utilization!==a.weeklyOpus?.utilization||i.weeklySonnet?.utilization!==a.weeklySonnet?.utilization)&&e.add(r.accountId)}e.size>0&&(v(e),setTimeout(()=>v(new Set),1500))}V.current=n,c(n)}n.status===`fulfilled`&&u(n.value),r.status===`fulfilled`&&f(r.value?.id??null),m(!1),g(!1)}if((0,Q.useEffect)(()=>{t&&W()},[t]),(0,Q.useEffect)(()=>{!t||!o||W()},[o]),!t)return null;let G=new Map(l.map(e=>[e.id,e])),ne=e.queryCostUsd!=null||e.totalCostUsd!=null,K=s.length>0,q=s.length||1,re=Math.ceil(Math.sqrt(q)),ie=Math.ceil(q/re);async function J(e,t){await T(e,{status:t===`disabled`?`active`:`disabled`}),W(),r?.()}async function X(){if(N){try{await O(N.id),H(`Account "${N.display}" removed.`),W(),r?.()}catch(e){H(`Failed to remove: ${e.message}`)}P(null)}}function ae(){F(null),E(!0)}return(0,$.jsxs)(`div`,{className:`relative border-b border-border bg-surface px-3 py-2.5 ${I?`fixed inset-0 z-50 flex flex-col gap-2.5 overflow-hidden`:`space-y-2.5 max-h-[350px] overflow-y-auto`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-semibold text-text-primary`,children:`Usage & Accounts`}),o&&(0,$.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:mr(new Date(o).getTime())})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{onClick:()=>M(!0),className:`text-xs text-text-subtle hover:text-text-primary px-1 cursor-pointer`,title:`Rotation & retry settings`,children:(0,$.jsx)(pe,{className:`size-3`})}),K&&(0,$.jsx)(`button`,{onClick:()=>L(e=>!e),className:`text-xs text-text-subtle hover:text-text-primary px-1 cursor-pointer`,title:I?`Exit fullscreen`:`Fullscreen view`,children:I?(0,$.jsx)(Xe,{className:`size-3`}):(0,$.jsx)(Je,{className:`size-3`})}),r&&(0,$.jsx)(`button`,{onClick:()=>{r(),W()},disabled:i||h,className:`text-xs text-text-subtle hover:text-text-primary px-1 disabled:opacity-50 cursor-pointer`,title:`Refresh`,children:(0,$.jsx)(Ae,{className:`size-3 ${i||h?`animate-spin`:``}`})}),(0,$.jsx)(`button`,{onClick:()=>{L(!1),n()},className:`text-xs text-text-subtle hover:text-text-primary px-1 cursor-pointer`,children:(0,$.jsx)(a,{className:`size-3`})})]})]}),R&&(0,$.jsx)(`div`,{className:`text-[11px] p-1.5 rounded bg-green-500/10 text-green-600 text-center animate-in fade-in duration-200`,children:R}),K||p?(0,$.jsx)(`div`,{className:I?`flex-1 min-h-0 grid gap-2 overflow-hidden`:`flex gap-1.5 overflow-x-auto pb-1 -mx-3 px-3 snap-x snap-mandatory scrollbar-thin`,style:I?{gridTemplateColumns:`repeat(${re}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${ie}, minmax(0, 1fr))`}:void 0,children:p?(0,$.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Loading...`}):s.map(t=>(0,$.jsx)(hr,{entry:t,isActive:t.accountId===(d??e.activeAccountId),accountInfo:G.get(t.accountId),onToggle:J,onDelete:(e,t)=>P({id:e,display:t}),onExport:e=>{F(e),E(!0)},onViewProfile:(e,t)=>b({profile:e,accountId:t}),flash:_.has(t.accountId),fullscreen:I},t.accountId))}):(0,$.jsx)($.Fragment,{children:e.session||e.weekly||e.weeklyOpus||e.weeklySonnet?(0,$.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,$.jsx)(dr,{label:`5-Hour Session`,bucket:e.session}),(0,$.jsx)(dr,{label:`Weekly`,bucket:e.weekly}),(0,$.jsx)(dr,{label:`Weekly (Opus)`,bucket:e.weeklyOpus}),(0,$.jsx)(dr,{label:`Weekly (Sonnet)`,bucket:e.weeklySonnet})]}):(0,$.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`No usage data available`})}),ne&&(0,$.jsxs)(`div`,{className:`border-t border-border pt-2 space-y-1`,children:[e.queryCostUsd!=null&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Last query`}),(0,$.jsxs)(`span`,{className:`text-text-primary font-medium tabular-nums`,children:[`$`,e.queryCostUsd.toFixed(4)]})]}),e.totalCostUsd!=null&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Session total`}),(0,$.jsxs)(`span`,{className:`text-text-primary font-medium tabular-nums`,children:[`$`,e.totalCostUsd.toFixed(4)]})]})]}),y&&(0,$.jsxs)(`div`,{className:`border-t border-border pt-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,$.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Profile`}),(0,$.jsx)(`button`,{className:`text-text-subtle hover:text-foreground cursor-pointer`,onClick:()=>b(null),children:(0,$.jsx)(a,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-[70px_1fr] gap-x-2 gap-y-0.5 text-[10px]`,children:[y.profile.account?.display_name&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Name`}),(0,$.jsx)(`span`,{children:y.profile.account.display_name})]}),y.profile.account?.email&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Email`}),(0,$.jsx)(`span`,{children:y.profile.account.email})]}),y.profile.organization?.name&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Org`}),(0,$.jsx)(`span`,{children:y.profile.organization.name})]}),y.profile.organization?.organization_type&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Type`}),(0,$.jsx)(`span`,{children:y.profile.organization.organization_type})]}),y.profile.organization?.rate_limit_tier&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Tier`}),(0,$.jsx)(`span`,{children:y.profile.organization.rate_limit_tier})]}),y.profile.organization?.subscription_status&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`Status`}),(0,$.jsx)(`span`,{children:y.profile.organization.subscription_status})]})]}),(0,$.jsx)(sr,{accountId:y.accountId})]}),(0,$.jsxs)(`div`,{className:`border-t border-border pt-2 flex gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{onClick:()=>S(!0),className:`flex-1 flex items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-secondary hover:bg-surface-hover transition-colors cursor-pointer`,children:[(0,$.jsx)(ye,{className:`size-3`}),` Add`]}),(0,$.jsxs)(`button`,{onClick:ae,className:`flex-1 flex items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-secondary hover:bg-surface-hover transition-colors cursor-pointer`,children:[(0,$.jsx)(Y,{className:`size-3`}),` Export`]}),(0,$.jsxs)(`button`,{onClick:()=>A(!0),className:`flex-1 flex items-center justify-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-secondary hover:bg-surface-hover transition-colors cursor-pointer`,children:[(0,$.jsx)(oe,{className:`size-3`}),` Import`]})]}),N&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-md`,children:(0,$.jsxs)(`div`,{className:`bg-surface border border-border rounded-lg shadow-lg p-4 mx-4 max-w-[280px] w-full space-y-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-text-primary text-center`,children:[`Remove `,(0,$.jsx)(`strong`,{className:`text-foreground`,children:N.display}),`?`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`button`,{onClick:()=>P(null),className:`flex-1 px-3 py-1.5 rounded-md text-xs border border-border text-text-secondary hover:bg-surface-hover cursor-pointer transition-colors`,children:`Cancel`}),(0,$.jsx)(`button`,{onClick:X,className:`flex-1 px-3 py-1.5 rounded-md text-xs bg-red-500 text-white hover:bg-red-600 cursor-pointer transition-colors`,children:`Remove`})]})]})}),(0,$.jsx)(Gn,{open:ee,onOpenChange:S,onSuccess:U}),(0,$.jsx)(Kn,{open:C,onOpenChange:e=>{E(e),e||F(null)},accounts:l,preselectId:te,onMessage:H}),(0,$.jsx)(qn,{open:D,onOpenChange:A,onSuccess:U}),(0,$.jsx)($n,{open:j,onOpenChange:M})]})}var _r={active:`bg-green-500`,idle:`bg-yellow-500`,shutdown:`bg-zinc-400`},vr={task_assignment:{label:`task`,className:`bg-blue-500/20 text-blue-400`},idle_notification:{label:`idle`,className:`bg-yellow-500/20 text-yellow-400`},completion:{label:`done`,className:`bg-green-500/20 text-green-400`},shutdown_request:{label:`shutdown`,className:`bg-red-500/20 text-red-400`},shutdown_approved:{label:`shutdown ✓`,className:`bg-zinc-500/20 text-zinc-400`}};function yr({teamNames:e,messages:t}){let[n,r]=(0,Q.useState)(e[0]??``),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(!1),c=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{e.length>0&&!e.includes(n)&&r(e[0])},[e,n]);let l=(0,Q.useCallback)(async e=>{s(!0);try{a((await y.get(`/api/teams/${encodeURIComponent(e)}`))?.members??[])}catch{a([])}s(!1)},[]);(0,Q.useEffect)(()=>{n&&l(n)},[n,l]),(0,Q.useEffect)(()=>{c.current?.scrollIntoView({behavior:`smooth`})},[t.length]);let u=t.slice(-200);return(0,$.jsxs)(`div`,{className:`space-y-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 mb-2`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-1 overflow-x-auto min-w-0 flex-1`,children:e.map(e=>(0,$.jsx)(`button`,{onClick:()=>r(e),className:m(`px-2 py-0.5 text-[11px] rounded-md whitespace-nowrap transition-colors`,n===e?`bg-primary/10 text-primary font-medium`:`text-text-subtle hover:text-text-primary`),children:e},e))}),(0,$.jsx)(`button`,{onClick:()=>n&&l(n),className:`text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Refresh`,children:(0,$.jsx)(Ae,{className:m(`size-3`,o&&`animate-spin`)})})]}),i.length>0&&(0,$.jsxs)(`div`,{className:`pb-2 mb-2 border-b border-border/30`,children:[(0,$.jsx)(`div`,{className:`text-[10px] text-text-subtle uppercase tracking-wider mb-1`,children:`Members`}),(0,$.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:m(`size-1.5 rounded-full shrink-0`,_r[e.status]??`bg-zinc-400`)}),(0,$.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),e.model&&e.model!==`unknown`&&(0,$.jsxs)(`span`,{className:`text-text-subtle text-[10px]`,children:[`(`,e.model,`)`]}),(0,$.jsx)(`span`,{className:`ml-auto text-text-subtle text-[10px]`,children:e.status})]},e.name))})]}),(0,$.jsx)(`div`,{className:`max-h-40 overflow-y-auto`,children:u.length===0?(0,$.jsx)(`p`,{className:`text-xs text-text-subtle text-center py-2`,children:`No messages yet`}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[u.map((e,t)=>{let n=e.parsedType?vr[e.parsedType]:null,r=br(e.timestamp);return(0,$.jsxs)(`div`,{className:`text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 text-text-subtle`,children:[(0,$.jsx)(`span`,{className:`font-medium`,style:xr(e.color),children:e.from}),(0,$.jsx)(`span`,{children:`→`}),(0,$.jsx)(`span`,{children:e.to}),(0,$.jsx)(`span`,{className:`ml-auto text-[10px]`,children:r})]}),(0,$.jsxs)(`div`,{className:`mt-0.5 text-foreground/90 break-words`,children:[n&&(0,$.jsx)(`span`,{className:m(`inline-block px-1 py-0 rounded text-[9px] mr-1`,n.className),children:n.label}),e.summary??Sr(e.text)]})]},`${e.timestamp}-${t}`)}),(0,$.jsx)(`div`,{ref:c})]})})]})}function br(e){try{return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return``}}function xr(e){if(e&&(/^#[0-9a-fA-F]{3,8}$/.test(e)||/^[a-zA-Z]{3,20}$/.test(e)))return{color:e}}function Sr(e,t=120){if(!e)return``;try{let n=JSON.parse(e);return n.summary??n.text??e.slice(0,t)}catch{}return e.length>t?e.slice(0,t)+`...`:e}function Cr(e){try{return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}catch{return``}}function wr(e){return e>=90?`text-red-500`:e>=70?`text-amber-500`:`text-green-500`}function Tr({sessionId:e,projectName:t}){let[n,r]=(0,Q.useState)(!1);return(0,$.jsx)(`button`,{onClick:()=>{try{let n=y.get(`${_(t)}/chat/sessions/${e}/debug?project=${encodeURIComponent(t)}`).then(e=>{let t=[`PPM Session: ${e.ppmSessionId}`,`SDK Session: ${e.sdkSessionId}`,e.jsonlPath?`JSONL: ${e.jsonlPath}`:`JSONL: not found`,e.projectPath?`Project: ${e.projectPath}`:null].filter(Boolean).join(`
9
+ `);return new Blob([t],{type:`text/plain`})});navigator.clipboard.write([new ClipboardItem({"text/plain":n})]).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})}catch{}},className:`p-1 rounded transition-colors ${n?`text-green-500 bg-green-500/10`:`text-text-subtle hover:text-text-secondary hover:bg-surface-elevated`}`,title:n?`Copied!`:`Copy session debug info`,children:n?(0,$.jsx)(Ve,{className:`size-3`}):(0,$.jsx)(B,{className:`size-3`})})}function Er({projectName:e,usageInfo:t,usageLoading:n,refreshUsage:r,lastFetchedAt:i,sessionId:o,providerId:s,onSelectSession:c,onBugReport:l,isConnected:u,onReconnect:d,teamActivity:f,teamMessages:p,onTeamOpen:m}){let[h,g]=(0,Q.useState)(null),[v,b]=(0,Q.useState)([]),[x,ee]=(0,Q.useState)(!1),S=te(e=>o?e.notifications.has(o):!1),C=te(e=>e.clearForSession),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(!1),P=(0,Q.useRef)(null),F=U(e=>e.openTab),I=e=>{g(t=>t===e?null:e)},L=(0,Q.useCallback)(async()=>{if(e){ee(!0);try{let t=await y.get(`${_(e)}/chat/sessions?limit=50&offset=0`);b(t.sessions),j(t.hasMore)}catch{}finally{ee(!1)}}},[e]),R=(0,Q.useCallback)(async()=>{if(!(!e||M||!A)){N(!0);try{let t=v.filter(e=>!e.pinned).length,n=await y.get(`${_(e)}/chat/sessions?limit=50&offset=${t}`);b(e=>{let t=new Set(e.map(e=>e.id)),r=n.sessions.filter(e=>!t.has(e.id));return[...e,...r]}),j(n.hasMore)}catch{}finally{N(!1)}}},[e,M,A,v]);(0,Q.useEffect)(()=>{h===`history`&&v.length===0&&L()},[h]);function z(t){c?(c(t),g(null)):F({type:`chat`,title:t.title||`Chat`,projectId:e??null,metadata:{projectName:e,sessionId:t.id,providerId:t.providerId},closable:!0})}let B=(0,Q.useCallback)((e,t)=>{t.stopPropagation(),D(e.id),k(e.title||``),setTimeout(()=>P.current?.select(),0)},[]),H=(0,Q.useCallback)(async()=>{if(!E||!O.trim()||!e){D(null);return}try{await y.patch(`${_(e)}/chat/sessions/${E}`,{title:O.trim()}),b(e=>e.map(e=>e.id===E?{...e,title:O.trim()}:e))}catch{}D(null)},[E,O,e]),G=(0,Q.useCallback)(()=>D(null),[]),ne=(0,Q.useCallback)(async(t,n)=>{if(t.stopPropagation(),!e)return;let r=`${_(e)}/chat/sessions/${n.id}/pin`;try{n.pinned?await y.del(r):await y.put(r),b(e=>e.map(e=>e.id===n.id?{...e,pinned:!e.pinned}:e).sort((e,t)=>e.pinned&&!t.pinned?-1:!e.pinned&&t.pinned?1:new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()))}catch{}},[e]),K=(0,Q.useCallback)(async(t,n)=>{if(t.stopPropagation(),e&&window.confirm(`Delete this session? This cannot be undone.`))try{await y.del(`${_(e)}/chat/sessions/${n.id}?providerId=${n.providerId}`),b(e=>e.filter(e=>e.id!==n.id))}catch{}},[e]),q=w.trim()?v.filter(e=>(e.title||``).toLowerCase().includes(w.toLowerCase())):v,J=!s||s===`claude`,Y=t.fiveHour==null?null:Math.round(t.fiveHour*100),X=t.sevenDay==null?null:Math.round(t.sevenDay*100),ae=Y!=null||X!=null?wr(Math.max(Y??0,X??0)):`text-text-subtle`;return(0,$.jsxs)(`div`,{className:`border-b border-border/50`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1`,children:[(0,$.jsxs)(`button`,{onClick:()=>I(`history`),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] transition-colors ${h===`history`?`text-primary bg-primary/10`:`text-text-secondary hover:text-foreground hover:bg-surface-elevated`}`,children:[(0,$.jsx)(We,{className:`size-3`}),(0,$.jsx)(`span`,{children:`History`})]}),o&&s&&s!==`mock`?(0,$.jsxs)(`button`,{onClick:()=>I(`config`),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] transition-colors ${h===`config`?`text-primary bg-primary/10`:`text-text-secondary hover:text-foreground hover:bg-surface-elevated`}`,title:`AI Settings`,children:[(0,$.jsx)(le,{providerId:s}),(0,$.jsx)(`span`,{className:`capitalize`,children:s})]}):(0,$.jsx)(`button`,{onClick:()=>I(`config`),className:`p-1 rounded transition-colors ${h===`config`?`text-primary bg-primary/10`:`text-text-subtle hover:text-text-secondary hover:bg-surface-elevated`}`,title:`AI Settings`,children:(0,$.jsx)(Qe,{className:`size-3`})}),J?(0,$.jsxs)(`button`,{onClick:()=>I(`usage`),className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] font-medium tabular-nums transition-colors hover:bg-surface-elevated ${h===`usage`?`bg-primary/10`:``} ${ae}`,title:`Usage limits`,children:[(0,$.jsx)(ze,{className:`size-3`}),t.activeAccountLabel&&(0,$.jsxs)(`span`,{className:`text-text-secondary font-normal truncate max-w-[60px]`,children:[`[`,t.activeAccountLabel,`]`]}),(0,$.jsxs)(`span`,{children:[`5h:`,Y==null?`--%`:`${Y}%`]}),(0,$.jsx)(`span`,{className:`text-text-subtle`,children:`·`}),(0,$.jsxs)(`span`,{children:[`Wk:`,X==null?`--%`:`${X}%`]})]}):null,f?.hasTeams&&(0,$.jsxs)(`button`,{onClick:()=>{I(`team`),m?.()},className:`relative flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] transition-colors ${h===`team`?`text-primary bg-primary/10`:`text-text-secondary hover:text-foreground hover:bg-surface-elevated`}`,title:`Team activity`,children:[(0,$.jsx)(nt,{className:`size-3`}),(0,$.jsx)(`span`,{children:`Team`}),(f.unreadCount??0)>0&&(0,$.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-2 bg-primary rounded-full animate-pulse`})]}),(0,$.jsx)(`div`,{className:`flex-1`}),S&&o&&(0,$.jsx)(`button`,{onClick:()=>C(o),className:`p-1 rounded text-amber-500 hover:text-amber-400 hover:bg-surface-elevated transition-colors`,title:`Mark as read`,children:(0,$.jsx)(W,{className:`size-3`})}),o&&(0,$.jsx)(Tr,{sessionId:o,projectName:e}),d&&(0,$.jsx)(`button`,{onClick:d,className:`size-4 flex items-center justify-center`,title:u?`Connected`:`Disconnected — click to reconnect`,children:(0,$.jsx)(`span`,{className:`size-2 rounded-full ${u?`bg-green-500`:`bg-red-500 animate-pulse`}`})})]}),h===`history`&&(0,$.jsxs)(`div`,{className:`border-t border-border/30 bg-surface`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 border-b border-border/30`,children:[(0,$.jsx)(Pe,{className:`size-3 text-text-subtle shrink-0`}),(0,$.jsx)(`input`,{type:`text`,value:w,onChange:e=>T(e.target.value),placeholder:`Search sessions...`,className:`flex-1 bg-transparent text-[11px] text-text-primary outline-none placeholder:text-text-subtle`}),(0,$.jsx)(`button`,{onClick:L,disabled:x,className:`p-0.5 rounded text-text-subtle hover:text-text-secondary transition-colors disabled:opacity-50`,title:`Refresh`,children:(0,$.jsx)(Ae,{className:`size-3 ${x?`animate-spin`:``}`})})]}),(0,$.jsx)(`div`,{className:`max-h-[200px] overflow-y-auto`,children:x&&v.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,$.jsx)(Z,{className:`size-3.5 animate-spin text-text-subtle`})}):q.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-3 text-[11px] text-text-subtle`,children:w?`No matching sessions`:`No sessions yet`}):(0,$.jsxs)($.Fragment,{children:[q.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2 w-full px-3 py-1.5 text-left hover:bg-surface-elevated transition-colors group`,children:[(0,$.jsx)(le,{providerId:e.providerId}),E===e.id?(0,$.jsxs)(`form`,{className:`flex items-center gap-1 flex-1 min-w-0`,onSubmit:e=>{e.preventDefault(),H()},children:[(0,$.jsx)(`input`,{ref:P,value:O,onChange:e=>k(e.target.value),onBlur:H,onKeyDown:e=>{e.key===`Escape`&&G()},className:`flex-1 min-w-0 bg-surface-elevated text-[11px] text-text-primary px-1 py-0.5 rounded border border-border outline-none focus:border-primary`,autoFocus:!0}),(0,$.jsx)(`button`,{type:`submit`,className:`p-0.5 text-green-500 hover:text-green-400`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(re,{className:`size-3`})}),(0,$.jsx)(`button`,{type:`button`,className:`p-0.5 text-text-subtle hover:text-text-secondary`,onClick:e=>{e.stopPropagation(),G()},children:(0,$.jsx)(a,{className:`size-3`})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{onClick:()=>z(e),className:`text-[11px] truncate flex-1 text-left flex items-center gap-1`,children:[e.title?.startsWith(`[PPM]`)&&(0,$.jsx)(V,{className:`size-3 text-muted-foreground shrink-0`}),e.title?.startsWith(`[PPM]`)?e.title.slice(7):e.title||`Untitled`]}),(0,$.jsx)(`button`,{onClick:t=>ne(t,e),className:`p-0.5 rounded transition-all ${e.pinned?`text-primary hover:text-primary/70`:`text-text-subtle hover:text-text-secondary can-hover:opacity-0 can-hover:group-hover:opacity-100`}`,title:e.pinned?`Unpin session`:`Pin session`,children:e.pinned?(0,$.jsx)(Me,{className:`size-3`}):(0,$.jsx)(Ee,{className:`size-3`})}),(0,$.jsx)(`button`,{onClick:t=>B(e,t),className:`p-0.5 rounded text-text-subtle hover:text-text-secondary can-hover:opacity-0 can-hover:group-hover:opacity-100 transition-opacity`,title:`Rename session`,children:(0,$.jsx)(ue,{className:`size-3`})}),(0,$.jsx)(`button`,{onClick:t=>K(t,e),className:`p-0.5 rounded text-text-subtle hover:text-red-400 hover:bg-red-500/20 can-hover:opacity-0 can-hover:group-hover:opacity-100 transition-opacity`,title:`Delete session`,children:(0,$.jsx)(ie,{className:`size-3`})})]}),E!==e.id&&e.updatedAt&&(0,$.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0 w-10 text-right`,children:Cr(e.updatedAt)})]},e.id)),A&&!w&&(0,$.jsxs)(`button`,{onClick:R,disabled:M,className:`flex items-center justify-center gap-1 w-full py-1.5 text-[11px] text-text-subtle hover:text-text-secondary hover:bg-surface-elevated transition-colors`,children:[M?(0,$.jsx)(Z,{className:`size-3 animate-spin`}):null,M?`Loading...`:`Load more`]})]})})]}),h===`config`&&(0,$.jsx)(`div`,{className:`border-t border-border/30 bg-surface px-3 py-2 max-h-[280px] overflow-y-auto`,children:(0,$.jsx)(je,{compact:!0})}),h===`team`&&f?.hasTeams&&(0,$.jsx)(`div`,{className:`border-t border-border/30 bg-surface px-3 py-2 max-h-[280px] overflow-y-auto`,children:(0,$.jsx)(yr,{teamNames:f.teamNames,messages:p??[]})}),h===`usage`&&J&&(0,$.jsx)(gr,{usage:t,visible:!0,onClose:()=>g(null),onReload:r,loading:n,lastFetchedAt:i})]})}function Dr({metadata:e,tabId:t}){let[n,r]=(0,Q.useState)(e?.sessionId??null),[i,a]=(0,Q.useState)(e?.providerId??`claude`),[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[v,x]=(0,Q.useState)([]),[ee,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(e?.permissionMode??void 0),k=(0,Q.useRef)(null),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(0),F=e?.projectName??``,I=U(e=>e.updateTab),L=ae(e=>e.version),{usageInfo:R,usageLoading:z,lastFetchedAt:B,refreshUsage:V}=_t(F,i);(0,Q.useEffect)(()=>{D||b().then(e=>{let t=e.providers[e.default_provider??`claude`];O(t?.permission_mode??`bypassPermissions`)}).catch(()=>{})},[]),(0,Q.useEffect)(()=>{!t||!n||I(t,{metadata:{...e,sessionId:n,providerId:i,permissionMode:D}})},[n,i,D]);let{messages:W,messagesLoading:G,isStreaming:ne,phase:K,isReconnecting:q,connectingElapsed:re,pendingApproval:ie,contextWindowPct:J,compactStatus:Y,statusMessage:X,sessionTitle:se,sendMessage:ce,respondToApproval:le,cancelStreaming:ue,reconnect:de,refetchMessages:fe,isConnected:pe,teamActivity:me,teamMessages:he,markTeamRead:ge}=ht(n,i,F);(0,Q.useEffect)(()=>{if(pe&&k.current){let{content:e,permissionMode:t}=k.current;k.current=null,ce(e,{permissionMode:t})}},[pe,ce]),(0,Q.useEffect)(()=>{if(!n||!t)return;let e=()=>{if(document.hidden)return;let{panels:e,focusedPanelId:r}=H.getState();e[r]?.activeTabId===t&&te.getState().clearForSession(n)};e(),document.addEventListener(`visibilitychange`,e);let r=H.subscribe(e);return()=>{document.removeEventListener(`visibilitychange`,e),r()}},[n,t]),(0,Q.useEffect)(()=>{t&&se&&I(t,{title:se})},[se]);let[_e,ye]=(0,Q.useState)(e?.pendingMessage);(0,Q.useEffect)(()=>{_e&&pe&&n&&t&&I(t,{metadata:{...e,pendingMessage:void 0}})},[pe,n]),(0,Q.useCallback)(()=>{U.getState().openTab({type:`chat`,title:`AI Chat`,metadata:{projectName:F,providerId:i},projectId:F||null,closable:!0})},[F,i]);let be=(0,Q.useCallback)(e=>{r(e.id),a(e.providerId),t&&I(t,{title:e.title||`Chat`})},[t,I]),xe=(0,Q.useCallback)(async(e,t)=>{if(!(!n||!F))try{let{api:r,projectUrl:a}=await f(async()=>{let{api:e,projectUrl:t}=await import(`./api-client-BfBM3I7n.js`).then(e=>e.n);return{api:e,projectUrl:t}},__vite__mapDeps([0,1])),o=await r.post(`${a(F)}/chat/sessions/${n}/fork?providerId=${i}`,{messageId:t});U.getState().openTab({type:`chat`,title:`Fork: ${e.slice(0,30)}`,metadata:{projectName:F,sessionId:o.id,providerId:i,pendingMessage:e},projectId:F||null,closable:!0})}catch(e){console.error(`Fork failed:`,e)}},[n,F,i]),Se=(0,Q.useCallback)((e,t)=>{if(t.length===0)return e;let n=t.filter(e=>e.serverPath).map(e=>e.serverPath).join(`
10
+ `);return n?(t.length===1?`[Attached file: ${n}]\n\n`:`[Attached files:\n${n}\n]\n\n`)+e:e},[]),Ce=(0,Q.useCallback)(async(e,t=[],o)=>{let s=Se(e,t);if(s.trim()){if(!n)try{let t=F,n=await y.post(`${_(t)}/chat/sessions`,{providerId:i,title:e.slice(0,50)});r(n.id),a(n.providerId),k.current={content:s,permissionMode:D};return}catch(e){console.error(`Failed to create session:`,e);return}ce(s,{permissionMode:D,priority:o})}},[n,i,F,ce,Se,D]),we=(0,Q.useCallback)((e,t)=>{l(e),d(t),(!e||!t)&&m(!1)},[]),Te=(0,Q.useCallback)(e=>{g(e),l(!1),d(``),setTimeout(()=>g(null),50)},[]),Ee=(0,Q.useCallback)(()=>{l(!1),d(``)},[]),De=(0,Q.useCallback)((e,t)=>{S(e),w(t)},[]),Oe=(0,Q.useCallback)(e=>{E(e),S(!1),w(``),setTimeout(()=>E(null),50)},[]),ke=(0,Q.useCallback)(()=>{S(!1),w(``)},[]);return(0,$.jsxs)(`div`,{className:`flex flex-col h-full relative`,onDragEnter:(0,Q.useCallback)(e=>{e.preventDefault(),P.current++,e.dataTransfer.types.includes(`Files`)&&j(!0)},[]),onDragLeave:(0,Q.useCallback)(e=>{e.preventDefault(),P.current--,P.current===0&&j(!1)},[]),onDragOver:(0,Q.useCallback)(e=>{e.preventDefault()},[]),onDrop:(0,Q.useCallback)(e=>{e.preventDefault(),P.current=0,j(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&(N(t),setTimeout(()=>N(null),100))},[]),children:[A&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm border-2 border-dashed border-primary rounded-lg pointer-events-none`,children:(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-primary`,children:[(0,$.jsx)(oe,{className:`size-8`}),(0,$.jsx)(`span`,{className:`text-sm font-medium`,children:`Drop files to attach`})]})}),q&&(0,$.jsx)(`div`,{className:`absolute inset-0 z-50 flex items-center justify-center bg-background/60 backdrop-blur-sm`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(Z,{className:`size-4 animate-spin`}),(0,$.jsx)(`span`,{children:`Reconnecting...`})]})}),(0,$.jsx)(Jt,{messages:W,messagesLoading:G,pendingApproval:ie,onApprovalResponse:le,isStreaming:ne,phase:K,connectingElapsed:re,statusMessage:X,compactStatus:Y,projectName:F,onFork:ne?void 0:xe,onSelectSession:be}),(0,$.jsxs)(`div`,{className:`border-t border-border bg-background shrink-0`,children:[(0,$.jsx)(Er,{projectName:F,usageInfo:R,usageLoading:z,refreshUsage:V,lastFetchedAt:B,sessionId:n,providerId:i,onSelectSession:be,onBugReport:n?()=>ve(L,{sessionId:n,projectName:F}):void 0,isConnected:pe,onReconnect:()=>{pe||de(),fe()},teamActivity:me,teamMessages:he,onTeamOpen:ge}),(0,$.jsx)(Un,{items:o,filter:u,onSelect:Te,onClose:Ee,visible:c,ranked:p}),(0,$.jsx)(Rn,{items:v,filter:C,onSelect:Oe,onClose:ke,visible:ee}),(0,$.jsx)(zn,{onSend:(e,t,n)=>{_e&&ye(void 0),Ce(e,t,n)},isStreaming:ne,onCancel:ue,autoFocus:!e?.sessionId||!!_e,initialValue:_e,projectName:F,onSlashStateChange:we,onSlashItemsLoaded:(e,t)=>{s(e),t!==void 0&&m(t)},slashSelected:h,onFileStateChange:De,onFileItemsLoaded:x,fileSelected:T,externalFiles:M,permissionMode:D,onModeChange:O,providerId:i,onProviderChange:n?void 0:a})]})]})}export{Dr as ChatTab};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/csv-preview-D2pJJj3K.js","assets/chunk-CFjPhJqf.js","assets/lib-DurwGtQO.js","assets/react-nm2Ru1Pt.js","assets/createLucideIcon-PuMiQgHl.js","assets/arrow-up-BYhx9ckd.js","assets/react-dom-Bpkvzu3U.js","assets/jsx-runtime-kMwlnEGE.js","assets/csv-parser-CNNw2RVA.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import"./react-dom-Bpkvzu3U.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./chevron-right-4zq1jPv6.js";import{n as i,t as a}from"./markdown-renderer-Br_NykOI.js";import{t as o}from"./table-DFevCOMd.js";import{t as s}from"./text-wrap-BWNOVswA.js";import{t as c}from"./preload-helper-Bf_JiD2A.js";import{t as l}from"./jsx-runtime-kMwlnEGE.js";import"./dist-DIV6WgAG.js";import{t as u}from"./utils-BNytJOb1.js";import{i as d,r as f,t as p}from"./api-client-BfBM3I7n.js";import{Ct as m,Et as ee,K as h,R as g,S as _,St as v,Tt as y,Y as te,_ as b,_t as x,a as ne,at as re,b as S,bt as C,g as w,pt as T,v as E,vt as ie,w as ae,wt as D,x as O,xt as k,y as A,yt as j}from"./index-BFXOaZuI.js";import"./chunk-GEFDOKGD-D-pKjlVd.js";import"./src-BqX54PbV.js";import"./chunk-7R4GIKGN-Dv-4cAYn.js";import"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import"./chunk-PU5JKC2W-ek7k4QVB.js";import"./chunk-MX3YWQON-BpS_PtKp.js";import"./chunk-YBOYWFTD-rQG3QH5s.js";import"./chunk-PQ6SQG4A-TF58UVMU.js";import"./chunk-KYZI473N-Bb0MCaIO.js";import"./chunk-O4XLMI2P-nDhi_cVu.js";import"./chunk-GLR3WWYH-DKikpoJM.js";import"./chunk-XPW4576I-BPQQBakK.js";import{n as oe,t as se}from"./use-monaco-theme-x9tJcwlL.js";import{n as ce,t as le}from"./sql-completion-provider-DM9Qov6L.js";var M=n(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),N=e(t(),1),P=l(),ue={ts:k,tsx:k,js:k,jsx:k,py:k,rs:k,go:k,html:k,css:k,scss:k,json:v,md:C,txt:C,yaml:j,yml:j};function de(e,t){return t?x:ue[e.split(`.`).pop()?.toLowerCase()??``]??ie}function F(e,t){let n=[],r=e;for(let e=0;e<t.length;e++){let i=t[e],a=t.slice(0,e+1).join(`/`),o=r.find(e=>e.name===i);if(n.push({name:i,fullPath:a,node:o??null,siblings:r}),o?.children)r=o.children;else{for(let r=e+1;r<t.length;r++)n.push({name:t[r],fullPath:t.slice(0,r+1).join(`/`),node:null,siblings:[]});break}}return n}function I(e){return[...e].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)}function fe({filePath:e,projectName:t,tabId:n,className:i}){let a=g(e=>e.tree),{updateTab:o,openTab:s}=h(),c=(0,N.useRef)(null),l=(0,N.useMemo)(()=>F(a,e.split(`/`).filter(Boolean)),[a,e]);(0,N.useEffect)(()=>{c.current&&(c.current.scrollLeft=c.current.scrollWidth)},[l]);function d(e,r){let i=u(e);r.metaKey||r.ctrlKey?s({type:`editor`,title:i,metadata:{filePath:e,projectName:t},projectId:t,closable:!0}):o(n,{title:i,metadata:{filePath:e,projectName:t}})}return(0,P.jsx)(`div`,{ref:c,className:i,children:l.map((e,n)=>(0,P.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[n>0&&(0,P.jsx)(r,{className:`size-3 text-muted-foreground shrink-0 mx-0.5`}),e.siblings.length>0?(0,P.jsx)(pe,{segment:e,isLast:n===l.length-1,projectName:t,onFileClick:d}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground px-1 py-0.5`,children:e.name})]},e.fullPath))})}function pe({segment:e,isLast:t,projectName:n,onFileClick:r}){let i=(0,N.useMemo)(()=>I(e.siblings),[e.siblings]);return(0,P.jsxs)(w,{children:[(0,P.jsx)(_,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`text-xs px-1 py-0.5 rounded hover:bg-muted transition-colors truncate max-w-[120px] ${t?`text-foreground font-medium`:`text-muted-foreground`}`,children:e.name})}),(0,P.jsx)(b,{align:`start`,className:`max-h-[300px] p-1`,children:i.map(t=>(0,P.jsx)(L,{node:t,projectName:n,activePath:e.fullPath,onFileClick:r},t.path))})]})}function L({node:e,projectName:t,activePath:n,onFileClick:r}){let i=de(e.name,e.type===`directory`),a=e.path===n;return e.type===`directory`&&e.children&&e.children.length>0?(0,P.jsxs)(A,{children:[(0,P.jsxs)(O,{className:`text-xs gap-1.5 ${a?`bg-muted`:``}`,children:[(0,P.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,P.jsx)(S,{className:`max-h-[300px] overflow-y-auto p-1`,children:I(e.children).map(e=>(0,P.jsx)(L,{node:e,projectName:t,activePath:n,onFileClick:r},e.path))})]}):(0,P.jsxs)(E,{className:`text-xs gap-1.5 cursor-pointer ${a?`bg-muted`:``}`,onSelect:e=>{},onClick:t=>{e.type!==`directory`&&r(e.path,t)},children:[(0,P.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]})}function R({active:e,onClick:t,icon:n,label:r}){return(0,P.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors ${e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,P.jsx)(n,{className:`size-3`}),(0,P.jsx)(`span`,{className:`hidden sm:inline`,children:r})]})}function me({ext:e,mdMode:t,onMdModeChange:n,csvMode:r,onCsvModeChange:a,wordWrap:c,onToggleWordWrap:l,filePath:u,projectName:d,className:f}){return(0,P.jsxs)(`div`,{className:f,children:[(e===`md`||e===`mdx`)&&n&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(R,{active:t===`edit`,onClick:()=>n(`edit`),icon:i,label:`Edit`}),(0,P.jsx)(R,{active:t===`preview`,onClick:()=>n(`preview`),icon:m,label:`Preview`})]}),e===`csv`&&a&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(R,{active:r===`table`,onClick:()=>a(`table`),icon:o,label:`Table`}),(0,P.jsx)(R,{active:r===`raw`,onClick:()=>a(`raw`),icon:i,label:`Raw`})]}),(0,P.jsx)(R,{active:c,onClick:l,icon:s,label:`Wrap`}),u&&d&&(0,P.jsx)(R,{active:!1,onClick:()=>ae(d,u),icon:y,label:`Download`})]})}var he=(0,N.lazy)(()=>c(()=>import(`./csv-preview-D2pJJj3K.js`).then(e=>({default:e.CsvPreview})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),ge=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`]),_e=new Set([`db`,`sqlite`,`sqlite3`]);function z(e){return e.split(`.`).pop()?.toLowerCase()??``}function ve(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`,sql:`sql`}[z(e)]??`plaintext`}function B({metadata:e,tabId:t}){let n=e?.filePath,r=e?.projectName,i=e?.inlineContent,a=e?.inlineLanguage,[o,s]=(0,N.useState)(i??null),[c,l]=(0,N.useState)(`utf-8`),[f,m]=(0,N.useState)(!0),[g,_]=(0,N.useState)(null),[v,y]=(0,N.useState)(!1),b=(0,N.useRef)(null),x=(0,N.useRef)(``),S=(0,N.useRef)(null),{tabs:C,updateTab:w}=h(),{wordWrap:E,toggleWordWrap:ie}=te(),ae=se(),D=C.find(e=>e.id===t),O=n?z(n):``,k=ge.has(O),A=O===`pdf`,j=_e.has(O),ue=O===`md`||O===`mdx`,de=O===`csv`,F=O===`sql`,[I,pe]=(0,N.useState)(`preview`),[L,R]=(0,N.useState)(`table`),{connections:B,cachedTables:Se,refreshTables:Ce}=ne(),[V,we]=(0,N.useState)(()=>{if(!F||!n)return null;let e=localStorage.getItem(`ppm:sql-conn:${n}`);return e?Number(e):null}),H=(0,N.useRef)(null),U=(0,N.useRef)(null),W=(0,N.useMemo)(()=>B.find(e=>e.id===V)??null,[B,V]),Te=i!=null&&(a===`json`||a===`xml`),[G,K]=(0,N.useState)(!1),Ee=(0,N.useCallback)(()=>{if(i)if(G)s(i),K(!1);else{let e=i.trimStart();if(a===`json`)try{s(JSON.stringify(JSON.parse(e),null,2)),K(!0)}catch{}else if(a===`xml`){let t=0;s(e.replace(/(>)(<)(\/*)/g,`$1
2
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import"./react-dom-Bpkvzu3U.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./chevron-right-4zq1jPv6.js";import{n as i,t as a}from"./markdown-renderer-CYs_lrjt.js";import{t as o}from"./table-DFevCOMd.js";import{t as s}from"./text-wrap-BWNOVswA.js";import{t as c}from"./preload-helper-Bf_JiD2A.js";import{t as l}from"./jsx-runtime-kMwlnEGE.js";import"./dist-DIV6WgAG.js";import{t as u}from"./utils-BNytJOb1.js";import{i as d,r as f,t as p}from"./api-client-BfBM3I7n.js";import{Ct as m,Et as ee,K as h,R as g,S as _,St as v,Tt as y,Y as te,_ as b,_t as x,a as ne,at as re,b as S,bt as C,g as w,pt as T,v as E,vt as ie,w as ae,wt as D,x as O,xt as k,y as A,yt as j}from"./index-BDAqXmpQ.js";import"./chunk-GEFDOKGD-D-pKjlVd.js";import"./src-BqX54PbV.js";import"./chunk-7R4GIKGN-Dv-4cAYn.js";import"./chunk-HHEYEP7N-C7vxA5i9.js";import"./dist-CSJdAyA9.js";import"./chunk-PU5JKC2W-ek7k4QVB.js";import"./chunk-MX3YWQON-BpS_PtKp.js";import"./chunk-YBOYWFTD-rQG3QH5s.js";import"./chunk-PQ6SQG4A-TF58UVMU.js";import"./chunk-KYZI473N-Bb0MCaIO.js";import"./chunk-O4XLMI2P-nDhi_cVu.js";import"./chunk-GLR3WWYH-DKikpoJM.js";import"./chunk-XPW4576I-BPQQBakK.js";import{n as oe,t as se}from"./use-monaco-theme-7qyyJae5.js";import{n as ce,t as le}from"./sql-completion-provider-DM9Qov6L.js";var M=n(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),N=e(t(),1),P=l(),ue={ts:k,tsx:k,js:k,jsx:k,py:k,rs:k,go:k,html:k,css:k,scss:k,json:v,md:C,txt:C,yaml:j,yml:j};function de(e,t){return t?x:ue[e.split(`.`).pop()?.toLowerCase()??``]??ie}function F(e,t){let n=[],r=e;for(let e=0;e<t.length;e++){let i=t[e],a=t.slice(0,e+1).join(`/`),o=r.find(e=>e.name===i);if(n.push({name:i,fullPath:a,node:o??null,siblings:r}),o?.children)r=o.children;else{for(let r=e+1;r<t.length;r++)n.push({name:t[r],fullPath:t.slice(0,r+1).join(`/`),node:null,siblings:[]});break}}return n}function I(e){return[...e].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)}function fe({filePath:e,projectName:t,tabId:n,className:i}){let a=g(e=>e.tree),{updateTab:o,openTab:s}=h(),c=(0,N.useRef)(null),l=(0,N.useMemo)(()=>F(a,e.split(`/`).filter(Boolean)),[a,e]);(0,N.useEffect)(()=>{c.current&&(c.current.scrollLeft=c.current.scrollWidth)},[l]);function d(e,r){let i=u(e);r.metaKey||r.ctrlKey?s({type:`editor`,title:i,metadata:{filePath:e,projectName:t},projectId:t,closable:!0}):o(n,{title:i,metadata:{filePath:e,projectName:t}})}return(0,P.jsx)(`div`,{ref:c,className:i,children:l.map((e,n)=>(0,P.jsxs)(`div`,{className:`flex items-center shrink-0`,children:[n>0&&(0,P.jsx)(r,{className:`size-3 text-muted-foreground shrink-0 mx-0.5`}),e.siblings.length>0?(0,P.jsx)(pe,{segment:e,isLast:n===l.length-1,projectName:t,onFileClick:d}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground px-1 py-0.5`,children:e.name})]},e.fullPath))})}function pe({segment:e,isLast:t,projectName:n,onFileClick:r}){let i=(0,N.useMemo)(()=>I(e.siblings),[e.siblings]);return(0,P.jsxs)(w,{children:[(0,P.jsx)(_,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`text-xs px-1 py-0.5 rounded hover:bg-muted transition-colors truncate max-w-[120px] ${t?`text-foreground font-medium`:`text-muted-foreground`}`,children:e.name})}),(0,P.jsx)(b,{align:`start`,className:`max-h-[300px] p-1`,children:i.map(t=>(0,P.jsx)(L,{node:t,projectName:n,activePath:e.fullPath,onFileClick:r},t.path))})]})}function L({node:e,projectName:t,activePath:n,onFileClick:r}){let i=de(e.name,e.type===`directory`),a=e.path===n;return e.type===`directory`&&e.children&&e.children.length>0?(0,P.jsxs)(A,{children:[(0,P.jsxs)(O,{className:`text-xs gap-1.5 ${a?`bg-muted`:``}`,children:[(0,P.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,P.jsx)(S,{className:`max-h-[300px] overflow-y-auto p-1`,children:I(e.children).map(e=>(0,P.jsx)(L,{node:e,projectName:t,activePath:n,onFileClick:r},e.path))})]}):(0,P.jsxs)(E,{className:`text-xs gap-1.5 cursor-pointer ${a?`bg-muted`:``}`,onSelect:e=>{},onClick:t=>{e.type!==`directory`&&r(e.path,t)},children:[(0,P.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]})}function R({active:e,onClick:t,icon:n,label:r}){return(0,P.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors ${e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,P.jsx)(n,{className:`size-3`}),(0,P.jsx)(`span`,{className:`hidden sm:inline`,children:r})]})}function me({ext:e,mdMode:t,onMdModeChange:n,csvMode:r,onCsvModeChange:a,wordWrap:c,onToggleWordWrap:l,filePath:u,projectName:d,className:f}){return(0,P.jsxs)(`div`,{className:f,children:[(e===`md`||e===`mdx`)&&n&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(R,{active:t===`edit`,onClick:()=>n(`edit`),icon:i,label:`Edit`}),(0,P.jsx)(R,{active:t===`preview`,onClick:()=>n(`preview`),icon:m,label:`Preview`})]}),e===`csv`&&a&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(R,{active:r===`table`,onClick:()=>a(`table`),icon:o,label:`Table`}),(0,P.jsx)(R,{active:r===`raw`,onClick:()=>a(`raw`),icon:i,label:`Raw`})]}),(0,P.jsx)(R,{active:c,onClick:l,icon:s,label:`Wrap`}),u&&d&&(0,P.jsx)(R,{active:!1,onClick:()=>ae(d,u),icon:y,label:`Download`})]})}var he=(0,N.lazy)(()=>c(()=>import(`./csv-preview-D2pJJj3K.js`).then(e=>({default:e.CsvPreview})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),ge=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`]),_e=new Set([`db`,`sqlite`,`sqlite3`]);function z(e){return e.split(`.`).pop()?.toLowerCase()??``}function ve(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`,sql:`sql`}[z(e)]??`plaintext`}function B({metadata:e,tabId:t}){let n=e?.filePath,r=e?.projectName,i=e?.inlineContent,a=e?.inlineLanguage,[o,s]=(0,N.useState)(i??null),[c,l]=(0,N.useState)(`utf-8`),[f,m]=(0,N.useState)(!0),[g,_]=(0,N.useState)(null),[v,y]=(0,N.useState)(!1),b=(0,N.useRef)(null),x=(0,N.useRef)(``),S=(0,N.useRef)(null),{tabs:C,updateTab:w}=h(),{wordWrap:E,toggleWordWrap:ie}=te(),ae=se(),D=C.find(e=>e.id===t),O=n?z(n):``,k=ge.has(O),A=O===`pdf`,j=_e.has(O),ue=O===`md`||O===`mdx`,de=O===`csv`,F=O===`sql`,[I,pe]=(0,N.useState)(`preview`),[L,R]=(0,N.useState)(`table`),{connections:B,cachedTables:Se,refreshTables:Ce}=ne(),[V,we]=(0,N.useState)(()=>{if(!F||!n)return null;let e=localStorage.getItem(`ppm:sql-conn:${n}`);return e?Number(e):null}),H=(0,N.useRef)(null),U=(0,N.useRef)(null),W=(0,N.useMemo)(()=>B.find(e=>e.id===V)??null,[B,V]),Te=i!=null&&(a===`json`||a===`xml`),[G,K]=(0,N.useState)(!1),Ee=(0,N.useCallback)(()=>{if(i)if(G)s(i),K(!1);else{let e=i.trimStart();if(a===`json`)try{s(JSON.stringify(JSON.parse(e),null,2)),K(!0)}catch{}else if(a===`xml`){let t=0;s(e.replace(/(>)(<)(\/*)/g,`$1
3
3
  $2$3`).split(`
4
4
  `).map(e=>{let n=e.trim();n.startsWith(`</`)&&(t=Math.max(0,t-1));let r=` `.repeat(t)+n;return n.startsWith(`<`)&&!n.startsWith(`</`)&&!n.endsWith(`/>`)&&!n.includes(`</`)&&t++,r}).join(`
5
5
  `)),K(!0)}}},[i,a,G]),De=(0,N.useCallback)(e=>{we(e),n&&localStorage.setItem(`ppm:sql-conn:${n}`,String(e)),Ce(e).catch(()=>{})},[n,Ce]),q=(0,N.useMemo)(()=>{if(!F||!V)return;let e=(Se.get(V)??[]).map(e=>({name:e.tableName,schema:e.schemaName}));if(e.length!==0)return{tables:e,getColumns:async(e,t)=>p.get(`/api/db/connections/${V}/schema?table=${encodeURIComponent(e)}${t?`&schema=${encodeURIComponent(t)}`:``}`)}},[F,V,Se]);(0,N.useEffect)(()=>{if(!(!H.current||!q))return U.current?.dispose(),le(),U.current=H.current.languages.registerCompletionItemProvider(`sql`,ce(H.current,q)),()=>{U.current?.dispose()}},[q]);let Oe=h(e=>e.openTab),J=(0,N.useCallback)(e=>{W&&Oe({type:`database`,title:`${W.name} · Query`,projectId:null,closable:!0,metadata:{connectionId:W.id,connectionName:W.name,dbType:W.type,initialSql:e}})},[W,Oe]),ke=(0,N.useCallback)(()=>{if(!S.current||!W)return;let e=S.current,t=e.getSelection();J(t&&!t.isEmpty()?e.getModel()?.getValueInRange(t)??e.getValue():e.getValue())},[W,J]),Y=(0,N.useRef)([]),X=(0,N.useRef)(J);X.current=J,(0,N.useEffect)(()=>()=>{Y.current.forEach(e=>e.dispose()),Y.current=[]},[]),(0,N.useEffect)(()=>{j&&t&&w(t,{type:`sqlite`})},[j,t,w]);let Z=n?/^(\/|[A-Za-z]:[/\\])/.test(n):!1;(0,N.useEffect)(()=>{if(i!=null){m(!1);return}if(!n||!Z&&!r)return;if(k||A){m(!1);return}m(!0),_(null);let e=Z?`/api/fs/read?path=${encodeURIComponent(n)}`:`${d(r)}/files/read?path=${encodeURIComponent(n)}`;return p.get(e).then(e=>{s(e.content),e.encoding&&l(e.encoding),x.current=e.content,m(!1)}).catch(e=>{_(e instanceof Error?e.message:`Failed to load file`),m(!1)}),()=>{b.current&&clearTimeout(b.current)}},[n,r,k,A,Z]),(0,N.useEffect)(()=>{if(!D)return;let e=n?u(n):`Untitled`,t=v?`${e} \u25CF`:e;D.title!==t&&w(D.id,{title:t})},[v]);let Ae=(0,N.useCallback)(async e=>{if(n&&!(!Z&&!r))try{Z?await p.put(`/api/fs/write`,{path:n,content:e}):await p.put(`${d(r)}/files/write`,{path:n,content:e}),y(!1)}catch{}},[n,r,Z]);function je(e){let t=e??``;s(t),x.current=t,y(!0),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>Ae(x.current),1e3)}let Q=e?.lineNumber,Me=(0,N.useCallback)((e,t)=>{if(S.current=e,H.current=t,Q&&Q>0&&setTimeout(()=>{e.revealLineInCenter(Q),e.setPosition({lineNumber:Q,column:1}),e.focus()},100),e.addCommand(t.KeyMod.Alt|t.KeyCode.KeyZ,()=>te.getState().toggleWordWrap()),t.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0,noSuggestionDiagnostics:!0}),t.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0,noSuggestionDiagnostics:!0}),q&&(U.current?.dispose(),U.current=t.languages.registerCompletionItemProvider(`sql`,ce(t,q))),F){Y.current.forEach(e=>e.dispose()),Y.current=[];let n=e.addCommand(0,(e,t)=>{t&&X.current(t)});if(n){let e=t.languages.registerCodeLensProvider(`sql`,{provideCodeLenses:e=>{let t=[],r=e.getValue().split(`
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{n as r,t as i}from"./x-D2_KzIET.js";import{t as a}from"./chevron-right-4zq1jPv6.js";import{t as o}from"./jsx-runtime-kMwlnEGE.js";import{t as s}from"./api-client-BfBM3I7n.js";import{Ct as c,Et as l,K as u,Mt as d,Nt as f,Q as p,Tt as m,it as h,mt as g,ot as _,pt as v,rt as y,st as b,tt as x}from"./index-BFXOaZuI.js";import"./use-monaco-theme-x9tJcwlL.js";import{t as S}from"./sql-query-editor-yvUfZVDr.js";import{n as C}from"./csv-parser-CNNw2RVA.js";var w=n(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),T=n(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),E=e(t(),1);function D(e,t,n,r){return`ppm-db-${e}-${n}.${t}-p${r}`}function O(e,t,n,r){try{let i=sessionStorage.getItem(D(e,t,n,r));return i?JSON.parse(i):null}catch{return null}}function ee(e,t,n,r,i,a){try{sessionStorage.setItem(D(e,t,n,r),JSON.stringify({data:i,cols:a}))}catch{}}function k(e){let t=`/api/db/connections/${e}`,[n,r]=(0,E.useState)(null),[i,a]=(0,E.useState)(`public`),[o,c]=(0,E.useState)(null),[l,u]=(0,E.useState)([]),[d,f]=(0,E.useState)(!1),[p,m]=(0,E.useState)(null),[h,g]=(0,E.useState)(1),[_,v]=(0,E.useState)(null),[y,b]=(0,E.useState)(null),[x,S]=(0,E.useState)(!1),[C,w]=(0,E.useState)(null),[T,D]=(0,E.useState)(`ASC`),k=(0,E.useCallback)(async(r,a,o,l,d)=>{let p=r??n,g=a??i;if(!p)return;f(!0);let _=l===void 0?C:l,v=d??T;try{let n=_?`&orderBy=${encodeURIComponent(_)}&orderDir=${v}`:``,[r,i]=await Promise.all([s.get(`${t}/data?table=${encodeURIComponent(p)}&schema=${g}&page=${o??h}&limit=100${n}`),s.get(`${t}/schema?table=${encodeURIComponent(p)}&schema=${g}`)]);c(r),u(i),ee(e,p,g,o??h,r,i)}catch(e){m(e.message)}finally{f(!1)}},[t,e,n,i,h,C,T]),A=(0,E.useCallback)((t,n=`public`)=>{r(t),a(n),g(1),v(null);let i=O(e,t,n,1);i?(c(i.data),u(i.cols),f(!1),k(t,n,1)):k(t,n,1)},[e,k]),j=(0,E.useCallback)(e=>{g(e),k(void 0,void 0,e)},[k]),te=(0,E.useCallback)(async e=>{S(!0),b(null);try{let r=await s.post(`${t}/query`,{sql:e});v(r),r.changeType===`modify`&&k(n??void 0,i)}catch(e){b(e.message)}finally{S(!1)}},[t,n,i,k]),M=(0,E.useCallback)(async(e,r,a,o)=>{if(!n)return;let c=n,l=i;try{await s.put(`${t}/cell`,{table:c,schema:l,pkColumn:e,pkValue:r,column:a,value:o}),k(c,l)}catch(e){m(e.message)}},[t,n,i,k]),N=(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.del(`${t}/row`,{table:a,schema:o,pkColumn:e,pkValue:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]);return{selectedTable:n,selectedSchema:i,selectTable:A,tableData:o,schema:l,loading:d,error:p,page:h,setPage:j,orderBy:C,orderDir:T,toggleSort:(0,E.useCallback)(e=>{let t,n=`ASC`;C===e?T===`ASC`?(t=e,n=`DESC`):(t=null,n=`ASC`):(t=e,n=`ASC`),w(t),D(n),g(1),k(void 0,void 0,1,t,n)},[C,T,k]),queryResult:_,queryError:y,queryLoading:x,executeQuery:te,updateCell:M,deleteRow:N,bulkDelete:(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.post(`${t}/rows/delete`,{table:a,schema:o,pkColumn:e,pkValues:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]),insertRow:(0,E.useCallback)(async e=>{if(!n)return;let r=n,a=i;try{await s.post(`${t}/row`,{table:r,schema:a,values:e}),k(r,a)}catch(e){throw m(e.message),e}},[t,n,i,k]),refreshData:k,queryAsTable:(0,E.useCallback)(async e=>{f(!0);try{let n=await s.post(`${t}/query`,{sql:e});n.changeType===`select`&&c({columns:n.columns,rows:n.rows,total:n.rows.length,page:1,limit:n.rows.length})}catch(e){m(e.message)}finally{f(!1)}},[t])}}var A=o();function j(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function te({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,E.useState)(!1),[o,s]=(0,E.useState)(!1),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(!i)return;let e=e=>{c.current&&!c.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let l=()=>{let r=C(e,t.map(t=>e.map(e=>String(t[e]??``))));j(`${n}.csv`,r,`text/csv`),a(!1)},u=()=>{let e=JSON.stringify(t,null,2);j(`${n}.json`,e,`application/json`),a(!1)},d=async e=>{if(r){s(!0);try{let t=await(await fetch(`${r}&format=${e}&limit=10000`)).text(),i=e===`csv`?`text/csv`:`application/json`;j(`${n}-all.${e}`,t,i)}catch{}s(!1),a(!1)}};return e.length===0||t.length===0?null:(0,A.jsxs)(`div`,{className:`relative`,ref:c,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,title:`Export`,children:(0,A.jsx)(m,{className:`size-3.5`})}),i&&(0,A.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md py-1 min-w-[160px] text-xs`,children:[(0,A.jsx)(`button`,{onClick:l,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (CSV)`}),(0,A.jsx)(`button`,{onClick:u,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (JSON)`}),r&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`border-t border-border my-1`}),(0,A.jsx)(`button`,{onClick:()=>d(`csv`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (CSV)`}),(0,A.jsx)(`button`,{onClick:()=>d(`json`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (JSON)`})]})]})]})}function M({tableData:e,schema:t,loading:n,page:o,onPageChange:s,onCellUpdate:c,onRowDelete:l,orderBy:m,orderDir:g,onToggleSort:y,onBulkDelete:S,onInsertRow:C,connectionId:D,selectedTable:O,selectedSchema:ee,connectionName:k,columnFilters:j={},onColumnFilter:M}){let[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(null),[z,ae]=(0,E.useState)(``),[B,V]=(0,E.useState)(new Set),[oe,se]=(0,E.useState)(!1),[ce,le]=(0,E.useState)({}),[ue,de]=(0,E.useState)(null),[fe,pe]=(0,E.useState)(!1),{openTab:H}=u(),me=(0,E.useCallback)(e=>{H({type:`editor`,title:e.col,projectId:null,closable:!0,metadata:{inlineContent:e.value,inlineLanguage:ne(e.value)}})},[H]),[U,he]=(0,E.useState)(new Set),[ge,_e]=(0,E.useState)(new Set),[ve,ye]=(0,E.useState)(null),[be,W]=(0,E.useState)(!1),xe=(0,E.useRef)(null),G=(0,E.useMemo)(()=>t.find(e=>e.pk)?.name||(t.find(e=>e.name.toLowerCase()===`id`)?.name??null),[t]),Se=(0,E.useCallback)(e=>{let t=JSON.stringify(e,null,2),n=G?String(e[G]??``):``;H({type:`editor`,title:n?`Row ${n}`:`Row`,projectId:null,closable:!0,metadata:{inlineContent:t,inlineLanguage:`json`}})},[H,G]),Ce=(0,E.useRef)(N);Ce.current=N;let K=(0,E.useRef)(F);K.current=F;let we=(0,E.useRef)(B);we.current=B;let Te=(0,E.useRef)(L);Te.current=L;let Ee=(0,E.useCallback)((e,t,n)=>{P({rowIdx:e,col:t}),I(n==null?``:typeof n==`object`?JSON.stringify(n):String(n))},[]),De=(0,E.useCallback)(()=>{let t=Ce.current;if(!t||!e||!G)return;let n=e.rows[t.rowIdx];if(!n)return;let r=n[t.col];String(r??``)!==K.current&&c(G,n[G],t.col,K.current===``?null:K.current),P(null)},[e,G,c]),Oe=(0,E.useCallback)(()=>P(null),[]),ke=(0,E.useCallback)(t=>{if(!e||!G||!l)return;let n=e.rows[t];n&&(l(G,n[G]),R(null))},[e,G,l]),Ae=(0,E.useCallback)(e=>{he(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),je=(0,E.useCallback)(e=>{_e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Me=(0,E.useCallback)((e,t)=>{let n={...j};t?n[e]=t:delete n[e],M?.(n)},[j,M]),Ne=(0,E.useCallback)(e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Pe=(0,E.useCallback)(()=>{e&&V(t=>t.size===e.rows.length?new Set:new Set(e.rows.map((e,t)=>t)))},[e]),Fe=(0,E.useCallback)(()=>{!e||!G||!S||(S(G,Array.from(B).map(t=>e.rows[t]?.[G]).filter(e=>e!=null)),V(new Set),pe(!1))},[e,G,S,B]),Ie=(0,E.useCallback)(async()=>{if(C){de(null);try{let e={};for(let[t,n]of Object.entries(ce))n!==``&&(e[t]=n);await C(e),se(!1),le({})}catch(e){de(e.message)}}},[C,ce]),q=(0,E.useMemo)(()=>{if(!e||!z)return e?.rows??[];let t=z.toLowerCase();return e.rows.filter(n=>e.columns.some(e=>String(n[e]??``).toLowerCase().includes(t)))},[e,z]),Le=(0,E.useRef)(null);(0,E.useEffect)(()=>{let t=Le.current;if(!t)return;let n=t=>{if(t.key===`Escape`){W(!1);return}let n=t.target?.tagName;if(!(n===`INPUT`||n===`TEXTAREA`)){if(t.key===`/`){t.preventDefault(),W(!0);return}if(!(!(t.metaKey||t.ctrlKey)||!e)&&(t.key===`a`&&(t.preventDefault(),V(new Set(e.rows.map((e,t)=>t)))),t.key===`c`&&B.size>0)){t.preventDefault();let n=e.columns,r=n.join(` `),i=Array.from(B).sort((e,t)=>e-t).map(t=>n.map(n=>{let r=e.rows[t]?.[n];return r==null?``:typeof r==`object`?JSON.stringify(r):String(r)}).join(` `));navigator.clipboard.writeText([r,...i].join(`
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{n as r,t as i}from"./x-D2_KzIET.js";import{t as a}from"./chevron-right-4zq1jPv6.js";import{t as o}from"./jsx-runtime-kMwlnEGE.js";import{t as s}from"./api-client-BfBM3I7n.js";import{Ct as c,Et as l,K as u,Mt as d,Nt as f,Q as p,Tt as m,it as h,mt as g,ot as _,pt as v,rt as y,st as b,tt as x}from"./index-BDAqXmpQ.js";import"./use-monaco-theme-7qyyJae5.js";import{t as S}from"./sql-query-editor-Dxx-QZaI.js";import{n as C}from"./csv-parser-CNNw2RVA.js";var w=n(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),T=n(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),E=e(t(),1);function D(e,t,n,r){return`ppm-db-${e}-${n}.${t}-p${r}`}function O(e,t,n,r){try{let i=sessionStorage.getItem(D(e,t,n,r));return i?JSON.parse(i):null}catch{return null}}function ee(e,t,n,r,i,a){try{sessionStorage.setItem(D(e,t,n,r),JSON.stringify({data:i,cols:a}))}catch{}}function k(e){let t=`/api/db/connections/${e}`,[n,r]=(0,E.useState)(null),[i,a]=(0,E.useState)(`public`),[o,c]=(0,E.useState)(null),[l,u]=(0,E.useState)([]),[d,f]=(0,E.useState)(!1),[p,m]=(0,E.useState)(null),[h,g]=(0,E.useState)(1),[_,v]=(0,E.useState)(null),[y,b]=(0,E.useState)(null),[x,S]=(0,E.useState)(!1),[C,w]=(0,E.useState)(null),[T,D]=(0,E.useState)(`ASC`),k=(0,E.useCallback)(async(r,a,o,l,d)=>{let p=r??n,g=a??i;if(!p)return;f(!0);let _=l===void 0?C:l,v=d??T;try{let n=_?`&orderBy=${encodeURIComponent(_)}&orderDir=${v}`:``,[r,i]=await Promise.all([s.get(`${t}/data?table=${encodeURIComponent(p)}&schema=${g}&page=${o??h}&limit=100${n}`),s.get(`${t}/schema?table=${encodeURIComponent(p)}&schema=${g}`)]);c(r),u(i),ee(e,p,g,o??h,r,i)}catch(e){m(e.message)}finally{f(!1)}},[t,e,n,i,h,C,T]),A=(0,E.useCallback)((t,n=`public`)=>{r(t),a(n),g(1),v(null);let i=O(e,t,n,1);i?(c(i.data),u(i.cols),f(!1),k(t,n,1)):k(t,n,1)},[e,k]),j=(0,E.useCallback)(e=>{g(e),k(void 0,void 0,e)},[k]),te=(0,E.useCallback)(async e=>{S(!0),b(null);try{let r=await s.post(`${t}/query`,{sql:e});v(r),r.changeType===`modify`&&k(n??void 0,i)}catch(e){b(e.message)}finally{S(!1)}},[t,n,i,k]),M=(0,E.useCallback)(async(e,r,a,o)=>{if(!n)return;let c=n,l=i;try{await s.put(`${t}/cell`,{table:c,schema:l,pkColumn:e,pkValue:r,column:a,value:o}),k(c,l)}catch(e){m(e.message)}},[t,n,i,k]),N=(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.del(`${t}/row`,{table:a,schema:o,pkColumn:e,pkValue:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]);return{selectedTable:n,selectedSchema:i,selectTable:A,tableData:o,schema:l,loading:d,error:p,page:h,setPage:j,orderBy:C,orderDir:T,toggleSort:(0,E.useCallback)(e=>{let t,n=`ASC`;C===e?T===`ASC`?(t=e,n=`DESC`):(t=null,n=`ASC`):(t=e,n=`ASC`),w(t),D(n),g(1),k(void 0,void 0,1,t,n)},[C,T,k]),queryResult:_,queryError:y,queryLoading:x,executeQuery:te,updateCell:M,deleteRow:N,bulkDelete:(0,E.useCallback)(async(e,r)=>{if(!n)return;let a=n,o=i;try{await s.post(`${t}/rows/delete`,{table:a,schema:o,pkColumn:e,pkValues:r}),k(a,o)}catch(e){m(e.message)}},[t,n,i,k]),insertRow:(0,E.useCallback)(async e=>{if(!n)return;let r=n,a=i;try{await s.post(`${t}/row`,{table:r,schema:a,values:e}),k(r,a)}catch(e){throw m(e.message),e}},[t,n,i,k]),refreshData:k,queryAsTable:(0,E.useCallback)(async e=>{f(!0);try{let n=await s.post(`${t}/query`,{sql:e});n.changeType===`select`&&c({columns:n.columns,rows:n.rows,total:n.rows.length,page:1,limit:n.rows.length})}catch(e){m(e.message)}finally{f(!1)}},[t])}}var A=o();function j(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function te({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,E.useState)(!1),[o,s]=(0,E.useState)(!1),c=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(!i)return;let e=e=>{c.current&&!c.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let l=()=>{let r=C(e,t.map(t=>e.map(e=>String(t[e]??``))));j(`${n}.csv`,r,`text/csv`),a(!1)},u=()=>{let e=JSON.stringify(t,null,2);j(`${n}.json`,e,`application/json`),a(!1)},d=async e=>{if(r){s(!0);try{let t=await(await fetch(`${r}&format=${e}&limit=10000`)).text(),i=e===`csv`?`text/csv`:`application/json`;j(`${n}-all.${e}`,t,i)}catch{}s(!1),a(!1)}};return e.length===0||t.length===0?null:(0,A.jsxs)(`div`,{className:`relative`,ref:c,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,title:`Export`,children:(0,A.jsx)(m,{className:`size-3.5`})}),i&&(0,A.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md py-1 min-w-[160px] text-xs`,children:[(0,A.jsx)(`button`,{onClick:l,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (CSV)`}),(0,A.jsx)(`button`,{onClick:u,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors`,children:`Export Page (JSON)`}),r&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`border-t border-border my-1`}),(0,A.jsx)(`button`,{onClick:()=>d(`csv`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (CSV)`}),(0,A.jsx)(`button`,{onClick:()=>d(`json`),disabled:o,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50`,children:o?`Exporting…`:`Export All (JSON)`})]})]})]})}function M({tableData:e,schema:t,loading:n,page:o,onPageChange:s,onCellUpdate:c,onRowDelete:l,orderBy:m,orderDir:g,onToggleSort:y,onBulkDelete:S,onInsertRow:C,connectionId:D,selectedTable:O,selectedSchema:ee,connectionName:k,columnFilters:j={},onColumnFilter:M}){let[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(null),[z,ae]=(0,E.useState)(``),[B,V]=(0,E.useState)(new Set),[oe,se]=(0,E.useState)(!1),[ce,le]=(0,E.useState)({}),[ue,de]=(0,E.useState)(null),[fe,pe]=(0,E.useState)(!1),{openTab:H}=u(),me=(0,E.useCallback)(e=>{H({type:`editor`,title:e.col,projectId:null,closable:!0,metadata:{inlineContent:e.value,inlineLanguage:ne(e.value)}})},[H]),[U,he]=(0,E.useState)(new Set),[ge,_e]=(0,E.useState)(new Set),[ve,ye]=(0,E.useState)(null),[be,W]=(0,E.useState)(!1),xe=(0,E.useRef)(null),G=(0,E.useMemo)(()=>t.find(e=>e.pk)?.name||(t.find(e=>e.name.toLowerCase()===`id`)?.name??null),[t]),Se=(0,E.useCallback)(e=>{let t=JSON.stringify(e,null,2),n=G?String(e[G]??``):``;H({type:`editor`,title:n?`Row ${n}`:`Row`,projectId:null,closable:!0,metadata:{inlineContent:t,inlineLanguage:`json`}})},[H,G]),Ce=(0,E.useRef)(N);Ce.current=N;let K=(0,E.useRef)(F);K.current=F;let we=(0,E.useRef)(B);we.current=B;let Te=(0,E.useRef)(L);Te.current=L;let Ee=(0,E.useCallback)((e,t,n)=>{P({rowIdx:e,col:t}),I(n==null?``:typeof n==`object`?JSON.stringify(n):String(n))},[]),De=(0,E.useCallback)(()=>{let t=Ce.current;if(!t||!e||!G)return;let n=e.rows[t.rowIdx];if(!n)return;let r=n[t.col];String(r??``)!==K.current&&c(G,n[G],t.col,K.current===``?null:K.current),P(null)},[e,G,c]),Oe=(0,E.useCallback)(()=>P(null),[]),ke=(0,E.useCallback)(t=>{if(!e||!G||!l)return;let n=e.rows[t];n&&(l(G,n[G]),R(null))},[e,G,l]),Ae=(0,E.useCallback)(e=>{he(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),je=(0,E.useCallback)(e=>{_e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Me=(0,E.useCallback)((e,t)=>{let n={...j};t?n[e]=t:delete n[e],M?.(n)},[j,M]),Ne=(0,E.useCallback)(e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Pe=(0,E.useCallback)(()=>{e&&V(t=>t.size===e.rows.length?new Set:new Set(e.rows.map((e,t)=>t)))},[e]),Fe=(0,E.useCallback)(()=>{!e||!G||!S||(S(G,Array.from(B).map(t=>e.rows[t]?.[G]).filter(e=>e!=null)),V(new Set),pe(!1))},[e,G,S,B]),Ie=(0,E.useCallback)(async()=>{if(C){de(null);try{let e={};for(let[t,n]of Object.entries(ce))n!==``&&(e[t]=n);await C(e),se(!1),le({})}catch(e){de(e.message)}}},[C,ce]),q=(0,E.useMemo)(()=>{if(!e||!z)return e?.rows??[];let t=z.toLowerCase();return e.rows.filter(n=>e.columns.some(e=>String(n[e]??``).toLowerCase().includes(t)))},[e,z]),Le=(0,E.useRef)(null);(0,E.useEffect)(()=>{let t=Le.current;if(!t)return;let n=t=>{if(t.key===`Escape`){W(!1);return}let n=t.target?.tagName;if(!(n===`INPUT`||n===`TEXTAREA`)){if(t.key===`/`){t.preventDefault(),W(!0);return}if(!(!(t.metaKey||t.ctrlKey)||!e)&&(t.key===`a`&&(t.preventDefault(),V(new Set(e.rows.map((e,t)=>t)))),t.key===`c`&&B.size>0)){t.preventDefault();let n=e.columns,r=n.join(` `),i=Array.from(B).sort((e,t)=>e-t).map(t=>n.map(n=>{let r=e.rows[t]?.[n];return r==null?``:typeof r==`object`?JSON.stringify(r):String(r)}).join(` `));navigator.clipboard.writeText([r,...i].join(`
2
2
  `))}}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[e,B]);let J=(0,E.useMemo)(()=>{if(!e)return[];let t=e.columns.filter(e=>U.has(e)),n=e.columns.filter(e=>!U.has(e));return[...t,...n]},[e?.columns,U]),Re=(0,E.useRef)(null),[Y,ze]=(0,E.useState)(0),[X,Be]=(0,E.useState)(new Map);(0,E.useEffect)(()=>{let e=Re.current;if(!e)return;let t=()=>{ze(e.offsetHeight);let t=new Map;e.querySelectorAll(`th[data-col]`).forEach(e=>{t.set(e.dataset.col,e.offsetWidth)});let n=e.querySelector(`th[data-col='_cb']`);n&&t.set(`_cb`,n.offsetWidth),Be(t)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e?.columns,U]);let Z=(0,E.useMemo)(()=>{let e=new Map,t=X.get(`_cb`)??(G?40:0);for(let n of J){if(!U.has(n))break;e.set(n,t),t+=X.get(n)??100}return e},[J,U,G,X]),Q=(0,E.useMemo)(()=>Array.from(ge).sort((e,t)=>e-t).map(e=>({idx:e,row:q[e]})).filter(e=>e.row),[ge,q]),Ve=(0,E.useRef)(new Map),[$,He]=(0,E.useState)(new Map),Ue=(0,E.useCallback)((e,t)=>{t?Ve.current.set(e,t):Ve.current.delete(e)},[]);(0,E.useEffect)(()=>{if(Q.length===0){$.size>0&&He(new Map);return}let e=requestAnimationFrame(()=>{let e=new Map;for(let{idx:t}of Q){let n=Ve.current.get(t);n&&e.set(t,n.offsetHeight)}He(e)});return()=>cancelAnimationFrame(e)},[Q,e]);let We=(0,E.useMemo)(()=>{let e=new Map,t=Y;for(let{idx:n}of Q)e.set(n,t),t+=$.get(n)??28;return e},[Y,Q,$]),Ge=(0,E.useCallback)(e=>{let t=xe.current,n=t?.querySelector(`th[data-col="${e}"]`);if(!t||!n)return;let r=0,i=t.querySelector(`th[data-col="_cb"]`);i&&(r+=i.offsetWidth);for(let[t,n]of Z)t!==e&&(r=Math.max(r,n+(X.get(t)??0)));let a=n.offsetLeft-r;t.scrollTo({left:a,behavior:`smooth`}),W(!1)},[Z,X]);if(!e)return(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,A.jsx)(v,{className:`size-4 animate-spin`}):`Select a table`});let Ke=Math.ceil(e.total/e.limit)||1,qe=B.size>0,Je=B.size===e.rows.length&&e.rows.length>0;return(0,A.jsxs)(`div`,{ref:Le,tabIndex:0,className:`flex flex-col h-full overflow-hidden outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 border-b border-border bg-background shrink-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1 flex-1`,children:[(0,A.jsx)(x,{className:`size-3 text-muted-foreground`}),(0,A.jsx)(`input`,{type:`text`,value:z,onChange:e=>ae(e.target.value),placeholder:`Search current page…`,className:`flex-1 text-xs bg-transparent outline-none text-foreground placeholder:text-muted-foreground`}),z&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>ae(``),className:`text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(i,{className:`size-3`})})]}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>W(!be),className:`p-0.5 rounded transition-colors ${be?`text-primary`:`text-muted-foreground hover:text-foreground`}`,title:`Jump to column ( / )`,children:(0,A.jsx)(w,{className:`size-3.5`})}),be&&(0,A.jsx)(re,{columns:e.columns,onSelect:Ge,onClose:()=>W(!1)})]}),qe&&(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[B.size,` selected`]}),S&&G&&(fe?(0,A.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:Fe,className:`text-destructive text-[10px] font-medium hover:underline`,children:[`Delete `,B.size,`?`]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>pe(!1),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,A.jsx)(`button`,{type:`button`,onClick:()=>pe(!0),className:`p-0.5 text-muted-foreground hover:text-destructive`,children:(0,A.jsx)(p,{className:`size-3`})})),(0,A.jsx)(te,{columns:e.columns,rows:Array.from(B).map(t=>e.rows[t]).filter(Boolean),filename:`${k??`db`}-selected`})]}),C&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>{se(!0),le({}),de(null)},className:`p-0.5 rounded text-muted-foreground hover:text-primary transition-colors`,title:`Insert row`,children:(0,A.jsx)(h,{className:`size-3.5`})})]}),oe&&(0,A.jsxs)(`div`,{className:`px-2 py-1.5 border-b border-border bg-muted/30 text-xs space-y-1`,children:[(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(e=>!e.pk).map(e=>(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(`label`,{className:`text-muted-foreground text-[10px] w-16 truncate`,title:e.name,children:e.name}),(0,A.jsx)(`input`,{value:ce[e.name]??``,onChange:t=>le(n=>({...n,[e.name]:t.target.value})),placeholder:e.defaultValue??(e.nullable?`NULL`:``),className:`h-5 w-24 text-[11px] px-1 rounded border border-border bg-background outline-none focus:border-primary`})]},e.name))}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:Ie,className:`text-[10px] px-2 py-0.5 rounded bg-primary text-primary-foreground hover:bg-primary/90`,children:`Save`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>se(!1),className:`text-[10px] text-muted-foreground hover:underline`,children:`Cancel`}),ue&&(0,A.jsx)(`span`,{className:`text-[10px] text-destructive`,children:ue})]})]}),(0,A.jsxs)(`div`,{ref:xe,className:`flex-1 overflow-auto relative`,children:[n&&(0,A.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-background/60`,children:(0,A.jsx)(v,{className:`size-5 animate-spin text-primary`})}),(0,A.jsxs)(`table`,{className:`w-full text-xs`,style:{borderCollapse:`separate`,borderSpacing:0},children:[(0,A.jsx)(`thead`,{ref:Re,className:`sticky top-0 z-20 bg-muted`,children:(0,A.jsxs)(`tr`,{children:[G&&(0,A.jsx)(`th`,{"data-col":`_cb`,className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border w-10 bg-muted`,style:{position:`sticky`,left:0,zIndex:30},children:(0,A.jsx)(`input`,{type:`checkbox`,checked:Je,onChange:Pe,className:`size-3 accent-primary`})}),J.map(e=>{let n=t.find(t=>t.name===e)?.pk,a=m===e,o=U.has(e),s=!!j[e],c=ve===e,l=Z.get(e);return(0,A.jsxs)(`th`,{"data-col":e,className:`group/th px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap bg-muted ${o?`border-r border-r-primary/20`:``}`,style:l==null?void 0:{position:`sticky`,left:l,zIndex:25},children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:()=>y(e),className:`flex items-center gap-0.5 ${n?`font-bold`:``} hover:text-foreground transition-colors`,children:[e,a&&g===`ASC`&&(0,A.jsx)(d,{className:`size-3`}),a&&g===`DESC`&&(0,A.jsx)(r,{className:`size-3`})]}),M&&(0,A.jsx)(`button`,{type:`button`,title:`Filter column`,onClick:()=>ye(c?null:e),className:`p-0.5 rounded transition-colors ${s||c?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:(0,A.jsx)(T,{className:`size-2.5`})}),(0,A.jsx)(`button`,{type:`button`,title:o?`Unpin column`:`Pin column`,onClick:()=>Ae(e),className:`p-0.5 rounded transition-colors ${o?`text-primary`:`text-muted-foreground/40 md:opacity-0 md:group-hover/th:opacity-100 hover:text-foreground`}`,children:o?(0,A.jsx)(b,{className:`size-2.5`}):(0,A.jsx)(_,{className:`size-2.5`})})]}),c&&(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,A.jsx)(`input`,{autoFocus:!0,type:`text`,value:j[e]??``,placeholder:`ILIKE filter…`,onChange:t=>Me(e,t.target.value),onKeyDown:e=>{e.key===`Escape`&&ye(null)},className:`w-full h-5 text-[10px] px-1 rounded border border-border bg-background outline-none focus:border-primary`}),s&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>Me(e,``),className:`text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(i,{className:`size-2.5`})})]})]},e)}),l&&G&&(0,A.jsx)(`th`,{className:`px-2 py-1.5 border-b border-border w-14 bg-muted`})]})}),(0,A.jsxs)(`tbody`,{children:[Q.map(({idx:e,row:t})=>(0,A.jsx)(ie,{row:t,rowIdx:e,columns:J,selected:B.has(e),onToggleSelect:Ne,pkCol:G,editingCell:N,editValue:F,onStartEdit:Ee,onCommitEdit:De,onCancelEdit:Oe,onSetEditValue:I,showDelete:!!l,confirmingDelete:L===e,onDelete:ke,onConfirmDelete:R,onViewCell:me,onViewRow:Se,pinned:!0,onTogglePin:je,pinnedCols:U,pinnedColOffsets:Z,stickyTop:We.get(e)??Y,trRef:t=>Ue(e,t)},`pin-${e}`)),q.map((e,t)=>ge.has(t)?null:(0,A.jsx)(ie,{row:e,rowIdx:t,columns:J,selected:B.has(t),onToggleSelect:Ne,pkCol:G,editingCell:N,editValue:F,onStartEdit:Ee,onCommitEdit:De,onCancelEdit:Oe,onSetEditValue:I,showDelete:!!l,confirmingDelete:L===t,onDelete:ke,onConfirmDelete:R,onViewCell:me,onViewRow:Se,pinned:!1,onTogglePin:je,pinnedCols:U,pinnedColOffsets:Z},t)),q.length===0&&(0,A.jsx)(`tr`,{children:(0,A.jsx)(`td`,{colSpan:J.length+2,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-t border-border bg-background shrink-0 text-xs text-muted-foreground`,children:[(0,A.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,A.jsxs)(`div`,{className:`hidden md:flex items-center gap-2 text-[10px] text-muted-foreground/50`,children:[(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:`/`}),` columns`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`A`]}),` select all`]}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`C`]}),` copy`]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,disabled:o<=1,onClick:()=>s(o-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,A.jsx)(f,{className:`size-3.5`})}),(0,A.jsxs)(`span`,{children:[o,` / `,Ke]}),(0,A.jsx)(`button`,{type:`button`,disabled:o>=Ke,onClick:()=>s(o+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,A.jsx)(a,{className:`size-3.5`})})]})]})]})}function N(e){return e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e)}var P=200;function F(e){if(e==null)return!1;if(typeof e==`object`)return!0;let t=String(e);if(t.length>=P)return!0;let n=t.trimStart();return!!((n[0]===`{`||n[0]===`[`)&&(n.endsWith(`}`)||n.endsWith(`]`))||n.startsWith(`<?xml`)||n.startsWith(`<`)&&n.endsWith(`>`))}function ne(e){let t=e.trimStart();if(t[0]===`{`||t[0]===`[`)try{return JSON.parse(t),`json`}catch{}return t.startsWith(`<?xml`)||t.startsWith(`<`)&&/<\/\w+>/.test(t)?`xml`:t.startsWith(`---`)||/^\w+:\s/m.test(t)?`yaml`:`plaintext`}function re({columns:e,onSelect:t,onClose:n}){let[r,i]=(0,E.useState)(``),[a,o]=(0,E.useState)(0),s=(0,E.useMemo)(()=>{if(!r)return e;let t=r.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,r]),c=(0,E.useRef)(null);return(0,E.useEffect)(()=>{c.current?.scrollIntoView({block:`nearest`})},[a]),(0,A.jsxs)(`div`,{className:`absolute top-full right-0 mt-1 z-50 w-52 max-h-56 bg-popover border border-border rounded-md shadow-lg overflow-hidden flex flex-col`,children:[(0,A.jsx)(`input`,{autoFocus:!0,type:`text`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`Escape`?n():e.key===`ArrowDown`?(e.preventDefault(),o(e=>Math.min(e+1,s.length-1))):e.key===`ArrowUp`?(e.preventDefault(),o(e=>Math.max(e-1,0))):e.key===`Enter`&&s[a]&&t(s[a])},placeholder:`Search columns…`,className:`px-2 py-1.5 text-xs bg-transparent outline-none border-b border-border text-foreground placeholder:text-muted-foreground`}),(0,A.jsx)(`div`,{className:`overflow-auto flex-1`,children:s.map((e,n)=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>t(e),ref:n===a?c:void 0,className:`w-full text-left px-2 py-1 text-xs truncate ${n===a?`bg-primary/10 text-primary`:`text-foreground hover:bg-muted`}`,children:e},e))})]})}var ie=(0,E.memo)(function({row:e,rowIdx:t,columns:n,selected:r,onToggleSelect:i,pkCol:a,editingCell:o,editValue:s,onStartEdit:l,onCommitEdit:u,onCancelEdit:d,onSetEditValue:f,showDelete:m,confirmingDelete:h,onDelete:g,onConfirmDelete:v,onViewCell:y,onViewRow:x,pinned:S,onTogglePin:C,pinnedCols:w,pinnedColOffsets:T,stickyTop:E,trRef:D}){let O=S?`bg-muted`:r?`bg-primary/5`:`bg-background`;return(0,A.jsxs)(`tr`,{ref:D,className:`group ${S?``:`hover:bg-muted/30`}`,style:S?{position:`sticky`,top:E,zIndex:15}:void 0,children:[a&&(0,A.jsx)(`td`,{className:`px-2 py-1 border-b border-border/50 ${O}`,style:{position:`sticky`,left:0,zIndex:12},children:(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>i(t),className:`size-3 accent-primary`}),(0,A.jsx)(`button`,{type:`button`,title:`View row as JSON`,onClick:()=>x(e),className:`p-0.5 rounded transition-colors text-muted-foreground/30 md:opacity-0 md:group-hover:opacity-100 hover:text-foreground`,children:(0,A.jsx)(c,{className:`size-2.5`})}),(0,A.jsx)(`button`,{type:`button`,title:S?`Unpin row`:`Pin row`,onClick:()=>C(t),className:`p-0.5 rounded transition-colors ${S?`text-primary`:`text-muted-foreground/30 md:opacity-0 md:group-hover:opacity-100 hover:text-foreground`}`,children:S?(0,A.jsx)(b,{className:`size-2.5`}):(0,A.jsx)(_,{className:`size-2.5`})})]})}),n.map(n=>{let r=o?.rowIdx===t&&o?.col===n,i=e[n],p=!r&&F(i),m=w.has(n),h=T.get(n);return(0,A.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] border-b border-border/50 ${m?`border-r border-r-primary/20`:``} ${m||S?O:``}`,style:h==null?void 0:{position:`sticky`,left:h,zIndex:10},children:r?(0,A.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:s,onChange:e=>f(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&u(),e.key===`Escape`&&d()}}):(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,A.jsx)(`span`,{className:`cursor-pointer truncate flex-1 ${i==null?`text-muted-foreground/40 italic`:``}`,onDoubleClick:()=>a&&l(t,n,i),title:N(i),children:N(i)}),p&&(0,A.jsx)(`button`,{type:`button`,title:`View full content`,onClick:()=>y({col:n,value:N(i)}),className:`shrink-0 p-0.5 rounded text-muted-foreground/50 hover:text-foreground transition-colors`,children:(0,A.jsx)(c,{className:`size-3`})})]})},n)}),m&&a&&(0,A.jsx)(`td`,{className:`px-2 py-1 border-b border-border/50 ${S?O:``}`,children:h?(0,A.jsxs)(`span`,{className:`flex items-center gap-1 whitespace-nowrap`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>g(t),className:`text-destructive text-[10px] font-medium hover:underline`,children:`Confirm`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>v(null),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,A.jsx)(`button`,{type:`button`,onClick:()=>v(t),className:`p-0.5 rounded md:opacity-0 md:group-hover:opacity-100 hover:bg-destructive/10 hover:text-destructive transition-opacity`,title:`Delete row`,children:(0,A.jsx)(p,{className:`size-3`})})})]})});function I(e){let t={},n=/"(\w+)"\s+ILIKE\s+'%([^']*?)%'/gi,r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2].replace(/''/g,`'`);return t}function L({metadata:e}){let t=e?.connectionId,n=e?.connectionName,r=e?.tableName,i=e?.schemaName??`public`,a=e?.initialSql,o=k(t),[c,u]=(0,E.useState)([]),[d,f]=(0,E.useState)(180),p=(0,E.useRef)(null),[m,h]=(0,E.useState)({}),_=(0,E.useMemo)(()=>{if(a&&!o.selectedTable)return a;if(o.selectedTable){let e=`SELECT * FROM "${o.selectedTable}"`,t=Object.entries(m).filter(([,e])=>e.trim()).map(([e,t])=>`"${e}" ILIKE '%${t.replace(/'/g,`''`)}%'`);t.length>0&&(e+=` WHERE ${t.join(` AND `)}`),o.orderBy&&(e+=` ORDER BY "${o.orderBy}" ${o.orderDir}`);let n=(o.page-1)*100;return e+=` LIMIT 100`,n>0&&(e+=` OFFSET ${n}`),e}return`SELECT * FROM `},[a,o.selectedTable,o.orderBy,o.orderDir,o.page,m]),v=(0,E.useCallback)(e=>{h(e)},[]),b=(0,E.useRef)(void 0);(0,E.useEffect)(()=>{if(!(!o.selectedTable||Object.keys(m).length===0))return clearTimeout(b.current),b.current=setTimeout(()=>{o.queryAsTable(_)},500),()=>clearTimeout(b.current)},[m]);let x=(0,E.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=d,r=e=>{let r=e.clientY-t;f(Math.max(80,Math.min(n+r,(p.current?.clientHeight??600)-100)))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[d]);(0,E.useEffect)(()=>{s.get(`/api/db/connections/${t}/tables?cached=1`).then(e=>u(e.map(e=>({name:e.name,schema:e.schema})))).catch(()=>{})},[t]);let C=(0,E.useMemo)(()=>{if(c.length!==0)return{tables:c,getColumns:async(e,n)=>await s.get(`/api/db/connections/${t}/schema?table=${encodeURIComponent(e)}${n?`&schema=${encodeURIComponent(n)}`:``}`)}},[t,c]),w=(0,E.useRef)(!1);(0,E.useEffect)(()=>{w.current||(w.current=!0,a?o.executeQuery(a):r&&o.selectTable(r,i))},[r,i,a]);let[T,D]=(0,E.useState)(!!a),O=(0,E.useCallback)(e=>{let t=e.trim();if(o.selectedTable&&RegExp(`^SELECT\\s+\\*\\s+FROM\\s+"?${o.selectedTable.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}"?\\b`,`i`).test(t)){h(I(t)),o.queryAsTable(t);return}D(!0),o.executeQuery(e)},[o.executeQuery,o.queryAsTable,o.selectedTable]),ee=(0,E.useCallback)(e=>{D(!1),o.toggleSort(e)},[o.toggleSort]),j=(0,E.useCallback)(e=>{D(!1),o.setPage(e)},[o.setPage]),N=o.queryResult,P=T&&!!(N||o.queryError),F=o.selectedTable&&!P;return(0,A.jsx)(`div`,{ref:p,className:`flex h-full w-full overflow-hidden`,children:(0,A.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,A.jsx)(l,{className:`size-3.5 text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:n??`Database`}),o.selectedTable&&(0,A.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`/ `,o.selectedTable]}),(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[o.tableData&&(0,A.jsx)(te,{columns:o.tableData.columns,rows:o.tableData.rows,filename:n?`${n}-${o.selectedTable??`data`}`:o.selectedTable??`data`,exportAllUrl:o.selectedTable?`/api/db/connections/${t}/export?table=${encodeURIComponent(o.selectedTable)}&schema=${o.selectedSchema}`:void 0}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>o.refreshData(),title:`Reload data`,className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,children:(0,A.jsx)(y,{className:`size-3 ${o.loading?`animate-spin`:``}`})})]})]}),(0,A.jsx)(`div`,{className:`shrink-0 border-b border-border`,style:{height:d},children:(0,A.jsx)(S,{onExecute:O,loading:o.queryLoading,defaultValue:_,schemaInfo:C})}),(0,A.jsx)(`div`,{onMouseDown:x,className:`shrink-0 h-1.5 cursor-row-resize bg-border/50 hover:bg-primary/30 flex items-center justify-center transition-colors`,children:(0,A.jsx)(g,{className:`size-3 text-muted-foreground/50`})}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[F&&(0,A.jsx)(M,{tableData:o.tableData,schema:o.schema,loading:o.loading,page:o.page,onPageChange:j,onCellUpdate:o.updateCell,onRowDelete:o.deleteRow,orderBy:o.orderBy,orderDir:o.orderDir,onToggleSort:ee,onBulkDelete:o.bulkDelete,onInsertRow:o.insertRow,connectionId:t,selectedTable:o.selectedTable,selectedSchema:o.selectedSchema,connectionName:n,columnFilters:m,onColumnFilter:v}),P&&(0,A.jsx)(z,{result:N,error:o.queryError,loading:o.queryLoading,schema:o.schema,connectionName:n})]})]})})}var R=()=>{};function z({result:e,error:t,loading:n,schema:r,connectionName:i}){let a=(0,E.useMemo)(()=>e?.changeType===`select`&&e.rows.length>0?{columns:e.columns,rows:e.rows,total:e.rows.length,limit:e.rows.length}:null,[e]),o=(0,E.useMemo)(()=>r?.length?r:(e?.columns??[]).map(e=>({name:e,type:`text`,nullable:!0,pk:!1,defaultValue:null})),[r,e?.columns]);return(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden text-xs`,children:[t&&(0,A.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5 shrink-0`,children:t}),e?.changeType===`modify`&&(0,A.jsxs)(`div`,{className:`px-3 py-2 text-green-500 shrink-0`,children:[e.rowsAffected,` row(s) affected`,e.executionTimeMs!=null&&(0,A.jsxs)(`span`,{className:`text-muted-foreground ml-2`,children:[e.executionTimeMs,`ms`]})]}),a&&(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[(0,A.jsx)(M,{tableData:a,schema:o,loading:!!n,page:1,onPageChange:R,onCellUpdate:R,orderBy:null,orderDir:`ASC`,onToggleSort:R,connectionName:i}),e?.executionTimeMs!=null&&(0,A.jsxs)(`div`,{className:`px-3 py-0.5 border-t border-border text-[10px] text-muted-foreground shrink-0`,children:[e.rows.length,` rows · `,e.executionTimeMs,`ms`]})]}),e?.changeType===`select`&&e.rows.length===0&&(0,A.jsxs)(`div`,{className:`px-3 py-2 text-muted-foreground shrink-0`,children:[`No results`,e.executionTimeMs!=null&&(0,A.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[e.executionTimeMs,`ms`]})]}),!e&&!t&&(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:n?(0,A.jsx)(v,{className:`size-4 animate-spin`}):`Run a query to see results`})]})}export{L as DatabaseViewer};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./columns-2-BoZAN-iw.js";import{t as i}from"./text-wrap-BWNOVswA.js";import{t as a}from"./jsx-runtime-kMwlnEGE.js";import{i as o,t as s}from"./api-client-BfBM3I7n.js";import{Y as c,lt as l,pt as u,xt as d}from"./index-BFXOaZuI.js";import{r as f,t as p}from"./use-monaco-theme-x9tJcwlL.js";var m=n(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),h=e(t(),1),g=a();function _(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,a=e?.ref1,v=e?.ref2,b=e?.file1,x=e?.file2,S=e?.original,C=e?.modified,w=S!=null||C!=null,T=!!(b&&x),[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!w),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(`both`),{wordWrap:I,toggleWordWrap:L}=c(),R=p(),z=(0,h.useRef)(null),[B,V]=(0,h.useState)();(0,h.useEffect)(()=>{let e=z.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&V(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[A,M]),(0,h.useEffect)(()=>{if(w||!n)return;if(j(!0),N(null),b&&x){let e=new URLSearchParams({file1:b,file2:x});s.get(`${o(n)}/files/compare?${e}`).then(e=>{k(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to compare files`),j(!1)});return}let e;if(t){let r=new URLSearchParams({file:t});a&&r.set(`ref`,a),e=`${o(n)}/git/file-diff?${r}`}else if(a||v){let t=new URLSearchParams;a&&t.set(`ref1`,a),v&&t.set(`ref2`,v),e=`${o(n)}/git/diff?${t}`}else e=`${o(n)}/git/diff`;s.get(e).then(e=>{D(e.diff),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)})},[t,n,a,v,b,x,w]);let{original:H,modified:U}=(0,h.useMemo)(()=>w?{original:S??``,modified:C??``}:T&&O?O:E?y(E):{original:``,modified:``},[E,w,S,C,T,O]),W=(0,h.useMemo)(()=>{let e=t??x??b;return e?_(e):`plaintext`},[t,b,x]),G=typeof window<`u`&&window.innerWidth<768,K=!G&&P===`both`;return!n&&!w?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`}):A?(0,g.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(u,{className:`size-5 animate-spin`}),(0,g.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]}):M?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:M}):!w&&!T&&!H&&!U?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(d,{className:`size-8`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,g.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[!G&&(0,g.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`left`?`both`:`left`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`left`?`bg-muted text-foreground`:``}`,title:`Expand original`,children:(0,g.jsx)(l,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(`both`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`both`?`bg-muted text-foreground`:``}`,title:`Side by side`,children:(0,g.jsx)(r,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`right`?`both`:`right`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`right`?`bg-muted text-foreground`:``}`,title:`Expand modified`,children:(0,g.jsx)(m,{className:`size-3.5`})}),(0,g.jsx)(`div`,{className:`w-px h-3.5 bg-border mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:L,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${I?`bg-muted text-foreground`:``}`,children:(0,g.jsx)(i,{className:`size-3.5`})})]}),(0,g.jsx)(`div`,{ref:z,className:`flex-1 overflow-hidden`,children:B&&B>0?(0,g.jsx)(f,{height:B,language:W,original:H,modified:U,theme:R,options:{fontSize:G?11:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:G||I?`on`:`off`,renderSideBySide:K,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,g.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})}):(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,g.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function y(e){let t=e.split(`
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./createLucideIcon-PuMiQgHl.js";import{t as r}from"./columns-2-BoZAN-iw.js";import{t as i}from"./text-wrap-BWNOVswA.js";import{t as a}from"./jsx-runtime-kMwlnEGE.js";import{i as o,t as s}from"./api-client-BfBM3I7n.js";import{Y as c,lt as l,pt as u,xt as d}from"./index-BDAqXmpQ.js";import{r as f,t as p}from"./use-monaco-theme-7qyyJae5.js";var m=n(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),h=e(t(),1),g=a();function _(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,a=e?.ref1,v=e?.ref2,b=e?.file1,x=e?.file2,S=e?.original,C=e?.modified,w=S!=null||C!=null,T=!!(b&&x),[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!w),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(`both`),{wordWrap:I,toggleWordWrap:L}=c(),R=p(),z=(0,h.useRef)(null),[B,V]=(0,h.useState)();(0,h.useEffect)(()=>{let e=z.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&V(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[A,M]),(0,h.useEffect)(()=>{if(w||!n)return;if(j(!0),N(null),b&&x){let e=new URLSearchParams({file1:b,file2:x});s.get(`${o(n)}/files/compare?${e}`).then(e=>{k(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to compare files`),j(!1)});return}let e;if(t){let r=new URLSearchParams({file:t});a&&r.set(`ref`,a),e=`${o(n)}/git/file-diff?${r}`}else if(a||v){let t=new URLSearchParams;a&&t.set(`ref1`,a),v&&t.set(`ref2`,v),e=`${o(n)}/git/diff?${t}`}else e=`${o(n)}/git/diff`;s.get(e).then(e=>{D(e.diff),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)})},[t,n,a,v,b,x,w]);let{original:H,modified:U}=(0,h.useMemo)(()=>w?{original:S??``,modified:C??``}:T&&O?O:E?y(E):{original:``,modified:``},[E,w,S,C,T,O]),W=(0,h.useMemo)(()=>{let e=t??x??b;return e?_(e):`plaintext`},[t,b,x]),G=typeof window<`u`&&window.innerWidth<768,K=!G&&P===`both`;return!n&&!w?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`}):A?(0,g.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(u,{className:`size-5 animate-spin`}),(0,g.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]}):M?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:M}):!w&&!T&&!H&&!U?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(d,{className:`size-8`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,g.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[!G&&(0,g.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`left`?`both`:`left`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`left`?`bg-muted text-foreground`:``}`,title:`Expand original`,children:(0,g.jsx)(l,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(`both`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`both`?`bg-muted text-foreground`:``}`,title:`Side by side`,children:(0,g.jsx)(r,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`right`?`both`:`right`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`right`?`bg-muted text-foreground`:``}`,title:`Expand modified`,children:(0,g.jsx)(m,{className:`size-3.5`})}),(0,g.jsx)(`div`,{className:`w-px h-3.5 bg-border mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:L,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${I?`bg-muted text-foreground`:``}`,children:(0,g.jsx)(i,{className:`size-3.5`})})]}),(0,g.jsx)(`div`,{ref:z,className:`flex-1 overflow-hidden`,children:B&&B>0?(0,g.jsx)(f,{height:B,language:W,original:H,modified:U,theme:R,options:{fontSize:G?11:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:G||I?`on`:`off`,renderSideBySide:K,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,g.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})}):(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,g.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function y(e){let t=e.split(`
2
2
  `),n=[],r=[],i=!1;for(let e of t)if(!(e.startsWith(`diff --git`)||e.startsWith(`diff --no-index`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`Binary files`)||e.startsWith(`\\ No newline`))){if(e.startsWith(`@@`)){i=!0;continue}if(i)if(e.startsWith(`-`))n.push(e.slice(1));else if(e.startsWith(`+`))r.push(e.slice(1));else{let t=e.startsWith(` `)?e.slice(1):e;n.push(t),r.push(t)}}return{original:n.join(`
3
3
  `),modified:r.join(`
4
4
  `)}}export{v as DiffViewer};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./jsx-runtime-kMwlnEGE.js";import{z as r}from"./index-BFXOaZuI.js";var i=e(t(),1),a=n(),o=`<script>
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./react-nm2Ru1Pt.js";import{t as n}from"./jsx-runtime-kMwlnEGE.js";import{z as r}from"./index-BDAqXmpQ.js";var i=e(t(),1),a=n(),o=`<script>
2
2
  function acquireVsCodeApi(){return{postMessage:function(m){window.parent.postMessage(m,"*")},getState:function(){try{return JSON.parse(sessionStorage.getItem("vscode-state")||"null")}catch{return null}},setState:function(s){sessionStorage.setItem("vscode-state",JSON.stringify(s));return s}}}
3
3
  <\/script>`;function s(e){if(!e)return e;let t=e.indexOf(`<head>`);return t===-1?o+e:e.slice(0,t+6)+o+e.slice(t+6)}function c({metadata:e}){let t=e?.panelId,n=r(e=>t?e.webviewPanels[t]:void 0),o=(0,i.useRef)(null),c=s(n?.html??``);return(0,i.useEffect)(()=>{let e=e=>{o.current&&e.source===o.current.contentWindow&&window.dispatchEvent(new CustomEvent(`ext:webview:send`,{detail:{panelId:t,message:e.data}}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[t]),(0,i.useEffect)(()=>{let e=e=>{let{panelId:n,message:r}=e.detail;n===t&&o.current?.contentWindow?.postMessage(r,`*`)};return window.addEventListener(`ext:webview:message`,e),()=>window.removeEventListener(`ext:webview:message`,e)},[t]),n?(0,a.jsx)(`div`,{className:`h-full w-full relative`,children:(0,a.jsx)(`iframe`,{ref:o,srcDoc:c,sandbox:`allow-scripts`,className:`w-full h-full border-0 bg-white dark:bg-zinc-900`,title:n.title})}):(0,a.jsx)(`div`,{className:`flex items-center justify-center h-full text-sm text-text-subtle`,children:`Webview panel not found`})}export{c as ExtensionWebview};