@xopcai/xopc 0.0.129 → 0.0.131

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 (178) hide show
  1. package/dist/browser-ext/icons/icon-128.png +0 -0
  2. package/dist/browser-ext/icons/icon-16.png +0 -0
  3. package/dist/browser-ext/icons/icon-32.png +0 -0
  4. package/dist/browser-ext/icons/icon-48.png +0 -0
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/apple-touch-icon.png +0 -0
  8. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DHzfg5D-.js → agent-avatar-dicebear-BJYeTxQ9.js} +1 -1
  9. package/dist/gateway/static/root/assets/agents-kVsY4Iz_.js +2 -0
  10. package/dist/gateway/static/root/assets/app-management-settings-panel-Bj8iJ-7d.js +1 -0
  11. package/dist/gateway/static/root/assets/{appearance-settings-bYeEj3IW.js → appearance-settings-6TjISbHB.js} +1 -1
  12. package/dist/gateway/static/root/assets/apps-page-DC4YwXLL.js +1 -0
  13. package/dist/gateway/static/root/assets/{archive-plugin-Dy6lsTHw.js → archive-plugin-2G62raBg.js} +1 -1
  14. package/dist/gateway/static/root/assets/{attachment-load-qOtBYR6Y.js → attachment-load-kLNJMEJh.js} +1 -1
  15. package/dist/gateway/static/root/assets/{automation-suggestion-card-BFH-RfaV.js → automation-suggestion-card-CpcZSSD8.js} +1 -1
  16. package/dist/gateway/static/root/assets/automations-page-MZ8m4bYP.js +4 -0
  17. package/dist/gateway/static/root/assets/{binary-plugins-DJvi_thc.js → binary-plugins-C_zSrWow.js} +1 -1
  18. package/dist/gateway/static/root/assets/{block-editor-DlMnizlt.js → block-editor-D_PMrT-l.js} +4 -4
  19. package/dist/gateway/static/root/assets/browser-settings-page-C89wKfPd.js +8 -0
  20. package/dist/gateway/static/root/assets/capability-presets-api-CPFtajl7.js +1 -0
  21. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Dng8Grpv.js → capability-presets-settings-panel-DWw31-4v.js} +1 -1
  22. package/dist/gateway/static/root/assets/channel-recipient-api-BUi8syv2.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-settings-DOYzcMAE.js +1 -0
  24. package/dist/gateway/static/root/assets/connectors-page-DCE-PgQF.js +2 -0
  25. package/dist/gateway/static/root/assets/desktop-pet-BYV16wez.js +1 -0
  26. package/dist/gateway/static/root/assets/{desktop-pet-settings-B-u63N4e.js → desktop-pet-settings-DGIaFqPR.js} +1 -1
  27. package/dist/gateway/static/root/assets/{directory-picker-path-field-8p1ehIHn.js → directory-picker-path-field-BEhDuShd.js} +1 -1
  28. package/dist/gateway/static/root/assets/dreaming-settings-BIkgLFDH.js +3 -0
  29. package/dist/gateway/static/root/assets/{extension-debug-page-DJ1ABK95.js → extension-debug-page-BIjLZMAQ.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-page-CP9P2lGM.js → extension-page-Cxv4Bgj5.js} +1 -1
  31. package/dist/gateway/static/root/assets/extension-settings-page-DNd0tRFl.js +1 -0
  32. package/dist/gateway/static/root/assets/fetch-Bl7zMnmd.js +1 -0
  33. package/dist/gateway/static/root/assets/gateway-config-api-BiqKIkkp.js +1 -0
  34. package/dist/gateway/static/root/assets/gateway-settings-D_Cvasqi.js +1 -0
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-CY5W2Pp4.js → gateway-startup-retry-CPOgTcpv.js} +1 -1
  36. package/dist/gateway/static/root/assets/{goal-create-dialog-2lPbGfp3.js → goal-create-dialog-DZ68qzpm.js} +1 -1
  37. package/dist/gateway/static/root/assets/goal-detail-page-DF8QhTHH.js +4 -0
  38. package/dist/gateway/static/root/assets/goals-config-api-h26_-2Vm.js +1 -0
  39. package/dist/gateway/static/root/assets/goals-page-BzBKHZJg.js +2 -0
  40. package/dist/gateway/static/root/assets/goals-settings-BFG1uTI8.js +1 -0
  41. package/dist/gateway/static/root/assets/heartbeat-settings-5vV8vTva.js +1 -0
  42. package/dist/gateway/static/root/assets/index-DOetFpTt.js +262 -0
  43. package/dist/gateway/static/root/assets/index-W4ogAiHt.css +1 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BrENZzM7.js → keyboard-shortcuts-settings-Dpx1ovO6.js} +1 -1
  45. package/dist/gateway/static/root/assets/logs-page-3QO3elfx.js +7 -0
  46. package/dist/gateway/static/root/assets/{markdown-split-BYF4ReGM.js → markdown-split-Ba4EsPkV.js} +1 -1
  47. package/dist/gateway/static/root/assets/{media-plugins-CpQDz-QJ.js → media-plugins-lA5rvtCq.js} +1 -1
  48. package/dist/gateway/static/root/assets/{messages-YzjnURPJ.js → messages-Bq4REfIj.js} +2 -2
  49. package/dist/gateway/static/root/assets/models-hub-panel-BBG87CHZ.js +2 -0
  50. package/dist/gateway/static/root/assets/notes-page-DrUGE-Hn.js +1 -0
  51. package/dist/gateway/static/root/assets/notes-workbench-eAIE8iKV.js +2 -0
  52. package/dist/gateway/static/root/assets/{page-tabs-RnYYOIWO.js → page-tabs-Cy7bX7Ce.js} +1 -1
  53. package/dist/gateway/static/root/assets/{preview-open-alternatives-CTRt06Ri.js → preview-open-alternatives-B9_iql49.js} +1 -1
  54. package/dist/gateway/static/root/assets/project-detail-page-Cwct6pCV.js +1 -0
  55. package/dist/gateway/static/root/assets/projects-page-BXZlzV8t.js +1 -0
  56. package/dist/gateway/static/root/assets/remote-access-hub-C29EWM0P.js +1 -0
  57. package/dist/gateway/static/root/assets/{save-bar-controls-c4pZeikq.js → save-bar-controls-nMloZ0mp.js} +1 -1
  58. package/dist/gateway/static/root/assets/{schedule-field-Cb6R7iuP.js → schedule-field-BuajpVNF.js} +1 -1
  59. package/dist/gateway/static/root/assets/{schema-form-BqET_hEP.js → schema-form-IeXV_yQk.js} +1 -1
  60. package/dist/gateway/static/root/assets/sessions-page-DHHVDqsy.js +1 -0
  61. package/dist/gateway/static/root/assets/settings-advanced-gate-hDvmobsT.js +1 -0
  62. package/dist/gateway/static/root/assets/{settings-collapsible-section-DuOvqNsI.js → settings-collapsible-section-ByixWwvu.js} +1 -1
  63. package/dist/gateway/static/root/assets/{settings-form-section-DptSsbWd.js → settings-form-section-C-5-n-jM.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BlVfBCb9.js → settings-loading-skeleton-CTA5Gje4.js} +1 -1
  65. package/dist/gateway/static/root/assets/settings-page-DzqxeemF.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-page-layout-DVt69dJJ.js → settings-page-layout-DgFTf6nM.js} +1 -1
  67. package/dist/gateway/static/root/assets/setup-status-panel-svpHcJ62.js +1 -0
  68. package/dist/gateway/static/root/assets/share-preview-page-IOjU69FC.js +2 -0
  69. package/dist/gateway/static/root/assets/shares-settings-Ddg8gHPN.js +1 -0
  70. package/dist/gateway/static/root/assets/skill-reload-api-DcNOEJsK.js +1 -0
  71. package/dist/gateway/static/root/assets/skills-page-DoonnYRs.js +2 -0
  72. package/dist/gateway/static/root/assets/{system-settings-panel-CW22OkZ4.js → system-settings-panel-BMDD7FXg.js} +1 -1
  73. package/dist/gateway/static/root/assets/{typed-models-lib-BqpGAKxV.js → typed-models-lib-DayamJ56.js} +1 -1
  74. package/dist/gateway/static/root/assets/use-channel-catalog-ChYwFiqo.js +1 -0
  75. package/dist/gateway/static/root/assets/{user-profile-settings-panel-CERVLuaW.js → user-profile-settings-panel-Dd0X3mPv.js} +1 -1
  76. package/dist/gateway/static/root/assets/{utils-BnmysurA.js → utils-D9v9ZpK4.js} +1 -1
  77. package/dist/gateway/static/root/assets/voice-api-key-field-QXGvjTwa.js +1 -0
  78. package/dist/gateway/static/root/assets/work-item-detail-page-CP-5OUYI.js +1 -0
  79. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Ci9GSPnS.js → workflow-run-setup-panel-IidqhbUI.js} +2 -2
  80. package/dist/gateway/static/root/assets/{workflow-start-dialog-BhDj8pqH.js → workflow-start-dialog-BQQkr8YD.js} +1 -1
  81. package/dist/gateway/static/root/assets/workflows-page-DtVIjVSX.js +18 -0
  82. package/dist/gateway/static/root/favicon-16x16.png +0 -0
  83. package/dist/gateway/static/root/favicon-32x32.png +0 -0
  84. package/dist/gateway/static/root/favicon-icon.svg +23 -1
  85. package/dist/gateway/static/root/favicon.ico +0 -0
  86. package/dist/gateway/static/root/favicon.png +0 -0
  87. package/dist/gateway/static/root/favicon.svg +20 -24
  88. package/dist/gateway/static/root/index.html +11 -11
  89. package/dist/gateway/static/root/logo-dark.svg +18 -23
  90. package/dist/gateway/static/root/logo.svg +18 -24
  91. package/dist/gateway/static/root/pwa-192x192.png +0 -0
  92. package/dist/gateway/static/root/pwa-512x512.png +0 -0
  93. package/dist/gateway/static/root/site.webmanifest +23 -0
  94. package/dist/package.js +1 -1
  95. package/dist/src/cli/commands/gateway/probe.js +6 -6
  96. package/dist/src/cli/commands/gateway/probe.js.map +1 -1
  97. package/dist/src/cli/commands/onboard.js +2 -2
  98. package/dist/src/cli/commands/onboard.js.map +1 -1
  99. package/dist/src/cli/commands/tui.js +11 -4
  100. package/dist/src/cli/commands/tui.js.map +1 -1
  101. package/dist/src/cli/utils/gateway-client-options.d.ts +3 -0
  102. package/dist/src/cli/utils/gateway-client-options.js +2 -1
  103. package/dist/src/cli/utils/gateway-client-options.js.map +1 -1
  104. package/dist/src/cli/utils/gateway-client.d.ts +6 -3
  105. package/dist/src/cli/utils/gateway-client.js +14 -8
  106. package/dist/src/cli/utils/gateway-client.js.map +1 -1
  107. package/dist/src/gateway/credential.d.ts +9 -0
  108. package/dist/src/gateway/credential.js +16 -0
  109. package/dist/src/gateway/credential.js.map +1 -0
  110. package/dist/src/gateway/hono/app.d.ts +0 -1
  111. package/dist/src/gateway/hono/app.js +2 -9
  112. package/dist/src/gateway/hono/app.js.map +1 -1
  113. package/dist/src/gateway/hono/middleware/auth.d.ts +0 -2
  114. package/dist/src/gateway/hono/middleware/auth.js +46 -21
  115. package/dist/src/gateway/hono/middleware/auth.js.map +1 -1
  116. package/dist/src/gateway/hono/routes/sessions.js +2 -27
  117. package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
  118. package/dist/src/gateway/server.js +1 -5
  119. package/dist/src/gateway/server.js.map +1 -1
  120. package/dist/src/mcp/channel-bridge.d.ts +2 -1
  121. package/dist/src/mcp/channel-bridge.js +10 -6
  122. package/dist/src/mcp/channel-bridge.js.map +1 -1
  123. package/dist/src/mcp/channel-server.d.ts +2 -1
  124. package/dist/src/mcp/channel-server.js +1 -1
  125. package/dist/src/mcp/channel-server.js.map +1 -1
  126. package/dist/src/mcp/gateway-http-client.d.ts +3 -2
  127. package/dist/src/mcp/gateway-http-client.js +9 -7
  128. package/dist/src/mcp/gateway-http-client.js.map +1 -1
  129. package/dist/src/tui/backends/gateway-sse-backend.d.ts +3 -2
  130. package/dist/src/tui/backends/gateway-sse-backend.js +45 -41
  131. package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
  132. package/dist/src/tui/tui-types.d.ts +3 -2
  133. package/dist/src/tui/tui-types.js.map +1 -1
  134. package/dist/src/tui/tui.js +1 -1
  135. package/dist/src/tui/tui.js.map +1 -1
  136. package/package.json +5 -2
  137. package/dist/gateway/static/root/assets/agents-CMxKKFQD.js +0 -2
  138. package/dist/gateway/static/root/assets/app-management-settings-panel-ptk9c5BN.js +0 -1
  139. package/dist/gateway/static/root/assets/apps-page-DdZvDf5B.js +0 -1
  140. package/dist/gateway/static/root/assets/automations-page-B8JTjkCr.js +0 -4
  141. package/dist/gateway/static/root/assets/browser-settings-page-slHLiZgi.js +0 -8
  142. package/dist/gateway/static/root/assets/capability-presets-api-D4q7vHVJ.js +0 -1
  143. package/dist/gateway/static/root/assets/channel-recipient-api-BrW5Kcgc.js +0 -1
  144. package/dist/gateway/static/root/assets/channels-settings-KIsISXw0.js +0 -1
  145. package/dist/gateway/static/root/assets/connectors-page-C5fx4Qs9.js +0 -2
  146. package/dist/gateway/static/root/assets/desktop-pet-Jmdn6q47.js +0 -1
  147. package/dist/gateway/static/root/assets/dreaming-settings-CCkKP-I4.js +0 -3
  148. package/dist/gateway/static/root/assets/extension-settings-page-DnhU-tx0.js +0 -1
  149. package/dist/gateway/static/root/assets/fetch-BMjlW0g1.js +0 -1
  150. package/dist/gateway/static/root/assets/gateway-config-api-CjxDn46s.js +0 -1
  151. package/dist/gateway/static/root/assets/gateway-settings-TING7224.js +0 -1
  152. package/dist/gateway/static/root/assets/goal-detail-page-DHWVRafk.js +0 -4
  153. package/dist/gateway/static/root/assets/goals-config-api-BqhuxG8P.js +0 -1
  154. package/dist/gateway/static/root/assets/goals-page-CMk-9ZYN.js +0 -2
  155. package/dist/gateway/static/root/assets/goals-settings-BHzOAU_l.js +0 -1
  156. package/dist/gateway/static/root/assets/heartbeat-settings-BQIm0P3V.js +0 -1
  157. package/dist/gateway/static/root/assets/index-C4k6QSXw.js +0 -257
  158. package/dist/gateway/static/root/assets/index-EKmpPvZj.css +0 -1
  159. package/dist/gateway/static/root/assets/logs-page-BiL302Ve.js +0 -2
  160. package/dist/gateway/static/root/assets/models-hub-panel-CFPpl3Cq.js +0 -2
  161. package/dist/gateway/static/root/assets/notes-page-BurgcdVZ.js +0 -1
  162. package/dist/gateway/static/root/assets/notes-workbench-BAELRM_O.js +0 -2
  163. package/dist/gateway/static/root/assets/project-detail-page-iXX1Ceo2.js +0 -1
  164. package/dist/gateway/static/root/assets/projects-page-GDVTFAY7.js +0 -1
  165. package/dist/gateway/static/root/assets/remote-access-hub-BUrbUnwv.js +0 -1
  166. package/dist/gateway/static/root/assets/sessions-page-CiOreA2k.js +0 -1
  167. package/dist/gateway/static/root/assets/settings-advanced-gate-C-qvptlu.js +0 -1
  168. package/dist/gateway/static/root/assets/settings-page-xQx2Pkg5.js +0 -1
  169. package/dist/gateway/static/root/assets/setup-status-panel-DWB8VdLK.js +0 -1
  170. package/dist/gateway/static/root/assets/share-preview-page-8m_ACH0z.js +0 -2
  171. package/dist/gateway/static/root/assets/shares-settings-CgxfhNxI.js +0 -1
  172. package/dist/gateway/static/root/assets/skill-reload-api-BBFUOxmf.js +0 -1
  173. package/dist/gateway/static/root/assets/skills-page-bo695odu.js +0 -2
  174. package/dist/gateway/static/root/assets/url-DFGNSBNT.js +0 -1
  175. package/dist/gateway/static/root/assets/use-channel-catalog-CPdJ0o0i.js +0 -1
  176. package/dist/gateway/static/root/assets/voice-api-key-field-Jr3jvPcB.js +0 -1
  177. package/dist/gateway/static/root/assets/work-item-detail-page-B-8rex4u.js +0 -1
  178. package/dist/gateway/static/root/assets/workflows-page-Brb3UGvs.js +0 -18
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{t as i}from"./messages-YzjnURPJ.js";import{n as a}from"./locale-store-Ba72bFmP.js";import{Dt as o,Ja as s,Mr as c,Nr as l,gs as u,kc as d,rs as f,xo as p}from"./index-C4k6QSXw.js";import{n as m,t as h}from"./settings-page-layout-DVt69dJJ.js";import{r as g,t as _}from"./settings-form-section-DptSsbWd.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(o,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{s()&&R&&z()},[R,z]),!s()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&c()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await l(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(f,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,p.press),onClick:()=>void B(),children:[(0,y.jsx)(u,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],s=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),s?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,p.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(d,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{t as i}from"./messages-Bq4REfIj.js";import{n as a}from"./locale-store-Ba72bFmP.js";import{Ar as o,Dc as s,Ka as c,Tt as l,jr as u,ms as d,ts as f,vo as p}from"./index-DOetFpTt.js";import{n as m,t as h}from"./settings-page-layout-DgFTf6nM.js";import{r as g,t as _}from"./settings-form-section-C-5-n-jM.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(l,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&o()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(f,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,p.press),onClick:()=>void B(),children:[(0,y.jsx)(d,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,p.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(s,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
@@ -1 +1 @@
1
- import{t as e}from"./cn-BQ_8x0bT.js";import{Eo as t,To as n,wo as r}from"./index-C4k6QSXw.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(n,r)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
1
+ import{t as e}from"./cn-BQ_8x0bT.js";import{Co as t,So as n,xo as r}from"./index-DOetFpTt.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(n,r)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./vendor-react-BOUWij0V.js";import{n as t,o as n}from"./fetch-Bl7zMnmd.js";import{i as r}from"./vendor-swr-BIWyz7Rc.js";var i=e();function a(e){return n(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function o(e){return(await t(a(e))).payload?.channels??[]}function s(e,t){let n=(0,i.c)(14),s;n[0]!==e||n[1]!==t?(s=e?a(t):null,n[0]=e,n[1]=t,n[2]=s):s=n[2];let c;n[3]===t?c=n[4]:(c=()=>o(t),n[3]=t,n[4]=c);let l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={revalidateOnFocus:!1},n[5]=l):l=n[5];let{data:u,error:d,isLoading:f,isValidating:p,mutate:m}=r(s,c,l),h;n[6]===u?h=n[7]:(h=u??[],n[6]=u,n[7]=h);let g;return n[8]!==d||n[9]!==f||n[10]!==p||n[11]!==m||n[12]!==h?(g={entries:h,isLoading:f,isValidating:p,error:d,mutate:m},n[8]=d,n[9]=f,n[10]=p,n[11]=m,n[12]=h,n[13]=g):g=n[13],g}export{s as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-YzjnURPJ.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{Bt as s,Do as c,Ht as l,It as u,Lt as d,Pt as f,_a as p,io as m,ir as h,lr as g,no as _,oc as v,ps as y,qc as b,xo as x}from"./index-C4k6QSXw.js";import{n as S,t as C}from"./settings-page-layout-DVt69dJJ.js";import{n as w,t as T}from"./settings-form-section-DptSsbWd.js";import{t as E}from"./utils-BnmysurA.js";var D=n(),O=e(t(),1),k=r(),A={callName:``,pronouns:``,timezone:``,notes:``};function j(e){if(e.timezone)return e;let t=d();return t?{...e,timezone:t}:e}function M(){let e=(0,D.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,k.jsxs)(`div`,{className:`grid gap-2`,children:[(0,k.jsx)(p,{className:`h-4 w-24`}),(0,k.jsx)(p,{className:`h-10 rounded-lg`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,k.jsxs)(`div`,{className:`grid gap-2`,children:[(0,k.jsx)(p,{className:`h-4 w-24`}),(0,k.jsx)(p,{className:`h-10 rounded-lg`})]}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,k.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"aria-hidden":`true`,children:[t,n,(0,k.jsxs)(`div`,{className:`grid gap-2 sm:col-span-2`,children:[(0,k.jsx)(p,{className:`h-4 w-28`}),(0,k.jsx)(p,{className:`h-28 rounded-lg`})]})]}),e[2]=r):r=e[2],r}function N(){let e=o(e=>e.language),t=a(e).userProfileSettings,n=E(),[r,p]=(0,O.useState)(A),[D,N]=(0,O.useState)(JSON.stringify(A)),[P,F]=(0,O.useState)(``),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!0),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(!1),[K,q]=(0,O.useState)(null);(0,O.useEffect)(()=>{let e=!1;return V(!0),q(null),h().then(t=>{if(e)return;let n=j(s(t)),r=u.some(e=>e.value===n.timezone),i=!n.pronouns||f.some(e=>e.value===n.pronouns);p(n),N(JSON.stringify(n)),L(!!(n.timezone&&!r)),F(n.timezone&&!r?n.timezone:``),z(!!(n.pronouns&&!i))}).catch(n=>{e||q(n instanceof Error?n.message:t.loadError)}).finally(()=>{e||V(!1)}),()=>{e=!0}},[t.loadError]);let J=JSON.stringify(r)!==D,Y=(0,O.useCallback)((t,n)=>e===`zh`?n:t,[e]),X=(0,O.useCallback)(e=>{p(t=>({...t,...e})),G(!1)},[]),Z=(0,O.useMemo)(()=>I?`__custom__`:u.some(e=>e.value===r.timezone)?r.timezone:`__custom__`,[I,r.timezone]),Q=(0,O.useCallback)(e=>{if(e===`__custom__`){L(!0);return}L(!1),F(``),X({timezone:e})},[X]),$=(0,O.useCallback)(()=>{let e=d();if(!e)return;let t=u.some(t=>t.value===e);L(!t),F(t?``:e),X({timezone:e})},[X]);async function ee(){U(!0),q(null);try{await g(l(r)),N(JSON.stringify(r)),G(!0)}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{U(!1)}}return(0,k.jsxs)(C,{gap:`gap-6`,children:[(0,k.jsx)(S,{title:t.title,subtitle:t.subtitle,actions:(0,k.jsxs)(c,{type:`button`,variant:`primary`,disabled:B||H||!J,onClick:()=>void ee(),children:[(0,k.jsx)(y,{className:`size-4`,"aria-hidden":!0}),H?t.saving:W?t.saved:t.save]})}),(0,k.jsxs)(T,{children:[(0,k.jsx)(w,{icon:b,title:t.sectionTitle,subtitle:t.sectionSubtitle}),B?(0,k.jsx)(M,{}):(0,k.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,k.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.callName}),(0,k.jsx)(`input`,{className:n,value:r.callName,onChange:e=>X({callName:e.target.value}),placeholder:t.callNamePlaceholder,autoComplete:`off`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.pronouns}),(0,k.jsxs)(_,{className:n,value:f.some(e=>e.value===r.pronouns)?r.pronouns:`__custom__`,onChange:e=>{if(e.target.value===`__custom__`){z(!0);return}z(!1),X({pronouns:e.target.value})},children:[(0,k.jsx)(m,{value:``,disabled:!0,children:t.pronounsPlaceholder}),f.map(e=>(0,k.jsx)(m,{value:e.value,children:Y(e.labelEn,e.labelZh)},e.value)),(0,k.jsx)(m,{value:`__custom__`,children:t.custom})]}),R?(0,k.jsx)(`input`,{className:i(n,`mt-1 text-xs`),value:f.some(e=>e.value===r.pronouns)?``:r.pronouns,onChange:e=>X({pronouns:e.target.value}),placeholder:t.pronounsPlaceholder,autoComplete:`off`}):null]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.timezone}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,k.jsxs)(_,{className:i(n,`min-w-0 flex-1`),value:Z,onChange:e=>Q(e.target.value),children:[u.map(e=>(0,k.jsx)(m,{value:e.value,children:Y(e.labelEn,e.labelZh)},e.value)),(0,k.jsx)(m,{value:`__custom__`,children:t.timezoneCustom})]}),(0,k.jsx)(`button`,{type:`button`,className:i(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,x.press),onClick:$,children:t.timezoneDetect})]}),I?(0,k.jsx)(`input`,{className:i(n,`mt-1 font-mono text-xs`),value:P,onChange:e=>{F(e.target.value),X({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null]}),(0,k.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.notes}),(0,k.jsx)(`textarea`,{className:i(n,`min-h-28 resize-y text-sm leading-relaxed`),value:r.notes,onChange:e=>X({notes:e.target.value}),placeholder:t.notesPlaceholder,rows:5,spellCheck:!0})]})]}),(0,k.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-lg bg-accent-soft/30 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,k.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,k.jsx)(`span`,{children:t.note})]}),K?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:K}):null]})]})}export{N as UserProfileSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{$a as s,Bt as c,Ft as l,Gc as u,Mt as d,Pt as f,Rt as p,ds as m,ha as h,ic as g,nr as _,sr as v,to as y,vo as b,wo as x}from"./index-DOetFpTt.js";import{n as S,t as C}from"./settings-page-layout-DgFTf6nM.js";import{n as w,t as T}from"./settings-form-section-C-5-n-jM.js";import{t as E}from"./utils-D9v9ZpK4.js";var D=n(),O=e(t(),1),k=r(),A={callName:``,pronouns:``,timezone:``,notes:``};function j(e){if(e.timezone)return e;let t=l();return t?{...e,timezone:t}:e}function M(){let e=(0,D.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,k.jsxs)(`div`,{className:`grid gap-2`,children:[(0,k.jsx)(h,{className:`h-4 w-24`}),(0,k.jsx)(h,{className:`h-10 rounded-lg`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,k.jsxs)(`div`,{className:`grid gap-2`,children:[(0,k.jsx)(h,{className:`h-4 w-24`}),(0,k.jsx)(h,{className:`h-10 rounded-lg`})]}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,k.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"aria-hidden":`true`,children:[t,n,(0,k.jsxs)(`div`,{className:`grid gap-2 sm:col-span-2`,children:[(0,k.jsx)(h,{className:`h-4 w-28`}),(0,k.jsx)(h,{className:`h-28 rounded-lg`})]})]}),e[2]=r):r=e[2],r}function N(){let e=o(e=>e.language),t=a(e).userProfileSettings,n=E(),[r,h]=(0,O.useState)(A),[D,N]=(0,O.useState)(JSON.stringify(A)),[P,F]=(0,O.useState)(``),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!0),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(!1),[K,q]=(0,O.useState)(null);(0,O.useEffect)(()=>{let e=!1;return V(!0),q(null),_().then(t=>{if(e)return;let n=j(p(t)),r=f.some(e=>e.value===n.timezone),i=!n.pronouns||d.some(e=>e.value===n.pronouns);h(n),N(JSON.stringify(n)),L(!!(n.timezone&&!r)),F(n.timezone&&!r?n.timezone:``),z(!!(n.pronouns&&!i))}).catch(n=>{e||q(n instanceof Error?n.message:t.loadError)}).finally(()=>{e||V(!1)}),()=>{e=!0}},[t.loadError]);let J=JSON.stringify(r)!==D,Y=(0,O.useCallback)((t,n)=>e===`zh`?n:t,[e]),X=(0,O.useCallback)(e=>{h(t=>({...t,...e})),G(!1)},[]),Z=(0,O.useMemo)(()=>I?`__custom__`:f.some(e=>e.value===r.timezone)?r.timezone:`__custom__`,[I,r.timezone]),Q=(0,O.useCallback)(e=>{if(e===`__custom__`){L(!0);return}L(!1),F(``),X({timezone:e})},[X]),$=(0,O.useCallback)(()=>{let e=l();if(!e)return;let t=f.some(t=>t.value===e);L(!t),F(t?``:e),X({timezone:e})},[X]);async function ee(){U(!0),q(null);try{await v(c(r)),N(JSON.stringify(r)),G(!0)}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{U(!1)}}return(0,k.jsxs)(C,{gap:`gap-6`,children:[(0,k.jsx)(S,{title:t.title,subtitle:t.subtitle,actions:(0,k.jsxs)(x,{type:`button`,variant:`primary`,disabled:B||H||!J,onClick:()=>void ee(),children:[(0,k.jsx)(m,{className:`size-4`,"aria-hidden":!0}),H?t.saving:W?t.saved:t.save]})}),(0,k.jsxs)(T,{children:[(0,k.jsx)(w,{icon:u,title:t.sectionTitle,subtitle:t.sectionSubtitle}),B?(0,k.jsx)(M,{}):(0,k.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,k.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.callName}),(0,k.jsx)(`input`,{className:n,value:r.callName,onChange:e=>X({callName:e.target.value}),placeholder:t.callNamePlaceholder,autoComplete:`off`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.pronouns}),(0,k.jsxs)(s,{className:n,value:d.some(e=>e.value===r.pronouns)?r.pronouns:`__custom__`,onChange:e=>{if(e.target.value===`__custom__`){z(!0);return}z(!1),X({pronouns:e.target.value})},children:[(0,k.jsx)(y,{value:``,disabled:!0,children:t.pronounsPlaceholder}),d.map(e=>(0,k.jsx)(y,{value:e.value,children:Y(e.labelEn,e.labelZh)},e.value)),(0,k.jsx)(y,{value:`__custom__`,children:t.custom})]}),R?(0,k.jsx)(`input`,{className:i(n,`mt-1 text-xs`),value:d.some(e=>e.value===r.pronouns)?``:r.pronouns,onChange:e=>X({pronouns:e.target.value}),placeholder:t.pronounsPlaceholder,autoComplete:`off`}):null]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.timezone}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,k.jsxs)(s,{className:i(n,`min-w-0 flex-1`),value:Z,onChange:e=>Q(e.target.value),children:[f.map(e=>(0,k.jsx)(y,{value:e.value,children:Y(e.labelEn,e.labelZh)},e.value)),(0,k.jsx)(y,{value:`__custom__`,children:t.timezoneCustom})]}),(0,k.jsx)(`button`,{type:`button`,className:i(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,b.press),onClick:$,children:t.timezoneDetect})]}),I?(0,k.jsx)(`input`,{className:i(n,`mt-1 font-mono text-xs`),value:P,onChange:e=>{F(e.target.value),X({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null]}),(0,k.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.notes}),(0,k.jsx)(`textarea`,{className:i(n,`min-h-28 resize-y text-sm leading-relaxed`),value:r.notes,onChange:e=>X({notes:e.target.value}),placeholder:t.notesPlaceholder,rows:5,spellCheck:!0})]})]}),(0,k.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-lg bg-accent-soft/30 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,k.jsx)(g,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,k.jsx)(`span`,{children:t.note})]}),K?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:K}):null]})]})}export{N as UserProfileSettingsPanel};
@@ -1 +1 @@
1
- import{t as e}from"./cn-BQ_8x0bT.js";import{Eo as t}from"./index-C4k6QSXw.js";function n(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function r(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function i(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}export{i as n,r,n as t};
1
+ import{t as e}from"./cn-BQ_8x0bT.js";import{Co as t}from"./index-DOetFpTt.js";function n(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function r(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function i(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}export{i as n,r,n as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{a,n as o,o as s}from"./fetch-Bl7zMnmd.js";import{o as c}from"./vendor-swr-BIWyz7Rc.js";import{$a as l,Co as u,Dc as d,Gt as f,Us as p,Wt as m,ds as h,ln as g,ma as _,pa as v,po as y,tl as b,to as x,wo as ee,xl as te}from"./index-DOetFpTt.js";var S=`/api/image/providers`;async function C(){return(await o(s(`/api/image/providers`)))?.payload?.providers??[]}var w=e(t(),1),ne=n();function T(){return{apiKey:``,region:``,baseUrl:``,imageBaseUrl:``}}function re(e){return e?.apiKey?`••••••••••••`:``}function E(e,t){let n=(()=>{if(!e||typeof e!=`object`||!(`providersConfig`in e))return;let t=e.providersConfig;if(!(!t||typeof t!=`object`||Array.isArray(t)))return t})(),r={};for(let e of t){let t=n?.[e];r[e]={apiKey:re(t),region:t?.region??``,baseUrl:t?.baseUrl??``,imageBaseUrl:t?.imageBaseUrl??``}}return r}function D(e,t,n){let r=e[n].trim();if(r!==t[n].trim())return r||null}function O(e,t){let n=e.trim(),r=t.trim();if(n!==r&&!(g(n)&&g(r)))return n||(r?null:void 0)}function ie(e,t,n){let r={};for(let i of e){let e=t[i]??T(),a=n[i]??T();if(JSON.stringify(e)===JSON.stringify(a))continue;let o={},s=O(e.apiKey,a.apiKey);s!==void 0&&(o.apiKey=s);let c=D(e,a,`region`);c!==void 0&&(o.region=c);let l=D(e,a,`baseUrl`);l!==void 0&&(o.baseUrl=l);let u=D(e,a,`imageBaseUrl`);u!==void 0&&(o.imageBaseUrl=u),Object.keys(o).length>0&&(r[i]=o)}return r}async function k(e){let t=await o(s(`/api/image/providers/${encodeURIComponent(e)}/reveal-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}async function ae(e){Object.keys(e).length!==0&&(await o(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({providersConfig:e})}),await v())}var A=r();function oe(e){let t=(0,ne.c)(18),{providerId:n,value:r,onChange:i,labels:a,apiKeyLinks:o,apiKeyLinkLabels:s}=e,c;t[0]===n?c=t[1]:(c=()=>k(n).then(j),t[0]=n,t[1]=c);let l=c,u=`img-cred-key-${n}`,p;t[2]!==a.apiKeyLabel||t[3]!==u?(p=(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:u,children:a.apiKeyLabel}),t[2]=a.apiKeyLabel,t[3]=u,t[4]=p):p=t[4];let m;t[5]!==s||t[6]!==o?(m=o.length>0?(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[f(e.kind,s),(0,A.jsx)(d,{className:`size-3`,"aria-hidden":!0})]},`${e.kind}-${e.href}`))}):null,t[5]=s,t[6]=o,t[7]=m):m=t[7];let h=`img-cred-key-${n}`,g;t[8]!==a||t[9]!==i||t[10]!==l||t[11]!==h||t[12]!==r?(g=(0,A.jsx)(y,{id:h,value:r,onChange:i,placeholder:a.optionalPlaceholder,labels:a,reveal:l,loadFailedLabel:a.loadFailed,maskedHelp:a.maskedHelp,notInConfigFile:a.notInConfigFile}),t[8]=a,t[9]=i,t[10]=l,t[11]=h,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==p||t[15]!==m||t[16]!==g?(_=(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[p,m,g]}),t[14]=p,t[15]=m,t[16]=g,t[17]=_):_=t[17],_}function j(e){return e.apiKey??null}function M(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,u)}function se(){return i(M(),`appearance-none bg-[length:1rem] bg-[right_0.5rem_center] bg-no-repeat pr-9`)}var N=`__custom__`;function ce(e,t){if(!e.region.trim()&&!e.imageBaseUrl.trim())return``;let n=e.region.trim().toLowerCase();return t.some(e=>e.value===n)?n:N}function le(e,t){let n=e.baseUrl.trim().replace(/\/+$/,``);if(!n)return``;let r=t.map(e=>e.value.replace(/\/+$/,``)).indexOf(n);return r>=0?t[r].value:N}function ue(e,t,n){return t===`beijing`?e.dashscopeRegion_beijing:t===`singapore`?e.dashscopeRegion_singapore:t===`us`?e.dashscopeRegion_us:n}function de(e,t){return t===`minimax`?e.minimaxClusterLabel:t===`fal`?e.falQueueBaseLabel:e.baseUrlLabel}function fe(e,t){return t===`minimax`?e.minimaxClusterHint:t===`fal`?e.falQueueBaseHint:null}function pe(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function me(e,t){return t===1?e.modelCountOne:e.modelCountMany.replace(`{count}`,String(t))}function P(e){let t=(0,ne.c)(76),{summaries:n,credDraft:r,credBaseline:a,credDirty:o,credSaving:s,credError:c,credSavedFlash:u,credNoopFlash:f,updateCredRow:g,onDiscardCredentials:_,onSaveCredentials:v,extensionIds:y,showExtensionLinks:S,showImageModelsLink:C,hideActions:re,language:E,apiKeyLinkLabels:D,messages:O}=e,ie=re===void 0?!1:re,k;t[0]===n?k=t[1]:(k=n.some(ye),t[0]=n,t[1]=k);let ae=k,j;t[2]===n?j=t[3]:(j=n.some(ve),t[2]=n,t[3]=j);let P=j,[F,be]=(0,w.useState)(_e),[I,L]=(0,w.useState)(ge),R;if(t[4]!==a||t[5]!==r||t[6]!==n){R=new Set;for(let e of n)pe(r[e.id]??T(),a[e.id]??T())&&R.add(e.id);t[4]=a,t[5]=r,t[6]=n,t[7]=R}else R=t[7];let z=R,B;t[8]!==z||t[9]!==I||t[10]!==F?(B=e=>I.has(e)?!1:F.has(e)?!0:z.has(e),t[8]=z,t[9]=I,t[10]=F,t[11]=B):B=t[11];let V=B,H;t[12]===V?H=t[13]:(H=e=>{if(V(e)){L(t=>new Set(t).add(e)),be(t=>{let n=new Set(t);return n.delete(e),n});return}L(t=>{let n=new Set(t);return n.delete(e),n}),be(t=>new Set(t).add(e))},t[12]=V,t[13]=H);let U=H;if(n.length===0)return null;let W;t[14]===O.credentialsIntro?W=t[15]:(W=(0,A.jsx)(`p`,{children:O.credentialsIntro}),t[14]=O.credentialsIntro,t[15]=W);let G;t[16]!==ae||t[17]!==O.regionHint?(G=ae?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:O.regionHint}):null,t[16]=ae,t[17]=O.regionHint,t[18]=G):G=t[18];let K;t[19]!==P||t[20]!==O.endpointPresetsHint?(K=P?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:O.endpointPresetsHint}):null,t[19]=P,t[20]=O.endpointPresetsHint,t[21]=K):K=t[21];let q;t[22]!==C||t[23]!==O.imageModelsLinkTitle||t[24]!==O.openImageModelsPage?(q=C?(0,A.jsx)(`p`,{children:(0,A.jsx)(te,{to:`/settings/credentials?tab=image-models`,className:`font-medium text-accent hover:underline`,title:O.imageModelsLinkTitle,children:O.openImageModelsPage})}):null,t[22]=C,t[23]=O.imageModelsLinkTitle,t[24]=O.openImageModelsPage,t[25]=q):q=t[25];let J;t[26]!==W||t[27]!==G||t[28]!==K||t[29]!==q?(J=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs leading-relaxed text-fg-muted`,children:[W,G,K,q]}),t[26]=W,t[27]=G,t[28]=K,t[29]=q,t[30]=J):J=t[30];let Y;t[31]===c?Y=t[32]:(Y=c?(0,A.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:c}):null,t[31]=c,t[32]=Y);let X;t[33]!==o||t[34]!==f||t[35]!==u||t[36]!==s||t[37]!==ie||t[38]!==_||t[39]!==v||t[40]!==O.credentialsNothingToSave||t[41]!==O.credentialsSaved||t[42]!==O.discardCredentials||t[43]!==O.saveCredentials||t[44]!==O.savingCredentials?(X=ie?null:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[u?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:O.credentialsSaved}):null,f?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:O.credentialsNothingToSave}):null,(0,A.jsx)(ee,{type:`button`,variant:`secondary`,onClick:_,disabled:!o||s,children:O.discardCredentials}),(0,A.jsx)(ee,{type:`button`,variant:`primary`,onClick:v,disabled:!o||s,children:s?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(p,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:O.savingCredentials})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(h,{className:`size-3.5`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:O.saveCredentials})]})})]}),t[33]=o,t[34]=f,t[35]=u,t[36]=s,t[37]=ie,t[38]=_,t[39]=v,t[40]=O.credentialsNothingToSave,t[41]=O.credentialsSaved,t[42]=O.discardCredentials,t[43]=O.saveCredentials,t[44]=O.savingCredentials,t[45]=X):X=t[45];let Z;if(t[46]!==D||t[47]!==a||t[48]!==r||t[49]!==y||t[50]!==V||t[51]!==E||t[52]!==S||t[53]!==n||t[54]!==O||t[55]!==U||t[56]!==g){let e;t[58]!==D||t[59]!==a||t[60]!==r||t[61]!==y||t[62]!==V||t[63]!==E||t[64]!==S||t[65]!==O||t[66]!==U||t[67]!==g?(e=e=>{let t=r[e.id]??T(),n=e.ui,o=S&&y.has(e.id)?`/settings/ext/${encodeURIComponent(e.id)}`:null,s=pe(t,a[e.id]??T()),c=V(e.id),u=e.label??e.id,f=me(O,e.models.length);return(0,A.jsxs)(`section`,{className:i(`overflow-hidden rounded-xl bg-surface-panel/80 shadow-surface transition-colors`,s&&`ring-1 ring-accent/50`),children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left hover:bg-surface-hover/70`,"aria-expanded":c,"aria-controls":`img-provider-credentials-${e.id}`,onClick:()=>U(e.id),children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate text-sm font-semibold text-fg`,children:u}),(0,A.jsx)(`span`,{className:`rounded-full bg-surface-subtle px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.id}),s?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:O.unsavedChanges}):null,e.configured?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:O.configured}):(0,A.jsx)(`span`,{className:`rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:O.missingKey})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,A.jsx)(`span`,{children:f}),e.defaultModel?(0,A.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[O.defaultModel,`:`]}),` `,e.id,`/`,e.defaultModel]}):null]})]}),(0,A.jsx)(b,{className:i(`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform`,c?`rotate-180`:`rotate-0`),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`sr-only`,children:c?O.collapseProvider:O.expandProvider})]}),c?(0,A.jsxs)(`div`,{id:`img-provider-credentials-${e.id}`,className:`bg-surface-base/45 px-4 py-4`,children:[o?(0,A.jsxs)(te,{to:o,className:`mb-3 inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,title:O.extensionSettingsLinkTitle,children:[(0,A.jsx)(d,{className:`size-3`}),O.openExtensionSettings]}):null,e.models.length>0?(0,A.jsxs)(`p`,{className:`mb-3 text-xs leading-relaxed text-fg-subtle`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[O.modelsLabel,`:`]}),` `,e.models.map(t=>`${e.id}/${t}`).join(`, `)]}):null,(0,A.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,A.jsx)(oe,{providerId:e.id,value:t.apiKey,onChange:t=>g(e.id,{apiKey:t}),apiKeyLinks:m(e.id,E),apiKeyLinkLabels:D,labels:{apiKeyLabel:O.apiKeyLabel,optionalPlaceholder:O.optionalPlaceholder,maskedHelp:O.apiKeyMaskedHelp,copy:O.apiKeyCopy,copied:O.apiKeyCopied,show:O.apiKeyShow,hide:O.apiKeyHide,notInConfigFile:O.apiKeyNotInConfigFile,loadFailed:O.apiKeyRevealFailed}}),n?.regions?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-region-preset-${e.id}`,children:O.regionLabel}),(0,A.jsxs)(l,{id:`img-cred-region-preset-${e.id}`,className:se(),value:ce(t,n.regions),onChange:t=>{let r=t.target.value;if(r===``){g(e.id,{region:``,imageBaseUrl:``});return}if(r===N){g(e.id,{region:``,imageBaseUrl:``});return}let i=n.regions.find(e=>e.value===r);i&&g(e.id,{region:i.value,imageBaseUrl:i.imageBaseUrl})},children:[(0,A.jsx)(x,{value:``,children:O.regionPresetDefault}),n.regions.map(e=>(0,A.jsx)(x,{value:e.value,children:ue(O,e.value,e.label)},e.value)),(0,A.jsx)(x,{value:N,children:O.regionPresetCustom})]}),ce(t,n.regions)===N?(0,A.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,A.jsx)(`input`,{type:`text`,className:M(),value:t.region,placeholder:`region`,onChange:t=>g(e.id,{region:t.target.value})}),(0,A.jsx)(`input`,{type:`url`,className:M(),value:t.imageBaseUrl,placeholder:O.imageBaseUrlLabel,onChange:t=>g(e.id,{imageBaseUrl:t.target.value})})]}):null]}):null,n?.baseUrlPresets?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-base-preset-${e.id}`,children:de(O,n.baseUrlPresetKind)}),fe(O,n.baseUrlPresetKind)?(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:fe(O,n.baseUrlPresetKind)}):null,(0,A.jsxs)(l,{id:`img-cred-base-preset-${e.id}`,className:se(),value:le(t,n.baseUrlPresets),onChange:t=>{let n=t.target.value;if(n===``){g(e.id,{baseUrl:``});return}if(n===N){g(e.id,{baseUrl:``});return}g(e.id,{baseUrl:n.replace(/\/+$/,``)})},children:[(0,A.jsx)(x,{value:``,children:O.baseUrlPresetDefault}),n.baseUrlPresets.map(he),(0,A.jsx)(x,{value:N,children:O.baseUrlPresetCustom})]}),le(t,n.baseUrlPresets)===N?(0,A.jsx)(`input`,{type:`url`,className:i(M(),`mt-2`),value:t.baseUrl,placeholder:`https://…`,onChange:t=>g(e.id,{baseUrl:t.target.value})}):null]}):null,n?.regions?.length&&ce(t,n.regions)!==N?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-imgbase-ro-${e.id}`,children:O.imageBaseUrlLabel}),(0,A.jsx)(`input`,{id:`img-cred-imgbase-ro-${e.id}`,type:`url`,readOnly:!0,className:i(M(),`cursor-not-allowed opacity-90`),value:t.imageBaseUrl,title:O.imageBaseUrlPresetHint}),(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:O.imageBaseUrlPresetHint})]}):null]})]}):null]},e.id)},t[58]=D,t[59]=a,t[60]=r,t[61]=y,t[62]=V,t[63]=E,t[64]=S,t[65]=O,t[66]=U,t[67]=g,t[68]=e):e=t[68],Z=n.map(e),t[46]=D,t[47]=a,t[48]=r,t[49]=y,t[50]=V,t[51]=E,t[52]=S,t[53]=n,t[54]=O,t[55]=U,t[56]=g,t[57]=Z}else Z=t[57];let Q;t[69]===Z?Q=t[70]:(Q=(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:Z}),t[69]=Z,t[70]=Q);let $;return t[71]!==J||t[72]!==Y||t[73]!==X||t[74]!==Q?($=(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[J,Y,X,Q]}),t[71]=J,t[72]=Y,t[73]=X,t[74]=Q,t[75]=$):$=t[75],$}function he(e){return(0,A.jsx)(x,{value:e.value,children:e.label},e.value)}function ge(){return new Set}function _e(){return new Set}function ve(e){return(e.ui?.baseUrlPresets?.length??0)>0}function ye(e){return(e.ui?.regions?.length??0)>0}function F(e){let t=_(a(e=>!!e.token)),n=t.data,r=(0,w.useMemo)(()=>e.map(e=>e.id),[e]),i=(0,w.useRef)(!1),[o,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(!1),[g,v]=(0,w.useState)(!1),y=(0,w.useMemo)(()=>E(n?.payload?.config,r),[n?.payload?.config,r]),b=o??y,x=y;return{gwSwr:t,credDraft:b,credBaseline:x,credDirty:(0,w.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(x),[b,x]),credSaving:u,credError:f,credSavedFlash:m,credNoopFlash:g,updateCredRow:(0,w.useCallback)((e,t)=>{i.current=!0,l(n=>{let r=n??y,i=r[e]??T();return{...r,[e]:{...i,...t}}})},[y]),onDiscardCredentials:(0,w.useCallback)(()=>{i.current=!1,l(null),p(null),h(!1),v(!1)},[]),saveCredentials:(0,w.useCallback)(async e=>{let n=ie(r,b,x);if(Object.keys(n).length===0){v(!0),window.setTimeout(()=>v(!1),2200);return}d(!0),p(null),h(!1);try{await ae(n),await t.mutate?.(),c(s(S)),i.current=!1,l(null),h(!0),window.setTimeout(()=>h(!1),2e3)}catch(t){p(t instanceof Error?t.message:e)}finally{d(!1)}},[r,b,x,t])}}function be(){return{enabled:!1,provider:`alibaba`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},fallback:{enabled:!0,order:[`alibaba`,`openai`]}}}function I(){return{enabled:!1,provider:`edge`,trigger:`always`,maxTextLength:512,timeoutMs:6e4,alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`en-US-MichelleNeural`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function R(e){return typeof e==`string`&&e.trim().length>0?e.trim():`alibaba`}function z(e,t,n){let r=L(e.providers)?e.providers:void 0,i=r&&L(r[t])?r[t]:void 0;return{...n,...i??{}}}function B(e){let t=be();if(!L(e))return t;let n=R(e.provider),r=z(e,`alibaba`,t.alibaba??{}),i=z(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!0,order:[`alibaba`,`openai`]};if(L(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function V(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function H(e){let t=I();if(!L(e))return t;let n=V(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`always`,i=t[`tts-local-cli`]??{},a=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,...a?{providers:a}:{},alibaba:z(e,`alibaba`,t.alibaba??{}),openai:z(e,`openai`,t.openai??{}),edge:z(e,`edge`,t.edge??{}),minimax:z(e,`minimax`,t.minimax??{}),"tts-local-cli":z(e,`tts-local-cli`,i)}}function U(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function W(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function G(e){let t=L(e)?e:{};return{stt:B(t.stt),tts:H(t.tts)}}async function K(){return G((await o(s(`/api/config`))).payload?.config??{})}async function q(e){await o(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:U(e.stt),tts:W(e.tts)})}),v()}async function J(){let e=await o(s(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function Y(){let e=await o(s(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function X(){let e=await o(s(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function Z(e){let t=await o(s(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function Q(e){let t=await o(s(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}function $(e){let t=(0,ne.c)(15),{kind:n,providerId:r,fieldId:a,value:o,onChange:s,labels:c,placeholder:l,className:u}=e,d=l===void 0?`sk-...`:l,f;t[0]!==n||t[1]!==r?(f=()=>Q({kind:n,provider:r}).then(xe),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]===u?m=t[4]:(m=i(`flex min-w-0 flex-col gap-1.5`,u),t[3]=u,t[4]=m);let h;t[5]!==a||t[6]!==c||t[7]!==s||t[8]!==d||t[9]!==p||t[10]!==o?(h=(0,A.jsx)(y,{id:a,value:o,onChange:s,placeholder:d,labels:c,reveal:p,loadFailedLabel:c.loadFailed,maskedHelp:c.maskedHelp,notInConfigFile:c.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=c,t[7]=s,t[8]=d,t[9]=p,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,A.jsx)(`div`,{className:m,children:h}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function xe(e){return e.apiKey??null}export{X as a,Z as c,C as d,S as f,K as i,F as l,J as n,G as o,Y as r,q as s,$ as t,P as u};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{Ac as s,Cc as c,Dc as l,Ga as u,Ki as d,Tl as f,Uo as p,Xc as m,a as ee,bs as h,c as g,d as _,f as te,hl as v,i as ne,il as y,ks as b,l as x,ms as S,o as C,wl as re,wo as w,xl as T,zo as E,zs as D}from"./index-DOetFpTt.js";var O=n(),k=e(t(),1),A=r();function j(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function M(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function ie(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function ae(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function N(e){let t=(0,O.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,A.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,A.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,A.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function P(e){let t=(0,O.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,A.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,A.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,A.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:M(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,A.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function F(){let{workItemId:e=``}=f(),t=re(),n=a(o(e=>e.language)).projectDetailPage.workItems,[r,O]=(0,k.useState)(null),[F,I]=(0,k.useState)(null),[L,R]=(0,k.useState)([]),[z,B]=(0,k.useState)(!0),[V,H]=(0,k.useState)(!1),[U,W]=(0,k.useState)(null),G=(0,k.useRef)(null),K=u(e=>e.setPageHeader),q=u(e=>e.clearPageHeader),J=(0,k.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),Y=(0,k.useCallback)(async()=>{if(e){B(!0),W(null);try{let[t,n]=await Promise.all([g(e),x(e).catch(()=>({events:[]}))]);O(t.item),R(n.events),I(await d(t.item.projectId).catch(()=>null))}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[e]);(0,k.useEffect)(()=>{Y()},[Y]);let X=(0,k.useCallback)(async()=>{if(r){H(!0),W(null);try{let e=await _(r.id);O(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[r,t]),Z=(0,k.useCallback)(async()=>{if(r){H(!0),W(null);try{let e=await ne(r.id);O(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[r,t]),Q=(0,k.useCallback)(async e=>{R((await x(e).catch(()=>({events:[]}))).events)},[]),oe=(0,k.useCallback)(async e=>{if(!(!r||!e.length)){H(!0),W(null);try{let t=await te(r.id,e);O(t.item),await Q(t.item.id)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[r,Q]),se=(0,k.useCallback)(async e=>{if(r){H(!0),W(null);try{let t=await ee(r.id,e.id);O(t.item),await Q(t.item.id)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[r,Q]),ce=(0,k.useCallback)(async e=>{if(r){W(null);try{await C(r.id,e)}catch(e){W(e instanceof Error?e.message:String(e))}}},[r]),$=(0,k.useMemo)(()=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(w,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void Y(),children:[(0,A.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),(0,A.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(w,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:V,onClick:X,children:[(0,A.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),(0,A.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,A.jsxs)(w,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:V,onClick:Z,children:[(0,A.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),(0,A.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[V,Z,X,r,Y,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,k.useLayoutEffect)(()=>(K({startExtra:(0,A.jsx)(T,{to:J,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":F?.name?n.detail.backToProject.replace(`{{name}}`,F.name):n.detail.backToProjects,children:(0,A.jsx)(v,{className:`size-4`,"aria-hidden":!0})}),main:(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(y,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,A.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(z?n.detail.loading:n.detail.notFound)})]}),r?(0,A.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,F?.name||r.projectId,` · `,n.updated,`: `,M(r.updatedAt)]}):null]}),end:$}),()=>q()),[q,$,r,z,F?.name,J,K,n,F]),z?(0,A.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,A.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,A.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):U||!r?(0,A.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,A.jsxs)(T,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,A.jsx)(v,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,A.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:U||n.detail.notFound})]}):(0,A.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,A.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-4 shadow-surface sm:px-5`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(y,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,A.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,A.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 font-medium`,j(r.status)),children:n.statuses[r.status]}),(0,A.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,A.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,A.jsxs)(w,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:V,onClick:X,children:[(0,A.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,A.jsxs)(w,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:V,onClick:Z,children:[(0,A.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,A.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,A.jsx)(N,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,A.jsx)(N,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,A.jsx)(N,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,A.jsx)(N,{label:n.updated,value:M(r.updatedAt)})]})]}),(0,A.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,A.jsxs)(`section`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,A.jsx)(c,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,A.jsx)(P,{events:L,t:n})]}),(0,A.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,A.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,A.jsx)(b,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,A.jsxs)(w,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:V,onClick:()=>G.current?.click(),children:[(0,A.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,A.jsx)(`input`,{ref:G,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{oe(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,A.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base px-2 py-2 text-sm`,children:[(0,A.jsx)(c,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,A.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,ie(e.size)]})]}),(0,A.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:V,onClick:()=>void ce(e),children:(0,A.jsx)(s,{className:`size-3.5`,"aria-hidden":!0})}),(0,A.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:V,onClick:()=>void se(e),children:(0,A.jsx)(E,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,A.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,A.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,A.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,A.jsxs)(T,{to:ae(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,A.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,A.jsx)(l,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,A.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,A.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,A.jsxs)(T,{to:J,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,A.jsx)(m,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:F?.name||r.projectId})]})]})]})]})]})}export{F as WorkItemDetailPage};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-YzjnURPJ.js";import{t as o}from"./fetch-BMjlW0g1.js";import{t as s}from"./url-DFGNSBNT.js";import{Ba as c,Do as l,Fo as u,Ga as d,Go as f,Ka as p,Oc as m,Qo as h,T as g,Ua as _,V as v,Va as y,Wa as b,X as x,Z as S,es as C,gs as w,io as T,j as E,ko as D,no as O,ns as k,rc as A,rl as ee,si as j}from"./index-C4k6QSXw.js";var M=e(t(),1),N=n();function P(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function F(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function I(e,t={}){let n=P(e.split(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{o,t as s}from"./fetch-Bl7zMnmd.js";import{$a as c,Do as l,Ec as u,Ha as d,No as f,Qo as p,Ra as m,T as h,Ua as g,Uo as _,V as v,Va as y,Wa as b,X as x,Xo as S,Z as C,ai as w,es as T,j as E,ms as D,tc as O,tl as ee,to as k,wo as A,za as j}from"./index-DOetFpTt.js";var M=e(t(),1),N=n();function P(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function F(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function I(e,t={}){let n=P(e.split(`
2
2
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
- `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(F(n));return null}async function L(e,t={}){let n=await o(s(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,c=``,l=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=I(e,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=I(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.trim()||void 0}}function te(){let[e,t]=(0,M.useState)(``),[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,M.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await L(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,M.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var R=r(),ne=5;function re(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function z(e){let t=(0,N.c)(232),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:u,intent:f,locale:g,context:v,disabled:x,className:S,showLabel:T}=e,E=s===void 0?`generic.text`:s,O=u===void 0?`plain`:u,k=f===void 0?`improve`:f,A=T===void 0?!0:T,[P,F]=(0,M.useState)(!1),[I,L]=(0,M.useState)(n),[z,B]=(0,M.useState)(`preview`),[V,H]=(0,M.useState)(``),[U,W]=(0,M.useState)(`edit`),[G,oe]=(0,M.useState)(!0),se=(0,M.useRef)(null),K=(0,M.useRef)(!0),{suggestion:q,thinking:J,loading:Y,error:X,generate:ce,reset:le}=te(),ue;t[0]===g?ue=t[1]:(ue=re(g),t[0]=g,t[1]=ue);let Z=ue,de;t[2]!==Y||t[3]!==J?(de=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=de):de=t[4];let Q=de,fe,pe;t[5]!==P||t[6]!==n?(fe=()=>{P||L(n)},pe=[P,n],t[5]=P,t[6]=n,t[7]=fe,t[8]=pe):(fe=t[7],pe=t[8]),(0,M.useEffect)(fe,pe);let me,he;t[9]===q?(me=t[10],he=t[11]):(he=()=>{H(q)},me=[q],t[9]=q,t[10]=me,t[11]=he),(0,M.useEffect)(he,me);let ge,_e;t[12]===J?(ge=t[13],_e=t[14]):(ge=()=>{J.trim()&&oe(!0)},_e=[J],t[12]=J,t[13]=ge,t[14]=_e),(0,M.useEffect)(ge,_e);let ve;t[15]!==Q||t[16]!==G?(ve=()=>{let e=se.current;!e||!Q||!G||K.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=ve):ve=t[17];let ye;t[18]!==Q||t[19]!==J||t[20]!==G?(ye=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=ye):ye=t[21],(0,M.useLayoutEffect)(ve,ye);let be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{let e=se.current;e&&(K.current=e.scrollHeight-e.scrollTop-e.clientHeight<=ne)},t[22]=be):be=t[22];let xe=be,Se;t[23]!==v||t[24]!==a||t[25]!==o||t[26]!==O||t[27]!==ce||t[28]!==k||t[29]!==g||t[30]!==E?(Se=async e=>{W(`edit`),oe(!0),K.current=!0,await ce({intent:k,scenario:E,input:e,locale:g,field:{id:a,label:o,format:O},context:v})},t[23]=v,t[24]=a,t[25]=o,t[26]=O,t[27]=ce,t[28]=k,t[29]=g,t[30]=E,t[31]=Se):Se=t[31];let Ce=Se,we;t[32]!==le||t[33]!==n?(we=()=>{L(n),B(`preview`),H(``),W(`edit`),oe(!0),le(),F(!0)},t[32]=le,t[33]=n,t[34]=we):we=t[34];let Te=we,Ee;t[35]!==I||t[36]!==Ce?(Ee=async()=>{await Ce(I)},t[35]=I,t[36]=Ce,t[37]=Ee):Ee=t[37];let De=Ee,Oe;t[38]!==le||t[39]!==n?(Oe=()=>{F(!1),L(n),B(`preview`),H(``),W(`edit`),oe(!0),le()},t[38]=le,t[39]=n,t[40]=Oe):Oe=t[40];let $=Oe,ke;t[41]!==$||t[42]!==I||t[43]!==r?(ke=()=>{r(I),$()},t[41]=$,t[42]=I,t[43]=r,t[44]=ke):ke=t[44];let Ae=ke,je;t[45]!==$||t[46]!==V||t[47]!==r?(je=()=>{V.trim()&&(r(V),$())},t[45]=$,t[46]=V,t[47]=r,t[48]=je):je=t[48];let Me=je,Ne;t[49]!==$||t[50]!==I||t[51]!==V||t[52]!==r?(Ne=()=>{if(!V.trim())return;let e=I.trimEnd();r(e?`${e}\n\n${V}`:V),$()},t[49]=$,t[50]=I,t[51]=V,t[52]=r,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==V||t[55]!==X||t[56]!==Y?(Fe=!Y&&!X&&V.trim().length>0,t[54]=V,t[55]=X,t[56]=Y,t[57]=Fe):Fe=t[57];let Ie=Fe,Le=I!==n,Re;t[58]!==V||t[59]!==X||t[60]!==J?(Re=V.trim().length>0||J.trim().length>0||!!X,t[58]=V,t[59]=X,t[60]=J,t[61]=Re):Re=t[61];let ze=Re,Be=!A&&`size-7 p-0`,Ve;t[62]!==S||t[63]!==Be?(Ve=i(`h-7 gap-1 px-2 text-xs`,Be,S),t[62]=S,t[63]=Be,t[64]=Ve):Ve=t[64];let He=x||Y,Ue;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,R.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=Ue):Ue=t[65];let We=A?Z.buttonTitle:null,Ge;t[66]!==Z.buttonTitle||t[67]!==Te||t[68]!==Ve||t[69]!==He||t[70]!==We?(Ge=(0,R.jsxs)(l,{type:`button`,variant:`ghost`,className:Ve,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:He,onClick:Te,children:[Ue,We]}),t[66]=Z.buttonTitle,t[67]=Te,t[68]=Ve,t[69]=He,t[70]=We,t[71]=Ge):Ge=t[71];let Ke;t[72]===$?Ke=t[73]:(Ke=e=>e?F(!0):$(),t[72]=$,t[73]=Ke);let qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,R.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[74]=qe):qe=t[74];let Je;t[75]===Z.title?Je=t[76]:(Je=(0,R.jsx)(p,{className:`text-base font-semibold text-fg`,children:Z.title}),t[75]=Z.title,t[76]=Je);let Ye;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,R.jsx)(D,{className:`size-5`,strokeWidth:1.75}),t[77]=Ye):Ye=t[77];let Xe;t[78]===Z.close?Xe=t[79]:(Xe=(0,R.jsx)(c,{asChild:!0,children:(0,R.jsx)(l,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:Ye})}),t[78]=Z.close,t[79]=Xe);let Ze;t[80]!==Je||t[81]!==Xe?(Ze=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Je,Xe]}),t[80]=Je,t[81]=Xe,t[82]=Ze):Ze=t[82];let Qe;t[83]===Z.current?Qe=t[84]:(Qe=(0,R.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[83]=Z.current,t[84]=Qe);let $e=z===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,et;t[85]===$e?et=t[86]:(et=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,$e),t[85]=$e,t[86]=et);let tt,nt;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>B(`edit`),nt=(0,R.jsx)(h,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[87]=tt,t[88]=nt):(tt=t[87],nt=t[88]);let rt;t[89]!==Z.edit||t[90]!==et?(rt=(0,R.jsxs)(`button`,{type:`button`,className:et,onClick:tt,children:[nt,Z.edit]}),t[89]=Z.edit,t[90]=et,t[91]=rt):rt=t[91];let it=z===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,at;t[92]===it?at=t[93]:(at=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,it),t[92]=it,t[93]=at);let ot,st;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>B(`preview`),st=(0,R.jsx)(m,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[94]=ot,t[95]=st):(ot=t[94],st=t[95]);let ct;t[96]!==Z.preview||t[97]!==at?(ct=(0,R.jsxs)(`button`,{type:`button`,className:at,onClick:ot,children:[st,Z.preview]}),t[96]=Z.preview,t[97]=at,t[98]=ct):ct=t[98];let lt;t[99]!==rt||t[100]!==ct?(lt=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[rt,ct]}),t[99]=rt,t[100]=ct,t[101]=lt):lt=t[101];let ut;t[102]!==Qe||t[103]!==lt?(ut=(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[Qe,lt]}),t[102]=Qe,t[103]=lt,t[104]=ut):ut=t[104];let dt;t[105]!==I||t[106]!==z||t[107]!==O||t[108]!==Z.current||t[109]!==Z.empty?(dt=z===`preview`?(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:O===`markdown`?(0,R.jsx)(j,{content:I||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:I||Z.empty})}):(0,R.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:I,onChange:e=>L(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[105]=I,t[106]=z,t[107]=O,t[108]=Z.current,t[109]=Z.empty,t[110]=dt):dt=t[110];let ft;t[111]!==ut||t[112]!==dt?(ft=(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[ut,dt]}),t[111]=ut,t[112]=dt,t[113]=ft):ft=t[113];let pt;t[114]===Z.editedSuggestion?pt=t[115]:(pt=(0,R.jsx)(`span`,{children:Z.editedSuggestion}),t[114]=Z.editedSuggestion,t[115]=pt);let mt;t[116]!==Z.loading||t[117]!==Y?(mt=Y?(0,R.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[116]=Z.loading,t[117]=Y,t[118]=mt):mt=t[118];let ht;t[119]!==pt||t[120]!==mt?(ht=(0,R.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[pt,mt]}),t[119]=pt,t[120]=mt,t[121]=ht):ht=t[121];let gt=U===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,_t;t[122]===gt?_t=t[123]:(_t=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,gt),t[122]=gt,t[123]=_t);let vt,yt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>W(`edit`),yt=(0,R.jsx)(h,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[124]=vt,t[125]=yt):(vt=t[124],yt=t[125]);let bt;t[126]!==Z.edit||t[127]!==_t?(bt=(0,R.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,Z.edit]}),t[126]=Z.edit,t[127]=_t,t[128]=bt):bt=t[128];let xt=U===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,St;t[129]===xt?St=t[130]:(St=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,xt),t[129]=xt,t[130]=St);let Ct,wt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=()=>W(`preview`),wt=(0,R.jsx)(m,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[131]=Ct,t[132]=wt):(Ct=t[131],wt=t[132]);let Tt;t[133]!==Z.preview||t[134]!==St?(Tt=(0,R.jsxs)(`button`,{type:`button`,className:St,onClick:Ct,children:[wt,Z.preview]}),t[133]=Z.preview,t[134]=St,t[135]=Tt):Tt=t[135];let Et;t[136]!==bt||t[137]!==Tt?(Et=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[bt,Tt]}),t[136]=bt,t[137]=Tt,t[138]=Et):Et=t[138];let Dt;t[139]!==ht||t[140]!==Et?(Dt=(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[ht,Et]}),t[139]=ht,t[140]=Et,t[141]=Dt):Dt=t[141];let Ot=Q?`opacity-100`:`pointer-events-none opacity-0`,kt;t[142]===Ot?kt=t[143]:(kt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ot),t[142]=Ot,t[143]=kt);let At=!Q,jt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>oe(ie),t[144]=jt):jt=t[144];let Mt;t[145]!==Z.thinkingLoading||t[146]!==Y?(Mt=Y?(0,R.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[145]=Z.thinkingLoading,t[146]=Y,t[147]=Mt):Mt=t[147];let Nt;t[148]!==Z.thinking||t[149]!==Mt?(Nt=(0,R.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,Mt]}),t[148]=Z.thinking,t[149]=Mt,t[150]=Nt):Nt=t[150];let Pt=G&&`rotate-180`,Ft;t[151]===Pt?Ft=t[152]:(Ft=i(`size-3.5 shrink-0 transition-transform`,Pt),t[151]=Pt,t[152]=Ft);let It;t[153]===Ft?It=t[154]:(It=(0,R.jsx)(ee,{className:Ft,strokeWidth:1.75,"aria-hidden":!0}),t[153]=Ft,t[154]=It);let Lt;t[155]!==Nt||t[156]!==It?(Lt=(0,R.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:jt,children:[Nt,It]}),t[155]=Nt,t[156]=It,t[157]=Lt):Lt=t[157];let Rt;t[158]!==J||t[159]!==G?(Rt=G?(0,R.jsx)(`pre`,{ref:se,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:xe,children:J}):null,t[158]=J,t[159]=G,t[160]=Rt):Rt=t[160];let zt;t[161]!==Lt||t[162]!==Rt?(zt=(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Lt,Rt]}),t[161]=Lt,t[162]=Rt,t[163]=zt):zt=t[163];let Bt;t[164]!==kt||t[165]!==At||t[166]!==zt?(Bt=(0,R.jsx)(`div`,{className:kt,"aria-hidden":At,children:zt}),t[164]=kt,t[165]=At,t[166]=zt,t[167]=Bt):Bt=t[167];let Vt=Q?`pointer-events-none opacity-0`:`opacity-100`,Ht;t[168]===Vt?Ht=t[169]:(Ht=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Vt),t[168]=Vt,t[169]=Ht);let Ut;t[170]!==V||t[171]!==X||t[172]!==O||t[173]!==Z.empty||t[174]!==Z.loading||t[175]!==Z.suggestion||t[176]!==Y||t[177]!==U?(Ut=X?(0,R.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):U===`preview`?(0,R.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!V.trim()?(0,R.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):O===`markdown`?(0,R.jsx)(j,{content:V||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:V||Z.empty})}):(0,R.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:V,onChange:e=>H(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[170]=V,t[171]=X,t[172]=O,t[173]=Z.empty,t[174]=Z.loading,t[175]=Z.suggestion,t[176]=Y,t[177]=U,t[178]=Ut):Ut=t[178];let Wt;t[179]!==Ht||t[180]!==Ut?(Wt=(0,R.jsx)(`div`,{className:Ht,children:Ut}),t[179]=Ht,t[180]=Ut,t[181]=Wt):Wt=t[181];let Gt;t[182]!==Bt||t[183]!==Wt?(Gt=(0,R.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Bt,Wt]}),t[182]=Bt,t[183]=Wt,t[184]=Gt):Gt=t[184];let Kt;t[185]!==Dt||t[186]!==Gt?(Kt=(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Dt,Gt]}),t[185]=Dt,t[186]=Gt,t[187]=Kt):Kt=t[187];let qt;t[188]!==ft||t[189]!==Kt?(qt=(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[ft,Kt]}),t[188]=ft,t[189]=Kt,t[190]=qt):qt=t[190];let Jt;t[191]!==$||t[192]!==Z.cancel?(Jt=(0,R.jsx)(l,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[191]=$,t[192]=Z.cancel,t[193]=Jt):Jt=t[193];let Yt=!Le,Xt;t[194]!==Ae||t[195]!==Z.applyCurrent||t[196]!==Yt?(Xt=(0,R.jsx)(l,{type:`button`,variant:`secondary`,disabled:Yt,onClick:Ae,children:Z.applyCurrent}),t[194]=Ae,t[195]=Z.applyCurrent,t[196]=Yt,t[197]=Xt):Xt=t[197];let Zt;t[198]===De?Zt=t[199]:(Zt=()=>void De(),t[198]=De,t[199]=Zt);let Qt;t[200]===ze?Qt=t[201]:(Qt=ze?(0,R.jsx)(w,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,R.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[200]=ze,t[201]=Qt);let $t=ze?Z.regenerate:Z.generate,en;t[202]!==Y||t[203]!==Zt||t[204]!==Qt||t[205]!==$t?(en=(0,R.jsxs)(l,{type:`button`,variant:`secondary`,disabled:Y,onClick:Zt,children:[Qt,$t]}),t[202]=Y,t[203]=Zt,t[204]=Qt,t[205]=$t,t[206]=en):en=t[206];let tn=!Ie,nn;t[207]!==Pe||t[208]!==Z.append||t[209]!==tn?(nn=(0,R.jsx)(l,{type:`button`,variant:`secondary`,disabled:tn,onClick:Pe,children:Z.append}),t[207]=Pe,t[208]=Z.append,t[209]=tn,t[210]=nn):nn=t[210];let rn=!Ie,an;t[211]!==Me||t[212]!==Z.replace||t[213]!==rn?(an=(0,R.jsx)(l,{type:`button`,variant:`primary`,disabled:rn,onClick:Me,children:Z.replace}),t[211]=Me,t[212]=Z.replace,t[213]=rn,t[214]=an):an=t[214];let on;t[215]!==Jt||t[216]!==Xt||t[217]!==en||t[218]!==nn||t[219]!==an?(on=(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Jt,Xt,en,nn,an]}),t[215]=Jt,t[216]=Xt,t[217]=en,t[218]=nn,t[219]=an,t[220]=on):on=t[220];let sn;t[221]!==Ze||t[222]!==qt||t[223]!==on?(sn=(0,R.jsxs)(b,{children:[qe,(0,R.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,R.jsxs)(y,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ae,children:[Ze,qt,on]})})]}),t[221]=Ze,t[222]=qt,t[223]=on,t[224]=sn):sn=t[224];let cn;t[225]!==P||t[226]!==Ke||t[227]!==sn?(cn=(0,R.jsx)(d,{open:P,onOpenChange:Ke,children:sn}),t[225]=P,t[226]=Ke,t[227]=sn,t[228]=cn):cn=t[228];let ln;return t[229]!==cn||t[230]!==Ge?(ln=(0,R.jsxs)(R.Fragment,{children:[Ge,cn]}),t[229]=cn,t[230]=Ge,t[231]=ln):ln=t[231],ln}function ie(e){return!e}function ae(e){return e.preventDefault()}function B(e,t){return e[t]??t}function V(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function H(e){let t=(0,N.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,y,b,S,C,w,T;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){b=a(r).workflows;let e=v[n]??[];y=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{x(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,S=`flex flex-col gap-3`,C=e.map(e=>{let t=B(b.args,e.labelKey),a=B(b.args,e.placeholderKey),c=o[e.key]??``;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,R.jsx)(z,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,R.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,R.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),w=y&&h.length>0?(0,R.jsx)(V,{examples:h,labels:b,onSelect:_}):null,T=g?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:b.goalLabel}),p?(0,R.jsx)(z,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:b.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,R.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:b.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=y,t[14]=b,t[15]=S,t[16]=C,t[17]=w,t[18]=T}else _=t[12],y=t[13],b=t[14],S=t[15],C=t[16],w=t[17],T=t[18];let E;t[23]!==_||t[24]!==h||t[25]!==y||t[26]!==b?(E=!y&&h.length>0?(0,R.jsx)(V,{examples:h,labels:b,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=y,t[26]=b,t[27]=E):E=t[27];let D;return t[28]!==S||t[29]!==C||t[30]!==w||t[31]!==T||t[32]!==E?(D=(0,R.jsxs)(`div`,{className:S,children:[C,w,T,E]}),t[28]=S,t[29]=C,t[30]=w,t[31]=T,t[32]=E,t[33]=D):D=t[33],D}var U=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function W(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function G({schema:e,value:t,onChange:n,labels:r,aiAssist:a,onValidChange:o}){let s=(0,M.useMemo)(()=>K(e),[e]),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,M.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!1)}};return(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,R.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(U,`min-h-40 font-mono text-xs leading-5`)}),f?(0,R.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,R.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,R.jsx)(oe,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function oe(e){let t=(0,N.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,f;t[0]===n.schema.enum?f=t[1]:(f=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=f);let p=f,m=!!o&&!p.length&&(d===`string`||!d),h=String(l),g=n.required?` *`:``,_;t[2]!==h||t[3]!==g?(_=(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[h,g]}),t[2]=h,t[3]=g,t[4]=_):_=t[4];let v;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==m||t[11]!==l||t[12]!==r?(v=m&&o?(0,R.jsx)(z,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=m,t[11]=l,t[12]=r,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u?b=t[18]:(b=u?(0,R.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=b);let x;t[19]!==u||t[20]!==p||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(x=p.length>0?(0,R.jsxs)(O,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:U,children:[(0,R.jsx)(T,{value:``}),p.map(se)]}):d===`boolean`?(0,R.jsxs)(O,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:U,children:[(0,R.jsx)(T,{value:``}),(0,R.jsx)(T,{value:`true`,children:a.booleanTrue}),(0,R.jsx)(T,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,R.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(e.target.value===``?void 0:Number(e.target.value)),className:U}):(0,R.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>c(e.target.value),className:i(U,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=p,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=x):x=t[25];let S;return t[26]!==y||t[27]!==b||t[28]!==x?(S=(0,R.jsxs)(`div`,{className:`block`,children:[y,b,x]}),t[26]=y,t[27]=b,t[28]=x,t[29]=S):S=t[29],S}function se(e){return(0,R.jsx)(T,{value:String(e),children:String(e)},String(e))}function K(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function q(e,t){return!W(e)||!e?!0:K(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function J(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e,t){if(e)return W(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:g(t.argValues)}function X(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=S(e,t);if(W(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.join(` · `):r.noInputSummary}function ce(e,t,n=!0){return e?n?W(e.inputSchema)?q(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(v[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function le(e){let t=(0,N.c)(114),{definition:n,language:r,value:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=S(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,M.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=W(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,C,w,T,E,D,O,k,A,ee;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(ce(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let S=y,j;t[42]!==d||t[43]!==o?(j=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=j):j=t[44];let M=j,N;if(t[45]!==_||t[46]!==S||t[47]!==o.schemaInput?(N=e=>{if(e.field===`goal`){_(e.text);return}S({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=S,t[47]=o.schemaInput,t[48]=N):N=t[48],x=N,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==M||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,R.jsx)(H,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:M,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=M,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],E=i;break bb0}w=`flex flex-col gap-3`,t[65]!==c||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==u||t[75]!==S||t[76]!==o?(T=n.inputSchema?(0,R.jsx)(G,{schema:n.inputSchema,value:o.schemaInput,onChange:S,onValidChange:(e,t)=>{g(e),u?.(ce(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=c,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=u,t[75]=S,t[76]=o,t[77]=T):T=t[77],ee=`flex flex-col gap-1`;let P;t[78]===f.goalLabel?P=t[79]:(P=(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=P);let F;t[80]!==c||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==o.goal||t[89]!==o.schemaInput?(F=c?(0,R.jsx)(z,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=o.goal,t[89]=o.schemaInput,t[90]=F):F=t[90],t[91]!==P||t[92]!==F?(C=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[P,F]}),t[91]=P,t[92]=F,t[93]=C):C=t[93],D=o.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=x,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=ee}else x=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],ee=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let j;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(j=(0,R.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=j):j=t[100];let P;t[101]!==C||t[102]!==j||t[103]!==ee?(P=(0,R.jsxs)(`div`,{className:ee,children:[C,j]}),t[101]=C,t[102]=j,t[103]=ee,t[104]=P):P=t[104];let F;t[105]!==x||t[106]!==v||t[107]!==f?(F=(0,R.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=F):F=t[108];let I;return t[109]!==w||t[110]!==T||t[111]!==P||t[112]!==F?(I=(0,R.jsxs)(`div`,{className:w,children:[T,P,F]}),t[109]=w,t[110]=T,t[111]=P,t[112]=F,t[113]=I):I=t[113],I}function ue(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?E(t.agentScaleExact,{count:n.min}):E(t.agentScaleRange,{min:n.min,max:n.max}):E(t.agentScaleExact,{count:e.defaults.maxSubagents})}function Z(e){let t=(0,N.c)(41),{definition:n,language:r,value:o,onChange:s,mode:c,badgeLabel:l,aiAssist:d,inputClassName:p,showTimeout:m,defaultAdvancedOpen:h,onValidityChange:g}=e,_=m===void 0?!1:m,v=h===void 0?!1:h,y=a(r).workflows,[b,x]=(0,M.useState)(v),C;t[0]!==n||t[1]!==r?(C=S(n,r),t[0]=n,t[1]=r,t[2]=C):C=t[2];let w=C,T;t[3]!==n.defaults||t[4]!==o.concurrency?(T=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=T):T=t[5];let D=T,O;t[6]!==n.defaults||t[7]!==o.maxSubagents?(O=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=O):O=t[8];let j=O,P;t[9]!==n||t[10]!==r||t[11]!==o?(P=X(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=P):P=t[12];let F=P,I=l??y.readyToStart,L;t[13]!==s||t[14]!==o?(L=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=L):L=t[15];let te=L,ne=c===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,re;t[16]===ne?re=t[17]:(re=i(`space-y-4`,ne),t[16]=ne,t[17]=re);let z=F||w.description,ie;t[18]===z?ie=t[19]:(ie=(0,R.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:z}),t[18]=z,t[19]=ie);let ae;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,R.jsx)(A,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ae):ae=t[20];let B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,R.jsx)(u,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=B):B=t[21];let V;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,R.jsx)(k,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=V):V=t[22];let H;t[23]!==s||t[24]!==o?(H=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=H):H=t[25];let U;t[26]===g?U=t[27]:(U=e=>{g?.(e)},t[26]=g,t[27]=U);let W;t[28]!==d||t[29]!==n||t[30]!==p||t[31]!==r||t[32]!==H||t[33]!==U||t[34]!==o?(W=(0,R.jsx)(le,{definition:n,language:r,value:o,onChange:H,onValidityChange:U,aiAssist:d,inputClassName:p}),t[28]=d,t[29]=n,t[30]=p,t[31]=r,t[32]=H,t[33]=U,t[34]=o,t[35]=W):W=t[35];let G;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>x(de),t[36]=G):G=t[36];let oe=y.advancedSettings,se=b&&`rotate-180`,K;t[37]===se?K=t[38]:(K=i(`size-4 transition-transform`,se),t[37]=se,t[38]=K);let q;return t[39]===K?q=t[40]:(q=(0,R.jsx)(ee,{className:K}),t[39]=K,t[40]=q),(0,R.jsxs)(`div`,{className:re,children:[(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:y.runPlanPreview}),ie]}),(0,R.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:I})]}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ae,(0,R.jsx)(`span`,{children:E(y.phaseCount,{count:n.phases.length})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[B,(0,R.jsx)(`span`,{children:ue(n,y)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,R.jsx)(`span`,{children:E(y.runLimitsSummary,{concurrency:D,max:j})})]})]}),n.phases.length>0?(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,R.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),y.startPlanPhases]}),(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(Q)})]}):null]}),W,(0,R.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:G,children:[oe,q]}),b?(0,R.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,R.jsx)(`input`,{value:o.concurrency,onChange:e=>te({concurrency:e.target.value}),placeholder:E(y.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,R.jsx)(`input`,{value:o.maxSubagents,onChange:e=>te({maxSubagents:e.target.value}),placeholder:E(y.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),_?(0,R.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>te({timeoutSeconds:e.target.value}),placeholder:E(y.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function de(e){return!e}function Q(e,t){return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,R.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,R.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{z as i,Y as n,ce as r,Z as t};
3
+ `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(F(n));return null}async function L(e,t={}){let n=await s(o(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,c=``,l=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=I(e,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=I(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.trim()||void 0}}function te(){let[e,t]=(0,M.useState)(``),[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,M.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await L(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,M.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var R=r(),ne=5;function re(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function z(e){let t=(0,N.c)(232),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:c,intent:f,locale:h,context:_,disabled:v,className:x,showLabel:C}=e,T=s===void 0?`generic.text`:s,E=c===void 0?`plain`:c,O=f===void 0?`improve`:f,k=C===void 0?!0:C,[P,F]=(0,M.useState)(!1),[I,L]=(0,M.useState)(n),[z,B]=(0,M.useState)(`preview`),[V,H]=(0,M.useState)(``),[U,W]=(0,M.useState)(`edit`),[G,oe]=(0,M.useState)(!0),se=(0,M.useRef)(null),K=(0,M.useRef)(!0),{suggestion:q,thinking:J,loading:Y,error:X,generate:ce,reset:le}=te(),ue;t[0]===h?ue=t[1]:(ue=re(h),t[0]=h,t[1]=ue);let Z=ue,de;t[2]!==Y||t[3]!==J?(de=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=de):de=t[4];let Q=de,fe,pe;t[5]!==P||t[6]!==n?(fe=()=>{P||L(n)},pe=[P,n],t[5]=P,t[6]=n,t[7]=fe,t[8]=pe):(fe=t[7],pe=t[8]),(0,M.useEffect)(fe,pe);let me,he;t[9]===q?(me=t[10],he=t[11]):(he=()=>{H(q)},me=[q],t[9]=q,t[10]=me,t[11]=he),(0,M.useEffect)(he,me);let ge,_e;t[12]===J?(ge=t[13],_e=t[14]):(ge=()=>{J.trim()&&oe(!0)},_e=[J],t[12]=J,t[13]=ge,t[14]=_e),(0,M.useEffect)(ge,_e);let ve;t[15]!==Q||t[16]!==G?(ve=()=>{let e=se.current;!e||!Q||!G||K.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=ve):ve=t[17];let ye;t[18]!==Q||t[19]!==J||t[20]!==G?(ye=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=ye):ye=t[21],(0,M.useLayoutEffect)(ve,ye);let be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{let e=se.current;e&&(K.current=e.scrollHeight-e.scrollTop-e.clientHeight<=ne)},t[22]=be):be=t[22];let xe=be,Se;t[23]!==_||t[24]!==a||t[25]!==o||t[26]!==E||t[27]!==ce||t[28]!==O||t[29]!==h||t[30]!==T?(Se=async e=>{W(`edit`),oe(!0),K.current=!0,await ce({intent:O,scenario:T,input:e,locale:h,field:{id:a,label:o,format:E},context:_})},t[23]=_,t[24]=a,t[25]=o,t[26]=E,t[27]=ce,t[28]=O,t[29]=h,t[30]=T,t[31]=Se):Se=t[31];let Ce=Se,we;t[32]!==le||t[33]!==n?(we=()=>{L(n),B(`preview`),H(``),W(`edit`),oe(!0),le(),F(!0)},t[32]=le,t[33]=n,t[34]=we):we=t[34];let Te=we,Ee;t[35]!==I||t[36]!==Ce?(Ee=async()=>{await Ce(I)},t[35]=I,t[36]=Ce,t[37]=Ee):Ee=t[37];let De=Ee,Oe;t[38]!==le||t[39]!==n?(Oe=()=>{F(!1),L(n),B(`preview`),H(``),W(`edit`),oe(!0),le()},t[38]=le,t[39]=n,t[40]=Oe):Oe=t[40];let $=Oe,ke;t[41]!==$||t[42]!==I||t[43]!==r?(ke=()=>{r(I),$()},t[41]=$,t[42]=I,t[43]=r,t[44]=ke):ke=t[44];let Ae=ke,je;t[45]!==$||t[46]!==V||t[47]!==r?(je=()=>{V.trim()&&(r(V),$())},t[45]=$,t[46]=V,t[47]=r,t[48]=je):je=t[48];let Me=je,Ne;t[49]!==$||t[50]!==I||t[51]!==V||t[52]!==r?(Ne=()=>{if(!V.trim())return;let e=I.trimEnd();r(e?`${e}\n\n${V}`:V),$()},t[49]=$,t[50]=I,t[51]=V,t[52]=r,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==V||t[55]!==X||t[56]!==Y?(Fe=!Y&&!X&&V.trim().length>0,t[54]=V,t[55]=X,t[56]=Y,t[57]=Fe):Fe=t[57];let Ie=Fe,Le=I!==n,Re;t[58]!==V||t[59]!==X||t[60]!==J?(Re=V.trim().length>0||J.trim().length>0||!!X,t[58]=V,t[59]=X,t[60]=J,t[61]=Re):Re=t[61];let ze=Re,Be=!k&&`size-7 p-0`,Ve;t[62]!==x||t[63]!==Be?(Ve=i(`h-7 gap-1 px-2 text-xs`,Be,x),t[62]=x,t[63]=Be,t[64]=Ve):Ve=t[64];let He=v||Y,Ue;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,R.jsx)(p,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=Ue):Ue=t[65];let We=k?Z.buttonTitle:null,Ge;t[66]!==Z.buttonTitle||t[67]!==Te||t[68]!==Ve||t[69]!==He||t[70]!==We?(Ge=(0,R.jsxs)(A,{type:`button`,variant:`ghost`,className:Ve,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:He,onClick:Te,children:[Ue,We]}),t[66]=Z.buttonTitle,t[67]=Te,t[68]=Ve,t[69]=He,t[70]=We,t[71]=Ge):Ge=t[71];let Ke;t[72]===$?Ke=t[73]:(Ke=e=>e?F(!0):$(),t[72]=$,t[73]=Ke);let qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,R.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[74]=qe):qe=t[74];let Je;t[75]===Z.title?Je=t[76]:(Je=(0,R.jsx)(b,{className:`text-base font-semibold text-fg`,children:Z.title}),t[75]=Z.title,t[76]=Je);let Ye;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,R.jsx)(l,{className:`size-5`,strokeWidth:1.75}),t[77]=Ye):Ye=t[77];let Xe;t[78]===Z.close?Xe=t[79]:(Xe=(0,R.jsx)(m,{asChild:!0,children:(0,R.jsx)(A,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:Ye})}),t[78]=Z.close,t[79]=Xe);let Ze;t[80]!==Je||t[81]!==Xe?(Ze=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Je,Xe]}),t[80]=Je,t[81]=Xe,t[82]=Ze):Ze=t[82];let Qe;t[83]===Z.current?Qe=t[84]:(Qe=(0,R.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[83]=Z.current,t[84]=Qe);let $e=z===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,et;t[85]===$e?et=t[86]:(et=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,$e),t[85]=$e,t[86]=et);let tt,nt;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>B(`edit`),nt=(0,R.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[87]=tt,t[88]=nt):(tt=t[87],nt=t[88]);let rt;t[89]!==Z.edit||t[90]!==et?(rt=(0,R.jsxs)(`button`,{type:`button`,className:et,onClick:tt,children:[nt,Z.edit]}),t[89]=Z.edit,t[90]=et,t[91]=rt):rt=t[91];let it=z===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,at;t[92]===it?at=t[93]:(at=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,it),t[92]=it,t[93]=at);let ot,st;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>B(`preview`),st=(0,R.jsx)(u,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[94]=ot,t[95]=st):(ot=t[94],st=t[95]);let ct;t[96]!==Z.preview||t[97]!==at?(ct=(0,R.jsxs)(`button`,{type:`button`,className:at,onClick:ot,children:[st,Z.preview]}),t[96]=Z.preview,t[97]=at,t[98]=ct):ct=t[98];let lt;t[99]!==rt||t[100]!==ct?(lt=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[rt,ct]}),t[99]=rt,t[100]=ct,t[101]=lt):lt=t[101];let ut;t[102]!==Qe||t[103]!==lt?(ut=(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[Qe,lt]}),t[102]=Qe,t[103]=lt,t[104]=ut):ut=t[104];let dt;t[105]!==I||t[106]!==z||t[107]!==E||t[108]!==Z.current||t[109]!==Z.empty?(dt=z===`preview`?(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:E===`markdown`?(0,R.jsx)(w,{content:I||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:I||Z.empty})}):(0,R.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:I,onChange:e=>L(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[105]=I,t[106]=z,t[107]=E,t[108]=Z.current,t[109]=Z.empty,t[110]=dt):dt=t[110];let ft;t[111]!==ut||t[112]!==dt?(ft=(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[ut,dt]}),t[111]=ut,t[112]=dt,t[113]=ft):ft=t[113];let pt;t[114]===Z.editedSuggestion?pt=t[115]:(pt=(0,R.jsx)(`span`,{children:Z.editedSuggestion}),t[114]=Z.editedSuggestion,t[115]=pt);let mt;t[116]!==Z.loading||t[117]!==Y?(mt=Y?(0,R.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[116]=Z.loading,t[117]=Y,t[118]=mt):mt=t[118];let ht;t[119]!==pt||t[120]!==mt?(ht=(0,R.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[pt,mt]}),t[119]=pt,t[120]=mt,t[121]=ht):ht=t[121];let gt=U===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,_t;t[122]===gt?_t=t[123]:(_t=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,gt),t[122]=gt,t[123]=_t);let vt,yt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>W(`edit`),yt=(0,R.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[124]=vt,t[125]=yt):(vt=t[124],yt=t[125]);let bt;t[126]!==Z.edit||t[127]!==_t?(bt=(0,R.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,Z.edit]}),t[126]=Z.edit,t[127]=_t,t[128]=bt):bt=t[128];let xt=U===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,St;t[129]===xt?St=t[130]:(St=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,xt),t[129]=xt,t[130]=St);let Ct,wt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=()=>W(`preview`),wt=(0,R.jsx)(u,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[131]=Ct,t[132]=wt):(Ct=t[131],wt=t[132]);let Tt;t[133]!==Z.preview||t[134]!==St?(Tt=(0,R.jsxs)(`button`,{type:`button`,className:St,onClick:Ct,children:[wt,Z.preview]}),t[133]=Z.preview,t[134]=St,t[135]=Tt):Tt=t[135];let Et;t[136]!==bt||t[137]!==Tt?(Et=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[bt,Tt]}),t[136]=bt,t[137]=Tt,t[138]=Et):Et=t[138];let Dt;t[139]!==ht||t[140]!==Et?(Dt=(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[ht,Et]}),t[139]=ht,t[140]=Et,t[141]=Dt):Dt=t[141];let Ot=Q?`opacity-100`:`pointer-events-none opacity-0`,kt;t[142]===Ot?kt=t[143]:(kt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ot),t[142]=Ot,t[143]=kt);let At=!Q,jt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>oe(ie),t[144]=jt):jt=t[144];let Mt;t[145]!==Z.thinkingLoading||t[146]!==Y?(Mt=Y?(0,R.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[145]=Z.thinkingLoading,t[146]=Y,t[147]=Mt):Mt=t[147];let Nt;t[148]!==Z.thinking||t[149]!==Mt?(Nt=(0,R.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,Mt]}),t[148]=Z.thinking,t[149]=Mt,t[150]=Nt):Nt=t[150];let Pt=G&&`rotate-180`,Ft;t[151]===Pt?Ft=t[152]:(Ft=i(`size-3.5 shrink-0 transition-transform`,Pt),t[151]=Pt,t[152]=Ft);let It;t[153]===Ft?It=t[154]:(It=(0,R.jsx)(ee,{className:Ft,strokeWidth:1.75,"aria-hidden":!0}),t[153]=Ft,t[154]=It);let Lt;t[155]!==Nt||t[156]!==It?(Lt=(0,R.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:jt,children:[Nt,It]}),t[155]=Nt,t[156]=It,t[157]=Lt):Lt=t[157];let Rt;t[158]!==J||t[159]!==G?(Rt=G?(0,R.jsx)(`pre`,{ref:se,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:xe,children:J}):null,t[158]=J,t[159]=G,t[160]=Rt):Rt=t[160];let zt;t[161]!==Lt||t[162]!==Rt?(zt=(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Lt,Rt]}),t[161]=Lt,t[162]=Rt,t[163]=zt):zt=t[163];let Bt;t[164]!==kt||t[165]!==At||t[166]!==zt?(Bt=(0,R.jsx)(`div`,{className:kt,"aria-hidden":At,children:zt}),t[164]=kt,t[165]=At,t[166]=zt,t[167]=Bt):Bt=t[167];let Vt=Q?`pointer-events-none opacity-0`:`opacity-100`,Ht;t[168]===Vt?Ht=t[169]:(Ht=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Vt),t[168]=Vt,t[169]=Ht);let Ut;t[170]!==V||t[171]!==X||t[172]!==E||t[173]!==Z.empty||t[174]!==Z.loading||t[175]!==Z.suggestion||t[176]!==Y||t[177]!==U?(Ut=X?(0,R.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):U===`preview`?(0,R.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!V.trim()?(0,R.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):E===`markdown`?(0,R.jsx)(w,{content:V||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:V||Z.empty})}):(0,R.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:V,onChange:e=>H(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[170]=V,t[171]=X,t[172]=E,t[173]=Z.empty,t[174]=Z.loading,t[175]=Z.suggestion,t[176]=Y,t[177]=U,t[178]=Ut):Ut=t[178];let Wt;t[179]!==Ht||t[180]!==Ut?(Wt=(0,R.jsx)(`div`,{className:Ht,children:Ut}),t[179]=Ht,t[180]=Ut,t[181]=Wt):Wt=t[181];let Gt;t[182]!==Bt||t[183]!==Wt?(Gt=(0,R.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Bt,Wt]}),t[182]=Bt,t[183]=Wt,t[184]=Gt):Gt=t[184];let Kt;t[185]!==Dt||t[186]!==Gt?(Kt=(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Dt,Gt]}),t[185]=Dt,t[186]=Gt,t[187]=Kt):Kt=t[187];let qt;t[188]!==ft||t[189]!==Kt?(qt=(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[ft,Kt]}),t[188]=ft,t[189]=Kt,t[190]=qt):qt=t[190];let Jt;t[191]!==$||t[192]!==Z.cancel?(Jt=(0,R.jsx)(A,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[191]=$,t[192]=Z.cancel,t[193]=Jt):Jt=t[193];let Yt=!Le,Xt;t[194]!==Ae||t[195]!==Z.applyCurrent||t[196]!==Yt?(Xt=(0,R.jsx)(A,{type:`button`,variant:`secondary`,disabled:Yt,onClick:Ae,children:Z.applyCurrent}),t[194]=Ae,t[195]=Z.applyCurrent,t[196]=Yt,t[197]=Xt):Xt=t[197];let Zt;t[198]===De?Zt=t[199]:(Zt=()=>void De(),t[198]=De,t[199]=Zt);let Qt;t[200]===ze?Qt=t[201]:(Qt=ze?(0,R.jsx)(D,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,R.jsx)(p,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[200]=ze,t[201]=Qt);let $t=ze?Z.regenerate:Z.generate,en;t[202]!==Y||t[203]!==Zt||t[204]!==Qt||t[205]!==$t?(en=(0,R.jsxs)(A,{type:`button`,variant:`secondary`,disabled:Y,onClick:Zt,children:[Qt,$t]}),t[202]=Y,t[203]=Zt,t[204]=Qt,t[205]=$t,t[206]=en):en=t[206];let tn=!Ie,nn;t[207]!==Pe||t[208]!==Z.append||t[209]!==tn?(nn=(0,R.jsx)(A,{type:`button`,variant:`secondary`,disabled:tn,onClick:Pe,children:Z.append}),t[207]=Pe,t[208]=Z.append,t[209]=tn,t[210]=nn):nn=t[210];let rn=!Ie,an;t[211]!==Me||t[212]!==Z.replace||t[213]!==rn?(an=(0,R.jsx)(A,{type:`button`,variant:`primary`,disabled:rn,onClick:Me,children:Z.replace}),t[211]=Me,t[212]=Z.replace,t[213]=rn,t[214]=an):an=t[214];let on;t[215]!==Jt||t[216]!==Xt||t[217]!==en||t[218]!==nn||t[219]!==an?(on=(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Jt,Xt,en,nn,an]}),t[215]=Jt,t[216]=Xt,t[217]=en,t[218]=nn,t[219]=an,t[220]=on):on=t[220];let sn;t[221]!==Ze||t[222]!==qt||t[223]!==on?(sn=(0,R.jsxs)(d,{children:[qe,(0,R.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,R.jsxs)(j,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ae,children:[Ze,qt,on]})})]}),t[221]=Ze,t[222]=qt,t[223]=on,t[224]=sn):sn=t[224];let cn;t[225]!==P||t[226]!==Ke||t[227]!==sn?(cn=(0,R.jsx)(g,{open:P,onOpenChange:Ke,children:sn}),t[225]=P,t[226]=Ke,t[227]=sn,t[228]=cn):cn=t[228];let ln;return t[229]!==cn||t[230]!==Ge?(ln=(0,R.jsxs)(R.Fragment,{children:[Ge,cn]}),t[229]=cn,t[230]=Ge,t[231]=ln):ln=t[231],ln}function ie(e){return!e}function ae(e){return e.preventDefault()}function B(e,t){return e[t]??t}function V(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function H(e){let t=(0,N.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,y,b,S,C,w,T;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){b=a(r).workflows;let e=v[n]??[];y=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{x(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,S=`flex flex-col gap-3`,C=e.map(e=>{let t=B(b.args,e.labelKey),a=B(b.args,e.placeholderKey),c=o[e.key]??``;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,R.jsx)(z,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,R.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,R.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),w=y&&h.length>0?(0,R.jsx)(V,{examples:h,labels:b,onSelect:_}):null,T=g?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:b.goalLabel}),p?(0,R.jsx)(z,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:b.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,R.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:b.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=y,t[14]=b,t[15]=S,t[16]=C,t[17]=w,t[18]=T}else _=t[12],y=t[13],b=t[14],S=t[15],C=t[16],w=t[17],T=t[18];let E;t[23]!==_||t[24]!==h||t[25]!==y||t[26]!==b?(E=!y&&h.length>0?(0,R.jsx)(V,{examples:h,labels:b,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=y,t[26]=b,t[27]=E):E=t[27];let D;return t[28]!==S||t[29]!==C||t[30]!==w||t[31]!==T||t[32]!==E?(D=(0,R.jsxs)(`div`,{className:S,children:[C,w,T,E]}),t[28]=S,t[29]=C,t[30]=w,t[31]=T,t[32]=E,t[33]=D):D=t[33],D}var U=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function W(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function G({schema:e,value:t,onChange:n,labels:r,aiAssist:a,onValidChange:o}){let s=(0,M.useMemo)(()=>K(e),[e]),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,M.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!1)}};return(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,R.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(U,`min-h-40 font-mono text-xs leading-5`)}),f?(0,R.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,R.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,R.jsx)(oe,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function oe(e){let t=(0,N.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:l}=e,u=n.schema.title||n.key,d=typeof n.schema.description==`string`?n.schema.description:void 0,f=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,p;t[0]===n.schema.enum?p=t[1]:(p=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=p);let m=p,h=!!o&&!m.length&&(f===`string`||!f),g=String(u),_=n.required?` *`:``,v;t[2]!==g||t[3]!==_?(v=(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[g,_]}),t[2]=g,t[3]=_,t[4]=v):v=t[4];let y;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==l||t[10]!==h||t[11]!==u||t[12]!==r?(y=h&&o?(0,R.jsx)(z,{value:typeof r==`string`?r:r==null?``:String(r),onApply:l,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(u),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=l,t[10]=h,t[11]=u,t[12]=r,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]===d?x=t[18]:(x=d?(0,R.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:d}):null,t[17]=d,t[18]=x);let S;t[19]!==d||t[20]!==m||t[21]!==a||t[22]!==l||t[23]!==f||t[24]!==r?(S=m.length>0?(0,R.jsxs)(c,{value:r==null?``:String(r),onChange:e=>l(e.target.value),className:U,children:[(0,R.jsx)(k,{value:``}),m.map(se)]}):f===`boolean`?(0,R.jsxs)(c,{value:typeof r==`boolean`?String(r):``,onChange:e=>l(e.target.value===``?void 0:e.target.value===`true`),className:U,children:[(0,R.jsx)(k,{value:``}),(0,R.jsx)(k,{value:`true`,children:a.booleanTrue}),(0,R.jsx)(k,{value:`false`,children:a.booleanFalse})]}):f===`number`||f===`integer`?(0,R.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>l(e.target.value===``?void 0:Number(e.target.value)),className:U}):(0,R.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>l(e.target.value),className:i(U,d&&d.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=d,t[20]=m,t[21]=a,t[22]=l,t[23]=f,t[24]=r,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,R.jsxs)(`div`,{className:`block`,children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}function se(e){return(0,R.jsx)(k,{value:String(e),children:String(e)},String(e))}function K(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function q(e,t){return!W(e)||!e?!0:K(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function J(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e,t){if(e)return W(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:h(t.argValues)}function X(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=C(e,t);if(W(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.join(` · `):r.noInputSummary}function ce(e,t,n=!0){return e?n?W(e.inputSchema)?q(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(v[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function le(e){let t=(0,N.c)(114),{definition:n,language:r,value:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=C(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,M.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=W(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,w,T,E,D,O,ee,k,A;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(ce(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let C=y,j;t[42]!==d||t[43]!==o?(j=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=j):j=t[44];let M=j,N;if(t[45]!==_||t[46]!==C||t[47]!==o.schemaInput?(N=e=>{if(e.field===`goal`){_(e.text);return}C({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=C,t[47]=o.schemaInput,t[48]=N):N=t[48],x=N,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==M||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,R.jsx)(H,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:M,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=M,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],E=i;break bb0}w=`flex flex-col gap-3`,t[65]!==c||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==u||t[75]!==C||t[76]!==o?(T=n.inputSchema?(0,R.jsx)(G,{schema:n.inputSchema,value:o.schemaInput,onChange:C,onValidChange:(e,t)=>{g(e),u?.(ce(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=c,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=u,t[75]=C,t[76]=o,t[77]=T):T=t[77],A=`flex flex-col gap-1`;let P;t[78]===f.goalLabel?P=t[79]:(P=(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=P);let F;t[80]!==c||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==o.goal||t[89]!==o.schemaInput?(F=c?(0,R.jsx)(z,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=o.goal,t[89]=o.schemaInput,t[90]=F):F=t[90],t[91]!==P||t[92]!==F?(S=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[P,F]}),t[91]=P,t[92]=F,t[93]=S):S=t[93],D=o.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),ee=f.goalPlaceholder,k=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=x,t[22]=S,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=ee,t[29]=k,t[30]=A}else x=t[21],S=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],ee=t[28],k=t[29],A=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let j;t[96]!==D||t[97]!==O||t[98]!==ee||t[99]!==k?(j=(0,R.jsx)(`textarea`,{value:D,onChange:O,placeholder:ee,className:k}),t[96]=D,t[97]=O,t[98]=ee,t[99]=k,t[100]=j):j=t[100];let P;t[101]!==S||t[102]!==j||t[103]!==A?(P=(0,R.jsxs)(`div`,{className:A,children:[S,j]}),t[101]=S,t[102]=j,t[103]=A,t[104]=P):P=t[104];let F;t[105]!==x||t[106]!==v||t[107]!==f?(F=(0,R.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=F):F=t[108];let I;return t[109]!==w||t[110]!==T||t[111]!==P||t[112]!==F?(I=(0,R.jsxs)(`div`,{className:w,children:[T,P,F]}),t[109]=w,t[110]=T,t[111]=P,t[112]=F,t[113]=I):I=t[113],I}function ue(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?E(t.agentScaleExact,{count:n.min}):E(t.agentScaleRange,{min:n.min,max:n.max}):E(t.agentScaleExact,{count:e.defaults.maxSubagents})}function Z(e){let t=(0,N.c)(41),{definition:n,language:r,value:o,onChange:s,mode:c,badgeLabel:l,aiAssist:u,inputClassName:d,showTimeout:p,defaultAdvancedOpen:m,onValidityChange:h}=e,g=p===void 0?!1:p,v=m===void 0?!1:m,y=a(r).workflows,[b,x]=(0,M.useState)(v),S;t[0]!==n||t[1]!==r?(S=C(n,r),t[0]=n,t[1]=r,t[2]=S):S=t[2];let w=S,D;t[3]!==n.defaults||t[4]!==o.concurrency?(D=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=D):D=t[5];let k=D,A;t[6]!==n.defaults||t[7]!==o.maxSubagents?(A=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=A):A=t[8];let j=A,P;t[9]!==n||t[10]!==r||t[11]!==o?(P=X(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=P):P=t[12];let F=P,I=l??y.readyToStart,L;t[13]!==s||t[14]!==o?(L=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=L):L=t[15];let te=L,ne=c===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,re;t[16]===ne?re=t[17]:(re=i(`space-y-4`,ne),t[16]=ne,t[17]=re);let z=F||w.description,ie;t[18]===z?ie=t[19]:(ie=(0,R.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:z}),t[18]=z,t[19]=ie);let ae;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,R.jsx)(O,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ae):ae=t[20];let B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,R.jsx)(f,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=B):B=t[21];let V;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,R.jsx)(T,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=V):V=t[22];let H;t[23]!==s||t[24]!==o?(H=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=H):H=t[25];let U;t[26]===h?U=t[27]:(U=e=>{h?.(e)},t[26]=h,t[27]=U);let W;t[28]!==u||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==H||t[33]!==U||t[34]!==o?(W=(0,R.jsx)(le,{definition:n,language:r,value:o,onChange:H,onValidityChange:U,aiAssist:u,inputClassName:d}),t[28]=u,t[29]=n,t[30]=d,t[31]=r,t[32]=H,t[33]=U,t[34]=o,t[35]=W):W=t[35];let G;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>x(de),t[36]=G):G=t[36];let oe=y.advancedSettings,se=b&&`rotate-180`,K;t[37]===se?K=t[38]:(K=i(`size-4 transition-transform`,se),t[37]=se,t[38]=K);let q;return t[39]===K?q=t[40]:(q=(0,R.jsx)(ee,{className:K}),t[39]=K,t[40]=q),(0,R.jsxs)(`div`,{className:re,children:[(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:y.runPlanPreview}),ie]}),(0,R.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:I})]}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ae,(0,R.jsx)(`span`,{children:E(y.phaseCount,{count:n.phases.length})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[B,(0,R.jsx)(`span`,{children:ue(n,y)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,R.jsx)(`span`,{children:E(y.runLimitsSummary,{concurrency:k,max:j})})]})]}),n.phases.length>0?(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,R.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),y.startPlanPhases]}),(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(Q)})]}):null]}),W,(0,R.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:G,children:[oe,q]}),b?(0,R.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,R.jsx)(`input`,{value:o.concurrency,onChange:e=>te({concurrency:e.target.value}),placeholder:E(y.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,R.jsx)(`input`,{value:o.maxSubagents,onChange:e=>te({maxSubagents:e.target.value}),placeholder:E(y.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),g?(0,R.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>te({timeoutSeconds:e.target.value}),placeholder:E(y.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function de(e){return!e}function Q(e,t){return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,R.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,R.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{z as i,Y as n,ce as r,Z as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-YzjnURPJ.js";import{Do as a,Ga as o,Ha as s,Ka as c,Ua as l,Va as u,Wa as d,Z as f}from"./index-C4k6QSXw.js";import{n as p,t as m}from"./workflow-run-setup-panel-Ci9GSPnS.js";var h=n(),g=e(t(),1),_=r();function v(e){let t=(0,h.c)(58),{open:n,definition:r,language:v,starting:y,onClose:b,onStart:x}=e,S;t[0]===v?S=t[1]:(S=i(v),t[0]=v,t[1]=S);let C=S.workflows,w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w={goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},t[2]=w):w=t[2];let[T,E]=(0,g.useState)(w),D;t[3]!==r||t[4]!==v?(D=r?f(r,v):null,t[3]=r,t[4]=v,t[5]=D):D=t[5];let O=D,k;t[6]!==r||t[7]!==n?(k=()=>{!n||!r||E({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``})},t[6]=r,t[7]=n,t[8]=k):k=t[8];let A=r?.id,j;if(t[9]!==n||t[10]!==A?(j=[n,A],t[9]=n,t[10]=A,t[11]=j):j=t[11],(0,g.useEffect)(k,j),!r||!O)return null;let M;t[12]!==r||t[13]!==T||t[14]!==O.description||t[15]!==x?(M=()=>{let e=p(r,T);x({goal:T.goal.trim()||O.description,input:e,concurrency:T.concurrency.trim()?Number(T.concurrency):void 0,maxSubagents:T.maxSubagents.trim()?Number(T.maxSubagents):void 0})},t[12]=r,t[13]=T,t[14]=O.description,t[15]=x,t[16]=M):M=t[16];let N=M,P;t[17]===b?P=t[18]:(P=e=>!e&&b(),t[17]=b,t[18]=P);let F;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,_.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[19]=F):F=t[19];let I;t[20]!==r.title||t[21]!==C.startTitle?(I=(0,_.jsxs)(c,{className:`text-base font-semibold text-fg`,children:[C.startTitle,` · `,r.title]}),t[20]=r.title,t[21]=C.startTitle,t[22]=I):I=t[22];let L;t[23]===O.description?L=t[24]:(L=(0,_.jsx)(s,{className:`mt-1 text-sm text-fg-muted`,children:O.description}),t[23]=O.description,t[24]=L);let R;t[25]!==I||t[26]!==L?(R=(0,_.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[I,L]}),t[25]=I,t[26]=L,t[27]=R):R=t[27];let z;t[28]!==r.id||t[29]!==r.name||t[30]!==r.title||t[31]!==O.description?(z={context:{surface:`workflow-start`,workflowId:r.id,workflowName:r.name,workflowTitle:r.title,workflowDescription:O.description}},t[28]=r.id,t[29]=r.name,t[30]=r.title,t[31]=O.description,t[32]=z):z=t[32];let B;t[33]!==r||t[34]!==T||t[35]!==C.readyToStart||t[36]!==v||t[37]!==z?(B=(0,_.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-auto px-5 py-4`,children:(0,_.jsx)(m,{definition:r,language:v,value:T,onChange:E,mode:`manual`,badgeLabel:C.readyToStart,aiAssist:z})}),t[33]=r,t[34]=T,t[35]=C.readyToStart,t[36]=v,t[37]=z,t[38]=B):B=t[38];let V;t[39]!==C.cancelDialog||t[40]!==b||t[41]!==y?(V=(0,_.jsx)(a,{variant:`secondary`,onClick:b,disabled:y,children:C.cancelDialog}),t[39]=C.cancelDialog,t[40]=b,t[41]=y,t[42]=V):V=t[42];let H=y?C.starting:C.start,U;t[43]!==y||t[44]!==N||t[45]!==H?(U=(0,_.jsx)(a,{variant:`primary`,onClick:N,disabled:y,children:H}),t[43]=y,t[44]=N,t[45]=H,t[46]=U):U=t[46];let W;t[47]!==V||t[48]!==U?(W=(0,_.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[V,U]}),t[47]=V,t[48]=U,t[49]=W):W=t[49];let G;t[50]!==R||t[51]!==B||t[52]!==W?(G=(0,_.jsxs)(d,{children:[F,(0,_.jsxs)(u,{className:`fixed left-1/2 top-1/2 z-66 flex max-h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[R,B,W]})]}),t[50]=R,t[51]=B,t[52]=W,t[53]=G):G=t[53];let K;return t[54]!==n||t[55]!==G||t[56]!==P?(K=(0,_.jsx)(o,{open:n,onOpenChange:P,children:G}),t[54]=n,t[55]=G,t[56]=P,t[57]=K):K=t[57],K}export{v as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-Bq4REfIj.js";import{Ba as a,Ha as o,Ua as s,Va as c,Wa as l,Z as u,wo as d,za as f}from"./index-DOetFpTt.js";import{n as p,t as m}from"./workflow-run-setup-panel-IidqhbUI.js";var h=n(),g=e(t(),1),_=r();function v(e){let t=(0,h.c)(58),{open:n,definition:r,language:v,starting:y,onClose:b,onStart:x}=e,S;t[0]===v?S=t[1]:(S=i(v),t[0]=v,t[1]=S);let C=S.workflows,w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w={goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},t[2]=w):w=t[2];let[T,E]=(0,g.useState)(w),D;t[3]!==r||t[4]!==v?(D=r?u(r,v):null,t[3]=r,t[4]=v,t[5]=D):D=t[5];let O=D,k;t[6]!==r||t[7]!==n?(k=()=>{!n||!r||E({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``})},t[6]=r,t[7]=n,t[8]=k):k=t[8];let A=r?.id,j;if(t[9]!==n||t[10]!==A?(j=[n,A],t[9]=n,t[10]=A,t[11]=j):j=t[11],(0,g.useEffect)(k,j),!r||!O)return null;let M;t[12]!==r||t[13]!==T||t[14]!==O.description||t[15]!==x?(M=()=>{let e=p(r,T);x({goal:T.goal.trim()||O.description,input:e,concurrency:T.concurrency.trim()?Number(T.concurrency):void 0,maxSubagents:T.maxSubagents.trim()?Number(T.maxSubagents):void 0})},t[12]=r,t[13]=T,t[14]=O.description,t[15]=x,t[16]=M):M=t[16];let N=M,P;t[17]===b?P=t[18]:(P=e=>!e&&b(),t[17]=b,t[18]=P);let F;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,_.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[19]=F):F=t[19];let I;t[20]!==r.title||t[21]!==C.startTitle?(I=(0,_.jsxs)(l,{className:`text-base font-semibold text-fg`,children:[C.startTitle,` · `,r.title]}),t[20]=r.title,t[21]=C.startTitle,t[22]=I):I=t[22];let L;t[23]===O.description?L=t[24]:(L=(0,_.jsx)(a,{className:`mt-1 text-sm text-fg-muted`,children:O.description}),t[23]=O.description,t[24]=L);let R;t[25]!==I||t[26]!==L?(R=(0,_.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[I,L]}),t[25]=I,t[26]=L,t[27]=R):R=t[27];let z;t[28]!==r.id||t[29]!==r.name||t[30]!==r.title||t[31]!==O.description?(z={context:{surface:`workflow-start`,workflowId:r.id,workflowName:r.name,workflowTitle:r.title,workflowDescription:O.description}},t[28]=r.id,t[29]=r.name,t[30]=r.title,t[31]=O.description,t[32]=z):z=t[32];let B;t[33]!==r||t[34]!==T||t[35]!==C.readyToStart||t[36]!==v||t[37]!==z?(B=(0,_.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-auto px-5 py-4`,children:(0,_.jsx)(m,{definition:r,language:v,value:T,onChange:E,mode:`manual`,badgeLabel:C.readyToStart,aiAssist:z})}),t[33]=r,t[34]=T,t[35]=C.readyToStart,t[36]=v,t[37]=z,t[38]=B):B=t[38];let V;t[39]!==C.cancelDialog||t[40]!==b||t[41]!==y?(V=(0,_.jsx)(d,{variant:`secondary`,onClick:b,disabled:y,children:C.cancelDialog}),t[39]=C.cancelDialog,t[40]=b,t[41]=y,t[42]=V):V=t[42];let H=y?C.starting:C.start,U;t[43]!==y||t[44]!==N||t[45]!==H?(U=(0,_.jsx)(d,{variant:`primary`,onClick:N,disabled:y,children:H}),t[43]=y,t[44]=N,t[45]=H,t[46]=U):U=t[46];let W;t[47]!==V||t[48]!==U?(W=(0,_.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[V,U]}),t[47]=V,t[48]=U,t[49]=W):W=t[49];let G;t[50]!==R||t[51]!==B||t[52]!==W?(G=(0,_.jsxs)(o,{children:[F,(0,_.jsxs)(f,{className:`fixed left-1/2 top-1/2 z-66 flex max-h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[R,B,W]})]}),t[50]=R,t[51]=B,t[52]=W,t[53]=G):G=t[53];let K;return t[54]!==n||t[55]!==G||t[56]!==P?(K=(0,_.jsx)(s,{open:n,onOpenChange:P,children:G}),t[54]=n,t[55]=G,t[56]=P,t[57]=K):K=t[57],K}export{v as t};