@xopcai/xopc 0.0.207 → 0.0.208

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 (136) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-BmpM0zwM.js → activity-store-D0mYZqhc.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DhK5wi6_.js → agent-avatar-dicebear-MWLQWL_i.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-Bl8FQZxW.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-CzaAcDOn.js → api-DZA1yVzM.js} +1 -1
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-B2X6quAF.js +1 -0
  8. package/dist/gateway/static/root/assets/appearance-settings-BZW-c38q.js +1 -0
  9. package/dist/gateway/static/root/assets/apps-page-CRUgTO10.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-CgnzBplN.js → archive-plugin-CK-gsjsJ.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-Cuybcmhn.js → attachment-load-EJGP4rCw.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-DrSwolhG.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-D6BBx6Ps.js → binary-plugins-Tbss_4P-.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-Dk1c3Spa.js → block-editor-C-dOWigw.js} +47 -47
  15. package/dist/gateway/static/root/assets/browser-settings-page-NlvDyMwD.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-DvfIzCgV.js → browser-workflow-inputs-DW06Zo1N.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-DZScuPlF.js → browser-workflows-page-B6RnRGwm.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-BWXUznw5.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-hoA8R_J1.js → capability-presets-api-Cc3BtQar.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-D0loEbzq.js +3 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-BS8I65NT.js → channel-recipient-api-BvZO5FaO.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-settings-CcivCw8U.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-status-swr-DkHAD2Zn.js +1 -0
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-BIPhWBDI.js → chat-terminal-dock-DVedGAeX.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connectors-api-B_78jmvM.js → connectors-api-CUl6_EQJ.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-DlBSlfkv.js +2 -0
  27. package/dist/gateway/static/root/assets/{cron-expression-BBheaBIr.js → cron-expression-BD9MgoE_.js} +1 -1
  28. package/dist/gateway/static/root/assets/{date-picker-CDwj7UrT.js → date-picker-ChqNmoxw.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-Dnrc2qZe.js → dependency-picker-CDUmFs6H.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-Bj_vUjXp.js → desktop-pet-D61gqxaD.js} +1 -1
  31. package/dist/gateway/static/root/assets/desktop-pet-settings-QvuJvIX_.js +1 -0
  32. package/dist/gateway/static/root/assets/directory-picker-path-field-DvXMvDNY.js +1 -0
  33. package/dist/gateway/static/root/assets/{extension-debug-page-_GZ4y2da.js → extension-debug-page-DMdVTAQ3.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-scR96Edg.js → extension-page-BNzxZtaK.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-settings-page-DoEfyizU.js +1 -0
  36. package/dist/gateway/static/root/assets/{gateway-config-api-984O_4wM.js → gateway-config-api-o7AKvthC.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-D4hvsdJA.js → gateway-config-swr-BQbkUP5X.js} +1 -1
  38. package/dist/gateway/static/root/assets/gateway-settings-TO5YYZ9a.js +1 -0
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-Deo5-O87.js → gateway-startup-retry-DIgdpHgk.js} +1 -1
  40. package/dist/gateway/static/root/assets/heartbeat-settings-UZAn1aAQ.js +1 -0
  41. package/dist/gateway/static/root/assets/home-page-CRJDpy5E.js +3 -0
  42. package/dist/gateway/static/root/assets/index-BSjP0Wsx.css +2 -0
  43. package/dist/gateway/static/root/assets/index-C2ZYFBGL.js +85 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGmOlNcB.js → keyboard-shortcuts-settings-4xaM3jjU.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-D9bguWRo.js +2 -0
  46. package/dist/gateway/static/root/assets/{local-apps-page-CzS2sCxg.js → local-apps-page-C1xDicdr.js} +1 -1
  47. package/dist/gateway/static/root/assets/{locale-store-C7xtkP3D.js → locale-store-pByvK12G.js} +1 -1
  48. package/dist/gateway/static/root/assets/logs-page-Gr-nE4nW.js +2 -0
  49. package/dist/gateway/static/root/assets/{management-settings-Cpxs43JB.js → management-settings-D1XdHm7v.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-split-CQvFHxUa.js → markdown-split-B_Ijq1Fr.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-view-BRwrSbwM.js → markdown-view-CyJlGUxB.js} +1 -1
  52. package/dist/gateway/static/root/assets/{media-plugins-Bs9MsiaM.js → media-plugins-CXXNRROJ.js} +1 -1
  53. package/dist/gateway/static/root/assets/messages-yG5P43Q9.js +3 -0
  54. package/dist/gateway/static/root/assets/{notes-page-Dux_g6aZ.js → notes-page-rkePB4CB.js} +1 -1
  55. package/dist/gateway/static/root/assets/notes-workbench-CpbD4XG2.js +4 -0
  56. package/dist/gateway/static/root/assets/page-tabs-gw-RMQCV.js +1 -0
  57. package/dist/gateway/static/root/assets/preview-open-alternatives-B8aMScJ2.js +1 -0
  58. package/dist/gateway/static/root/assets/{product-open-page-f_jbg-9N.js → product-open-page-CjcpkWAz.js} +1 -1
  59. package/dist/gateway/static/root/assets/project-detail-page-GvSYDbjR.js +1 -0
  60. package/dist/gateway/static/root/assets/projects-page-DPRxKGbs.js +1 -0
  61. package/dist/gateway/static/root/assets/remote-access-hub-WIzeu-gB.js +1 -0
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-zapSiJrv.js → runtime-tools-settings-panel-Ch5qq86o.js} +2 -2
  63. package/dist/gateway/static/root/assets/{schema-form-CFyz8y5v.js → schema-form-DHYWYUFt.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-2XEJM0YE.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-g1GThZ0O.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-form-section-DlzZx0-i.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DFUJEv4G.js → settings-loading-skeleton-BVLhreQi.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-Cnp9Bdd0.js → settings-page-BJU-kUnN.js} +1 -1
  69. package/dist/gateway/static/root/assets/setup-status-panel-C6qj2L-q.js +1 -0
  70. package/dist/gateway/static/root/assets/{share-preview-page-DA8nA4cz.js → share-preview-page-hvIuZXMe.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-BBpE1bep.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-DXORBJNk.js +1 -0
  73. package/dist/gateway/static/root/assets/skills-page-Dlvuh7D-.js +2 -0
  74. package/dist/gateway/static/root/assets/{skills-page.utils--1-vOg3V.js → skills-page.utils-B6ddOpnf.js} +1 -1
  75. package/dist/gateway/static/root/assets/system-settings-panel-BdbCAyoA.js +1 -0
  76. package/dist/gateway/static/root/assets/task-detail-page-DC0hc8hp.js +1 -0
  77. package/dist/gateway/static/root/assets/{theme-store-DoyRfkoi.js → theme-store-BtdGacMI.js} +1 -1
  78. package/dist/gateway/static/root/assets/typed-models-lib-CL6qHYJA.js +1 -0
  79. package/dist/gateway/static/root/assets/{use-autosave-DzIR5Lxf.js → use-autosave-DysNnqCS.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-context-page-Bwg4KV8B.js +1 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-B7MZS8tS.js → voice-api-key-field-UEsO9Jr-.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-zyX6yxxF.js → work-discovery-overlay-B9disASf.js} +1 -1
  83. package/dist/gateway/static/root/assets/work-discovery-page-CmPfOfHl.js +1 -0
  84. package/dist/gateway/static/root/assets/workflow-run-setup-panel-A0zTQHFQ.js +3 -0
  85. package/dist/gateway/static/root/assets/workflows-page-DhQNh7W6.js +5 -0
  86. package/dist/gateway/static/root/index.html +11 -15
  87. package/dist/package.js +1 -1
  88. package/dist/src/gateway/heartbeat/service.js +1 -1
  89. package/dist/src/heartbeat/index.js +1 -1
  90. package/package.json +3 -3
  91. package/dist/gateway/static/root/assets/agents-Bc3Lc-n2.js +0 -68
  92. package/dist/gateway/static/root/assets/app-management-settings-panel-Dqj5G_cd.js +0 -1
  93. package/dist/gateway/static/root/assets/appearance-settings-Bm1uLGMi.js +0 -1
  94. package/dist/gateway/static/root/assets/apps-page-BKtwU47-.js +0 -1
  95. package/dist/gateway/static/root/assets/automations-page-ilGeRLDN.js +0 -6
  96. package/dist/gateway/static/root/assets/browser-settings-page-BCu8AZbs.js +0 -8
  97. package/dist/gateway/static/root/assets/capabilities-settings-panel-BbWQBtTe.js +0 -7
  98. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BTVU46Yn.js +0 -3
  99. package/dist/gateway/static/root/assets/channels-settings-BEQsC9a9.js +0 -1
  100. package/dist/gateway/static/root/assets/channels-status-swr-DRwbgtOT.js +0 -1
  101. package/dist/gateway/static/root/assets/connectors-page-w_3kpqbc.js +0 -2
  102. package/dist/gateway/static/root/assets/desktop-pet-settings-uiCwJJk4.js +0 -1
  103. package/dist/gateway/static/root/assets/directory-picker-path-field-D0zUQ-TO.js +0 -1
  104. package/dist/gateway/static/root/assets/extension-settings-page-CILsAwxx.js +0 -1
  105. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
  106. package/dist/gateway/static/root/assets/gateway-settings-aF4eQHo3.js +0 -1
  107. package/dist/gateway/static/root/assets/heartbeat-settings-D5DrFWH6.js +0 -1
  108. package/dist/gateway/static/root/assets/home-page-DiMWxngC.js +0 -3
  109. package/dist/gateway/static/root/assets/index-DzKLVgY-.js +0 -85
  110. package/dist/gateway/static/root/assets/index-wR5jX-lw.css +0 -2
  111. package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +0 -1
  112. package/dist/gateway/static/root/assets/local-app-workbench-page-De8vuwu1.js +0 -2
  113. package/dist/gateway/static/root/assets/logs-page-BI9stsVO.js +0 -2
  114. package/dist/gateway/static/root/assets/messages-Dxk5Rzj_.js +0 -3
  115. package/dist/gateway/static/root/assets/notes-workbench-CGafcgJ8.js +0 -4
  116. package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +0 -1
  117. package/dist/gateway/static/root/assets/preview-open-alternatives-fvhtN4Y2.js +0 -1
  118. package/dist/gateway/static/root/assets/project-detail-page-C6mNsjYr.js +0 -1
  119. package/dist/gateway/static/root/assets/projects-page-D1G6VIxR.js +0 -1
  120. package/dist/gateway/static/root/assets/remote-access-hub-CIez6X0x.js +0 -1
  121. package/dist/gateway/static/root/assets/sessions-page-6irxQjHb.js +0 -1
  122. package/dist/gateway/static/root/assets/settings-advanced-gate-CRb0QTG2.js +0 -1
  123. package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +0 -1
  124. package/dist/gateway/static/root/assets/settings-form-section-DCiK4TIq.js +0 -1
  125. package/dist/gateway/static/root/assets/setup-status-panel-BFMGTGBO.js +0 -1
  126. package/dist/gateway/static/root/assets/shares-settings-CaKfvJzQ.js +0 -1
  127. package/dist/gateway/static/root/assets/skill-reload-api-BOBUcYr5.js +0 -1
  128. package/dist/gateway/static/root/assets/skills-page-BJJACxzz.js +0 -2
  129. package/dist/gateway/static/root/assets/system-settings-panel-DY0lIaXY.js +0 -1
  130. package/dist/gateway/static/root/assets/task-detail-page-Ciuwe7AG.js +0 -1
  131. package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
  132. package/dist/gateway/static/root/assets/user-context-page-yf18T_BZ.js +0 -1
  133. package/dist/gateway/static/root/assets/work-discovery-page-2e5J0sIp.js +0 -1
  134. package/dist/gateway/static/root/assets/workflow-run-setup-panel-Cj1vPWRM.js +0 -3
  135. package/dist/gateway/static/root/assets/workflows-page-D37zWlWY.js +0 -5
  136. package/dist/gateway/static/root/assets/working-directory-picker-modal-Bm7cox3y.js +0 -1
@@ -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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./locale-store-pByvK12G.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{Co as S,Dl as C,Hl as w,Ia as T,Il as E,Ls as D,So as O,Vl as k,Yc as A,_o as j,ac as M,bo as N,co as P,do as F,fo as I,go as L,ho as R,lo as z,ml as B,mo as V,pc as H,po as U,qa as W,so as G,uo as K,vo as q,vs as J,xo as ee,yo as Y}from"./index-C2ZYFBGL.js";import{n as te,t as ne}from"./use-autosave-DysNnqCS.js";import{t as re}from"./page-tabs-gw-RMQCV.js";import{F as ie,a as ae,i as oe}from"./connectors-api-CUl6_EQJ.js";var X=n(),Z=e(t(),1),Q=r(),se=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),$=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ce={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`关于你`,subtitle:`清楚查看 xopc 知道什么、为什么知道,以及应该如何与你协作。`,profile:`个人资料`,understanding:`对你的理解`,collaboration:`协作约定`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},le={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},ue={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function de(e){let t=(0,X.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function fe(e){let t=(0,X.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function pe(e){let t=(0,X.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let x;t[1]===i?x=t[2]:(x=(0,Q.jsx)(y,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=x);let S;t[3]===a?S=t[4]:(S=(0,Q.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(d,{className:`size-4`}),t[8]=w):w=t[8];let T;t[9]===s?T=t[10]:(T=(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:w})}),t[9]=s,t[10]=T);let E;t[11]!==C||t[12]!==T?(E=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[11]=C,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,Q.jsx)(g,{asChild:!0,children:(0,Q.jsx)(f,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,Q.jsx)(f,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,Q.jsxs)(_,{children:[p,(0,Q.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,Q.jsx)(b,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function me(e){return JSON.stringify(e)}function he(e){let t=(0,X.c)(10),[n,r]=(0,Z.useState)(e),i;t[0]===e?i=t[1]:(i=me(e),t[0]=e,t[1]=i);let a=(0,Z.useRef)(i),o;t[2]===e?o=t[3]:(o=me(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>me(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Z.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function ge(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function _e(){let e=(0,X.c)(87),t=p(xe),n=ce[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&se.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=W(be),l=W(ye),{data:u,error:d,isLoading:f,mutate:m}=x(`/api/you`,V),h;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(h=()=>(c({startExtra:null,main:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=h):h=e[6];let g;if(e[7]!==l||e[8]!==c||e[9]!==n?(g=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=g):g=e[10],(0,Z.useEffect)(h,g),f){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,Q.jsx)(T,{className:`h-10 w-96 max-w-full`}),(0,Q.jsx)(T,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===m?t=e[13]:(t=()=>void m(),e[12]=m,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,Q.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,Q.jsx)(`div`,{className:`p-6`,children:(0,Q.jsxs)(fe,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let _=n.title,v;e[20]===a?v=e[21]:(v=e=>a({tab:e}),e[20]=a,e[21]=v);let y;e[22]===n.profile?y=e[23]:(y={id:`profile`,label:n.profile,icon:C},e[22]=n.profile,e[23]=y);let b;e[24]!==u.understandings.length||e[25]!==n.understanding?(b={id:`understanding`,label:n.understanding,icon:w,count:u.understandings.length},e[24]=u.understandings.length,e[25]=n.understanding,e[26]=b):b=e[26];let S=n.collaboration,E;e[27]===u.rules?E=e[28]:(E=u.rules.filter(ve),e[27]=u.rules,e[28]=E);let O;e[29]!==n.collaboration||e[30]!==E.length?(O={id:`collaboration`,label:S,icon:A,count:E.length},e[29]=n.collaboration,e[30]=E.length,e[31]=O):O=e[31];let j;e[32]===n.sources?j=e[33]:(j={id:`sources`,label:n.sources,icon:k},e[32]=n.sources,e[33]=j);let M;e[34]===n.dreaming?M=e[35]:(M={id:`dreaming`,label:n.dreaming,icon:H},e[34]=n.dreaming,e[35]=M);let N;e[36]===n.privacy?N=e[37]:(N={id:`privacy`,label:n.privacy,icon:D},e[36]=n.privacy,e[37]=N);let P;e[38]!==j||e[39]!==M||e[40]!==N||e[41]!==y||e[42]!==b||e[43]!==O?(P=[y,b,O,j,M,N],e[38]=j,e[39]=M,e[40]=N,e[41]=y,e[42]=b,e[43]=O,e[44]=P):P=e[44];let F;e[45]!==n.title||e[46]!==P||e[47]!==v||e[48]!==s?(F=(0,Q.jsx)(re,{ariaLabel:_,activeTab:s,onChange:v,items:P}),e[45]=n.title,e[46]=P,e[47]=v,e[48]=s,e[49]=F):F=e[49];let I;e[50]!==u.profile||e[51]!==t||e[52]!==m||e[53]!==n||e[54]!==s?(I=s===`profile`?(0,Q.jsx)(Se,{profile:u.profile,language:t,t:n,onChanged:e=>m(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=u.profile,e[51]=t,e[52]=m,e[53]=n,e[54]=s,e[55]=I):I=e[55];let L;e[56]!==u.quality||e[57]!==u.understandings||e[58]!==t||e[59]!==m||e[60]!==n||e[61]!==s?(L=s===`understanding`?(0,Q.jsx)(we,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?m(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):m()}):null,e[56]=u.quality,e[57]=u.understandings,e[58]=t,e[59]=m,e[60]=n,e[61]=s,e[62]=L):L=e[62];let R;e[63]!==u.rules||e[64]!==t||e[65]!==m||e[66]!==n||e[67]!==s?(R=s===`collaboration`?(0,Q.jsx)(Me,{rules:u.rules,language:t,t:n,onChanged:()=>m()}):null,e[63]=u.rules,e[64]=t,e[65]=m,e[66]=n,e[67]=s,e[68]=R):R=e[68];let z;e[69]!==n||e[70]!==s?(z=s===`sources`?(0,Q.jsx)(Fe,{t:n}):null,e[69]=n,e[70]=s,e[71]=z):z=e[71];let B;e[72]!==u.consolidation?.lastRun||e[73]!==n||e[74]!==s?(B=s===`dreaming`?(0,Q.jsx)(Ie,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[72]=u.consolidation?.lastRun,e[73]=n,e[74]=s,e[75]=B):B=e[75];let U;e[76]!==n||e[77]!==s?(U=s===`privacy`?(0,Q.jsx)(Re,{t:n}):null,e[76]=n,e[77]=s,e[78]=U):U=e[78];let G;return e[79]!==F||e[80]!==I||e[81]!==L||e[82]!==R||e[83]!==z||e[84]!==B||e[85]!==U?(G=(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[F,I,L,R,z,B,U]}),e[79]=F,e[80]=I,e[81]=L,e[82]=R,e[83]=z,e[84]=B,e[85]=U,e[86]=G):G=e[86],G}function ve(e){return e.status===`active`}function ye(e){return e.clearPageHeader}function be(e){return e.setPageHeader}function xe(e){return e.language}function Se(e){let t=(0,X.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=ge(n),t[0]=n,t[1]=o);let s=o,[c,l]=he(s),u;t[2]===c?u=t[3]:(u=me(c),t[2]=c,t[3]=u);let d;t[4]===s?d=t[5]:(d=me(s),t[4]=s,t[5]=d);let p=u!==d,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await S({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==p||t[11]!==m?(h={value:c,dirty:p,delayMs:500,onSave:m},t[9]=c,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g=ne(h),_;t[13]!==c||t[14]!==l?(_=(e,t,n)=>(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,Q.jsx)(`input`,{className:$,placeholder:n,value:c[e],onChange:t=>l(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=l,t[15]=_):_=t[15];let v=_,y=g.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,Q.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[16]=i.profileHint,t[17]=b);let x;t[18]!==v||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=v(`callName`,i.callName,i.callNamePlaceholder),t[18]=v,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let C;t[22]!==v||t[23]!==i.role||t[24]!==i.rolePlaceholder?(C=v(`role`,i.role,i.rolePlaceholder),t[22]=v,t[23]=i.role,t[24]=i.rolePlaceholder,t[25]=C):C=t[25];let w;t[26]===i.primaryGoal?w=t[27]:(w=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=w);let T;t[28]===l?T=t[29]:(T=e=>l(t=>({...t,primaryGoal:e.target.value})),t[28]=l,t[29]=T);let E;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==T?(E=(0,Q.jsx)(`textarea`,{className:$,rows:3,placeholder:i.primaryGoalPlaceholder,value:c.primaryGoal,onChange:T}),t[30]=c.primaryGoal,t[31]=i.primaryGoalPlaceholder,t[32]=T,t[33]=E):E=t[33];let D;t[34]!==w||t[35]!==E?(D=(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[w,E]}),t[34]=w,t[35]=E,t[36]=D):D=t[36];let O;t[37]!==v||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(O=r===`en`?v(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=v,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=O):O=t[41];let k;t[42]===i.timezone?k=t[43]:(k=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=k);let A;t[44]===l?A=t[45]:(A=e=>l(t=>({...t,timezone:e.target.value})),t[44]=l,t[45]=A);let j;t[46]!==c.timezone||t[47]!==A?(j=(0,Q.jsx)(`input`,{className:`${$} min-w-0 flex-1`,value:c.timezone,onChange:A}),t[46]=c.timezone,t[47]=A,t[48]=j):j=t[48];let M;t[49]===l?M=t[50]:(M=()=>l(Ce),t[49]=l,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,Q.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[51]=i.detect,t[52]=M,t[53]=N):N=t[53];let P;t[54]!==j||t[55]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[54]=j,t[55]=N,t[56]=P):P=t[56];let F;t[57]!==k||t[58]!==P?(F=(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,P]}),t[57]=k,t[58]=P,t[59]=F):F=t[59];let I;t[60]!==v||t[61]!==i.locale?(I=v(`locale`,i.locale),t[60]=v,t[61]=i.locale,t[62]=I):I=t[62];let L;t[63]!==x||t[64]!==C||t[65]!==D||t[66]!==O||t[67]!==F||t[68]!==I?(L=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,C,D,O,F,I]}),t[63]=x,t[64]=C,t[65]=D,t[66]=O,t[67]=F,t[68]=I,t[69]=L):L=t[69];let R;t[70]!==g.error||t[71]!==g.status?(R=(0,Q.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,Q.jsx)(te,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let z;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(z=(0,Q.jsx)(de,{children:(0,Q.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=z):z=t[77],z}function Ce(e){return{...e,timezone:I()}}function we(e){let t=(0,X.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(`preference`),_;t[0]===n?_=t[1]:(_=n.filter(Ee),t[0]=n,t[1]=_);let v=_,y;t[2]===n?y=t[3]:(y=n.filter(Te),t[2]=n,t[3]=y);let b=y,x;t[4]!==h||t[5]!==c||t[6]!==p?(x=async e=>{e.preventDefault(),p.trim()&&(await P({statement:p,kind:h}),m(``),d(!1),await c())},t[4]=h,t[5]=c,t[6]=p,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=C);let w,T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!0),T=(0,Q.jsx)(u,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let E;t[12]===a.addUnderstanding?E=t[13]:(E=(0,Q.jsxs)(f,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=E);let D;t[14]!==C||t[15]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,E]}),t[14]=C,t[15]=E,t[16]=D):D=t[16];let O=a.addUnderstanding,k=a.understoodHint,A=a.add,j=a.cancel,M;t[17]===p?M=t[18]:(M=p.trim(),t[17]=p,t[18]=M);let N=!M,F;t[19]===a.statement?F=t[20]:(F=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=F);let I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>m(e.target.value),t[21]=I):I=t[21];let L;t[22]!==p||t[23]!==a.statement?(L=(0,Q.jsx)(`textarea`,{autoFocus:!0,className:$,rows:4,placeholder:a.statement,value:p,onChange:I}),t[22]=p,t[23]=a.statement,t[24]=L):L=t[24];let R;t[25]!==F||t[26]!==L?(R=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,L]}),t[25]=F,t[26]=L,t[27]=R):R=t[27];let z;t[28]===a.kind?z=t[29]:(z=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=z);let B,V;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>g(e.target.value),V=Object.entries(le),t[30]=B,t[31]=V):(B=t[30],V=t[31]);let H;t[32]===i?H=t[33]:(H=V.map(e=>{let[t,n]=e;return(0,Q.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=H);let U;t[34]!==h||t[35]!==H?(U=(0,Q.jsx)(o,{value:h,onChange:B,children:H}),t[34]=h,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==z||t[38]!==U?(W=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[z,U]}),t[37]=z,t[38]=U,t[39]=W):W=t[39];let G;t[40]!==l||t[41]!==S||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==N||t[47]!==R||t[48]!==W?(G=(0,Q.jsxs)(pe,{open:l,onOpenChange:d,title:O,description:k,submitLabel:A,cancelLabel:j,submitDisabled:N,onSubmit:S,children:[R,W]}),t[40]=l,t[41]=S,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=N,t[47]=R,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==r||t[51]!==a?(K=(0,Q.jsx)(De,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=K):K=t[52];let q;t[53]===a?q=t[54]:(q=(0,Q.jsx)(Ae,{t:a}),t[53]=a,t[54]=q);let J;t[55]!==i||t[56]!==c||t[57]!==b||t[58]!==a?(J=b.length?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:b.map(e=>(0,Q.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=b,t[58]=a,t[59]=J):J=t[59];let ee;t[60]!==v.length||t[61]!==a.active?(ee=(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,v.length]}),t[60]=v.length,t[61]=a.active,t[62]=ee):ee=t[62];let Y;t[63]!==v||t[64]!==i||t[65]!==c||t[66]!==a?(Y=v.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:v.map(e=>(0,Q.jsx)(ke,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,Q.jsx)(fe,{children:a.emptyUnderstanding}),t[63]=v,t[64]=i,t[65]=c,t[66]=a,t[67]=Y):Y=t[67];let te;t[68]!==ee||t[69]!==Y?(te=(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[ee,Y]}),t[68]=ee,t[69]=Y,t[70]=te):te=t[70];let ne;return t[71]!==G||t[72]!==K||t[73]!==q||t[74]!==J||t[75]!==te||t[76]!==D?(ne=(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[D,G,K,q,J,te]}),t[71]=G,t[72]=K,t[73]=q,t[74]=J,t[75]=te,t[76]=D,t[77]=ne):ne=t[77],ne}function Te(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ee(e){return e.status===`active`}function De(e){let t=(0,X.c)(32),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==m||t[21]!==_||t[22]!==c||t[23]!==d?(v=[c,d,m,_],t[20]=m,t[21]=_,t[22]=c,t[23]=d,t[24]=v):v=t[24];let y=v,b;t[25]===r.qualityTitle?b=t[26]:(b=(0,Q.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[25]=r.qualityTitle,t[26]=b);let x;t[27]===y?x=t[28]:(x=y.map(Oe),t[27]=y,t[28]=x);let S;return t[29]!==b||t[30]!==x?(S=(0,Q.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Oe(e){let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,Q.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function ke(e){let t=(0,X.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,d]=he(n.statement),p=u!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await N(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:u,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=ne(g),v;t[11]!==u||t[12]!==o||t[13]!==d?(v=o?(0,Q.jsx)(`textarea`,{autoFocus:!0,className:$,value:u,onChange:e=>d(e.target.value),rows:3}):(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[11]=u,t[12]=o,t[13]=d,t[14]=v):v=t[14];let y=le[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,Q.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,Q.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==C||t[21]!==b?(w=(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==v?(T=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,w]}),t[23]=w,t[24]=v,t[25]=T):T=t[25];let E;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(E=o?(0,Q.jsx)(f,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,Q.jsxs)(f,{variant:`ghost`,onClick:()=>s(!0),children:[(0,Q.jsx)(M,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=E):E=t[30];let D;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(D=n.status===`active`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f,{variant:`primary`,onClick:async()=>{await a((await N(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,Q.jsx)(f,{onClick:async()=>{await a((await N(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=D):D=t[36];let O;t[37]!==c||t[38]!==n.id||t[39]!==a?(O=async()=>{if(!c){l(!0);return}await K(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=O):O=t[40];let k;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(J,{className:`size-3.5`}),t[41]=k):k=t[41];let A=c?i.confirmDelete:i.delete,j;t[42]!==O||t[43]!==A?(j=(0,Q.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:O,children:[k,A]}),t[42]=O,t[43]=A,t[44]=j):j=t[44];let P;t[45]!==E||t[46]!==D||t[47]!==j?(P=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[E,D,j]}),t[45]=E,t[46]=D,t[47]=j,t[48]=P):P=t[48];let F;t[49]!==T||t[50]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[T,P]}),t[49]=T,t[50]=P,t[51]=F):F=t[51];let I;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(I=o||_.status!==`idle`?(0,Q.jsx)(te,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=I):I=t[55];let L;return t[56]!==_.onBlurCapture||t[57]!==F||t[58]!==I?(L=(0,Q.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,Q.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[F,I]})}),t[56]=_.onBlurCapture,t[57]=F,t[58]=I,t[59]=L):L=t[59],L}function Ae(e){let t=(0,X.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=x(`you-focuses`,L),[s,c]=(0,Z.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(T,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,Q.jsx)(fe,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(je),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,u;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(u=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=u):u=t[32];let d=u,p;t[33]===n.focusHint?p=t[34]:(p=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,Q.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,d(e.confidence)]})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,Q.jsx)(f,{onClick:async()=>{await O(e.id,`paused`),await o()},children:n.pause}):(0,Q.jsx)(f,{variant:`primary`,onClick:async()=>{await O(e.id,`active`),await o()},children:n.activate}),(0,Q.jsx)(f,{variant:`ghost`,onClick:async()=>{await O(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,Q.jsx)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await O(e.id,`rejected`),await o()},children:n.reject}):null,(0,Q.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await F(e.id),c(null),await o()},children:[(0,Q.jsx)(J,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,Q.jsx)(fe,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function je(e){return e.status!==`rejected`}function Me(e){let t=(0,X.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Z.useState)(!1),[d,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(`communication`),[g,_]=(0,Z.useState)(null),v,y,b,x,S,C;if(t[0]!==c||t[1]!==m||t[2]!==g||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ne),w;t[25]!==m||t[26]!==a||t[27]!==d?(w=async e=>{e.preventDefault(),d.trim()&&(await G({statement:d,category:m}),p(``),l(!1),await a())},t[25]=m,t[26]=a,t[27]=d,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,Q.jsx)(u,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,Q.jsxs)(f,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===d?P=t[39]:(P=d.trim(),t[38]=d,t[39]=P);let F=!P,I;t[40]===i.ruleStatement?I=t[41]:(I=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=I);let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>p(e.target.value),t[42]=L):L=t[42];let R;t[43]!==d||t[44]!==i.ruleStatement?(R=(0,Q.jsx)(`textarea`,{autoFocus:!0,className:$,rows:4,placeholder:i.ruleStatement,value:d,onChange:L}),t[43]=d,t[44]=i.ruleStatement,t[45]=R):R=t[45];let B;t[46]!==I||t[47]!==R?(B=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[I,R]}),t[46]=I,t[47]=R,t[48]=B):B=t[48];let V;t[49]===i.category?V=t[50]:(V=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=V);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>h(e.target.value),U=Object.entries(ue),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,Q.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let K;t[55]!==m||t[56]!==W?(K=(0,Q.jsx)(o,{value:m,onChange:H,children:W}),t[55]=m,t[56]=W,t[57]=K):K=t[57];let q;t[58]!==V||t[59]!==K?(q=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,K]}),t[58]=V,t[59]=K,t[60]=q):q=t[60],t[61]!==c||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==F||t[68]!==B||t[69]!==q?(C=(0,Q.jsxs)(pe,{open:c,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:F,onSubmit:T,children:[B,q]}),t[61]=c,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=F,t[68]=B,t[69]=q,t[70]=C):C=t[70],v=`space-y-2`,y=(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,Q.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:ue[e.category][r]}),(0,Q.jsx)(`span`,{children:`·`}),(0,Q.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`·`}),(0,Q.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,Q.jsx)(f,{variant:`ghost`,onClick:async()=>{await Y(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,Q.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(g!==e.id){_(e.id);return}await z(e.id),_(null),await a()},children:[(0,Q.jsx)(J,{className:`size-3.5`}),g===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,Q.jsx)(fe,{children:i.emptyRules}),t[0]=c,t[1]=m,t[2]=g,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,Q.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,Q.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ne(e){return e.status!==`archived`}async function Pe(){let[e,t,n]=await Promise.all([U(),ae(),oe()]);return{grants:e,connectors:t,catalog:n}}function Fe({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`you-understanding-sources`,Pe),[o,s]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null);if(r)return(0,Q.jsx)(T,{className:`h-64 rounded-2xl`});if(n)return(0,Q.jsxs)(fe,{children:[e.error,` `,(0,Q.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let h=t?.grants??[],g=t?.connectors??[],_=new Map((t?.catalog??[]).map(e=>[e.id,e])),v=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=g.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?_.get(n.connectorId):[..._.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},y=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,b=async t=>{m(null),d(null),s({grantId:t.id,kind:`refresh`});try{await j(t.id),await i().catch(()=>void 0),m({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){m({tone:`error`,message:y(e)})}finally{s(null)}},S=async t=>{if(u!==t.id){d(t.id),m(null);return}s({grantId:t.id,kind:`revoke`});try{await q(t.id),await i().catch(()=>void 0),d(null),m({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){m({tone:`error`,message:y(e)})}finally{s(null)}};return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,Q.jsx)(f,{asChild:!0,variant:`primary`,children:(0,Q.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,Q.jsx)(c,{className:`size-4`})]})})]}),p?(0,Q.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${p.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:p.message}):null,(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,h.length]}),h.length?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:h.map(t=>{let n=v(t);return(0,Q.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,Q.jsx)(ie,{connector:n,size:`sm`}):(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,Q.jsx)(B,{className:`size-4 text-fg-muted`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),t.lastCollectedAt?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,Q.jsx)(f,{variant:`ghost`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`refresh`,onClick:()=>void b(t),children:o?.grantId===t.id&&o.kind===`refresh`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,Q.jsx)(f,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:o!==null,"aria-busy":o?.grantId===t.id&&o.kind===`revoke`,onClick:()=>void S(t),children:o?.grantId===t.id&&o.kind===`revoke`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):u===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,Q.jsx)(fe,{children:e.noSources})]}),(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,g.length]}),g.length?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:g.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=_.get(t.connectorId);return(0,Q.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Q.jsx)(ie,{connector:r??{displayName:t.displayName}}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,Q.jsx)(E,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,Q.jsx)(fe,{children:e.noConnectors})]})]})}function Ie(e){let t=(0,X.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=x(`you-context-settings`,R),u=i?.dreaming??null,[d,p]=he(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&me(d)!==me(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await ee({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==d||t[6]!==h||t[7]!==g?(_={value:d,dirty:h,delayMs:500,onSave:g},t[5]=d,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=ne(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,Q.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,Q.jsxs)(fe,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(T,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let S=v.onBlurCapture,C;t[20]===r.mode?C=t[21]:(C=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=C);let w;t[22]===p?w=t[23]:(w=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=w);let E;t[24]===r.on?E=t[25]:(E=(0,Q.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,Q.jsx)(s,{value:`off`,children:r.off}),t[26]=r.off,t[27]=D);let O;t[28]!==d.mode||t[29]!==D||t[30]!==w||t[31]!==E?(O=(0,Q.jsxs)(o,{value:d.mode,onChange:w,children:[E,D]}),t[28]=d.mode,t[29]=D,t[30]=w,t[31]=E,t[32]=O):O=t[32];let k;t[33]!==O||t[34]!==C?(k=(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[C,O]}),t[33]=O,t[34]=C,t[35]=k):k=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===p?j=t[39]:(j=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,Q.jsx)(`input`,{type:`time`,className:$,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let F=d.timezone??``,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=I(),t[48]=L):L=t[48];let z;t[49]===p?z=t[50]:(z=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=z);let B;t[51]!==F||t[52]!==z?(B=(0,Q.jsx)(`input`,{className:`${$} min-w-0 flex-1`,value:F,placeholder:L,onChange:z}),t[51]=F,t[52]=z,t[53]=B):B=t[53];let V;t[54]===p?V=t[55]:(V=()=>p(Le),t[54]=p,t[55]=V);let H;t[56]!==r.detect||t[57]!==V?(H=(0,Q.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[56]=r.detect,t[57]=V,t[58]=H):H=t[58];let U;t[59]!==B||t[60]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[B,H]}),t[59]=B,t[60]=H,t[61]=U):U=t[61];let W;t[62]!==P||t[63]!==U?(W=(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,U]}),t[62]=P,t[63]=U,t[64]=W):W=t[64];let G;t[65]===r.evidenceThreshold?G=t[66]:(G=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=G);let K;t[67]===p?K=t[68]:(K=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=K);let q;t[69]!==d.minEvidenceSources||t[70]!==K?(q=(0,Q.jsx)(`input`,{type:`number`,min:2,max:10,className:$,value:d.minEvidenceSources,onChange:K}),t[69]=d.minEvidenceSources,t[70]=K,t[71]=q):q=t[71];let J;t[72]!==G||t[73]!==q?(J=(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[G,q]}),t[72]=G,t[73]=q,t[74]=J):J=t[74];let Y;t[75]===r.scanLimit?Y=t[76]:(Y=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=Y);let re;t[77]===p?re=t[78]:(re=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=re);let ie;t[79]!==d.limit||t[80]!==re?(ie=(0,Q.jsx)(`input`,{type:`number`,min:1,max:2e3,className:$,value:d.limit,onChange:re}),t[79]=d.limit,t[80]=re,t[81]=ie):ie=t[81];let ae;t[82]!==Y||t[83]!==ie?(ae=(0,Q.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[Y,ie]}),t[82]=Y,t[83]=ie,t[84]=ae):ae=t[84];let oe;t[85]!==k||t[86]!==N||t[87]!==W||t[88]!==J||t[89]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[k,N,W,J,ae]}),t[85]=k,t[86]=N,t[87]=W,t[88]=J,t[89]=ae,t[90]=oe):oe=t[90];let Z;t[91]!==v.error||t[92]!==v.status?(Z=(0,Q.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,Q.jsx)(te,{status:v.status,error:v.error})}),t[91]=v.error,t[92]=v.status,t[93]=Z):Z=t[93];let se;t[94]!==v.onBlurCapture||t[95]!==oe||t[96]!==Z?(se=(0,Q.jsx)(de,{children:(0,Q.jsxs)(`div`,{onBlurCapture:S,children:[oe,Z]})}),t[94]=v.onBlurCapture,t[95]=oe,t[96]=Z,t[97]=se):se=t[97];let ce;t[98]===r.lastRun?ce=t[99]:(ce=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=ce);let le;t[100]!==n||t[101]!==y||t[102]!==r.neverRun||t[103]!==r.runItems?(le=n?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:y}),(0,Q.jsx)(`span`,{children:`·`}),(0,Q.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`·`}),(0,Q.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=y,t[102]=r.neverRun,t[103]=r.runItems,t[104]=le):le=t[104];let ue;t[105]!==ce||t[106]!==le?(ue=(0,Q.jsxs)(de,{children:[ce,le]}),t[105]=ce,t[106]=le,t[107]=ue):ue=t[107];let pe;return t[108]!==se||t[109]!==ue||t[110]!==b?(pe=(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[b,se,ue]}),t[108]=se,t[109]=ue,t[110]=b,t[111]=pe):pe=t[111],pe}function Le(e){return e&&{...e,timezone:I()}}function Re(e){let t=(0,X.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=x(`you-context-settings`,R),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=he(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await ee({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=ne(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,Q.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,Q.jsxs)(fe,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(T,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,Q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,Q.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,Q.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let S;t[25]===n.policyAllow?S=t[26]:(S=(0,Q.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=S);let C;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==S?(C=(0,Q.jsxs)(o,{value:u,onChange:v,children:[y,b,S]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=S,t[32]=C):C=t[32];let w;t[33]!==C||t[34]!==_?(w=(0,Q.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,C]}),t[33]=C,t[34]=_,t[35]=w):w=t[35];let E;t[36]===n.privacyWarning?E=t[37]:(E=(0,Q.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=E);let D;t[38]!==h.error||t[39]!==h.status?(D=(0,Q.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,Q.jsx)(te,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=D):D=t[40];let O;t[41]!==h.onBlurCapture||t[42]!==w||t[43]!==E||t[44]!==D?(O=(0,Q.jsx)(de,{children:(0,Q.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[w,E,D]})}),t[41]=h.onBlurCapture,t[42]=w,t[43]=E,t[44]=D,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==g?(k=(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[g,O]}),t[46]=O,t[47]=g,t[48]=k):k=t[48],k}export{_e as UserContextPage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-C7xtkP3D.js";import{n as o}from"./gateway-config-swr-D4hvsdJA.js";import{Ho as s}from"./index-DzKLVgY-.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function d(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};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,providers:i}}function _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/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 k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x as u};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-pByvK12G.js";import{n as o}from"./gateway-config-swr-BQbkUP5X.js";import{Jo as s}from"./index-C2ZYFBGL.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function d(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};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,providers:i}}function _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/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 k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x as u};
@@ -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"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-Dxk5Rzj_.js";import{n as s}from"./locale-store-C7xtkP3D.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{Ha as m,Wo as h}from"./index-DzKLVgY-.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-2e5J0sIp.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(h,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
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"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-yG5P43Q9.js";import{n as s}from"./locale-store-pByvK12G.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{Ja as m,rs as h}from"./index-C2ZYFBGL.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-CmPfOfHl.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(h,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as te}from"./cn-JdwAhgNB.js";import{t as s}from"./button-CSEbl4zT.js";import{t as ne}from"./messages-yG5P43Q9.js";import{n as re}from"./locale-store-pByvK12G.js";import{$a as c,Ia as l,Il as u,Ja as d,Ls as f,Qa as ie,Rl as ae,Sl as oe,X as se,Xa as ce,Xc as le,Ya as ue,Z as de,Za as fe,ao as p,el as m,eo as h,io as g,no as pe,ol as me,oo as he,ro as ge,rs as _e,to as ve}from"./index-C2ZYFBGL.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function ye(){return new Promise(e=>window.setTimeout(e,1200))}async function be(e,t){let n=[],r=t.wait??ye;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!v.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var y=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function xe(e){return new Set(e.filter(e=>e.availability===`available`&&y.has(e.id)).map(e=>e.id))}var b=n(),Se=[`folder_structure`,`recent_progress`,`next_steps`];function x(e){return e instanceof Error?e.message:String(e)}function Ce({embedded:e=!1,onRequestClose:t}={}){let n=re(e=>e.language),v=ne(n).onboarding.workDiscovery,ye=ne(n).chat.workingDirectory,y=i(),[Ce]=r(),S=e||Ce.get(`new`)===`1`,[C,w]=(0,_.useState)(`loading`),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),[k,A]=(0,_.useState)(!1),[j,M]=(0,_.useState)(null),[we,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(``),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(()=>new Set),[B,Te]=(0,_.useState)([]),[V,H]=(0,_.useState)(()=>new Set),[Ee,U]=(0,_.useState)([]),[De,Oe]=(0,_.useState)(!1),[W,G]=(0,_.useState)({current:0,total:0}),[ke,Ae]=(0,_.useState)([]),[K,je]=(0,_.useState)(()=>new Set),q=(0,_.useRef)(!1),Me=e=>{je(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,_.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(Ae(t),je(xe(t)))}),()=>{e=!0}},[]);let J=(0,_.useCallback)(e=>{d.getState().updateDirectoryRun(e),O(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},[]),Ne=async()=>{A(!0),M(null);try{let e=await ce();if(!e.length){M(v.noCandidates);return}Te(e),H(new Set([e[0].rootPath])),w(`candidates`)}catch(e){M(x(e))}finally{A(!1)}},Pe=e=>{H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Fe=(0,_.useCallback)((e,t,n)=>{d.getState().updateDirectoryRun(e),O(e),G({current:t+1,total:n}),U(n=>{let r=[...n];return r[t]=e,r}),w(`running`)},[]),Ie=(0,_.useCallback)(e=>{U(t=>t.map(t=>t?.id===e.id?e:t))},[]),Le=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;A(!0),M(null),U([]),G({current:1,total:e.length}),Oe(!0),q.current=!1;let t=!1;try{let n=await be(e,{grantDirectory:h,startRun:g,fetchRun:c,shouldStop:()=>q.current,onRun:(e,n,r)=>{Fe(e,n,r),t||(t=!0,d.getState().collectSources(e.id,[...K]))},onError:(t,n,r)=>{G({current:r+1,total:e.length}),M(v.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,x(t)))}});if(q.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?J(r):w(`candidates`)}catch(e){M(x(e)),w(`candidates`)}finally{Oe(!1),A(!1)}},Y=de({onPicked:(0,_.useCallback)(async e=>{A(!0),M(null);try{E(await ve(e)),w(`consent`)}catch(e){M(x(e)),w(`intro`)}finally{A(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ie().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():y(`/chat`,{replace:!0});return}if(!S&&r.activeRunId)try{let t=await c(r.activeRunId);e||J(t);return}catch{}e||w(`intro`)}}).catch(t=>{e||(M(x(t)),w(`intro`))}),()=>{e=!0}},[J,y,t,S]),(0,_.useEffect)(()=>{if(!D||C!==`running`||De)return;let e=!1,t=async()=>{try{let t=await c(D.id);e||J(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===D.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[J,De,C,D]);let Re=async()=>{A(!0);try{await fe()}finally{t?t():y(`/chat`,{replace:!0})}},ze=async()=>{if(T){A(!0),M(null),U([]),G({current:0,total:0});try{await h(T.canonicalRootPath);let e=await g(T.canonicalRootPath);J(e),d.getState().collectSources(e.id,[...K])}catch(e){M(x(e)),w(`consent`)}finally{A(!1)}}},X=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;y(`/chat/${encodeURIComponent(e)}${n}`)},Be=e=>{O(e),N(!1),L(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},Ve=async()=>{D&&(q.current=!0,J(await ue(D.id)))},Z=async(e,t)=>{if(!D)return;await ge(D.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;X(D.sessionKey,r)},He=async()=>{if(D){A(!0),M(null);try{let e=D.result?.profileCandidates??[],t=await p((e.length>0?await he(D.id,e.map(e=>({id:e.id,status:R.has(e.id)?`accepted`:`rejected`}))):D).id,`confirmed`);O(t),Ie(t),w(`recommendation`)}catch(e){M(x(e))}finally{A(!1)}}},Q=async e=>{if(!(!D||!P.trim())){A(!0),M(null);try{let t=await p(D.id,e,P.trim());O(t),X(t.sessionKey,P.trim())}catch(e){M(x(e)),A(!1)}}},Ue=async()=>{if(D){A(!0);try{X((await p(D.id,`dismissed`)).sessionKey)}catch(e){M(x(e)),A(!1)}}},$=D?.result?.suggestions.find(e=>e.id===D.result?.primarySuggestionId)??D?.result?.suggestions[0],We=D?.result?.suggestions.filter(e=>e.id!==$?.id)??[],Ge=e=>e===`command`?v.riskCommand:e===`file_write`?v.riskFileWrite:v.riskAnalysis,Ke=Ee.filter(e=>e?.status===`completed`),qe=e&&C===`candidates`,Je=Ke.length>1?(0,b.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,b.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:v.analysisResults}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ke.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===D?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Be(e),children:t},e.id)})})]}):null;return(0,b.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,b.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${qe?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,b.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,b.jsx)(_e,{className:`size-11`})}),C===`loading`?(0,b.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,b.jsx)(l,{className:`h-8 w-64 max-w-full`}),(0,b.jsx)(l,{className:`mt-4 h-4 w-full max-w-sm`}),(0,b.jsx)(l,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,b.jsx)(l,{className:`mt-10 h-12 w-full rounded-xl`}),(0,b.jsx)(l,{className:`mt-3 h-11 w-full rounded-xl`}),(0,b.jsx)(l,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,C===`intro`?(0,b.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,b.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.title}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:v.subtitle})]}),(0,b.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[ke.length?(0,b.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.localSourcesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.localSourcesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:ke.map(e=>{let t=K.has(e.id);return(0,b.jsxs)(`button`,{type:`button`,className:te(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,t?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Me(e.id),children:[(0,b.jsx)(`span`,{className:te(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,b.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,b.jsxs)(s,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Ne(),disabled:k||Y.picking,children:[k?(0,b.jsx)(o,{className:`size-4 animate-spin`}):(0,b.jsx)(f,{className:`size-4`}),v.quickScan]}),(0,b.jsxs)(s,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:Y.pick,disabled:k||Y.picking,children:[Y.picking?(0,b.jsx)(o,{className:`size-4 animate-spin`}):(0,b.jsx)(m,{className:`size-4`}),v.chooseFolderManually]}),(0,b.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.quickScanNote})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>y(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:v.connectCloudSource}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Re(),disabled:k,children:v.skip})]}):null,C===`candidates`?(0,b.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,b.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.candidatesTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.candidatesSubtitle})]}),(0,b.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:B.map((e,t)=>{let n=V.has(e.rootPath);return(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Pe(e.rootPath),children:[(0,b.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,b.jsx)(a,{className:`size-3.5`})}),(0,b.jsx)(m,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:v.recommendedCandidate}):null]}),(0,b.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,b.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,b.jsx)(`span`,{children:e.projectKind===`coding`?v.codingProject:e.projectKind===`general`?v.generalProject:v.unknownProject}),e.branch?(0,b.jsx)(`span`,{children:v.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,b.jsx)(`span`,{children:v.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,b.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.multiFolderPrivacyNote})]}),j?(0,b.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(s,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k||V.size===0,onClick:()=>void Le(),children:[k?(0,b.jsx)(o,{className:`mr-2 size-4 animate-spin`}):null,v.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,b.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:Y.pick,children:v.chooseFolderManually})]}),(0,b.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>w(`intro`),children:v.back})]})]}):null,C===`consent`&&T?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.selectedTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.selectedSubtitle})]}),(0,b.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,b.jsx)(m,{className:`size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:T.displayName}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:T.canonicalRootPath})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:T.projectKind===`coding`?v.codingProject:T.projectKind===`general`?v.generalProject:v.unknownProject})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.localFingerprint}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:T.fingerprint.branch?v.branchValue.replace(`{{branch}}`,T.fingerprint.branch):v.noGitBranch})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentActivity}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:v.changedFiles.replace(`{{count}}`,String(T.fingerprint.changedFileCount))})]}),T.fingerprint.recentAreas.length>0?(0,b.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentAreas}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:T.fingerprint.recentAreas.map(e=>(0,b.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,b.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willRead}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willReadValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(ee,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willIgnore}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willIgnoreValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:T.remoteModel?v.providerDisclosure.replace(`{{provider}}`,T.provider):v.localDisclosure})]})]})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(s,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void ze(),children:[k?(0,b.jsx)(o,{className:`mr-2 size-4 animate-spin`}):null,v.startAnalysis]}),(0,b.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:Y.pick,children:v.changeFolder})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Re(),children:v.skip})]}):null,C===`running`&&D?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.analyzingTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.analyzingSubtitle}),W.total>1?(0,b.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:v.analyzingFolderProgress.replace(`{{current}}`,String(W.current)).replace(`{{total}}`,String(W.total))}):null]}),(0,b.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Se.map((e,t)=>{let n=Math.max(0,Se.indexOf(D.stage??`folder_structure`)),r=t<n,i=t===n;return(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,b.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,b.jsx)(a,{className:`size-4`}):i?(0,b.jsx)(o,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,b.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,b.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:v.stages[e]})]},e)})}),(0,b.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:D.rootPath}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,b.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>y(`/chat`),children:v.continueInBackground}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Ve(),children:v.cancelAnalysis})]})]}):null,C===`recognition`&&D?.result?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.recognitionEyebrow}),(0,b.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:D.result.lowConfidence?v.lowConfidenceTitle:v.recognitionTitle})]}),Je,(0,b.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,b.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:D.result.projectSummary}),(0,b.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:D.result.currentState}),!D.result.lowConfidence&&$?.evidence.length?(0,b.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:$.evidence.slice(0,3).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(le,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{children:[e.path?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${$.id}-recognition-${t}`))}):null]}),D.result.workThreads?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.workThreadsTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.workThreadsSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:D.result.workThreads.map(e=>(0,b.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?v.workThreadCurrent:e.horizon===`ongoing`?v.workThreadOngoing:v.workThreadLongTerm}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,D.result.profileCandidates?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.profileCandidatesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.profileCandidatesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:D.result.profileCandidates.map(e=>(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:R.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,b.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,D.result.lowConfidence?(0,b.jsxs)(`div`,{className:`mt-5`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:D.result.contextQuestion}),(0,b.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsx)(s,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:k||!P.trim(),onClick:()=>void Q(`different_goal`),children:v.continueWithCorrection})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void He(),children:[k?(0,b.jsx)(o,{className:`size-4 animate-spin`}):(0,b.jsx)(a,{className:`size-4`}),v.confirmUnderstanding]}),(0,b.jsx)(s,{variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:()=>N(e=>!e),children:v.notQuiteRight})]}),we?(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:v.correctionLabel}),(0,b.jsx)(`textarea`,{id:`work-discovery-correction`,value:P,onChange:e=>F(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(s,{variant:`ghost`,disabled:k||!P.trim(),onClick:()=>void Q(`different_goal`),children:v.differentGoal}),(0,b.jsx)(s,{variant:`primary`,disabled:k||!P.trim(),onClick:()=>void Q(`corrected`),children:v.useCorrection})]})]}):null]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsx)(`button`,{type:`button`,disabled:k,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Ue(),children:v.openConversation})]}):null,C===`recommendation`&&D?.result&&$?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.understandingConfirmed}),(0,b.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:v.primaryRecommendationTitle})]}),Je,(0,b.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,b.jsx)(u,{className:`size-5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:$.title}),(0,b.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:$.rationale}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,b.jsx)(oe,{className:`size-3.5`}),v.estimatedMinutes.replace(`{{count}}`,String($.estimatedMinutes))]}),(0,b.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ge($.risk)})]}),(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.expectedTask}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:$.expectedTask})]}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,b.jsx)(s,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void Z($,!1),children:v.startRecommendedAction}),(0,b.jsx)(s,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void Z($,!0),children:v.explainFirst})]})]})]})}),We.length>0?(0,b.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>L(e=>!e),children:[v.otherDirections,(0,b.jsx)(ae,{className:`size-4 transition-transform ${I?`rotate-180`:``}`})]}),I?(0,b.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:We.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void Z(e,!0),children:[(0,b.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,b.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(D.sessionKey),children:v.doSomethingElse}),(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{N(!0),w(`recognition`)},children:v.correctUnderstanding})]})]}):null,C===`error`&&D?(0,b.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,b.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,b.jsx)(ee,{className:`size-5`})}),(0,b.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:v.errorTitle}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:D.errorMessage}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsx)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void pe(D.id).then(J),children:v.retry}),(0,b.jsx)(s,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{O(null),E(null),w(`intro`)},children:v.chooseDifferent})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(D.sessionKey),children:v.openConversation})]}):null]}),Y.hasNativePicker?null:(0,b.jsx)(se,{open:Y.modalOpen,onOpenChange:Y.setModalOpen,initialAbsolutePath:T?.canonicalRootPath,onConfirm:Y.confirmPick,wd:ye})]})}export{Ce as WorkDiscoveryPage};
@@ -0,0 +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{n as i,r as a}from"./popover-select-BzdnTy3h.js";import{t as o}from"./markdown-view-CyJlGUxB.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./button-CSEbl4zT.js";import{t as u}from"./messages-yG5P43Q9.js";import{o as d,r as f}from"./locale-store-pByvK12G.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BPoKqzeH.js";import{As as y,Fc as b,Hr as x,Lr as S,Ms as C,Ps as w,Rl as T,Ss as E,Zr as D,ds as O,oi as k,qs as A,si as j,ul as M}from"./index-C2ZYFBGL.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(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 L(e,t={}){let n=F(e.split(`
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(I(n));return null}async function R(e,t={}){let n=await d(f(`/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=``,o=``,s=``;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=L(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(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,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(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 B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:u,format:d,intent:f,locale:b,context:x,disabled:S,className:w,showLabel:E}=e,D=u===void 0?`generic.text`:u,O=d===void 0?`plain`:d,k=f===void 0?`improve`:f,j=E===void 0?!0:E,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===b?me=t[1]:(me=ne(b),t[0]=b,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==x||t[24]!==i||t[25]!==a||t[26]!==O||t[27]!==fe||t[28]!==k||t[29]!==b||t[30]!==D?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:k,scenario:D,input:e,locale:b,field:{id:i,label:a,format:O},context:x})},t[23]=x,t[24]=i,t[25]=a,t[26]=O,t[27]=fe,t[28]=k,t[29]=b,t[30]=D,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!j&&`size-7 p-0`,Ge;t[62]!==w||t[63]!==We?(Ge=c(`h-7 gap-1 px-2 text-xs`,We,w),t[62]=w,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=S||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(C,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=j?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(l,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=c(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(p,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(_,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(s,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(m,{asChild:!0,children:(0,z.jsx)(l,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(M,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==O||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.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,z.jsx)(o,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.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:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=O,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(M,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=c(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(T,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.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:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,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:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==O||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.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}):W===`preview`?(0,z.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&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):O===`markdown`?(0,z.jsx)(o,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.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:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=O,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(l,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(l,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(A,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(l,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(l,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(l,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(g,{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:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(h,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(v,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(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 U(e,t){return!V(e)||!e?!0:H(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 W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:S(t.argValues)}function ae(e,t,n){let r=u(t).workflows;if(!e)return r.noInputSummary;let i=j(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(D[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=D[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.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,z.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,z.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,z.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,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:o,onGoalChange:s,examplePrompts:l,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,x,S,C;if(t[2]!==p||t[3]!==i||t[4]!==h||t[5]!==o||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==g||t[11]!==n){y=u(r).workflows;let e=D[n]??[];v=e.length>0;let l=c(`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]!==i||t[20]!==a||t[21]!==s?(d=e=>{k(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,x=e.map(e=>{let t=K(y.args,e.labelKey),o=K(y.args,e.placeholderKey),s=i[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,z.jsx)(B,{value:s,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c(l,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:l})]},e.key)}),S=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,C=g?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,z.jsx)(B,{value:o,onApply:s,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:y.goalPlaceholder,className:c(l,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=i,t[4]=h,t[5]=o,t[6]=f,t[7]=r,t[8]=a,t[9]=s,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else _=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let w;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(w=!v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=w):w=t[27];let T;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,z.jsxs)(`div`,{className:b,children:[x,S,C,w]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}var q=`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 le({schema:e,value:t,onChange:n,labels:r,aiAssist:i,onValidChange:a}){let o=(0,N.useMemo)(()=>H(e),[e]),[s,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(o.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),s&&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),a?.(!1);return}p(null),n(t),a?.(!0,t)}catch{p(r.rawJsonInvalid),a?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!s;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),a?.(!0))},children:r.rawJson})]}),s?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:c(q,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:o.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:o,aiAssist:s,allValues:l,onChange:u}=e,d=n.schema.title||n.key,f=typeof n.schema.description==`string`?n.schema.description:void 0,p=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,m;t[0]===n.schema.enum?m=t[1]:(m=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=m);let h=m,g=!!s&&!h.length&&(p===`string`||!p),_=String(d),v=n.required?` *`:``,y;t[2]!==_||t[3]!==v?(y=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[_,v]}),t[2]=_,t[3]=v,t[4]=y):y=t[4];let b;t[5]!==s||t[6]!==l||t[7]!==n.key||t[8]!==n.schema||t[9]!==u||t[10]!==g||t[11]!==d||t[12]!==r?(b=g&&s?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:u,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(d),scenario:s.scenario??`workflow.arg`,locale:s.locale,context:{...s.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:l},disabled:s.disabled,showLabel:!1}):null,t[5]=s,t[6]=l,t[7]=n.key,t[8]=n.schema,t[9]=u,t[10]=g,t[11]=d,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===f?S=t[18]:(S=f?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:f}):null,t[17]=f,t[18]=S);let C;t[19]!==f||t[20]!==h||t[21]!==o||t[22]!==u||t[23]!==p||t[24]!==r?(C=h.length>0?(0,z.jsxs)(i,{value:r==null?``:String(r),onChange:e=>u(e.target.value),className:q,children:[(0,z.jsx)(a,{value:``}),h.map(de)]}):p===`boolean`?(0,z.jsxs)(i,{value:typeof r==`boolean`?String(r):``,onChange:e=>u(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(a,{value:``}),(0,z.jsx)(a,{value:`true`,children:o.booleanTrue}),(0,z.jsx)(a,{value:`false`,children:o.booleanFalse})]}):p===`number`||p===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>u(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>u(e.target.value),className:c(q,f&&f.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=f,t[20]=h,t[21]=o,t[22]=u,t[23]=p,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(a,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.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,z.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,z.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,z.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,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:o,inputClassName:s,onValidityChange:l}=e,d;t[0]===r?d=t[1]:(d=u(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=j(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,N.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=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A;if(t[9]!==o||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==s||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==a||t[18]!==l||t[19]!==h||t[20]!==i){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c(`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`,s),u;t[31]!==n||t[32]!==a||t[33]!==l||t[34]!==h?(u=(e,t)=>{let r=t===void 0?h:t;a(e),l?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=l,t[34]=h,t[35]=u):u=t[35];let d=u,p;t[36]!==d||t[37]!==i?(p=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let j=y,M;t[42]!==d||t[43]!==i?(M=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==j||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}j({...i.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=j,t[47]=i.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==o||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=o?{disabled:o.disabled,argScenario:o.inputScenario??`workflow.arg`,goalScenario:o.goalScenario??`workflow.goal`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=o,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==v||t[57]!==s||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:N,goal:i.goal,onGoalChange:_,examplePrompts:v,inputClassName:s,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=s,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],T=a;break bb0}C=`flex flex-col gap-3`,t[65]!==o||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]!==l||t[75]!==j||t[76]!==i?(w=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:j,onValidChange:(e,t)=>{g(e),l?.(G(n,t?{...i,schemaInput:t}:i,e))},aiAssist:o?{locale:r,disabled:o.disabled,scenario:o.inputScenario??`workflow.arg`,context:{...o.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]=o,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]=l,t[75]=j,t[76]=i,t[77]=w):w=t[77],A=`flex flex-col gap-1`;let F;t[78]===f.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=F);let I;t[80]!==o||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]!==i.goal||t[89]!==i.schemaInput?(I=o?(0,z.jsx)(B,{value:i.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:o.goalScenario??`workflow.goal`,locale:r,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:i.schemaInput},disabled:o.disabled,showLabel:!1}):null,t[80]=o,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]=i.goal,t[89]=i.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(S=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=S):S=t[93],E=i.goal,t[94]===_?D=t[95]:(D=e=>_(e.target.value),t[94]=_,t[95]=D),O=f.goalPlaceholder,k=c(e,`min-h-20 resize-y`)}t[9]=o,t[10]=n,t[11]=v,t[12]=b,t[13]=s,t[14]=f,t[15]=r,t[16]=m.description,t[17]=a,t[18]=l,t[19]=h,t[20]=i,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A}else x=t[21],S=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];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let M;t[96]!==E||t[97]!==D||t[98]!==O||t[99]!==k?(M=(0,z.jsx)(`textarea`,{value:E,onChange:D,placeholder:O,className:k}),t[96]=E,t[97]=D,t[98]=O,t[99]=k,t[100]=M):M=t[100];let F;t[101]!==S||t[102]!==M||t[103]!==A?(F=(0,z.jsxs)(`div`,{className:A,children:[S,M]}),t[101]=S,t[102]=M,t[103]=A,t[104]=F):F=t[104];let I;t[105]!==x||t[106]!==v||t[107]!==f?(I=(0,z.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=I):I=t[108];let L;return t[109]!==C||t[110]!==w||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:C,children:[w,F,I]}),t[109]=C,t[110]=w,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?x(t.agentScaleExact,{count:n.min}):x(t.agentScaleRange,{min:n.min,max:n.max}):x(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:i,onChange:a,mode:o,badgeLabel:s,aiAssist:l,inputClassName:d,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,h=f===void 0?!1:f,g=p===void 0?!1:p,_=u(r).workflows,[v,y]=(0,N.useState)(g),S;t[0]!==n||t[1]!==r?(S=j(n,r),t[0]=n,t[1]=r,t[2]=S):S=t[2];let C=S,D;t[3]!==n.defaults||t[4]!==i.concurrency?(D=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=D):D=t[5];let k=D,A;t[6]!==n.defaults||t[7]!==i.maxSubagents?(A=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=A):A=t[8];let M=A,F;t[9]!==n||t[10]!==r||t[11]!==i?(F=ae(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=F):F=t[12];let I=F,L=s??_.readyToStart,R;t[13]!==a||t[14]!==i?(R=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=R):R=t[15];let ee=R,te=o===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=c(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||C.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(b,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(O,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==a||t[24]!==i?(U=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=U):U=t[25];let W;t[26]===m?W=t[27]:(W=e=>{m?.(e)},t[26]=m,t[27]=W);let G;t[28]!==l||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==i?(G=(0,z.jsx)(Y,{definition:n,language:r,value:i,onChange:U,onValidityChange:W,aiAssist:l,inputClassName:d}),t[28]=l,t[29]=n,t[30]=d,t[31]=r,t[32]=U,t[33]=W,t[34]=i,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>y(pe),t[36]=K):K=t[36];let oe=_.advancedSettings,se=v&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=c(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(T,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:_.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:x(_.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,_)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:x(_.runLimitsSummary,{concurrency:k,max:M})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),_.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),v?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:i.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:x(_.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,z.jsx)(`input`,{value:i.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:x(_.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`}),h?(0,z.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:x(_.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 pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.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{B as a,G as i,oe as n,W as r,fe as t};