@xopcai/xopc 0.0.120 → 0.0.121
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/dashscope/src/image-generation-provider.d.ts +6 -5
- package/dist/extensions/dashscope/src/image-generation-provider.js +40 -64
- package/dist/extensions/dashscope/src/image-generation-provider.js.map +1 -1
- package/dist/extensions/dashscope/src/index.d.ts +1 -1
- package/dist/extensions/dashscope/src/index.js +2 -2
- package/dist/extensions/dashscope/xopc.extension.json +3 -2
- package/dist/extensions/minimax/src/image-generation-provider.d.ts +7 -5
- package/dist/extensions/minimax/src/image-generation-provider.js +43 -37
- package/dist/extensions/minimax/src/image-generation-provider.js.map +1 -1
- package/dist/extensions/minimax/src/index.d.ts +1 -1
- package/dist/extensions/minimax/src/index.js +2 -2
- package/dist/extensions/minimax/xopc.extension.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +41 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-APTlX9Sq.js → agent-avatar-dicebear-4AW4JgSU.js} +1 -1
- package/dist/gateway/static/root/assets/agents-2SVUUPlp.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DTKc5HHT.js → app-management-settings-panel-CE6GkGU2.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BTciFrE9.js → appearance-settings-BmaUjghw.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DT52OrbM.js → apps-page-BWeQ1I49.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CiHaUMII.js → archive-plugin-CX4_KWut.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-t4gSrNjL.js → attachment-load-jf-PIIUU.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CtysjSoQ.js → automation-suggestion-card-BHk5rtJz.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-QHotl53D.js +1 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BAbSldW5.js → binary-plugins-DG9XQikd.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BNr_82xl.js → block-editor-Up_VIxLJ.js} +6 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cmwi6IIQ.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-tzD702Gg.js → capability-presets-api-CGM4OyMw.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-AGhTueAc.js → capability-presets-settings-panel-CzWt0LBb.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-DL_KzwGE.js → channel-recipient-api-BEByL4_o.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BOMCUe2J.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-C-Dexk_F.js +2 -0
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +1 -0
- package/dist/gateway/static/root/assets/dist-wO9a2_ID.js +1 -0
- package/dist/gateway/static/root/assets/{dreaming-settings-BEwWA1yf.js → dreaming-settings-WPEj8pir.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Dl2kO0Sf.js → extension-debug-page-DZxa_j7-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DmbLPsx_.js → extension-page-CseziW53.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B_9J-xyo.js +1 -0
- package/dist/gateway/static/root/assets/{fetch-B3ME5Eri.js → fetch-Cs4ck8zA.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DI9_BBTo.js → gateway-config-api-Dl223a7r.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-DdzbtW9R.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CSZQTz6K.js → gateway-startup-retry-IvePwjFE.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Dxldogms.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-Bhzqrp2w.js → goals-config-api-CUCP6yCl.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-DU5Nd6Xp.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-Dj87qPxv.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-Cgm5JmwH.js +1 -0
- package/dist/gateway/static/root/assets/index-BU1pvxmS.js +191 -0
- package/dist/gateway/static/root/assets/index-l54WfSqe.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-kMp08SlX.js → keyboard-shortcuts-settings-DJgYw0nB.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C10aS4XO.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-split-Bc0w40vz.js → markdown-split-gnQ_EiGo.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DJ_HvgIy.js → media-plugins-CQV-mgJn.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C6Kc4Jhf.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-B35CAfg6.js +2 -0
- package/dist/gateway/static/root/assets/note-detail-page-Brlwse8x.js +2 -0
- package/dist/gateway/static/root/assets/{note-image-lightbox-4zntqpZq.js → note-image-lightbox-BthwKjLA.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-VocWOjoK.js → notes-page-CoAwRc7L.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BbA7sRd_.js → preview-open-alternatives-BPMXC-2u.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B36RQ05h.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Dividh61.js → save-bar-controls-BEHqwZjz.js} +1 -1
- package/dist/gateway/static/root/assets/schedule-field-CMY25m97.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-CxjxsFfg.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-73THChnj.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CR9VsY-R.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BMCOfuE_.js → settings-collapsible-section-s-kiLAxP.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DBkGwpIN.js → settings-form-section-CIxIEYxU.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-BJ1AhfKI.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-NxoW5Y57.js → settings-page-layout--6qT7ZJa.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C1TtS1vJ.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-B0suFCfj.js → share-preview-page-BZADSbS1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-gqC8Rmhy.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C9P-WYvS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CEpSvOhF.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CrmEnyX4.js → system-settings-panel-Czjf0kLJ.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BAsGn25g.js → typed-models-lib-Cmt8SYdI.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-C7vcAoGb.js → use-channel-catalog-DyM-ckEQ.js} +1 -1
- package/dist/gateway/static/root/assets/user-profile-settings-panel-BygLv8vm.js +1 -0
- package/dist/gateway/static/root/assets/{utils-Dl9efgnV.js → utils-CloW8coB.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BsoqJba6.js +1 -0
- package/dist/gateway/static/root/assets/{voice-player-store-CMC5NOJp.js → voice-player-store-DduWlJYV.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CcQeX6l5.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-CeA8A9Ef.js +18 -0
- package/dist/gateway/static/root/index.html +7 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/xopc-auth-storage.d.ts +1 -5
- package/dist/src/agent/embedded/xopc-auth-storage.js +2 -8
- package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +23 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js.map +1 -1
- package/dist/src/agent/goals/checklist-judge.js +1 -1
- package/dist/src/agent/goals/checklist-judge.js.map +1 -1
- package/dist/src/agent/goals/judge.js +1 -1
- package/dist/src/agent/goals/judge.js.map +1 -1
- package/dist/src/agent/image/tool-model-config.d.ts +2 -0
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js.map +1 -1
- package/dist/src/agent/memory/compaction.d.ts +1 -1
- package/dist/src/agent/memory/compaction.js +1 -1
- package/dist/src/agent/memory/compaction.js.map +1 -1
- package/dist/src/agent/middleware/self-verify.d.ts +3 -0
- package/dist/src/agent/middleware/self-verify.js +18 -0
- package/dist/src/agent/middleware/self-verify.js.map +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.js +28 -3
- package/dist/src/agent/orchestration/agent-event-handler.js.map +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +21 -5
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
- package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt.d.ts +1 -0
- package/dist/src/agent/prompt/system-prompt.js +13 -1
- package/dist/src/agent/prompt/system-prompt.js.map +1 -1
- package/dist/src/agent/sandbox/path-policy.js +30 -6
- package/dist/src/agent/sandbox/path-policy.js.map +1 -1
- package/dist/src/agent/service/btw-query.js +1 -1
- package/dist/src/agent/service/btw-query.js.map +1 -1
- package/dist/src/agent/starter-agents.js +16 -16
- package/dist/src/agent/starter-agents.js.map +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +12 -1
- package/dist/src/agent/tools/image-generate-tool.js.map +1 -1
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/session-search-tool.js.map +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/web-extract.js.map +1 -1
- package/dist/src/agent-manifest/index.js +2 -2
- package/dist/src/agent-manifest/schema.d.ts +66 -0
- package/dist/src/agent-manifest/schema.js +28 -2
- package/dist/src/agent-manifest/schema.js.map +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js.map +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +161 -11
- package/dist/src/cli/commands/onboard/model.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/profile.js +1 -1
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/default-model.d.ts +11 -0
- package/dist/src/config/default-model.js +19 -0
- package/dist/src/config/default-model.js.map +1 -0
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/schema.d.ts +71 -11
- package/dist/src/config/schema.js +57 -22
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/connectors/registries/smithery.js +10 -9
- package/dist/src/connectors/registries/smithery.js.map +1 -1
- package/dist/src/daemon/install-plan.js +2 -1
- package/dist/src/daemon/install-plan.js.map +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +6 -16
- package/dist/src/gateway/global-defaults-admin.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +24 -0
- package/dist/src/gateway/hono/routes/agents.js +1 -79
- package/dist/src/gateway/hono/routes/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +132 -14
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js.map +1 -1
- package/dist/src/gateway/image-capabilities.d.ts +11 -1
- package/dist/src/gateway/image-capabilities.js +32 -43
- package/dist/src/gateway/image-capabilities.js.map +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/workspace-editor-path.js +9 -1
- package/dist/src/gateway/workspace-editor-path.js.map +1 -1
- package/dist/src/generated/bundled-image-generation-providers.d.ts +4 -2
- package/dist/src/generated/bundled-image-generation-providers.js +6 -4
- package/dist/src/generated/bundled-image-generation-providers.js.map +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/media/paths.js +3 -4
- package/dist/src/media/paths.js.map +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/providers/domestic-presets.d.ts +615 -0
- package/dist/src/providers/domestic-presets.js +834 -0
- package/dist/src/providers/domestic-presets.js.map +1 -0
- package/dist/src/providers/env-keys.js +29 -5
- package/dist/src/providers/env-keys.js.map +1 -1
- package/dist/src/providers/extension-stream-bridge.js +1 -1
- package/dist/src/providers/extension-stream-bridge.js.map +1 -1
- package/dist/src/providers/index.d.ts +5 -5
- package/dist/src/providers/index.js +101 -21
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/model-discovery.d.ts +17 -0
- package/dist/src/providers/model-discovery.js +61 -0
- package/dist/src/providers/model-discovery.js.map +1 -0
- package/dist/src/providers/model-registry.d.ts +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/model-registry.js.map +1 -1
- package/dist/src/providers/presentation.js +185 -14
- package/dist/src/providers/presentation.js.map +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/session-title.js.map +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +1 -1
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/voice/tts/summarize.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js.map +1 -1
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +0 -41
- package/dist/gateway/static/root/assets/agents-CFW_FS_V.js +0 -2
- package/dist/gateway/static/root/assets/automations-page-B2YvT3ES.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-BQEXPhDU.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-DRTutLlN.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DneJVuge.js +0 -2
- package/dist/gateway/static/root/assets/dist-By6Rh2ee.js +0 -1
- package/dist/gateway/static/root/assets/dist-CkobR7mk.js +0 -1
- package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BS2rx40e.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DAFI_T0W.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DLuz4jC9.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-DTAfv9Ft.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-CWN2iirQ.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CkkkHvOi.js +0 -1
- package/dist/gateway/static/root/assets/index-CnjzMw5i.js +0 -191
- package/dist/gateway/static/root/assets/index-E1QinYKp.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-CDXDlS_W.js +0 -2
- package/dist/gateway/static/root/assets/messages-CISb1HLv.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-BTwxMIgZ.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-page-BBfOeB0m.js +0 -2
- package/dist/gateway/static/root/assets/remote-access-hub-CXwjuD_Q.js +0 -1
- package/dist/gateway/static/root/assets/schedule-field-pRheF2CO.js +0 -1
- package/dist/gateway/static/root/assets/schema-form-D6PiPxfr.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CpcVySQK.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BVy_TawT.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-CZpNyCWn.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-MVHLLu_a.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C6DBbQGo.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-6hJmhwSn.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Im1MA0Iw.js +0 -2
- package/dist/gateway/static/root/assets/user-profile-settings-panel-QAQWGelF.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-D-6XueTv.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DVPllR4k.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-B94WISTW.js +0 -18
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CISb1HLv.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{i as s}from"./theme-store-Bt6vAkSB.js";import{c,i as l,n as u}from"./fetch-B3ME5Eri.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,Ai as p,Ar as m,Bs as h,Cn as g,Ct as _,Di as v,Dn as y,Fa as b,Fi as x,Fr as S,Hs as C,Ii as w,Ir as T,Is as E,Li as D,Lr as O,Mi as k,Mr as A,Ms as j,Na as M,Ni as N,No as P,Nr as F,Oi as ee,On as I,Oo as L,Pi as te,Pr as ne,Ps as R,Qn as re,Qs as ie,Ri as z,Rr as B,Sn as ae,Tn as V,Ua as H,Wi as U,Xs as W,Ya as G,Yo as oe,Zn as se,Zs as ce,_n as le,_r as K,_t as ue,aa as q,at as de,ba as fe,bn as pe,br as me,bt as he,ca as ge,d as _e,dn as ve,dr as ye,dt as J,ea as be,es as xe,fn as Se,fr as Ce,ga as we,gn as Te,gr as Ee,ha as De,hn as Oe,hr as ke,ht as Ae,ja as je,ji as Me,jr as Ne,js as Pe,ki as Fe,ko as Ie,la as Le,ls as Y,lt as Re,mn as ze,mr as Be,mt as Ve,n as He,ni as Ue,pa as We,pn as Ge,pr as Ke,pt as qe,qo as Je,qs as Ye,sa as X,so as Xe,t as Ze,ta as Qe,to as $e,ts as et,u as tt,ua as nt,ut as rt,vn as it,vo as at,wn as ot,xt as st,ya as ct,yn as lt,zi as ut,zr as dt}from"./index-CnjzMw5i.js";import{t as ft}from"./markdown-editor-AssmZFx4.js";import{n as pt,t as mt}from"./settings-form-section-DBkGwpIN.js";import{n as ht,t as gt}from"./settings-page-layout-NxoW5Y57.js";import{n as _t}from"./agent-avatar-dicebear-APTlX9Sq.js";import{n as vt,r as yt,t as bt}from"./channel-recipient-api-DL_KzwGE.js";import{n as xt,r as St,t as Ct}from"./utils-Dl9efgnV.js";import{a as wt,i as Tt,n as Et,o as Dt,t as Ot}from"./typed-models-lib-BAsGn25g.js";import{a as kt,o as At,r as jt,s as Mt}from"./capability-presets-api-tzD702Gg.js";var Z=n(),Q=r();function Nt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(Me,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=m):m=t[0];let h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=h):h=t[1];let g=o?f.purgeDisk:f.removeFromConfig,_;t[2]===g?_=t[3]:(_=(0,Q.jsx)(te,{className:`text-base font-semibold text-fg`,children:g}),t[2]=g,t[3]=_);let v=o?f.confirmDeletePurge:f.confirmDelete,y;t[4]===v?y=t[5]:(y=(0,Q.jsx)(p,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:v}),t[4]=v,t[5]=y);let b;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(b=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=b):b=t[13];let x;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(x=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=x):x=t[17];let S=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,C;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(C=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=C):C=t[22];let w=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==C||t[25]!==w||t[26]!==S?(T=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:S,disabled:C,onClick:u,children:w}),t[23]=u,t[24]=C,t[25]=w,t[26]=S,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==_||t[33]!==y||t[34]!==b?(D=(0,Q.jsxs)(k,{children:[m,(0,Q.jsxs)(Fe,{className:h,onOpenAutoFocus:Pt,children:[_,y,b,E]})]}),t[31]=E,t[32]=_,t[33]=y,t[34]=b,t[35]=D):D=t[35];let O;return t[36]!==r||t[37]!==n||t[38]!==D?(O=(0,Q.jsx)(N,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=O):O=t[39],O}function Pt(e){return e.preventDefault()}var Ft=[{id:`overview`,labelKey:`navOverview`,icon:Je},{id:`behavior`,labelKey:`navBehavior`,icon:M},{id:`tools`,labelKey:`navTools`,icon:nt},{id:`skills`,labelKey:`navSkills`,icon:ge},{id:`memory`,labelKey:`navMemory`,icon:j},{id:`connections`,labelKey:`navConnections`,icon:Pe},{id:`config`,labelKey:`navConfig`,icon:b},{id:`dangerZone`,labelKey:`navDangerZone`,icon:ct}];function It(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,Qe.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=Ft.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Lt(e){let t=(0,Z.c)(44),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:m,busy:h,children:g}=e,_=m===void 0?!0:m,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Me,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,re)}),t[0]=v):v=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,se,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=y):y=t[1];let b;t[2]===o?b=t[3]:(b=(0,Q.jsx)(te,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=b);let x;t[4]===s?x=t[5]:(x=(0,Q.jsx)(p,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=x);let S;t[6]!==b||t[7]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[b,x]}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=C):C=t[9];let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[10]=w):w=t[10];let T;t[11]===a.closeDialogAria?T=t[12]:(T=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:C,"aria-label":a.closeDialogAria,children:w})}),t[11]=a.closeDialogAria,t[12]=T);let E;t[13]!==S||t[14]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[S,T]}),t[13]=S,t[14]=T,t[15]=E):E=t[15];let D;t[16]!==a||t[17]!==l||t[18]!==c?(D=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(It,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=D):D=t[19];let O;t[20]===g?O=t[21]:(O=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:g}),t[20]=g,t[21]=O);let A;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==h||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==_?(A=_?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(X,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:h||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=h,t[26]=d,t[27]=f,t[28]=u,t[29]=_,t[30]=A):A=t[30];let j;t[31]!==O||t[32]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[O,A]}),t[31]=O,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==D||t[35]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[D,j]}),t[34]=D,t[35]=j,t[36]=M):M=t[36];let P;t[37]!==M||t[38]!==E?(P=(0,Q.jsxs)(k,{children:[v,(0,Q.jsx)(Fe,{className:y,onOpenAutoFocus:Rt,children:(0,Q.jsxs)(qe,{layer:`modal`,children:[E,M]})})]}),t[37]=M,t[38]=E,t[39]=P):P=t[39];let F;return t[40]!==r||t[41]!==n||t[42]!==P?(F=(0,Q.jsx)(N,{open:n,onOpenChange:r,children:P}),t[40]=r,t[41]=n,t[42]=P,t[43]=F):F=t[43],F}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=e=>u(e);function Bt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Vt(e){let t=Bt(e);return t==null?`border-edge bg-surface-panel text-fg-muted`:t>=70?`border-success/30 bg-success-soft text-fg`:t>=40?`border-warning/40 bg-warning-soft text-fg`:`border-danger/30 bg-danger-soft text-fg`}function Ht({embedded:e=!1,agentId:t}){let n=a(o(e=>e.language)).agentsSettings.memoryPanel,[r,i]=(0,$.useState)(``),[s,c]=(0,$.useState)(``),[f,p]=(0,$.useState)(``),[m,h]=(0,$.useState)({}),[g,_]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),{data:v}=d(l(`/api/memory/providers`),zt),{data:y,mutate:b}=d(l(`/api/memory/records?status=active&limit=80`),zt),{data:x,mutate:S}=d(l(`/api/memory/records?status=candidate&limit=80`),zt),{data:C}=d(l(`/api/memory/signals?limit=50`),zt),{data:w,mutate:T}=d(l(`/api/memory/traces?limit=80`),zt),{data:E}=d(l(`/api/memory/feedback-summary?limit=1000`),zt),{data:D,mutate:O}=d(l(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),zt),{data:k,isLoading:A}=d(s?l(`/api/memory/search`):null,e=>u(e,{method:`POST`,body:JSON.stringify({query:s,maxResults:20})})),j=k?.results.map(e=>({...e.record,score:e.score}))??y?.records??[],M=v?.providers.length??0,N=y?.records.length??0,P=x?.records.length??0,F=C?.signals.length??0,ee=w?.traces.length??0,I=E?.summaries??[],L=(0,$.useMemo)(()=>new Map(I.map(e=>[e.recordId,e])),[I]),te=I.reduce((e,t)=>e+t.total,0),ne=I.reduce((e,t)=>e+t.helpful,0),R=te>0?Math.round(ne/te*100):null,re=(0,$.useMemo)(()=>[{label:n.providers,value:M},{label:n.records,value:N},{label:n.inbox,value:P},{label:n.signals,value:F},{label:n.traceEvents,value:ee},{label:n.recallQuality,value:R==null?`—`:`${R}%`}],[P,R,M,N,F,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,ee]);(0,$.useEffect)(()=>{let e=D?.memory.providerRouting;e&&_({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[D]);async function ie(){if(D){p(n.saving);try{await u(l(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:D.agentId,memory:{...D.memory,providerRouting:g}})}),await O(),p(n.saved)}catch(e){p(e instanceof Error?e.message:n.saveFailed)}}}async function z(e){h(t=>({...t,[e]:n.testing}));try{let t=(await u(l(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);h(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),T()}catch(t){h(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function B(e,t){await u(l(`/api/memory/records/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([S(),b()])}return(0,Q.jsxs)(`div`,{className:e?`flex min-h-0 w-full flex-1 flex-col gap-5 overflow-y-auto overscroll-contain pr-1`:`mx-auto flex w-full max-w-app-main flex-1 flex-col gap-5 px-4 py-6`,children:[e?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-6`,children:re.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e.label}),(0,Q.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-fg`,children:e.value})]},e.label))}),(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providerPolicy}),(0,Q.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.searchStrategy,(0,Q.jsx)(`select`,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.searchStrategy,onChange:e=>_(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(`select`,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.writeStrategy,onChange:e=>_(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowExternalWrites,onChange:e=>_(t=>({...t,allowExternalWrites:e.target.checked}))}),n.allowExternalWrites]}),(0,Q.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Q.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n.writableProviders}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(v?.providers??[]).filter(e=>!e.capabilities.local).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3 py-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowedProviderIds?.includes(e.id)??!1,onChange:t=>_(n=>({...n,allowedProviderIds:t.target.checked?[...n.allowedProviderIds??[],e.id]:(n.allowedProviderIds??[]).filter(t=>t!==e.id)}))}),e.displayName]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`primary`,onClick:ie,children:n.savePolicy}),f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:f}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.inbox}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.inboxHint})]}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:P})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[(x?.records??[]).map(e=>(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.sensitivity??`normal`}),(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.confidence==null?null:(0,Q.jsxs)(`span`,{children:[Math.round(e.confidence*100),`%`]})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),e.evidence?.[0]?.sourceText?(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.evidence[0].sourceText}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`primary`,onClick:()=>B(e.id,`active`),children:n.approve}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>B(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>B(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),P===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noInbox}):null]})]}),(0,Q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),c(r.trim())},children:[(0,Q.jsx)(`input`,{className:`min-h-10 flex-1 rounded-md border border-edge bg-surface px-3 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:e=>i(e.target.value),placeholder:n.searchPlaceholder}),(0,Q.jsx)(X,{className:`min-h-10 rounded-md px-4`,type:`submit`,variant:`primary`,children:n.search})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:s?`${n.searchResults}${A?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[j.map(e=>{let t=L.get(e.id),r=Bt(t);return(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),e.status?(0,Q.jsx)(`span`,{children:e.status}):null,e.sensitivity?(0,Q.jsx)(`span`,{children:e.sensitivity}):null,(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.source.path?(0,Q.jsx)(`span`,{children:e.source.path}):null,(0,Q.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 ${Vt(t)}`,children:r==null?n.noRecallFeedback:`${n.recallQuality} ${r}% · ${t?.total??0}`})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),t?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[n.helpful,`: `,t.helpful]}),(0,Q.jsxs)(`span`,{children:[n.notHelpful,`: `,t.notHelpful]}),t.mixed?(0,Q.jsxs)(`span`,{children:[n.mixed,`: `,t.mixed]}):null,t.irrelevant?(0,Q.jsxs)(`span`,{children:[n.irrelevant,`: `,t.irrelevant]}):null]}):null]},e.id)}),j.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecords}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providers}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(v?.providers??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[e.id,` · `,e.available?n.available:n.unavailable]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>z(e.id),children:n.test}),m[e.id]?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:m[e.id]}):null]})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.recallQuality}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[I.slice(0,8).map(e=>{let t=(y?.records??[]).find(t=>t.id===e.recordId),r=Bt(e);return(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 font-medium text-fg`,children:t?.kind??n.record}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 ${Vt(e)}`,children:[r??0,`%`]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-fg-muted`,children:t?.content??e.recordId}),(0,Q.jsxs)(`div`,{className:`mt-2`,children:[e.helpful,` `,n.helpful,` · `,e.notHelpful,` `,n.notHelpful,` · `,e.total,` `,n.feedback]})]},e.recordId)}),I.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(C?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:(w?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Ut(e){let t=(0,Z.c)(28),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=a||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==o||t[5]!==r?(p=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?s:c,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:border-edge hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=i(`flex flex-col gap-1 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Wt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,m=d?r||l.unset:a,h=p?i||l.unset:o,g;t[5]!==l.subtitle||t[6]!==l.title?(g=(0,Q.jsx)(pt,{icon:Ie,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=g):g=t[7];let _=d?`inherit`:`override`,v;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(v=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=v):v=t[11];let y;t[12]!==m||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==_||t[18]!==v?(y=(0,Q.jsx)(Ut,{label:l.modelLabel,mode:_,value:m,inheritedFrom:v,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=m,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=p?`inherit`:`override`,x;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(x=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=x):x=t[23];let S;t[24]!==h||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==b||t[30]!==x?(S=(0,Q.jsx)(Ut,{label:l.workspaceLabel,mode:b,value:h,inheritedFrom:x,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=h,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=b,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==y||t[33]!==S?(C=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[y,S]}),t[32]=y,t[33]=S,t[34]=C):C=t[34];let w;return t[35]!==g||t[36]!==C?(w=(0,Q.jsxs)(mt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Gt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Kt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),a=n.startsWith(`agent:`);r=i(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,e&&`border-accent/25 bg-accent/10 text-accent`,a&&`border-edge bg-surface-base text-fg-muted`,!e&&!a&&`border-edge-subtle bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let a;return t[2]!==n||t[3]!==r?(a=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function qt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,a;t[2]===r?a=t[3]:(a=i(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=a);let o;t[4]!==e.value||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:e.value}),t[4]=e.value,t[5]=a,t[6]=o):o=t[6];let s;t[7]===e.source?s=t[8]:(s=(0,Q.jsx)(Kt,{source:e.source}),t[7]=e.source,t[8]=s);let c;return t[9]!==n||t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,o,s]}),t[9]=n,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Jt(e,t){return e&&e.length>0?e.join(`, `):t}function Yt(e){let t=(0,Z.c)(30),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>it(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=d(i,a,o),u=s?.manifest,f;t[5]!==s?.presetChain||t[6]!==u?.extends?(f=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=f):f=t[7];let p=f,m;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveMemoryTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoPresets||t[16]!==n.effectiveNoToolPolicies||t[17]!==n.effectivePresetChain||t[18]!==n.effectiveSkillsTitle||t[19]!==n.effectiveTitle||t[20]!==n.effectiveToolsTitle||t[21]!==s?.sources||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==p){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(Zt),i=Object.entries(u?.tools?.builtin??{}).sort(Xt),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(pt,{icon:L,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(mt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-sm text-fg`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Gt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(qt,{name:n,value:r.model,monoValue:!0,source:Gt(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(qt,{name:n,value:r.mode,source:Gt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`mode`,value:a?.mode??`all`,source:Gt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(qt,{name:`allow`,value:Jt(a.allow,`—`),source:Gt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(qt,{name:`deny`,value:Jt(a.deny,`—`),source:Gt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveMemoryTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`mode`,value:o?.mode??`off`,source:Gt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(qt,{name:`sources`,value:Jt(o?.sources,`—`),source:Gt(e,[`memory.sources`,`memory`])})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`requiresConfirmation`,value:Jt(d?.requiresConfirmation,`—`),source:Gt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(qt,{name:`forbidden`,value:Jt(d?.forbidden,`—`),source:Gt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(qt,{name:`escalation`,value:Jt(d?.escalation,`—`),source:Gt(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveMemoryTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoPresets,t[16]=n.effectiveNoToolPolicies,t[17]=n.effectivePresetChain,t[18]=n.effectiveSkillsTitle,t[19]=n.effectiveTitle,t[20]=n.effectiveToolsTitle,t[21]=s?.sources,t[22]=c,t[23]=l,t[24]=u,t[25]=p,t[26]=m}else m=t[26];return m}function Xt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Zt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Qt(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function $t(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function en(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)($t,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)($t,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)($t,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(tn,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)(nn,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(on,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function tn(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(Qt,{children:(0,Q.jsx)(Wt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function nn(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(an)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,g,_,v,y;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(rn).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;g=Qt,m=mt;let b;t[34]===c?b=t[35]:(b=()=>c(``),t[34]=c,t[35]=b);let x;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(et,{className:`size-3.5`,"aria-hidden":!0}),t[36]=x):x=t[36];let S;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==b?(S=(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:b,children:[x,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=b,t[40]=S):S=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==S?(_=(0,Q.jsx)(pt,{icon:M,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:S}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=S,t[44]=_):_=t[44];let w;t[45]!==p.id||t[46]!==c?(w=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=w):w=t[47];let T=p.name||n.capabilityPresetsGlobalDefault,E;t[48]===T?E=t[49]:(E=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:T}),t[48]=T,t[49]=E);let D;t[50]===n.capabilityPresetsGlobalDefault?D=t[51]:(D=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=D);let O;t[52]!==E||t[53]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[E,D]}),t[52]=E,t[53]=D,t[54]=O):O=t[54];let k;t[55]===p.id?k=t[56]:(k=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=k);let A=p.description||n.capabilityPresetsGlobalDefaultHint,j;t[57]===A?j=t[58]:(j=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:A}),t[57]=A,t[58]=j);let N;t[59]!==w||t[60]!==O||t[61]!==k||t[62]!==j?(N=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-accent/25 bg-accent-soft/20 px-3 py-2 sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:w,children:[O,k,j]})}),t[59]=w,t[60]=O,t[61]=k,t[62]=j,t[63]=N):N=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-3 text-sm text-fg-muted`,children:n.capabilityPresetsEmptyAdditional})]}),y=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(`select`,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(`option`,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)($e,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=g,t[29]=_,t[30]=v,t[31]=y}else m=t[27],g=t[28],_=t[29],v=t[30],y=t[31];let b;t[64]!==m||t[65]!==_||t[66]!==v||t[67]!==y?(b=(0,Q.jsxs)(m,{children:[_,v,y]}),t[64]=m,t[65]=_,t[66]=v,t[67]=y,t[68]=b):b=t[68];let x;return t[69]!==g||t[70]!==b?(x=(0,Q.jsx)(g,{children:b}),t[69]=g,t[70]=b,t[71]=x):x=t[71],x}function rn(e){return e.id}function an(e){return[e.id,e]}function on(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(Qt,{children:(0,Q.jsx)(Yt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function sn(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(Qt,{children:r.id===`main`?(0,Q.jsx)(mt,{children:(0,Q.jsx)(pt,{icon:ct,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(mt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(pt,{icon:ct,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(fe,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var cn=i(q,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function ln(e){let t=(0,Z.c)(62),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:m,sessionsLoading:h,newBindSessionIdx:g,setNewBindSessionIdx:_,newBindCustomPeer:v,setNewBindCustomPeer:y,onRefreshSessions:b,lastActiveLabels:x,selectRecipient:S}=e,C=!u&&(d||l.length>0),w;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(w=(0,Q.jsx)(pt,{className:`shrink-0`,icon:Ie,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=w):w=t[2];let T;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==o||t[7]!==a||t[8]!==r||t[9]!==s?(T=a?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoading}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:St(e.match)}),(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${St(e.match)}`))}),t[3]=n.channelsLoading,t[4]=n.channelsNone,t[5]=n.removeBinding,t[6]=o,t[7]=a,t[8]=r,t[9]=s,t[10]=T):T=t[10];let E;t[11]!==n.channelLabel||t[12]!==n.channelsDisabledSuffix||t[13]!==n.channelsLoadingChannels||t[14]!==n.channelsManualChannelHint||t[15]!==l||t[16]!==u||t[17]!==f||t[18]!==p||t[19]!==y||t[20]!==_||t[21]!==d?(E=u?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoadingChannels}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Ct(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`select`,{className:i(Ct(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[11]=n.channelLabel,t[12]=n.channelsDisabledSuffix,t[13]=n.channelsLoadingChannels,t[14]=n.channelsManualChannelHint,t[15]=l,t[16]=u,t[17]=f,t[18]=p,t[19]=y,t[20]=_,t[21]=d,t[22]=E):E=t[22];let D;t[23]!==n.channelsCustomPeerHint||t[24]!==n.channelsCustomPeerPlaceholder||t[25]!==n.channelsLoadingSessions||t[26]!==n.channelsNoSessionsHint||t[27]!==n.channelsPeerAny||t[28]!==n.channelsPeerFromSessions||t[29]!==n.channelsRefreshSessions||t[30]!==n.channelsRefreshSessionsHint||t[31]!==n.channelsSessionLabel||t[32]!==n.peerIdLabel||t[33]!==m||t[34]!==r||t[35]!==x||t[36]!==f||t[37]!==v||t[38]!==g||t[39]!==b||t[40]!==S||t[41]!==h||t[42]!==y||t[43]!==_||t[44]!==C?(D=C&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||h||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>b(),children:[(0,Q.jsx)(G,{className:i(`size-3.5`,h&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),h&&m.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsLoadingSessions}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(`select`,{className:i(Ct(),`py-2`),value:g==null?``:String(g),disabled:r||!f.trim()||!!v.trim(),onChange:e=>{let t=e.target.value;_(t===``?null:Number(t))},children:[(0,Q.jsx)(`option`,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(`option`,{value:String(t),children:bt(e,x)},`${e.channel}-${e.chatId}`))]})]}),m.length===0&&f.trim()&&!h?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Ct(),`min-w-0 w-full sm:flex-1`),value:v,onChange:e=>{y(e.target.value),e.target.value.trim()&&_(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(`select`,{className:cn,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(`option`,{value:``,children:S}),m.map(e=>(0,Q.jsx)(`option`,{value:e.chatId,children:bt(e,x)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[23]=n.channelsCustomPeerHint,t[24]=n.channelsCustomPeerPlaceholder,t[25]=n.channelsLoadingSessions,t[26]=n.channelsNoSessionsHint,t[27]=n.channelsPeerAny,t[28]=n.channelsPeerFromSessions,t[29]=n.channelsRefreshSessions,t[30]=n.channelsRefreshSessionsHint,t[31]=n.channelsSessionLabel,t[32]=n.peerIdLabel,t[33]=m,t[34]=r,t[35]=x,t[36]=f,t[37]=v,t[38]=g,t[39]=b,t[40]=S,t[41]=h,t[42]=y,t[43]=_,t[44]=C,t[45]=D):D=t[45];let O;t[46]!==r||t[47]!==u||t[48]!==f?(O=r||!f.trim()||u,t[46]=r,t[47]=u,t[48]=f,t[49]=O):O=t[49];let k;t[50]!==n.addBinding||t[51]!==O?(k=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(X,{type:`submit`,disabled:O,children:n.addBinding})}),t[50]=n.addBinding,t[51]=O,t[52]=k):k=t[52];let A;t[53]!==c||t[54]!==E||t[55]!==D||t[56]!==k?(A=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[E,D,k]}),t[53]=c,t[54]=E,t[55]=D,t[56]=k,t[57]=A):A=t[57];let j;return t[58]!==w||t[59]!==T||t[60]!==A?(j=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[w,T,A]}),t[58]=w,t[59]=T,t[60]=A,t[61]=j):j=t[61],j}function un(e){let t=(0,Z.c)(29),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:c,filesViewMode:l,setFilesViewMode:u,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=s(dn),v;t[0]===n.filesHint?v=t[1]:(v=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[0]=n.filesHint,t[1]=v);let y;t[2]!==n.filesAutoSaveHint||t[3]!==n.filesEmpty||t[4]!==n.filesLoading||t[5]!==n.filesMarkdownEdit||t[6]!==n.filesMarkdownPreview||t[7]!==n.filesNavAria||t[8]!==n.filesSavingStatus||t[9]!==n.missing||t[10]!==n.pickFile||t[11]!==n.tryInChat||t[12]!==o||t[13]!==d||t[14]!==p||t[15]!==a||t[16]!==r||t[17]!==l||t[18]!==_||t[19]!==g||t[20]!==h||t[21]!==m||t[22]!==c||t[23]!==f||t[24]!==u?(y=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(`nav`,{className:`-mx-1 flex shrink-0 flex-wrap gap-1 px-1 pb-1`,role:`tablist`,"aria-label":n.filesNavAria,children:a.files.map(e=>{let t=o===e.name;return(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:i(`inline-flex shrink-0 items-center rounded-lg px-3 py-2 font-mono text-xs font-medium whitespace-nowrap transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,Qe.press,t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`,e.missing&&`opacity-60`),onClick:()=>c(e.name),children:[e.name,e.missing?` (${n.missing})`:``]},e.name)})}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Qe.press,l===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`edit`),children:[(0,Q.jsx)(je,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Qe.press,l===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`preview`),children:[(0,Q.jsx)(xe,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(at,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),l===`edit`?(0,Q.jsx)(`div`,{className:i(Ct(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Ct(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(me,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[2]=n.filesAutoSaveHint,t[3]=n.filesEmpty,t[4]=n.filesLoading,t[5]=n.filesMarkdownEdit,t[6]=n.filesMarkdownPreview,t[7]=n.filesNavAria,t[8]=n.filesSavingStatus,t[9]=n.missing,t[10]=n.pickFile,t[11]=n.tryInChat,t[12]=o,t[13]=d,t[14]=p,t[15]=a,t[16]=r,t[17]=l,t[18]=_,t[19]=g,t[20]=h,t[21]=m,t[22]=c,t[23]=f,t[24]=u,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function dn(e){return e.resolved===`dark`}function fn(e){let t=(0,Z.c)(66),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(pt,{className:`shrink-0`,icon:P,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=Et(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=Et(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg border border-edge-subtle bg-surface-base/60 p-3 text-xs text-fg-muted dark:border-edge`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=y):y=t[39];let b;t[40]!==a||t[41]!==r||t[42]!==o||t[43]!==i.typedModels.defaultRole||t[44]!==s||t[45]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Mt,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[40]=a,t[41]=r,t[42]=o,t[43]=i.typedModels.defaultRole,t[44]=s,t[45]=y,t[46]=b):b=t[46];let x;t[47]!==n.modelsSave||t[48]!==a||t[49]!==u||t[50]!==c?(x=u?null:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[47]=n.modelsSave,t[48]=a,t[49]=u,t[50]=c,t[51]=x):x=t[51];let S;t[52]===l?S=t[53]:(S=()=>void l(),t[52]=l,t[53]=S);let C;t[54]!==n.modelsResetInherit||t[55]!==a||t[56]!==S?(C=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[54]=n.modelsResetInherit,t[55]=a,t[56]=S,t[57]=C):C=t[57];let w;t[58]!==x||t[59]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[58]=x,t[59]=C,t[60]=w):w=t[60];let T;return t[61]!==d||t[62]!==w||t[63]!==v||t[64]!==b?(T=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,w]}),t[61]=d,t[62]=w,t[63]=v,t[64]=b,t[65]=T):T=t[65],T}function pn(e){let t=(0,Z.c)(37),{value:n,onChange:r,disabled:a,wd:o,placeholder:s,inputClassName:c,trailing:l}=e,u;t[0]!==r||t[1]!==n?(u={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=Re(u),f;t[3]===n?f=t[4]:(f=n.trim(),t[3]=n,t[4]=f);let p=f,m=p?`${p}\n${o.chooseFolder}`:`${s??o.notSet}\n${o.selectWorkingDirectory}`,h;t[5]===c?h=t[6]:(h=i(`min-w-0 flex-1`,c),t[5]=c,t[6]=h);let g=a||d.picking,_;t[7]===r?_=t[8]:(_=e=>void r(e.target.value),t[7]=r,t[8]=_);let v=s??o.pathInputPlaceholder,y;t[9]!==h||t[10]!==g||t[11]!==_||t[12]!==v||t[13]!==n?(y=(0,Q.jsx)(`input`,{type:`text`,className:h,value:n,disabled:g,onChange:_,placeholder:v,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=n,t[14]=y):y=t[14];let b=a||d.picking,x;t[15]!==m||t[16]!==d.pick||t[17]!==b||t[18]!==n||t[19]!==o.selectWorkingDirectory?(x=(0,Q.jsx)(rt,{compact:!0,value:n,onPick:d.pick,disabled:b,title:m,"aria-label":o.selectWorkingDirectory}),t[15]=m,t[16]=d.pick,t[17]=b,t[18]=n,t[19]=o.selectWorkingDirectory,t[20]=x):x=t[20];let S;t[21]!==x||t[22]!==l?(S=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[x,l]}),t[21]=x,t[22]=l,t[23]=S):S=t[23];let C;t[24]!==S||t[25]!==y?(C=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[y,S]}),t[24]=S,t[25]=y,t[26]=C):C=t[26];let w;t[27]!==d.confirmPick||t[28]!==d.hasNativePicker||t[29]!==d.modalOpen||t[30]!==d.setModalOpen||t[31]!==p||t[32]!==o?(w=d.hasNativePicker?null:(0,Q.jsx)(de,{open:d.modalOpen,onOpenChange:d.setModalOpen,initialAbsolutePath:p||void 0,onConfirm:d.confirmPick,wd:o}),t[27]=d.confirmPick,t[28]=d.hasNativePicker,t[29]=d.modalOpen,t[30]=d.setModalOpen,t[31]=p,t[32]=o,t[33]=w):w=t[33];let T;return t[34]!==C||t[35]!==w?(T=(0,Q.jsxs)(Q.Fragment,{children:[C,w]}),t[34]=C,t[35]=w,t[36]=T):T=t[36],T}function mn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function hn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),h=(0,$.useMemo)(()=>{let e=O(n.trim());return e&&T(e.styleId)?e.styleId:F[0]??`adventurer`},[n]),g=(0,$.useCallback)(async(e,n)=>{try{await ze(t)}catch{}r(S(e,n)),p(!1)},[t,r]),_=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await I(t,n),B(t),r(ne)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),v=(e,t)=>{let r=O(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void _(e)}),(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(we,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:F.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void g(e,A[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,Qe.press,h===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:mn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(h,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Qe.press,v(h,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(h,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(D,{open:f,onOpenChange:p,children:[(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,Qe.press),children:a.avatarMore})}),(0,Q.jsx)(w,{children:(0,Q.jsxs)(x,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:mn(h,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ne.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(h,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Qe.press,v(h,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(h,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(m,{agentId:t,avatar:n,size:40}),n.trim()&&!O(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function gn(e){let t=(0,Z.c)(207),{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:h,setEditWorkspace:g,editModel:_,setEditModel:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:w,profileMarkdownLoading:T,profileDraft:E,updateIdentity:D,handleSoulTemplateChange:O,handleSoulContentChange:A,setAvatarDialogOpen:j,toggleSoulPreviewMode:P,onTryInChat:F}=e,I=o(yn),L=s(vn),ne;t[0]===E?.identity?ne=t[1]:(ne=E?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=E?.identity,t[1]=ne);let R=ne,ie=E?.soulTemplate??`professional`,z=E?.soulCustomContent??``,B=E?.soulEditorNonce??0,ae=E?.soulPreviewMode??!1,V=E?.avatarDialogOpen??!1,H;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(H=Ct(),t[2]=H):H=t[2];let U=H,W;t[3]===I?W=t[4]:(W=(e,t)=>I===`zh`?t:e,t[3]=I,t[4]=W);let G=W;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let oe;t[7]!==R.avatar||t[8]!==a.id?(oe=(0,Q.jsx)(m,{agentId:a.id,avatar:R.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=R.avatar,t[8]=a.id,t[9]=oe):oe=t[9];let ce;t[10]===j?ce=t[11]:(ce=()=>j(!0),t[10]=j,t[11]=ce);let le;t[12]!==n.avatarOpenSettingsAria||t[13]!==ce?(le={onClick:ce,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=ce,t[14]=le):le=t[14];let K;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==x||t[19]!==S||t[20]!==a.isDefault?(K=a.isDefault||x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,x?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:S?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=x,t[19]=S,t[20]=a.isDefault,t[21]=K):K=t[21];let q;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==c||t[25]!==x||t[26]!==y||t[27]!==b||t[28]!==a.isDefault?(q=!a.isDefault||!x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void y(),children:n.setDefault}),x?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void b(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=c,t[25]=x,t[26]=y,t[27]=b,t[28]=a.isDefault,t[29]=q):q=t[29];let de;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==oe||t[33]!==le||t[34]!==K||t[35]!==q?(de=(0,Q.jsx)(pt,{icon:M,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:oe,iconInteractive:le,titleAccessory:K,trailing:q}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=oe,t[33]=le,t[34]=K,t[35]=q,t[36]=de):de=t[36];let fe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Q.jsx)(Me,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,re)}),t[37]=fe):fe=t[37];let pe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(pe=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,se),t[38]=pe):pe=t[38];let he;t[39]===n.avatarPickerTitle?he=t[40]:(he=(0,Q.jsx)(te,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=he);let ge;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ge=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=ge):ge=t[41];let _e;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[42]=_e):_e=t[42];let ve;t[43]===n.closeDialogAria?ve=t[44]:(ve=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:ge,"aria-label":n.closeDialogAria,children:_e})}),t[43]=n.closeDialogAria,t[44]=ve);let ye;t[45]!==he||t[46]!==ve?(ye=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[he,ve]}),t[45]=he,t[46]=ve,t[47]=ye):ye=t[47];let Se;t[48]===n.avatarRowHint?Se=t[49]:(Se=(0,Q.jsx)(p,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Se);let Ce;t[50]===D?Ce=t[51]:(Ce=e=>D({avatar:e}),t[50]=D,t[51]=Ce);let we;t[52]!==n||t[53]!==R.avatar||t[54]!==a.id||t[55]!==Ce?(we=(0,Q.jsx)(hn,{agentId:a.id,value:R.avatar,onChange:Ce,a:n}),t[52]=n,t[53]=R.avatar,t[54]=a.id,t[55]=Ce,t[56]=we):we=t[56];let Te;t[57]!==ye||t[58]!==Se||t[59]!==we?(Te=(0,Q.jsxs)(k,{children:[fe,(0,Q.jsxs)(Fe,{className:pe,onOpenAutoFocus:_n,children:[ye,Se,we]})]}),t[57]=ye,t[58]=Se,t[59]=we,t[60]=Te):Te=t[60];let Ee;t[61]!==V||t[62]!==j||t[63]!==Te?(Ee=(0,Q.jsx)(N,{open:V,onOpenChange:j,children:Te}),t[61]=V,t[62]=j,t[63]=Te,t[64]=Ee):Ee=t[64];let De;t[65]===n.displayName?De=t[66]:(De=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=De);let Oe;t[67]!==u||t[68]!==D?(Oe=e=>{u(e.target.value),D({name:e.target.value})},t[67]=u,t[68]=D,t[69]=Oe):Oe=t[69];let ke;t[70]!==n.personaNamePlaceholder||t[71]!==l||t[72]!==Oe?(ke=(0,Q.jsx)(`input`,{className:U,value:l,onChange:Oe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=l,t[72]=Oe,t[73]=ke):ke=t[73];let je;t[74]!==De||t[75]!==ke?(je=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[De,ke]}),t[74]=De,t[75]=ke,t[76]=je):je=t[76];let Ne;t[77]===n.personaEmoji?Ne=t[78]:(Ne=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Ne);let Pe;t[79]===D?Pe=t[80]:(Pe=e=>D({emoji:e.target.value}),t[79]=D,t[80]=Pe);let Ie;t[81]!==n.personaEmojiPlaceholder||t[82]!==R.emoji||t[83]!==Pe?(Ie=(0,Q.jsx)(`input`,{className:U,value:R.emoji,onChange:Pe,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=R.emoji,t[83]=Pe,t[84]=Ie):Ie=t[84];let Re;t[85]!==Ne||t[86]!==Ie?(Re=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ne,Ie]}),t[85]=Ne,t[86]=Ie,t[87]=Re):Re=t[87];let ze;t[88]===n.agentDescription?ze=t[89]:(ze=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=ze);let Be;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Be=i(U,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Be):Be=t[90];let Ve;t[91]!==f||t[92]!==D?(Ve=e=>{f(e.target.value),D({description:e.target.value})},t[91]=f,t[92]=D,t[93]=Ve):Ve=t[93];let He;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==Ve?(He=(0,Q.jsx)(`textarea`,{className:Be,value:d,onChange:Ve,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=Ve,t[97]=He):He=t[97];let Ue;t[98]!==ze||t[99]!==He?(Ue=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ze,He]}),t[98]=ze,t[99]=He,t[100]=Ue):Ue=t[100];let Ge;t[101]===n.personaCreature?Ge=t[102]:(Ge=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Ge);let Ke;t[103]===R.creature?Ke=t[104]:(Ke=Ae.some(e=>e.value===R.creature)?R.creature:`__custom__`,t[103]=R.creature,t[104]=Ke);let qe;t[105]===D?qe=t[106]:(qe=e=>{if(e.target.value===`__custom__`){D({creature:``});return}D({creature:e.target.value})},t[105]=D,t[106]=qe);let Je;t[107]===G?Je=t[108]:(Je=Ae.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:G(e.labelEn,e.labelZh)},e.value)),t[107]=G,t[108]=Je);let Ye;t[109]===G?Ye=t[110]:(Ye=G(`Custom…`,`自定义…`),t[109]=G,t[110]=Ye);let Ze;t[111]===Ye?Ze=t[112]:(Ze=(0,Q.jsx)(`option`,{value:`__custom__`,children:Ye}),t[111]=Ye,t[112]=Ze);let $e;t[113]!==Ke||t[114]!==qe||t[115]!==Je||t[116]!==Ze?($e=(0,Q.jsxs)(`select`,{className:U,value:Ke,onChange:qe,children:[Je,Ze]}),t[113]=Ke,t[114]=qe,t[115]=Je,t[116]=Ze,t[117]=$e):$e=t[117];let et;t[118]!==n.personaCreaturePlaceholder||t[119]!==R.creature||t[120]!==D?(et=Ae.some(e=>e.value===R.creature)?null:(0,Q.jsx)(`input`,{className:i(U,`mt-1 text-xs`),value:R.creature,onChange:e=>D({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=R.creature,t[120]=D,t[121]=et):et=t[121];let tt;t[122]!==Ge||t[123]!==$e||t[124]!==et?(tt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ge,$e,et]}),t[122]=Ge,t[123]=$e,t[124]=et,t[125]=tt):tt=t[125];let nt;t[126]!==je||t[127]!==Re||t[128]!==Ue||t[129]!==tt?(nt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[je,Re,Ue,tt]}),t[126]=je,t[127]=Re,t[128]=Ue,t[129]=tt,t[130]=nt):nt=t[130];let rt;t[131]!==Ee||t[132]!==nt||t[133]!==de?(rt=(0,Q.jsxs)(mt,{children:[de,Ee,nt]}),t[131]=Ee,t[132]=nt,t[133]=de,t[134]=rt):rt=t[134];let it;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(it=(0,Q.jsx)(pt,{icon:Y,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=it):it=t[137];let ot;t[138]===n.modelPrimary?ot=t[139]:(ot=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=ot);let st;t[140]===v?st=t[141]:(st=e=>v(e),t[140]=v,t[141]=st);let ct;t[142]!==c||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==_||t[147]!==st?(ct=(0,Q.jsx)(J,{className:`min-w-0 flex-1`,value:_,disabled:c,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:st}),t[142]=c,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=_,t[147]=st,t[148]=ct):ct=t[148];let lt;t[149]!==n.modelClear||t[150]!==c||t[151]!==_||t[152]!==v?(lt=_.trim()?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:c,onClick:()=>v(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=c,t[151]=_,t[152]=v,t[153]=lt):lt=t[153];let ut;t[154]!==ct||t[155]!==lt?(ut=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ct,lt]}),t[154]=ct,t[155]=lt,t[156]=ut):ut=t[156];let dt;t[157]!==ot||t[158]!==ut?(dt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ot,ut]}),t[157]=ot,t[158]=ut,t[159]=dt):dt=t[159];let ht;t[160]===n.workspacePath?ht=t[161]:(ht=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=ht);let gt=r.workingDirectory,_t=r.workingDirectory.notSet,vt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(vt=i(U,`font-mono text-xs`),t[162]=vt):vt=t[162];let yt;t[163]!==c||t[164]!==r.workingDirectory||t[165]!==h||t[166]!==g?(yt=(0,Q.jsx)(pn,{value:h,onChange:g,disabled:c,wd:gt,placeholder:_t,inputClassName:vt}),t[163]=c,t[164]=r.workingDirectory,t[165]=h,t[166]=g,t[167]=yt):yt=t[167];let bt;t[168]!==ht||t[169]!==yt?(bt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ht,yt]}),t[168]=ht,t[169]=yt,t[170]=bt):bt=t[170];let xt;t[171]!==dt||t[172]!==bt?(xt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[dt,bt]}),t[171]=dt,t[172]=bt,t[173]=xt):xt=t[173];let St;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==c||t[177]!==w||t[178]!==C||t[179]!==F?(St=w?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(X,{type:`button`,disabled:c,onClick:()=>void C(),children:n.save}),F?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:F,children:[(0,Q.jsx)(at,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=c,t[177]=w,t[178]=C,t[179]=F,t[180]=St):St=t[180];let wt;t[181]!==it||t[182]!==xt||t[183]!==St?(wt=(0,Q.jsxs)(mt,{children:[it,xt,St]}),t[181]=it,t[182]=xt,t[183]=St,t[184]=wt):wt=t[184];let Tt;t[185]!==n.loading||t[186]!==n.personaSectionSoul||t[187]!==n.personaSectionSoulHint||t[188]!==n.personaSoulCustomEdit||t[189]!==n.personaSoulEdit||t[190]!==n.personaSoulPreview||t[191]!==n.personaSoulTemplate||t[192]!==A||t[193]!==O||t[194]!==L||t[195]!==G||t[196]!==T||t[197]!==z||t[198]!==B||t[199]!==ae||t[200]!==ie||t[201]!==P?(Tt=T?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Q.jsxs)(mt,{children:[(0,Q.jsx)(pt,{icon:We,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:ue.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,Qe.pressCard,ie===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>O(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:G(e.labelEn,e.labelZh)})]},e.id))})]}),ie===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(be,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:ae?n.personaSoulEdit:n.personaSoulPreview,"aria-label":ae?n.personaSoulEdit:n.personaSoulPreview,onClick:P,children:ae?(0,Q.jsx)(Xe,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(xe,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(U,`flex min-h-64 flex-col overflow-hidden p-0`),children:ae?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(me,{content:z})}):(0,Q.jsx)(ft,{initialContent:z,onChange:A,isDark:L,className:`min-h-0 flex-1`},`soul-${B}`)})]}):null]}),t[185]=n.loading,t[186]=n.personaSectionSoul,t[187]=n.personaSectionSoulHint,t[188]=n.personaSoulCustomEdit,t[189]=n.personaSoulEdit,t[190]=n.personaSoulPreview,t[191]=n.personaSoulTemplate,t[192]=A,t[193]=O,t[194]=L,t[195]=G,t[196]=T,t[197]=z,t[198]=B,t[199]=ae,t[200]=ie,t[201]=P,t[202]=Tt):Tt=t[202];let Et;return t[203]!==rt||t[204]!==wt||t[205]!==Tt?(Et=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[rt,wt,Tt]}),t[203]=rt,t[204]=wt,t[205]=Tt,t[206]=Et):Et=t[206],Et}function _n(e){return e.preventDefault()}function vn(e){return e.resolved===`dark`}function yn(e){return e.language}function bn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function xn(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Sn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=Se(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,h;t[3]!==n||t[4]!==r?(h=ve(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=h):h=t[5];let g=h,_;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(_=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=_):_=t[9];let v=_,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,C=r.tools.effectiveDisable.length,w=r.skills.effectiveAllowlist?.length,T;t[14]!==r.avatar||t[15]!==r.id?(T=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(m,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=T):T=t[16];let E;t[17]===p?E=t[18]:(E=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=E);let D;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(D=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=D):D=t[21];let O;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(O=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=O):O=t[26];let k;t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[E,D,O]}),t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]===r.id?A=t[32]:(A=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=A);let N;t[33]!==A||t[34]!==k?(N=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[33]=A,t[34]=k,t[35]=N):N=t[35];let P;t[36]!==N||t[37]!==T?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[T,N]}),t[36]=N,t[37]=T,t[38]=P):P=t[38];let F;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(F=d?(0,Q.jsxs)(X,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(at,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=F):F=t[42];let ee;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(ee=r.isDefault?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=ee):ee=t[47];let I;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(I=o?null:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=I):I=t[52];let L;t[53]!==F||t[54]!==ee||t[55]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[F,ee,I]}),t[53]=F,t[54]=ee,t[55]=I,t[56]=L):L=t[56];let te;t[57]!==P||t[58]!==L?(te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[P,L]}),t[57]=P,t[58]=L,t[59]=te):te=t[59];let ne;t[60]===g?ne=t[61]:(ne=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:g}),t[60]=g,t[61]=ne);let re;t[62]!==te||t[63]!==ne?(re=(0,Q.jsx)(mt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[te,ne]})}),t[62]=te,t[63]=ne,t[64]=re):re=t[64];let ie;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ie=(0,Q.jsx)(pt,{icon:M,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ie):ie=t[67];let z;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(z=(0,Q.jsx)(bn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=z):z=t[71];let B;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(B=(0,Q.jsx)(bn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=B):B=t[75];let ae;t[76]!==z||t[77]!==B?(ae=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[z,B]}),t[76]=z,t[77]=B,t[78]=ae):ae=t[78];let V;t[79]!==ie||t[80]!==ae?(V=(0,Q.jsxs)(mt,{children:[ie,ae]}),t[79]=ie,t[80]=ae,t[81]=V):V=t[81];let H;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(H=(0,Q.jsx)(pt,{icon:R,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=H):H=t[84];let U;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(U=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=U):U=t[88];let W;t[89]!==n.listToolsLabel||t[90]!==U?(W=(0,Q.jsx)(xn,{icon:nt,label:n.listToolsLabel,value:U}),t[89]=n.listToolsLabel,t[90]=U,t[91]=W):W=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==w?(G=w?n.listSkillsCount.replace(`{{count}}`,String(w)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=w,t[95]=G):G=t[95];let se;t[96]!==n.listSkillsLabel||t[97]!==G?(se=(0,Q.jsx)(xn,{icon:M,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=se):se=t[98];let ce;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(ce=(0,Q.jsx)(xn,{icon:j,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=ce):ce=t[101];let le;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(le=(0,Q.jsx)(xn,{icon:Pe,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=le):le=t[104];let K;t[105]!==n.listWorkspaceLabel||t[106]!==b?(K=(0,Q.jsx)(xn,{icon:oe,label:n.listWorkspaceLabel,value:b}),t[105]=n.listWorkspaceLabel,t[106]=b,t[107]=K):K=t[107];let ue;t[108]!==W||t[109]!==se||t[110]!==ce||t[111]!==le||t[112]!==K?(ue=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[W,se,ce,le,K]}),t[108]=W,t[109]=se,t[110]=ce,t[111]=le,t[112]=K,t[113]=ue):ue=t[113];let q;t[114]!==H||t[115]!==ue?(q=(0,Q.jsxs)(mt,{children:[H,ue]}),t[114]=H,t[115]=ue,t[116]=q):q=t[116];let de;return t[117]!==re||t[118]!==V||t[119]!==q?(de=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[re,V,q]}),t[117]=re,t[118]=V,t[119]=q,t[120]=de):de=t[120],de}function Cn(e){let t=(0,Z.c)(66),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(wn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(pt,{className:`shrink-0`,icon:E,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let b;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(b=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=U(`skills`),t[25]=w):w=t[25];let T;t[26]===n.skillsLibraryLink?T=t[27]:(T=(0,Q.jsx)(Ye,{to:w,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=T);let D;t[28]!==C||t[29]!==T?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,T]}),t[28]=C,t[29]=T,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsCatalogLoading||t[44]!==n.skillsEmptyCatalog||t[45]!==n.skillsNoDescription||t[46]!==a||t[47]!==s||t[48]!==h||t[49]!==d||t[50]!==o||t[51]!==c||t[52]!==u?(M=o?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsCatalogLoading}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 dark:border-edge-subtle`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsCatalogLoading,t[44]=n.skillsEmptyCatalog,t[45]=n.skillsNoDescription,t[46]=a,t[47]=s,t[48]=h,t[49]=d,t[50]=o,t[51]=c,t[52]=u,t[53]=M):M=t[53];let N;t[54]!==n.skillsSave||t[55]!==a||t[56]!==p||t[57]!==f?(N=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(X,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[54]=n.skillsSave,t[55]=a,t[56]=p,t[57]=f,t[58]=N):N=t[58];let P;return t[59]!==D||t[60]!==k||t[61]!==j||t[62]!==M||t[63]!==N||t[64]!==v?(P=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,D,k,j,M,N]}),t[59]=D,t[60]=k,t[61]=j,t[62]=M,t[63]=N,t[64]=v,t[65]=P):P=t[65],P}function wn(e){return e.name||e.directoryId}var Tn=[`write_file`,`edit_file`,`shell`],En=[`shell`,`image_generate`,`extensions`],Dn=[`send_message`,`send_media`];function On(e){let t=(0,Z.c)(88),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=c??new Set,t[4]=c,t[5]=y);let b=y,x;t[6]!==b||t[7]!==o||t[8]!==n||t[9]!==s?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=b,t[7]=o,t[8]=n,t[9]=s,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==s?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);s(t)},t[11]=v,t[12]=s,t[13]=C):C=t[13];let w=C,T;t[14]===s?T=t[15]:(T=()=>{s(new Set)},t[14]=s,t[15]=T);let E=T,D;t[16]!==r||t[17]!==s||t[18]!==h?(D=()=>{s(new Set([...r,...h]))},t[16]=r,t[17]=s,t[18]=h,t[19]=D):D=t[19];let O=D,k;t[20]===r?k=t[21]:(k=At(r),t[20]=r,t[21]=k);let A=k,j;if(t[22]!==v||t[23]!==A||t[24]!==n||t[25]!==h){if(j=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(An),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),j.push(n)}for(let e of kt){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&j.push({key:e.key,ids:[...t]})}if(A.length>0){let e;t[31]===A?e=t[32]:(e={key:`misc`,ids:A},t[31]=A,t[32]=e),j.push(e)}t[22]=v,t[23]=A,t[24]=n,t[25]=h,t[26]=j}else j=t[26];let M=j,N=M.some(kn),P=g||a,F;t[33]===f.quickActionsLabel?F=t[34]:(F=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=F);let ee=P||r.length===0&&h.length===0,I;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==ee?(I=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ee,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=ee,t[38]=I):I=t[38];let L=P||r.length===0&&h.length===0,te;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==L?(te=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:L,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=L,t[42]=te):te=t[42];let ne=P||r.length===0,R;t[43]===w?R=t[44]:(R=()=>w(Tn),t[43]=w,t[44]=R);let re;t[45]!==f.quickReadOnlyWorkspace||t[46]!==ne||t[47]!==R?(re=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ne,onClick:R,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=ne,t[47]=R,t[48]=re):re=t[48];let ie=P||r.length===0,z;t[49]===w?z=t[50]:(z=()=>w(En),t[49]=w,t[50]=z);let B;t[51]!==f.quickHighRiskOff||t[52]!==ie||t[53]!==z?(B=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ie,onClick:z,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ie,t[53]=z,t[54]=B):B=t[54];let ae=P||r.length===0,V;t[55]===w?V=t[56]:(V=()=>w(Dn),t[55]=w,t[56]=V);let H;t[57]!==f.quickNoOutbound||t[58]!==ae||t[59]!==V?(H=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:Dt,disabled:ae,onClick:V,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ae,t[59]=V,t[60]=H):H=t[60];let U;t[61]!==I||t[62]!==te||t[63]!==re||t[64]!==B||t[65]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[I,te,re,B,H]}),t[61]=I,t[62]=te,t[63]=re,t[64]=B,t[65]=H,t[66]=U):U=t[66];let W;t[67]!==F||t[68]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,U]}),t[67]=F,t[68]=U,t[69]=W):W=t[69];let G;t[70]!==b||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==M||t[75]!==N||t[76]!==f.emptyBuiltin||t[77]!==f.loadingBuiltin||t[78]!==f.lockedByDefaults||t[79]!==f.notInBuiltin||t[80]!==a||t[81]!==n||t[82]!==P||t[83]!==S?(G=a?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.loadingBuiltin}):N?(0,Q.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:M.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,a=n===`agentEntry`&&b.has(e),s=o.has(e),c=a?!1:!s,l=u(e);return(0,Q.jsx)(`li`,{className:i(`rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5 dark:border-edge-subtle`,r&&`border-dashed`,a&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:i(`flex gap-3 text-sm`,a?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:a||P,onChange:()=>S(e,!c)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,a?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=o,t[72]=d,t[73]=u,t[74]=M,t[75]=N,t[76]=f.emptyBuiltin,t[77]=f.loadingBuiltin,t[78]=f.lockedByDefaults,t[79]=f.notInBuiltin,t[80]=a,t[81]=n,t[82]=P,t[83]=S,t[84]=G):G=t[84];let oe;return t[85]!==W||t[86]!==G?(oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[W,G]}),t[85]=W,t[86]=G,t[87]=oe):oe=t[87],oe}function kn(e){return e.ids.length>0}function An(e,t){return e.localeCompare(t)}function jn(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:s,toolEntryDisable:c,setToolEntryDisable:l,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=o(Nn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,g;t[2]===i.tools.presetDenied?g=t[3]:(g=new Set(i.tools.presetDenied.flatMap(Mn)),t[2]=i.tools.presetDenied,t[3]=g);let _=g,v;t[4]===l?v=t[5]:(v=e=>{l(e)},t[4]=l,t[5]=v);let y=v,b=n.toolsDisableGroups,x;t[6]===b?x=t[7]:(x=e=>b[e],t[6]=b,t[7]=x);let S=x,C;t[8]===n.toolDescriptions?C=t[9]:(C=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=C);let w=C,T;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(T=(0,Q.jsx)(pt,{className:`shrink-0`,icon:nt,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=T):T=t[12];let E;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(E={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=E):E=t[23];let D;t[24]!==s||t[25]!==r.builtinToolIds||t[26]!==S||t[27]!==w||t[28]!==y||t[29]!==_||t[30]!==E||t[31]!==c?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(On,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:c,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:s,labels:E})}),t[24]=s,t[25]=r.builtinToolIds,t[26]=S,t[27]=w,t[28]=y,t[29]=_,t[30]=E,t[31]=c,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==s||t[35]!==f||t[36]!==u?(O=f?null:(0,Q.jsx)(X,{type:`button`,disabled:s,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=s,t[35]=f,t[36]=u,t[37]=O):O=t[37];let k;t[38]===d?k=t[39]:(k=()=>void d(),t[38]=d,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==s||t[42]!==k?(A=(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:s,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=s,t[42]=k,t[43]=A):A=t[43];let j;t[44]!==A||t[45]!==O?(j=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[O,A]}),t[44]=A,t[45]=O,t[46]=j):j=t[46];let M;return t[47]!==j||t[48]!==T||t[49]!==D?(M=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[T,D,j]}),t[47]=j,t[48]=T,t[49]=D,t[50]=M):M=t[50],M}function Mn(e){let t=String(e).trim();return t?[t]:[]}function Nn(e){return e.language}function Pn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:ee,setFileDraft:I,fileSaving:L,profileFileLoading:te,profileEditorNonce:ne,toolEntryDisable:R,setToolEntryDisable:re,onSaveTools:ie,onClearToolsEntry:z,modelRows:B,setModelRows:ae,onSaveModels:V,onClearModelsEntry:H,skillsCatalogLoading:U,catalogForPick:W,skillsInherit:G,setSkillsInherit:oe,skillsPick:se,setSkillsPick:ce,onSaveSkills:le,bindingsLoading:K,agentBindings:ue,bindChannelStatuses:q,bindChannelsLoading:de,useManualChannel:fe,newBindChannel:pe,setNewBindChannel:me,bindSessionChats:he,bindSessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:J,refreshBindSessions:be,onRemoveBinding:xe,onAddBinding:Se,onTryInChat:Ce}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Ce||t[11]!==a?(e=(0,Q.jsx)(Sn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Ce}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Ce,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Ce||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(gn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Ce}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Ce,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==B||t[43]!==H||t[44]!==V||t[45]!==a||t[46]!==ae?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(fn,{a:n,chat:r,selected:a,busy:c,modelRows:B,setModelRows:ae,onSaveModels:V,onClearModelsEntry:H})}),t[39]=n,t[40]=c,t[41]=r,t[42]=B,t[43]=H,t[44]=V,t[45]=a,t[46]=ae,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==ee||t[51]!==L||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Ce||t[56]!==ne||t[57]!==te||t[58]!==N||t[59]!==I||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(un,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:ee,setFileDraft:I,fileSaving:L,profileFileLoading:te,profileEditorNonce:ne,onTryInChat:Ce})}),t[48]=n,t[49]=M,t[50]=ee,t[51]=L,t[52]=j,t[53]=A,t[54]=P,t[55]=Ce,t[56]=ne,t[57]=te,t[58]=N,t[59]=I,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==z||t[70]!==ie||t[71]!==a||t[72]!==re||t[73]!==R?(e=(0,Q.jsx)(jn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:R,setToolEntryDisable:re,onSaveTools:ie,onClearToolsEntry:z}),t[66]=n,t[67]=c,t[68]=s,t[69]=z,t[70]=ie,t[71]=a,t[72]=re,t[73]=R,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==W||t[78]!==le||t[79]!==a||t[80]!==oe||t[81]!==ce||t[82]!==U||t[83]!==G||t[84]!==se?(e=(0,Q.jsx)(Cn,{a:n,selected:a,busy:c,skillsCatalogLoading:U,catalogForPick:W,skillsInherit:G,setSkillsInherit:oe,skillsPick:se,setSkillsPick:ce,onSaveSkills:le}),t[75]=n,t[76]=c,t[77]=W,t[78]=le,t[79]=a,t[80]=oe,t[81]=ce,t[82]=U,t[83]=G,t[84]=se,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(Ht,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==ue||t[90]!==q||t[91]!==de||t[92]!==he||t[93]!==ge||t[94]!==K||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==pe||t[99]!==ye||t[100]!==_e||t[101]!==Se||t[102]!==xe||t[103]!==be||t[104]!==me||t[105]!==J||t[106]!==ve||t[107]!==fe?(e=(0,Q.jsx)(ln,{a:n,busy:c,bindingsLoading:K,agentBindings:ue,channelStatuses:q,channelsStatusLoading:de,useManualChannel:fe,newBindChannel:pe,setNewBindChannel:me,bindSessionChats:he,sessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:J,onRefreshSessions:be,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:xe,onAddBinding:Se}),t[88]=n,t[89]=ue,t[90]=q,t[91]=de,t[92]=he,t[93]=ge,t[94]=K,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=pe,t[99]=ye,t[100]=_e,t[101]=Se,t[102]=xe,t[103]=be,t[104]=me,t[105]=J,t[106]=ve,t[107]=fe,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(en,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(sn,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let we;return t[126]===n.selectAgentHint?we=t[127]:(we=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=we),we}function Fn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=Se(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=ve(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function In(e,t){return e.replace(`{{count}}`,String(t))}function Ln(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?In(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?In(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Rn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?In(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?In(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function zn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(Ee,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,f),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(ye,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(Ke,{children:(0,Q.jsxs)(Ce,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(Be,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(ke,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Bn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,h,g,_;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Fn(r,c,n),v=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),_=e;break bb0}h=`flex flex-col gap-4`,t[16]!==n||t[17]!==v?(g=v?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listEmpty}):null,t[16]=n,t[17]=v,t[18]=g):g=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let y;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(y=e=>{let t=Se(e,n),r=e.id,c=ve(e,n),f=Ln(e,n),p=Rn(e,n),h=e.id===a||e.isDefault,g=e.id===o,_=g&&s,v=g&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-surface`,`transition-[border-color,transform,box-shadow] duration-150 ease-out`,`hover:border-edge-strong`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,Qe.pressCard),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 text-left`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(m,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[h?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,v?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!h&&!g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Vn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(at,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=y):y=t[26],p=e.map(y)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=h,t[12]=g,t[13]=_}else f=t[9],p=t[10],h=t[11],g=t[12],_=t[13];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let v;t[27]!==f||t[28]!==p?(v=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=v):v=t[29];let y;return t[30]!==h||t[31]!==g||t[32]!==v?(y=(0,Q.jsxs)(`div`,{className:h,children:[g,v]}),t[30]=h,t[31]=g,t[32]=v,t[33]=y):y=t[33],y}function Vn(e){return(0,Q.jsx)(zn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Hn(e){let t=(0,Z.c)(130),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:m,createDescription:h,setCreateDescription:g,createWorkspace:_,setCreateWorkspace:v,createModel:y,setCreateModel:b,onCreate:x,onSuggestWorkspace:S,agents:C,duplicateSourceId:w,onSelectDuplicateSource:T}=e,E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(Me,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,re)}),t[0]=E):E=t[0];let D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(D=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,se,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=D):D=t[1];let O;t[2]===a.addAgent?O=t[3]:(O=(0,Q.jsx)(te,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=O);let A;t[4]===a.addAgentHint?A=t[5]:(A=(0,Q.jsx)(p,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=A);let j;t[6]!==O||t[7]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[O,A]}),t[6]=O,t[7]=A,t[8]=j):j=t[8];let M;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=i(be,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=M):M=t[9];let P;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[10]=P):P=t[10];let F;t[11]===a.closeDialogAria?F=t[12]:(F=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:M,"aria-label":a.closeDialogAria,children:P})}),t[11]=a.closeDialogAria,t[12]=F);let I;t[13]!==j||t[14]!==F?(I=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[j,F]}),t[13]=j,t[14]=F,t[15]=I):I=t[15];let L;t[16]!==a||t[17]!==C||t[18]!==w||t[19]!==T?(L=C.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(`select`,{className:i(Ct(),`bg-surface-panel`),value:w??``,onChange:e=>T(e.target.value||null),children:[(0,Q.jsx)(`option`,{value:``,children:a.copyFromExistingAgentNone}),C.map(e=>(0,Q.jsxs)(`option`,{value:e.id,children:[Se(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=C,t[18]=w,t[19]=T,t[20]=L):L=t[20];let ne;t[21]===c?ne=t[22]:(ne=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=ne);let R;t[23]!==a.newAgentLabel||t[24]!==l?(R=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=R):R=t[25];let ie;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ie=Ct(),t[26]=ie):ie=t[26];let z;t[27]===d?z=t[28]:(z=e=>d(e.target.value),t[27]=d,t[28]=z);let B;t[29]===S?B=t[30]:(B=()=>S(),t[29]=S,t[30]=B);let ae;t[31]!==u||t[32]!==z||t[33]!==B?(ae=(0,Q.jsx)(`input`,{className:ie,value:u,onChange:z,onBlur:B,required:!0,autoComplete:`off`}),t[31]=u,t[32]=z,t[33]=B,t[34]=ae):ae=t[34];let V;t[35]!==R||t[36]!==ae?(V=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[R,ae]}),t[35]=R,t[36]=ae,t[37]=V):V=t[37];let H;t[38]===a.newAgentIdOptional?H=t[39]:(H=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=H);let U;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(U=i(Ct(),`font-mono text-xs`),t[40]=U):U=t[40];let W;t[41]===m?W=t[42]:(W=e=>m(e.target.value),t[41]=m,t[42]=W);let G;t[43]===S?G=t[44]:(G=()=>S(),t[43]=S,t[44]=G);let oe;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==W||t[49]!==G?(oe=(0,Q.jsx)(`input`,{className:U,value:f,onChange:W,onBlur:G,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=f,t[48]=W,t[49]=G,t[50]=oe):oe=t[50];let ce;t[51]===a.newAgentIdRules?ce=t[52]:(ce=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=ce);let le;t[53]!==H||t[54]!==oe||t[55]!==ce?(le=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[H,oe,ce]}),t[53]=H,t[54]=oe,t[55]=ce,t[56]=le):le=t[56];let K;t[57]!==a.agentDescription||t[58]!==l?(K=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=K):K=t[59];let ue;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ue=i(Ct(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=ue):ue=t[60];let q;t[61]===g?q=t[62]:(q=e=>g(e.target.value),t[61]=g,t[62]=q);let de;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==q?(de=(0,Q.jsx)(`textarea`,{className:ue,value:h,onChange:q,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=q,t[66]=de):de=t[66];let fe;t[67]!==K||t[68]!==de?(fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[K,de]}),t[67]=K,t[68]=de,t[69]=fe):fe=t[69];let pe;t[70]===a.newWorkspace?pe=t[71]:(pe=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=pe);let me;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(me=i(Ct(),`font-mono text-xs`),t[72]=me):me=t[72];let he;t[73]===v?he=t[74]:(he=e=>v(e.target.value),t[73]=v,t[74]=he);let ge;t[75]!==_||t[76]!==he?(ge=(0,Q.jsx)(`input`,{className:me,value:_,onChange:he,required:!0,autoComplete:`off`}),t[75]=_,t[76]=he,t[77]=ge):ge=t[77];let _e;t[78]!==pe||t[79]!==ge?(_e=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[pe,ge]}),t[78]=pe,t[79]=ge,t[80]=_e):_e=t[80];let ve;t[81]===a.newModelOptional?ve=t[82]:(ve=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=ve);let ye;t[83]===b?ye=t[84]:(ye=e=>b(e),t[83]=b,t[84]=ye);let xe;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==y||t[90]!==ye?(xe=(0,Q.jsx)(J,{className:`min-w-0 flex-1`,value:y,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:ye}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=y,t[90]=ye,t[91]=xe):xe=t[91];let Ce;t[92]!==a.modelClear||t[93]!==s||t[94]!==y||t[95]!==b?(Ce=y.trim()?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>b(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=y,t[95]=b,t[96]=Ce):Ce=t[96];let we;t[97]!==xe||t[98]!==Ce?(we=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[xe,Ce]}),t[97]=xe,t[98]=Ce,t[99]=we):we=t[99];let Te;t[100]!==ve||t[101]!==we?(Te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[ve,we]}),t[100]=ve,t[101]=we,t[102]=Te):Te=t[102];let Ee;t[103]!==a.createModalCancel||t[104]!==s?(Ee=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Ee):Ee=t[105];let Oe;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Q.jsx)(De,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=Oe):Oe=t[106];let ke;t[107]!==a.create||t[108]!==s?(ke=(0,Q.jsxs)(X,{type:`submit`,disabled:s,children:[Oe,a.create]}),t[107]=a.create,t[108]=s,t[109]=ke):ke=t[109];let Ae;t[110]!==Ee||t[111]!==ke?(Ae=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ee,ke]}),t[110]=Ee,t[111]=ke,t[112]=Ae):Ae=t[112];let je;t[113]!==x||t[114]!==ne||t[115]!==V||t[116]!==le||t[117]!==fe||t[118]!==_e||t[119]!==Te||t[120]!==Ae||t[121]!==L?(je=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:x,children:[L,ne,V,le,fe,_e,Te,Ae]}),t[113]=x,t[114]=ne,t[115]=V,t[116]=le,t[117]=fe,t[118]=_e,t[119]=Te,t[120]=Ae,t[121]=L,t[122]=je):je=t[122];let Ne;t[123]!==je||t[124]!==I?(Ne=(0,Q.jsxs)(k,{children:[E,(0,Q.jsx)(Fe,{className:D,onOpenAutoFocus:Un,children:(0,Q.jsxs)(qe,{layer:`modal`,children:[I,je]})})]}),t[123]=je,t[124]=I,t[125]=Ne):Ne=t[125];let Pe;return t[126]!==r||t[127]!==n||t[128]!==Ne?(Pe=(0,Q.jsx)(N,{open:n,onOpenChange:r,children:Ne}),t[126]=r,t[127]=n,t[128]=Ne,t[129]=Pe):Pe=t[129],Pe}function Un(e){return e.preventDefault()}var Wn=`~/.xopc/workspace`;function Gn(e){let t=e.trim();return t?`${Wn}/${tt(t)}`:``}function Kn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(H,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)($e,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function qn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Jn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=v(async()=>{if(!t)return null;let[e,n]=await Promise.all([Te(t,`IDENTITY.md`).catch(()=>``),Te(t,`SOUL.md`).catch(()=>``)]),r=st(e);return{identity:r,soulTemplate:he(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?qn(a):null),p=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),m=(0,$.useRef)(t);m.current=t;let h=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?qn(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),y=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=ue.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),b=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),x=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),S=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),C=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([V(e,`IDENTITY.md`,_(f.identity)),V(e,`SOUL.md`,f.soulCustomContent)]),s.current=!1,l(e=>{let t=e??f;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[f]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=C,()=>{r.current=null}},[C,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:y,handleSoulContentChange:b,setAvatarDialogOpen:x,toggleSoulPreviewMode:S}}var Yn={draft:``,editorNonce:0,loadedKey:``};function Xn(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function Zn(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=v(()=>n?le(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(Xn,Yn),[h,g]=(0,$.useState)(!1),[_,y]=(0,$.useState)(`edit`),b=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==b.current&&(b.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let x=p.draft,S=p.editorNonce,C=(0,$.useRef)(x);C.current=x;let w=(0,$.useRef)(n);w.current=n;let T=(0,$.useRef)(d);T.current=d;let E=(0,$.useRef)(null),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(``),A=(0,$.useRef)(()=>{}),j=v(()=>d&&n?Te(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=K(async()=>{let e=w.current,t=T.current;if(!e||!t||`${e}:${t}`!==D.current)return;let n=C.current;if(n!==O.current){g(!0),o(null);try{await V(e,t,n),O.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{g(!1)}}},800);A.current=N.flush,(0,$.useEffect)(()=>()=>{A.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&A.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==k.current&&(A.current(),k.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){m({type:`clear`});return}M||(D.current=F,O.current=j.data,m({type:`load`,key:F,content:j.data}))},[F,M,j.data]);let ee=(0,$.useRef)({activeFile:d,selectedId:n});return(ee.current.activeFile!==d||ee.current.selectedId!==n)&&(ee.current={activeFile:d,selectedId:n},y(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{A.current(),f(e)},[]),fileDraft:x,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(C.current):e}),N()},[N]),fileSaving:h,filesViewMode:_,setFilesViewMode:y,profileFileLoading:M,profileEditorNonce:S,overviewSaveProfileMarkdownRef:E,saveProfileMarkdownDebounced:N}}function Qn(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=v(()=>vt(),[t,n],{enabled:m,initial:[],errorData:[]}),_=h.data,y=h.loading,b=(0,$.useMemo)(()=>y||_.length===0?``:_[0]?.name??``,[_,y]),[x,S]=(0,$.useState)(``),C=(0,$.useRef)(b);t===`connections`&&!y&&b&&C.current!==b&&(!x||!_.some(e=>e.name===x))&&(C.current=b,S(b)),C.current=b;let w=x.trim(),T=m&&w.length>0,E=v(()=>yt(w),[t,n,w],{enabled:T,initial:[],errorData:[]}),D=E.data,O=E.loading,k=E.setData,[A,j]=(0,$.useState)(null),[M,N]=(0,$.useState)(``),P=(0,$.useRef)(w);P.current!==w&&(P.current=w,j(null));let F=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),ee=(0,$.useCallback)(()=>{let e=x.trim();e&&yt(e).then(e=>{k(e),j(t=>t!=null&&t<e.length?t:null)}).catch(()=>{k([]),j(null)})},[x,k]),I=!y&&_.length===0,L=t===`connections`&&n&&i,te=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await g(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:F,allBindings:p,bindChannelStatuses:_,bindChannelsLoading:y,bindSessionChats:D,bindSessionsLoading:O,bindingsLoading:L,newBindChannel:x,setNewBindChannel:S,newBindSessionIdx:A,setNewBindSessionIdx:j,newBindCustomPeer:M,setNewBindCustomPeer:N,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!x.trim())return;let t=xt(x,M,A,D),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await g(n),l.current=!0,d(n),j(null),N(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,D,x,M,A,o,a,s,c]),onRemoveBinding:te,refreshBindSessions:ee,useManualChannel:I}}function $n(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(nr)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:p}=v(tr,s,d),m;n[10]===f?m=n[11]:(m=f.filter(er),n[10]=f,n[11]=m);let h=m,g;return n[12]!==h||n[13]!==f||n[14]!==p?(g={catalogForPick:h,skillCatalog:f,skillsCatalogLoading:p},n[12]=h,n[13]=f,n[14]=p,n[15]=g):g=n[15],g}function er(e){return e.enabled!==!1}function tr(){return pe()}function nr(e){return e+1}function rr(e){return $n(e.panel===`skills`,e.hasToken)}function ir(e){return new Set(e.tools.entryDisable)}function ar(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function or(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(ir(n)),n&&t===`skills`){let e=ar(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Tt(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function sr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function cr(e){let t=Tt(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Tt(e.typedModels.effective)}function lr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function ur(){let e=o(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,l]=(0,$.useState)(null),[u,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),h=t.cron,g=t.chat,_=!!c(e=>e.token),[v,b]=ie(),x=W(),{agentId:S}=ce(),C=ut(e=>e.setPageHeader),w=ut(e=>e.clearPageHeader),{data:T,error:E,isLoading:D,mutate:O}=d(_?`settings-gateway-agents`:null,lt,{revalidateOnFocus:!1}),{data:k,mutate:A}=d(_?`settings-capability-presets`:null,jt,{revalidateOnFocus:!1}),j=Ue(_),{data:M}=j,N=(0,$.useMemo)(()=>ae(M?.payload?.config??{}),[M]),P=T??null,F=(0,$.useMemo)(()=>P?P.agents.find(e=>e.id===P.defaultId)??P.agents[0]??null:null,[P]),ee=!!(_&&D),[I,L]=(0,$.useState)(null),te=E instanceof Error?E.message:E?n.loadError:null,ne=I??te,[R,re]=(0,$.useState)(null),[z,B]=(0,$.useState)(`overview`),[V,H]=(0,$.useState)(``),[U,G]=(0,$.useState)(``),[oe,se]=(0,$.useState)(``),[le,K]=(0,$.useState)(``),[ue,q]=(0,$.useState)(``),[de,fe]=(0,$.useState)(null),[pe,me]=(0,$.useState)(!1),he=(0,$.useRef)(``),[ge,ve]=(0,$.useState)(null),[ye,J]=(0,$.useState)(!1),[be,xe]=(0,$.useState)(``),[Ce,we]=(0,$.useState)(``),[Te,Ee]=(0,$.useState)(``),[De,ke]=(0,$.useState)(``),[Ae,je]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),Pe=(0,$.useRef)(null),[Fe,Ie]=(0,$.useState)(!1),Le=(0,$.useRef)({data:null,routeAgentId:void 0});P&&(P!==Le.current.data||S!==Le.current.routeAgentId)&&(Le.current={data:P,routeAgentId:S},S&&P.agents.some(e=>e.id===S)?re(S):re(e=>e&&P.agents.some(t=>t.id===e)?e:P.defaultId)),(0,$.useEffect)(()=>{!P||!S||P.agents.some(e=>e.id===S)||x(Ze,{replace:!0})},[P,S,x]),(0,$.useEffect)(()=>{S&&B(`overview`)},[S]),(0,$.useEffect)(()=>{v.get(`panel`)===`defaults`&&x(S?He(S):Ze,{replace:!0,state:{[Ve]:S?He(S):Ze}})},[v,S,x]),(0,$.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!S||(B(`overview`),ee||!P?.agents.some(e=>e.id===S)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),b(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[v,S,ee,P,b]);let Y=(0,$.useMemo)(()=>P?.agents.find(e=>e.id===R)??null,[P,R]),Re=(0,$.useMemo)(()=>{let e=M?.payload?.config;if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.tui;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaultAgent;return typeof n==`string`?n.trim().toLowerCase():``},[M]),ze=(0,$.useMemo)(()=>!P||Re&&P.agents.some(e=>e.id===Re)?Re:P.defaultId||P.agents[0]?.id||Re,[P,Re]),Be=!!(P&&Re&&!P.agents.some(e=>e.id===Re));(0,$.useEffect)(()=>{we(Be?``:Re)},[Re,Be]);let We=(0,$.useRef)(null),Ke=Y?Y.id:null;Y&&We.current!==Ke?(We.current=Ke,Ee(Y.workspace),ke(Y.model?.primary??``),je(Se(Y,a(e).agentsSettings)),Ne(Y.description??``)):!Y&&We.current!==null&&(We.current=null,Ee(``),ke(``),je(``),Ne(``));let qe=Jn({agentId:Y?.id??null,enabled:z===`behavior`&&!!Y,saveRef:Pe}),Je=Zn({panel:z,selectedId:R,hasToken:_,dataAgentsLength:P?.agents.length,saveErrorMessage:n.saveError,setError:L}),Ye=or({panel:z,selected:Y}),X=Qn({panel:z,hasToken:_,bindingsFromConfig:N,gatewayCfgLoading:M===void 0,selected:Y,saveErrorMessage:n.saveError,setBusy:J,setError:L}),Xe=rr({panel:z,hasToken:_}),Qe=(0,$.useCallback)(()=>{let e=Gn(U.trim()||V);K(t=>t===``||t===he.current?(he.current=e,e):t)},[U,V]),$e=(0,$.useCallback)(()=>{he.current=``,H(``),G(``),se(``),K(``),q(``),fe(null),ve(null),me(!0)},[]),et=(0,$.useCallback)(e=>{let t=new Set(P?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,P]),tt=(0,$.useCallback)(e=>{if(ve(e),!e)return;let t=P?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=et(t.id),o=t.description??``;he.current=``,H(i),G(a),se(o),K(t.workspace),q(t.model?.primary??``),fe(null)},[n.duplicateName,P,et]),nt=(0,$.useCallback)(e=>{tt(e),me(!0)},[tt]),rt=(0,$.useMemo)(()=>(0,Q.jsx)(Kn,{a:n,busy:ye,listSearchQuery:be,onListSearchQueryChange:xe,onAddAgent:()=>$e()}),[n,ye,be,$e]);(0,$.useLayoutEffect)(()=>_?(C({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:rt}),()=>w()):(w(),()=>w()),[n.title,rt,w,_,C]);async function it(t){t.preventDefault();let r=V.trim();if(!r)return;let i=_e(U,r);if(i.ok===!1){fe(i.error);return}let a=le.trim()||Gn(U.trim()||r);if(a){J(!0),fe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${oe.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
-
`),{createdAgentId:n,...i}=await Ge({workspace:a,...U.trim()?{id:U.trim()}:{},...ue.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:ue.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...ge?{cloneFrom:ge}:{}});O(i,{revalidate:!1}),H(``),G(``),se(``),K(``),q(``),fe(null),me(!1),re(n),x(He(n))}catch(e){fe(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function at(){if(Y){J(!0),L(null);try{O(await y(Y.id,{workspace:Te.trim()||void 0,...De.trim()?{models:sr(Y,De.trim())}:{}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function st(e){J(!0),L(null);try{O(await y(e.id,{setDefault:!0}),{revalidate:!1}),re(e.id)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ct(){let e=Ce.trim().toLowerCase();if(e&&!P?.agents.some(t=>t.id===e)){L(n.tuiDefaultAgentInvalid);return}J(!0),L(null);try{await ot(e||null),await j.mutate()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ft(e){J(!0),L(null);try{await ot(e.id),we(e.id),await j.mutate()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function pt(){J(!0),L(null);try{await ot(null),we(``),await j.mutate()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function mt(e,t){J(!0),L(null);try{let n=await Oe(e.id,t);O(n,{revalidate:!1}),re(n.defaultId),B(`overview`),S===e.id&&x(Ze,{replace:!0}),i(!1),l(null),m(``)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}function ht(e,t){e.id!==`main`&&(l(e),f(t),m(``),i(!0))}async function gt(){if(Y){J(!0),L(null);try{O(await y(Y.id,{tools:{builtin:lr(Ye.toolEntryDisable)}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function _t(){if(Y){J(!0),L(null);try{O(await y(Y.id,{tools:null}),{revalidate:!1}),Ye.setToolEntryDisable(new Set)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function vt(){if(!Y)return;let e=wt(Ye.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){L(e);return}J(!0),L(null);try{O(await y(Y.id,{models:{roles:Ot(Ye.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function yt(){if(!Y)return;let e=cr(Y),t=Ot(e);if(!t?.roles?.[Y.typedModels.defaultRole]){L(n.typedModelsInvalidModel);return}J(!0),L(null);try{O(await y(Y.id,{models:{defaultRole:Y.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Ye.setModelRows(e)}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function bt(){if(Y){J(!0),L(null);try{O(await y(Y.id,{skills:Ye.skillsInherit?null:[...Ye.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function xt(e){if(Y){J(!0),L(null);try{O(await y(Y.id,{extends:e}),{revalidate:!1}),A()}catch(e){L(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}let St=z!==`behavior`,Ct=(()=>{if(!Y||z!==`behavior`)return!1;let e=Y.workspace,t=Y.model?.primary??``;return Te.trim()!==e||De.trim()!==t})(),Tt=(()=>{if(St||!Y)return!1;switch(z){case`behavior`:return Ct||qe.dirty;default:return!0}})(),Et=St||!Tt;function Dt(){Ie(!0),setTimeout(()=>Ie(!1),2e3)}async function kt(){switch(z){case`behavior`:await Promise.all([at(),Pe.current?.()??Promise.resolve()]),Dt();break;default:break}}function At(e){e||x(Ze)}let Mt=Y?Ae.trim()||Se(Y,n):S??``,Z=Y?.id??S??``,Nt=(0,$.useCallback)(async()=>{if(Y){await kt(),Je.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(dt,Y.id)}catch{}x(`/chat/new`,{state:{agentId:Y.id,fromAgentEditor:!0}})}},[Y,kt,Je.saveProfileMarkdownDebounced,x]),Pt={a:n,chat:g,cCron:h,selected:Y,panel:z,data:P,busy:ye,editName:Ae,setEditName:je,editDescription:Me,setEditDescription:Ne,editWorkspace:Te,setEditWorkspace:Ee,editModel:De,setEditModel:ke,defaultModel:F?.model?.primary??``,defaultWorkspace:F?.workspace??``,onSetDefault:()=>{Y&&st(Y)},onSetTuiDefault:()=>{Y&&ft(Y)},isTuiDefault:!!(Y&&Y.id===ze),isTuiDefaultInherited:!!(Y&&Y.id===ze&&(!Re||Be)),onSaveAgentEdits:()=>void at(),onDelete:e=>{Y&&ht(Y,e)},onTryInChat:()=>void Nt(),capabilityPresets:k?.presets??[],defaultPresetId:k?.defaultPresetId,onUpdateAgentExtends:e=>void xt(e),onOpenCapabilityPreset:e=>{x(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Pe,overviewProfile:qe,filesLoading:Je.filesLoading,files:Je.files,activeFile:Je.activeFile,setActiveFile:Je.setActiveFile,filesViewMode:Je.filesViewMode,setFilesViewMode:Je.setFilesViewMode,fileDraft:Je.fileDraft,setFileDraft:Je.setFileDraft,fileSaving:Je.fileSaving,profileFileLoading:Je.profileFileLoading,profileEditorNonce:Je.profileEditorNonce,toolEntryDisable:Ye.toolEntryDisable,setToolEntryDisable:Ye.setToolEntryDisable,onSaveTools:()=>void gt(),onClearToolsEntry:()=>void _t(),modelRows:Ye.modelRows,setModelRows:Ye.setModelRows,onSaveModels:()=>void vt(),onClearModelsEntry:()=>void yt(),skillsCatalogLoading:Xe.skillsCatalogLoading,catalogForPick:Xe.catalogForPick,skillsInherit:Ye.skillsInherit,setSkillsInherit:Ye.setSkillsInherit,skillsPick:Ye.skillsPick,setSkillsPick:Ye.setSkillsPick,onSaveSkills:()=>void bt(),bindingsLoading:X.bindingsLoading,agentBindings:X.agentBindings,bindChannelStatuses:X.bindChannelStatuses,bindChannelsLoading:X.bindChannelsLoading,useManualChannel:X.useManualChannel,newBindChannel:X.newBindChannel,setNewBindChannel:X.setNewBindChannel,bindSessionChats:X.bindSessionChats,bindSessionsLoading:X.bindSessionsLoading,newBindSessionIdx:X.newBindSessionIdx,setNewBindSessionIdx:X.setNewBindSessionIdx,newBindCustomPeer:X.newBindCustomPeer,setNewBindCustomPeer:X.setNewBindCustomPeer,refreshBindSessions:X.refreshBindSessions,onRemoveBinding:e=>void X.onRemoveBinding(e),onAddBinding:X.onAddBinding};return{hasToken:_,a:n,chat:g,language:e,data:P,savedTuiDefaultAgentId:Re,effectiveTuiDefaultAgentId:ze,tuiDefaultAgentDraft:Ce,setTuiDefaultAgentDraft:we,tuiDefaultAgentUnavailable:Be,onSaveTuiDefaultAgent:ct,onSetTuiDefaultAgent:ft,onClearTuiDefaultAgent:pt,onSetDefaultAgent:st,loading:ee,displayError:ne,navigate:x,routeAgentId:S,busy:ye,listSearchQuery:be,openAddAgentModal:$e,openDuplicateAgentModal:nt,duplicateSourceId:ge,onSelectDuplicateSource:tt,panel:z,setPanel:B,modalTitle:Mt,modalSubtitle:Z,footerSaveDisabled:Et,savedFlash:Fe,handleModalFooterSave:kt,onAgentModalOpenChange:At,addAgentModalOpen:pe,setAddAgentModalOpen:me,createWorkspaceSuggestedRef:he,createModalError:de,setCreateModalError:fe,createDisplayName:V,setCreateDisplayName:H,createAgentId:U,setCreateAgentId:G,createDescription:oe,setCreateDescription:se,createWorkspace:le,setCreateWorkspace:K,createModel:ue,setCreateModel:q,onCreate:it,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:Qe,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:l,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:mt,editorPanelProps:Pt}}function dr(){let e=ur();return e.hasToken?(0,Q.jsxs)(gt,{gap:`gap-6`,padding:`px-4 py-8`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:e.displayError}):null,e.loading?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Bn,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(He(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(dt,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Lt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):(0,Q.jsx)(Pn,{...e.editorPanelProps})}):null,(0,Q.jsx)(Hn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(Nt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(gt,{gap:`gap-3`,padding:`px-4 py-8`,children:[(0,Q.jsx)(ht,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{dr as AgentsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CISb1HLv.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{r as s}from"./toast-z0toXu32.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{$r as l,Dr as u,Ko as d,Ks as f,Mi as p,Na as m,Ni as h,Oi as g,Pi as _,Qs as v,Ya as y,Z as b,ba as x,c as S,ca as C,co as w,ji as T,ki as E,la as D,qs as O,ro as k,sa as A,to as ee,ts as j,ws as M,zi as N}from"./index-CnjzMw5i.js";import{t as te}from"./format-cron-label-arqgGlVV.js";import{i as P,n as F,o as ne,r as I,t as L}from"./dist-By6Rh2ee.js";import{i as re,n as R,r as ie,t as ae}from"./workflow-run-setup-panel-DVPllR4k.js";var z=n(),B=e(t(),1),V=r(),H={name:``,description:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalMinutes:`60`,cronExpr:`0 9 * * *`,webhookSecretId:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,safetyMode:`suggest_only`,timeoutSeconds:`300`,afterRunMode:`none`,webhookUrl:``,disableAfterFailures:`3`};function U(e){return e===`zh`?`zh-CN`:`en-US`}function oe(e,t,n){return e?new Intl.DateTimeFormat(U(n),{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)):t.never}function se(e,t,n,r){if(e.kind===`manual`)return t.trigger.manual;if(e.kind===`webhook`)return t.trigger.webhook;if(e.kind===`event`)return t.trigger.eventWithType.replace(`{type}`,e.eventType);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,oe(Date.parse(i.at),t,r)):i.kind===`interval`?t.trigger.everyMinutes.replace(`{minutes}`,String(Math.round(i.everyMs/6e4))):te(i.expr,U(r),n.scheduleBadge,{timezone:i.tz})}function ce(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function W(e){return e.safety?.mode??`auto_apply`}function G(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function le(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function K(e){return e.status===`running`||e.status===`queued`}function ue(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function q(e){return K(e)?0:ue(e)?1:e.status===`succeeded`?2:3}function de(e){return[...e].sort((e,t)=>{let n=q(e)-q(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function fe(e){let t=(0,z.c)(5),n;t[0]===e?n=t[1]:(n=()=>typeof window>`u`?!1:window.matchMedia(e).matches,t[0]=e,t[1]=n);let[r,i]=(0,B.useState)(n),a,o;return t[2]===e?(a=t[3],o=t[4]):(a=()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),n=()=>i(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},o=[e],t[2]=e,t[3]=a,t[4]=o),(0,B.useEffect)(a,o),r}function pe(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;o=e.triggerMode===`manual`?{kind:`manual`}:e.triggerMode===`webhook`?{kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}}:e.triggerMode===`goalBlocked`?{kind:`event`,eventType:`goal.status_changed`,source:`goals`,payloadMatch:{status:`blocked`}}:e.triggerMode===`noteCreated`?{kind:`event`,eventType:`note.created`,source:`notes`}:e.triggerMode===`workflowFailed`?{kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}}:e.triggerMode===`sessionUpdated`?{kind:`event`,eventType:`session.transcript.updated`,source:`sessions`}:e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Math.max(1,Number.parseInt(e.intervalMinutes,10)||60)*6e4}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=R(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.safetyMode===`auto_apply`?e.afterRunMode:`none`,u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{},timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300)}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300)};return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},trigger:o,action:u,safety:{mode:e.safetyMode},afterRun:l===`webhook`?{kind:`webhook`,url:e.webhookUrl.trim()}:{kind:l},reliability:{timeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||300),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function J(){let e=o(e=>e.language),t=a(e),n=t.automations,r=t.cron,d=N(e=>e.setPageHeader),f=N(e=>e.clearPageHeader),[m,y]=v(),x=m.get(`run`)?.trim()??``,C=m.get(`draft`)?.trim()??``,w=m.get(`action`)?.trim()??``,O=m.get(`autogenerate`)===`1`,k=(0,B.useRef)(``),j=fe(`(min-width: 1280px)`),[M,te]=(0,B.useState)(`activity`),[re,R]=(0,B.useState)(!1),[ae,z]=(0,B.useState)(`blank`),[U,se]=(0,B.useState)(H),[ce,W]=(0,B.useState)(null),[G,le]=(0,B.useState)(null),[K,q]=(0,B.useState)(!1),[J,he]=(0,B.useState)(null),[X,be]=(0,B.useState)(``),[xe,Z]=(0,B.useState)(null),[Se,we]=(0,B.useState)(!1),[Te,Q]=(0,B.useState)(!1),[$,Ee]=(0,B.useState)(null),[De,Oe]=(0,B.useState)(!1),[ke,Ae]=(0,B.useState)(!1),[je,Me]=(0,B.useState)(!1),[Ne,Pe]=(0,B.useState)(null),Fe=c(`automations`,()=>S.list(),{refreshInterval:15e3}),Ie=c(`automation-runs`,()=>S.runs(50),{refreshInterval:1e4}),Le=c(`automation-metrics`,()=>S.metrics(),{refreshInterval:15e3}),Re=c(G?`automation-run-events:${G}`:null,()=>S.runEvents(G),{refreshInterval:5e3}),ze=c(`automation-workflow-definitions`,b),Be=c(`automation-chat-agents`,l),Ve=Fe.data?.automations??[],He=(0,B.useMemo)(()=>de(Ie.data?.runs??[]),[Ie.data?.runs]),Ue=(0,B.useMemo)(()=>He.find(e=>e.id===G)??null,[He,G]),We=(0,B.useMemo)(()=>Ve.find(e=>e.id===J)??null,[Ve,J]),Ge=(0,B.useMemo)(()=>He.filter(e=>e.automationId===J),[He,J]),Ke=Re.data?.events??[],qe=Le.data,Je=(0,B.useMemo)(()=>He.filter(ue),[He]),Ye=He[0]??null,Xe=(0,B.useMemo)(()=>ze.data??[],[ze.data]),Ze=Be.data?.items??[],Qe=(0,B.useMemo)(()=>Xe.find(e=>e.id===U.workflowId.trim())??null,[U.workflowId,Xe]),$e=U.actionMode===`workflow`&&(!U.workflowId.trim()||Xe.length>0&&!Xe.some(e=>e.id===U.workflowId)),et=U.actionMode===`workflow`&&Qe?!ie(Qe,U.workflowInput,U.workflowInputValid).valid:!1,tt=!!U.name.trim()&&(U.actionMode===`workflow`?!$e&&!et:!!U.instruction.trim())&&(U.afterRunMode!==`webhook`||!!U.webhookUrl.trim()),nt=(0,B.useMemo)(()=>[{name:n.templates.dailyAgent.name,description:n.templates.dailyAgent.description,form:{...H,name:n.templates.dailyAgent.name,instruction:n.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:n.templates.morningWorkflow.name,description:n.templates.morningWorkflow.description,form:{...H,name:n.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:Xe[0]?.id??``}},{name:n.templates.webhookAgent.name,description:n.templates.webhookAgent.description,form:{...H,name:n.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:n.templates.blockedGoal.name,description:n.templates.blockedGoal.description,form:{...H,name:n.templates.blockedGoal.formName,triggerMode:`goalBlocked`,instruction:n.templates.blockedGoal.instruction}},{name:n.templates.noteCreated.name,description:n.templates.noteCreated.description,form:{...H,name:n.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:n.templates.noteCreated.instruction}}],[n,Xe]),rt=(0,B.useCallback)(async()=>{await Promise.all([Fe.mutate(),Ie.mutate(),Le.mutate(),Re.mutate()])},[Fe.mutate,Le.mutate,Re.mutate,Ie.mutate]),it=(0,B.useCallback)(e=>{z(e),R(!0),e===`blank`&&se(H)},[]),at=(0,B.useCallback)(async()=>{Me(!0),W(null);try{await rt()}catch(e){let t=e instanceof Error?e.message:String(e);W(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}finally{Me(!1)}},[n.feedback.actionFailed,rt]);(0,B.useEffect)(()=>{x&&(te(`activity`),le(x),j||q(!0))},[x,j]),(0,B.useEffect)(()=>{j&&q(!1)},[j]),(0,B.useEffect)(()=>{w===`create`&&(it(`blank`),y(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[w,it,y]),(0,B.useEffect)(()=>{if(!C)return;let t=`${e}:${O?`auto`:`seed`}:${C}`;k.current!==t&&(k.current=t,be(C),Z(null),Q(!1),z(`draft`),R(!0),y(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),O&&(W(null),we(!0),S.draft({prompt:C,language:e}).then(e=>{Z(e.draft),Q(!1)}).catch(e=>{W(e instanceof Error?e.message:String(e))}).finally(()=>{we(!1)})))},[O,C,e,y]);let ot=(0,B.useCallback)(e=>{le(e),j||q(!0),y(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[y,j]);(0,B.useEffect)(()=>{Ee(null),Ae(!1)},[G]);async function st(){if(W(null),tt)try{await S.create(pe(U,Qe)),se(H),R(!1),await rt(),s({type:`success`,title:n.dashboard.created})}catch(e){let t=e instanceof Error?e.message:String(e);W(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}}async function ct(e,t,r){W(null),Pe(e);try{return await t(),await rt(),r&&s({type:`success`,title:r}),!0}catch(e){let t=e instanceof Error?e.message:String(e);return W(t),s({type:`error`,title:n.feedback.actionFailed,message:t}),!1}finally{Pe(null)}}async function lt(){let t=X.trim();if(t){W(null),we(!0);try{Z((await S.draft({prompt:t,language:e})).draft),Q(!1)}catch(e){W(e instanceof Error?e.message:String(e))}finally{we(!1)}}}async function ut(){xe&&await ct(`draft:publish`,async()=>{await S.create(xe.automation),Z(null),be(``),Q(!1),R(!1)},n.dashboard.created)}async function dt(t){W(null),Oe(!0),Ee(null),Ae(!1);try{Ee((await S.repairDraft(t.id,{language:e})).repair)}catch(e){W(e instanceof Error?e.message:String(e))}finally{Oe(!1)}}async function ft(e){$&&await ct(`run:${e.id}:repair`,async()=>{await S.update(e.automationId,$.patch),Ee(null),Ae(!1)},n.feedback.repairApplied)}let pt=(0,B.useMemo)(()=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(u,{className:`size-9 shrink-0 p-0`,loading:je,label:n.refresh,onClick:at}),(0,V.jsxs)(P,{children:[(0,V.jsx)(ne,{asChild:!0,children:(0,V.jsxs)(A,{variant:`primary`,children:[(0,V.jsx)(ee,{className:`size-4`}),n.new]})}),(0,V.jsx)(I,{children:(0,V.jsxs)(L,{align:`end`,className:`z-70 min-w-52 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>it(`draft`),children:n.createMenu.draft}),(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>it(`template`),children:n.createMenu.template}),(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>it(`blank`),children:n.createMenu.blank})]})})]})]}),[n.createMenu.blank,n.createMenu.draft,n.createMenu.template,n.new,n.refresh,it,je,at]);return(0,B.useLayoutEffect)(()=>(d({startExtra:null,main:(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,V.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:pt}),()=>f()),[f,pt,n.subtitle,n.title,d]),(0,V.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,V.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-5 px-4 py-6`,children:[(0,V.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,V.jsx)(Y,{label:n.dashboard.needsAttention,value:qe?.failedLastHour??Je.length,tone:Je.length>0?`danger`:`neutral`}),(0,V.jsx)(Y,{label:n.metrics.running,value:qe?.runningRuns??He.filter(e=>e.status===`running`).length}),(0,V.jsx)(Y,{label:n.dashboard.latestResult,value:Ye?n.status[Ye.status]:n.none,tone:Ye&&ue(Ye)?`danger`:`neutral`}),(0,V.jsx)(Y,{label:n.metrics.next,value:qe?.nextRun?oe(qe.nextRun.runAtMs,n,e):n.none})]}),(0,V.jsx)(`nav`,{className:`inline-flex w-fit rounded-lg border border-edge bg-surface-panel p-1`,children:[{id:`activity`,label:n.dashboard.activity,count:He.length},{id:`automations`,label:n.dashboard.manage,count:Ve.length}].map(e=>(0,V.jsxs)(`button`,{className:i(`inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted`,M===e.id&&`bg-surface-hover text-fg`),onClick:()=>{te(e.id),e.id!==`activity`&&q(!1)},children:[(0,V.jsx)(`span`,{children:e.label}),(0,V.jsx)(`span`,{className:`rounded-full border border-edge/70 px-1.5 py-0.5 text-[0.6875rem] leading-none text-fg-muted`,children:e.count})]},e.id))}),ce?(0,V.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:ce}):null,M===`activity`?(0,V.jsxs)(`section`,{className:`grid h-[min(42rem,calc(100vh-17rem))] min-h-[28rem] items-stretch gap-4 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[(0,V.jsx)(`div`,{className:`min-h-0 min-w-0`,children:(0,V.jsx)(_e,{runs:He.slice(0,12),labels:n,cronLabels:r,language:e,selectedRunId:G,busyAction:Ne,className:`h-full overflow-y-auto`,onSelectRun:ot,onAction:ct})}),(0,V.jsx)(ve,{className:`hidden h-full xl:block`,run:Ue,events:Ke,labels:n,cronLabels:r,language:e,loading:Re.isLoading,repairDraft:$,repairLoading:De,repairApproved:ke,busyAction:Ne,onRepairApprovedChange:Ae,onSuggestRepair:dt,onApplyRepair:ft})]}):(0,V.jsx)(`section`,{children:(0,V.jsx)(ge,{automations:Ve,runs:He,labels:n,cronLabels:r,language:e,busyAction:Ne,onOpenDetails:he,onAction:ct})})]}),(0,V.jsx)(h,{open:re,onOpenChange:R,children:(0,V.jsxs)(p,{children:[(0,V.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,V.jsxs)(E,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,V.jsx)(_,{className:`text-base font-semibold text-fg`,children:ae===`draft`?n.draft.title:ae===`template`?n.createMenu.templatesTitle:n.createTitle}),(0,V.jsx)(g,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,"aria-label":n.close,children:(0,V.jsx)(D,{className:`size-4`})})})]}),ae===`draft`?(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,V.jsx)(me,{labels:n,prompt:X,draft:xe,loading:Se,approved:Te,publishBusy:Ne===`draft:publish`,onPromptChange:be,onGenerate:lt,onPublish:ut,onApprovedChange:Q,onDiscard:()=>{Z(null),Q(!1)}})}):ae===`template`?(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,V.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:nt.map(e=>(0,V.jsxs)(`button`,{className:`rounded-lg border border-edge bg-surface-base p-4 text-left hover:bg-surface-hover`,onClick:()=>{se(e.form),z(`blank`)},children:[(0,V.jsx)(`div`,{className:`font-medium text-fg`,children:e.name}),(0,V.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:e.description})]},e.name))})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ce,{form:U,labels:n,setForm:se,workflowDefinitions:Xe,selectedWorkflow:Qe,workflowsLoading:ze.isLoading,agentOptions:Ze,agentsLoading:Be.isLoading,language:e}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,V.jsx)(g,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,children:n.cancel})}),(0,V.jsx)(A,{variant:`primary`,onClick:st,disabled:!tt,children:n.create})]})]})]})]})}),(0,V.jsx)(ye,{automation:We,runs:Ge,labels:n,cronLabels:r,language:e,busyAction:Ne,onClose:()=>he(null),onSelectRun:e=>{ot(e),he(null)},onAction:ct}),(0,V.jsx)(h,{open:!j&&K&&!!Ue,onOpenChange:q,children:(0,V.jsxs)(p,{children:[(0,V.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,V.jsxs)(E,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,V.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:Ue?.automationName??n.dashboard.result}),(0,V.jsx)(g,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,"aria-label":n.close,children:(0,V.jsx)(D,{className:`size-4`})})})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(ve,{className:`h-full rounded-none border-0`,run:Ue,events:Ke,labels:n,cronLabels:r,language:e,loading:Re.isLoading,repairDraft:$,repairLoading:De,repairApproved:ke,busyAction:Ne,onRepairApprovedChange:Ae,onSuggestRepair:dt,onApplyRepair:ft})})]})]})})]})}function Y(e){let t=(0,z.c)(13),{label:n,value:r,tone:a}=e,o=a===void 0?`neutral`:a,s=o===`danger`?`border-red-500/30`:`border-edge`,c;t[0]===s?c=t[1]:(c=i(`rounded-lg border bg-surface-panel px-4 py-3`,s),t[0]=s,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,V.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[2]=n,t[3]=l);let u=o===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,d;t[4]===u?d=t[5]:(d=i(`mt-1 truncate text-lg font-semibold`,u),t[4]=u,t[5]=d);let f;t[6]!==d||t[7]!==r?(f=(0,V.jsx)(`div`,{className:d,children:r}),t[6]=d,t[7]=r,t[8]=f):f=t[8];let p;return t[9]!==c||t[10]!==l||t[11]!==f?(p=(0,V.jsxs)(`div`,{className:c,children:[l,f]}),t[9]=c,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function me(e){let t=(0,z.c)(47),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,onPromptChange:c,onGenerate:l,onPublish:u,onApprovedChange:d,onDiscard:f}=e,p=s===void 0?!1:s,h=!!(i&&i.simulation.requiredConfirmations.length>0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,V.jsx)(m,{className:`size-4 text-accent`}),t[0]=g):g=t[0];let _;t[1]===n.draft.title?_=t[2]:(_=(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[g,n.draft.title]}),t[1]=n.draft.title,t[2]=_);let v;t[3]===n.draft.subtitle?v=t[4]:(v=(0,V.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=v);let y;t[5]!==_||t[6]!==v?(y=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[_,v]}),t[5]=_,t[6]=v,t[7]=y):y=t[7];let b;t[8]!==a||t[9]!==r?(b=a||!r.trim(),t[8]=a,t[9]=r,t[10]=b):b=t[10];let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,V.jsx)(m,{className:`size-4`}),t[11]=x):x=t[11];let S=a?n.draft.generating:n.draft.generate,C;t[12]!==l||t[13]!==b||t[14]!==S?(C=(0,V.jsxs)(A,{variant:`primary`,onClick:l,disabled:b,children:[x,S]}),t[12]=l,t[13]=b,t[14]=S,t[15]=C):C=t[15];let w;t[16]!==y||t[17]!==C?(w=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[y,C]}),t[16]=y,t[17]=C,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=e=>c(e.target.value),t[19]=c,t[20]=T);let E;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==T?(E=(0,V.jsx)(`textarea`,{className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:T,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==o||t[26]!==i||t[27]!==n.draft.approval||t[28]!==n.draft.assumptions||t[29]!==n.draft.discard||t[30]!==n.draft.publish||t[31]!==n.draft.review||t[32]!==n.draft.risks||t[33]!==n.draft.safety||t[34]!==n.feedback||t[35]!==n.info||t[36]!==n.none||t[37]!==d||t[38]!==f||t[39]!==u||t[40]!==p||t[41]!==h?(D=i?(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,V.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,V.jsx)(Z,{label:n.info.when,value:i.simulation.triggerSummary}),(0,V.jsx)(Z,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,V.jsx)(he,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,V.jsx)(he,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,V.jsx)(he,{title:n.draft.risks,items:i.risks,empty:n.none}),h?(0,V.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,V.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>d(e.target.checked)}),(0,V.jsx)(`span`,{children:n.draft.approval})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,V.jsx)(A,{variant:`ghost`,onClick:f,children:n.draft.discard}),(0,V.jsx)(A,{variant:`primary`,onClick:u,disabled:p||h&&!o,children:p?n.feedback.working:n.draft.publish})]})]})]}):null,t[25]=o,t[26]=i,t[27]=n.draft.approval,t[28]=n.draft.assumptions,t[29]=n.draft.discard,t[30]=n.draft.publish,t[31]=n.draft.review,t[32]=n.draft.risks,t[33]=n.draft.safety,t[34]=n.feedback,t[35]=n.info,t[36]=n.none,t[37]=d,t[38]=f,t[39]=u,t[40]=p,t[41]=h,t[42]=D):D=t[42];let O;return t[43]!==w||t[44]!==E||t[45]!==D?(O=(0,V.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-panel p-4`,children:[w,E,D]}),t[43]=w,t[44]=E,t[45]=D,t[46]=O):O=t[46],O}function he(e){let t=(0,z.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(X):(0,V.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,V.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,V.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function X(e){return(0,V.jsxs)(`li`,{children:[`- `,e]},e)}function ge(e){let t=(0,z.c)(22),{automations:n,runs:r,labels:a,cronLabels:o,language:s,busyAction:c,onOpenDetails:l,onAction:u}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(C,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===a.empty.automations?n=t[2]:(n=(0,V.jsx)(Se,{icon:e,title:a.empty.automations}),t[1]=a.empty.automations,t[2]=n),n}let d;if(t[3]!==n||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==s||t[8]!==u||t[9]!==l||t[10]!==r){let e;t[12]!==c||t[13]!==o||t[14]!==a||t[15]!==s||t[16]!==u||t[17]!==l||t[18]!==r?(e=e=>{let t=r.filter(t=>t.automationId===e.id),n=t.find(K),d=t[0],f=c===`automation:${e.id}:run`,p=c===`automation:${e.id}:toggle`,m=c===`automation:${e.id}:delete`;return(0,V.jsxs)(`article`,{className:`flex min-h-44 cursor-pointer flex-col rounded-lg border border-edge bg-surface-panel p-3.5 outline-none hover:bg-surface-hover`,role:`button`,tabIndex:0,onClick:()=>l(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&l(e.id)},children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.name}),n?(0,V.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`}):null]}),e.description?(0,V.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null]}),(0,V.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?a.enabled:a.paused})]}),(0,V.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg`,children:[(0,V.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase text-fg-muted`,children:a.info.when}),(0,V.jsx)(`span`,{className:`truncate`,children:se(e.trigger,a,o,s)})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg-muted`,children:[(0,V.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase`,children:a.info.run}),(0,V.jsx)(`span`,{className:`truncate`,children:ce(e.action,a)})]})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,V.jsxs)(`span`,{children:[a.last,`: `,oe(e.state.lastRunAtMs,a,s)]}),(0,V.jsxs)(`span`,{children:[a.next,`: `,oe(e.state.nextRunAtMs,a,s)]}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5`,G(e.state.lastRunStatus)),children:e.state.lastRunStatus?a.status[e.state.lastRunStatus]:a.status.notRun}),d?.error?(0,V.jsx)(`p`,{className:`basis-full line-clamp-1 text-red-700 dark:text-red-300`,children:d.error}):null]}),(0,V.jsx)(`div`,{className:`mt-auto flex justify-end pt-3`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(A,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":a.dashboard.runNow,disabled:c!==null,onClick:t=>{t.stopPropagation(),u(`automation:${e.id}:run`,()=>S.runNow(e.id),a.feedback.rerunQueued)},children:(0,V.jsx)(k,{className:i(`size-4`,f&&`animate-pulse`)})}),(0,V.jsx)(A,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":e.enabled?a.dashboard.pause:a.dashboard.resume,disabled:c!==null,onClick:t=>{t.stopPropagation(),u(`automation:${e.id}:toggle`,()=>e.enabled?S.pause(e.id):S.resume(e.id),e.enabled?a.feedback.paused:a.dashboard.resumed)},children:p?(0,V.jsx)(y,{className:`size-4 animate-spin`}):e.enabled?(0,V.jsx)(w,{className:`size-4`}):(0,V.jsx)(k,{className:`size-4`})}),(0,V.jsx)(A,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":a.dashboard.delete,disabled:c!==null,onClick:t=>{t.stopPropagation(),u(`automation:${e.id}:delete`,()=>S.remove(e.id),a.dashboard.deleted)},children:m?(0,V.jsx)(y,{className:`size-4 animate-spin`}):(0,V.jsx)(x,{className:`size-4`})})]})})]},e.id)},t[12]=c,t[13]=o,t[14]=a,t[15]=s,t[16]=u,t[17]=l,t[18]=r,t[19]=e):e=t[19],d=n.map(e),t[3]=n,t[4]=c,t[5]=o,t[6]=a,t[7]=s,t[8]=u,t[9]=l,t[10]=r,t[11]=d}else d=t[11];let f;return t[20]===d?f=t[21]:(f=(0,V.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:d}),t[20]=d,t[21]=f),f}function _e(e){let t=(0,z.c)(25),{runs:n,labels:r,cronLabels:a,language:o,selectedRunId:s,busyAction:c,className:l,onSelectRun:u,onAction:d}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(f,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===r.empty.runs?n=t[2]:(n=(0,V.jsx)(Se,{icon:e,title:r.empty.runs}),t[1]=r.empty.runs,t[2]=n),n}let p;t[3]===l?p=t[4]:(p=i(`rounded-lg border border-edge bg-surface-panel`,l),t[3]=l,t[4]=p);let m;if(t[5]!==c||t[6]!==a||t[7]!==r||t[8]!==o||t[9]!==d||t[10]!==u||t[11]!==n||t[12]!==s){let e;t[14]!==c||t[15]!==a||t[16]!==r||t[17]!==o||t[18]!==d||t[19]!==u||t[20]!==s?(e=e=>(0,V.jsxs)(`div`,{className:i(`grid cursor-pointer gap-3 border-b border-edge p-4 outline-none last:border-b-0 hover:bg-surface-hover md:grid-cols-[1fr_auto]`,s===e.id&&`bg-surface-hover`),role:`button`,tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&u(e.id)},children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`font-medium text-fg`,children:e.automationName}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,G(e.status)),children:r.status[e.status]}),e.workflowRunId?(0,V.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[r.workflowPrefix,` `,e.workflowRunId.slice(0,8)]}):null]}),(0,V.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:e.error||e.summary||ce(e.actionSnapshot,r)}),(0,V.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[oe(e.createdAtMs,r,o),` · `,e.manual?r.trigger.manual:se(e.triggerSnapshot,r,a,o)]})]}),e.status===`running`||e.status===`queued`?(0,V.jsx)(A,{variant:`ghost`,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`run:${e.id}:cancel`,()=>S.cancelRun(e.id),r.dashboard.cancelled)},children:c===`run:${e.id}:cancel`?r.feedback.working:r.cancel}):null]},e.id),t[14]=c,t[15]=a,t[16]=r,t[17]=o,t[18]=d,t[19]=u,t[20]=s,t[21]=e):e=t[21],m=n.map(e),t[5]=c,t[6]=a,t[7]=r,t[8]=o,t[9]=d,t[10]=u,t[11]=n,t[12]=s,t[13]=m}else m=t[13];let h;return t[22]!==p||t[23]!==m?(h=(0,V.jsx)(`div`,{className:p,children:m}),t[22]=p,t[23]=m,t[24]=h):h=t[24],h}function ve(e){let t=(0,z.c)(127),{className:n,run:r,events:a,labels:o,cronLabels:s,language:c,loading:l,repairDraft:u,repairLoading:p,repairApproved:h,busyAction:g,onRepairApprovedChange:_,onSuggestRepair:v,onApplyRepair:y}=e;if(!r){let e;t[0]===n?e=t[1]:(e=i(`flex min-h-64 flex-col justify-center rounded-lg border border-edge bg-surface-panel px-4 text-center text-sm text-fg-muted`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(f,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let a;t[3]===o.selectRun?a=t[4]:(a=(0,V.jsx)(`div`,{className:`mt-2`,children:o.selectRun}),t[3]=o.selectRun,t[4]=a);let s;return t[5]!==e||t[6]!==a?(s=(0,V.jsxs)(`aside`,{className:e,children:[r,a]}),t[5]=e,t[6]=a,t[7]=s):s=t[7],s}let b;t[8]===n?b=t[9]:(b=i(`min-h-0 overflow-y-auto rounded-lg border border-edge bg-surface-panel`,n),t[8]=n,t[9]=b);let x;t[10]===r.automationName?x=t[11]:(x=(0,V.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=x);let S;t[12]===r.id?S=t[13]:(S=r.id.slice(0,8),t[12]=r.id,t[13]=S);let C;t[14]===S?C=t[15]:(C=(0,V.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:S}),t[14]=S,t[15]=C);let w;t[16]!==x||t[17]!==C?(w=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[x,C]}),t[16]=x,t[17]=C,t[18]=w):w=t[18];let T;t[19]===r.status?T=t[20]:(T=i(`shrink-0 rounded-full px-2 py-0.5 text-xs`,G(r.status)),t[19]=r.status,t[20]=T);let E=o.status[r.status],D;t[21]!==T||t[22]!==E?(D=(0,V.jsx)(`span`,{className:T,children:E}),t[21]=T,t[22]=E,t[23]=D):D=t[23];let k;t[24]!==w||t[25]!==D?(k=(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[w,D]}),t[24]=w,t[25]=D,t[26]=k):k=t[26];let ee=o.details.created,M;t[27]!==o||t[28]!==c||t[29]!==r.createdAtMs?(M=oe(r.createdAtMs,o,c),t[27]=o,t[28]=c,t[29]=r.createdAtMs,t[30]=M):M=t[30];let N;t[31]!==o.details.created||t[32]!==M?(N=(0,V.jsx)(be,{label:ee,value:M}),t[31]=o.details.created,t[32]=M,t[33]=N):N=t[33];let te=o.details.started,P;t[34]!==o||t[35]!==c||t[36]!==r.startedAtMs?(P=oe(r.startedAtMs,o,c),t[34]=o,t[35]=c,t[36]=r.startedAtMs,t[37]=P):P=t[37];let F;t[38]!==o.details.started||t[39]!==P?(F=(0,V.jsx)(be,{label:te,value:P}),t[38]=o.details.started,t[39]=P,t[40]=F):F=t[40];let ne=o.details.duration,I;t[41]!==o||t[42]!==r.durationMs?(I=le(r.durationMs,o),t[41]=o,t[42]=r.durationMs,t[43]=I):I=t[43];let L;t[44]!==o.details.duration||t[45]!==I?(L=(0,V.jsx)(be,{label:ne,value:I}),t[44]=o.details.duration,t[45]=I,t[46]=L):L=t[46];let re;t[47]!==o.details.model||t[48]!==r.model?(re=r.model?(0,V.jsx)(be,{label:o.details.model,value:r.model}):null,t[47]=o.details.model,t[48]=r.model,t[49]=re):re=t[49];let R;t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==re?(R=(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[N,F,L,re]}),t[50]=N,t[51]=F,t[52]=L,t[53]=re,t[54]=R):R=t[54];let ie;t[55]===o.dashboard.result?ie=t[56]:(ie=(0,V.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.dashboard.result}),t[55]=o.dashboard.result,t[56]=ie);let ae;t[57]===r?ae=t[58]:(ae=ue(r)?`text-red-700 dark:text-red-300`:`text-fg`,t[57]=r,t[58]=ae);let B;t[59]===ae?B=t[60]:(B=i(`mt-1 break-words text-sm`,ae),t[59]=ae,t[60]=B);let H;t[61]!==o||t[62]!==r.actionSnapshot||t[63]!==r.error||t[64]!==r.summary?(H=r.error||r.summary||ce(r.actionSnapshot,o),t[61]=o,t[62]=r.actionSnapshot,t[63]=r.error,t[64]=r.summary,t[65]=H):H=t[65];let U;t[66]!==B||t[67]!==H?(U=(0,V.jsx)(`p`,{className:B,children:H}),t[66]=B,t[67]=H,t[68]=U):U=t[68];let W;t[69]!==s||t[70]!==o||t[71]!==c||t[72]!==r.manual||t[73]!==r.triggerSnapshot?(W=r.manual?o.trigger.manual:se(r.triggerSnapshot,o,s,c),t[69]=s,t[70]=o,t[71]=c,t[72]=r.manual,t[73]=r.triggerSnapshot,t[74]=W):W=t[74];let K;t[75]!==o.explain.whyRan||t[76]!==W?(K=(0,V.jsx)(be,{label:o.explain.whyRan,value:W}),t[75]=o.explain.whyRan,t[76]=W,t[77]=K):K=t[77];let q;t[78]!==o.dashboard.openSession||t[79]!==r.sessionKey?(q=r.sessionKey?(0,V.jsx)(A,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,V.jsxs)(O,{to:`/chat/${encodeURIComponent(r.sessionKey)}`,children:[(0,V.jsx)(j,{className:`size-3.5`}),o.dashboard.openSession]})}):null,t[78]=o.dashboard.openSession,t[79]=r.sessionKey,t[80]=q):q=t[80];let de;t[81]!==o.feedback||t[82]!==r.workflowRunId?(de=r.workflowRunId?(0,V.jsx)(A,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,V.jsxs)(O,{to:`/workflows?run=${encodeURIComponent(r.workflowRunId)}`,children:[(0,V.jsx)(d,{className:`size-3.5`}),o.feedback.workflow]})}):null,t[81]=o.feedback,t[82]=r.workflowRunId,t[83]=de):de=t[83];let fe;t[84]!==K||t[85]!==q||t[86]!==de?(fe=(0,V.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[K,q,de]}),t[84]=K,t[85]=q,t[86]=de,t[87]=fe):fe=t[87];let pe;t[88]!==ie||t[89]!==U||t[90]!==fe?(pe=(0,V.jsxs)(`div`,{className:`mt-3 rounded-md border border-edge/70 bg-surface-base/50 p-3`,children:[ie,U,fe]}),t[88]=ie,t[89]=U,t[90]=fe,t[91]=pe):pe=t[91];let J;t[92]!==o.repair||t[93]!==v||t[94]!==p||t[95]!==r?(J=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,V.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,V.jsxs)(A,{variant:`secondary`,onClick:()=>v(r),disabled:p,children:[(0,V.jsx)(m,{className:`size-4`}),p?o.repair.generating:o.repair.suggest]})}):null,t[92]=o.repair,t[93]=v,t[94]=p,t[95]=r,t[96]=J):J=t[96];let Y;t[97]!==R||t[98]!==pe||t[99]!==J||t[100]!==k?(Y=(0,V.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[k,R,pe,J]}),t[97]=R,t[98]=pe,t[99]=J,t[100]=k,t[101]=Y):Y=t[101];let me;t[102]!==g||t[103]!==o.feedback||t[104]!==o.none||t[105]!==o.repair||t[106]!==y||t[107]!==_||t[108]!==h||t[109]!==u||t[110]!==r?(me=u?(0,V.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,V.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:u.explanation}),u.expectedEffect?(0,V.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:u.expectedEffect}):null,(0,V.jsx)(he,{title:o.repair.risks,items:u.risks,empty:o.none}),(0,V.jsx)(`pre`,{className:`mt-3 max-h-36 overflow-auto rounded-md bg-surface-base p-2 text-xs text-fg-muted`,children:JSON.stringify(u.patch,null,2)}),u.requiresApproval?(0,V.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,V.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:h,onChange:e=>_(e.target.checked)}),(0,V.jsx)(`span`,{children:o.repair.approval})]}):null,(0,V.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,V.jsx)(A,{variant:`primary`,onClick:()=>y(r),disabled:g===`run:${r.id}:repair`||u.requiresApproval&&!h,children:g===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[102]=g,t[103]=o.feedback,t[104]=o.none,t[105]=o.repair,t[106]=y,t[107]=_,t[108]=h,t[109]=u,t[110]=r,t[111]=me):me=t[111];let X;t[112]===o.timeline?X=t[113]:(X=(0,V.jsx)(`div`,{className:`mb-3 text-xs font-semibold uppercase text-fg-muted`,children:o.timeline}),t[112]=o.timeline,t[113]=X);let ge;t[114]!==a||t[115]!==o||t[116]!==c||t[117]!==l?(ge=l?(0,V.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.loading}):a.length===0?(0,V.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,V.jsx)(`ol`,{className:`space-y-3`,children:a.map(e=>(0,V.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,V.jsx)(`span`,{className:i(`mt-1 size-2 rounded-full`,xe(e.type))}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm text-fg`,children:e.message}),(0,V.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[oe(e.createdAtMs,o,c),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,V.jsx)(`pre`,{className:`mt-2 max-h-28 overflow-auto rounded-md bg-surface-base p-2 text-xs text-fg-muted`,children:JSON.stringify(e.data,null,2)}):null]})]},e.id))}),t[114]=a,t[115]=o,t[116]=c,t[117]=l,t[118]=ge):ge=t[118];let _e;t[119]!==X||t[120]!==ge?(_e=(0,V.jsxs)(`div`,{className:`px-4 py-3`,children:[X,ge]}),t[119]=X,t[120]=ge,t[121]=_e):_e=t[121];let ve;return t[122]!==b||t[123]!==Y||t[124]!==me||t[125]!==_e?(ve=(0,V.jsxs)(`aside`,{className:b,children:[Y,me,_e]}),t[122]=b,t[123]=Y,t[124]=me,t[125]=_e,t[126]=ve):ve=t[126],ve}function ye(e){let t=(0,z.c)(25),{automation:n,runs:r,labels:a,cronLabels:o,language:s,busyAction:c,onClose:l,onSelectRun:u,onAction:m}=e,v;t[0]===n?v=t[1]:(v=n?W(n):`suggest_only`,t[0]=n,t[1]=v);let b=v,C=n?c===`automation:${n.id}:run`:!1,ee=n?c===`automation:${n.id}:toggle`:!1,N=n?c===`automation:${n.id}:delete`:!1,te=!!n,P;t[2]===l?P=t[3]:(P=e=>!e&&l(),t[2]=l,t[3]=P);let F;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,V.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[4]=F):F=t[4];let ne;t[5]!==n||t[6]!==c||t[7]!==o||t[8]!==N||t[9]!==a||t[10]!==s||t[11]!==b||t[12]!==m||t[13]!==l||t[14]!==u||t[15]!==C||t[16]!==r||t[17]!==ee?(ne=n?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:n.name}),n.description?(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:n.description}):null]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:n.enabled?a.enabled:a.paused}),(0,V.jsx)(g,{asChild:!0,children:(0,V.jsx)(A,{variant:`ghost`,"aria-label":a.close,children:(0,V.jsx)(D,{className:`size-4`})})})]})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,V.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[18rem_1fr]`,children:[(0,V.jsxs)(`aside`,{className:`grid h-fit gap-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,V.jsx)(Z,{label:a.info.when,value:se(n.trigger,a,o,s)}),(0,V.jsx)(Z,{label:a.info.run,value:ce(n.action,a)}),(0,V.jsx)(Z,{label:a.info.safety,value:a.safety[b]}),(0,V.jsx)(be,{label:a.last,value:oe(n.state.lastRunAtMs,a,s)}),(0,V.jsx)(be,{label:a.next,value:oe(n.state.nextRunAtMs,a,s)}),n.state.consecutiveFailures?(0,V.jsx)(be,{label:a.dashboard.failures,value:String(n.state.consecutiveFailures)}):null,n.state.lastError?(0,V.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null]}),(0,V.jsxs)(`section`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.dashboard.runHistory}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.dashboard.runHistoryDescription})]}),(0,V.jsx)(`span`,{className:`rounded-full border border-edge bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length})]}),r.length===0?(0,V.jsx)(Se,{icon:(0,V.jsx)(f,{className:`size-5`}),title:a.empty.runs}):(0,V.jsx)(`div`,{className:`grid gap-2`,children:r.map(e=>(0,V.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsxs)(`button`,{className:`min-w-0 text-left outline-none`,onClick:()=>u(e.id),children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,V.jsx)(M,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,V.jsx)(f,{className:`size-4 shrink-0 text-fg-muted`}),(0,V.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:oe(e.createdAtMs,a,s)}),(0,V.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,G(e.status)),children:a.status[e.status]})]}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.error||e.summary||ce(e.actionSnapshot,a)})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[e.sessionKey?(0,V.jsx)(A,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,V.jsxs)(O,{to:`/chat/${encodeURIComponent(e.sessionKey)}`,children:[(0,V.jsx)(j,{className:`size-3.5`}),a.dashboard.openSession]})}):null,e.workflowRunId?(0,V.jsx)(A,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,V.jsxs)(O,{to:`/workflows?run=${encodeURIComponent(e.workflowRunId)}`,children:[(0,V.jsx)(d,{className:`size-3.5`}),a.feedback.workflow]})}):null]})]})},e.id))})]})]})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2 border-t border-edge px-5 py-4`,children:[(0,V.jsxs)(A,{variant:`ghost`,disabled:c!==null,onClick:()=>void m(`automation:${n.id}:delete`,()=>S.remove(n.id),a.dashboard.deleted).then(e=>{e&&l()}),children:[N?(0,V.jsx)(y,{className:`size-4 animate-spin`}):(0,V.jsx)(x,{className:`size-4`}),a.dashboard.delete]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(A,{variant:`secondary`,disabled:c!==null,onClick:()=>void m(`automation:${n.id}:toggle`,()=>n.enabled?S.pause(n.id):S.resume(n.id),n.enabled?a.feedback.paused:a.dashboard.resumed),children:[ee?(0,V.jsx)(y,{className:`size-4 animate-spin`}):n.enabled?(0,V.jsx)(w,{className:`size-4`}):(0,V.jsx)(k,{className:`size-4`}),n.enabled?a.dashboard.pause:a.dashboard.resume]}),(0,V.jsxs)(A,{variant:`primary`,disabled:c!==null,onClick:()=>void m(`automation:${n.id}:run`,()=>S.runNow(n.id),a.feedback.rerunQueued),children:[C?(0,V.jsx)(y,{className:`size-4 animate-spin`}):(0,V.jsx)(k,{className:`size-4`}),a.dashboard.runNow]})]})]})]}):null,t[5]=n,t[6]=c,t[7]=o,t[8]=N,t[9]=a,t[10]=s,t[11]=b,t[12]=m,t[13]=l,t[14]=u,t[15]=C,t[16]=r,t[17]=ee,t[18]=ne):ne=t[18];let I;t[19]===ne?I=t[20]:(I=(0,V.jsxs)(p,{children:[F,(0,V.jsx)(E,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,56rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:ne})]}),t[19]=ne,t[20]=I);let L;return t[21]!==te||t[22]!==P||t[23]!==I?(L=(0,V.jsx)(h,{open:te,onOpenChange:P,children:I}),t[21]=te,t[22]=P,t[23]=I,t[24]=L):L=t[24],L}function be(e){let t=(0,z.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,V.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,V.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,V.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function xe(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Z(e){let t=(0,z.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,V.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,V.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Se(e){let t=(0,z.c)(5),{icon:n,title:r}=e,i;t[0]===r?i=t[1]:(i=(0,V.jsx)(`div`,{className:`mt-2 text-sm`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,V.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge bg-surface-panel text-fg-muted`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Ce(e){let t=(0,z.c)(218),{form:n,labels:r,setForm:a,workflowDefinitions:o,selectedWorkflow:s,workflowsLoading:c,agentOptions:l,agentsLoading:u,language:d}=e,f;t[0]===a?f=t[1]:(f=e=>a(t=>({...t,...e})),t[0]=a,t[1]=f);let p=f,m,h;t[2]!==n.actionMode||t[3]!==n.workflowId||t[4]!==a||t[5]!==o?(m=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=o[0]?.id;e&&a(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},h=[n.actionMode,n.workflowId,a,o],t[2]=n.actionMode,t[3]=n.workflowId,t[4]=a,t[5]=o,t[6]=m,t[7]=h):(m=t[6],h=t[7]),(0,B.useEffect)(m,h);let g;t[8]===p?g=t[9]:(g=e=>p({name:e.target.value}),t[8]=p,t[9]=g);let _;t[10]!==n.name||t[11]!==g?(_=(0,V.jsx)(`input`,{className:Q,value:n.name,onChange:g}),t[10]=n.name,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==r.form.name||t[14]!==_?(v=(0,V.jsx)($,{label:r.form.name,children:_}),t[13]=r.form.name,t[14]=_,t[15]=v):v=t[15];let y;t[16]===p?y=t[17]:(y=e=>p({description:e.target.value}),t[16]=p,t[17]=y);let b;t[18]!==n.description||t[19]!==y?(b=(0,V.jsx)(`input`,{className:Q,value:n.description,onChange:y}),t[18]=n.description,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==r.form.description||t[22]!==b?(x=(0,V.jsx)($,{label:r.form.description,children:b}),t[21]=r.form.description,t[22]=b,t[23]=x):x=t[23];let S;t[24]===r.form.trigger?S=t[25]:(S=(0,V.jsx)(Ee,{title:r.form.trigger}),t[24]=r.form.trigger,t[25]=S);let C;t[26]===p?C=t[27]:(C=e=>p({triggerMode:e.target.value}),t[26]=p,t[27]=C);let w;t[28]===r.trigger.manual?w=t[29]:(w=(0,V.jsx)(`option`,{value:`manual`,children:r.trigger.manual}),t[28]=r.trigger.manual,t[29]=w);let T;t[30]===r.trigger.daily?T=t[31]:(T=(0,V.jsx)(`option`,{value:`daily`,children:r.trigger.daily}),t[30]=r.trigger.daily,t[31]=T);let E;t[32]===r.trigger.weekly?E=t[33]:(E=(0,V.jsx)(`option`,{value:`weekly`,children:r.trigger.weekly}),t[32]=r.trigger.weekly,t[33]=E);let D;t[34]===r.trigger.interval?D=t[35]:(D=(0,V.jsx)(`option`,{value:`interval`,children:r.trigger.interval}),t[34]=r.trigger.interval,t[35]=D);let O;t[36]===r.trigger.customCron?O=t[37]:(O=(0,V.jsx)(`option`,{value:`cron`,children:r.trigger.customCron}),t[36]=r.trigger.customCron,t[37]=O);let k;t[38]===r.trigger.webhook?k=t[39]:(k=(0,V.jsx)(`option`,{value:`webhook`,children:r.trigger.webhook}),t[38]=r.trigger.webhook,t[39]=k);let A;t[40]===r.trigger.goalBlocked?A=t[41]:(A=(0,V.jsx)(`option`,{value:`goalBlocked`,children:r.trigger.goalBlocked}),t[40]=r.trigger.goalBlocked,t[41]=A);let ee;t[42]===r.trigger.noteCreated?ee=t[43]:(ee=(0,V.jsx)(`option`,{value:`noteCreated`,children:r.trigger.noteCreated}),t[42]=r.trigger.noteCreated,t[43]=ee);let j;t[44]===r.trigger.workflowFailed?j=t[45]:(j=(0,V.jsx)(`option`,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[44]=r.trigger.workflowFailed,t[45]=j);let M;t[46]===r.trigger.sessionUpdated?M=t[47]:(M=(0,V.jsx)(`option`,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[46]=r.trigger.sessionUpdated,t[47]=M);let N;t[48]!==n.triggerMode||t[49]!==C||t[50]!==w||t[51]!==T||t[52]!==E||t[53]!==D||t[54]!==O||t[55]!==k||t[56]!==A||t[57]!==ee||t[58]!==j||t[59]!==M?(N=(0,V.jsxs)(`select`,{className:Q,value:n.triggerMode,onChange:C,children:[w,T,E,D,O,k,A,ee,j,M]}),t[48]=n.triggerMode,t[49]=C,t[50]=w,t[51]=T,t[52]=E,t[53]=D,t[54]=O,t[55]=k,t[56]=A,t[57]=ee,t[58]=j,t[59]=M,t[60]=N):N=t[60];let te;t[61]!==n.time||t[62]!==n.triggerMode||t[63]!==n.weekday||t[64]!==r.form.day||t[65]!==r.form.time||t[66]!==r.weekdays||t[67]!==p?(te=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)($,{label:r.form.time,children:(0,V.jsx)(`input`,{className:Q,type:`time`,value:n.time,onChange:e=>p({time:e.target.value})})}),n.triggerMode===`weekly`?(0,V.jsx)($,{label:r.form.day,children:(0,V.jsxs)(`select`,{className:Q,value:n.weekday,onChange:e=>p({weekday:e.target.value}),children:[(0,V.jsx)(`option`,{value:`1`,children:r.weekdays.monday}),(0,V.jsx)(`option`,{value:`2`,children:r.weekdays.tuesday}),(0,V.jsx)(`option`,{value:`3`,children:r.weekdays.wednesday}),(0,V.jsx)(`option`,{value:`4`,children:r.weekdays.thursday}),(0,V.jsx)(`option`,{value:`5`,children:r.weekdays.friday}),(0,V.jsx)(`option`,{value:`6`,children:r.weekdays.saturday}),(0,V.jsx)(`option`,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[61]=n.time,t[62]=n.triggerMode,t[63]=n.weekday,t[64]=r.form.day,t[65]=r.form.time,t[66]=r.weekdays,t[67]=p,t[68]=te):te=t[68];let P;t[69]!==n.intervalMinutes||t[70]!==n.triggerMode||t[71]!==r.form.everyMinutes||t[72]!==p?(P=n.triggerMode===`interval`?(0,V.jsx)($,{label:r.form.everyMinutes,children:(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.intervalMinutes,onChange:e=>p({intervalMinutes:e.target.value})})}):null,t[69]=n.intervalMinutes,t[70]=n.triggerMode,t[71]=r.form.everyMinutes,t[72]=p,t[73]=P):P=t[73];let F;t[74]!==n.cronExpr||t[75]!==n.triggerMode||t[76]!==r.form.expression||t[77]!==p?(F=n.triggerMode===`cron`?(0,V.jsx)($,{label:r.form.expression,children:(0,V.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>p({cronExpr:e.target.value})})}):null,t[74]=n.cronExpr,t[75]=n.triggerMode,t[76]=r.form.expression,t[77]=p,t[78]=F):F=t[78];let ne;t[79]!==n.triggerMode||t[80]!==n.webhookSecretId||t[81]!==r.form.secretId||t[82]!==p?(ne=n.triggerMode===`webhook`?(0,V.jsx)($,{label:r.form.secretId,children:(0,V.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>p({webhookSecretId:e.target.value})})}):null,t[79]=n.triggerMode,t[80]=n.webhookSecretId,t[81]=r.form.secretId,t[82]=p,t[83]=ne):ne=t[83];let I;t[84]===r.form.action?I=t[85]:(I=(0,V.jsx)(Ee,{title:r.form.action}),t[84]=r.form.action,t[85]=I);let L;t[86]!==n.workflowId||t[87]!==p||t[88]!==o?(L=e=>{let t=e.target.value;p({actionMode:t,...t===`workflow`&&!n.workflowId.trim()&&o[0]?{workflowId:o[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[86]=n.workflowId,t[87]=p,t[88]=o,t[89]=L):L=t[89];let R;t[90]===r.action.runAgent?R=t[91]:(R=(0,V.jsx)(`option`,{value:`agent`,children:r.action.runAgent}),t[90]=r.action.runAgent,t[91]=R);let ie;t[92]===r.action.runWorkflow?ie=t[93]:(ie=(0,V.jsx)(`option`,{value:`workflow`,children:r.action.runWorkflow}),t[92]=r.action.runWorkflow,t[93]=ie);let H;t[94]!==n.actionMode||t[95]!==L||t[96]!==R||t[97]!==ie?(H=(0,V.jsxs)(`select`,{className:Q,value:n.actionMode,onChange:L,children:[R,ie]}),t[94]=n.actionMode,t[95]=L,t[96]=R,t[97]=ie,t[98]=H):H=t[98];let U=r.form.agent,oe=n.agentId,se;t[99]===p?se=t[100]:(se=e=>p({agentId:e.target.value}),t[99]=p,t[100]=se);let ce=u?r.form.loadingAgents:r.form.defaultAgent,W;t[101]===ce?W=t[102]:(W=(0,V.jsx)(`option`,{value:``,children:ce}),t[101]=ce,t[102]=W);let G;t[103]===l?G=t[104]:(G=l.map(Te),t[103]=l,t[104]=G);let le;t[105]!==n.agentId||t[106]!==se||t[107]!==W||t[108]!==G?(le=(0,V.jsxs)(`select`,{className:Q,value:oe,onChange:se,children:[W,G]}),t[105]=n.agentId,t[106]=se,t[107]=W,t[108]=G,t[109]=le):le=t[109];let K;t[110]!==r.form.agent||t[111]!==le?(K=(0,V.jsx)($,{label:U,children:le}),t[110]=r.form.agent,t[111]=le,t[112]=K):K=t[112];let ue;t[113]!==n.actionMode||t[114]!==n.agentId||t[115]!==n.description||t[116]!==n.instruction||t[117]!==n.name||t[118]!==n.triggerMode||t[119]!==n.workflowId||t[120]!==n.workflowInput||t[121]!==r.form.instruction||t[122]!==r.form.loadingWorkflows||t[123]!==r.form.noWorkflows||t[124]!==r.form.triggeredRun||t[125]!==r.form.workflow||t[126]!==d||t[127]!==s||t[128]!==p||t[129]!==o||t[130]!==c?(ue=n.actionMode===`agent`?(0,V.jsxs)($,{label:r.form.instruction,children:[(0,V.jsx)(`div`,{className:`flex justify-end`,children:(0,V.jsx)(re,{value:n.instruction,onApply:e=>p({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:d,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,V.jsx)(`textarea`,{className:i(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>p({instruction:e.target.value})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)($,{label:r.form.workflow,children:(0,V.jsxs)(`select`,{className:Q,value:n.workflowId,onChange:e=>p({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:c||o.length===0,children:[c?(0,V.jsx)(`option`,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,V.jsx)(`option`,{value:``,children:r.form.noWorkflows}):null,o.map(we)]})}),s?(0,V.jsx)(ae,{definition:s,language:d,value:n.workflowInput,onChange:e=>p({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>p({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:s.id,workflowTitle:s.title,workflowDescription:s.description}},inputClassName:`rounded-lg`}):null]}),t[113]=n.actionMode,t[114]=n.agentId,t[115]=n.description,t[116]=n.instruction,t[117]=n.name,t[118]=n.triggerMode,t[119]=n.workflowId,t[120]=n.workflowInput,t[121]=r.form.instruction,t[122]=r.form.loadingWorkflows,t[123]=r.form.noWorkflows,t[124]=r.form.triggeredRun,t[125]=r.form.workflow,t[126]=d,t[127]=s,t[128]=p,t[129]=o,t[130]=c,t[131]=ue):ue=t[131];let q;t[132]===r.form.safety?q=t[133]:(q=(0,V.jsx)(Ee,{title:r.form.safety}),t[132]=r.form.safety,t[133]=q);let de;t[134]!==n.afterRunMode||t[135]!==p?(de=e=>{let t=e.target.value;p({safetyMode:t,...t!==`auto_apply`&&n.afterRunMode===`webhook`?{afterRunMode:`none`,webhookUrl:``}:{}})},t[134]=n.afterRunMode,t[135]=p,t[136]=de):de=t[136];let fe;t[137]===r.safety.suggest_only?fe=t[138]:(fe=(0,V.jsx)(`option`,{value:`suggest_only`,children:r.safety.suggest_only}),t[137]=r.safety.suggest_only,t[138]=fe);let pe;t[139]===r.safety.ask_before_apply?pe=t[140]:(pe=(0,V.jsx)(`option`,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),t[139]=r.safety.ask_before_apply,t[140]=pe);let J;t[141]===r.safety.auto_apply?J=t[142]:(J=(0,V.jsx)(`option`,{value:`auto_apply`,children:r.safety.auto_apply}),t[141]=r.safety.auto_apply,t[142]=J);let Y;t[143]!==n.safetyMode||t[144]!==de||t[145]!==fe||t[146]!==pe||t[147]!==J?(Y=(0,V.jsxs)(`select`,{className:Q,value:n.safetyMode,onChange:de,children:[fe,pe,J]}),t[143]=n.safetyMode,t[144]=de,t[145]=fe,t[146]=pe,t[147]=J,t[148]=Y):Y=t[148];let me=n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription,he;t[149]===me?he=t[150]:(he=(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:me}),t[149]=me,t[150]=he);let X;t[151]!==r.form.safety||t[152]!==Y||t[153]!==he?(X=(0,V.jsxs)($,{label:r.form.safety,children:[Y,he]}),t[151]=r.form.safety,t[152]=Y,t[153]=he,t[154]=X):X=t[154];let ge;t[155]===r.form.afterRun?ge=t[156]:(ge=(0,V.jsx)(Ee,{title:r.form.afterRun}),t[155]=r.form.afterRun,t[156]=ge);let _e;t[157]===p?_e=t[158]:(_e=e=>p({afterRunMode:e.target.value}),t[157]=p,t[158]=_e);let ve;t[159]===r.afterRun.none?ve=t[160]:(ve=(0,V.jsx)(`option`,{value:`none`,children:r.afterRun.none}),t[159]=r.afterRun.none,t[160]=ve);let ye;t[161]===r.afterRun.saveToSession?ye=t[162]:(ye=(0,V.jsx)(`option`,{value:`saveToSession`,children:r.afterRun.saveToSession}),t[161]=r.afterRun.saveToSession,t[162]=ye);let be=n.safetyMode!==`auto_apply`,xe;t[163]!==r.afterRun.webhook||t[164]!==be?(xe=(0,V.jsx)(`option`,{value:`webhook`,disabled:be,children:r.afterRun.webhook}),t[163]=r.afterRun.webhook,t[164]=be,t[165]=xe):xe=t[165];let Z;t[166]!==n.afterRunMode||t[167]!==_e||t[168]!==ve||t[169]!==ye||t[170]!==xe?(Z=(0,V.jsxs)(`select`,{className:Q,value:n.afterRunMode,onChange:_e,children:[ve,ye,xe]}),t[166]=n.afterRunMode,t[167]=_e,t[168]=ve,t[169]=ye,t[170]=xe,t[171]=Z):Z=t[171];let Se;t[172]!==n.afterRunMode||t[173]!==n.webhookUrl||t[174]!==r.form.webhookUrl||t[175]!==p?(Se=n.afterRunMode===`webhook`?(0,V.jsx)($,{label:r.form.webhookUrl,children:(0,V.jsx)(`input`,{className:Q,value:n.webhookUrl,onChange:e=>p({webhookUrl:e.target.value})})}):null,t[172]=n.afterRunMode,t[173]=n.webhookUrl,t[174]=r.form.webhookUrl,t[175]=p,t[176]=Se):Se=t[176];let Ce;t[177]===r.form.reliability?Ce=t[178]:(Ce=(0,V.jsx)(Ee,{title:r.form.reliability}),t[177]=r.form.reliability,t[178]=Ce);let De;t[179]===p?De=t[180]:(De=e=>p({timeoutSeconds:e.target.value}),t[179]=p,t[180]=De);let Oe;t[181]!==n.timeoutSeconds||t[182]!==De?(Oe=(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:De}),t[181]=n.timeoutSeconds,t[182]=De,t[183]=Oe):Oe=t[183];let ke;t[184]!==r.form.timeoutSeconds||t[185]!==Oe?(ke=(0,V.jsx)($,{label:r.form.timeoutSeconds,children:Oe}),t[184]=r.form.timeoutSeconds,t[185]=Oe,t[186]=ke):ke=t[186];let Ae;t[187]===p?Ae=t[188]:(Ae=e=>p({disableAfterFailures:e.target.value}),t[187]=p,t[188]=Ae);let je;t[189]!==n.disableAfterFailures||t[190]!==Ae?(je=(0,V.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:Ae}),t[189]=n.disableAfterFailures,t[190]=Ae,t[191]=je):je=t[191];let Me;t[192]!==r.form.disableAfterFailures||t[193]!==je?(Me=(0,V.jsx)($,{label:r.form.disableAfterFailures,children:je}),t[192]=r.form.disableAfterFailures,t[193]=je,t[194]=Me):Me=t[194];let Ne;t[195]!==ke||t[196]!==Me?(Ne=(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ke,Me]}),t[195]=ke,t[196]=Me,t[197]=Ne):Ne=t[197];let Pe;return t[198]!==S||t[199]!==N||t[200]!==te||t[201]!==P||t[202]!==F||t[203]!==ne||t[204]!==I||t[205]!==H||t[206]!==K||t[207]!==ue||t[208]!==q||t[209]!==X||t[210]!==ge||t[211]!==Z||t[212]!==Se||t[213]!==Ce||t[214]!==v||t[215]!==Ne||t[216]!==x?(Pe=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,V.jsxs)(`div`,{className:`grid gap-4`,children:[v,x,S,N,te,P,F,ne,I,H,K,ue,q,X,ge,Z,Se,Ce,Ne]})}),t[198]=S,t[199]=N,t[200]=te,t[201]=P,t[202]=F,t[203]=ne,t[204]=I,t[205]=H,t[206]=K,t[207]=ue,t[208]=q,t[209]=X,t[210]=ge,t[211]=Z,t[212]=Se,t[213]=Ce,t[214]=v,t[215]=Ne,t[216]=x,t[217]=Pe):Pe=t[217],Pe}function we(e){return(0,V.jsx)(`option`,{value:e.id,children:e.title||e.name},e.id)}function Te(e){return(0,V.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,z.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,V.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,V.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Ee(e){let t=(0,z.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(d,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,V.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{J as AutomationsPage};
|