elanous 0.2.5 → 0.2.7

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 (479) hide show
  1. package/.env.example +10 -7
  2. package/README.md +9 -4
  3. package/apps/pwa/out/404/index.html +1 -1
  4. package/apps/pwa/out/404.html +1 -1
  5. package/apps/pwa/out/_next/static/chunks/1105-c473ed46272fba79.js +1 -0
  6. package/apps/pwa/out/_next/static/chunks/1201-09613bce624467c0.js +1 -0
  7. package/apps/pwa/out/_next/static/chunks/1377-1efeffbbac0963ff.js +1 -0
  8. package/apps/pwa/out/_next/static/chunks/1470.98a6ab61ccb4131c.js +1 -0
  9. package/apps/pwa/out/_next/static/chunks/216-5acd01cbde4acda7.js +1 -0
  10. package/apps/pwa/out/_next/static/chunks/2330-c2f07246c8788af1.js +1 -0
  11. package/apps/pwa/out/_next/static/chunks/{5391-8793f88b03b30161.js → 2375-cb6debea56cce4fb.js} +1 -1
  12. package/apps/pwa/out/_next/static/chunks/{1751.50b96ea9c37b49b6.js → 2415.ed6428ff334c7ce2.js} +1 -1
  13. package/apps/pwa/out/_next/static/chunks/2929-617f1e66a55be184.js +1 -0
  14. package/apps/pwa/out/_next/static/chunks/2977-e38442e86289f1d3.js +1 -0
  15. package/apps/pwa/out/_next/static/chunks/2982-2a2df543be3d2e5a.js +25 -0
  16. package/apps/pwa/out/_next/static/chunks/{4daa2798-1363d725c79f3593.js → 2ea96958-e8c7e112de50b067.js} +1 -1
  17. package/apps/pwa/out/_next/static/chunks/3403.4bc97b4066945a94.js +5 -0
  18. package/apps/pwa/out/_next/static/chunks/3441-a1dd4acfeda14488.js +1 -0
  19. package/apps/pwa/out/_next/static/chunks/371-4ad6af55dad02ced.js +1 -0
  20. package/apps/pwa/out/_next/static/chunks/4114-3e63117452378807.js +1 -0
  21. package/apps/pwa/out/_next/static/chunks/{8617.465ca22a319c95b3.js → 4323.c5dfb6f503304775.js} +1 -1
  22. package/apps/pwa/out/_next/static/chunks/4836-2eba6079f31b88d4.js +1 -0
  23. package/apps/pwa/out/_next/static/chunks/{8918-482b30ce2a8ebf4c.js → 5080-1613752891fcadb4.js} +3 -3
  24. package/apps/pwa/out/_next/static/chunks/5609-012bb3557211f07e.js +1 -0
  25. package/apps/pwa/out/_next/static/chunks/{5348-bbf838e119661eee.js → 5791-bb82743fa6299562.js} +1 -1
  26. package/apps/pwa/out/_next/static/chunks/{9704-3221c102623c8d73.js → 6062-73e68343a9814f6a.js} +1 -1
  27. package/apps/pwa/out/_next/static/chunks/{4440-18bb160d95819f4e.js → 6090-85a3f05f954e5697.js} +1 -1
  28. package/apps/pwa/out/_next/static/chunks/6284-69db415193d5f8bd.js +1 -0
  29. package/apps/pwa/out/_next/static/chunks/6320-baac91d68843a9a6.js +1 -0
  30. package/apps/pwa/out/_next/static/chunks/6416-505ba707cacafbba.js +1 -0
  31. package/apps/pwa/out/_next/static/chunks/6725-68ab7cc0b1faf00d.js +1 -0
  32. package/apps/pwa/out/_next/static/chunks/6998-a654fe5c58271600.js +1 -0
  33. package/apps/pwa/out/_next/static/chunks/7647.2fcd30d894d5ee30.js +1 -0
  34. package/apps/pwa/out/_next/static/chunks/7673-2eda1507d38dadb8.js +1 -0
  35. package/apps/pwa/out/_next/static/chunks/7990-e12efba616f46e03.js +1 -0
  36. package/apps/pwa/out/_next/static/chunks/{f6f3850d-7f324c6566002113.js → 8046cadf-211ca3c0e00f2b72.js} +1 -1
  37. package/apps/pwa/out/_next/static/chunks/8067-f74bf14d67ad98f1.js +1 -0
  38. package/apps/pwa/out/_next/static/chunks/8142-744998d65d7bb17e.js +1 -0
  39. package/apps/pwa/out/_next/static/chunks/8519-f6b5d8a5833a7603.js +1 -0
  40. package/apps/pwa/out/_next/static/chunks/8619-4365e03a2862830f.js +1 -0
  41. package/apps/pwa/out/_next/static/chunks/8894-e92491a164192cc1.js +1 -0
  42. package/apps/pwa/out/_next/static/chunks/920-f7dceb78f1c585ef.js +1 -0
  43. package/apps/pwa/out/_next/static/chunks/9454-a3e0953307216c58.js +1 -0
  44. package/apps/pwa/out/_next/static/chunks/9651-3cd291a6fa1370d2.js +1 -0
  45. package/apps/pwa/out/_next/static/chunks/9740-67051141115ce775.js +1 -0
  46. package/apps/pwa/out/_next/static/chunks/9804-64c02c3c127d5014.js +1 -0
  47. package/apps/pwa/out/_next/static/chunks/ae787e4c-f2998de7f1ba72a4.js +1 -0
  48. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-859cea1570b6227a.js +1 -0
  49. package/apps/pwa/out/_next/static/chunks/app/approvals/page-d5ebde04844689e6.js +1 -0
  50. package/apps/pwa/out/_next/static/chunks/app/autopilot/{page-f89e9a303515a033.js → page-10ed24f413ed66e9.js} +1 -1
  51. package/apps/pwa/out/_next/static/chunks/app/board/{page-4f403cd060442c95.js → page-211810b6c93ab66a.js} +1 -1
  52. package/apps/pwa/out/_next/static/chunks/app/botlab/{page-0ac5d053f0444d21.js → page-624f7a2f89b60c8f.js} +1 -1
  53. package/apps/pwa/out/_next/static/chunks/app/bots/page-5a5fb385a4df0ffe.js +1 -0
  54. package/apps/pwa/out/_next/static/chunks/app/chat/page-80497e93a878ddc5.js +1 -0
  55. package/apps/pwa/out/_next/static/chunks/app/consult/page-7457f52683562161.js +1 -0
  56. package/apps/pwa/out/_next/static/chunks/app/control/page-cee86394de407aa6.js +1 -0
  57. package/apps/pwa/out/_next/static/chunks/app/design-check/page-4ff8edab44196b8c.js +1 -0
  58. package/apps/pwa/out/_next/static/chunks/app/editor/page-92e4f44428d5e290.js +1 -0
  59. package/apps/pwa/out/_next/static/chunks/app/exec/page-b7dcf5d48a854b76.js +1 -0
  60. package/apps/pwa/out/_next/static/chunks/app/field/page-51480757e7d68b92.js +1 -0
  61. package/apps/pwa/out/_next/static/chunks/app/healthz/route-859cea1570b6227a.js +1 -0
  62. package/apps/pwa/out/_next/static/chunks/app/intake/page-2a05dfe80c8bdf16.js +1 -0
  63. package/apps/pwa/out/_next/static/chunks/app/layout-d9979633aa82f8e6.js +1 -0
  64. package/apps/pwa/out/_next/static/chunks/app/live/page-30533117beb53625.js +1 -0
  65. package/apps/pwa/out/_next/static/chunks/app/market/page-f7857826c2f97ad7.js +1 -0
  66. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-07267f1391b96aba.js +1 -0
  67. package/apps/pwa/out/_next/static/chunks/app/morning/{page-bccce0babceae30f.js → page-55d50e9b0006a91d.js} +1 -1
  68. package/apps/pwa/out/_next/static/chunks/app/not-found-9699b1786be6171d.js +1 -0
  69. package/apps/pwa/out/_next/static/chunks/app/observatory/page-43dd772aee8af75f.js +1 -0
  70. package/apps/pwa/out/_next/static/chunks/app/page-a7e37af7d0399cb8.js +1 -0
  71. package/apps/pwa/out/_next/static/chunks/app/reflection/page-973ab7af59c718b7.js +1 -0
  72. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-a9f8d3865b91e436.js +1 -0
  73. package/apps/pwa/out/_next/static/chunks/app/sessions/page-15e5a15db84c56aa.js +1 -0
  74. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-a2e572e4511f2a16.js +1 -0
  75. package/apps/pwa/out/_next/static/chunks/app/settings/page-dd107bf1c7d52a90.js +1 -0
  76. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-d42b99cdfb9f27c6.js +1 -0
  77. package/apps/pwa/out/_next/static/chunks/app/setup/layout-859cea1570b6227a.js +1 -0
  78. package/apps/pwa/out/_next/static/chunks/app/setup/page-2764ff40dad5a995.js +1 -0
  79. package/apps/pwa/out/_next/static/chunks/app/share/page-c5f1152db116ff96.js +1 -0
  80. package/apps/pwa/out/_next/static/chunks/app/showroom/page-f933bca81ea38a6f.js +1 -0
  81. package/apps/pwa/out/_next/static/chunks/app/tasks/page-c1c95739c0bff3b8.js +1 -0
  82. package/apps/pwa/out/_next/static/chunks/app/term/page-a7aaffcf771662d8.js +1 -0
  83. package/apps/pwa/out/_next/static/chunks/app/trace/page-71d18eec33b9c667.js +1 -0
  84. package/apps/pwa/out/_next/static/chunks/app/vault/page-56adbe1a1f1379bd.js +1 -0
  85. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-2c4e59079ee357ac.js +1 -0
  86. package/apps/pwa/out/_next/static/chunks/app/workflows/page-a81f113f3ef89d72.js +1 -0
  87. package/apps/pwa/out/_next/static/chunks/app/workspace/page-5d422f38c052967e.js +1 -0
  88. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-fc27b00e20733146.js +1 -0
  89. package/apps/pwa/out/_next/static/chunks/framework-ea806bb57f2b8923.js +1 -0
  90. package/apps/pwa/out/_next/static/chunks/main-8d2302399c2c8f87.js +1 -0
  91. package/apps/pwa/out/_next/static/chunks/main-app-6870f30ea99f8346.js +1 -0
  92. package/apps/pwa/out/_next/static/chunks/pages/_app-b10928c60f0b8488.js +1 -0
  93. package/apps/pwa/out/_next/static/chunks/pages/_error-689039227d443fab.js +1 -0
  94. package/apps/pwa/out/_next/static/chunks/{webpack-2bf59c720fe9542c.js → webpack-e5bea36f183b25e6.js} +1 -1
  95. package/apps/pwa/out/_next/static/css/f537bdb19c69306a.css +1 -0
  96. package/apps/pwa/out/_next/static/keajW7DDyghEs1y8oJe6T/_buildManifest.js +1 -0
  97. package/apps/pwa/out/approvals/index.html +1 -1
  98. package/apps/pwa/out/approvals/index.txt +22 -22
  99. package/apps/pwa/out/autopilot/index.html +1 -1
  100. package/apps/pwa/out/autopilot/index.txt +22 -22
  101. package/apps/pwa/out/board/index.html +1 -1
  102. package/apps/pwa/out/board/index.txt +22 -22
  103. package/apps/pwa/out/botlab/index.html +1 -1
  104. package/apps/pwa/out/botlab/index.txt +21 -21
  105. package/apps/pwa/out/bots/index.html +1 -1
  106. package/apps/pwa/out/bots/index.txt +21 -21
  107. package/apps/pwa/out/chat/index.html +1 -1
  108. package/apps/pwa/out/chat/index.txt +21 -21
  109. package/apps/pwa/out/consult/index.html +1 -0
  110. package/apps/pwa/out/consult/index.txt +32 -0
  111. package/apps/pwa/out/control/index.html +1 -1
  112. package/apps/pwa/out/control/index.txt +22 -22
  113. package/apps/pwa/out/design-check/index.html +1 -1
  114. package/apps/pwa/out/design-check/index.txt +22 -22
  115. package/apps/pwa/out/editor/index.html +1 -1
  116. package/apps/pwa/out/editor/index.txt +22 -22
  117. package/apps/pwa/out/exec/index.html +1 -0
  118. package/apps/pwa/out/exec/index.txt +32 -0
  119. package/apps/pwa/out/field/index.html +1 -0
  120. package/apps/pwa/out/field/index.txt +32 -0
  121. package/apps/pwa/out/healthz +1 -1
  122. package/apps/pwa/out/icons/elanous-16.png +0 -0
  123. package/apps/pwa/out/icons/elanous-180.png +0 -0
  124. package/apps/pwa/out/icons/elanous-192.png +0 -0
  125. package/apps/pwa/out/icons/elanous-32.png +0 -0
  126. package/apps/pwa/out/icons/elanous-512.png +0 -0
  127. package/apps/pwa/out/index.html +1 -1
  128. package/apps/pwa/out/index.txt +21 -21
  129. package/apps/pwa/out/intake/index.html +1 -1
  130. package/apps/pwa/out/intake/index.txt +22 -22
  131. package/apps/pwa/out/live/index.html +1 -1
  132. package/apps/pwa/out/live/index.txt +22 -22
  133. package/apps/pwa/out/market/index.html +1 -1
  134. package/apps/pwa/out/market/index.txt +21 -21
  135. package/apps/pwa/out/missions/placeholder/index.html +1 -1
  136. package/apps/pwa/out/missions/placeholder/index.txt +21 -21
  137. package/apps/pwa/out/morning/index.html +1 -1
  138. package/apps/pwa/out/morning/index.txt +22 -22
  139. package/apps/pwa/out/observatory/index.html +1 -1
  140. package/apps/pwa/out/observatory/index.txt +22 -22
  141. package/apps/pwa/out/reflection/index.html +1 -1
  142. package/apps/pwa/out/reflection/index.txt +22 -22
  143. package/apps/pwa/out/scheduler/index.html +1 -1
  144. package/apps/pwa/out/scheduler/index.txt +22 -22
  145. package/apps/pwa/out/sessions/index.html +1 -1
  146. package/apps/pwa/out/sessions/index.txt +21 -21
  147. package/apps/pwa/out/settings/devices/index.html +1 -1
  148. package/apps/pwa/out/settings/devices/index.txt +22 -22
  149. package/apps/pwa/out/settings/index.html +1 -1
  150. package/apps/pwa/out/settings/index.txt +22 -22
  151. package/apps/pwa/out/setup/done/index.html +1 -1
  152. package/apps/pwa/out/setup/done/index.txt +22 -22
  153. package/apps/pwa/out/setup/index.html +1 -1
  154. package/apps/pwa/out/setup/index.txt +22 -22
  155. package/apps/pwa/out/share/index.html +1 -1
  156. package/apps/pwa/out/share/index.txt +22 -22
  157. package/apps/pwa/out/showroom/index.html +1 -1
  158. package/apps/pwa/out/showroom/index.txt +21 -21
  159. package/apps/pwa/out/tasks/index.html +1 -1
  160. package/apps/pwa/out/tasks/index.txt +22 -22
  161. package/apps/pwa/out/term/index.html +1 -1
  162. package/apps/pwa/out/term/index.txt +22 -22
  163. package/apps/pwa/out/trace/index.html +1 -1
  164. package/apps/pwa/out/trace/index.txt +22 -22
  165. package/apps/pwa/out/vault/index.html +1 -1
  166. package/apps/pwa/out/vault/index.txt +22 -22
  167. package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
  168. package/apps/pwa/out/workflows/chat-ui/index.txt +22 -22
  169. package/apps/pwa/out/workflows/index.html +1 -1
  170. package/apps/pwa/out/workflows/index.txt +22 -22
  171. package/apps/pwa/out/workspace/index.html +1 -1
  172. package/apps/pwa/out/workspace/index.txt +22 -22
  173. package/apps/pwa/out/worktrees/index.html +1 -1
  174. package/apps/pwa/out/worktrees/index.txt +22 -22
  175. package/bin/elanous.cjs +107 -0
  176. package/graphs/field/field-feed.yaml +24 -0
  177. package/graphs/field/recipes.yaml +12 -0
  178. package/graphs/landing/landing-heal.yaml +3 -1
  179. package/graphs/landing/recipes.yaml +3 -0
  180. package/graphs/release/recipes.yaml +13 -0
  181. package/graphs/release/release-loop.yaml +13 -4
  182. package/package.json +5 -5
  183. package/plugins/card-followup/README.md +42 -0
  184. package/plugins/card-followup/examples/card-sample.json +7 -0
  185. package/plugins/card-followup/graphs/card-followup.yaml +18 -0
  186. package/plugins/card-followup/graphs/recipes.yaml +16 -0
  187. package/plugins/card-followup/graphs/run-step.ts +276 -0
  188. package/plugins/card-followup/graphs/sales-strategy.ts +173 -0
  189. package/plugins/card-followup/plugin.json +25 -0
  190. package/plugins/doc-draft/README.md +13 -0
  191. package/plugins/doc-draft/examples/brief-sample.json +8 -0
  192. package/plugins/doc-draft/graphs/doc-draft.yaml +14 -0
  193. package/plugins/doc-draft/graphs/recipes.yaml +9 -0
  194. package/plugins/doc-draft/graphs/run-step.ts +113 -0
  195. package/plugins/doc-draft/plugin.json +24 -0
  196. package/plugins/geo-check/README.md +15 -0
  197. package/plugins/geo-check/examples/brand-sample.json +8 -0
  198. package/plugins/geo-check/graphs/geo-check.yaml +20 -0
  199. package/plugins/geo-check/graphs/recipes.yaml +18 -0
  200. package/plugins/geo-check/graphs/run-step.ts +198 -0
  201. package/plugins/geo-check/plugin.json +24 -0
  202. package/plugins/job-coach/.codex-plugin/plugin.json +1 -1
  203. package/plugins/job-coach/README.md +31 -1
  204. package/plugins/job-coach/graphs/run-step.ts +2 -2
  205. package/plugins/job-coach/plugin.json +1 -1
  206. package/plugins/job-coach/plugin.ts +1 -1
  207. package/scripts/affinity/endcard.sh +3 -2
  208. package/scripts/affinity/reframe.sh +3 -1
  209. package/scripts/ci-public-export-leak-gate.ts +48 -0
  210. package/scripts/codex-quota-alert.ts +122 -258
  211. package/scripts/coord-tracks.json +4 -4
  212. package/scripts/daemon-port-baseline.txt +1 -2
  213. package/scripts/field-feed/deliver-node.ts +52 -0
  214. package/scripts/field-feed/feed-node.ts +67 -0
  215. package/scripts/field-feed/lib.ts +162 -0
  216. package/scripts/field-feed/reel-node.ts +24 -0
  217. package/scripts/field-feed/start.ts +62 -0
  218. package/scripts/fixtures/vflow-sample.ndjson +6 -0
  219. package/scripts/install.sh +92 -13
  220. package/scripts/landing-heal/clean-checkout.ts +114 -0
  221. package/scripts/landing-heal/run-mission.ts +38 -3
  222. package/scripts/lib/android-test-device.ts +32 -0
  223. package/scripts/lib/pwa-scenarios/scenarios.ts +2 -1
  224. package/scripts/public-export.ts +8 -4
  225. package/scripts/release-loop/baseline-from-logs.ts +92 -0
  226. package/scripts/release-loop/checklist-gate-node.ts +35 -0
  227. package/scripts/release-loop/env-known-failures.ts +31 -0
  228. package/scripts/release-loop/gate-diff.ts +29 -0
  229. package/scripts/release-loop/gate-node.ts +124 -29
  230. package/scripts/release-loop/known-issues-node.ts +159 -0
  231. package/scripts/release-loop/npm-publish-node.ts +118 -0
  232. package/scripts/release-loop/ops-upgrade-node.ts +87 -0
  233. package/scripts/release-loop/release-readiness.ts +58 -0
  234. package/scripts/release-loop/shard-plan.ts +47 -0
  235. package/scripts/release-loop/unattended-release.ts +93 -0
  236. package/scripts/ux/measure-first-text.ts +102 -0
  237. package/scripts/ux/record-page.ts +4 -1
  238. package/scripts/vflow-collect.ts +20 -7
  239. package/scripts/vflow-search.ts +73 -0
  240. package/scripts/video-free-line-test-walker.ts +36 -0
  241. package/scripts/video-pipeline.ts +2 -2
  242. package/skills/explainer-video/SKILL.md +24 -3
  243. package/skills/explainer-video/engine/brand/elanous-mark-on-dark.svg +1 -1
  244. package/skills/explainer-video/engine/build.mjs +2 -2
  245. package/skills/explainer-video/engine/reel.mjs +235 -0
  246. package/skills/explainer-video/engine/reel.sh +9 -0
  247. package/skills/explainer-video/engine/vo.ts +58 -16
  248. package/skills/explainer-video/examples/elanous-0.2.5/script.json +1 -1
  249. package/skills/grill-me/SKILL.md +1 -1
  250. package/skills/omni-digest/docs/diagrams/noncode-terminal-promotion-path-2026-08-13.mmd +1 -1
  251. package/src/a2a/server.ts +2 -0
  252. package/src/acp/elanous-aware-peers.ts +30 -0
  253. package/src/acp/server.ts +91 -15
  254. package/src/agent/monad-agent-turn.ts +25 -6
  255. package/src/agent/shared-app-tools.ts +5 -3
  256. package/src/agent-substrate/review-intent.ts +6 -2
  257. package/src/agent-substrate/shard-boundary-intent.ts +70 -0
  258. package/src/auth/github-app-token.ts +4 -1
  259. package/src/autopilot/mission-origin.ts +20 -4
  260. package/src/autopilot/mission-phase-track.ts +11 -1
  261. package/src/autopilot/track-agent-shadow.ts +151 -0
  262. package/src/autopilot/track-agent.ts +26 -6
  263. package/src/autopilot/track-courier.ts +2 -2
  264. package/src/boot/acp-server-help.ts +16 -0
  265. package/src/boot/daemon-prompt-turn.ts +31 -10
  266. package/src/boot/daemon-tools/index.ts +7 -1
  267. package/src/budget/codex-credit-pace.ts +84 -0
  268. package/src/budget/codex-credit-plan.ts +154 -0
  269. package/src/budget/codex-reset-credit-state.ts +2 -0
  270. package/src/chat/chat-cli.ts +4 -1
  271. package/src/chat/short-question.ts +40 -0
  272. package/src/cli/agent-cli.ts +24 -15
  273. package/src/cli/ask-bare.ts +42 -0
  274. package/src/cli/cli-user-error.ts +25 -0
  275. package/src/cli/codex-credit-plan-view.ts +25 -0
  276. package/src/cli/dependence-gauge.ts +237 -0
  277. package/src/cli/doctor-cli.ts +5 -0
  278. package/src/cli/doctor-modes.ts +48 -0
  279. package/src/cli/intake-cli.ts +12 -2
  280. package/src/cli/intake-source-cli.ts +58 -0
  281. package/src/cli/machine-cli.ts +23 -0
  282. package/src/cli/msg-cli.ts +137 -0
  283. package/src/cli/nexus-ios-bind.ts +25 -8
  284. package/src/cli/phone-link.ts +117 -0
  285. package/src/cli/plugin-cli.ts +52 -0
  286. package/src/cli/pr-cli.ts +36 -0
  287. package/src/cli/private-ledger-commands.ts +31 -0
  288. package/src/cli/provider-cli.ts +5 -0
  289. package/src/cli/release-cli.ts +56 -12
  290. package/src/cli/release-run-if-ready.ts +48 -0
  291. package/src/cli/setup-cli.ts +27 -6
  292. package/src/cli/setup-recommend.ts +8 -0
  293. package/src/cli/usage-cli.ts +11 -1
  294. package/src/codex/setup.ts +27 -8
  295. package/src/dashboard/index.ts +1 -1
  296. package/src/discord.ts +56 -6
  297. package/src/domains/core-tools.ts +37 -14
  298. package/src/domains/outbound-alert.ts +55 -16
  299. package/src/exec-requests/planner.ts +140 -0
  300. package/src/exec-requests/runner.ts +338 -0
  301. package/src/exec-requests/store.ts +76 -0
  302. package/src/field/field-media.ts +250 -0
  303. package/src/field/field-reel.ts +196 -0
  304. package/src/grok/credential.ts +7 -5
  305. package/src/harness/aside-run-status.ts +33 -0
  306. package/src/harness/browser-verify.ts +48 -17
  307. package/src/harness/harness-cli-command.ts +25 -3
  308. package/src/harness/image-load-state.ts +21 -0
  309. package/src/harness/process-garbage.ts +45 -0
  310. package/src/index.ts +104 -38
  311. package/src/instance/leader.ts +13 -1
  312. package/src/intake-plane/collect-github.ts +5 -3
  313. package/src/intake-plane/collect-telegram-saved.ts +15 -3
  314. package/src/intake-plane/discord-seat-work.ts +56 -0
  315. package/src/intake-plane/intake-sources.ts +202 -0
  316. package/src/intake-plane/items.ts +28 -12
  317. package/src/intake-plane/seat-doc-route.ts +207 -0
  318. package/src/intake-plane/submit-intake-work.ts +9 -1
  319. package/src/intake-plane/telegram-seat-work.ts +72 -0
  320. package/src/llm/model-defaults.ts +24 -1
  321. package/src/llm.ts +5 -4
  322. package/src/machines/machine-ledger.ts +127 -0
  323. package/src/market/pack-internal-refs.ts +28 -0
  324. package/src/market/publish.ts +31 -4
  325. package/src/maturity/feature-maturity.ts +65 -0
  326. package/src/model-tier/turn-tier.ts +24 -0
  327. package/src/msg/msg-store.ts +149 -0
  328. package/src/native-tool-catalog.ts +2 -1
  329. package/src/nexus/api/chat-fast-path-config.ts +28 -0
  330. package/src/nexus/api/consult-requests.ts +117 -0
  331. package/src/nexus/api/discord-trigger-bot.ts +3 -0
  332. package/src/nexus/api/exec-requests.ts +51 -0
  333. package/src/nexus/api/field-uploads.ts +180 -0
  334. package/src/nexus/api/graph-approvals-feed.ts +140 -0
  335. package/src/nexus/api/graph-approvals.ts +120 -4
  336. package/src/nexus/api/harness-api.ts +219 -5
  337. package/src/nexus/api/http-server.ts +68 -5
  338. package/src/nexus/api/seat-requests.ts +254 -0
  339. package/src/nexus/api/trace-run-scan.ts +37 -0
  340. package/src/nexus/api/trace.ts +19 -3
  341. package/src/nexus/index.ts +3 -0
  342. package/src/nexus/setup-status.ts +4 -5
  343. package/src/notify/llm-budget-alert.ts +125 -0
  344. package/src/oauth/codex-account-rotation.ts +26 -4
  345. package/src/oauth/codex-account-store.ts +20 -2
  346. package/src/oauth/codex-browser-login.ts +173 -0
  347. package/src/oauth/codex.ts +4 -1
  348. package/src/oauth/fallback-chain.ts +5 -5
  349. package/src/oauth/store.ts +42 -5
  350. package/src/onboarding/continue-here.ts +29 -0
  351. package/src/onboarding/entry-hints.ts +8 -0
  352. package/src/onboarding/full-screen-io.ts +35 -3
  353. package/src/onboarding/help/skills.md +1 -1
  354. package/src/onboarding/non-interactive.ts +1 -0
  355. package/src/onboarding/subscription-hint.ts +27 -0
  356. package/src/onboarding/web-first.ts +83 -0
  357. package/src/onboarding.ts +230 -23
  358. package/src/plugins/maker/node-install.ts +92 -0
  359. package/src/plugins/maker/node-maker.ts +139 -0
  360. package/src/plugins/maker/plugin-maker.ts +220 -0
  361. package/src/policy/llm-policy.ts +268 -0
  362. package/src/prompt-library/session-guidance.ts +7 -1
  363. package/src/prompt-library/universal-preamble.ts +2 -2
  364. package/src/relay/channel.ts +184 -0
  365. package/src/relay/mux.ts +182 -0
  366. package/src/relay/relay-cli.ts +20 -0
  367. package/src/relay/relay-server.ts +220 -0
  368. package/src/relay/test-vectors.json +29 -0
  369. package/src/release-loop/checklist.ts +36 -9
  370. package/src/seat-address/seat-address.ts +34 -0
  371. package/src/self-dev/decompose.ts +1 -0
  372. package/src/self-dev/dev-pipeline.ts +6 -3
  373. package/src/self-dev/run-record-mirror.ts +44 -0
  374. package/src/self-dev/run-store.ts +12 -3
  375. package/src/self-implement/harness-policy-gates.ts +4 -1
  376. package/src/self-implement/report-origin.ts +12 -1
  377. package/src/self-implement/run-ledger-compact.ts +1 -1
  378. package/src/session/chat.ts +17 -5
  379. package/src/session/index.ts +23 -10
  380. package/src/skills/shared-agent-skill-roots.ts +25 -0
  381. package/src/steward/failure-streak.ts +78 -0
  382. package/src/steward/steward-cards.ts +24 -0
  383. package/src/steward/triage-budget.ts +127 -0
  384. package/src/steward/triage-plan.ts +75 -0
  385. package/src/steward/triage.ts +244 -42
  386. package/src/task-cards/card-store.ts +1 -1
  387. package/src/task-orchestrator/surfaces/pod-bun-cache.ts +18 -0
  388. package/src/task-orchestrator/surfaces/pod-command-job.ts +12 -3
  389. package/src/task-orchestrator/surfaces/pod-ledger-collect.ts +11 -5
  390. package/src/task-orchestrator/surfaces/pod-ledger-events.ts +68 -0
  391. package/src/task-orchestrator/surfaces/self-implement-pod.ts +78 -4
  392. package/src/telegram.ts +145 -2
  393. package/src/tool-runtime/elanous-skills-list-runtime.ts +3 -3
  394. package/src/tool-runtime/self-cognition-runtimes.ts +160 -2
  395. package/src/user-config.ts +84 -4
  396. package/src/version/packed-revision.json +1 -1
  397. package/src/video-pipeline/recipes/character.ts +42 -5
  398. package/src/video-pipeline/recipes/explainer.ts +213 -0
  399. package/src/video-pipeline/recipes/ffmpeg.ts +1 -1
  400. package/src/video-pipeline/recipes/free-line.ts +16 -3
  401. package/src/video-pipeline/recipes/remote.ts +7 -1
  402. package/src/video-pipeline/vflow-reference.ts +109 -0
  403. package/src/video-pipeline/walk-line.ts +3 -2
  404. package/apps/pwa/out/_next/static/chunks/06ef2eba-d1b99ac6d2ea663c.js +0 -1
  405. package/apps/pwa/out/_next/static/chunks/1413-7179a49332db5a80.js +0 -1
  406. package/apps/pwa/out/_next/static/chunks/150-25c277137a9638ab.js +0 -1
  407. package/apps/pwa/out/_next/static/chunks/1640-bc99ec23bbe29d12.js +0 -1
  408. package/apps/pwa/out/_next/static/chunks/2300-de059d0ab2a16630.js +0 -1
  409. package/apps/pwa/out/_next/static/chunks/2684-05b0a81e75298c16.js +0 -1
  410. package/apps/pwa/out/_next/static/chunks/3026-2ed7e317d9b02102.js +0 -25
  411. package/apps/pwa/out/_next/static/chunks/3611-77496ada38cd6358.js +0 -1
  412. package/apps/pwa/out/_next/static/chunks/3717-68957c4dc9ceec90.js +0 -1
  413. package/apps/pwa/out/_next/static/chunks/3929-46ba9af6f9d895cc.js +0 -1
  414. package/apps/pwa/out/_next/static/chunks/4015-62c5a3744698a8da.js +0 -1
  415. package/apps/pwa/out/_next/static/chunks/4217-3c4317a7905f9eeb.js +0 -1
  416. package/apps/pwa/out/_next/static/chunks/4240-3230f230fae2d7d5.js +0 -1
  417. package/apps/pwa/out/_next/static/chunks/4271-e53e075ebd48593b.js +0 -1
  418. package/apps/pwa/out/_next/static/chunks/4377.3b125fef79576dfd.js +0 -5
  419. package/apps/pwa/out/_next/static/chunks/4853-35fdbe6bdbcdc0fc.js +0 -1
  420. package/apps/pwa/out/_next/static/chunks/5007-6a3b30e23ff68a6e.js +0 -1
  421. package/apps/pwa/out/_next/static/chunks/5244-12b424c42070f5ff.js +0 -1
  422. package/apps/pwa/out/_next/static/chunks/5611-df00af3e4e4a61bb.js +0 -1
  423. package/apps/pwa/out/_next/static/chunks/5890-dca2321773be829a.js +0 -1
  424. package/apps/pwa/out/_next/static/chunks/6123-37c9dc57ddaa7ab0.js +0 -1
  425. package/apps/pwa/out/_next/static/chunks/6588-b7975304a302ab91.js +0 -1
  426. package/apps/pwa/out/_next/static/chunks/6604-c03961962b6273b6.js +0 -1
  427. package/apps/pwa/out/_next/static/chunks/7109-cf8c87e968e83a65.js +0 -1
  428. package/apps/pwa/out/_next/static/chunks/7178-30f77877525a2efb.js +0 -1
  429. package/apps/pwa/out/_next/static/chunks/7262-871563fc9663730b.js +0 -1
  430. package/apps/pwa/out/_next/static/chunks/7294-f0eeebb92aa93459.js +0 -1
  431. package/apps/pwa/out/_next/static/chunks/7429-881af44deed6958f.js +0 -1
  432. package/apps/pwa/out/_next/static/chunks/7527.943753b6ed829f09.js +0 -1
  433. package/apps/pwa/out/_next/static/chunks/764-a01e858525a190c0.js +0 -1
  434. package/apps/pwa/out/_next/static/chunks/7868-e35d5f7985ecd3f1.js +0 -1
  435. package/apps/pwa/out/_next/static/chunks/8320-51484af7b01fdfa5.js +0 -1
  436. package/apps/pwa/out/_next/static/chunks/9131-52f5fad51cceca04.js +0 -1
  437. package/apps/pwa/out/_next/static/chunks/9238.2cd5f47f4bf7a2c3.js +0 -1
  438. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-70c404c7bb6d7f0f.js +0 -1
  439. package/apps/pwa/out/_next/static/chunks/app/approvals/page-3ffd80166b1050aa.js +0 -1
  440. package/apps/pwa/out/_next/static/chunks/app/bots/page-4bcc63e272ae8205.js +0 -1
  441. package/apps/pwa/out/_next/static/chunks/app/chat/page-880734bd07d62882.js +0 -1
  442. package/apps/pwa/out/_next/static/chunks/app/control/page-72bd384898d88955.js +0 -1
  443. package/apps/pwa/out/_next/static/chunks/app/design-check/page-1018bbc9586ecae5.js +0 -1
  444. package/apps/pwa/out/_next/static/chunks/app/editor/page-de86f8c38076dd7b.js +0 -1
  445. package/apps/pwa/out/_next/static/chunks/app/healthz/route-70c404c7bb6d7f0f.js +0 -1
  446. package/apps/pwa/out/_next/static/chunks/app/intake/page-cd6447196d8bafe6.js +0 -1
  447. package/apps/pwa/out/_next/static/chunks/app/layout-e733630c47fa102b.js +0 -1
  448. package/apps/pwa/out/_next/static/chunks/app/live/page-d1c1a8357b161875.js +0 -1
  449. package/apps/pwa/out/_next/static/chunks/app/market/page-60c514128e81d787.js +0 -1
  450. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-8b637b7e325e13c1.js +0 -1
  451. package/apps/pwa/out/_next/static/chunks/app/not-found-63301d11dbe73836.js +0 -1
  452. package/apps/pwa/out/_next/static/chunks/app/observatory/page-a8cf0dc472060db2.js +0 -1
  453. package/apps/pwa/out/_next/static/chunks/app/page-02fba54881ccfa49.js +0 -1
  454. package/apps/pwa/out/_next/static/chunks/app/reflection/page-d5e8e90f0038f8de.js +0 -1
  455. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-b1ef6824f494466a.js +0 -1
  456. package/apps/pwa/out/_next/static/chunks/app/sessions/page-d589bb0f233b1009.js +0 -1
  457. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-c9bbaebef4cda059.js +0 -1
  458. package/apps/pwa/out/_next/static/chunks/app/settings/page-3639ce7916b92fed.js +0 -1
  459. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-7450ae7478955653.js +0 -1
  460. package/apps/pwa/out/_next/static/chunks/app/setup/layout-70c404c7bb6d7f0f.js +0 -1
  461. package/apps/pwa/out/_next/static/chunks/app/setup/page-b41ca4abfd618452.js +0 -1
  462. package/apps/pwa/out/_next/static/chunks/app/share/page-b333dd79ebee3fa9.js +0 -1
  463. package/apps/pwa/out/_next/static/chunks/app/showroom/page-8be1227492793655.js +0 -1
  464. package/apps/pwa/out/_next/static/chunks/app/tasks/page-6e03e9371b552e0d.js +0 -1
  465. package/apps/pwa/out/_next/static/chunks/app/term/page-911411e9fca18d03.js +0 -1
  466. package/apps/pwa/out/_next/static/chunks/app/trace/page-792170e649b37088.js +0 -1
  467. package/apps/pwa/out/_next/static/chunks/app/vault/page-c40463466937bc91.js +0 -1
  468. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-509c798b80384536.js +0 -1
  469. package/apps/pwa/out/_next/static/chunks/app/workflows/page-1cac2aa21d77c417.js +0 -1
  470. package/apps/pwa/out/_next/static/chunks/app/workspace/page-9626799d9b4a2cd1.js +0 -1
  471. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-84cd419494e16b0f.js +0 -1
  472. package/apps/pwa/out/_next/static/chunks/framework-361487d2da603917.js +0 -1
  473. package/apps/pwa/out/_next/static/chunks/main-app-607f5beb94cb2e07.js +0 -1
  474. package/apps/pwa/out/_next/static/chunks/main-d0222d219e29dddf.js +0 -1
  475. package/apps/pwa/out/_next/static/chunks/pages/_app-a26980a31126decc.js +0 -1
  476. package/apps/pwa/out/_next/static/chunks/pages/_error-edb2b37decf23e4d.js +0 -1
  477. package/apps/pwa/out/_next/static/css/eaa74e8bb2f62269.css +0 -1
  478. package/apps/pwa/out/_next/static/ktMqfrBbf8BMGac0jqLrb/_buildManifest.js +0 -1
  479. /package/apps/pwa/out/_next/static/{ktMqfrBbf8BMGac0jqLrb → keajW7DDyghEs1y8oJe6T}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5244],{5244:(e,t,s)=>{s.d(t,{O:()=>e5});var a=s(58443),r=s(77947),n=s(34015),l=s(32736),i=s(19990),d=s(65534),o=s(89704);let c="pushcut-webhook",u="pushcut";async function m(e,t){return e.fetchJson("/v1/config/secrets",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:c,value:t})})}async function x(e){return e.fetchJson("/v1/registry/bindings?channel=".concat(u))}async function h(e,t){var s;let a=null!=(s=t.method)?s:"POST",r={};return void 0!==t.sessionId&&(r.sessionId=t.sessionId),void 0!==t.label&&(r.label=t.label),void 0!==t.meta&&(r.meta=t.meta),void 0!==t.mergeMeta&&(r.mergeMeta=t.mergeMeta),e.fetchJson("/v1/registry/bindings/".concat(u,"/").concat(encodeURIComponent(t.token)),{method:a,headers:{"content-type":"application/json"},body:JSON.stringify(r)})}async function p(e,t){return e.fetchJson("/v1/registry/bindings/".concat(u,"/").concat(encodeURIComponent(t)),{method:"DELETE"})}var b=s(23783);let f="elanous.pwa.pushSubscriptionId",g="elanous.pwa.pushSubscriptionLabel";function v(){let e="Notification"in window&&"serviceWorker"in navigator&&"PushManager"in window,t=null,s=null;try{t=window.localStorage.getItem(f),s=window.localStorage.getItem(g)}catch(e){}return{supported:e,permission:e?Notification.permission:"unknown",cachedId:t,cachedLabel:s}}async function j(e){var t,s;let a,r;if(!("Notification"in window)||!("serviceWorker"in navigator)||!("PushManager"in window))return{status:"unsupported",reason:"Notification/PushManager API absent"};if(!e.baseUrl)return{status:"error",reason:"daemon baseUrl not configured"};if("granted"!==await Notification.requestPermission())return(0,b.cY)("pwa.push.permission-denied"),{status:"permission-denied"};let n=e.baseUrl.replace(/\/$/,"");try{let e=await fetch("".concat(n,"/v1/push/vapid-public-key"));if(!e.ok)throw Error("HTTP ".concat(e.status));let t=await e.json();if(!t.publicKey)throw Error("missing publicKey in response");a=t.publicKey}catch(e){return{status:"error",reason:"vapid fetch: ".concat(e instanceof Error?e.message:String(e))}}let l=await navigator.serviceWorker.ready;try{r=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),s=atob((e+t).replace(/-/g,"+").replace(/_/g,"/")),a=new Uint8Array(s.length);for(let e=0;e<s.length;e+=1)a[e]=s.charCodeAt(e);return a}(a)})}catch(e){return{status:"error",reason:"subscribe: ".concat(e instanceof Error?e.message:String(e))}}let i=r.toJSON(),d=null!=(s=e.label)?s:"".concat(null!=(t=navigator.userAgent.split(" ")[0])?t:"browser"," ").concat(new Date().toISOString().slice(0,10));try{let t=await fetch("".concat(n,"/v1/push/subscribe"),{method:"POST",headers:{"content-type":"application/json",...e.token?{authorization:"Bearer ".concat(e.token)}:{}},body:JSON.stringify({subscription:i,label:d})});if(!t.ok){let e=await t.text();try{await r.unsubscribe()}catch(e){}return{status:"error",reason:"subscribe POST: ".concat(t.status," ").concat(e.slice(0,200))}}let s=await t.json();if(!s.id){try{await r.unsubscribe()}catch(e){}return{status:"error",reason:"daemon did not return subscription id"}}try{window.localStorage.setItem(f,s.id),window.localStorage.setItem(g,d)}catch(e){}return(0,b.cY)("pwa.push.enabled",{id:s.id,label:d}),{status:"enabled",id:s.id}}catch(e){try{await r.unsubscribe()}catch(e){}return{status:"error",reason:e instanceof Error?e.message:String(e)}}}async function y(e){let t=null;try{t=window.localStorage.getItem(f)}catch(e){}if(!t)return{status:"not-subscribed"};try{if("serviceWorker"in navigator){let e=await navigator.serviceWorker.ready,t=await e.pushManager.getSubscription();t&&await t.unsubscribe()}}catch(e){}if(e.baseUrl)try{await fetch("".concat(e.baseUrl.replace(/\/$/,""),"/v1/push/subscribe/").concat(encodeURIComponent(t)),{method:"DELETE",...e.token?{headers:{authorization:"Bearer ".concat(e.token)}}:{}})}catch(e){(0,b.cY)("pwa.push.disable.daemon-failed",{reason:e instanceof Error?e.message:String(e)})}try{window.localStorage.removeItem(f),window.localStorage.removeItem(g)}catch(e){}return{status:"disabled"}}var N=s(62866);let k=[{value:"none",label:"none — auto-detect / Quick Setup 안내"},{value:"codex",label:"codex — OpenAI Codex (OAuth or OPENAI_API_KEY)"},{value:"claude-code",label:"claude-code — Anthropic (claude-code CLI 인증)"},{value:"gemini",label:"gemini — Google (GEMINI_API_KEY)"}];function w(){let e=(0,N.Qj)(),[t,s]=(0,r.useState)({status:"idle"}),[n,l]=(0,r.useState)({status:"idle"}),[d,o]=(0,r.useState)(!1);(0,r.useEffect)(()=>{o(!0)},[]);let c=(0,r.useCallback)(async()=>{if(e){s({status:"loading"});try{let t=await e.getChatBackendDetection();s({status:"ok",snapshot:t})}catch(e){s({status:"error",error:e.message})}}},[e]),u=(0,r.useCallback)(async t=>{if(e){l({status:"mutating",target:t});try{await e.putSwitch("global.chat.defaultBackend",{value:t}),await c(),l({status:"idle"})}catch(e){l({status:"error",error:e.message})}}},[e,c]);return((0,r.useEffect)(()=>{c()},[c]),d&&e)?(0,a.jsxs)("section",{"data-testid":"quick-setup-card",className:"rounded border border-border bg-card p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2 flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"Quick Setup — chat 백엔드"}),(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"chat 탭이 사용할 LLM 백엔드 1개만 셋업하면 됩니다. 데스크탑 NEXUS TUI Settings 탭과 같은 안내."})]}),(0,a.jsx)(i.$,{"data-testid":"quick-setup-refresh",variant:"outline",size:"sm",disabled:"loading"===t.status,onClick:()=>void c(),"aria-label":"detection 재실행",title:"env / OAuth 재감지 (TUI 의 r 키 mirror)",children:"loading"===t.status?"…":"Refresh"})]}),"idle"===t.status&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"대기 중…"}),"loading"===t.status&&(0,a.jsx)("p",{"data-testid":"quick-setup-loading",className:"text-xs text-muted-foreground",children:"detection 진행 중…"}),"error"===t.status&&(0,a.jsx)("p",{"data-testid":"quick-setup-error",className:"text-xs text-destructive",children:t.error}),"ok"===t.status&&(0,a.jsx)(S,{snapshot:t.snapshot,swap:n,onSwap:u})]}):null}function S(e){let{snapshot:t,swap:s,onSwap:r}=e,n="none"!==t.detection.backend;return(0,a.jsxs)("div",{className:"space-y-3 text-xs",children:[(0,a.jsx)("div",{"data-testid":"quick-setup-status",children:n?(0,a.jsxs)("span",{children:["현재 wired \xb7"," ",(0,a.jsx)("code",{className:"rounded bg-muted px-1 font-mono",children:t.detection.backend})," ",(0,a.jsxs)("span",{className:"text-muted-foreground",children:["(",t.detection.source,")"]})]}):(0,a.jsx)("span",{className:"text-muted-foreground",children:"현재 wired \xb7 (없음 — 아래 3 provider 중 1개 셋업)"})}),(0,a.jsx)("ul",{className:"space-y-2","data-testid":"quick-setup-entries",children:t.entries.map(e=>(0,a.jsx)(C,{entry:e,wired:t.detection.backend===e.provider},e.provider))}),(0,a.jsxs)("div",{className:"space-y-1 border-t border-border/40 pt-2",children:[(0,a.jsx)("label",{className:"block text-[11px] text-muted-foreground",htmlFor:"quick-setup-swap",children:"Backend swap (`global.chat.defaultBackend` 변경)"}),(0,a.jsx)("select",{id:"quick-setup-swap","data-testid":"quick-setup-swap",value:t.detection.backend,disabled:"mutating"===s.status,onChange:e=>r(e.target.value),className:"flex h-8 w-full rounded-md border border-input bg-background px-2 py-1 text-xs shadow-xs focus:outline-none focus:ring-2 focus:ring-ring",children:k.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),"mutating"===s.status&&(0,a.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["적용 중 (target: ",(0,a.jsx)("code",{children:s.target}),")…"]}),"error"===s.status&&(0,a.jsxs)("p",{"data-testid":"quick-setup-swap-error",className:"text-[11px] text-destructive",children:["swap 실패 \xb7 ",s.error]}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"새 chat 탭부터 적용 \xb7 기존 chat 인스턴스는 per-tab override 또는 재시작 시 반영. 변경은 즉시 NEXUS daemon 의 UserConfig 에 저장."})]}),(0,a.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["Grok \xb7 중국 4종 (kimi/qwen/glm/deepseek) 등은 NEXUS chat 우선순위 외 — daemon 탭 또는 ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"elanous legacy"})," ","에서 사용."]})]})}function C(e){let{entry:t,wired:s}=e;return(0,a.jsxs)("li",{"data-testid":"quick-setup-provider-".concat(t.provider),"data-wired":s?"true":"false",className:"rounded border border-border/60 bg-background p-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 font-medium",children:[(0,a.jsx)("span",{"aria-hidden":"true",children:s?"▶":" "}),(0,a.jsx)("span",{children:t.label})]}),(0,a.jsx)("ul",{className:"mt-1 space-y-1",children:t.paths.map(e=>(0,a.jsxs)("li",{"data-testid":"quick-setup-path-".concat(t.provider,"-").concat(e.tag),"data-detected":e.detected?"true":"false",className:"flex gap-2",children:[(0,a.jsx)("span",{"aria-label":e.detected?"detected":"missing",children:e.detected?"✓":"◯"}),(0,a.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:e.tag}),(0,a.jsx)("span",{className:"text-[11px]",children:e.hint})]},e.tag))})]})}var U=s(88670),A=s(12135),M=s(41640);let E="global.nexus.firstBootGuideShown";function P(){let e=(0,N.Qj)(),[t,s]=(0,r.useState)({status:"idle"}),[n,l]=(0,r.useState)(!1),[d,o]=(0,r.useState)(!1);(0,r.useEffect)(()=>{o(!0)},[]);let c=(0,r.useCallback)(async()=>{if(e){s({status:"loading"});try{let t=await e.getSwitch(E),a=!0===t.switch.value;s({status:a?"hidden":"shown"})}catch(e){s({status:"error",error:e.message})}}},[e]),u=(0,r.useCallback)(async()=>{if(e){l(!0);try{await e.putSwitch(E,{value:!0}),s({status:"hidden"})}catch(e){s({status:"error",error:e.message})}finally{l(!1)}}},[e]);return((0,r.useEffect)(()=>{c()},[c]),d&&e&&"shown"===t.status)?(0,a.jsxs)("section",{"data-testid":"welcome-card",className:"rounded border border-primary/30 bg-primary/5 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2 flex items-start justify-between gap-2",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"✦ Welcome to elanous NEXUS"}),(0,a.jsx)(i.$,{"data-testid":"welcome-card-dismiss",variant:"ghost",size:"sm",disabled:n,onClick:()=>void u(),"aria-label":"환영 카드 닫기",children:n?"…":"Got it"})]}),(0,a.jsxs)("div",{className:"space-y-2 text-xs text-muted-foreground",children:[(0,a.jsx)("p",{children:"모바일 / iOS / 원격에서도 같은 NEXUS 에 접속 — 데스크탑 TUI 와 이 PWA 는 같은 daemon 의 두 surface (UserConfig SSoT 공유)."}),(0,a.jsxs)("p",{children:["Chat 백엔드를 셋업하지 않았다면 위의 ",(0,a.jsx)("strong",{children:"Quick Setup"})," ","카드에서 1개만 선택하면 됩니다."]}),(0,a.jsxs)("p",{children:["Telegram \xb7 Discord allowlist \xb7 자동 부팅 (launchd / systemd) 등"," ",(0,a.jsx)("em",{children:"advanced 셋업"}),"은 데스크탑에서"," ",(0,a.jsx)("span",{className:"font-mono",children:"elanous legacy"})," →"," ",(0,a.jsx)("span",{className:"font-mono",children:"/setup"})," wizard 에서 셋업 (NEXUS 미mirror 영역)."]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"font-mono",children:"[Got it]"})," ","한 번 누르면 다음부터 안 보입니다 (TUI 와 동기화)."]})]})]}):null}let z=[{area:"Chat 백엔드",status:"✓ NEXUS native",location:"PWA Quick Setup card"},{area:"Telegram bot token",status:"✓ NEXUS native",location:"PWA Secret modal"},{area:"Discord bot token",status:"✓ NEXUS native",location:"PWA Secret modal"},{area:"Telegram allowlist",status:"◯ Wizard 전용",location:"desktop",cmd:"elanous legacy → /setup"},{area:"Discord guild \xb7 voice",status:"◯ Wizard 전용",location:"desktop",cmd:"elanous legacy → /setup"},{area:"OS 자동 부팅",status:"◯ NEXUS subcommand",location:"desktop",cmd:"elanous nexus install --launchd"}];function L(){return(0,a.jsxs)("section",{"data-testid":"advanced-setup-map",className:"space-y-2",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Advanced setup map"}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs",children:[(0,a.jsx)("p",{className:"mb-2 text-muted-foreground",children:"NEXUS native 셋업 영역은 PWA 에서 직접 \xb7 그 외 advanced 셋업은 desktop wizard 또는 NEXUS subcommand 에서."}),(0,a.jsxs)("table",{className:"w-full text-left text-[11px]",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border text-muted-foreground",children:[(0,a.jsx)("th",{className:"py-1 pr-2 font-medium",children:"영역"}),(0,a.jsx)("th",{className:"py-1 pr-2 font-medium",children:"상태"}),(0,a.jsx)("th",{className:"py-1 font-medium",children:"셋업 위치"})]})}),(0,a.jsx)("tbody",{children:z.map(e=>(0,a.jsxs)("tr",{"data-testid":"advanced-setup-row-".concat(e.area),className:"border-b border-border/50 last:border-0",children:[(0,a.jsx)("td",{className:"py-1.5 pr-2 font-medium",children:e.area}),(0,a.jsx)("td",{className:"py-1.5 pr-2 font-mono text-[10px]",children:e.status}),(0,a.jsxs)("td",{className:"py-1.5 text-muted-foreground",children:[e.location,e.cmd&&(0,a.jsxs)(a.Fragment,{children:[" \xb7 ",(0,a.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[10px]",children:e.cmd})]})]})]},e.area))})]})]})]})}function I(){let e=(0,N.Qj)(),[t,s]=(0,r.useState)({status:"idle"}),[n,l]=(0,r.useState)(!1),[d,o]=(0,r.useState)(!1);(0,r.useEffect)(()=>{o(!0)},[]);let c=(0,r.useCallback)(async()=>{if(e){s({status:"minting"}),l(!1);try{let t=await e.mintConnectToken();s({status:"shown",token:t.token,hint:t.hint})}catch(e){s({status:"error",error:e.message})}}},[e]),u=(0,r.useCallback)(async()=>{if("shown"===t.status)try{await navigator.clipboard.writeText(t.token),l(!0),setTimeout(()=>l(!1),2e3)}catch(e){s({status:"error",error:"clipboard: ".concat(e.message)})}},[t]);return d&&e?(0,a.jsxs)("section",{"data-testid":"connect-token-card",className:"space-y-2",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Connect token (other devices)"}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs space-y-2",children:[(0,a.jsxs)("p",{className:"text-muted-foreground",children:["다른 머신에서 ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"elanous nexus connect <host>"})," 시 paste 할 bearer token 을 발급. 한 번 paste 하면 그 머신의 bookmark 에 영구 저장 — 매번 재발급할 필요 없음."]}),"idle"===t.status&&(0,a.jsx)(i.$,{size:"sm",onClick:()=>void c(),"data-testid":"connect-token-generate",children:"Generate connect token"}),"minting"===t.status&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"Minting…"}),"shown"===t.status&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("code",{className:"block break-all rounded bg-muted p-2 font-mono text-[11px] select-all","data-testid":"connect-token-value",children:t.token}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.$,{size:"sm",onClick:()=>void u(),"data-testid":"connect-token-copy",children:n?"✓ Copied":"Copy to clipboard"}),(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>s({status:"idle"}),"data-testid":"connect-token-hide",children:"Hide"})]}),(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground",children:t.hint})]}),"error"===t.status&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("p",{className:"text-rose-500",children:["발급 실패: ",t.error]}),(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>s({status:"idle"}),children:"Reset"})]})]})]}):null}var R=s(31550),T=s(33919),D=s(1921),$=s(51719);let O=(0,$.A)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var Y=s(79998),B=s(8666);function Q(){return(0,N.Qj)()?(0,a.jsx)(W,{}):null}function W(){var e;let{data:t,isLoading:s,error:r,refetch:n,isFetching:l}=function(){let e=(0,N.M1)();return(0,Y.I)({queryKey:B.AF.platforms(),queryFn:()=>e.getPlatforms(),refetchInterval:3e4})}(),i=null!=(e=null==t?void 0:t.platforms)?e:[],d=i.filter(e=>"connected"===e.status).length;return(0,a.jsxs)("section",{className:"space-y-2","data-testid":"platform-connections-card",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Platform connections"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[(0,a.jsx)("span",{"data-testid":"platform-summary",children:t?"".concat(d," of ").concat(i.length," connected"):s?"loading…":""}),(0,a.jsx)("button",{type:"button",onClick:()=>n(),disabled:l,"aria-label":"Refresh platform connection status",className:"rounded p-1 hover:bg-surface-elevated disabled:opacity-50",children:(0,a.jsx)(R.A,{className:"h-3 w-3 ".concat(l?"animate-spin":"")})})]})]}),r&&(0,a.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-error",children:[(0,a.jsx)(T.A,{className:"h-3 w-3"}),r instanceof Error?r.message:"Failed to load platform list"]}),s&&!t&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Querying /v1/platforms…"}),t&&(0,a.jsx)("ul",{className:"space-y-1.5",role:"list",children:i.map(e=>(0,a.jsx)(_,{entry:e},e.id))})]})}function _(e){let{entry:t}=e,s="connected"===t.status;return(0,a.jsxs)("li",{"data-testid":"platform-row-".concat(t.id),"data-status":t.status,className:"flex items-start gap-3 rounded-md border border-border bg-surface px-3 py-2",children:[(0,a.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:s?(0,a.jsx)(D.A,{className:"h-4 w-4 text-green-600","aria-label":"connected"}):(0,a.jsx)(O,{className:"h-4 w-4 text-muted-foreground","aria-label":"not configured"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,a.jsx)("span",{className:"text-[12px] font-medium",children:t.label}),(0,a.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider ".concat(s?"bg-green-600/10 text-green-700":"bg-muted text-muted-foreground"),children:s?"connected":"not configured"})]}),(0,a.jsx)("div",{className:"text-[11px] text-muted-foreground",children:t.detail}),!s&&t.hint&&(0,a.jsx)("div",{className:"text-[10px] italic text-muted-foreground/80",children:t.hint})]})]})}var F=s(26958);function V(){var e,t;let s=(0,N.Qj)(),[n,l]=(0,r.useState)({status:"idle"}),[d,o]=(0,r.useState)({status:"idle"}),[c,u]=(0,r.useState)(!1);(0,r.useEffect)(()=>{u(!0)},[]);let m=(0,r.useCallback)(async()=>{if(s){l({status:"loading"});try{var e,t,a;let r=await fetch("".concat(s.baseUrl,"/v1/hitl/audit/recent?channel=pushcut&limit=").concat(1),{credentials:"include"}),n=await r.json();if(!r.ok||!n.ok)return void l({status:"error",error:null!=(t=n.error)?t:"HTTP ".concat(r.status),fetchedAt:Date.now()});let i=null==(e=n.entries)?void 0:e[n.entries.length-1];l({status:"ok",count:null!=(a=n.count)?a:0,lastEntry:i,fetchedAt:Date.now()})}catch(e){l({status:"error",error:e.message,fetchedAt:Date.now()})}}},[s]),x=(0,r.useCallback)(async()=>{if(s){o({status:"sending"});try{var e,t;let a=await fetch("".concat(s.baseUrl,"/v1/hitl/test-pushcut"),{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({})}),r=await a.json();a.ok&&r.ok?(o({status:"ok",banner:"✓ sent → ".concat(null!=(e=r.notificationName)?e:"(unknown)")}),m()):o({status:"error",banner:"✗ ".concat(null!=(t=r.reason)?t:"HTTP ".concat(a.status)).concat(r.hint?" \xb7 ".concat(r.hint):"")})}catch(e){o({status:"error",banner:"✗ ".concat(e.message)})}}},[s,m]);if((0,r.useEffect)(()=>{m()},[m]),!c||!s)return null;let h=n.lastEntry,p=h?(t=Date.now()-h.ts)<0?"just now":t<6e4?"".concat(Math.floor(t/1e3),"s ago"):t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago"):"(no Pushcut deliveries recorded yet)";return(0,a.jsxs)("section",{"data-testid":"pushcut-settings-card",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2 flex items-start justify-between gap-2",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"\uD83D\uDCF2 Pushcut HITL channel"}),(0,a.jsx)(i.$,{"data-testid":"pushcut-settings-refresh",variant:"ghost",size:"sm",onClick:()=>void m(),"aria-label":"Refresh Pushcut status",children:"↻"})]}),(0,a.jsxs)("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-xs",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:"Last delivery"}),(0,a.jsx)("dd",{"data-testid":"pushcut-last-delivery",className:"font-mono",children:"loading"===n.status?"…":p}),h?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:"Last answer"}),(0,a.jsxs)("dd",{className:"font-mono",children:[h.answer?"yes":"no"," \xb7 ",h.elapsedMs,"ms"]}),(0,a.jsx)("dt",{className:"text-muted-foreground",children:"Last requestId"}),(0,a.jsx)("dd",{className:"font-mono break-all",children:h.requestId})]}):null,(0,a.jsx)("dt",{className:"text-muted-foreground",children:"Total recorded"}),(0,a.jsx)("dd",{className:"font-mono",children:"ok"===n.status?null!=(e=n.count)?e:0:"—"})]}),"error"===n.status?(0,a.jsxs)("p",{className:"mt-2 text-xs text-destructive",children:["audit fetch failed: ",n.error]}):null,(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,a.jsx)(i.$,{"data-testid":"pushcut-test-button",variant:"outline",size:"sm",disabled:"sending"===d.status,onClick:()=>void x(),children:"sending"===d.status?"…":"Test notification"}),d.banner?(0,a.jsx)("span",{"data-testid":"pushcut-test-banner",className:"ok"===d.status?"text-xs text-emerald-600 font-mono":"text-xs text-destructive font-mono",children:d.banner}):null]}),(0,a.jsxs)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["Audit log: ",(0,a.jsx)("span",{className:"font-mono",children:"$ELANOUS_DIR/hitl-log.jsonl"})," ","(rotates at 100 MB \xb7 cv-3 β-4)"]})]})}var K=s(95512);let H=[{value:"fixed",label:"고정 (Fixed)",blurb:"입력 바 위에 항상 표시. 키보드 위주 dogfood 에 좋음."},{value:"popup",label:"팝업 (Popup)",blurb:"턴이 끝날 때마다 잠깐 (~6초) 나타나고 자동 dismiss. 모바일 화면 절약."},{value:"off",label:"끔 (Off)",blurb:"완전 숨김. 입력만으로 진행하고 싶을 때."}];function q(){let[e,t]=(0,r.useState)("fixed"),[s,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>(n(!0),t((0,K.sY)()),(0,K.u9)(t)),[]),(0,a.jsxs)("section",{"data-testid":"intent-panel-settings",className:"rounded-lg border bg-card p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"space-y-1",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Intent Panel"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Showroom 의 intent 6-button 패널 표시 방식을 선택합니다."})]}),(0,a.jsx)("div",{role:"radiogroup","aria-label":"intent panel display mode",className:"mt-3 space-y-2",children:H.map(r=>{let n=s&&e===r.value;return(0,a.jsxs)("label",{"data-testid":"intent-panel-mode-".concat(r.value),className:"flex cursor-pointer items-start gap-3 rounded-md border border-border/60 p-3 hover:border-border","data-active":n?"true":"false",children:[(0,a.jsx)("input",{type:"radio",name:"intent-panel-display-mode",value:r.value,checked:n,onChange:()=>{var e;return e=r.value,void((0,K._n)(e),t(e))},className:"mt-0.5 h-4 w-4"}),(0,a.jsxs)("span",{className:"flex flex-col gap-0.5",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:r.label}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:r.blurb})]})]},r.value)})})]})}var X=s(64385);function G(){let[e,t]=(0,r.useState)(X.kv),[s,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>(n(!0),t((0,X.Vm)()),(0,X.$L)(t)),[]),(0,a.jsxs)("section",{"data-testid":"chat-routing-settings",className:"rounded-lg border bg-card p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"space-y-1",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Chat input classification"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"입력 중 자동 분류를 켜거나 끕니다. 전송은 기존 ACP 경로를 유지합니다."})]}),(0,a.jsx)("div",{className:"mt-3 space-y-2",children:(0,a.jsxs)("label",{"data-testid":"chat-routing-auto",className:"flex cursor-pointer items-start gap-3 rounded-md border border-border/60 p-3 hover:border-border","data-active":s&&e.autoRouting?"true":"false",children:[(0,a.jsx)("input",{type:"checkbox",checked:s?e.autoRouting:X.kv.autoRouting,onChange:e=>{var s;return s=e.target.checked,void((0,X.Kz)(s),t(e=>({...e,autoRouting:s})))},className:"mt-0.5 h-4 w-4"}),(0,a.jsxs)("span",{className:"flex flex-col gap-0.5",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Automatic routing"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"입력 중 mission router 가 plan / build / review / research / quick / vision 으로 자동 분류합니다. OFF (default) 시 분류 요청을 보내지 않습니다."})]})]})})]})}function J(e){let t=Object.entries(e);return 0===t.length?"—":t.map(e=>{let[t,s]=e;return"".concat(t,":").concat(s)}).join(" \xb7 ")}function Z(){let{config:e}=(0,n.Q)(),[t,s]=(0,r.useState)({ocr:{total:0,failures:0,byProvider:{},byPolishMode:{}},save:{total:0,failures:0,byPolishMode:{}},client:{cancel:0,edit:0,discard:0},startedAt:"",ts:""}),[l,d]=(0,r.useState)(!1),[o,c]=(0,r.useState)(null),[u,m]=(0,r.useState)(!1),x=(0,r.useCallback)(async()=>{if(e.baseUrl){m(!0);try{let t=await fetch("".concat(e.baseUrl,"/v1/metrics/notes-from-image"),{...e.token?{headers:{authorization:"Bearer ".concat(e.token)}}:{}});if(!t.ok)return void c("HTTP ".concat(t.status));let a=await t.json();s(a.snapshot),d(a.wired),c(null),(0,b.cY)("notes-metrics.snapshot",{wired:a.wired,ocrTotal:a.snapshot.ocr.total,saveTotal:a.snapshot.save.total})}catch(e){c(String(e instanceof Error?e.message:e))}finally{m(!1)}}},[e.baseUrl,e.token]);(0,r.useEffect)(()=>{x();let e=setInterval(()=>{x()},1e4);return()=>clearInterval(e)},[x]);let h=t.ocr.total-t.ocr.failures,p=t.save.total-t.save.failures;return(0,a.jsxs)("section",{"data-testid":"notes-metrics-card",className:"rounded-lg border border-border bg-card p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-heading text-sm font-medium",children:"카메라 노트 metric"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"카메라 → markdown 노트 파이프라인 사용량 (daemon 재시작 시 0 으로 리셋)."})]}),(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>void x(),disabled:u,"aria-label":"refresh notes metrics",children:(0,a.jsx)(R.A,{className:u?"h-3.5 w-3.5 animate-spin":"h-3.5 w-3.5"})})]}),!l&&(0,a.jsx)("p",{"data-testid":"notes-metrics-not-wired",className:"mb-3 rounded bg-muted/50 px-2 py-1 text-xs text-muted-foreground",children:"collector 미wire — runNexus 재기동 후 측정 시작."}),o&&(0,a.jsxs)("p",{"data-testid":"notes-metrics-error",className:"mb-3 text-xs text-destructive",children:["metric fetch 실패: ",o]}),(0,a.jsxs)("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:"OCR 총 / 성공 / 실패"}),(0,a.jsxs)("dd",{"data-testid":"notes-metrics-ocr",children:[t.ocr.total," / ",h," / ",t.ocr.failures]}),(0,a.jsx)("dt",{className:"text-muted-foreground",children:"OCR provider"}),(0,a.jsx)("dd",{"data-testid":"notes-metrics-ocr-providers",children:J(t.ocr.byProvider)}),(0,a.jsx)("dt",{className:"text-muted-foreground",children:"OCR polishMode"}),(0,a.jsx)("dd",{"data-testid":"notes-metrics-ocr-polish",children:J(t.ocr.byPolishMode)}),(0,a.jsx)("dt",{className:"text-muted-foreground",children:"Save 총 / 성공 / 실패"}),(0,a.jsxs)("dd",{"data-testid":"notes-metrics-save",children:[t.save.total," / ",p," / ",t.save.failures]}),(0,a.jsx)("dt",{className:"text-muted-foreground",children:"Save polishMode"}),(0,a.jsx)("dd",{"data-testid":"notes-metrics-save-polish",children:J(t.save.byPolishMode)}),(0,a.jsx)("dt",{className:"text-muted-foreground",children:"Client cancel \xb7 edit \xb7 discard"}),(0,a.jsxs)("dd",{"data-testid":"notes-metrics-client",children:[t.client.cancel," \xb7 ",t.client.edit," \xb7 ",t.client.discard]})]}),t.startedAt&&l&&(0,a.jsxs)("p",{className:"mt-3 text-[10px] text-muted-foreground",children:["since ",t.startedAt]})]})}var ee=s(75355);function et(){let[e,t]=(0,r.useState)(ee.hn);(0,r.useEffect)(()=>{t((0,ee.hn)())},[]);let s=e=>{t((0,ee.qv)(e)),(0,b.cY)("settings.ocr-prefs.update",e)};return(0,a.jsxs)("section",{"data-testid":"ocr-prefs-card",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"\uD83D\uDCF7 OCR 기본 설정"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"사진 → 노트 모달의 초기 토글 상태. 매번 같은 옵션을 켜고 있다면 default 로 저장."})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"flex items-center justify-between gap-3 rounded-md border border-input bg-background px-3 py-2 text-xs",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{children:"LLM 비전 default"}),(0,a.jsx)("span",{className:"text-muted-foreground",children:"\xb7 더 정확하지만 느림 + 비쌈"})]}),(0,a.jsx)("input",{type:"checkbox","data-testid":"ocr-prefs-llm-vision",checked:e.defaultUseLlmVision,onChange:e=>s({defaultUseLlmVision:e.target.checked}),"aria-label":"LLM 비전 default"})]}),(0,a.jsxs)("label",{className:"flex items-center justify-between gap-3 rounded-md border border-input bg-background px-3 py-2 text-xs",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{children:"손글씨 default"}),(0,a.jsx)("span",{className:"text-muted-foreground",children:"\xb7 handwriting strength 자동 추가"})]}),(0,a.jsx)("input",{type:"checkbox","data-testid":"ocr-prefs-handwriting",checked:e.defaultPreferHandwriting,onChange:e=>s({defaultPreferHandwriting:e.target.checked}),"aria-label":"손글씨 default"})]})]}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>{t((0,ee.sg)()),(0,b.cY)("settings.ocr-prefs.reset")},className:"text-xs text-muted-foreground","data-testid":"ocr-prefs-reset",children:"기본값으로 리셋"})})]})}let es=["lm-studio","vllm","ollama","anthropic-openai-wrap"],ea={"lm-studio":"http://localhost:1234",vllm:"http://localhost:8000",ollama:"http://localhost:11434","anthropic-openai-wrap":"https://api.anthropic.com"};function er(){let{client:e,config:t}=(0,n.Q)(),[s,l]=(0,r.useState)({status:"idle"}),[c,u]=(0,r.useState)(0),[m,x]=(0,r.useState)(!1),[h,p]=(0,r.useState)(""),[b,f]=(0,r.useState)("anthropic-openai-wrap"),[g,v]=(0,r.useState)(ea["anthropic-openai-wrap"]),[j,y]=(0,r.useState)(""),[N,k]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(!t.baseUrl)return void l({status:"idle"});let s=!1;return l({status:"loading"}),(async()=>{try{let t=await e.getLlmHosts();s||l({status:"ok",data:t})}catch(e){s||l({status:"error",error:e instanceof Error?e.message:String(e)})}})(),()=>{s=!0}},[e,t.baseUrl,c]);let w=(0,r.useCallback)(()=>u(e=>e+1),[]),S=(0,r.useCallback)(e=>{f(e),v(ea[e])},[]),C=(0,r.useCallback)(async()=>{let t=h.trim(),a=g.trim(),r=j.trim();if(!t||!a)return void o.oR.error("name + endpoint 필수");if("anthropic-openai-wrap"===b&&!r)return void o.oR.error("Anthropic 은 apiKey 필수");k(!0);try{var n,l;let i=[...(null!=(l=null==(n=s.data)?void 0:n.hosts)?l:[]).filter(e=>e.name!==t).map(e=>{let t={name:e.name,kind:e.kind,endpoint:e.endpoint};return e.apiKey&&"[redacted]"!==e.apiKey&&(t.apiKey=e.apiKey),t}),{name:t,kind:b,endpoint:a,...r?{apiKey:r}:{}}];await e.setLlmHosts(i),o.oR.success("host '".concat(t,"' 추가됨")),p(""),y(""),x(!1),w()}catch(e){o.oR.error("추가 실패: ".concat(e instanceof Error?e.message:String(e)))}finally{k(!1)}},[e,h,b,g,j,s.data,w]),U=(0,r.useCallback)(async t=>{k(!0);try{var a,r;let n=(null!=(r=null==(a=s.data)?void 0:a.hosts)?r:[]).filter(e=>e.name!==t).map(e=>{let t={name:e.name,kind:e.kind,endpoint:e.endpoint};return e.apiKey&&"[redacted]"!==e.apiKey&&(t.apiKey=e.apiKey),t});await e.setLlmHosts(n),o.oR.success("host '".concat(t,"' 제거됨")),w()}catch(e){o.oR.error("제거 실패: ".concat(e instanceof Error?e.message:String(e)))}finally{k(!1)}},[e,s.data,w]),A=(0,r.useCallback)(async()=>{k(!0);try{await e.clearLlmHosts(),o.oR.success("env / legacy 로 환원"),w()}catch(e){o.oR.error("reset 실패: ".concat(e instanceof Error?e.message:String(e)))}finally{k(!1)}},[e,w]);if(!t.baseUrl)return null;let M=s.data,E=(null==M?void 0:M.source)==="override"?"bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-900 dark:text-fuchsia-200":(null==M?void 0:M.source)==="env"?"bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-200":"bg-zinc-100 text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300";return(0,a.jsxs)("section",{className:"space-y-2","data-testid":"llm-hosts-card",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"LLM Hosts"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[M&&(0,a.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-medium uppercase ".concat(E),"data-testid":"llm-hosts-source-badge",children:M.source}),(0,a.jsx)("span",{"data-testid":"llm-hosts-count",children:M?"".concat(M.count," host").concat(1===M.count?"":"s"):"loading"===s.status?"loading…":""}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:w,disabled:"loading"===s.status||N,"data-testid":"llm-hosts-refresh",children:"Refresh"})]})]}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs space-y-2",children:[(null==M?void 0:M.deprecations)&&M.deprecations.length>0&&(0,a.jsxs)("div",{className:"rounded border border-amber-300 bg-amber-50 p-2 text-[11px] text-amber-800 dark:border-amber-700 dark:bg-amber-900/30 dark:text-amber-200","data-testid":"llm-hosts-deprecations",children:[(0,a.jsx)("p",{className:"font-medium",children:"호환성 경고 \xb7 다음 release 에서 제거 예정"}),(0,a.jsx)("ul",{className:"ml-4 list-disc",children:M.deprecations.map(e=>(0,a.jsx)("li",{className:"font-mono text-[10px]",children:e},e))})]}),"error"===s.status&&(0,a.jsxs)("p",{className:"text-rose-500","data-testid":"llm-hosts-error",children:["조회 실패 \xb7 ",s.error]}),"loading"===s.status&&!M&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"Probing /v1/llm/hosts…"}),M&&0===M.hosts.length&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"No hosts configured. Add one below to enable a remote LLM provider (e.g. Anthropic / Gemini API direct)."}),M&&M.hosts.length>0&&(0,a.jsx)("ul",{className:"space-y-1","data-testid":"llm-hosts-list",children:M.hosts.map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded border border-border bg-muted/30 px-2 py-1","data-testid":"llm-host-row-".concat(e.name),children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 font-mono text-[11px] font-medium",children:[(0,a.jsx)("span",{children:e.name}),(0,a.jsx)("span",{className:"rounded bg-muted px-1 text-[9px] uppercase text-muted-foreground",children:e.kind}),"[redacted]"===e.apiKey&&(0,a.jsx)("span",{className:"rounded bg-emerald-100 px-1 text-[9px] uppercase text-emerald-700 dark:bg-emerald-900 dark:text-emerald-200",title:"apiKey configured (server-side, not echoed)","data-testid":"llm-host-key-badge-".concat(e.name),children:"key"})]}),(0,a.jsx)("div",{className:"truncate font-mono text-[10px] text-muted-foreground",children:e.endpoint})]}),"override"===M.source&&(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>{U(e.name)},disabled:N,"data-testid":"llm-host-remove-".concat(e.name),children:"Remove"})]},e.name))}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 pt-1",children:[(0,a.jsx)(i.$,{size:"sm",onClick:()=>x(e=>!e),disabled:N,"data-testid":"llm-hosts-add-toggle",children:m?"Cancel add":"Add host"}),(null==M?void 0:M.source)==="override"&&(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>{A()},disabled:N,"data-testid":"llm-hosts-reset",children:"Reset to env/legacy"})]}),m&&(0,a.jsxs)("div",{className:"mt-2 space-y-1.5 rounded border border-dashed border-border p-2","data-testid":"llm-hosts-add-form",children:[(0,a.jsx)(d.p,{value:h,placeholder:"name (e.g. anthropic-cloud)",onChange:e=>p(e.target.value),"data-testid":"llm-hosts-add-name",className:"text-[11px]"}),(0,a.jsx)("select",{value:b,onChange:e=>S(e.target.value),className:"flex h-8 w-full rounded-md border border-input bg-background px-2 text-xs","data-testid":"llm-hosts-add-kind",children:es.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}),(0,a.jsx)(d.p,{value:g,placeholder:"endpoint URL",onChange:e=>v(e.target.value),"data-testid":"llm-hosts-add-endpoint",className:"text-[11px]"}),"anthropic-openai-wrap"===b&&(0,a.jsx)(d.p,{type:"password",value:j,placeholder:"apiKey (sk-ant-…)",onChange:e=>y(e.target.value),"data-testid":"llm-hosts-add-apikey",className:"text-[11px]"}),(0,a.jsx)(i.$,{size:"sm",onClick:()=>{C()},disabled:N||!h.trim()||!g.trim(),"data-testid":"llm-hosts-add-submit",children:N?"Saving…":"Save"})]})]}),(0,a.jsxs)("p",{className:"text-[10px] text-muted-foreground",children:["In-memory override \xb7 daemon restart reverts to ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"ELANOUS_LLM_HOSTS"})," env / legacy single host. Permanent change → set the env var in ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:".zshrc"})," or ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"launchctl setenv"}),". PUT replaces the full list, so re-add Anthropic/Gemini hosts in one go (existing apiKeys appear as ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"[redacted]"})," and aren’t round-trippable)."]})]})}var en=s(57113);function el(){var e,t;let[s,n]=(0,r.useState)(en.lu);(0,r.useEffect)(()=>{n((0,en.lu)())},[]);let l=s.speakingThresholdMultiplier===en.Qc.speakingThresholdMultiplier;return(0,a.jsxs)("section",{"data-testid":"voice-prefs-card",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"\uD83C\uDF99️ Voice barge-in 튜닝"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"BI-2 ducking 강도 — TTS 재생 중 자기-에코 false-fire 를 막는 RMS multiplier. 변경은 voice toggle off → on 또는 새로고침 시 적용."})]}),(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"rounded-md border border-input bg-background px-3 py-2",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between text-xs",children:[(0,a.jsx)("span",{className:"font-medium",children:"speaking threshold multiplier"}),(0,a.jsx)("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[11px]","data-testid":"voice-prefs-multiplier-value",children:(e=s.speakingThresholdMultiplier,"".concat(e.toFixed(1),"\xd7"))})]}),(0,a.jsx)("input",{type:"range",min:en.u4,max:en.M_,step:.1,value:s.speakingThresholdMultiplier,onChange:e=>{var t;return t={speakingThresholdMultiplier:Number(e.target.value)},void(n((0,en.ik)(t)),(0,b.cY)("settings.voice-prefs.update",t))},"data-testid":"voice-prefs-multiplier-slider","aria-label":"Speaking threshold multiplier","aria-valuemin":en.u4,"aria-valuemax":en.M_,"aria-valuenow":s.speakingThresholdMultiplier,className:"w-full"}),(0,a.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground","data-testid":"voice-prefs-hint",children:(t=s.speakingThresholdMultiplier)<=1.2?"거의 ducking 없음 — 자기-에코 false-fire 가능":t<=1.7?"약한 ducking — 강한 AEC 환경 + 빠른 cut-in":t<=2.5?"기본값 — 대부분 환경에서 균형":t<=3.5?"강한 ducking — 시끄러운 환경 / 민감한 마이크":"매우 강한 ducking — 자기-에코가 심한 환경"})]})}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsxs)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>{n((0,en.KS)()),(0,b.cY)("settings.voice-prefs.reset")},disabled:l,className:"text-xs text-muted-foreground","data-testid":"voice-prefs-reset",children:["기본값으로 리셋 (",en.Qc.speakingThresholdMultiplier.toFixed(1),"\xd7)"]})})]})}var ei=s(3844),ed=s(85364),eo=s(66271);function ec(e){let{currentTier:t,nextTier:s,currentTierMonthlyUsd:n,nextTierMonthlyUsd:l,monthSoFarUsd:d,onConfirm:o,onCancel:c}=e,u=(0,r.useRef)(null);(0,r.useEffect)(()=>{var e;null==(e=u.current)||e.focus()},[]);let m=ed.YS[t],x=ed.YS[s],h=l>n,p=h?'Switch to "'.concat(ed.LW[s],'" tier?'):'Switch to "'.concat(ed.LW[s],'" tier (cheaper)'),b=l-n,f=b>=0?"+".concat((0,ed.Bg)(Math.abs(b))):"-".concat((0,ed.Bg)(Math.abs(b)));return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"tier-confirm-title","aria-describedby":"tier-confirm-summary","data-testid":"tier-change-confirm-modal",onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),c())},children:(0,a.jsxs)("div",{className:"w-full max-w-md rounded-lg border bg-white p-4 shadow-xl dark:bg-zinc-900 ".concat(h?"border-amber-300 dark:border-amber-700":"border-emerald-300 dark:border-emerald-700"),children:[(0,a.jsxs)("h2",{id:"tier-confirm-title",className:"mb-2 text-sm font-medium ".concat(h?"text-amber-700 dark:text-amber-300":"text-emerald-700 dark:text-emerald-300"),children:[h?"⚠️":"✓"," ",p]}),(0,a.jsx)("p",{id:"tier-confirm-summary",className:"mb-3 text-xs text-zinc-700 dark:text-zinc-300",children:x.rationale}),(0,a.jsxs)("dl",{className:"mb-4 space-y-1.5 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("dt",{className:"text-zinc-500 dark:text-zinc-400",children:"Month so far"}),(0,a.jsx)("dd",{className:"font-mono tabular-nums text-zinc-900 dark:text-zinc-100","data-testid":"tier-confirm-month-so-far",children:(0,ed.Bg)(d).replace("/mo","")})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("dt",{className:"text-zinc-500 dark:text-zinc-400",children:["At current tier (",ed.LW[t],")"]}),(0,a.jsx)("dd",{className:"font-mono tabular-nums text-zinc-900 dark:text-zinc-100","data-testid":"tier-confirm-current-projected",children:(0,ed.Bg)(n)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between rounded px-2 py-1 ".concat(h?"bg-amber-50 dark:bg-amber-950/40":"bg-emerald-50 dark:bg-emerald-950/40"),children:[(0,a.jsxs)("dt",{className:h?"text-amber-700 dark:text-amber-300":"text-emerald-700 dark:text-emerald-300",children:["At new tier (",ed.LW[s],")"]}),(0,a.jsxs)("dd",{className:"font-mono tabular-nums ".concat(h?"text-amber-900 dark:text-amber-100":"text-emerald-900 dark:text-emerald-100"),"data-testid":"tier-confirm-next-projected",children:[(0,ed.Bg)(l),(0,a.jsxs)("span",{className:"ml-1 text-[10px] opacity-70","data-testid":"tier-confirm-delta",children:["(",f,")"]})]})]})]}),(0,a.jsxs)("p",{className:"mb-3 text-[11px] text-zinc-500 dark:text-zinc-400","data-testid":"tier-confirm-rate-line",children:["Per-call: $",m.usdPerMinAudio.toFixed(3),"/min → $",(x.usdPerMinAudio+x.loadedExtraUsdPerMin).toFixed(3),"/min"]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:c,"data-testid":"tier-confirm-cancel",children:"Cancel"}),(0,a.jsx)(i.$,{ref:u,type:"button",size:"sm",onClick:o,"data-testid":"tier-confirm-confirm",className:h?"bg-amber-600 text-white hover:bg-amber-700":"bg-emerald-600 text-white hover:bg-emerald-700",children:h?"Confirm switch":"Switch"})]})]})})}let eu=ed.Ql.length;function em(){let{config:e}=(0,n.Q)(),t=(0,r.useMemo)(()=>({baseUrl:e.baseUrl,...e.token?{token:e.token}:{}}),[e.baseUrl,e.token]),[s,l]=(0,r.useState)(eo.Ij),[d,o]=(0,r.useState)(null),[c,u]=(0,r.useState)("idle"),[m]=(0,r.useState)(0);(0,r.useEffect)(()=>{l((0,eo.Ij)());let e=!1;return(async()=>{let s=await (0,ei.ee)(t);!e&&s&&(l(s),u("synced"))})(),()=>{e=!0}},[t]);let x=(0,eo.gF)(s),h=ed.YS[x],p=void 0===s.stt,f=(0,ed.K0)(null!=d?d:x),g=(0,r.useMemo)(()=>{let e={};for(let t of ed.Ql)e[t]=(0,ed.nX)(t,s.audioMinPerDay);return e},[s.audioMinPerDay]),v=e=>{l((0,eo.Pz)({stt:e})),u("syncing"),(0,b.cY)("settings.model-tier.update",{stt:e}),(0,ei.ZB)(t,e).then(u)};return(0,a.jsxs)("section",{"data-testid":"voice-model-tier-card",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"\uD83C\uDF9A️ Voice transcription quality"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Pick how accurate vs. cheap the speech-to-text should be — elanous picks the model. Switching takes effect on the next voice call."})]}),(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"rounded-md border border-input bg-background px-3 py-2",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:"font-medium",children:[ed.LW[x],p&&(0,a.jsx)("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground","data-testid":"voice-model-tier-default-badge",children:"Smart default"}),"syncing"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-blue-500/10 px-1.5 py-0.5 text-[10px] text-blue-600","data-testid":"voice-model-tier-sync-status",children:"Syncing…"}),"synced"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-600","data-testid":"voice-model-tier-sync-status",children:"Synced"}),"offline"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-600","data-testid":"voice-model-tier-sync-status",title:"Daemon unreachable — change saved locally \xb7 will sync when daemon comes back",children:"Offline"}),"error"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10px] text-red-600","data-testid":"voice-model-tier-sync-status",title:"Daemon refused the write — local copy still has your choice",children:"Sync error"})]}),(0,a.jsx)("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[11px]","data-testid":"voice-model-tier-cost",children:s.audioMinPerDay>0?(0,ed.Bg)(g[x]):"".concat((h.usdPerMinAudio+h.loadedExtraUsdPerMin).toFixed(3),"/min")})]}),(0,a.jsx)("input",{type:"range",min:0,max:eu-1,step:1,value:f,onChange:e=>{let t=function(e){let t=Math.max(0,Math.min(eu-1,Math.round(e)));return ed.Ql[t]}(Number(e.target.value));if(t!==x){if(function(e){let{currentTier:t,nextTier:s,currentTierMonthlyUsd:a,nextTierMonthlyUsd:r,audioMinPerDay:n}=e;if(t===s)return!1;let l=r-a;if(l<0)return!1;if(n>0)return l>=1;let i=ed.YS[t].usdPerMinAudio+ed.YS[t].loadedExtraUsdPerMin,d=ed.YS[s].usdPerMinAudio+ed.YS[s].loadedExtraUsdPerMin;return 0===i?d>0:d>=5*i}({currentTier:x,nextTier:t,currentTierMonthlyUsd:g[x],nextTierMonthlyUsd:g[t],audioMinPerDay:s.audioMinPerDay}))return void o(t);v(t)}},"data-testid":"voice-model-tier-slider","aria-label":"Voice transcription tier","aria-valuemin":0,"aria-valuemax":eu-1,"aria-valuenow":f,"aria-valuetext":ed.LW[x],className:"w-full"}),(0,a.jsx)("div",{className:"mt-1 flex justify-between text-[10px] text-muted-foreground","data-testid":"voice-model-tier-tick-labels",children:ed.Ql.map(e=>(0,a.jsx)("span",{className:e===x?"font-semibold text-foreground":void 0,children:ed.LW[e]},e))}),(0,a.jsx)("p",{className:"mt-2 text-[11px] text-muted-foreground","data-testid":"voice-model-tier-rationale",children:h.rationale}),(0,a.jsxs)("p",{className:"mt-1 text-[10px] text-muted-foreground/80","data-testid":"voice-model-tier-model-id",children:["Model: ",(0,a.jsx)("span",{className:"font-mono",children:h.model}),"wip"===h.status&&(0,a.jsx)("span",{className:"ml-1 rounded bg-amber-500/10 px-1 py-0.5 text-amber-600",children:"WIP \xb7 install local binary first"})]})]})}),(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,a.jsxs)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>{l((0,eo.Pv)()),o(null),u("syncing"),(0,b.cY)("settings.model-tier.reset"),(0,ei.ZB)(t,null).then(u)},disabled:p,className:"text-xs text-muted-foreground","data-testid":"voice-model-tier-reset",children:["Reset to default (",ed.LW[ed.j$],")"]}),s.audioMinPerDay>0&&(0,a.jsxs)("span",{className:"text-[10px] text-muted-foreground","data-testid":"voice-model-tier-usage-hint",children:["~",s.audioMinPerDay.toFixed(0)," min/day \xb7 14-day rolling avg"]})]}),d&&(0,a.jsx)(ec,{currentTier:x,nextTier:d,currentTierMonthlyUsd:g[x],nextTierMonthlyUsd:g[d],monthSoFarUsd:m,onConfirm:()=>{d&&v(d),o(null)},onCancel:()=>{o(null),(0,b.cY)("settings.model-tier.cancel",{from:x})}})]})}let ex=ed.Ql.length;function eh(e){return"string"==typeof e&&(0,ed.D9)(e)?e:"anthropic"}function ep(){let{config:e}=(0,n.Q)(),t=(0,r.useMemo)(()=>({baseUrl:e.baseUrl,...e.token?{token:e.token}:{}}),[e.baseUrl,e.token]),[s,l]=(0,r.useState)(eo.Ij),[d,o]=(0,r.useState)(()=>eh(e.provider)),[c,u]=(0,r.useState)("idle");(0,r.useEffect)(()=>{l((0,eo.Ij)());let e=!1;return(async()=>{let s=await (0,ei.ee)(t);!e&&s&&(l(s),u("synced"))})(),()=>{e=!0}},[t]),(0,r.useEffect)(()=>{o(eh(e.provider))},[e.provider]);let m=(0,eo.oA)(s),x=void 0===s.llm,h=(0,ed.K0)(m),p=(0,ed.f7)(d,m);return(0,a.jsxs)("section",{"data-testid":"llm-model-tier-card",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"\uD83E\uDDE0 AI assistant quality"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Pick how careful vs. fast the model should think. elanous chooses the right model on your active provider \xb7 the slider stays the same across providers."})]}),(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"rounded-md border border-input bg-background px-3 py-2",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:"font-medium",children:[ed.LW[m],x&&(0,a.jsx)("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground","data-testid":"llm-model-tier-default-badge",children:"Smart default"}),"syncing"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-blue-500/10 px-1.5 py-0.5 text-[10px] text-blue-600","data-testid":"llm-model-tier-sync-status",children:"Syncing…"}),"synced"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-600","data-testid":"llm-model-tier-sync-status",children:"Synced"}),"offline"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-600","data-testid":"llm-model-tier-sync-status",title:"Daemon unreachable",children:"Offline"}),"error"===c&&(0,a.jsx)("span",{className:"ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10px] text-red-600","data-testid":"llm-model-tier-sync-status",title:"Daemon refused the write",children:"Sync error"})]}),(0,a.jsx)("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[11px]","data-testid":"llm-model-tier-provider",children:ed.T0[d]})]}),(0,a.jsx)("input",{type:"range",min:0,max:ex-1,step:1,value:h,onChange:e=>{let s=function(e){let t=Math.max(0,Math.min(ex-1,Math.round(e)));return ed.Ql[t]}(Number(e.target.value));s!==m&&(l((0,eo.Pz)({llm:s})),u("syncing"),(0,b.cY)("settings.model-tier.llm.update",{llm:s}),(0,ei.tM)(t,s).then(u))},"data-testid":"llm-model-tier-slider","aria-label":"AI assistant tier","aria-valuemin":0,"aria-valuemax":ex-1,"aria-valuenow":h,"aria-valuetext":ed.LW[m],className:"w-full"}),(0,a.jsx)("div",{className:"mt-1 flex justify-between text-[10px] text-muted-foreground","data-testid":"llm-model-tier-tick-labels",children:ed.Ql.map(e=>(0,a.jsx)("span",{className:e===m?"font-semibold text-foreground":void 0,children:ed.LW[e]},e))}),(0,a.jsx)("p",{className:"mt-2 text-[11px] text-muted-foreground","data-testid":"llm-model-tier-rationale",children:p.rationale}),(0,a.jsxs)("p",{className:"mt-1 text-[10px] text-muted-foreground/80","data-testid":"llm-model-tier-model-id",children:["Model: ",(0,a.jsx)("span",{className:"font-mono",children:p.model}),p.reasoningLevel&&(0,a.jsxs)("span",{className:"ml-1 text-muted-foreground",children:["\xb7 reasoning: ",(0,a.jsx)("span",{className:"font-mono",children:p.reasoningLevel})]}),"wip"===p.status&&(0,a.jsx)("span",{className:"ml-1 rounded bg-amber-500/10 px-1 py-0.5 text-amber-600",children:"WIP \xb7 install local runtime first"})]})]})}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsxs)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>{l((0,eo.Pz)({llm:void 0})),u("syncing"),(0,b.cY)("settings.model-tier.llm.reset"),(0,ei.tM)(t,null).then(u)},disabled:x,className:"text-xs text-muted-foreground","data-testid":"llm-model-tier-reset",children:["Reset to default (",ed.LW[ed.j$],")"]})})]})}let eb=ed.Ql.length;function ef(){var e;let{config:t}=(0,n.Q)(),s=(0,r.useMemo)(()=>({baseUrl:t.baseUrl,...t.token?{token:t.token}:{}}),[t.baseUrl,t.token]),[l,d]=(0,r.useState)(eo.Ij),[o,c]=(0,r.useState)("idle");(0,r.useEffect)(()=>{d((0,eo.Ij)());let e=!1;return(async()=>{let t=await (0,ei.ee)(s);!e&&t&&(d(t),c("synced"))})(),()=>{e=!0}},[s]);let u=(0,eo.Md)(l),m=ed.eP[u],x=void 0===l.tts,h=(0,ed.K0)(u),p=!Number.isFinite(e=m.usdPerCharacter)||e<=0?"free":"$".concat((1e6*e).toFixed(0),"/M chars");return(0,a.jsxs)("section",{"data-testid":"tts-model-tier-card",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"\uD83D\uDD0A Voice playback quality"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Pick text-to-speech quality vs. cost. Voice identity (Rachel \xb7 SoYoung \xb7 custom) lives in a separate picker (Phase 2 M2-2b)."})]}),(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"rounded-md border border-input bg-background px-3 py-2",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between text-xs",children:[(0,a.jsxs)("span",{className:"font-medium",children:[ed.LW[u],x&&(0,a.jsx)("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground","data-testid":"tts-model-tier-default-badge",children:"Smart default"}),"syncing"===o&&(0,a.jsx)("span",{className:"ml-2 rounded bg-blue-500/10 px-1.5 py-0.5 text-[10px] text-blue-600","data-testid":"tts-model-tier-sync-status",children:"Syncing…"}),"synced"===o&&(0,a.jsx)("span",{className:"ml-2 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-600","data-testid":"tts-model-tier-sync-status",children:"Synced"}),"offline"===o&&(0,a.jsx)("span",{className:"ml-2 rounded bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-600","data-testid":"tts-model-tier-sync-status",children:"Offline"}),"error"===o&&(0,a.jsx)("span",{className:"ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10px] text-red-600","data-testid":"tts-model-tier-sync-status",children:"Sync error"})]}),(0,a.jsx)("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[11px]","data-testid":"tts-model-tier-rate",children:p})]}),(0,a.jsx)("input",{type:"range",min:0,max:eb-1,step:1,value:h,onChange:e=>{let t=function(e){let t=Math.max(0,Math.min(eb-1,Math.round(e)));return ed.Ql[t]}(Number(e.target.value));t!==u&&(d((0,eo.Pz)({tts:t})),c("syncing"),(0,b.cY)("settings.model-tier.tts.update",{tts:t}),(0,ei.pP)(s,t).then(c))},"data-testid":"tts-model-tier-slider","aria-label":"Voice playback tier","aria-valuemin":0,"aria-valuemax":eb-1,"aria-valuenow":h,"aria-valuetext":ed.LW[u],className:"w-full"}),(0,a.jsx)("div",{className:"mt-1 flex justify-between text-[10px] text-muted-foreground","data-testid":"tts-model-tier-tick-labels",children:ed.Ql.map(e=>(0,a.jsx)("span",{className:e===u?"font-semibold text-foreground":void 0,children:ed.LW[e]},e))}),(0,a.jsx)("p",{className:"mt-2 text-[11px] text-muted-foreground","data-testid":"tts-model-tier-rationale",children:m.rationale}),(0,a.jsxs)("p",{className:"mt-1 text-[10px] text-muted-foreground/80","data-testid":"tts-model-tier-model-id",children:["Provider: ",(0,a.jsx)("span",{className:"font-mono",children:m.provider}),(0,a.jsx)("span",{className:"ml-1",children:"\xb7"}),(0,a.jsxs)("span",{className:"ml-1",children:["Model: ",(0,a.jsx)("span",{className:"font-mono",children:m.model})]})]})]})}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsxs)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>{d((0,eo.Pz)({tts:void 0})),c("syncing"),(0,b.cY)("settings.model-tier.tts.reset"),(0,ei.pP)(s,null).then(c)},disabled:x,className:"text-xs text-muted-foreground","data-testid":"tts-model-tier-reset",children:["Reset to default (",ed.LW[ed.j$],")"]})})]})}let eg=null;async function ev(e){var t;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.baseUrl)return null;let a=null!=(t=s.now)?t:Date.now();if(!s.bypassMemo&&eg&&a-eg.fetchedAt<6e4)return eg.lib;try{let t=e.baseUrl.replace(/\/$/,"")+"/v1/elevenlabs/voices",s={};e.token&&(s.authorization="Bearer ".concat(e.token));let r=await fetch(t,{headers:s});if(!r.ok)return null;let n=await r.json(),l={voices:Array.isArray(n.voices)?n.voices:[],configured:!0===n.configured,fromCache:!0===n.fromCache};return eg={fetchedAt:a,lib:l},l}catch(e){return null}}let ej="elanous.tts-voice.recent";function ey(){if("undefined"==typeof localStorage)return[];try{let e=localStorage.getItem(ej);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e&&e.length>0).slice(0,5)}catch(e){return[]}}let eN=[{key:"default",label:"Default",hint:"Fallback when a specific context isn't set"},{key:"chat",label:"Chat reply",hint:"Used by the PWA / TUI chat surface"},{key:"digest",label:"Morning digest",hint:"Daily summary read-back (P2-D7)"},{key:"alert",label:"Push alerts",hint:"Urgency-driven voice for push notifications"},{key:"discord",label:"Discord bot",hint:"X9 Discord voice channel + DM voice replies"}],ek="elanous.tts-voice-map";function ew(){if("undefined"==typeof localStorage)return{};try{let e=localStorage.getItem(ek);if(!e)return{};let t=JSON.parse(e),s={};for(let e of eN){let a=t[e.key];"string"==typeof a&&a.trim().length>0&&(s[e.key]=a.trim())}return s}catch(e){return{}}}function eS(e){return[e.gender,e.accent,e.category].filter(Boolean).join(" \xb7 ")||"voice"}function eC(){var e;let{config:t}=(0,n.Q)(),s=(0,r.useMemo)(()=>({baseUrl:t.baseUrl,...t.token?{token:t.token}:{}}),[t.baseUrl,t.token]),[l,o]=(0,r.useState)(ew),[c,u]=(0,r.useState)("idle"),[m,x]=(0,r.useState)(null),[h,p]=(0,r.useState)(""),[f,g]=(0,r.useState)(null),[v,j]=(0,r.useState)(ey),y=(0,r.useRef)(null),[N,k]=(0,r.useState)(null);(0,r.useEffect)(()=>{o(ew()),j(ey());let e=!1;return(async()=>{let t=await ev(s);e||(x(t),u(null===t?"offline":"synced"))})(),()=>{e=!0}},[s]);let w=(0,r.useMemo)(()=>{let e=new Map;if(m)for(let t of m.voices)e.set(t.id,t);return e},[m]),S=(0,r.useMemo)(()=>{if(!m)return[];var e=m.voices;let t=h.trim().toLowerCase();return t?e.filter(e=>[e.name,e.category,e.accent,e.gender,e.age,e.description,e.language,e.id].filter(Boolean).join(" ").toLowerCase().includes(t)):[...e]},[m,h]),C=async(e,t)=>{let a=(null!=t?t:"").trim(),r={...l};a?r[e]=a:delete r[e],o(r);if("undefined"!=typeof localStorage)try{localStorage.setItem(ek,JSON.stringify(r))}catch(e){}a&&(!function(e){if("undefined"==typeof localStorage||!e||"string"!=typeof e)return;let t=e.trim();if(!t)return;let s=ey().filter(e=>e!==t),a=[t,...s].slice(0,5);try{localStorage.setItem(ej,JSON.stringify(a))}catch(e){}}(a),j(ey())),u("syncing"),(0,b.cY)("settings.tts-voice.apply",{context:e,voiceId:a||null}),u(await (0,ei.D4)(s,{[e]:a||null}))},U=async()=>{if(o({}),"undefined"!=typeof localStorage)try{localStorage.removeItem(ek)}catch(e){}u("syncing"),(0,b.cY)("settings.tts-voice.reset-all"),u(await (0,ei.D4)(s,{default:null,chat:null,digest:null,alert:null,discord:null}))},A=e=>{if(!e.previewUrl)return;y.current&&(y.current.pause(),y.current.src="");let t=new Audio(e.previewUrl);y.current=t,k(e.id),t.addEventListener("ended",()=>k(t=>t===e.id?null:t)),t.addEventListener("error",()=>k(t=>t===e.id?null:t)),t.play().catch(()=>k(t=>t===e.id?null:t)),(0,b.cY)("settings.tts-voice.preview",{voiceId:e.id})},M=()=>{y.current&&(y.current.pause(),y.current.src="",y.current=null),k(null)},E=Object.keys(l).length>0,P=null!==m&&m.voices.length>0;return(0,a.jsxs)("section",{"data-testid":"tts-voice-id-picker-card",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2 flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"\uD83D\uDDE3️ Voice identity (per context)"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Pick a different voice per surface (chat / morning digest / alerts / Discord). Browse the ElevenLabs library or paste a voice id directly."})]}),"syncing"===c&&(0,a.jsx)("span",{className:"rounded bg-blue-500/10 px-1.5 py-0.5 text-[10px] text-blue-600","data-testid":"tts-voice-sync-status",children:"Syncing…"}),"synced"===c&&(0,a.jsx)("span",{className:"rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-600","data-testid":"tts-voice-sync-status",children:"Synced"}),"offline"===c&&(0,a.jsx)("span",{className:"rounded bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-600","data-testid":"tts-voice-sync-status",title:"Daemon unreachable",children:"Offline"}),"error"===c&&(0,a.jsx)("span",{className:"rounded bg-red-500/10 px-1.5 py-0.5 text-[10px] text-red-600","data-testid":"tts-voice-sync-status",children:"Sync error"})]}),m&&!m.configured&&(0,a.jsxs)("div",{className:"mb-3 rounded bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300","data-testid":"tts-voice-library-unconfigured",children:["ElevenLabs API key not set — set ",(0,a.jsx)("code",{className:"font-mono",children:"ELEVENLABS_API_KEY"})," in your env or store via ",(0,a.jsx)("code",{className:"font-mono",children:"elanous config set-secret elevenlabs.apiKey <key>"})," ","to browse the 10k+ voice library."]}),(0,a.jsx)("div",{className:"space-y-2","data-testid":"tts-voice-rows",children:eN.map(e=>{let t=l[e.key],s=t?w.get(t):void 0;return(0,a.jsxs)("div",{className:"rounded-md border border-input bg-background px-3 py-2",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-baseline justify-between gap-2 text-xs",children:[(0,a.jsx)("span",{className:"font-medium","data-testid":"tts-voice-row-".concat(e.key,"-label"),children:e.label}),s&&(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground","data-testid":"tts-voice-row-".concat(e.key,"-current-name"),children:[s.name," ",(0,a.jsxs)("span",{className:"opacity-60",children:["\xb7 ",eS(s)]})]}),t&&!s&&(0,a.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground","data-testid":"tts-voice-row-".concat(e.key,"-current"),children:t})]}),(0,a.jsx)("p",{className:"mb-1 text-[10px] text-muted-foreground",children:e.hint}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.p,{defaultValue:null!=t?t:"",onBlur:s=>{let a=s.target.value.trim();a!==(null!=t?t:"")&&C(e.key,a||null)},placeholder:"Voice id (paste) or use Browse →",className:"text-xs","data-testid":"tts-voice-row-".concat(e.key,"-input")}),(0,a.jsx)(i.$,{type:"button",size:"sm",variant:f===e.key?"default":"outline",onClick:()=>g(f===e.key?null:e.key),disabled:!P,className:"text-xs","data-testid":"tts-voice-row-".concat(e.key,"-browse"),title:P?"Browse library":"Library not loaded yet",children:"Browse"}),(null==s?void 0:s.previewUrl)&&(0,a.jsx)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>N===s.id?M():A(s),className:"text-xs","data-testid":"tts-voice-row-".concat(e.key,"-preview"),children:N===s.id?"⏸":"▶"}),(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(e.key,null),disabled:!t,className:"text-xs text-muted-foreground","data-testid":"tts-voice-row-".concat(e.key,"-clear"),children:"Clear"})]})]},e.key)})}),null!==f&&P&&(0,a.jsxs)("div",{className:"mt-3 rounded-md border border-input bg-background p-2","data-testid":"tts-voice-library-catalog",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,a.jsx)(d.p,{value:h,onChange:e=>p(e.target.value),placeholder:"Search voices (name \xb7 accent \xb7 gender \xb7 description)",className:"text-xs","data-testid":"tts-voice-library-search"}),(0,a.jsx)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>g(null),className:"text-xs text-muted-foreground","data-testid":"tts-voice-library-close",children:"Close"})]}),v.length>0&&!h&&(0,a.jsxs)("div",{className:"mb-2","data-testid":"tts-voice-recent-row",children:[(0,a.jsx)("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:"Recently used"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:v.map(e=>{let t=w.get(e);return t?(0,a.jsx)("button",{type:"button",className:"rounded border border-border/40 bg-muted/30 px-2 py-1 text-[11px] hover:bg-muted",onClick:()=>f&&C(f,e),"data-testid":"tts-voice-recent-".concat(e),children:t.name},e):null})})]}),(0,a.jsxs)("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:[S.length," voice",1===S.length?"":"s",h&&' matching "'.concat(h,'"')]}),(0,a.jsxs)("div",{className:"max-h-64 space-y-1 overflow-y-auto pr-1","data-testid":"tts-voice-library-list",children:[S.slice(0,50).map(e=>{let t=N===e.id;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded border border-border/40 bg-muted/20 px-2 py-1 text-xs","data-testid":"tts-voice-library-row-".concat(e.id),children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate font-medium",children:e.name}),(0,a.jsxs)("div",{className:"truncate text-[10px] text-muted-foreground",children:[eS(e),e.description&&(0,a.jsxs)("span",{children:[" \xb7 ",e.description]})]})]}),e.previewUrl&&(0,a.jsx)(i.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>t?M():A(e),className:"text-xs","data-testid":"tts-voice-library-preview-".concat(e.id),children:t?"⏸":"▶"}),(0,a.jsx)(i.$,{type:"button",size:"sm",onClick:()=>f&&C(f,e.id),className:"text-xs","data-testid":"tts-voice-library-apply-".concat(e.id),children:"Apply"})]},e.id)}),S.length>50&&(0,a.jsxs)("p",{className:"text-center text-[10px] text-muted-foreground",children:["Showing first 50 of ",S.length," \xb7 refine the search to see more"]}),0===S.length&&(0,a.jsxs)("p",{className:"px-2 py-4 text-center text-[11px] text-muted-foreground",children:['No voices match "',h,'"']})]})]}),(0,a.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:U,disabled:!E,className:"text-xs text-muted-foreground","data-testid":"tts-voice-reset-all",children:"Reset all"}),(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground/80",children:P?"".concat(null!=(e=null==m?void 0:m.voices.length)?e:0," voices \xb7 library cache via daemon"):"Paste voice id manually until daemon library is reachable"})]})]})}let eU={casual_chat:{id:"casual_chat",label:"Casual chat",icon:"\uD83D\uDCAC",description:"Day-to-day messaging \xb7 cheap STT / LLM \xb7 no read-back.",tiers:{stt:"budget",llm:"budget",tts:"budget"}},meeting:{id:"meeting",label:"Meeting notes",icon:"\uD83D\uDCCB",description:"Balanced accuracy for transcripts \xb7 standard LLM summarization.",tiers:{stt:"balanced",llm:"balanced",tts:"balanced"},monthlyUsdCap:5},medical_dictation:{id:"medical_dictation",label:"Medical / legal dictation",icon:"\uD83C\uDFE5",description:"Loaded STT (timestamps + jargon adaptation) \xb7 Best LLM \xb7 ElevenLabs voice.",tiers:{stt:"loaded",llm:"best",tts:"best"},monthlyUsdCap:20},live_caption:{id:"live_caption",label:"Live captioning",icon:"\uD83C\uDFAC",description:"Low-latency STT \xb7 LLM disabled \xb7 no read-back.",tiers:{stt:"balanced",llm:"budget",tts:"budget"}},sleep_mode:{id:"sleep_mode",label:"Sleep mode",icon:"\uD83C\uDF19",description:"Cost zero \xb7 local-only models \xb7 no API calls.",tiers:{stt:"budget",llm:"budget",tts:"budget"},monthlyUsdCap:0}},eA=["casual_chat","meeting","medical_dictation","live_caption","sleep_mode"],eM="elanous.active-preset";function eE(){if("undefined"!=typeof localStorage)try{let e=localStorage.getItem(eM);if(!e)return;return eA.includes(e)?e:void 0}catch(e){return}}function eP(e){if("undefined"!=typeof localStorage)try{null===e?localStorage.removeItem(eM):localStorage.setItem(eM,e)}catch(e){}}function ez(){let{config:e}=(0,n.Q)(),t=(0,r.useMemo)(()=>({baseUrl:e.baseUrl,...e.token?{token:e.token}:{}}),[e.baseUrl,e.token]),[s,l]=(0,r.useState)(eE),[d,o]=(0,r.useState)("idle"),[c,u]=(0,r.useState)(null);(0,r.useEffect)(()=>{l(eE())},[]);let m=async e=>{u(e.id),o("syncing"),(0,b.cY)("settings.preset.apply",{id:e.id}),eP(e.id),l(e.id),o(await (0,ei.F$)(t,{id:e.id,tiers:e.tiers,...e.ttsVoice?{ttsVoice:e.ttsVoice}:{},...void 0!==e.monthlyUsdCap?{monthlyUsdCap:e.monthlyUsdCap}:{}})),u(null)},x=async()=>{o("syncing"),(0,b.cY)("settings.preset.clear"),eP(null),l(void 0),o(await (0,ei.F$)(t,null))};return(0,a.jsxs)("section",{"data-testid":"preset-card-grid",className:"rounded border border-border/60 bg-card/40 p-4 shadow-sm",children:[(0,a.jsxs)("header",{className:"mb-2 flex items-start justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"⚡ Quick presets"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"One-click bundles for common use cases — applies STT, LLM, TTS, voice id, and budget cap together. You can still fine-tune any slider after applying."})]}),"syncing"===d&&(0,a.jsx)("span",{className:"rounded bg-blue-500/10 px-1.5 py-0.5 text-[10px] text-blue-600","data-testid":"preset-sync-status",children:"Syncing…"}),"synced"===d&&(0,a.jsx)("span",{className:"rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-600","data-testid":"preset-sync-status",children:"Synced"}),"offline"===d&&(0,a.jsx)("span",{className:"rounded bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-600","data-testid":"preset-sync-status",children:"Offline"}),"error"===d&&(0,a.jsx)("span",{className:"rounded bg-red-500/10 px-1.5 py-0.5 text-[10px] text-red-600","data-testid":"preset-sync-status",children:"Sync error"})]}),s&&(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between rounded bg-emerald-500/5 px-3 py-2 text-xs","data-testid":"preset-active-banner",children:[(0,a.jsxs)("span",{className:"text-emerald-700 dark:text-emerald-300",children:["✓ Active preset: ",(0,a.jsx)("strong",{children:eU[s].label})]}),(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:x,className:"text-[11px] text-muted-foreground","data-testid":"preset-clear-active",children:"Clear preset"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3","data-testid":"preset-card-list",children:eA.map(e=>{let t=eU[e],r=s===e,n=c===e;return(0,a.jsxs)("button",{type:"button",onClick:()=>m(t),disabled:n,className:"rounded-md border px-3 py-2 text-left transition-colors ".concat(r?"border-emerald-500 bg-emerald-500/5":"border-border/60 bg-background hover:bg-muted/40"),"data-testid":"preset-card-".concat(e),children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-sm font-semibold",children:[t.icon," ",t.label]}),r&&(0,a.jsx)("span",{className:"text-[10px] text-emerald-600",children:"active"}),n&&(0,a.jsx)("span",{className:"text-[10px] text-blue-600",children:"applying…"})]}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground",children:t.description}),(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1 text-[9px] text-muted-foreground",children:[t.tiers.stt&&(0,a.jsxs)("span",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:["stt:",t.tiers.stt]}),t.tiers.llm&&(0,a.jsxs)("span",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:["llm:",t.tiers.llm]}),t.tiers.tts&&(0,a.jsxs)("span",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:["tts:",t.tiers.tts]}),void 0!==t.monthlyUsdCap&&(0,a.jsxs)("span",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:["cap:$",t.monthlyUsdCap]})]})]},e)})})]})}var eL=s(73632);let eI=(0,$.A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var eR=s(66420);let eT=(0,$.A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var eD=s(19961);let e$={skills:"\uD83D\uDEE0️",toolRestrictions:"\uD83D\uDD12",structuredOutput:"\uD83D\uDCCB",thinkingControl:"\uD83D\uDCAD",effortControl:"⚙️",sessionResume:"↩️",mcp:"\uD83E\uDDE9",hooks:"\uD83E\uDE9D",agents:"\uD83E\uDD16",envInjection:"\uD83D\uDD11",costControl:"\uD83D\uDCB0",fallbackModel:"\uD83D\uDD01",sandbox:"\uD83E\uDDF1",multiHostFanout:"\uD83C\uDF10"};function eO(){let{client:e,config:t}=(0,n.Q)(),s=(0,eD.X)(e),[l,i]=(0,r.useState)({}),[d,o]=(0,r.useState)({state:"idle"}),[c,u]=(0,r.useState)("list"),m=(0,r.useMemo)(()=>{let e=s.providers[0];return e?Object.keys(e.capabilities).sort():[]},[s.providers]);(0,r.useEffect)(()=>{if(s.providers.length>0&&0===Object.keys(l).length){let e={};for(let t of s.providers)e[t.id]=!1;i(e)}},[s.providers,l]);let x=(0,r.useCallback)(e=>{i(t=>({...t,[e]:!t[e]}))},[]),h=(0,r.useCallback)(async()=>{o({state:"running"});try{var e,a;let r="".concat(null!=(a=null==(e=t.baseUrl)?void 0:e.replace(/\/$/,""))?a:"","/v1/registry/discovery"),n={};t.token&&(n.authorization="Bearer ".concat(t.token));let l=await fetch(r,{method:"POST",headers:n});if(!l.ok)return void o({state:"error",detail:"HTTP ".concat(l.status)});await s.reload(),o({state:"ok"})}catch(e){o({state:"error",detail:e instanceof Error?e.message:String(e)})}},[t.baseUrl,t.token,s]);return(0,a.jsxs)("section",{className:"space-y-2","data-testid":"llm-catalog-card",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"LLM Catalog"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[(0,a.jsx)("span",{"data-testid":"llm-catalog-summary",children:s.loading?"loading…":"".concat(s.providers.length," providers \xb7 ").concat(s.models.length," models")}),(0,a.jsx)("button",{type:"button",onClick:()=>u(e=>"list"===e?"matrix":"list"),"aria-label":"Toggle view: list vs capability matrix","data-testid":"llm-catalog-view-toggle",className:"rounded px-1.5 py-0.5 text-[10px] uppercase font-medium hover:bg-surface-elevated",children:"list"===c?"matrix":"list"}),(0,a.jsx)("button",{type:"button",onClick:h,disabled:"running"===d.state||s.loading,"aria-label":"Run discovery refresh","data-testid":"llm-catalog-refresh",className:"rounded p-1 hover:bg-surface-elevated disabled:opacity-50",children:(0,a.jsx)(R.A,{className:"h-3 w-3 ".concat("running"===d.state?"animate-spin":"")})})]})]}),s.error&&(0,a.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-error","data-testid":"llm-catalog-error",children:[(0,a.jsx)(T.A,{className:"h-3 w-3"}),s.error]}),"error"===d.state&&(0,a.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-error",children:[(0,a.jsx)(T.A,{className:"h-3 w-3"}),"discovery failed \xb7 ",d.detail]}),"ok"===d.state&&(0,a.jsx)("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-400",children:"discovery complete — catalog refreshed"}),s.loading&&0===s.providers.length&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Querying /v1/registry/catalog…"}),s.providers.length>0&&"matrix"===c&&(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-border","data-testid":"llm-catalog-matrix",children:(0,a.jsxs)("table",{className:"min-w-full text-[10px]",children:[(0,a.jsx)("thead",{className:"bg-surface-elevated",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"sticky left-0 z-10 bg-surface-elevated px-2 py-1 text-left font-medium",children:"Provider"}),m.map(e=>{var t;return(0,a.jsx)("th",{className:"px-1.5 py-1 text-center font-medium uppercase text-muted-foreground",title:e,children:null!=(t=e$[e])?t:e.slice(0,3)},e)})]})}),(0,a.jsx)("tbody",{children:s.providers.map(e=>(0,a.jsxs)("tr",{className:"border-t border-border/40","data-testid":"llm-catalog-matrix-row-".concat(e.id),children:[(0,a.jsx)("td",{className:"sticky left-0 z-10 bg-card px-2 py-1 font-mono text-[10px]",children:e.id}),m.map(t=>{let s=e.capabilities[t];return(0,a.jsx)("td",{className:"px-1.5 py-1 text-center",title:"".concat(e.id," \xb7 ").concat(t,": ").concat(s?"yes":"no"),children:s?(0,a.jsx)(eL.A,{className:"mx-auto h-3 w-3 text-emerald-600 dark:text-emerald-400"}):(0,a.jsx)(eI,{className:"mx-auto h-3 w-3 text-muted-foreground/50"})},t)})]},e.id))})]})}),s.providers.length>0&&"list"===c&&(0,a.jsx)("ul",{className:"space-y-1 rounded-md border border-border","data-testid":"llm-catalog-provider-list",children:s.providers.map(e=>{var t;let r=s.modelsByProvider(e.id),n=null!=(t=l[e.id])&&t,i=Object.entries(e.capabilities).filter(e=>{let[,t]=e;return!0===t}).map(e=>{let[t]=e;return t});return(0,a.jsxs)("li",{className:"border-b border-border/40 last:border-0","data-testid":"llm-catalog-provider-".concat(e.id),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>x(e.id),"aria-expanded":n,className:"flex w-full items-start justify-between gap-2 px-2 py-1.5 text-left hover:bg-surface-elevated","data-testid":"llm-catalog-provider-toggle-".concat(e.id),children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[n?(0,a.jsx)(eR.A,{className:"h-3 w-3"}):(0,a.jsx)(eT,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:e.displayName}),(0,a.jsx)("span",{className:"rounded bg-muted px-1 font-mono text-[9px] uppercase text-muted-foreground",children:e.id})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-0.5 pl-4 text-[10px] text-muted-foreground",children:i.map(e=>{var t;return(0,a.jsxs)("span",{className:"rounded bg-surface-elevated px-1",title:e,children:[null!=(t=e$[e])?t:"\xb7"," ",e]},e)})})]}),(0,a.jsxs)("span",{className:"shrink-0 rounded bg-muted px-1 text-[10px] text-muted-foreground",children:[r.length," model",1===r.length?"":"s"]})]}),n&&(0,a.jsxs)("ul",{className:"border-t border-border/40 bg-surface-elevated/50 px-2 py-1","data-testid":"llm-catalog-models-".concat(e.id),children:[0===r.length&&(0,a.jsx)("li",{className:"py-1 text-[10px] text-muted-foreground",children:"no models registered for this provider"}),r.map(e=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 py-0.5 font-mono text-[10px]","data-testid":"llm-catalog-model-".concat(e.id),children:[(0,a.jsx)("span",{className:"truncate",title:e.id,children:e.id}),(0,a.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:[e.contextSize?"".concat(Math.round(e.contextSize/1e3),"k ctx"):"—",e.pricing?" \xb7 $".concat(e.pricing.inputPerMTok,"/$").concat(e.pricing.outputPerMTok):""]})]},e.id))]})]},e.id)})})]})}var eY=s(33158);function eB(e){let{status:t,percent:s,monthlyUsdCap:n,monthSoFarUsd:l,recommendedFallback:d,notifyAtPct:o,onApply:c,onAdjustCap:u,onDismiss:m}=e,[x,h]=(0,r.useState)("switch"),p=(0,r.useRef)(null);(0,r.useEffect)(()=>{var e;null==(e=p.current)||e.focus()},[]);let b="cap-exceeded"===t,f=ed.LW[d],g=(0,ed.Bg)(l).replace("/mo",""),v=(0,ed.Bg)(n).replace("/mo","");return(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"budget-threshold-title","aria-describedby":"budget-threshold-summary","data-testid":"budget-threshold-modal","data-status":t,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),m())},children:(0,a.jsxs)("div",{className:"w-full max-w-md rounded-lg border bg-white p-4 shadow-xl dark:bg-zinc-900 ".concat(b?"border-rose-300 dark:border-rose-700":"border-amber-300 dark:border-amber-700"),children:[(0,a.jsxs)("h2",{id:"budget-threshold-title",className:"mb-2 text-sm font-medium ".concat(b?"text-rose-700 dark:text-rose-300":"text-amber-700 dark:text-amber-300"),children:["\uD83D\uDCB0 You've used ",g," of ",v," monthly cap (",Math.round(s),"%)"]}),(0,a.jsx)("p",{id:"budget-threshold-summary",className:"mb-3 text-xs text-zinc-600 dark:text-zinc-400","data-testid":"budget-threshold-summary",children:b?"You've passed the cap. elanous recommends falling back to ".concat(f," tier for the rest of this month."):"You're past the ".concat(o,"% threshold. elanous can switch to ").concat(f," tier to slow the burn.")}),(0,a.jsxs)("fieldset",{className:"mb-4 space-y-1.5 text-xs","data-testid":"budget-threshold-choices",children:[(0,a.jsx)("legend",{className:"sr-only",children:"Auto-fallback options"}),(0,a.jsx)(eQ,{id:"switch",label:"Switch to ".concat(f," tier for the rest of this month"),checked:"switch"===x,onSelect:()=>h("switch")}),(0,a.jsx)(eQ,{id:"continue",label:"Continue at current tier (may exceed cap)",checked:"continue"===x,onSelect:()=>h("continue")}),(0,a.jsx)(eQ,{id:"local-only",label:"Use local-only models (cost = $0)",checked:"local-only"===x,onSelect:()=>h("local-only")})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"sm",onClick:u,"data-testid":"budget-threshold-adjust-cap",children:"Adjust cap"}),(0,a.jsx)(i.$,{ref:p,type:"button",size:"sm",onClick:()=>c(x,d),"data-testid":"budget-threshold-apply",className:b?"bg-rose-600 text-white hover:bg-rose-700":"bg-amber-600 text-white hover:bg-amber-700",children:"Apply"})]})]})})}function eQ(e){let{id:t,label:s,checked:r,onSelect:n}=e;return(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1 ".concat(r?"bg-zinc-100 dark:bg-zinc-800":"hover:bg-zinc-50 dark:hover:bg-zinc-800/50"),"data-testid":"budget-threshold-choice-".concat(t),children:[(0,a.jsx)("input",{type:"radio",name:"budget-threshold-choice",value:t,checked:r,onChange:n,className:"h-3 w-3"}),(0,a.jsx)("span",{className:"text-zinc-700 dark:text-zinc-200",children:s})]})}function eW(e){var t,s;let{pollMs:l=6e4,onAdjustCap:i}=e,{config:d}=(0,n.Q)(),[c,u]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(!d.baseUrl)return;let e=!1,t=async()=>{let t=await (0,eY.gh)({baseUrl:d.baseUrl,...d.token?{token:d.token}:{}});e||u(t)};if(t(),l<=0)return()=>{e=!0};let s=setInterval(()=>{t()},l);return()=>{e=!0,clearInterval(s)}},[d.baseUrl,d.token,l]);let m=(0,r.useCallback)(async(e,t)=>{if(!c)return;if("continue"===e){(0,eY.s0)(c.monthYYYYMM,"ok"===c.status?"warning":c.status),u({...c,status:"ok"}),o.oR.message("Continuing at current tier — elanous will nag again at next threshold.");return}let s=await (0,eY.iQ)({baseUrl:d.baseUrl,...d.token?{token:d.token}:{}},t);"synced"===s?o.oR.success("Switched STT/LLM/TTS to ".concat(t,".")):"offline"===s?o.oR.error("Daemon offline — change saved locally, will sync when online."):o.oR.error("Budget fallback failed: ".concat(s,".")),(0,eY.s0)(c.monthYYYYMM,"ok"===c.status?"warning":c.status),u({...c,status:"ok"})},[d.baseUrl,d.token,c]),x=(0,r.useCallback)(()=>{c&&((0,eY.s0)(c.monthYYYYMM,"ok"===c.status?"warning":c.status),u({...c,status:"ok"}))},[c]),h=(0,r.useCallback)(()=>{i&&i(),x()},[i,x]);return c&&(0,eY.Vl)(c)?(0,a.jsx)(eB,{status:c.status,percent:null!=(t=c.percent)?t:0,monthlyUsdCap:null!=(s=c.monthlyUsdCap)?s:0,monthSoFarUsd:c.monthSoFarUsd,recommendedFallback:c.recommendedFallback,notifyAtPct:c.notifyAtPct,onApply:(e,t)=>{m(e,t)},onAdjustCap:h,onDismiss:x}):null}let e_={embedding:"RAG retrieval \xb7 similarity. Most users never touch this.",vision:"OCR \xb7 screenshot analysis \xb7 note-from-image."};function eF(){let{config:e}=(0,n.Q)(),t=(0,r.useMemo)(()=>({baseUrl:e.baseUrl,...e.token?{token:e.token}:{}}),[e.baseUrl,e.token]),[s,l]=(0,r.useState)(eo.Ij),[d,o]=(0,r.useState)("idle"),[c,u]=(0,r.useState)("idle");(0,r.useEffect)(()=>{l((0,eo.Ij)());let e=!1;return(async()=>{let s=await (0,ei.ee)(t);!e&&s&&l(s)})(),()=>{e=!0}},[t]);let m=async(e,s)=>{(0,b.cY)("pwa.settings.tier.embedding-vision","selected ".concat(e,"=").concat(s)),"embedding"===e?(o("syncing"),o(await (0,ei.zs)(t,s)),l(e=>({...e,embedding:s}))):(u("syncing"),u(await (0,ei.We)(t,s)),l(e=>({...e,vision:s})))},x=e=>{let t="embedding"===e?(0,eo.ew)(s):(0,eo.lH)(s),r="embedding"===e?!!s.embedding:!!s.vision,n="embedding"===e?d:c;return(0,a.jsxs)("div",{className:"space-y-1.5","data-testid":"embedding-vision-row-".concat(e),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-zinc-500 dark:text-zinc-400",children:"embedding"===e?"Embedding":"Vision"}),(0,a.jsx)("span",{className:"text-[10px] text-zinc-400 dark:text-zinc-500",children:r?"Saved \xb7 ".concat(n):"Smart default"})]}),(0,a.jsx)("p",{className:"text-[11px] text-zinc-500 dark:text-zinc-400",children:e_[e]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:ed.Ql.map(s=>(0,a.jsx)(i.$,{size:"sm",variant:s===t?"default":"outline",onClick:()=>{m(e,s)},"data-testid":"embedding-vision-".concat(e,"-").concat(s),className:"text-[11px]",children:ed.LW[s]},s))})]})};return(0,a.jsxs)("section",{className:"space-y-4 rounded-md border border-border bg-card p-4","data-testid":"embedding-vision-card",children:[(0,a.jsxs)("header",{className:"space-y-1",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Embedding \xb7 Vision tier"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Phase 3 scaffolding — model selection for RAG embedding + image vision. Resolvers wired; call-site integration follows as RAG / vision pipelines come online."})]}),x("embedding"),x("vision")]})}var eV=s(49413);function eK(){let e=(0,N.Qj)(),[t,s]=(0,r.useState)(!1),[n,l]=(0,r.useState)({status:"idle"}),[d,o]=(0,r.useState)({});(0,r.useEffect)(()=>{s(!0)},[]);let c=(0,r.useCallback)(async()=>{if(e){l({status:"loading"});try{let t=await e.getPersonas();l({status:"ok",personas:t.personas}),o({})}catch(e){l({status:"error",message:e.message})}}},[e]);(0,r.useEffect)(()=>{t&&e&&c()},[t,e,c]);let u=(0,r.useCallback)((e,t,s)=>{o(a=>{var r;return{...a,[e]:{personaId:e,draft:s,dirty:s!==(null!=t?t:""),saving:!1,...(null==(r=a[e])?void 0:r.error)?{error:void 0}:{}}}})},[]),m=(0,r.useCallback)(async t=>{if(!e)return;let s=d[t];if(s){o(e=>({...e,[t]:{...s,saving:!0,error:void 0}}));try{let a=await e.patchPersonaDescription(t,s.draft);l(e=>"ok"!==e.status?e:{status:"ok",personas:e.personas.map(e=>e.personaId===t?a.persona:e)}),o(e=>{let{[t]:s,...a}=e;return a})}catch(e){o(a=>({...a,[t]:{...s,saving:!1,error:e.message}}))}}},[e,d]);return t&&e?(0,a.jsxs)("section",{id:"personas","data-testid":"persona-card",className:"space-y-3 rounded border border-border bg-card p-4",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Personas"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"4 인격 yaml file 의 description 편집. 빈 string 으로 저장하면 clear."})]}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:c,disabled:"loading"===n.status,children:"Refresh"})]}),"idle"===n.status||"loading"===n.status?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading personas…"}):null,"error"===n.status?(0,a.jsxs)("p",{className:"text-xs text-destructive",children:["persona 로드 실패: ",n.message]}):null,"ok"===n.status&&0===n.personas.length?(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["~/.elanous/personas/ 에 yaml file 이 없음. yaml seed:"," ",(0,a.jsx)("span",{className:"font-mono",children:"personas/*.yaml"})," 복사 후 refresh."]}):null,"ok"===n.status&&n.personas.length>0?(0,a.jsx)("ul",{className:"flex flex-col gap-3",children:n.personas.map(e=>(0,a.jsx)(eH,{persona:e,edit:d[e.personaId],onDraftChange:u,onSave:m},e.personaId))}):null,(0,a.jsxs)("p",{className:"text-[10px] text-muted-foreground",children:["Note: ⚗ Auto describer 와 orchestrator routing 은"," ",(0,a.jsx)("a",{href:"https://github.com/ElanvitalAI/elanous/blob/main/내부 문서 `RESEARCH-hermes-pr27572-triage-orchestrator-deferred-2026-05-19`",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Hermes PR #27572 research"})," ","채택 시 활성화 예정."]})]}):null}function eH(e){var t,s,r,n;let{persona:l,edit:d,onDraftChange:o,onSave:c}=e,u=null!=(t=l.description)?t:"",m=null!=(s=null==d?void 0:d.draft)?s:u,x=null!=(r=null==d?void 0:d.dirty)&&r,h=null!=(n=null==d?void 0:d.saving)&&n,p=280-m.length<0;return(0,a.jsxs)("li",{className:"flex flex-col gap-2 rounded border border-border bg-background p-3","data-testid":"persona-row-".concat(l.personaId),children:[(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[l.brandColor?(0,a.jsx)("span",{className:"inline-block h-3 w-3 rounded",style:{backgroundColor:l.brandColor},"aria-hidden":!0}):null,(0,a.jsx)("span",{className:"text-sm font-medium",children:l.displayName}),(0,a.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.personaId})]}),l.primaryModel?(0,a.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:l.primaryModel}):null]}),(0,a.jsx)("textarea",{value:m,onChange:e=>o(l.personaId,u,e.target.value),rows:2,maxLength:560,placeholder:"이 persona 가 무엇을 잘 하는지 1-2 문장으로 적어주세요.",disabled:h,"data-testid":"persona-description-".concat(l.personaId),className:(0,eV.cn)("w-full resize-none rounded border border-input bg-transparent px-2.5 py-1.5 text-xs","focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50",p&&"border-destructive")}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("span",{className:(0,eV.cn)("font-mono text-[10px]",p?"text-destructive":"text-muted-foreground"),children:[m.length," / ",280]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(null==d?void 0:d.error)?(0,a.jsx)("span",{className:"text-[10px] text-destructive",children:d.error}):null,(0,a.jsx)(i.$,{size:"sm",onClick:()=>c(l.personaId),disabled:!x||h||p,"data-testid":"persona-save-".concat(l.personaId),children:h?"저장중…":"저장"})]})]})]})}let eq="2026-09-30T11:24:29.919Z",eX="e491ebf";function eG(e){try{return new Date(e).toLocaleString("ko-KR",{timeZone:"Asia/Seoul",year:"2-digit",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}catch(t){return e}}function eJ(){let[e,t]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=!1;return fetch("/v1/health").then(e=>e.ok?e.json():null).then(s=>{!e&&s&&"number"==typeof s.startedAt&&t({startedAt:s.startedAt,sha:"string"==typeof s.daemonSha?s.daemonSha:""})}).catch(()=>{}),()=>{e=!0}},[]);let s=eX&&"unknown"!==eX?eX:"",n=(null==e?void 0:e.sha)&&"unknown"!==e.sha?e.sha:"",l=!!n&&!!s&&n!==s;return(0,a.jsxs)("section",{className:"space-y-3 rounded-2xl border border-border bg-card p-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-base font-semibold",children:"빌드 정보"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"배포 최신 여부 판별 — 새로고침 후 시각/SHA 가 안 바뀌면 옛 캐시."})]}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,a.jsxs)("div",{className:"rounded-xl bg-muted/40 p-3",children:[(0,a.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"PWA 프론트 빌드"}),(0,a.jsxs)("div",{className:"mt-1 font-mono text-sm",children:[eq?eG(eq):"—",s?" \xb7 ".concat(s):""]})]}),(0,a.jsxs)("div",{className:"rounded-xl bg-muted/40 p-3",children:[(0,a.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"데몬(백엔드) 시작"}),(0,a.jsxs)("div",{className:"mt-1 font-mono text-sm ".concat(l?"text-amber-500":""),children:[e?eG(new Date(e.startedAt).toISOString()):"…",n?" \xb7 ".concat(n):""]}),l&&(0,a.jsx)("div",{className:"mt-1 text-[11px] text-amber-500",children:"프론트/데몬 SHA 불일치 — 재빌드\xb7재시작 필요"})]})]})]})}var eZ=s(26253),e0=s(78413);function e1(){let{read:e=e0.fG,write:t=e0.MQ}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[s,n]=(0,r.useState)(!1),[l,i]=(0,r.useState)(!1);(0,r.useEffect)(()=>{n(e(eZ.f4)),i(e(eZ.vm))},[e]);let d=e=>eZ.Ue.filter(t=>t.visibility===e).map(e=>e.label).join(" \xb7 "),o=(e,s,a)=>{a(s),t(e,s)};return(0,a.jsxs)("section",{className:"space-y-3 rounded-2xl border border-border bg-card p-4","aria-label":"메뉴",children:[(0,a.jsx)("h2",{className:"text-base font-semibold",children:"메뉴"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"메뉴에는 주요 탭만 보입니다. Labs(베타)와 숨긴 탭은 이 기기에서만 켤 수 있고, 숨긴 탭도 주소로는 열립니다."}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox","data-elanous-action":"menu-show-labs",checked:s,onChange:e=>o(eZ.f4,e.target.checked,n)}),(0,a.jsxs)("span",{children:["Labs 탭 보기 ",(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",d("labs"),")"]})]})]}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox","data-elanous-action":"menu-show-hidden",checked:l,onChange:e=>o(eZ.vm,e.target.checked,i)}),(0,a.jsxs)("span",{children:["숨긴 탭 보기 ",(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",d("hidden"),")"]})]})]})]})}let e2=["","claude","gemini","grok","codex"];function e5(){var e,t,s,b,f,g;let{config:N,setConfig:k,client:S,sessionId:C}=(0,n.Q)();(0,r.useEffect)(()=>{if("#bearer-token"!==window.location.hash)return;let e=window.setTimeout(()=>{let e=document.getElementById("bearer-token");null==e||e.scrollIntoView({block:"center"}),null==e||e.focus()},50);return()=>window.clearTimeout(e)},[]);let{theme:E,setTheme:z}=(0,l.D)(),[R,T]=(0,r.useState)({status:"idle"}),[D,$]=(0,r.useState)({status:"idle"}),[O,Y]=(0,r.useState)({status:"idle"}),[B,W]=(0,r.useState)(0),[_,K]=(0,r.useState)({status:"idle"}),[H,X]=(0,r.useState)(0),[J,ee]=(0,r.useState)({status:"idle"}),[es,ea]=(0,r.useState)(0),[en,ei]=(0,r.useState)(()=>({supported:!1,permission:"unknown",cachedId:null,cachedLabel:null})),[ed,eo]=(0,r.useState)(!1),[ec,eu]=(0,r.useState)(null);(0,r.useEffect)(()=>{ei(v())},[]);let ex=(0,r.useCallback)(()=>{ei(v())},[]),eh=(0,r.useCallback)(async()=>{eo(!0),eu(null);try{let e=await j({baseUrl:N.baseUrl,...N.token?{token:N.token}:{}});"enabled"===e.status?o.oR.success("Notifications enabled"):"permission-denied"===e.status?o.oR.error("Permission denied — enable in browser/iOS settings"):"unsupported"===e.status?o.oR.error("Push not supported: ".concat(e.reason)):(eu(e.reason),o.oR.error("Enable failed: ".concat(e.reason)))}finally{eo(!1),ex()}},[N.baseUrl,N.token,ex]),eb=(0,r.useCallback)(async()=>{eo(!0);try{await y({baseUrl:N.baseUrl,...N.token?{token:N.token}:{}}),o.oR.success("Notifications disabled")}finally{eo(!1),ex()}},[N.baseUrl,N.token,ex]),eg=(0,r.useCallback)(async()=>{if(N.baseUrl)try{var e,t;let s=await fetch("".concat(N.baseUrl.replace(/\/$/,""),"/v1/push/test"),{method:"POST",...N.token?{headers:{authorization:"Bearer ".concat(N.token)}}:{}});if(!s.ok)return void o.oR.error("Test failed: HTTP ".concat(s.status));let a=await s.json();o.oR.success("Test sent: ".concat(null!=(e=a.delivered)?e:0," / ").concat(null!=(t=a.attempted)?t:0," delivered"))}catch(e){o.oR.error("Test failed: ".concat(e instanceof Error?e.message:String(e)))}},[N.baseUrl,N.token]),[ev,ej]=(0,r.useState)(""),[ey,eN]=(0,r.useState)(""),[ek,ew]=(0,r.useState)(""),[eS,eU]=(0,r.useState)(null),[eA,eM]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(!N.baseUrl)return void T({status:"idle"});let e=!1,t=new AbortController,s=Date.now();return T({status:"loading"}),(async()=>{try{let a=await fetch("".concat(N.baseUrl.replace(/\/$/,""),"/v1/health"),{signal:t.signal});if(e)return;let r=Date.now()-s;if(!a.ok)return void T({status:"error",error:"HTTP ".concat(a.status),latencyMs:r,checkedAt:Date.now()});let n=await a.json();T({status:n.ok?"ok":"error",..."number"==typeof n.sessions?{sessions:n.sessions}:{},latencyMs:r,checkedAt:Date.now(),...n.ok?{}:{error:"health.ok=false"}})}catch(t){if(e)return;T({status:"error",error:t instanceof Error?t.message:String(t),latencyMs:Date.now()-s,checkedAt:Date.now()})}})(),()=>{e=!0,t.abort()}},[N.baseUrl]),(0,r.useEffect)(()=>{if("ok"!==R.status||!N.baseUrl)return void $({status:"idle"});let e=!1,t=new AbortController;return $({status:"loading"}),(async()=>{try{var s,a;let r=await fetch("".concat(N.baseUrl.replace(/\/$/,""),"/v1/tools"),{signal:t.signal,credentials:"same-origin",mode:"same-origin",...N.token?{headers:{authorization:"Bearer ".concat(N.token)}}:{}});if(e)return;if(!r.ok)return void $({status:"error",error:"HTTP ".concat(r.status)});let n=await r.json(),l=(null!=(s=n.specs)?s:[]).map(e=>{var t;return"string"==typeof e?{name:e,description:""}:{name:e.name,description:null!=(t=e.description)?t:""}});$({status:"ok",kind:null!=(a=n.kind)?a:"none",specs:l})}catch(t){if(e)return;$({status:"error",error:t instanceof Error?t.message:String(t)})}})(),()=>{e=!0,t.abort()}},[R.status,R.checkedAt,N.baseUrl,N.token]),(0,r.useEffect)(()=>{if("ok"!==R.status||!N.baseUrl)return void Y({status:"idle"});let e=!1,t=new AbortController;return Y({status:"loading"}),(async()=>{try{var s;let a=await fetch("".concat(N.baseUrl.replace(/\/$/,""),"/v1/diag/auth-trace"),{signal:t.signal,credentials:"same-origin",mode:"same-origin",...N.token?{headers:{authorization:"Bearer ".concat(N.token)}}:{}});if(e)return;if(!a.ok)return void Y({status:"error",error:"HTTP ".concat(a.status)});let r=await a.json();Y({status:"ok",entries:null!=(s=r.entries)?s:[],fetchedAt:Date.now()})}catch(t){if(e)return;Y({status:"error",error:t instanceof Error?t.message:String(t)})}})(),()=>{e=!0,t.abort()}},[R.status,R.checkedAt,N.baseUrl,N.token,B]),(0,r.useEffect)(()=>{if("ok"!==R.status||!N.baseUrl||!C)return void K({status:"idle"});let e=!1,t=null,s=new AbortController;return K({status:"loading"}),(async()=>{try{let a="".concat(N.baseUrl.replace(/\/$/,""),"/v1/turns/last/screenshot?session=").concat(encodeURIComponent(C)),r=await fetch(a,{signal:s.signal,...N.token?{headers:{authorization:"Bearer ".concat(N.token)}}:{}});if(e)return;if(404===r.status)return void K({status:"none",fetchedAt:Date.now()});if(!r.ok)return void K({status:"error",error:"HTTP ".concat(r.status)});let n=await r.blob();if(e)return;t=URL.createObjectURL(n),K({status:"ok",objectUrl:t,fetchedAt:Date.now()})}catch(t){if(e)return;K({status:"error",error:t instanceof Error?t.message:String(t)})}})(),()=>{e=!0,s.abort(),t&&URL.revokeObjectURL(t)}},[R.status,N.baseUrl,N.token,C,H]),(0,r.useEffect)(()=>{if("ok"!==R.status||!N.baseUrl)return void ee({status:"idle"});let e=!1;return ee(e=>({...e,status:"loading"})),(async()=>{try{let t=await x(S);if(e)return;ee(e=>({status:"ok",bindings:t.bindings,...e.secretRef?{secretRef:e.secretRef}:{},...e.pendingSecretValue?{pendingSecretValue:e.pendingSecretValue}:{}}))}catch(s){if(e)return;let t=s instanceof Error?s.message:String(s);t.includes("404")||t.includes("Not Found")?ee({status:"nexus-missing"}):ee({status:"error",error:t})}})(),()=>{e=!0}},[S,R.status,N.baseUrl,es]);let eE=(0,r.useCallback)(()=>{ea(e=>e+1)},[]),eP=(0,r.useCallback)(async()=>{eM(!0);try{let e=function(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}(),t=await m(S,e);ee(s=>({...s,secretRef:t.ref,pendingSecretValue:e})),o.oR.success("Pushcut secret rotated \xb7 copy + paste into iPhone Shortcut")}catch(t){let e=t instanceof Error?t.message:String(t);o.oR.error("secret rotate failed: ".concat(e))}finally{eM(!1)}},[S]),eL=(0,r.useCallback)(async()=>{if(!ev.trim())return void o.oR.error("token required");let e=ey.trim()||C;if(!e)return void o.oR.error("sessionId required (auto-fill: open this session in /term first)");eU("__new__");try{await h(S,{token:ev.trim(),sessionId:e,...ek.trim()?{label:ek.trim()}:{}}),o.oR.success("binding saved"),ej(""),eN(""),ew(""),eE()}catch(e){o.oR.error("binding save failed: ".concat(e instanceof Error?e.message:String(e)))}finally{eU(null)}},[S,ev,ey,ek,C,eE]),eI=(0,r.useCallback)(async e=>{eU(e);try{await p(S,e),o.oR.success("binding deleted: ".concat(e.slice(0,8),"…")),eE()}catch(e){o.oR.error("delete failed: ".concat(e instanceof Error?e.message:String(e)))}finally{eU(null)}},[S,eE]),eR=e=>"number"!=typeof e?"—":"".concat(e," ms"),eT=e=>{if(!e)return"";let t=Math.floor((Date.now()-e)/1e3);return t<5?"just now":t<60?"".concat(t,"s ago"):"".concat(Math.floor(t/60),"m ago")};return(0,a.jsxs)("div",{className:"mx-auto max-w-2xl space-y-8 p-6",children:[(0,a.jsx)(eW,{}),(0,a.jsxs)("header",{className:"space-y-1",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Settings"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Daemon connection, provider default, theme. Stored in localStorage."})]}),(0,a.jsx)(P,{}),(0,a.jsx)(w,{}),(0,a.jsx)(U.Q,{}),(0,a.jsx)(A.lN,{}),(0,a.jsx)(M.Q,{}),(0,a.jsx)("div",{id:"channels",className:"scroll-mt-8","aria-hidden":!0}),(0,a.jsx)(Q,{}),(0,a.jsx)(F.W,{}),(0,a.jsx)("div",{id:"advanced",className:"scroll-mt-8","aria-hidden":!0}),(0,a.jsx)(eO,{}),(0,a.jsx)(er,{}),(0,a.jsx)(V,{}),(0,a.jsx)(G,{}),(0,a.jsx)(q,{}),(0,a.jsx)(Z,{}),(0,a.jsx)(et,{}),(0,a.jsx)("div",{id:"voice",className:"scroll-mt-8","aria-hidden":!0}),(0,a.jsx)(el,{}),(0,a.jsx)(ez,{}),(0,a.jsx)(em,{}),(0,a.jsx)(ep,{}),(0,a.jsx)(ef,{}),(0,a.jsx)(eC,{}),(0,a.jsx)(eF,{}),(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Daemon"}),(0,a.jsxs)("label",{className:"block space-y-1",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Base URL"}),(0,a.jsx)(d.p,{value:N.baseUrl,placeholder:"http://localhost:31415",onChange:e=>k({baseUrl:e.target.value})})]}),(0,a.jsxs)("label",{className:"block space-y-1",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Bearer token"}),(0,a.jsx)(d.p,{id:"bearer-token",type:"password",value:N.token,placeholder:"(optional)",onChange:e=>k({token:e.target.value})})]}),(0,a.jsxs)("label",{className:"block space-y-1",children:[(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Default provider"}),(0,a.jsx)("select",{value:N.provider,className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-xs focus:outline-none focus:ring-2 focus:ring-ring",onChange:e=>k({provider:e.target.value}),children:e2.map(e=>(0,a.jsx)("option",{value:e,children:e||"(none — server default)"},e))})]})]}),(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Daemon health"}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>{k({baseUrl:N.baseUrl})},disabled:!N.baseUrl,children:"Recheck"})]}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs",children:["idle"===R.status&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"Set Base URL above to probe."}),"loading"===R.status&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"Probing…"}),"ok"===R.status&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block h-2 w-2 rounded-full bg-emerald-500","aria-hidden":!0}),(0,a.jsx)("span",{className:"font-medium text-foreground",children:"Reachable"}),(0,a.jsx)("span",{className:"text-muted-foreground",children:eR(R.latencyMs)}),(0,a.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:eT(R.checkedAt)})]}),"number"==typeof R.sessions&&(0,a.jsxs)("p",{className:"text-muted-foreground",children:["Active sessions: ",(0,a.jsx)("span",{className:"font-mono text-foreground",children:R.sessions})]})]}),"error"===R.status&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block h-2 w-2 rounded-full bg-rose-500","aria-hidden":!0}),(0,a.jsx)("span",{className:"font-medium text-rose-600 dark:text-rose-400",children:"Unreachable"}),(0,a.jsx)("span",{className:"text-muted-foreground",children:eR(R.latencyMs)}),(0,a.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:eT(R.checkedAt)})]}),(0,a.jsx)("p",{className:"break-all font-mono text-[11px] text-muted-foreground",children:R.error}),(0,a.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["Verify Base URL \xb7 daemon running (",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"elanous serve --status"}),") \xb7 network reachable from this device."]})]})]})]}),(0,a.jsx)("div",{id:"tools",className:"scroll-mt-8","aria-hidden":!0}),("ok"===D.status||"error"===D.status)&&(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"LLM tool surface"}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs",children:["ok"===D.status&&"none"===D.kind&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"Tools 미설정 — `elanous serve --tools readonly` 또는 `webterm` 으로 활성화."}),"ok"===D.status&&D.kind&&"none"!==D.kind&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block h-2 w-2 rounded-full ".concat("webterm"===D.kind?"bg-amber-500":"bg-emerald-500"),"aria-hidden":!0}),(0,a.jsx)("span",{className:"font-medium text-foreground",children:"kind:"}),(0,a.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono",children:D.kind}),"webterm"===D.kind&&(0,a.jsx)("span",{className:"text-[10px] text-amber-600 dark:text-amber-400",children:"(write-capable)"})]}),D.specs&&D.specs.length>0&&(0,a.jsx)("ul",{className:"flex flex-wrap gap-1",children:D.specs.map(e=>(0,a.jsx)("li",{title:e.description,className:"rounded border border-border bg-muted/50 px-1.5 py-0.5 font-mono text-[10px]",children:e.name},e.name))})]}),"error"===D.status&&(0,a.jsxs)("p",{className:"text-muted-foreground",children:[(0,a.jsx)("span",{className:"text-rose-500",children:"tool surface 조회 실패"})," \xb7 ",D.error]})]})]}),("ok"===O.status||"error"===O.status)&&(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Auth trace"}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>W(e=>e+1),children:"Refresh"})]}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs",children:["error"===O.status&&(0,a.jsxs)("p",{className:"text-muted-foreground",children:[(0,a.jsx)("span",{className:"text-rose-500",children:"auth-trace 조회 실패"})," \xb7 ",O.error]}),"ok"===O.status&&(null!=(b=null==(e=O.entries)?void 0:e.length)?b:0)===0&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"아직 auth 결정 없음. /v1/* 호출이 한 번도 없었다는 뜻."}),"ok"===O.status&&O.entries&&O.entries.length>0&&(0,a.jsx)("div",{className:"max-h-64 overflow-auto font-mono text-[10px]",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{className:"sticky top-0 bg-card text-muted-foreground",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-1 text-left",children:"time"}),(0,a.jsx)("th",{className:"px-1 text-left",children:"path"}),(0,a.jsx)("th",{className:"px-1 text-left",children:"ok"}),(0,a.jsx)("th",{className:"px-1 text-left",children:"reason"}),(0,a.jsx)("th",{className:"px-1 text-left",children:"sfs"}),(0,a.jsx)("th",{className:"px-1 text-left",children:"origin"}),(0,a.jsx)("th",{className:"px-1 text-left",children:"host"})]})}),(0,a.jsx)("tbody",{children:O.entries.slice().reverse().slice(0,30).map((e,t)=>{var s,r,n;return(0,a.jsxs)("tr",{className:"border-t border-border/50",children:[(0,a.jsx)("td",{className:"px-1 whitespace-nowrap",children:new Date(e.ts).toLocaleTimeString()}),(0,a.jsx)("td",{className:"px-1 truncate max-w-[120px]",children:e.path}),(0,a.jsx)("td",{className:"px-1 ".concat(e.ok?"text-emerald-500":"text-rose-500"),children:e.ok?"Y":"N"}),(0,a.jsx)("td",{className:"px-1 truncate max-w-[140px]",children:e.reason}),(0,a.jsx)("td",{className:"px-1 truncate max-w-[80px]",children:null!=(s=e.sfs)?s:"∅"}),(0,a.jsx)("td",{className:"px-1 truncate max-w-[140px]",children:null!=(r=e.origin)?r:"∅"}),(0,a.jsx)("td",{className:"px-1 truncate max-w-[140px]",children:null!=(n=e.host)?n:"∅"})]},"".concat(e.ts,"-").concat(t))})})]})})]})]}),C&&"webterm"===D.kind&&(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Last screenshot"}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>X(e=>e+1),disabled:"loading"===_.status||!N.baseUrl,children:"Refresh"})]}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs",children:["loading"===_.status&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"Probing…"}),"none"===_.status&&(0,a.jsxs)("p",{className:"text-muted-foreground",children:["아직 agent 가 screenshot 을 호출한 적 없음. ",(0,a.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5",children:"WebTerminalScreenshot"})," tool 실행 후 Refresh."]}),"ok"===_.status&&_.objectUrl&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("p",{className:"text-muted-foreground",children:["Most recent ",(0,a.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5",children:"tool_result"})," image in this session."]}),(0,a.jsx)("img",{src:_.objectUrl,alt:"Last screenshot",className:"max-w-full rounded border border-border bg-black"})]}),"error"===_.status&&(0,a.jsxs)("p",{className:"text-muted-foreground",children:[(0,a.jsx)("span",{className:"text-rose-500",children:"screenshot 조회 실패"})," \xb7 ",_.error]})]})]}),("idle"!==J.status||"ok"===R.status)&&(0,a.jsxs)("section",{className:"space-y-3","data-testid":"pushcut-section",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Pushcut webhook"}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:eE,disabled:"loading"===J.status||!N.baseUrl,"data-testid":"pushcut-refresh",children:"Refresh"})]}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs space-y-3",children:["loading"===J.status&&(0,a.jsx)("p",{className:"text-muted-foreground",children:"Probing…"}),"nexus-missing"===J.status&&(0,a.jsxs)("p",{className:"text-muted-foreground",children:["NEXUS endpoints not reachable. ",(0,a.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5",children:"elanous nexus"})," 로 띄우면 secret + binding 관리가 활성됩니다.",(0,a.jsxs)("span",{className:"block mt-1 text-[10px]",children:["(현재 daemon 만 단독 실행 중인 경우 — 본 섹션은 NEXUS HTTP 의 ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"/v1/registry/bindings"})," + ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"/v1/config/secrets"})," 의존)"]})]}),"error"===J.status&&(0,a.jsxs)("p",{className:"text-muted-foreground",children:[(0,a.jsx)("span",{className:"text-rose-500",children:"조회 실패"})," \xb7 ",J.error]}),("ok"===J.status||J.secretRef)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-medium",children:"HMAC secret"}),(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>{eP()},disabled:eA||!N.baseUrl,"data-testid":"pushcut-rotate-secret",children:eA?"Rotating…":"Rotate"})]}),J.secretRef&&(0,a.jsxs)("p",{className:"font-mono text-[10px] text-muted-foreground",children:["ref: ",(0,a.jsx)("span",{className:"text-foreground",children:J.secretRef})," \xb7 id: ",(0,a.jsx)("span",{className:"text-foreground",children:c})]}),J.pendingSecretValue&&(0,a.jsxs)("div",{className:"rounded border border-amber-300 bg-amber-50 px-2 py-1.5 dark:border-amber-700 dark:bg-amber-950",children:[(0,a.jsx)("p",{className:"text-[10px] font-semibold text-amber-700 dark:text-amber-200",children:"Copy now — only shown once"}),(0,a.jsx)("code",{className:"block break-all font-mono text-[11px] text-amber-900 dark:text-amber-100 select-all","data-testid":"pushcut-secret-value",children:J.pendingSecretValue}),(0,a.jsxs)("p",{className:"mt-1 text-[10px] text-amber-700 dark:text-amber-300",children:["Paste into iPhone “elanous-camera” Pushcut Shortcut Header ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:"X-Pushcut-Sig"})," recipe."]})]})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"font-medium",children:"Bindings (token → session)"}),(0,a.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[null!=(f=null==(t=J.bindings)?void 0:t.length)?f:0," active"]})]}),(null!=(g=null==(s=J.bindings)?void 0:s.length)?g:0)===0&&"ok"===J.status&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"No bindings yet. Add one below — the daemon will route Pushcut webhooks for that token to the chosen session."}),J.bindings&&J.bindings.length>0&&(0,a.jsx)("ul",{className:"space-y-1","data-testid":"pushcut-bindings-list",children:J.bindings.map(e=>{var t,s;return(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded border border-border bg-muted/30 px-2 py-1",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-0.5",children:[(0,a.jsx)("div",{className:"font-mono text-[11px] font-medium truncate",children:null!=(t=e.label)?t:"(no label)"}),(0,a.jsxs)("div",{className:"font-mono text-[10px] text-muted-foreground truncate",children:["token: ",e.key.length>16?"".concat(e.key.slice(0,8),"…").concat(e.key.slice(-4)):e.key]}),(0,a.jsxs)("div",{className:"font-mono text-[10px] text-muted-foreground truncate",children:["session: ",null!=(s=e.sessionId)?s:"(unset)"]})]}),(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>{eI(e.key)},disabled:eS===e.key,"data-testid":"pushcut-delete-".concat(e.key),children:eS===e.key?"Deleting…":"Delete"})]},e.key)})}),(0,a.jsxs)("div",{className:"space-y-1.5 rounded border border-dashed border-border p-2 mt-2",children:[(0,a.jsx)("p",{className:"text-[10px] font-medium text-muted-foreground",children:"Add binding"}),(0,a.jsx)(d.p,{value:ev,placeholder:"token (webhook URL key)",onChange:e=>ej(e.target.value),"data-testid":"pushcut-add-token",className:"text-[11px]"}),(0,a.jsx)(d.p,{value:ey,placeholder:C?"sessionId (default: ".concat(C.slice(0,12),"…)"):"sessionId",onChange:e=>eN(e.target.value),"data-testid":"pushcut-add-session",className:"text-[11px]"}),(0,a.jsx)(d.p,{value:ek,placeholder:"label (e.g. iPhone 15)",onChange:e=>ew(e.target.value),"data-testid":"pushcut-add-label",className:"text-[11px]"}),(0,a.jsx)(i.$,{size:"sm",onClick:()=>{eL()},disabled:"__new__"===eS||!ev.trim(),"data-testid":"pushcut-add-submit",children:"__new__"===eS?"Saving…":"Add"})]})]})]})]}),(0,a.jsxs)("p",{className:"text-[10px] text-muted-foreground",children:["Channel: ",(0,a.jsx)("code",{className:"rounded bg-muted px-1",children:u})," \xb7 powered by NEXUS subsystem registry (PR τ #1698) + secret backend (PR σ #1696). Webhook receiver lands in a follow-up daemon-side PR."]})]}),(0,a.jsx)("div",{id:"ios",className:"scroll-mt-8","aria-hidden":!0}),en.supported&&(0,a.jsxs)("section",{className:"space-y-3","data-testid":"webpush-section",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Notifications"}),(0,a.jsxs)("div",{className:"rounded-md border border-border bg-card p-3 text-xs space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block h-2 w-2 rounded-full ".concat(en.cachedId?"bg-emerald-500":"denied"===en.permission?"bg-rose-500":"bg-muted-foreground"),"aria-hidden":!0}),(0,a.jsx)("span",{className:"font-medium",children:en.cachedId?"Subscribed":"denied"===en.permission?"Permission denied":"Not subscribed"}),en.cachedLabel&&(0,a.jsx)("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground",children:en.cachedLabel})]}),"denied"===en.permission&&(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground",children:"Browser/iOS denied notification permission. Enable in Settings → Safari → Notifications, then reload."}),ec&&(0,a.jsx)("p",{className:"text-[10px] text-rose-500 break-all","data-testid":"webpush-error",children:ec}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[!en.cachedId&&(0,a.jsx)(i.$,{size:"sm",onClick:()=>{eh()},disabled:ed||!N.baseUrl||"denied"===en.permission,"data-testid":"webpush-enable",children:ed?"Enabling…":"Enable notifications"}),en.cachedId&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>{eb()},disabled:ed,"data-testid":"webpush-disable",children:ed?"Disabling…":"Disable"}),(0,a.jsx)(i.$,{size:"sm",variant:"outline",onClick:()=>{eg()},disabled:ed||!N.baseUrl,"data-testid":"webpush-test",children:"Send test"})]})]}),(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground",children:"Push 알림은 PWA 가 닫혀 있어도 도착합니다 — agent turn 완료 \xb7 녹화 종료 등. iOS 16.4+ home-screen installed PWA 만 작동 (Pushcut 가 fallback)."})]})]}),(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Session"}),(0,a.jsx)("div",{className:"rounded-md border border-border bg-card px-3 py-2 font-mono text-xs",children:C||"(no session yet)"}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["A new session id is allocated on first load. Use Chat’s",(0,a.jsx)("code",{className:"mx-1 rounded bg-muted px-1.5 py-0.5",children:":fork"}),"meta-command to start fresh once U-3 ships."]})]}),(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Theme"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.z.map(e=>(0,a.jsx)(i.$,{variant:e===E?"default":"outline",size:"sm",onClick:()=>z(e),children:e},e))})]}),(0,a.jsx)(eK,{}),(0,a.jsx)(L,{}),(0,a.jsx)(I,{}),(0,a.jsx)(e1,{}),(0,a.jsx)(eJ,{}),(0,a.jsx)(i.$,{onClick:()=>o.oR.success("Settings saved"),children:"Saved"})]})}},8666:(e,t,s)=>{s.d(t,{AF:()=>a});let a={all:["nexus"],health:()=>[...a.all,"health"],snapshot:()=>[...a.all,"snapshot"],tabs:e=>e?[...a.all,"tabs",{kind:e}]:[...a.all,"tabs"],tab:e=>[...a.all,"tab",e],templates:()=>[...a.all,"templates"],template:e=>[...a.all,"template",e],config:()=>[...a.all,"config"],switches:()=>[...a.all,"switches"],switch:e=>[...a.all,"switch",e],secrets:()=>[...a.all,"secrets"],bindingChannels:()=>[...a.all,"bindings","channels"],bindings:e=>[...a.all,"bindings",e],binding:(e,t)=>[...a.all,"binding",e,t],logsTail:(e,t)=>t?[...a.all,"logs",e,{lines:t}]:[...a.all,"logs",e],workflows:()=>[...a.all,"workflows"],workflow:e=>[...a.all,"workflow",e],workflowRun:e=>[...a.all,"workflow-run",e],workflowRuns:()=>[...a.all,"workflow-runs"],pendingApprovals:()=>[...a.all,"workflow-pending-approvals"],platforms:()=>[...a.all,"platforms"],providers:()=>[...a.all,"providers"],worktrees:()=>[...a.all,"worktrees"],designCheck:()=>[...a.all,"design-check"],designPreviews:()=>[...a.all,"design-previews"],designPreview:e=>[...a.all,"design-preview",e],registryCatalog:()=>[...a.all,"registry-catalog"],resolvedView:()=>[...a.all,"resolved-view"]};a.snapshot(),a.tabs(),a.health(),a.snapshot(),a.config(),a.switches()},19961:(e,t,s)=>{s.d(t,{X:()=>i});var a=s(77947);let r=null,n=[],l=[];function i(e){let[t,s]=(0,a.useState)(()=>r&&Date.now()-r.at<3e5?r.providers:n),[i,d]=(0,a.useState)(()=>r&&Date.now()-r.at<3e5?r.models:l),[o,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(null),x=(0,a.useCallback)(async()=>{c(!0),m(null);try{let t=await e.getRegistryCatalog(),a=t.providers.map(e=>({id:e.id,displayName:e.displayName,aliases:e.aliases,modelPrefixes:e.modelPrefixes,apiKeyEnv:e.apiKeyEnv,endpointPattern:e.endpointPattern,capabilities:e.capabilities,builtIn:e.builtIn})),n=t.models.map(e=>({id:e.id,provider:e.provider,displayName:e.displayName,...void 0!==e.family?{family:e.family}:{},...void 0!==e.familyShortcut?{familyShortcut:e.familyShortcut}:{},...void 0!==e.contextSize?{contextSize:e.contextSize}:{},...void 0!==e.outputMaxTokens?{outputMaxTokens:e.outputMaxTokens}:{},...void 0!==e.vision?{vision:e.vision}:{},...void 0!==e.reasoning?{reasoning:e.reasoning}:{},...void 0!==e.toolCalling?{toolCalling:e.toolCalling}:{},...void 0!==e.pricing?{pricing:e.pricing}:{},...void 0!==e.deprecated?{deprecated:e.deprecated}:{},...void 0!==e.releaseDate?{releaseDate:e.releaseDate}:{},...void 0!==e.kind?{kind:e.kind}:{}}));r={at:Date.now(),providers:a,models:n},s(a),d(n)}catch(e){m(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e]);(0,a.useEffect)(()=>{if(r&&Date.now()-r.at<3e5){s(r.providers),d(r.models);return}x()},[x]);let h=(0,a.useCallback)(async()=>{r=null,await x()},[x]),p=(0,a.useMemo)(()=>t.map(e=>e.id),[t]),b=(0,a.useMemo)(()=>{let e=new Map;for(let t of i){let s=e.get(t.provider);s?s.push(t):e.set(t.provider,[t])}return t=>{var s;return t?null!=(s=e.get(t))?s:[]:i}},[i]);return{providers:t,providerIds:p,models:i,modelsByProvider:b,loading:o,error:u,reload:h}}},26253:(e,t,s)=>{s.d(t,{vm:()=>U,f4:()=>C,OE:()=>A,Ue:()=>M,Ye:()=>S});var a=s(58002),r=s(8917),n=s(55396),l=s(52978),i=s(32531),d=s(28817),o=s(99888),c=s(69495),u=s(69636),m=s(11284),x=s(85627),h=s(23321),p=s(83528),b=s(69427),f=s(21625),g=s(36501),v=s(46729),j=s(19875),y=s(95711),N=s(13581),k=s(73816),w=s(33499);function S(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"owner",a=e=>{var t;return null!=(t=e.visibility)?t:"public"},r=e.filter(e=>(0,w.EX)(s,e.href));return{main:r.filter(e=>"public"===a(e)),labs:t.showLabs?r.filter(e=>"labs"===a(e)):[],hidden:t.showHidden?r.filter(e=>"hidden"===a(e)):[]}}let C="elanous.nav.showLabs",U="elanous.nav.showHidden",A=[{href:"/share",category:"system-share-target",reason:"운영체제가 공유 동작으로 호출하는 Share Target 진입점."},{href:"/missions",category:"dynamic-route-parent",reason:"`[id]`를 받는 동적 주소이며 부모 경로 자체는 없다."},{href:"/setup",category:"provider-onboarding",reason:"LLM provider 온보딩 진입점."},{href:"/setup/done",category:"provider-onboarding-complete",reason:"LLM provider 온보딩 완료 화면."},{href:"/settings/devices",category:"settings-subpage",reason:"Settings 아래 Device fleet 하위 화면."},{href:"/workflows",category:"workflow-legacy-redirect",reason:"기존 워크플로 링크를 /editor?mode=workflow 로 전달한다."},{href:"/workflows/chat-ui",category:"workflow-subflow",reason:"Workflows에서 여는 hosted chat 하위 흐름."},{href:"/",category:"root-welcome",reason:"첫 방문자를 위한 루트 welcome 화면."},{href:"/404",category:"error-page",reason:"오류 페이지."},{href:"/morning",category:"unwired-screen",reason:"부르는 백엔드가 아직 없는 미배선 화면."},{href:"/botlab",category:"diagnostic-readonly",reason:"봇 화면 \xab벽\xbb을 한 자리에서 보는 읽기 진단 화면(#15390 \xb7 봇 운영자용)."}],M=[{href:"/term",label:"Terminal",hint:"터미널 + agent dock",icon:a.A,kind:"term"},{href:"/chat",label:"Chat",hint:"채팅 (스트리밍 \xb7 multimodal \xb7 mic)",icon:r.A,kind:"chat"},{href:"/intake",label:"Intake",hint:"넣으면 흡수 \xb7 작업 \xb7 그래프로 (URL \xb7 미션 \xb7 메모)",icon:n.A,kind:null},{href:"/approvals",label:"Approvals",hint:"아이디어 PR 요약 \xb7 승인하고 머지",icon:l.A,kind:null},{href:"/showroom",label:"Showroom",hint:"multi-agent 동시 비교 (broadcast \xb7 CV-3)",icon:i.A,kind:null,visibility:"labs"},{href:"/live",label:"Live",hint:"런이 판단\xb7기획하는 신호 (진짜 수 \xb7 쇼 모드)",icon:d.A,kind:null},{href:"/trace",label:"Trace",hint:"렌즈를 좁혀 런을 따라간다 (플릿 → 런 → 판단)",icon:o.A,kind:null},{href:"/bots",label:"Bots",hint:"봇 신원 + 공통 명령 카탈로그 (읽기 전용)",icon:c.A,kind:null,visibility:"hidden"},{href:"/observatory",label:"Observatory",hint:"subject 관측 (talk \xb7 screen \xb7 agent)",icon:u.A,kind:null,visibility:"hidden"},{href:"/autopilot",label:"Missions",hint:"미션 \xb7 작업 (미션 계보\xb7골 던지기\xb7작업 보드\xb7자율행동)",icon:m.A,kind:null,activeAlso:["/tasks","/missions"]},{href:"/tasks",label:"Tasks",hint:"작업 보드 (Missions 안 ② 작업)",icon:x.A,kind:"tasks",visibility:"hidden"},{href:"/board",label:"보드",hint:"태스크 카드 흐름 (스튜어드 → 실행 → 착지 → 릴리스)",icon:x.A,kind:null,visibility:"labs"},{href:"/design-check",label:"Design",hint:"디자인 시스템 고르기 \xb7 시안 \xb7 URL 로 내 시스템",icon:h.A,kind:null},{href:"/vault",label:"Vault",hint:"Obsidian 노트 (브라우저\xb7에디터\xb7검색\xb7그래프)",icon:p.A,kind:null},{href:"/market",label:"마켓",hint:"플러그인 찾아보기 \xb7 상세 \xb7 설치됨",icon:b.A,kind:null},{href:"/scheduler",label:"Schedules",hint:"예약 잡 종합 현황 (크론\xb7데몬\xb7launchd)",icon:f.A,kind:null},{href:"/sessions",label:"Sessions",hint:"세션 카드 데크 (스와이프 결정)",icon:g.A,kind:null,visibility:"hidden"},{href:"/reflection",label:"Reflection",hint:"오늘의 회고 (5분 갱신)",icon:v.A,kind:null,visibility:"hidden"},{href:"/editor",label:"편집기",hint:"워크플로 \xb7 실행 그래프 작성\xb7편집",icon:j.A,kind:null,visibility:"labs",activeAlso:["/workflows"]},{href:"/worktrees",label:"Worktrees",hint:"격리 작업 트리 목록\xb7상태",icon:j.A,kind:null,visibility:"hidden"},{href:"/control",label:"Control",hint:"데몬 제어 패널",icon:y.A,kind:"control",visibility:"hidden"},{href:"/settings",label:"Settings",hint:"환경 + provider + theme",icon:N.A,kind:"settings"},{href:"/workspace",label:"Workspace",hint:"여러 탭 동시 보기",icon:k.A,kind:null,visibility:"labs"}]},26958:(e,t,s)=>{s.d(t,{W:()=>o});var a=s(58443),r=s(77947),n=s(19990),l=s(65534),i=s(62866);let d=["telegram","discord"];function o(){let{client:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,i.Qj)(),s=null!=e?e:t,[o,c]=(0,r.useState)([]),[u,m]=(0,r.useState)({}),[x,h]=(0,r.useState)({}),[p,b]=(0,r.useState)({}),[f,g]=(0,r.useState)(null),[v,j]=(0,r.useState)({}),[y,N]=(0,r.useState)("");(0,r.useEffect)(()=>{if(!s)return;let e=!1;return s.getChannelBots().then(t=>{let{platforms:s}=t;e||(c(s),h(e=>{let t={...e};for(let e of s)Object.hasOwn(t,e.platform)||(t[e.platform]=e.allowedUsers.join(", "));return t}))}).catch(()=>{e||N("봇 상태를 불러오지 못했습니다.")}),()=>{e=!0}},[s]);let k=async e=>{var t;if(!s)return;g(e),N("");let a=null==(t=u[e])?void 0:t.trim(),r=Object.hasOwn(x,e)?x[e].split(",").map(e=>e.trim()).filter(Boolean):void 0;m(t=>({...t,[e]:""}));try{let t=await s.setChannelBot({platform:e,...a?{token:a}:{},...void 0!==r?{allowedUsers:r}:{}});t.botName&&b(s=>({...s,[e]:t.botName})),j(s=>({...s,[e]:t.restartNeeded}));try{let e=await s.getChannelBots();c(e.platforms)}catch(e){N("저장됐지만 봇 상태를 다시 불러오지 못했습니다.")}}catch(t){N("".concat(e," 저장에 실패했습니다. 토큰과 허용 사용자 ID를 확인하세요."))}finally{g(null)}};return s?(0,a.jsxs)("section",{className:"space-y-4 rounded border border-border bg-card p-4","data-testid":"channel-bot-setup-card",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"봇 연결"}),d.map(e=>{var t,s;let r=o.find(t=>t.platform===e);return(0,a.jsxs)("div",{className:"space-y-2 border-t border-border pt-3",children:[(0,a.jsx)("h3",{className:"text-sm font-medium capitalize",children:e}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:(null==r?void 0:r.configured)?"연결됨 (".concat(r.source,")"):"미연결"}),p[e]&&(0,a.jsxs)("p",{className:"text-xs",children:["봇 이름: ",p[e]]}),(0,a.jsx)("label",{htmlFor:"".concat(e,"-bot-token"),className:"block text-xs",children:"봇 토큰"}),(0,a.jsx)(l.p,{id:"".concat(e,"-bot-token"),type:"password",autoComplete:"off",value:null!=(t=u[e])?t:"",onChange:t=>m(s=>({...s,[e]:t.target.value}))}),(0,a.jsx)("label",{htmlFor:"".concat(e,"-allowed-users"),className:"block text-xs",children:"허용 사용자 ID (쉼표로 구분)"}),(0,a.jsx)(l.p,{id:"".concat(e,"-allowed-users"),value:null!=(s=x[e])?s:"",onChange:t=>h(s=>({...s,[e]:t.target.value}))}),(0,a.jsx)(n.$,{type:"button",size:"sm",disabled:null!==f,onClick:()=>void k(e),children:"확인하고 저장"}),v[e]&&(0,a.jsx)("p",{role:"status",className:"text-xs",children:"봇을 재시작해야 반영됩니다"})]},e)}),y&&(0,a.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:y})]}):null}},31550:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(51719).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},32736:(e,t,s)=>{s.d(t,{D:()=>h,ThemeProvider:()=>x,z:()=>i});var a=s(58443),r=s(77947),n=s(23783),l=s(62866);let i=["catppuccin-mocha","mocha-pastel-accent","catppuccin-latte","rose-pine-dawn","nord-light","elanous-pastel-default"],d="elanous.pwa.theme",o="dashboard.theme.active",c="catppuccin-mocha";function u(e){return"string"==typeof e&&i.includes(e)}let m=(0,r.createContext)(null);function x(e){let{children:t}=e,s=(0,l.Qj)(),[x,h]=(0,r.useState)(c),p=(0,r.useRef)(0),b=(0,r.useCallback)(e=>{h(e),document.documentElement.dataset.theme=e},[]);(0,r.useEffect)(()=>{let e=localStorage.getItem(d),t=u(e)?e:c;b(t),(0,n.cY)("webterm.provider.theme.init",{theme:t})},[b]),(0,r.useEffect)(()=>{if(!s)return;let e=!0,t=p.current;return s.getSwitch(o).then(s=>{let{switch:a}=s;e&&t===p.current&&u(a.value)&&(b(a.value),localStorage.setItem(d,a.value))}).catch(()=>void 0),()=>{e=!1}},[b,s]);let f=(0,r.useCallback)(e=>{u(e)&&(p.current+=1,b(e),localStorage.setItem(d,e),(0,n.cY)("webterm.provider.theme.set",{theme:e}),null==s||s.putSwitch(o,{value:e}).catch(()=>void 0))},[b,s]);return(0,a.jsx)(m.Provider,{value:{theme:x,setTheme:f,themes:i},children:t})}function h(){let e=(0,r.useContext)(m);if(!e)throw Error("useTheme must be used inside <ThemeProvider>");return e}},33499:(e,t,s)=>{s.d(t,{EX:()=>n,dY:()=>r});let a={"/":"stable","/404":"stable","/setup":"stable","/setup/done":"stable","/chat":"stable","/term":"stable","/live":"stable","/market":"stable","/sessions":"stable","/settings":"beta","/editor":"beta","/intake":"beta","/trace":"beta","/board":"beta","/autopilot":"beta","/missions/[id]":"beta","/tasks":"beta","/workspace":"beta","/reflection":"beta","/vault":"beta","/observatory":"beta","/showroom":"beta","/workflows":"beta","/approvals":"tool","/worktrees":"tool","/design-check":"tool","/control":"tool","/scheduler":"ops","/dashboard":"ops","/bots":"ops","/botlab":"ops","/morning":"broken","/settings/devices":"broken","/workflows/chat-ui":"broken","/share":"system"};function r(e){var t;let s=(null==(t=e.split(/[?#]/,1)[0])?void 0:t.replace(/\/+$/,""))||"/";return Object.prototype.hasOwnProperty.call(a,s)?a[s]:s.startsWith("/missions/")&&-1===s.slice(10).indexOf("/")?a["/missions/[id]"]:void 0}function n(e,t){var s;let a=r(t);return!!a&&("owner"===e||"system"!==a&&((null==(s=t.split(/[?#]/,1)[0])?void 0:s.replace(/\/+$/,""))==="/settings"||"stable"===a||"contributor"===e&&("beta"===a||"tool"===a)))}},78413:(e,t,s)=>{s.d(t,{MQ:()=>n,OY:()=>a,fG:()=>r});let a="elanous:nav-prefs";function r(e){try{return"1"===window.localStorage.getItem(e)}catch(e){return!1}}function n(e,t){try{t?window.localStorage.setItem(e,"1"):window.localStorage.removeItem(e)}catch(e){}try{window.dispatchEvent(new Event(a))}catch(e){}}},88670:(e,t,s)=>{s.d(t,{Q:()=>c});var a=s(58443),r=s(77947),n=s(19990),l=s(65534),i=s(62866),d=s(75391);function o(e){if(e instanceof d.Iu&&e.body&&"object"==typeof e.body){var t;let s=e.body;return[null!=(t=s.reason)?t:s.error,s.path].filter(Boolean).join(": ")}return e instanceof Error?e.message:String(e)}function c(){let e=(0,i.Qj)(),[t,s]=(0,r.useState)(!1),[d,c]=(0,r.useState)(null),[u,m]=(0,r.useState)({vault:"",selection:"custom",dirs:""}),{vault:x,selection:h,dirs:p}=u,[b,f]=(0,r.useState)(!0),[g,v]=(0,r.useState)(!1),[j,y]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[w,S]=(0,r.useState)("");(0,r.useEffect)(()=>{s(!0)},[]);let C=(0,r.useCallback)(async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all";if(e){f(!0);try{let s=await e.getObsidianSkills();c(s),m(e=>({vault:"skills"===t?e.vault:s.obsidian.vault,selection:"vault"===t?e.selection:s.skills.activeSet,dirs:"vault"===t?e.dirs:s.skills.dirs.join("\n")})),y("")}catch(e){y(o(e))}finally{f(!1)}}},[e]);(0,r.useEffect)(()=>{t&&e&&C()},[t,e,C]);let U=async()=>{if(e){v(!0),k("");try{var t;let s=await e.setObsidian({vault:x.trim()});await C("vault"),k(null!=(t=s.warning)?t:"Vault saved.")}catch(e){k(o(e))}finally{v(!1)}}},A=async()=>{if(e){v(!0),S("");try{await e.setSkills("custom"===h?{dirs:p.split("\n").map(e=>e.trim()).filter(Boolean)}:{activeSet:h}),await C("skills"),S("Skills saved.")}catch(e){S(o(e))}finally{v(!1)}}};return t&&e?(0,a.jsxs)("section",{className:"space-y-4 rounded border border-border bg-card p-4","data-testid":"obsidian-skills-card",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Obsidian & Skills"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose directories on the machine running NEXUS."})]}),(0,a.jsx)(n.$,{size:"sm",variant:"outline",onClick:()=>void C("all"),disabled:b||g,children:"Refresh"})]}),b&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading paths…"}),j&&(0,a.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:j}),d&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{htmlFor:"obsidian-vault",className:"text-sm font-medium",children:"Obsidian vault path"}),(0,a.jsx)(l.p,{id:"obsidian-vault",value:x,onChange:e=>{m(t=>({...t,vault:e.target.value})),k("")},placeholder:"/absolute/path/to/vault"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"vault-validation",children:x===d.obsidian.vault?d.obsidian.looksLikeVault?"Vault found (.obsidian detected)":d.obsidian.exists?"Directory found; .obsidian not detected":"Directory not found":"Save to validate this path on the NEXUS host."}),(0,a.jsx)(n.$,{size:"sm",onClick:()=>void U(),disabled:g||!x.trim(),children:"Save vault"}),N&&(0,a.jsx)("p",{role:"status",className:"text-xs","data-testid":"vault-feedback",children:N})]}),(0,a.jsxs)("div",{className:"space-y-2 border-t border-border pt-3",children:[(0,a.jsx)("label",{htmlFor:"skills-preset",className:"text-sm font-medium",children:"Skills source"}),(0,a.jsxs)("select",{id:"skills-preset",value:h,onChange:e=>{m(t=>({...t,selection:e.target.value})),S("")},className:"flex h-9 w-full rounded-md border border-input bg-background px-3 text-sm",children:[d.skills.presets.map(e=>{var t;return(0,a.jsxs)("option",{value:e.key,children:[e.label," — ",null!=(t=e.dir)?t:"(no path)"," ",e.exists?"✓":"(missing)"]},e.key)}),(0,a.jsx)("option",{value:"custom",children:"Custom directories"})]}),"custom"===h&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{htmlFor:"skills-dirs",className:"block text-xs text-muted-foreground",children:"One absolute directory per line"}),(0,a.jsx)("textarea",{id:"skills-dirs",value:p,onChange:e=>{m(t=>({...t,dirs:e.target.value})),S("")},rows:3,className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs",placeholder:"/absolute/path/to/skills"})]}),(0,a.jsx)(n.$,{size:"sm",onClick:()=>void A(),disabled:g,children:"Save skills"}),w&&(0,a.jsx)("p",{role:"status",className:"text-xs","data-testid":"skills-feedback",children:w})]})]})]}):null}},95512:(e,t,s)=>{s.d(t,{GZ:()=>i,_n:()=>u,gu:()=>o,mB:()=>d,sY:()=>c,u9:()=>m});let a="elanous.showroom.intentPanel.collapsed",r="elanous.showroom.intentPanel.displayMode",n="fixed",l=new Set(["fixed","popup","off"]);function i(){try{return"true"===window.localStorage.getItem(a)}catch(e){return!1}}function d(e){try{e?window.localStorage.setItem(a,"true"):window.localStorage.removeItem(a),window.dispatchEvent(new StorageEvent("storage",{key:a,newValue:e?"true":null}))}catch(e){}}function o(e){let t=t=>{(t.key===a||null===t.key)&&e(i())};return window.addEventListener("storage",t),()=>{window.removeEventListener("storage",t)}}function c(){try{let e=window.localStorage.getItem(r);if(e&&l.has(e))return e;return n}catch(e){return n}}function u(e){try{e===n?window.localStorage.removeItem(r):window.localStorage.setItem(r,e),window.dispatchEvent(new StorageEvent("storage",{key:r,newValue:e===n?null:e}))}catch(e){}}function m(e){let t=t=>{(t.key===r||null===t.key)&&e(c())};return window.addEventListener("storage",t),()=>{window.removeEventListener("storage",t)}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5611],{1802:(t,n,e)=>{function r(){return[]}function i(t){return null==t?r:function(){return this.querySelectorAll(t)}}e.d(n,{A:()=>i})},8959:(t,n,e)=>{e.d(n,{A:()=>d});var r=e(22120),i=e(96534),o=e(52867),a=e(31907),u=e(92563);let s=t=>()=>t;function l(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:s,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}function c(t){return!t.ctrlKey&&!t.button}function f(){return this.parentNode}function h(t,n){return null==n?{x:t.x,y:t.y}:n}function p(){return navigator.maxTouchPoints||"ontouchstart"in this}function d(){var t,n,e,d,v=c,y=f,m=h,g=p,_={},w=(0,r.A)("start","drag","end"),x=0,b=0;function A(t){t.on("mousedown.drag",k).filter(g).on("touchstart.drag",E).on("touchmove.drag",z,u.vr).on("touchend.drag touchcancel.drag",$).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function k(r,o){if(!d&&v.call(this,r,o)){var s=S(this,y.call(this,r,o),r,o,"mouse");s&&((0,i.A)(r.view).on("mousemove.drag",M,u.Rw).on("mouseup.drag",N,u.Rw),(0,a.A)(r.view),(0,u.GK)(r),e=!1,t=r.clientX,n=r.clientY,s("start",r))}}function M(r){if((0,u.Ay)(r),!e){var i=r.clientX-t,o=r.clientY-n;e=i*i+o*o>b}_.mouse("drag",r)}function N(t){(0,i.A)(t.view).on("mousemove.drag mouseup.drag",null),(0,a.y)(t.view,e),(0,u.Ay)(t),_.mouse("end",t)}function E(t,n){if(v.call(this,t,n)){var e,r,i=t.changedTouches,o=y.call(this,t,n),a=i.length;for(e=0;e<a;++e)(r=S(this,o,t,n,i[e].identifier,i[e]))&&((0,u.GK)(t),r("start",t,i[e]))}}function z(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=_[r[n].identifier])&&((0,u.Ay)(t),e("drag",t,r[n]))}function $(t){var n,e,r=t.changedTouches,i=r.length;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),n=0;n<i;++n)(e=_[r[n].identifier])&&((0,u.GK)(t),e("end",t,r[n]))}function S(t,n,e,r,i,a){var u,s,c,f=w.copy(),h=(0,o.A)(a||e,n);if(null!=(c=m.call(t,new l("beforestart",{sourceEvent:e,target:A,identifier:i,active:x,x:h[0],y:h[1],dx:0,dy:0,dispatch:f}),r)))return u=c.x-h[0]||0,s=c.y-h[1]||0,function e(a,p,d){var v,y=h;switch(a){case"start":_[i]=e,v=x++;break;case"end":delete _[i],--x;case"drag":h=(0,o.A)(d||p,n),v=x}f.call(a,t,new l(a,{sourceEvent:p,subject:c,target:A,identifier:i,active:v,x:h[0]+u,y:h[1]+s,dx:h[0]-y[0],dy:h[1]-y[1],dispatch:f}),r)}}return A.filter=function(t){return arguments.length?(v="function"==typeof t?t:s(!!t),A):v},A.container=function(t){return arguments.length?(y="function"==typeof t?t:s(t),A):y},A.subject=function(t){return arguments.length?(m="function"==typeof t?t:s(t),A):m},A.touchable=function(t){return arguments.length?(g="function"==typeof t?t:s(!!t),A):g},A.on=function(){var t=w.on.apply(w,arguments);return t===w?A:t},A.clickDistance=function(t){return arguments.length?(b=(t*=1)*t,A):Math.sqrt(b)},A}l.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t}},9912:(t,n,e)=>{e.d(n,{A:()=>a});var r=e(28652),i=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,o=RegExp(i.source,"g");function a(t,n){var e,a,u,s,l,c=i.lastIndex=o.lastIndex=0,f=-1,h=[],p=[];for(t+="",n+="";(u=i.exec(t))&&(s=o.exec(n));)(l=s.index)>c&&(l=n.slice(c,l),h[f]?h[f]+=l:h[++f]=l),(u=u[0])===(s=s[0])?h[f]?h[f]+=s:h[++f]=s:(h[++f]=null,p.push({i:f,x:(0,r.A)(u,s)})),c=o.lastIndex;return c<n.length&&(l=n.slice(c),h[f]?h[f]+=l:h[++f]=l),h.length<2?p[0]?(e=p[0].x,function(t){return e(t)+""}):(a=n,function(){return a}):(n=p.length,function(t){for(var e,r=0;r<n;++r)h[(e=p[r]).i]=e.x(t);return h.join("")})}},21146:(t,n,e)=>{e.d(n,{A:()=>i,j:()=>o});var r=e(83442);function i(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):o(this.node(),t)}function o(t,n){return t.style.getPropertyValue(n)||(0,r.A)(t).getComputedStyle(t,null).getPropertyValue(n)}},21487:(t,n,e)=>{e.d(n,{Ay:()=>u});var r=e(55602);function i(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}var o=e(49181);function a(t,n){var e=n-t;return e?function(n){return t+n*e}:(0,o.A)(isNaN(t)?n:t)}let u=function t(n){var e,i=1==(e=+n)?a:function(t,n){var r,i,a;return n-t?(r=t,i=n,r=Math.pow(r,a=e),i=Math.pow(i,a)-r,a=1/a,function(t){return Math.pow(r+t*i,a)}):(0,o.A)(isNaN(t)?n:t)};function u(t,n){var e=i((t=(0,r.Qh)(t)).r,(n=(0,r.Qh)(n)).r),o=i(t.g,n.g),u=i(t.b,n.b),s=a(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=o(n),t.b=u(n),t.opacity=s(n),t+""}}return u.gamma=t,u}(1);function s(t){return function(n){var e,i,o=n.length,a=Array(o),u=Array(o),s=Array(o);for(e=0;e<o;++e)i=(0,r.Qh)(n[e]),a[e]=i.r||0,u[e]=i.g||0,s[e]=i.b||0;return a=t(a),u=t(u),s=t(s),i.opacity=1,function(t){return i.r=a(t),i.g=u(t),i.b=s(t),i+""}}}s(function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),o=t[r],a=t[r+1],u=r>0?t[r-1]:2*o-a,s=r<n-1?t[r+2]:2*a-o;return i((e-r/n)*n,u,o,a,s)}}),s(function(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),o=t[(r+n-1)%n],a=t[r%n],u=t[(r+1)%n],s=t[(r+2)%n];return i((e-r/n)*n,o,a,u,s)}})},22120:(t,n,e)=>{e.d(n,{A:()=>u});var r={value:()=>{}};function i(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw Error("illegal type: "+t);r[t]=[]}return new o(r)}function o(t){this._=t}function a(t,n,e){for(var i=0,o=t.length;i<o;++i)if(t[i].name===n){t[i]=r,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=e&&t.push({name:n,value:e}),t}o.prototype=i.prototype={constructor:o,on:function(t,n){var e,r=this._,i=(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw Error("unknown type: "+t);return{type:t,name:n}}),o=-1,u=i.length;if(arguments.length<2){for(;++o<u;)if((e=(t=i[o]).type)&&(e=function(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}(r[e],t.name)))return e;return}if(null!=n&&"function"!=typeof n)throw Error("invalid callback: "+n);for(;++o<u;)if(e=(t=i[o]).type)r[e]=a(r[e],t.name,n);else if(null==n)for(e in r)r[e]=a(r[e],t.name,null);return this},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new o(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw Error("unknown type: "+t);for(r=this._[t],o=0,e=r.length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};let u=i},28652:(t,n,e)=>{e.d(n,{A:()=>r});function r(t,n){return t*=1,n*=1,function(e){return t*(1-e)+n*e}}},31907:(t,n,e)=>{e.d(n,{A:()=>o,y:()=>a});var r=e(96534),i=e(92563);function o(t){var n=t.document.documentElement,e=(0,r.A)(t).on("dragstart.drag",i.Ay,i.Rw);"onselectstart"in n?e.on("selectstart.drag",i.Ay,i.Rw):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function a(t,n){var e=t.document.documentElement,o=(0,r.A)(t).on("dragstart.drag",null);n&&(o.on("click.drag",i.Ay,i.Rw),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in e?o.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}},35417:(t,n,e)=>{e.d(n,{A:()=>function t(n,e){var s,l,c=typeof e;return null==e||"boolean"===c?(0,u.A)(e):("number"===c?o.A:"string"===c?(l=(0,r.Ay)(e))?(e=l,i.Ay):a.A:e instanceof r.Ay?i.Ay:e instanceof Date?function(t,n){var e=new Date;return t*=1,n*=1,function(r){return e.setTime(t*(1-r)+n*r),e}}:!ArrayBuffer.isView(s=e)||s instanceof DataView?Array.isArray(e)?function(n,e){var r,i=e?e.length:0,o=n?Math.min(i,n.length):0,a=Array(o),u=Array(i);for(r=0;r<o;++r)a[r]=t(n[r],e[r]);for(;r<i;++r)u[r]=e[r];return function(t){for(r=0;r<o;++r)u[r]=a[r](t);return u}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(n,e){var r,i={},o={};for(r in(null===n||"object"!=typeof n)&&(n={}),(null===e||"object"!=typeof e)&&(e={}),e)r in n?i[r]=t(n[r],e[r]):o[r]=e[r];return function(t){for(r in i)o[r]=i[r](t);return o}}:o.A:function(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}})(n,e)}});var r=e(55602),i=e(21487),o=e(28652),a=e(9912),u=e(49181)},49181:(t,n,e)=>{e.d(n,{A:()=>r});let r=t=>()=>t},52867:(t,n,e)=>{e.d(n,{A:()=>r});function r(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}},53485:(t,n,e)=>{e.d(n,{A:()=>i});var r=e(86090);function i(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),r.A.hasOwnProperty(n)?{space:r.A[n],local:t}:t}},53537:(t,n,e)=>{e.d(n,{G:()=>d});var r,i=e(65325),o=e(22120),a=e(79876);function u(t,n,e){var r=new a.M4;return n=null==n?0:+n,r.restart(e=>{r.stop(),t(e+n)},n,e),r}var s=(0,o.A)("start","end","cancel","interrupt"),l=[];function c(t,n,e,r,i,o){var c=t.__transition;if(c){if(e in c)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(a){var c,f,h,p;if(1!==e.state)return l();for(c in i)if((p=i[c]).name===e.name){if(3===p.state)return u(o);4===p.state?(p.state=6,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete i[c]):+c<n&&(p.state=6,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete i[c])}if(u(function(){3===e.state&&(e.state=4,e.timer.restart(s,e.delay,e.time),s(a))}),e.state=2,e.on.call("start",t,t.__data__,e.index,e.group),2===e.state){for(c=0,e.state=3,r=Array(h=e.tween.length),f=-1;c<h;++c)(p=e.tween[c].value.call(t,t.__data__,e.index,e.group))&&(r[++f]=p);r.length=f+1}}function s(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(l),e.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===e.state&&(e.on.call("end",t,t.__data__,e.index,e.group),l())}function l(){for(var r in e.state=6,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=(0,a.O1)(function(t){e.state=1,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:s,tween:l,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function f(t,n){var e=p(t,n);if(e.state>0)throw Error("too late; already scheduled");return e}function h(t,n){var e=p(t,n);if(e.state>3)throw Error("too late; already running");return e}function p(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw Error("transition not found");return e}function d(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o){if((e=o[i]).name!==n){a=!1;continue}r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]}a&&delete t.__transition}}var v=e(28652),y=180/Math.PI,m={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function g(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r<n*e&&(t=-t,n=-n,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*y,skewX:Math.atan(s)*y,scaleX:a,scaleY:u}}function _(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u,s,l,c,f=[],h=[];return o=t(o),a=t(a),!function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:(0,v.A)(t,i)},{i:s-2,x:(0,v.A)(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,f,h),u=o.rotate,s=a.rotate,u!==s?(u-s>180?s+=360:s-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:(0,v.A)(u,s)})):s&&f.push(i(f)+"rotate("+s+r),l=o.skewX,c=a.skewX,l!==c?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:(0,v.A)(l,c)}):c&&f.push(i(f)+"skewX("+c+r),!function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:(0,v.A)(t,e)},{i:u-2,x:(0,v.A)(n,r)})}else(1!==e||1!==r)&&o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,f,h),o=a=null,function(t){for(var n,e=-1,r=h.length;++e<r;)f[(n=h[e]).i]=n.x(t);return f.join("")}}}var w=_(function(t){let n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?m:g(n.a,n.b,n.c,n.d,n.e,n.f)},"px, ","px)","deg)"),x=_(function(t){return null==t?m:(r||(r=document.createElementNS("http://www.w3.org/2000/svg","g")),r.setAttribute("transform",t),t=r.transform.baseVal.consolidate())?g((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):m},", ",")",")"),b=e(53485);function A(t,n,e){var r=t._id;return t.each(function(){var t=h(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return p(t,r).value[n]}}var k=e(55602),M=e(21487),N=e(9912);function E(t,n){var e;return("number"==typeof n?v.A:n instanceof k.Ay?M.Ay:(e=(0,k.Ay)(n))?(n=e,M.Ay):N.A)(t,n)}var z=e(75196),$=e(59223),S=e(1802),T=i.Ay.prototype.constructor,C=e(21146);function P(t){return function(){this.style.removeProperty(t)}}var X=0;function j(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}var q=i.Ay.prototype;j.prototype=(function(t){return(0,i.Ay)().transition(t)}).prototype={constructor:j,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=(0,$.A)(t));for(var r=this._groups,i=r.length,o=Array(i),a=0;a<i;++a)for(var u,s,l=r[a],f=l.length,h=o[a]=Array(f),d=0;d<f;++d)(u=l[d])&&(s=t.call(u,u.__data__,d,l))&&("__data__"in u&&(s.__data__=u.__data__),h[d]=s,c(h[d],n,e,d,h,p(u,e)));return new j(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=(0,S.A)(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var s,l=r[u],f=l.length,h=0;h<f;++h)if(s=l[h]){for(var d,v=t.call(s,s.__data__,h,l),y=p(s,e),m=0,g=v.length;m<g;++m)(d=v[m])&&c(d,n,e,m,v,y);o.push(v),a.push(s)}return new j(o,a,n,e)},selectChild:q.selectChild,selectChildren:q.selectChildren,filter:function(t){"function"!=typeof t&&(t=(0,z.A)(t));for(var n=this._groups,e=n.length,r=Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,s=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&s.push(o);return new j(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw Error();for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=Array(r),u=0;u<o;++u)for(var s,l=n[u],c=e[u],f=l.length,h=a[u]=Array(f),p=0;p<f;++p)(s=l[p]||c[p])&&(h[p]=s);for(;u<r;++u)a[u]=n[u];return new j(a,this._parents,this._name,this._id)},selection:function(){return new T(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=++X,r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],s=u.length,l=0;l<s;++l)if(a=u[l]){var f=p(a,n);c(a,t,e,l,u,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new j(r,this._parents,t,e)},call:q.call,nodes:q.nodes,node:q.node,size:q.size,empty:q.empty,each:q.each,on:function(t,n){var e,r,i,o,a,u,s=this._id;return arguments.length<2?p(this.node(),s).on.on(t):this.each((e=s,r=t,i=n,u=(r+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})?f:h,function(){var t=u(this,e),n=t.on;n!==o&&(a=(o=n).copy()).on(r,i),t.on=a}))},attr:function(t,n){var e=(0,b.A)(t),r="transform"===e?x:E;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var a,u,s=e(this);return null==s?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local))===(u=s+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,s))}}:function(t,n,e){var r,i,o;return function(){var a,u,s=e(this);return null==s?void this.removeAttribute(t):(a=this.getAttribute(t))===(u=s+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,s))}})(e,r,A(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}:function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}})(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw Error();var r=(0,b.A)(t);return this.tween(e,(r.local?function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(n){this.setAttributeNS(t.space,t.local,i.call(this,n))}),e}return i._value=n,i}:function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(n){this.setAttribute(t,i.call(this,n))}),e}return i._value=n,i})(r,n))},style:function(t,n,e){var r,i,o,a,u,s,l,c,f,p,d,v,y,m,g,_,x,b,k,M,N,z="transform"==(t+="")?w:E;return null==n?this.styleTween(t,(r=t,function(){var t=(0,C.j)(this,r),n=(this.style.removeProperty(r),(0,C.j)(this,r));return t===n?null:t===i&&n===o?a:a=z(i=t,o=n)})).on("end.style."+t,P(t)):"function"==typeof n?this.styleTween(t,(u=t,s=A(this,"style."+t,n),function(){var t=(0,C.j)(this,u),n=s(this),e=n+"";return null==n&&(this.style.removeProperty(u),e=n=(0,C.j)(this,u)),t===e?null:t===l&&e===c?f:(c=e,f=z(l=t,n))})).each((p=this._id,x="end."+(_="style."+(d=t)),function(){var t=h(this,p),n=t.on,e=null==t.value[_]?g||(g=P(d)):void 0;(n!==v||m!==e)&&(y=(v=n).copy()).on(x,m=e),t.on=y})):this.styleTween(t,(b=t,N=n+"",function(){var t=(0,C.j)(this,b);return t===N?null:t===k?M:M=z(k=t,n)}),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw Error();return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(n){this.style.setProperty(t,o.call(this,n),e)}),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){var n,e;return this.tween("text","function"==typeof t?(n=A(this,"text",t),function(){var t=n(this);this.textContent=null==t?"":t}):(e=null==t?"":t+"",function(){this.textContent=e}))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw Error();return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){this.textContent=r.call(this,t)}),n}return r._value=t,r}(t))},remove:function(){var t;return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=p(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?function(t,n){var e,r;return function(){var i=h(this,t),o=i.tween;if(o!==e){r=e=o;for(var a=0,u=r.length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}}i.tween=r}}:function(t,n,e){var r,i;if("function"!=typeof e)throw Error();return function(){var o=h(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},s=0,l=i.length;s<l;++s)if(i[s].name===n){i[s]=u;break}s===l&&i.push(u)}o.tween=i}})(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){f(this,t).delay=+n.apply(this,arguments)}}:function(t,n){return n*=1,function(){f(this,t).delay=n}})(n,t)):p(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){h(this,t).duration=+n.apply(this,arguments)}}:function(t,n){return n*=1,function(){h(this,t).duration=n}})(n,t)):p(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw Error();return function(){h(this,t).ease=n}}(n,t)):p(this.node(),n).ease},easeVarying:function(t){var n;if("function"!=typeof t)throw Error();return this.each((n=this._id,function(){var e=t.apply(this,arguments);if("function"!=typeof e)throw Error();h(this,n).ease=e}))},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise(function(o,a){var u={value:a},s={value:function(){0==--i&&o()}};e.each(function(){var e=h(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(s)),e.on=n}),0===i&&o()})},[Symbol.iterator]:q[Symbol.iterator]};var R={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};i.Ay.prototype.interrupt=function(t){return this.each(function(){d(this,t)})},i.Ay.prototype.transition=function(t){var n,e;t instanceof j?(n=t._id,t=t._name):(n=++X,(e=R).time=(0,a.tB)(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var u,s=r[o],l=s.length,f=0;f<l;++f)(u=s[f])&&c(u,t,n,f,s,e||function(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw Error(`transition ${n} not found`);return e}(u,n));return new j(r,this._parents,t,n)}},55602:(t,n,e)=>{function r(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function i(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function o(){}e.d(n,{Ay:()=>_,Qh:()=>b});var a="\\s*([+-]?\\d+)\\s*",u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",s="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",l=/^#([0-9a-f]{3,8})$/,c=RegExp(`^rgb\\(${a},${a},${a}\\)$`),f=RegExp(`^rgb\\(${s},${s},${s}\\)$`),h=RegExp(`^rgba\\(${a},${a},${a},${u}\\)$`),p=RegExp(`^rgba\\(${s},${s},${s},${u}\\)$`),d=RegExp(`^hsl\\(${u},${s},${s}\\)$`),v=RegExp(`^hsla\\(${u},${s},${s},${u}\\)$`),y={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function m(){return this.rgb().formatHex()}function g(){return this.rgb().formatRgb()}function _(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=l.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?w(n):3===e?new A(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?x(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?x(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=c.exec(t))?new A(n[1],n[2],n[3],1):(n=f.exec(t))?new A(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=h.exec(t))?x(n[1],n[2],n[3],n[4]):(n=p.exec(t))?x(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=d.exec(t))?$(n[1],n[2]/100,n[3]/100,1):(n=v.exec(t))?$(n[1],n[2]/100,n[3]/100,n[4]):y.hasOwnProperty(t)?w(y[t]):"transparent"===t?new A(NaN,NaN,NaN,0):null}function w(t){return new A(t>>16&255,t>>8&255,255&t,1)}function x(t,n,e,r){return r<=0&&(t=n=e=NaN),new A(t,n,e,r)}function b(t,n,e,r){var i;return 1==arguments.length?((i=t)instanceof o||(i=_(i)),i)?new A((i=i.rgb()).r,i.g,i.b,i.opacity):new A:new A(t,n,e,null==r?1:r)}function A(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function k(){return`#${z(this.r)}${z(this.g)}${z(this.b)}`}function M(){let t=N(this.opacity);return`${1===t?"rgb(":"rgba("}${E(this.r)}, ${E(this.g)}, ${E(this.b)}${1===t?")":`, ${t})`}`}function N(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function E(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function z(t){return((t=E(t))<16?"0":"")+t.toString(16)}function $(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new T(t,n,e,r)}function S(t){if(t instanceof T)return new T(t.h,t.s,t.l,t.opacity);if(t instanceof o||(t=_(t)),!t)return new T;if(t instanceof T)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),a=Math.max(n,e,r),u=NaN,s=a-i,l=(a+i)/2;return s?(u=n===a?(e-r)/s+(e<r)*6:e===a?(r-n)/s+2:(n-e)/s+4,s/=l<.5?a+i:2-a-i,u*=60):s=l>0&&l<1?0:u,new T(u,s,l,t.opacity)}function T(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function C(t){return(t=(t||0)%360)<0?t+360:t}function P(t){return Math.max(0,Math.min(1,t||0))}function X(t,n,e){return(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)*255}r(o,_,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:m,formatHex:m,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return S(this).formatHsl()},formatRgb:g,toString:g}),r(A,b,i(o,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new A(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new A(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new A(E(this.r),E(this.g),E(this.b),N(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:k,formatHex:k,formatHex8:function(){return`#${z(this.r)}${z(this.g)}${z(this.b)}${z((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:M,toString:M})),r(T,function(t,n,e,r){return 1==arguments.length?S(t):new T(t,n,e,null==r?1:r)},i(o,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new T(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new T(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new A(X(t>=240?t-240:t+120,i,r),X(t,i,r),X(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new T(C(this.h),P(this.s),P(this.l),N(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=N(this.opacity);return`${1===t?"hsl(":"hsla("}${C(this.h)}, ${100*P(this.s)}%, ${100*P(this.l)}%${1===t?")":`, ${t})`}`}}))},59223:(t,n,e)=>{function r(){}function i(t){return null==t?r:function(){return this.querySelector(t)}}e.d(n,{A:()=>i})},65325:(t,n,e)=>{e.d(n,{LN:()=>Y,Ay:()=>D,zr:()=>R});var r=e(59223),i=e(1802),o=e(75196),a=Array.prototype.find;function u(){return this.firstElementChild}var s=Array.prototype.filter;function l(){return Array.from(this.children)}function c(t){return Array(t.length)}function f(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function h(t,n,e,r,i,o){for(var a,u=0,s=n.length,l=o.length;u<l;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new f(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function p(t,n,e,r,i,o,a){var u,s,l,c=new Map,h=n.length,p=o.length,d=Array(h);for(u=0;u<h;++u)(s=n[u])&&(d[u]=l=a.call(s,s.__data__,u,n)+"",c.has(l)?i[u]=s:c.set(l,s));for(u=0;u<p;++u)l=a.call(t,o[u],u,o)+"",(s=c.get(l))?(r[u]=s,s.__data__=o[u],c.delete(l)):e[u]=new f(t,o[u]);for(u=0;u<h;++u)(s=n[u])&&c.get(d[u])===s&&(i[u]=s)}function d(t){return t.__data__}function v(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}f.prototype={constructor:f,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var y=e(53485),m=e(21146);function g(t){return t.trim().split(/^|\s+/)}function _(t){return t.classList||new w(t)}function w(t){this._node=t,this._names=g(t.getAttribute("class")||"")}function x(t,n){for(var e=_(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function b(t,n){for(var e=_(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function A(){this.textContent=""}function k(){this.innerHTML=""}function M(){this.nextSibling&&this.parentNode.appendChild(this)}function N(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}w.prototype={add:function(t){0>this._names.indexOf(t)&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var E=e(86090);function z(t){var n=(0,y.A)(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===E.g&&n.documentElement.namespaceURI===E.g?n.createElement(t):n.createElementNS(e,t)}})(n)}function $(){return null}function S(){var t=this.parentNode;t&&t.removeChild(this)}function T(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function C(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function P(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)(e=n[r],t.type&&e.type!==t.type||e.name!==t.name)?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function X(t,n,e){return function(){var r,i=this.__on,o=function(t){n.call(this,t,this.__data__)};if(i){for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),r.value=n;return}}this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}var j=e(83442);function q(t,n,e){var r=(0,j.A)(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}var R=[null];function Y(t,n){this._groups=t,this._parents=n}function O(){return new Y([[document.documentElement]],R)}Y.prototype=O.prototype={constructor:Y,select:function(t){"function"!=typeof t&&(t=(0,r.A)(t));for(var n=this._groups,e=n.length,i=Array(e),o=0;o<e;++o)for(var a,u,s=n[o],l=s.length,c=i[o]=Array(l),f=0;f<l;++f)(a=s[f])&&(u=t.call(a,a.__data__,f,s))&&("__data__"in a&&(u.__data__=a.__data__),c[f]=u);return new Y(i,this._parents)},selectAll:function(t){if("function"==typeof t){var n;n=t,t=function(){var t;return t=n.apply(this,arguments),null==t?[]:Array.isArray(t)?t:Array.from(t)}}else t=(0,i.A)(t);for(var e=this._groups,r=e.length,o=[],a=[],u=0;u<r;++u)for(var s,l=e[u],c=l.length,f=0;f<c;++f)(s=l[f])&&(o.push(t.call(s,s.__data__,f,l)),a.push(s));return new Y(o,a)},selectChild:function(t){var n;return this.select(null==t?u:(n="function"==typeof t?t:(0,o.j)(t),function(){return a.call(this.children,n)}))},selectChildren:function(t){var n;return this.selectAll(null==t?l:(n="function"==typeof t?t:(0,o.j)(t),function(){return s.call(this.children,n)}))},filter:function(t){"function"!=typeof t&&(t=(0,o.A)(t));for(var n=this._groups,e=n.length,r=Array(e),i=0;i<e;++i)for(var a,u=n[i],s=u.length,l=r[i]=[],c=0;c<s;++c)(a=u[c])&&t.call(a,a.__data__,c,u)&&l.push(a);return new Y(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,d);var e=n?p:h,r=this._parents,i=this._groups;"function"!=typeof t&&(x=t,t=function(){return x});for(var o=i.length,a=Array(o),u=Array(o),s=Array(o),l=0;l<o;++l){var c=r[l],f=i[l],v=f.length,y="object"==typeof(w=t.call(c,c&&c.__data__,l,r))&&"length"in w?w:Array.from(w),m=y.length,g=u[l]=Array(m),_=a[l]=Array(m);e(c,f,g,_,s[l]=Array(v),y,n);for(var w,x,b,A,k=0,M=0;k<m;++k)if(b=g[k]){for(k>=M&&(M=k+1);!(A=_[M])&&++M<m;);b._next=A||null}}return(a=new Y(a,r))._enter=u,a._exit=s,a},enter:function(){return new Y(this._enter||this._groups.map(c),this._parents)},exit:function(){return new Y(this._exit||this._groups.map(c),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),u=Array(i),s=0;s<a;++s)for(var l,c=e[s],f=r[s],h=c.length,p=u[s]=Array(h),d=0;d<h;++d)(l=c[d]||f[d])&&(p[d]=l);for(;s<i;++s)u[s]=e[s];return new Y(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=v);for(var e=this._groups,r=e.length,i=Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,l=i[o]=Array(s),c=0;c<s;++c)(a=u[c])&&(l[c]=a);l.sort(n)}return new Y(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(let n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=(0,y.A)(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:m.A,property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=g(t+"");if(arguments.length<2){for(var r=_(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?x:b)(this,t)}}:n?function(t){return function(){x(this,t)}}:function(t){return function(){b(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?A:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?k:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(M)},lower:function(){return this.each(N)},append:function(t){var n="function"==typeof t?t:z(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:z(t),i=null==n?$:"function"==typeof n?n:(0,r.A)(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),i.apply(this,arguments)||null)})},remove:function(){return this.each(S)},clone:function(t){return this.select(t?C:T)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}),a=o.length;if(arguments.length<2){var u=this.node().__on;if(u){for(var s,l=0,c=u.length;l<c;++l)for(r=0,s=u[l];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value}return}for(r=0,u=n?X:P;r<a;++r)this.each(u(o[r],n,e));return this},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return q(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return q(this,t,n)}})(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};let D=O},68458:(t,n,e)=>{function r(t){return((t=Math.exp(t))+1/t)/2}e.d(n,{A:()=>i});let i=function t(n,e,i){function o(t,o){var a,u,s=t[0],l=t[1],c=t[2],f=o[0],h=o[1],p=o[2],d=f-s,v=h-l,y=d*d+v*v;if(y<1e-12)u=Math.log(p/c)/n,a=function(t){return[s+t*d,l+t*v,c*Math.exp(n*t*u)]};else{var m=Math.sqrt(y),g=(p*p-c*c+i*y)/(2*c*e*m),_=(p*p-c*c-i*y)/(2*p*e*m),w=Math.log(Math.sqrt(g*g+1)-g);u=(Math.log(Math.sqrt(_*_+1)-_)-w)/n,a=function(t){var i,o,a=t*u,f=r(w),h=c/(e*m)*(f*(((i=Math.exp(2*(i=n*a+w)))-1)/(i+1))-((o=Math.exp(o=w))-1/o)/2);return[s+h*d,l+h*v,c*f/r(n*a+w)]}}return a.duration=1e3*u*n/Math.SQRT2,a}return o.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},o}(Math.SQRT2,2,4)},75196:(t,n,e)=>{function r(t){return function(){return this.matches(t)}}function i(t){return function(n){return n.matches(t)}}e.d(n,{A:()=>r,j:()=>i})},79876:(t,n,e)=>{e.d(n,{M4:()=>v,O1:()=>y,tB:()=>p});var r,i,o=0,a=0,u=0,s=0,l=0,c=0,f="object"==typeof performance&&performance.now?performance:Date,h="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function p(){return l||(h(d),l=f.now()+c)}function d(){l=0}function v(){this._call=this._time=this._next=null}function y(t,n,e){var r=new v;return r.restart(t,n,e),r}function m(){l=(s=f.now())+c,o=a=0;try{p(),++o;for(var t,n=r;n;)(t=l-n._time)>=0&&n._call.call(void 0,t),n=n._next;--o}finally{o=0,function(){for(var t,n,e=r,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:r=n);i=t,_(o)}(),l=0}}function g(){var t=f.now(),n=t-s;n>1e3&&(c-=n,s=t)}function _(t){!o&&(a&&(a=clearTimeout(a)),t-l>24?(t<1/0&&(a=setTimeout(m,t-f.now()-c)),u&&(u=clearInterval(u))):(u||(s=f.now(),u=setInterval(g,1e3)),o=1,h(m)))}v.prototype=y.prototype={constructor:v,restart:function(t,n,e){if("function"!=typeof t)throw TypeError("callback is not a function");e=(null==e?p():+e)+(null==n?0:+n),this._next||i===this||(i?i._next=this:r=this,i=this),this._call=t,this._time=e,_()},stop:function(){this._call&&(this._call=null,this._time=1/0,_())}}},83442:(t,n,e)=>{e.d(n,{A:()=>r});function r(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}},86090:(t,n,e)=>{e.d(n,{A:()=>i,g:()=>r});var r="http://www.w3.org/1999/xhtml";let i={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}},92563:(t,n,e)=>{e.d(n,{Ay:()=>a,GK:()=>o,Rw:()=>i,vr:()=>r});let r={passive:!1},i={capture:!0,passive:!1};function o(t){t.stopImmediatePropagation()}function a(t){t.preventDefault(),t.stopImmediatePropagation()}},96534:(t,n,e)=>{e.d(n,{A:()=>i});var r=e(65325);function i(t){return"string"==typeof t?new r.LN([[document.querySelector(t)]],[document.documentElement]):new r.LN([[t]],r.zr)}},97653:(t,n,e)=>{e.d(n,{s_:()=>b,GS:()=>h,_V:()=>p});var r=e(22120),i=e(31907),o=e(68458),a=e(96534),u=e(52867),s=e(53537);let l=t=>()=>t;function c(t,{sourceEvent:n,target:e,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function f(t,n,e){this.k=t,this.x=n,this.y=e}f.prototype={constructor:f,scale:function(t){return 1===t?this:new f(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new f(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var h=new f(1,0,0);function p(t){for(;!t.__zoom;)if(!(t=t.parentNode))return h;return t.__zoom}function d(t){t.stopImmediatePropagation()}function v(t){t.preventDefault(),t.stopImmediatePropagation()}function y(t){return(!t.ctrlKey||"wheel"===t.type)&&!t.button}function m(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function g(){return this.__zoom||h}function _(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function w(){return navigator.maxTouchPoints||"ontouchstart"in this}function x(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function b(){var t,n,e,p=y,b=m,A=x,k=_,M=w,N=[0,1/0],E=[[-1/0,-1/0],[1/0,1/0]],z=250,$=o.A,S=(0,r.A)("start","zoom","end"),T=0,C=10;function P(t){t.property("__zoom",g).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",V).filter(M).on("touchstart.zoom",I).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function X(t,n){return(n=Math.max(N[0],Math.min(N[1],n)))===t.k?t:new f(n,t.x,t.y)}function j(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new f(t.k,r,i)}function q(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function R(t,n,e,r){t.on("start.zoom",function(){Y(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){Y(this,arguments).event(r).end()}).tween("zoom",function(){var t=arguments,i=Y(this,t).event(r),o=b.apply(this,t),a=null==e?q(o):"function"==typeof e?e.apply(this,t):e,u=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),s=this.__zoom,l="function"==typeof n?n.apply(this,t):n,c=$(s.invert(a).concat(u/s.k),l.invert(a).concat(u/l.k));return function(t){if(1===t)t=l;else{var n=c(t),e=u/n[2];t=new f(e,a[0]-n[0]*e,a[1]-n[1]*e)}i.zoom(null,t)}})}function Y(t,n,e){return!e&&t.__zooming||new O(t,n)}function O(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=b.apply(t,n),this.taps=0}function D(t,...n){if(p.apply(this,arguments)){var e=Y(this,n).event(t),r=this.__zoom,i=Math.max(N[0],Math.min(N[1],r.k*Math.pow(2,k.apply(this,arguments)))),o=(0,u.A)(t);if(e.wheel)(e.mouse[0][0]!==o[0]||e.mouse[0][1]!==o[1])&&(e.mouse[1]=r.invert(e.mouse[0]=o)),clearTimeout(e.wheel);else{if(r.k===i)return;e.mouse=[o,r.invert(o)],(0,s.G)(this),e.start()}v(t),e.wheel=setTimeout(function(){e.wheel=null,e.end()},150),e.zoom("mouse",A(j(X(r,i),e.mouse[0],e.mouse[1]),e.extent,E))}}function B(t,...n){if(!e&&p.apply(this,arguments)){var r=t.currentTarget,o=Y(this,n,!0).event(t),l=(0,a.A)(t.view).on("mousemove.zoom",function(t){if(v(t),!o.moved){var n=t.clientX-f,e=t.clientY-h;o.moved=n*n+e*e>T}o.event(t).zoom("mouse",A(j(o.that.__zoom,o.mouse[0]=(0,u.A)(t,r),o.mouse[1]),o.extent,E))},!0).on("mouseup.zoom",function(t){l.on("mousemove.zoom mouseup.zoom",null),(0,i.y)(t.view,o.moved),v(t),o.event(t).end()},!0),c=(0,u.A)(t,r),f=t.clientX,h=t.clientY;(0,i.A)(t.view),d(t),o.mouse=[c,this.__zoom.invert(c)],(0,s.G)(this),o.start()}}function V(t,...n){if(p.apply(this,arguments)){var e=this.__zoom,r=(0,u.A)(t.changedTouches?t.changedTouches[0]:t,this),i=e.invert(r),o=e.k*(t.shiftKey?.5:2),s=A(j(X(e,o),r,i),b.apply(this,n),E);v(t),z>0?(0,a.A)(this).transition().duration(z).call(R,s,r,t):(0,a.A)(this).call(P.transform,s,r,t)}}function I(e,...r){if(p.apply(this,arguments)){var i,o,a,l,c=e.touches,f=c.length,h=Y(this,r,e.changedTouches.length===f).event(e);for(d(e),o=0;o<f;++o)a=c[o],l=[l=(0,u.A)(a,this),this.__zoom.invert(l),a.identifier],h.touch0?h.touch1||h.touch0[2]===l[2]||(h.touch1=l,h.taps=0):(h.touch0=l,i=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(h.taps<2&&(n=l[0],t=setTimeout(function(){t=null},500)),(0,s.G)(this),h.start())}}function L(t,...n){if(this.__zooming){var e,r,i,o,a=Y(this,n).event(t),s=t.changedTouches,l=s.length;for(v(t),e=0;e<l;++e)r=s[e],i=(0,u.A)(r,this),a.touch0&&a.touch0[2]===r.identifier?a.touch0[0]=i:a.touch1&&a.touch1[2]===r.identifier&&(a.touch1[0]=i);if(r=a.that.__zoom,a.touch1){var c=a.touch0[0],f=a.touch0[1],h=a.touch1[0],p=a.touch1[1],d=(d=h[0]-c[0])*d+(d=h[1]-c[1])*d,y=(y=p[0]-f[0])*y+(y=p[1]-f[1])*y;r=X(r,Math.sqrt(d/y)),i=[(c[0]+h[0])/2,(c[1]+h[1])/2],o=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!a.touch0)return;i=a.touch0[0],o=a.touch0[1]}a.zoom("touch",A(j(r,i,o),a.extent,E))}}function G(t,...r){if(this.__zooming){var i,o,s=Y(this,r).event(t),l=t.changedTouches,c=l.length;for(d(t),e&&clearTimeout(e),e=setTimeout(function(){e=null},500),i=0;i<c;++i)o=l[i],s.touch0&&s.touch0[2]===o.identifier?delete s.touch0:s.touch1&&s.touch1[2]===o.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(o=(0,u.A)(o,this),Math.hypot(n[0]-o[0],n[1]-o[1])<C)){var f=(0,a.A)(this).on("dblclick.zoom");f&&f.apply(this,arguments)}}}return P.transform=function(t,n,e,r){var i=t.selection?t.selection():t;i.property("__zoom",g),t!==i?R(t,n,e,r):i.interrupt().each(function(){Y(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},P.scaleBy=function(t,n,e,r){P.scaleTo(t,function(){var t=this.__zoom.k,e="function"==typeof n?n.apply(this,arguments):n;return t*e},e,r)},P.scaleTo=function(t,n,e,r){P.transform(t,function(){var t=b.apply(this,arguments),r=this.__zoom,i=null==e?q(t):"function"==typeof e?e.apply(this,arguments):e,o=r.invert(i),a="function"==typeof n?n.apply(this,arguments):n;return A(j(X(r,a),i,o),t,E)},e,r)},P.translateBy=function(t,n,e,r){P.transform(t,function(){return A(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),b.apply(this,arguments),E)},null,r)},P.translateTo=function(t,n,e,r,i){P.transform(t,function(){var t=b.apply(this,arguments),i=this.__zoom,o=null==r?q(t):"function"==typeof r?r.apply(this,arguments):r;return A(h.translate(o[0],o[1]).scale(i.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,E)},r,i)},O.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var n=(0,a.A)(this.that).datum();S.call(t,this.that,new c(t,{sourceEvent:this.sourceEvent,target:P,type:t,transform:this.that.__zoom,dispatch:S}),n)}},P.wheelDelta=function(t){return arguments.length?(k="function"==typeof t?t:l(+t),P):k},P.filter=function(t){return arguments.length?(p="function"==typeof t?t:l(!!t),P):p},P.touchable=function(t){return arguments.length?(M="function"==typeof t?t:l(!!t),P):M},P.extent=function(t){return arguments.length?(b="function"==typeof t?t:l([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),P):b},P.scaleExtent=function(t){return arguments.length?(N[0]=+t[0],N[1]=+t[1],P):[N[0],N[1]]},P.translateExtent=function(t){return arguments.length?(E[0][0]=+t[0][0],E[1][0]=+t[1][0],E[0][1]=+t[0][1],E[1][1]=+t[1][1],P):[[E[0][0],E[0][1]],[E[1][0],E[1][1]]]},P.constrain=function(t){return arguments.length?(A=t,P):A},P.duration=function(t){return arguments.length?(z=+t,P):z},P.interpolate=function(t){return arguments.length?($=t,P):$},P.on=function(){var t=S.on.apply(S,arguments);return t===S?P:t},P.clickDistance=function(t){return arguments.length?(T=(t*=1)*t,P):Math.sqrt(T)},P.tapDistance=function(t){return arguments.length?(C=+t,P):C},P}p.prototype=f.prototype}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5890],{12135:(e,t,l)=>{l.d(t,{lN:()=>h});var a=l(58443),r=l(77947),i=l(19990),s=l(65534),n=l(62866),d=l(75391);let c=[{value:"decompose",label:"쪼개기"},{value:"wait-reset",label:"리셋까지 기다리기"},{value:"next-provider",label:"다음 프로바이더"},{value:"proceed",label:"그대로 진행"}];function o(e){return{mode:e.resolved.mode,chain:e.resolved.chain.map(e=>({...e})),minHeadroomPercent:String(e.resolved.budgetGate.minHeadroomPercent),onShortfall:e.resolved.budgetGate.onShortfall}}function u(e,t,l){let a=t+l;if(a<0||a>=e.length)return e;let r=e.slice(),[i]=r.splice(t,1);return r.splice(a,0,i),r}function m(e){if(e instanceof d.Iu&&e.body&&"object"==typeof e.body){var t,l;let a=e.body;return null!=(l=null!=(t=a.reason)?t:a.error)?l:e.message}return e instanceof Error?e.message:String(e)}function h(){var e,t;let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},d=(0,n.Qj)(),h=null!=(e=l.client)?e:d,[x,f]=(0,r.useState)(!!l.initialDraft),[p,v]=(0,r.useState)([]),[b,g]=(0,r.useState)(null!=(t=l.initialDraft)?t:null),[j,y]=(0,r.useState)(!l.initialDraft),[N,k]=(0,r.useState)(!1),[w,C]=(0,r.useState)(""),[S,P]=(0,r.useState)("");(0,r.useEffect)(()=>{f(!0)},[]);let E=(0,r.useCallback)(async()=>{if(h){y(!0);try{let e=await h.getChildLlmPreference();v(e.providers),g(o(e)),P("")}catch(e){P(m(e))}finally{y(!1)}}},[h]);(0,r.useEffect)(()=>{x&&h&&E()},[x,h,E]);let H=async()=>{if(!h||!b)return;k(!0),C(""),P("");let e=Number(b.minHeadroomPercent);try{let t=await h.setChildLlmPreference({mode:b.mode,chain:b.chain.map(e=>{var t;return{provider:e.provider.trim(),...(null==(t=e.model)?void 0:t.trim())?{model:e.model.trim()}:{}}}).filter(e=>e.provider),budgetGate:{...Number.isFinite(e)?{minHeadroomPercent:e}:{},onShortfall:b.onShortfall}});g(o({resolved:t.resolved,providers:p})),C("저장했습니다.")}catch(e){P(m(e))}finally{k(!1)}};if(!x||!h||!b)return(0,a.jsxs)("section",{className:"space-y-2 rounded border border-border bg-card p-4","data-testid":"child-llm-preference-card",children:[S&&(0,a.jsx)("p",{role:"alert",className:"text-xs text-destructive","data-testid":"child-llm-error",children:S}),j&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"불러오는 중…"})]});let z=b.chain.length>1,F=p.length>0?p:["grok"];return(0,a.jsxs)("section",{className:"space-y-4 rounded border border-border bg-card p-4","data-testid":"child-llm-preference-card",children:[(0,a.jsxs)("header",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"자식 LLM 선호"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"구현에 쓸 모델 순서와, 예산이 모자랄 때의 행동."})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:"child-llm-mode",className:"text-sm font-medium",children:"모드"}),(0,a.jsxs)("select",{id:"child-llm-mode","data-testid":"child-llm-mode",value:b.mode,onChange:e=>g({...b,mode:e.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 text-sm",children:[(0,a.jsx)("option",{value:"pinned",children:"고정"}),(0,a.jsx)("option",{value:"auto",children:"자동"})]})]}),"auto"===b.mode&&(0,a.jsxs)("div",{className:"space-y-2","data-testid":"child-llm-chain",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"순서"}),b.chain.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2","data-testid":"child-llm-chain-row",children:[(0,a.jsx)("select",{"aria-label":"프로바이더 ".concat(t+1),value:e.provider,onChange:l=>{let a=b.chain.slice();a[t]={...e,provider:l.target.value},g({...b,chain:a})},className:"flex h-9 flex-1 rounded-md border border-input bg-background px-3 text-sm",children:F.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}),z&&(0,a.jsxs)("span",{className:"flex gap-1","data-testid":"child-llm-order",children:[(0,a.jsx)(i.$,{type:"button",size:"sm",variant:"outline","aria-label":"".concat(t+1," 위로"),disabled:0===t,onClick:()=>g({...b,chain:u(b.chain,t,-1)}),children:"위"}),(0,a.jsx)(i.$,{type:"button",size:"sm",variant:"outline","aria-label":"".concat(t+1," 아래로"),disabled:t===b.chain.length-1,onClick:()=>g({...b,chain:u(b.chain,t,1)}),children:"아래"})]}),(0,a.jsx)(i.$,{type:"button",size:"sm",variant:"outline","aria-label":"".concat(t+1," 빼기"),onClick:()=>g({...b,chain:b.chain.filter((e,l)=>l!==t)}),children:"빼기"})]},"".concat(e.provider,"-").concat(t))),(0,a.jsx)(i.$,{type:"button",size:"sm",variant:"outline","data-testid":"child-llm-add",onClick:()=>{var e;return g({...b,chain:[...b.chain,{provider:null!=(e=F[0])?e:"grok"}]})},children:"추가"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:"child-llm-headroom",className:"text-sm font-medium",children:"예산 여유 %"}),(0,a.jsx)(s.p,{id:"child-llm-headroom","data-testid":"child-llm-headroom",inputMode:"numeric",value:b.minHeadroomPercent,onChange:e=>g({...b,minHeadroomPercent:e.target.value})})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("label",{htmlFor:"child-llm-shortfall",className:"text-sm font-medium",children:"모자랄 때"}),(0,a.jsx)("select",{id:"child-llm-shortfall","data-testid":"child-llm-shortfall",value:b.onShortfall,onChange:e=>g({...b,onShortfall:e.target.value}),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 text-sm",children:c.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,a.jsx)(i.$,{type:"button",size:"sm","data-testid":"child-llm-save",onClick:()=>void H(),disabled:N,children:"저장"}),w&&(0,a.jsx)("p",{role:"status",className:"text-xs","data-testid":"child-llm-saved",children:w}),S&&(0,a.jsx)("p",{role:"alert",className:"text-xs text-destructive","data-testid":"child-llm-error",children:S})]})}},41640:(e,t,l)=>{l.d(t,{Q:()=>c});var a=l(58443),r=l(77947),i=l(19990),s=l(62866),n=l(75391);function d(e){if(e instanceof n.Iu&&e.body&&"object"==typeof e.body){var t,l;let a=e.body;return null!=(l=null!=(t=a.reason)?t:a.error)?l:e.message}return e instanceof Error?e.message:String(e)}function c(){var e,t;let{client:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,s.Qj)(),c=null!=l?l:n,[o,u]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[x,f]=(0,r.useState)(!1),[p,v]=(0,r.useState)(""),[b,g]=(0,r.useState)(!1),j=(0,r.useCallback)(async()=>{if(c)try{let e=await c.getAnswerPriority();u(e),h(e.effective),v("")}catch(e){v(d(e))}},[c]);(0,r.useEffect)(()=>{j()},[j]);let y=async()=>{if(c&&m){f(!0),g(!1),v("");try{let e=await c.setAnswerPriority(m);u(t=>t&&{...t,value:e.value,effective:e.value}),g(!0)}catch(e){v(d(e))}finally{f(!1)}}};return(0,a.jsxs)("section",{className:"space-y-4 rounded border border-border bg-card p-4","data-testid":"answer-depth-card",children:[(0,a.jsxs)("header",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"답변 깊이"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"한 번 답할 때 도구를 얼마나 깊게 사용할지 선택하세요."})]}),o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("fieldset",{className:"space-y-2",children:[(0,a.jsxs)("legend",{className:"text-sm font-medium",children:["현재 값: ",null!=(t=null==(e=o.choices.find(e=>e.value===o.effective))?void 0:e.label)?t:o.effective]}),o.choices.map(e=>(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 text-sm",children:[(0,a.jsx)("input",{type:"radio",name:"answer-depth",value:e.value,checked:m===e.value,onChange:()=>{h(e.value),g(!1)}}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"font-medium",children:e.label}),(0,a.jsx)("span",{className:"block text-xs text-muted-foreground",children:e.description})]})]},e.value))]}),(0,a.jsx)(i.$,{type:"button",size:"sm",onClick:()=>void y(),disabled:x||!m,children:"저장"}),b&&(0,a.jsx)("p",{role:"status",className:"text-xs",children:"저장했습니다."})]}),p&&(0,a.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:p})]})}},62866:(e,t,l)=>{l.d(t,{M1:()=>c,Qj:()=>o,tI:()=>d});var a=l(58443),r=l(77947),i=l(93741),s=l(66328);let n=(0,r.createContext)(null);function d(e){let{client:t,queryClient:l,defaultStaleTimeMs:d,children:c}=e,o=(0,r.useMemo)(()=>null!=l?l:new i.E({defaultOptions:{queries:{staleTime:null!=d?d:2e3,refetchOnWindowFocus:!1}}}),[l,d]);return(0,a.jsx)(n.Provider,{value:t,children:(0,a.jsx)(s.Ht,{client:o,children:c})})}function c(){let e=(0,r.useContext)(n);if(!e)throw Error("useNexusClient must be used within <NexusProvider>");return e}function o(){return(0,r.useContext)(n)}},65534:(e,t,l)=>{l.d(t,{p:()=>s});var a=l(58443);l(77947);var r=l(14240),i=l(49413);function s(e){let{className:t,type:l,...s}=e;return(0,a.jsx)(r.p,{type:l,"data-slot":"input",className:(0,i.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...s})}}}]);