@xopcai/xopc 0.0.126 → 0.0.127
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/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-C70vgt60.js → agent-avatar-dicebear-CgGgO4OV.js} +1 -1
- package/dist/gateway/static/root/assets/agents-k59l7NMb.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D9-HW6cy.js → app-management-settings-panel-DeQsTsyy.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BHlahIDL.js → appearance-settings-BnHQW7Hv.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BdJ1eQg3.js → apps-page-BG9b4abG.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-B-aoIt0w.js → archive-plugin-5NXT7Zqv.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BD0G0FD5.js → attachment-load-DghwhYe0.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-iJRVI7aZ.js → automation-suggestion-card-DYmESgwl.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-De8mVutL.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B0mNlVSz.js → binary-plugins-DSbPKdWX.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CJY9Lu5G.js → block-editor-CoZ-_np-.js} +27 -27
- package/dist/gateway/static/root/assets/browser-settings-page-C_ZRa4LF.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-Bgc8ag55.js → capability-presets-api-hny224j-.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-B1nIi0TC.js → capability-presets-settings-panel-Drc0qLsw.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-0sauApoC.js → channel-recipient-api-DAlOHxKJ.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-CA20zBV9.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-qMyMB5te.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-XG6Vb_fZ.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-npJ0Oh5p.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-DqZ6fbIj.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-BR2ItBuf.js +1 -0
- package/dist/gateway/static/root/assets/dreaming-settings-CkUZ997f.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BbyczVZ3.js → extension-debug-page-Tl0f1rNv.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DLN1I3DR.js → extension-page-Ck7QuwE3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D9VGHmYJ.js → extension-settings-page-3RMhQtZ3.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-5V96dUz3.js → fetch-pg2ErdAk.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BtIzObwp.js → gateway-config-api-DbG97ia2.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-B8cyqKk-.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DEMad2wt.js → gateway-startup-retry-Yh8h3hkj.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-4PcF6Sh6.js → goal-create-dialog-DmeW7Zz3.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DrTyGbVD.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-CVN7-pdM.js → goals-config-api-CxCWGIBB.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-DV1bJhIh.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-IYCH3-Pi.js → goals-settings-9DrfOkP5.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Cf_a2Bmz.js → heartbeat-settings-KaDpZrv0.js} +1 -1
- package/dist/gateway/static/root/assets/index-C2F0Clvm.js +256 -0
- package/dist/gateway/static/root/assets/index-COQSX5d_.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-lKTg6St7.js → keyboard-shortcuts-settings-CfQrt_Rb.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C9dpiNTF.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-split-Bv4k6iGJ.js → markdown-split-BwiMdCf_.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bbi8g3N8.js → media-plugins-DhoizyZv.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DmnbiNxU.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-zdCdmBmH.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-MpGeFfPt.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-DYCM3yd2.js +2 -0
- package/dist/gateway/static/root/assets/{page-tabs-Cp395RYD.js → page-tabs-DDC2t4Z8.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DqV5OM4m.js → preview-open-alternatives-BTmk-XDM.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cu0ElRnS.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DakNaUjZ.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DYKjt7L9.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BItmzAzI.js → save-bar-controls-DqU-yKIh.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-BQ8IjjCn.js → schedule-field-CUttkoSB.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BRpD6x3d.js → schema-form-CVSQA9nI.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CcGHDsz1.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CuFdeKNu.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BKSPQM4R.js → settings-collapsible-section-CK7ogS-P.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-BmyfthNQ.js → settings-form-section-Bugp38Fa.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-0AJoUvxi.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-Bls5tfbH.js → settings-page-layout-DBRWwdhh.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-kQEsTGAs.js → setup-status-panel-D6a_hEk7.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DbYZNAPb.js → share-preview-page-BtsuETKF.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CcEFT7S9.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BcN_RuTD.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BbRZZZA5.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DKDAojWM.js → system-settings-panel-DJ6YuLqR.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BCCV4Kkp.js → typed-models-lib-B0T7N8Km.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-NBqg3iFY.js → use-channel-catalog-C6vrxdzZ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-suQ2x-LB.js → user-profile-settings-panel-DZ0nKMgj.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-DPGVr3tS.js → utils-CehXcWAY.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-2QKflCx8.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DfJnuWq1.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BTkRVNAh.js → workflow-run-setup-panel-c4jeaohQ.js} +2 -2
- package/dist/gateway/static/root/assets/{workflow-start-dialog-DAImVtdO.js → workflow-start-dialog-ENRHjoqa.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-BJwwFTm_.js +18 -0
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +5 -0
- package/dist/src/agent/agent-manager.d.ts +14 -0
- package/dist/src/agent/agent-manager.js +111 -2
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/capabilities/definitions.d.ts +153 -0
- package/dist/src/agent/capabilities/definitions.js +156 -0
- package/dist/src/agent/capabilities/definitions.js.map +1 -0
- package/dist/src/agent/capabilities/index.d.ts +2 -0
- package/dist/src/agent/capabilities/index.js +3 -0
- package/dist/src/agent/capabilities/registry.d.ts +10 -0
- package/dist/src/agent/capabilities/registry.js +51 -0
- package/dist/src/agent/capabilities/registry.js.map +1 -0
- package/dist/src/agent/service/process-direct-one-shot.js +5 -3
- package/dist/src/agent/service/process-direct-one-shot.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +4 -3
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service.d.ts +2 -0
- package/dist/src/agent/service.js +3 -0
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/skills/parse-skill-metadata.js +9 -1
- package/dist/src/agent/skills/parse-skill-metadata.js.map +1 -1
- package/dist/src/agent/skills/skill-manager.d.ts +4 -0
- package/dist/src/agent/skills/skill-manager.js +17 -0
- package/dist/src/agent/skills/skill-manager.js.map +1 -1
- package/dist/src/agent/skills/types.d.ts +5 -0
- package/dist/src/agent/tools/desktop-pet-tool.d.ts +24 -0
- package/dist/src/agent/tools/desktop-pet-tool.js +90 -0
- package/dist/src/agent/tools/desktop-pet-tool.js.map +1 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +17 -0
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- 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.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/index.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +1 -0
- package/dist/src/gateway/agent-builtin-tools.js.map +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +7 -0
- package/dist/src/gateway/hono/routes/commands-skills.js.map +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +2 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.js +28 -0
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +6 -2
- package/dist/src/gateway/service/run-gateway-agent.js.map +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/pets/factory.d.ts +25 -0
- package/dist/src/pets/factory.js +327 -0
- package/dist/src/pets/factory.js.map +1 -0
- package/dist/src/pets/manifest.d.ts +2 -0
- package/dist/src/pets/manifest.js +16 -0
- package/dist/src/pets/manifest.js.map +1 -0
- package/dist/src/pets/validator.d.ts +12 -0
- package/dist/src/pets/validator.js +175 -0
- package/dist/src/pets/validator.js.map +1 -0
- package/dist/src/projects/project-service.d.ts +2 -0
- package/dist/src/projects/project-service.js +6 -0
- package/dist/src/projects/project-service.js.map +1 -1
- package/dist/src/projects/project-store.d.ts +1 -0
- package/dist/src/projects/project-store.js +14 -7
- package/dist/src/projects/project-store.js.map +1 -1
- package/dist/src/projects/types.d.ts +2 -0
- package/dist/src/session/session-title.js +22 -2
- package/dist/src/session/session-title.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/025_project_pinned_at.sql +5 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/package.json +1 -1
- package/skills/creative/hatch-pet/SKILL.md +63 -0
- package/dist/gateway/static/root/assets/agents-DRYVahI-.js +0 -2
- package/dist/gateway/static/root/assets/automations-page-D8hYQbkl.js +0 -4
- package/dist/gateway/static/root/assets/browser-settings-page-CiWEO-Iy.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-BddPdqVo.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Ba2GDhSE.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-CiEc4KmY.js +0 -1
- package/dist/gateway/static/root/assets/dist-By6Rh2ee.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-4bvpk5wr.js +0 -3
- package/dist/gateway/static/root/assets/gateway-settings-KFsGGDhg.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-B482PSaG.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-CUdgJuDn.js +0 -2
- package/dist/gateway/static/root/assets/index-CA2tR2vm.js +0 -256
- package/dist/gateway/static/root/assets/index-Ds3u0LOk.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-BCporcNH.js +0 -2
- package/dist/gateway/static/root/assets/messages-C22hxE1N.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-D68Pyow7.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-CuUMOiyv.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-Dx2N5zTk.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-sB8AzZi3.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-LBnJqWK2.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Dbj0o6SC.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DhDZKspB.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BvXLMNL6.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-Cfm9UxAr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BtR4B0kn.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CJNVOWoK.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DcWDHrt3.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-DaJASKFP.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-BrCZpAWh.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-vyJ8wSXm.js +0 -18
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hatch-pet
|
|
3
|
+
description: Create and install a custom animated xopc desktop pet from a user description.
|
|
4
|
+
metadata:
|
|
5
|
+
xopc:
|
|
6
|
+
activates_capabilities:
|
|
7
|
+
- desktop-pet-authoring
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Hatch Pet
|
|
11
|
+
|
|
12
|
+
Use this skill when the user wants to create, customize, refine, or install an xopc desktop pet.
|
|
13
|
+
|
|
14
|
+
## Conversation flow
|
|
15
|
+
|
|
16
|
+
Do not jump straight to `create_desktop_pet` when the pet idea is vague. First guide the user with `clarify` so the final pet has a clear visual identity, personality, and action set.
|
|
17
|
+
|
|
18
|
+
Use at most 3 concise `clarify` calls before creating or updating the pet. Each call should ask one short question. Provide `choices` when useful, set a sensible `default`, and write the question so the user knows they can type their own custom answer instead of picking a listed option.
|
|
19
|
+
|
|
20
|
+
Recommended questions for a new pet:
|
|
21
|
+
|
|
22
|
+
1. Base character: ask what kind of pet it should be.
|
|
23
|
+
- Choices: `Tiny robot companion`, `Cute animal mascot`, `Plant or object spirit`, `Describe my own`
|
|
24
|
+
- Default: `Tiny robot companion`
|
|
25
|
+
2. Visual mood: ask what style or vibe it should have.
|
|
26
|
+
- Choices: `Soft and cute`, `Techy and energetic`, `Calm and focused`, `Describe my own`
|
|
27
|
+
- Default: `Soft and cute`
|
|
28
|
+
3. Signature work behavior: ask which behavior should be most recognizable.
|
|
29
|
+
- Choices: `Typing at a laptop`, `Searching a toolbox`, `Celebrating completed work`, `Describe my own`
|
|
30
|
+
- Default: `Typing at a laptop`
|
|
31
|
+
|
|
32
|
+
For an existing pet update, ask only what is missing for the requested refinement:
|
|
33
|
+
|
|
34
|
+
1. Refinement target: ask what should change.
|
|
35
|
+
- Choices: `Appearance`, `Personality and dialogue`, `Animations and work actions`, `Everything`
|
|
36
|
+
- Default: `Animations and work actions`
|
|
37
|
+
2. Update behavior: overwrite the same custom pet by default. Ask about renaming or creating a variant only if the user explicitly requests a separate version.
|
|
38
|
+
|
|
39
|
+
Skip clarification when the user already supplied enough detail, or when they explicitly asked you to choose. In that case, choose a coherent cute desktop-helper design and proceed.
|
|
40
|
+
|
|
41
|
+
## Prompt assembly
|
|
42
|
+
|
|
43
|
+
After clarification, synthesize one complete `prompt` for `create_desktop_pet`. Include:
|
|
44
|
+
|
|
45
|
+
- The pet's base form, silhouette, colors, face/expression, and visual style.
|
|
46
|
+
- Personality and short dialogue tone.
|
|
47
|
+
- Required desktop-helper animation ideas: idle, greeting, thinking, typing at a laptop, searching through a toolbox, reading/searching, file or terminal work, success celebration, and error/blocked reaction.
|
|
48
|
+
- Any user-requested refinements, constraints, or brand cues.
|
|
49
|
+
- A note that the pet should read clearly at small desktop size and feel cute, lively, and polished.
|
|
50
|
+
|
|
51
|
+
Do not expose implementation details to the user unless they ask.
|
|
52
|
+
|
|
53
|
+
## Tool call
|
|
54
|
+
|
|
55
|
+
Once the pet concept is clear, call `create_desktop_pet` with:
|
|
56
|
+
|
|
57
|
+
- `mode`: use `create` for a new pet; use `update` when the user is refining an existing custom pet.
|
|
58
|
+
- `petId`: required for `update`; pass the id from Settings, including the `custom:` prefix if present.
|
|
59
|
+
- `name`: a short display name when the user provides or implies one.
|
|
60
|
+
- `prompt`: the full visual and personality description, including all requested refinements.
|
|
61
|
+
- `description`: a concise one-line description for Settings.
|
|
62
|
+
|
|
63
|
+
When updating an existing pet, keep the same name unless the user explicitly asks to rename it. After the tool succeeds, tell the user the pet was installed under `~/.xopc/pets` and can be selected from Settings > Pet.
|
|
@@ -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-C22hxE1N.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-5V96dUz3.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$c as f,$n as p,Aa as m,Ai as h,At as g,Bo as _,Bs as v,Da as y,Di as b,Ea as x,Ei as S,Fs as C,Ga as w,Gc as T,Gr as E,Io as D,It as O,Ja as k,Jn as A,Jo as j,Jr as M,Ka as N,Kn as P,Kr as F,La as I,Lt as L,Ma as R,Mi as z,Nt as B,Oa as ee,Oi as V,Ot as te,Ps as H,Qn as U,Qr as ne,Ro as re,S as W,Ta as ie,Ti as G,To as K,Ua as q,Uc as ae,Ur as oe,Va as se,Wa as ce,Wr as le,Xa as ue,Xn as de,Ya as fe,Yc as pe,Yi as me,Yn as he,Yr as ge,Za as _e,Zn as ve,ao as ye,ar as be,bo as J,cr as xe,dc as Se,dl as Ce,er as we,es as Te,fc as Ee,fl as De,fo as Y,fs as Oe,ho as ke,ir as Ae,ja as je,ji as Me,jt as Ne,ka as Pe,ki as Fe,lr as Ie,mo as Le,n as Re,nl as ze,oo as Be,or as X,os as Ve,po as He,qa as Ue,qc as We,qn as Ge,qr as Ke,ra as qe,rc as Je,rr as Ye,sl as Xe,t as Ze,tc as Qe,tr as $e,ul as et,uo as tt,vo as nt,wa as rt,wi as it,wo as at,ws as ot,x as st,xc as ct,xo as lt,zt as ut}from"./index-CA2tR2vm.js";import{t as dt}from"./markdown-editor-BFOjBBla.js";import{n as ft,t as pt}from"./settings-form-section-BmyfthNQ.js";import{t as mt}from"./page-tabs-Cp395RYD.js";import{n as ht,t as gt}from"./settings-page-layout-Bls5tfbH.js";import{n as _t}from"./agent-avatar-dicebear-C70vgt60.js";import{n as vt,r as yt,t as bt}from"./channel-recipient-api-0sauApoC.js";import{n as xt,r as St,t as Ct}from"./utils-DPGVr3tS.js";import{a as wt,i as Tt,n as Et,o as Dt,t as Ot}from"./typed-models-lib-BCCV4Kkp.js";import{a as kt,o as At,r as jt,s as Mt}from"./capability-presets-api-Bgc8ag55.js";import{t as Nt}from"./directory-picker-path-field-CiEc4KmY.js";var Z=n(),Q=r();function Pt(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,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(ee,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=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)(je,{className:`text-base font-semibold text-fg`,children:g}),t[2]=g,t[3]=_);let v=o?f.confirmDeletePurge:f.confirmDelete,b;t[4]===v?b=t[5]:(b=(0,Q.jsx)(y,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:v}),t[4]=v,t[5]=b);let S;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(S=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]=S):S=t[13];let C;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(C=(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=C):C=t[17];let w=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,T;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(T=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=T):T=t[22];let E=o?f.purgeDisk:f.removeFromConfig,D;t[23]!==u||t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:w,disabled:T,onClick:u,children:E}),t[23]=u,t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]!==D||t[29]!==C?(O=(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:[C,D]}),t[28]=D,t[29]=C,t[30]=O):O=t[30];let k;t[31]!==O||t[32]!==_||t[33]!==b||t[34]!==S?(k=(0,Q.jsxs)(Pe,{children:[p,(0,Q.jsxs)(x,{className:h,onOpenAutoFocus:Ft,children:[_,b,S,O]})]}),t[31]=O,t[32]=_,t[33]=b,t[34]=S,t[35]=k):k=t[35];let A;return t[36]!==r||t[37]!==n||t[38]!==k?(A=(0,Q.jsx)(m,{open:n,onOpenChange:r,children:k}),t[36]=r,t[37]=n,t[38]=k,t[39]=A):A=t[39],A}function Ft(e){return e.preventDefault()}var $=e(t(),1),It=[{id:`overview`,labelKey:`navOverview`,icon:Qe},{id:`behavior`,labelKey:`navBehavior`,icon:re},{id:`tools`,labelKey:`navTools`,icon:ke},{id:`skills`,labelKey:`navSkills`,icon:He},{id:`memory`,labelKey:`navMemory`,icon:T},{id:`connections`,labelKey:`navConnections`,icon:ae},{id:`config`,labelKey:`navConfig`,icon:_},{id:`dangerZone`,labelKey:`navDangerZone`,icon:at}];function Lt(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`,Be.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=It.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 Rt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:h,children:g}=e,_=p===void 0?!0:p,[v,b]=(0,$.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(ee,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,N)}),t[0]=S):S=t[0];let C;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(C=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,w,`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]=C):C=t[1];let T;t[2]===o?T=t[3]:(T=(0,Q.jsx)(je,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=T);let E;t[4]===s?E=t[5]:(E=(0,Q.jsx)(y,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=E);let D;t[6]!==T||t[7]!==E?(D=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[T,E]}),t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=i(ye,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=O):O=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[10]=k):k=t[10];let A;t[11]===a.closeDialogAria?A=t[12]:(A=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:O,"aria-label":a.closeDialogAria,children:k})}),t[11]=a.closeDialogAria,t[12]=A);let j;t[13]!==D||t[14]!==A?(j=(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:[D,A]}),t[13]=D,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==a||t[17]!==l||t[18]!==c?(M=(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)(Lt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=M):M=t[19];let P;t[20]===g?P=t[21]:(P=(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]=P);let F;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]!==_?(F=_?(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)(Y,{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]=F):F=t[30];let I;t[31]!==P||t[32]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[P,F]}),t[31]=P,t[32]=F,t[33]=I):I=t[33];let L;t[34]!==M||t[35]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[M,I]}),t[34]=M,t[35]=I,t[36]=L):L=t[36];let R;t[37]!==v||t[38]!==L||t[39]!==j?(R=(0,Q.jsxs)(Pe,{children:[S,(0,Q.jsx)(x,{ref:b,className:C,onOpenAutoFocus:zt,children:(0,Q.jsxs)(ce,{layer:`modal`,portalContainer:v,children:[j,L]})})]}),t[37]=v,t[38]=L,t[39]=j,t[40]=R):R=t[40];let z;return t[41]!==r||t[42]!==n||t[43]!==R?(z=(0,Q.jsx)(m,{open:n,onOpenChange:r,children:R}),t[41]=r,t[42]=n,t[43]=R,t[44]=z):z=t[44],z}function zt(e){return e.preventDefault()}var Bt=e=>u(e);function Vt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Ht(e){let t=Vt(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 Ut({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`),Bt),{data:y,mutate:b}=d(l(`/api/memory/records?status=active&limit=80`),Bt),{data:x,mutate:S}=d(l(`/api/memory/records?status=candidate&limit=80`),Bt),{data:C}=d(l(`/api/memory/signals?limit=50`),Bt),{data:w,mutate:T}=d(l(`/api/memory/traces?limit=80`),Bt),{data:E}=d(l(`/api/memory/feedback-summary?limit=1000`),Bt),{data:D,mutate:O}=d(l(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Bt),{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,I=w?.traces.length??0,L=E?.summaries??[],R=(0,$.useMemo)(()=>new Map(L.map(e=>[e.recordId,e])),[L]),z=L.reduce((e,t)=>e+t.total,0),B=L.reduce((e,t)=>e+t.helpful,0),ee=z>0?Math.round(B/z*100):null,V=(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:I},{label:n.recallQuality,value:ee==null?`—`:`${ee}%`}],[P,ee,M,N,F,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,I]);(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 te(){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 H(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 U(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`:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-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:V.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,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 bg-surface-panel shadow-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)(se,{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)(q,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(se,{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)(q,{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)(Y,{type:`button`,variant:`primary`,onClick:te,children:n.savePolicy}),f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:f}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-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)(Y,{type:`button`,variant:`primary`,onClick:()=>U(e.id,`active`),children:n.approve}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>U(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>U(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-panel 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)(Y,{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 bg-surface-panel shadow-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=R.get(e.id),r=Vt(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 ${Ht(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 bg-surface-panel shadow-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)(Y,{type:`button`,variant:`secondary`,onClick:()=>H(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 bg-surface-panel shadow-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:[L.slice(0,8).map(e=>{let t=(y?.records??[]).find(t=>t.id===e.recordId),r=Vt(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 ${Ht(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)}),L.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 bg-surface-panel shadow-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 bg-surface-panel shadow-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 Wt(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: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 bg-surface-panel/80 px-4 py-3 shadow-surface 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 Gt(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)(ft,{icon:C,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)(Wt,{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)(Wt,{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 w;t[32]!==y||t[33]!==S?(w=(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]=w):w=t[34];let T;return t[35]!==g||t[36]!==w?(T=(0,Q.jsxs)(pt,{children:[g,w]}),t[35]=g,t[36]=w,t[37]=T):T=t[37],T}function Kt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function qt(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 px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,a&&`bg-surface-base text-fg-muted`,!e&&!a&&`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 Jt(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)(qt,{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 bg-surface-panel/80 px-3 py-2 shadow-surface 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 Yt(e,t){return e&&e.length>0?e.join(`, `):t}function Xt(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=()=>p(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 m=f,h;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]!==m){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(Qt),i=Object.entries(u?.tools?.builtin??{}).sort(Zt),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(ft,{icon:H,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],h=(0,Q.jsxs)(pt,{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 bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:m.length?m.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)(Jt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Kt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Jt,{name:n,value:r.model,monoValue:!0,source:Kt(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)(Jt,{name:n,value:r.mode,source:Kt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,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)(Jt,{name:`mode`,value:a?.mode??`all`,source:Kt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Jt,{name:`allow`,value:Yt(a.allow,`—`),source:Kt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Jt,{name:`deny`,value:Yt(a.deny,`—`),source:Kt(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)(Jt,{name:`mode`,value:o?.mode??`off`,source:Kt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Jt,{name:`sources`,value:Yt(o?.sources,`—`),source:Kt(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)(Jt,{name:`requiresConfirmation`,value:Yt(d?.requiresConfirmation,`—`),source:Kt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Jt,{name:`forbidden`,value:Yt(d?.forbidden,`—`),source:Kt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Jt,{name:`escalation`,value:Yt(d?.escalation,`—`),source:Kt(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]=m,t[26]=h}else h=t[26];return h}function Zt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Qt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function $t(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 en(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 tn(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)(en,{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)(en,{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)(en,{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)(nn,{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)(rn,{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)(sn,{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 nn(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)($t,{children:(0,Q.jsx)(Gt,{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 rn(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(on)),t[0]=a,t[1]=u);let d=u,p;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(p=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]=p):p=t[6];let m=p,h,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]!==m.description||t[21]!==m.id||t[22]!==m.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(an).filter(e=>e!==l&&!o.includes(e)),p=u[0]??``;g=$t,h=pt;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)(Ee,{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)(Y,{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)(ft,{icon:re,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:S}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=S,t[44]=_):_=t[44];let C;t[45]!==m.id||t[46]!==c?(C=()=>c(m.id),t[45]=m.id,t[46]=c,t[47]=C):C=t[47];let w=m.name||n.capabilityPresetsGlobalDefault,T;t[48]===w?T=t[49]:(T=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:w}),t[48]=w,t[49]=T);let E;t[50]===n.capabilityPresetsGlobalDefault?E=t[51]:(E=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=E);let D;t[52]!==T||t[53]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[T,E]}),t[52]=T,t[53]=E,t[54]=D):D=t[54];let O;t[55]===m.id?O=t[56]:(O=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:m.id}),t[55]=m.id,t[56]=O);let k=m.description||n.capabilityPresetsGlobalDefaultHint,A;t[57]===k?A=t[58]:(A=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:k}),t[57]=k,t[58]=A);let j;t[59]!==C||t[60]!==D||t[61]!==O||t[62]!==A?(j=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-accent-soft/20 px-3 py-2 shadow-surface 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,children:[D,O,A]})}),t[59]=C,t[60]=D,t[61]=O,t[62]=A,t[63]=j):j=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[j,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 bg-surface-panel/80 px-3 py-2 shadow-surface 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)(Y,{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)(f,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(Y,{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)(ze,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(Y,{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)(K,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-3 text-sm text-fg-muted shadow-surface`,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)(se,{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:p,children:u.map(e=>(0,Q.jsx)(q,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:i||!p,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||p;t&&s([...o,t])},children:[(0,Q.jsx)(Ve,{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]=m.description,t[21]=m.id,t[22]=m.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=h,t[28]=g,t[29]=_,t[30]=v,t[31]=y}else h=t[27],g=t[28],_=t[29],v=t[30],y=t[31];let b;t[64]!==h||t[65]!==_||t[66]!==v||t[67]!==y?(b=(0,Q.jsxs)(h,{children:[_,v,y]}),t[64]=h,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 an(e){return e.id}function on(e){return[e.id,e]}function sn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)($t,{children:(0,Q.jsx)(Xt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function cn(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)($t,{children:r.id===`main`?(0,Q.jsx)(pt,{children:(0,Q.jsx)(ft,{icon:at,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(pt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(ft,{icon:at,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)(Y,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(K,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(Y,{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 ln=i(tt,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function un(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,w=!u&&(d||l.length>0),T;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(T=(0,Q.jsx)(ft,{className:`shrink-0`,icon:C,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=T):T=t[2];let E;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==o||t[7]!==a||t[8]!==r||t[9]!==s?(E=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)(Y,{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]=E):E=t[10];let D;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?(D=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)(se,{className:i(Ct(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(q,{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]=D):D=t[22];let O;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]!==w?(O=w&&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)(Y,{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)(Te,{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)(se,{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)(q,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(q,{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)(se,{className:ln,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(q,{value:``,children:S}),m.map(e=>(0,Q.jsx)(q,{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]=w,t[45]=O):O=t[45];let k;t[46]!==r||t[47]!==u||t[48]!==f?(k=r||!f.trim()||u,t[46]=r,t[47]=u,t[48]=f,t[49]=k):k=t[49];let A;t[50]!==n.addBinding||t[51]!==k?(A=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(Y,{type:`submit`,disabled:k,children:n.addBinding})}),t[50]=n.addBinding,t[51]=k,t[52]=A):A=t[52];let j;t[53]!==c||t[54]!==D||t[55]!==O||t[56]!==A?(j=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[D,O,A]}),t[53]=c,t[54]=D,t[55]=O,t[56]=A,t[57]=j):j=t[57];let M;return t[58]!==T||t[59]!==E||t[60]!==j?(M=(0,Q.jsxs)(pt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[T,E,j]}),t[58]=T,t[59]=E,t[60]=j,t[61]=M):M=t[61],M}function dn(e){let t=(0,Z.c)(32),{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(fn),v;t[0]!==n.missing||t[1]!==a?.files?(v=a?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=a?.files,t[2]=v):v=t[2];let y=v,b;t[3]===n.filesHint?b=t[4]:(b=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=b);let x;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesLoading||t[8]!==n.filesMarkdownEdit||t[9]!==n.filesMarkdownPreview||t[10]!==n.filesNavAria||t[11]!==n.filesSavingStatus||t[12]!==n.pickFile||t[13]!==n.tryInChat||t[14]!==o||t[15]!==d||t[16]!==p||t[17]!==y||t[18]!==a||t[19]!==r||t[20]!==l||t[21]!==_||t[22]!==g||t[23]!==h||t[24]!==m||t[25]!==c||t[26]!==f||t[27]!==u?(x=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)(mt,{items:y,activeTab:o??``,onChange:c,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(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`,Be.press,l===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`edit`),children:[(0,Q.jsx)(D,{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`,Be.press,l===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`preview`),children:[(0,Q.jsx)(Se,{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)(Y,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(ot,{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)(dt,{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)(ne,{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[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesLoading,t[8]=n.filesMarkdownEdit,t[9]=n.filesMarkdownPreview,t[10]=n.filesNavAria,t[11]=n.filesSavingStatus,t[12]=n.pickFile,t[13]=n.tryInChat,t[14]=o,t[15]=d,t[16]=p,t[17]=y,t[18]=a,t[19]=r,t[20]=l,t[21]=_,t[22]=g,t[23]=h,t[24]=m,t[25]=c,t[26]=f,t[27]=u,t[28]=x):x=t[28];let S;return t[29]!==b||t[30]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function fn(e){return e.resolved===`dark`}function pn(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)(ft,{className:`shrink-0`,icon:v,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 y;t[17]!==m||t[18]!==_?(y=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg bg-surface-panel/60 p-3 text-xs text-fg-muted shadow-surface`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=y):y=t[19];let b;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?(b={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]=b):b=t[39];let x;t[40]!==a||t[41]!==r||t[42]!==o||t[43]!==i.typedModels.defaultRole||t[44]!==s||t[45]!==b?(x=(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:b})}),t[40]=a,t[41]=r,t[42]=o,t[43]=i.typedModels.defaultRole,t[44]=s,t[45]=b,t[46]=x):x=t[46];let S;t[47]!==n.modelsSave||t[48]!==a||t[49]!==u||t[50]!==c?(S=u?null:(0,Q.jsx)(Y,{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]=S):S=t[51];let C;t[52]===l?C=t[53]:(C=()=>void l(),t[52]=l,t[53]=C);let w;t[54]!==n.modelsResetInherit||t[55]!==a||t[56]!==C?(w=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:a,onClick:C,children:n.modelsResetInherit}),t[54]=n.modelsResetInherit,t[55]=a,t[56]=C,t[57]=w):w=t[57];let T;t[58]!==S||t[59]!==w?(T=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[S,w]}),t[58]=S,t[59]=w,t[60]=T):T=t[60];let E;return t[61]!==d||t[62]!==T||t[63]!==y||t[64]!==x?(E=(0,Q.jsxs)(pt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,y,x,T]}),t[61]=d,t[62]=T,t[63]=y,t[64]=x,t[65]=E):E=t[65],E}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),m=(0,$.useMemo)(()=>{let e=Me(n.trim());return e&&h(e.styleId)?e.styleId:b[0]??`adventurer`},[n]),g=(0,$.useCallback)(async(e,n)=>{try{await he(t)}catch{}r(Fe(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 Ie(t,n),z(t),r(V)}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=Me(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)(Y,{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)(lt,{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:b.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void g(e,S[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,Be.press,m===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:[S.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Be.press,v(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(ue,{open:f,onOpenChange:p,children:[(0,Q.jsx)(_e,{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`,Be.press),children:a.avatarMore})}),(0,Q.jsx)(fe,{children:(0,Q.jsxs)(k,{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(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:G.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,Be.press,v(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(m,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)(it,{agentId:t,avatar:n,size:40}),n.trim()&&!Me(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:p,setEditWorkspace:h,editModel:g,setEditModel:_,onSetDefault:v,onSetTuiDefault:b,isTuiDefault:S,isTuiDefaultInherited:C,onSaveAgentEdits:T,hideInlineSave:E,profileMarkdownLoading:D,profileDraft:O,updateIdentity:k,handleSoulTemplateChange:A,handleSoulContentChange:j,setAvatarDialogOpen:M,toggleSoulPreviewMode:P,onTryInChat:F}=e,I=o(yn),L=s(vn),R;t[0]===O?.identity?R=t[1]:(R=O?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=O?.identity,t[1]=R);let z=R,V=O?.soulTemplate??`professional`,H=O?.soulCustomContent??``,U=O?.soulEditorNonce??0,W=O?.soulPreviewMode??!1,G=O?.avatarDialogOpen??!1,K;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(K=Ct(),t[2]=K):K=t[2];let ae=K,oe;t[3]===I?oe=t[4]:(oe=(e,t)=>I===`zh`?t:e,t[3]=I,t[4]=oe);let ce=oe;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 le;t[7]!==z.avatar||t[8]!==a.id?(le=(0,Q.jsx)(it,{agentId:a.id,avatar:z.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=z.avatar,t[8]=a.id,t[9]=le):le=t[9];let ue;t[10]===M?ue=t[11]:(ue=()=>M(!0),t[10]=M,t[11]=ue);let de;t[12]!==n.avatarOpenSettingsAria||t[13]!==ue?(de={onClick:ue,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=ue,t[14]=de):de=t[14];let fe;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==S||t[19]!==C||t[20]!==a.isDefault?(fe=a.isDefault||S?(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,S?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:C?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=S,t[19]=C,t[20]=a.isDefault,t[21]=fe):fe=t[21];let pe;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==c||t[25]!==S||t[26]!==v||t[27]!==b||t[28]!==a.isDefault?(pe=!a.isDefault||!S?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void v(),children:n.setDefault}),S?null:(0,Q.jsx)(Y,{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]=S,t[26]=v,t[27]=b,t[28]=a.isDefault,t[29]=pe):pe=t[29];let me;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==le||t[33]!==de||t[34]!==fe||t[35]!==pe?(me=(0,Q.jsx)(ft,{icon:re,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:le,iconInteractive:de,titleAccessory:fe,trailing:pe}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=le,t[33]=de,t[34]=fe,t[35]=pe,t[36]=me):me=t[36];let he;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Q.jsx)(ee,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,N)}),t[37]=he):he=t[37];let ge;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ge=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`,w),t[38]=ge):ge=t[38];let _e;t[39]===n.avatarPickerTitle?_e=t[40]:(_e=(0,Q.jsx)(je,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=_e);let ve;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ve=i(ye,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=ve):ve=t[41];let be;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[42]=be):be=t[42];let J;t[43]===n.closeDialogAria?J=t[44]:(J=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:ve,"aria-label":n.closeDialogAria,children:be})}),t[43]=n.closeDialogAria,t[44]=J);let xe;t[45]!==_e||t[46]!==J?(xe=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[_e,J]}),t[45]=_e,t[46]=J,t[47]=xe):xe=t[47];let Ce;t[48]===n.avatarRowHint?Ce=t[49]:(Ce=(0,Q.jsx)(y,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Ce);let we;t[50]===k?we=t[51]:(we=e=>k({avatar:e}),t[50]=k,t[51]=we);let Te;t[52]!==n||t[53]!==z.avatar||t[54]!==a.id||t[55]!==we?(Te=(0,Q.jsx)(hn,{agentId:a.id,value:z.avatar,onChange:we,a:n}),t[52]=n,t[53]=z.avatar,t[54]=a.id,t[55]=we,t[56]=Te):Te=t[56];let Ee;t[57]!==xe||t[58]!==Ce||t[59]!==Te?(Ee=(0,Q.jsxs)(Pe,{children:[he,(0,Q.jsxs)(x,{className:ge,onOpenAutoFocus:_n,children:[xe,Ce,Te]})]}),t[57]=xe,t[58]=Ce,t[59]=Te,t[60]=Ee):Ee=t[60];let De;t[61]!==G||t[62]!==M||t[63]!==Ee?(De=(0,Q.jsx)(m,{open:G,onOpenChange:M,children:Ee}),t[61]=G,t[62]=M,t[63]=Ee,t[64]=De):De=t[64];let ke;t[65]===n.displayName?ke=t[66]:(ke=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=ke);let Ae;t[67]!==u||t[68]!==k?(Ae=e=>{u(e.target.value),k({name:e.target.value})},t[67]=u,t[68]=k,t[69]=Ae):Ae=t[69];let Me;t[70]!==n.personaNamePlaceholder||t[71]!==l||t[72]!==Ae?(Me=(0,Q.jsx)(`input`,{className:ae,value:l,onChange:Ae,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=l,t[72]=Ae,t[73]=Me):Me=t[73];let Fe;t[74]!==ke||t[75]!==Me?(Fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[ke,Me]}),t[74]=ke,t[75]=Me,t[76]=Fe):Fe=t[76];let Ie;t[77]===n.personaEmoji?Ie=t[78]:(Ie=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Ie);let Re;t[79]===k?Re=t[80]:(Re=e=>k({emoji:e.target.value}),t[79]=k,t[80]=Re);let ze;t[81]!==n.personaEmojiPlaceholder||t[82]!==z.emoji||t[83]!==Re?(ze=(0,Q.jsx)(`input`,{className:ae,value:z.emoji,onChange:Re,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=z.emoji,t[83]=Re,t[84]=ze):ze=t[84];let X;t[85]!==Ie||t[86]!==ze?(X=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ie,ze]}),t[85]=Ie,t[86]=ze,t[87]=X):X=t[87];let Ve;t[88]===n.agentDescription?Ve=t[89]:(Ve=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=Ve);let He;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(He=i(ae,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=He):He=t[90];let Ue;t[91]!==f||t[92]!==k?(Ue=e=>{f(e.target.value),k({description:e.target.value})},t[91]=f,t[92]=k,t[93]=Ue):Ue=t[93];let We;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==Ue?(We=(0,Q.jsx)(`textarea`,{className:He,value:d,onChange:Ue,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=Ue,t[97]=We):We=t[97];let Ge;t[98]!==Ve||t[99]!==We?(Ge=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[Ve,We]}),t[98]=Ve,t[99]=We,t[100]=Ge):Ge=t[100];let Ke;t[101]===n.personaCreature?Ke=t[102]:(Ke=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Ke);let qe;t[103]===z.creature?qe=t[104]:(qe=Ne.some(e=>e.value===z.creature)?z.creature:`__custom__`,t[103]=z.creature,t[104]=qe);let Je;t[105]===k?Je=t[106]:(Je=e=>{if(e.target.value===`__custom__`){k({creature:``});return}k({creature:e.target.value})},t[105]=k,t[106]=Je);let Ye;t[107]===ce?Ye=t[108]:(Ye=Ne.map(e=>(0,Q.jsx)(q,{value:e.value,children:ce(e.labelEn,e.labelZh)},e.value)),t[107]=ce,t[108]=Ye);let Xe;t[109]===ce?Xe=t[110]:(Xe=ce(`Custom…`,`自定义…`),t[109]=ce,t[110]=Xe);let Ze;t[111]===Xe?Ze=t[112]:(Ze=(0,Q.jsx)(q,{value:`__custom__`,children:Xe}),t[111]=Xe,t[112]=Ze);let Qe;t[113]!==qe||t[114]!==Je||t[115]!==Ye||t[116]!==Ze?(Qe=(0,Q.jsxs)(se,{className:ae,value:qe,onChange:Je,children:[Ye,Ze]}),t[113]=qe,t[114]=Je,t[115]=Ye,t[116]=Ze,t[117]=Qe):Qe=t[117];let $e;t[118]!==n.personaCreaturePlaceholder||t[119]!==z.creature||t[120]!==k?($e=Ne.some(e=>e.value===z.creature)?null:(0,Q.jsx)(`input`,{className:i(ae,`mt-1 text-xs`),value:z.creature,onChange:e=>k({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=z.creature,t[120]=k,t[121]=$e):$e=t[121];let et;t[122]!==Ke||t[123]!==Qe||t[124]!==$e?(et=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ke,Qe,$e]}),t[122]=Ke,t[123]=Qe,t[124]=$e,t[125]=et):et=t[125];let tt;t[126]!==Fe||t[127]!==X||t[128]!==Ge||t[129]!==et?(tt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Fe,X,Ge,et]}),t[126]=Fe,t[127]=X,t[128]=Ge,t[129]=et,t[130]=tt):tt=t[130];let rt;t[131]!==De||t[132]!==tt||t[133]!==me?(rt=(0,Q.jsxs)(pt,{children:[me,De,tt]}),t[131]=De,t[132]=tt,t[133]=me,t[134]=rt):rt=t[134];let at;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(at=(0,Q.jsx)(ft,{icon:ct,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=at):at=t[137];let st;t[138]===n.modelPrimary?st=t[139]:(st=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=st);let lt;t[140]===_?lt=t[141]:(lt=e=>_(e),t[140]=_,t[141]=lt);let ut;t[142]!==c||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==g||t[147]!==lt?(ut=(0,Q.jsx)(te,{className:`min-w-0 flex-1`,value:g,disabled:c,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:lt}),t[142]=c,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=g,t[147]=lt,t[148]=ut):ut=t[148];let mt;t[149]!==n.modelClear||t[150]!==c||t[151]!==g||t[152]!==_?(mt=g.trim()?(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:c,onClick:()=>_(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=c,t[151]=g,t[152]=_,t[153]=mt):mt=t[153];let ht;t[154]!==ut||t[155]!==mt?(ht=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ut,mt]}),t[154]=ut,t[155]=mt,t[156]=ht):ht=t[156];let gt;t[157]!==st||t[158]!==ht?(gt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[st,ht]}),t[157]=st,t[158]=ht,t[159]=gt):gt=t[159];let _t;t[160]===n.workspacePath?_t=t[161]:(_t=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=_t);let vt=r.workingDirectory,yt=r.workingDirectory.notSet,bt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(bt=i(ae,`font-mono text-xs`),t[162]=bt):bt=t[162];let xt;t[163]!==c||t[164]!==r.workingDirectory||t[165]!==p||t[166]!==h?(xt=(0,Q.jsx)(Nt,{value:p,onChange:h,disabled:c,wd:vt,placeholder:yt,inputClassName:bt}),t[163]=c,t[164]=r.workingDirectory,t[165]=p,t[166]=h,t[167]=xt):xt=t[167];let St;t[168]!==_t||t[169]!==xt?(St=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[_t,xt]}),t[168]=_t,t[169]=xt,t[170]=St):St=t[170];let wt;t[171]!==gt||t[172]!==St?(wt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[gt,St]}),t[171]=gt,t[172]=St,t[173]=wt):wt=t[173];let Tt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==c||t[177]!==E||t[178]!==T||t[179]!==F?(Tt=E?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Y,{type:`button`,disabled:c,onClick:()=>void T(),children:n.save}),F?(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:c,onClick:F,children:[(0,Q.jsx)(ot,{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]=E,t[178]=T,t[179]=F,t[180]=Tt):Tt=t[180];let Et;t[181]!==at||t[182]!==wt||t[183]!==Tt?(Et=(0,Q.jsxs)(pt,{children:[at,wt,Tt]}),t[181]=at,t[182]=wt,t[183]=Tt,t[184]=Et):Et=t[184];let Dt;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]!==j||t[193]!==A||t[194]!==L||t[195]!==ce||t[196]!==D||t[197]!==H||t[198]!==U||t[199]!==W||t[200]!==V||t[201]!==P?(Dt=D?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Q.jsxs)(pt,{children:[(0,Q.jsx)(ft,{icon:nt,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:B.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`,Be.pressCard,V===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>A(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:ce(e.labelEn,e.labelZh)})]},e.id))})]}),V===`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(ye,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:W?n.personaSoulEdit:n.personaSoulPreview,"aria-label":W?n.personaSoulEdit:n.personaSoulPreview,onClick:P,children:W?(0,Q.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Se,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(ae,`flex min-h-64 flex-col overflow-hidden p-0`),children:W?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(ne,{content:H})}):(0,Q.jsx)(dt,{initialContent:H,onChange:j,isDark:L,className:`min-h-0 flex-1`},`soul-${U}`)})]}):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]=j,t[193]=A,t[194]=L,t[195]=ce,t[196]=D,t[197]=H,t[198]=U,t[199]=W,t[200]=V,t[201]=P,t[202]=Dt):Dt=t[202];let Ot;return t[203]!==rt||t[204]!==Et||t[205]!==Dt?(Ot=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[rt,Et,Dt]}),t[203]=rt,t[204]=Et,t[205]=Dt,t[206]=Ot):Ot=t[206],Ot}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 bg-surface-panel/80 px-4 py-3 shadow-surface`,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 bg-surface-panel/80 px-4 py-3 shadow-surface`,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=Ge(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]!==n||t[4]!==r?(m=P(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let h=m,g;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(g=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=g):g=t[9];let _=g,v;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(v=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=v):v=t[13];let y=v,b=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,x=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.tools.effectiveDisable.length,C=r.skills.effectiveAllowlist?.length,w;t[14]!==r.avatar||t[15]!==r.id?(w=(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)(it,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=w):w=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 j;t[33]!==A||t[34]!==k?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[33]=A,t[34]=k,t[35]=j):j=t[35];let M;t[36]!==j||t[37]!==w?(M=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[w,j]}),t[36]=j,t[37]=w,t[38]=M):M=t[38];let N;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(N=d?(0,Q.jsxs)(Y,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(ot,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=N):N=t[42];let F;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(F=r.isDefault?null:(0,Q.jsx)(Y,{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]=F):F=t[47];let I;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(I=o?null:(0,Q.jsx)(Y,{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]!==N||t[54]!==F||t[55]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[N,F,I]}),t[53]=N,t[54]=F,t[55]=I,t[56]=L):L=t[56];let R;t[57]!==M||t[58]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[M,L]}),t[57]=M,t[58]=L,t[59]=R):R=t[59];let z;t[60]===h?z=t[61]:(z=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=z);let B;t[62]!==R||t[63]!==z?(B=(0,Q.jsx)(pt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[R,z]})}),t[62]=R,t[63]=z,t[64]=B):B=t[64];let ee;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ee=(0,Q.jsx)(ft,{icon:re,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ee):ee=t[67];let V;t[68]!==n.modelPrimary||t[69]!==b||t[70]!==_?(V=(0,Q.jsx)(bn,{label:n.modelPrimary,value:_,badge:b,mono:!0}),t[68]=n.modelPrimary,t[69]=b,t[70]=_,t[71]=V):V=t[71];let te;t[72]!==n.workspacePath||t[73]!==x||t[74]!==y?(te=(0,Q.jsx)(bn,{label:n.workspacePath,value:y,badge:x,mono:!0}),t[72]=n.workspacePath,t[73]=x,t[74]=y,t[75]=te):te=t[75];let H;t[76]!==V||t[77]!==te?(H=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[V,te]}),t[76]=V,t[77]=te,t[78]=H):H=t[78];let U;t[79]!==ee||t[80]!==H?(U=(0,Q.jsxs)(pt,{children:[ee,H]}),t[79]=ee,t[80]=H,t[81]=U):U=t[81];let ne;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(ne=(0,Q.jsx)(ft,{icon:We,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=ne):ne=t[84];let W;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==S?(W=S>0?n.listToolsDisabledCount.replace(`{{count}}`,String(S)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=S,t[88]=W):W=t[88];let ie;t[89]!==n.listToolsLabel||t[90]!==W?(ie=(0,Q.jsx)(xn,{icon:ke,label:n.listToolsLabel,value:W}),t[89]=n.listToolsLabel,t[90]=W,t[91]=ie):ie=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==C?(G=C?n.listSkillsCount.replace(`{{count}}`,String(C)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=C,t[95]=G):G=t[95];let K;t[96]!==n.listSkillsLabel||t[97]!==G?(K=(0,Q.jsx)(xn,{icon:re,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=K):K=t[98];let q;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(q=(0,Q.jsx)(xn,{icon:T,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=q):q=t[101];let oe;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(oe=(0,Q.jsx)(xn,{icon:ae,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=oe):oe=t[104];let se;t[105]!==n.listWorkspaceLabel||t[106]!==y?(se=(0,Q.jsx)(xn,{icon:Je,label:n.listWorkspaceLabel,value:y}),t[105]=n.listWorkspaceLabel,t[106]=y,t[107]=se):se=t[107];let ce;t[108]!==ie||t[109]!==K||t[110]!==q||t[111]!==oe||t[112]!==se?(ce=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ie,K,q,oe,se]}),t[108]=ie,t[109]=K,t[110]=q,t[111]=oe,t[112]=se,t[113]=ce):ce=t[113];let le;t[114]!==ne||t[115]!==ce?(le=(0,Q.jsxs)(pt,{children:[ne,ce]}),t[114]=ne,t[115]=ce,t[116]=le):le=t[116];let ue;return t[117]!==B||t[118]!==U||t[119]!==le?(ue=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[B,U,le]}),t[117]=B,t[118]=U,t[119]=le,t[120]=ue):ue=t[120],ue}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)(ft,{className:`shrink-0`,icon:pe,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)(Y,{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)(Y,{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=I(`skills`),t[25]=w):w=t[25];let T;t[26]===n.skillsLibraryLink?T=t[27]:(T=(0,Q.jsx)(Xe,{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 E;t[28]!==C||t[29]!==T?(E=(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]=E):E=t[30];let D;t[31]===r.skills.preset?D=t[32]:(D=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=D);let O;t[33]!==n.skillsPresetLabel||t[34]!==D?(O=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,D]}),t[33]=n.skillsPresetLabel,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(k=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]=k):k=t[39];let A;t[40]!==n.skillsEffectiveLabel||t[41]!==k?(A=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,k]}),t[40]=n.skillsEffectiveLabel,t[41]=k,t[42]=A):A=t[42];let j;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?(j=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 bg-surface-panel/70 px-3 shadow-surface`,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]=j):j=t[53];let M;t[54]!==n.skillsSave||t[55]!==a||t[56]!==p||t[57]!==f?(M=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(Y,{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]=M):M=t[58];let N;return t[59]!==E||t[60]!==O||t[61]!==A||t[62]!==j||t[63]!==M||t[64]!==v?(N=(0,Q.jsxs)(pt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,E,O,A,j,M]}),t[59]=E,t[60]=O,t[61]=A,t[62]=j,t[63]=M,t[64]=v,t[65]=N):N=t[65],N}function wn(e){return e.name||e.directoryId}var Tn=[`write_file`,`apply_patch`,`exec_command`],En=[`exec_command`,`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 I=P||r.length===0&&h.length===0,L;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==I?(L=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:Dt,disabled:I,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=I,t[38]=L):L=t[38];let R=P||r.length===0&&h.length===0,z;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==R?(z=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:Dt,disabled:R,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=R,t[42]=z):z=t[42];let B=P||r.length===0,ee;t[43]===w?ee=t[44]:(ee=()=>w(Tn),t[43]=w,t[44]=ee);let V;t[45]!==f.quickReadOnlyWorkspace||t[46]!==B||t[47]!==ee?(V=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:Dt,disabled:B,onClick:ee,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=B,t[47]=ee,t[48]=V):V=t[48];let te=P||r.length===0,H;t[49]===w?H=t[50]:(H=()=>w(En),t[49]=w,t[50]=H);let U;t[51]!==f.quickHighRiskOff||t[52]!==te||t[53]!==H?(U=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:Dt,disabled:te,onClick:H,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=te,t[53]=H,t[54]=U):U=t[54];let ne=P||r.length===0,re;t[55]===w?re=t[56]:(re=()=>w(Dn),t[55]=w,t[56]=re);let W;t[57]!==f.quickNoOutbound||t[58]!==ne||t[59]!==re?(W=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:Dt,disabled:ne,onClick:re,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ne,t[59]=re,t[60]=W):W=t[60];let ie;t[61]!==L||t[62]!==z||t[63]!==V||t[64]!==U||t[65]!==W?(ie=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,z,V,U,W]}),t[61]=L,t[62]=z,t[63]=V,t[64]=U,t[65]=W,t[66]=ie):ie=t[66];let G;t[67]!==F||t[68]!==ie?(G=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,ie]}),t[67]=F,t[68]=ie,t[69]=G):G=t[69];let K;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?(K=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 bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,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]=K):K=t[84];let q;return t[85]!==G||t[86]!==K?(q=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[G,K]}),t[85]=G,t[86]=K,t[87]=q):q=t[87],q}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)(ft,{className:`shrink-0`,icon:ke,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)(Y,{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)(Y,{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)(pt,{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:I,setFileDraft:L,fileSaving:R,profileFileLoading:z,profileEditorNonce:B,toolEntryDisable:ee,setToolEntryDisable:V,onSaveTools:te,onClearToolsEntry:H,modelRows:U,setModelRows:ne,onSaveModels:re,onClearModelsEntry:W,skillsCatalogLoading:ie,catalogForPick:G,skillsInherit:K,setSkillsInherit:q,skillsPick:ae,setSkillsPick:oe,onSaveSkills:se,bindingsLoading:ce,agentBindings:le,bindChannelStatuses:ue,bindChannelsLoading:de,useManualChannel:fe,newBindChannel:pe,setNewBindChannel:me,bindSessionChats:he,bindSessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:be,refreshBindSessions:J,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]!==U||t[43]!==W||t[44]!==re||t[45]!==a||t[46]!==ne?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(pn,{a:n,chat:r,selected:a,busy:c,modelRows:U,setModelRows:ne,onSaveModels:re,onClearModelsEntry:W})}),t[39]=n,t[40]=c,t[41]=r,t[42]=U,t[43]=W,t[44]=re,t[45]=a,t[46]=ne,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==R||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Ce||t[56]!==B||t[57]!==z||t[58]!==N||t[59]!==L||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(dn,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:R,profileFileLoading:z,profileEditorNonce:B,onTryInChat:Ce})}),t[48]=n,t[49]=M,t[50]=I,t[51]=R,t[52]=j,t[53]=A,t[54]=P,t[55]=Ce,t[56]=B,t[57]=z,t[58]=N,t[59]=L,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]!==H||t[70]!==te||t[71]!==a||t[72]!==V||t[73]!==ee?(e=(0,Q.jsx)(jn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:ee,setToolEntryDisable:V,onSaveTools:te,onClearToolsEntry:H}),t[66]=n,t[67]=c,t[68]=s,t[69]=H,t[70]=te,t[71]=a,t[72]=V,t[73]=ee,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==G||t[78]!==se||t[79]!==a||t[80]!==q||t[81]!==oe||t[82]!==ie||t[83]!==K||t[84]!==ae?(e=(0,Q.jsx)(Cn,{a:n,selected:a,busy:c,skillsCatalogLoading:ie,catalogForPick:G,skillsInherit:K,setSkillsInherit:q,skillsPick:ae,setSkillsPick:oe,onSaveSkills:se}),t[75]=n,t[76]=c,t[77]=G,t[78]=se,t[79]=a,t[80]=q,t[81]=oe,t[82]=ie,t[83]=K,t[84]=ae,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(Ut,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==le||t[90]!==ue||t[91]!==de||t[92]!==he||t[93]!==ge||t[94]!==ce||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]!==J||t[104]!==me||t[105]!==be||t[106]!==ve||t[107]!==fe?(e=(0,Q.jsx)(un,{a:n,busy:c,bindingsLoading:ce,agentBindings:le,channelStatuses:ue,channelsStatusLoading:de,useManualChannel:fe,newBindChannel:pe,setNewBindChannel:me,bindSessionChats:he,sessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:be,onRefreshSessions:J,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:xe,onAddBinding:Se}),t[88]=n,t[89]=le,t[90]=ue,t[91]=de,t[92]=he,t[93]=ge,t[94]=ce,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]=J,t[104]=me,t[105]=be,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)(tn,{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)(cn,{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=Ge(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=P(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)(M,{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`,Ue),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(oe,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(E,{children:(0,Q.jsxs)(le,{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)(F,{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,m,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){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Fn(r,c,n),_=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:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),g=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==_?(h=_?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listEmpty}):null,t[16]=n,t[17]=_,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let v;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(v=e=>{let t=Ge(e,n),r=e.id,c=P(e,n),f=Ln(e,n),p=Rn(e,n),m=e.id===a||e.isDefault,h=e.id===o,g=h&&s,_=h&&!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 bg-surface-panel p-4 shadow-surface`,`transition-[background-color,transform,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/45`,`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`,Be.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)(it,{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:[m?(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,_?(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,g?(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,!m&&!h?(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 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)(Y,{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)(ot,{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]=v):v=t[26],p=e.map(v)}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]=m,t[12]=h,t[13]=g}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=_):_=t[29];let v;return t[30]!==m||t[31]!==h||t[32]!==_?(v=(0,Q.jsxs)(`div`,{className:m,children:[h,_]}),t[30]=m,t[31]=h,t[32]=_,t[33]=v):v=t[33],v}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)(131),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:h,setCreateDescription:g,createWorkspace:_,setCreateWorkspace:v,createModel:b,setCreateModel:S,onCreate:C,onSuggestWorkspace:T,agents:E,duplicateSourceId:D,onSelectDuplicateSource:O}=e,[k,A]=(0,$.useState)(null),j;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(ee,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,N)}),t[0]=j):j=t[0];let M;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(M=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`,w,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=M):M=t[1];let P;t[2]===a.addAgent?P=t[3]:(P=(0,Q.jsx)(je,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=P);let F;t[4]===a.addAgentHint?F=t[5]:(F=(0,Q.jsx)(y,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=F);let I;t[6]!==P||t[7]!==F?(I=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[P,F]}),t[6]=P,t[7]=F,t[8]=I):I=t[8];let L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=i(ye,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=L):L=t[9];let R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(Le,{className:`size-4`,"aria-hidden":!0}),t[10]=R):R=t[10];let z;t[11]===a.closeDialogAria?z=t[12]:(z=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:L,"aria-label":a.closeDialogAria,children:R})}),t[11]=a.closeDialogAria,t[12]=z);let B;t[13]!==I||t[14]!==z?(B=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[I,z]}),t[13]=I,t[14]=z,t[15]=B):B=t[15];let V;t[16]!==a||t[17]!==E||t[18]!==D||t[19]!==O?(V=E.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)(se,{className:i(Ct(),`bg-surface-panel`),value:D??``,onChange:e=>O(e.target.value||null),children:[(0,Q.jsx)(q,{value:``,children:a.copyFromExistingAgentNone}),E.map(e=>(0,Q.jsxs)(q,{value:e.id,children:[Ge(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]=E,t[18]=D,t[19]=O,t[20]=V):V=t[20];let H;t[21]===c?H=t[22]:(H=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]=H);let U;t[23]!==a.newAgentLabel||t[24]!==l?(U=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=U):U=t[25];let ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=Ct(),t[26]=ne):ne=t[26];let re;t[27]===d?re=t[28]:(re=e=>d(e.target.value),t[27]=d,t[28]=re);let W;t[29]===T?W=t[30]:(W=()=>T(),t[29]=T,t[30]=W);let G;t[31]!==u||t[32]!==re||t[33]!==W?(G=(0,Q.jsx)(`input`,{className:ne,value:u,onChange:re,onBlur:W,required:!0,autoComplete:`off`}),t[31]=u,t[32]=re,t[33]=W,t[34]=G):G=t[34];let K;t[35]!==U||t[36]!==G?(K=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[U,G]}),t[35]=U,t[36]=G,t[37]=K):K=t[37];let ae;t[38]===a.newAgentIdOptional?ae=t[39]:(ae=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=ae);let oe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(oe=i(Ct(),`font-mono text-xs`),t[40]=oe):oe=t[40];let le;t[41]===p?le=t[42]:(le=e=>p(e.target.value),t[41]=p,t[42]=le);let ue;t[43]===T?ue=t[44]:(ue=()=>T(),t[43]=T,t[44]=ue);let de;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==le||t[49]!==ue?(de=(0,Q.jsx)(`input`,{className:oe,value:f,onChange:le,onBlur:ue,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]=le,t[49]=ue,t[50]=de):de=t[50];let fe;t[51]===a.newAgentIdRules?fe=t[52]:(fe=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=fe);let pe;t[53]!==ae||t[54]!==de||t[55]!==fe?(pe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ae,de,fe]}),t[53]=ae,t[54]=de,t[55]=fe,t[56]=pe):pe=t[56];let me;t[57]!==a.agentDescription||t[58]!==l?(me=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=me):me=t[59];let he;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(he=i(Ct(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=he):he=t[60];let ge;t[61]===g?ge=t[62]:(ge=e=>g(e.target.value),t[61]=g,t[62]=ge);let _e;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==ge?(_e=(0,Q.jsx)(`textarea`,{className:he,value:h,onChange:ge,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==me||t[68]!==_e?(ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[me,_e]}),t[67]=me,t[68]=_e,t[69]=ve):ve=t[69];let be;t[70]===a.newWorkspace?be=t[71]:(be=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=be);let xe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(xe=i(Ct(),`font-mono text-xs`),t[72]=xe):xe=t[72];let Se;t[73]===v?Se=t[74]:(Se=e=>v(e.target.value),t[73]=v,t[74]=Se);let Ce;t[75]!==_||t[76]!==Se?(Ce=(0,Q.jsx)(`input`,{className:xe,value:_,onChange:Se,required:!0,autoComplete:`off`}),t[75]=_,t[76]=Se,t[77]=Ce):Ce=t[77];let we;t[78]!==be||t[79]!==Ce?(we=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[be,Ce]}),t[78]=be,t[79]=Ce,t[80]=we):we=t[80];let Te;t[81]===a.newModelOptional?Te=t[82]:(Te=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=Te);let Ee;t[83]===S?Ee=t[84]:(Ee=e=>S(e),t[83]=S,t[84]=Ee);let De;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==b||t[90]!==Ee?(De=(0,Q.jsx)(te,{className:`min-w-0 flex-1`,value:b,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:Ee}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=b,t[90]=Ee,t[91]=De):De=t[91];let Oe;t[92]!==a.modelClear||t[93]!==s||t[94]!==b||t[95]!==S?(Oe=b.trim()?(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>S(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=b,t[95]=S,t[96]=Oe):Oe=t[96];let ke;t[97]!==De||t[98]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[De,Oe]}),t[97]=De,t[98]=Oe,t[99]=ke):ke=t[99];let Ae;t[100]!==Te||t[101]!==ke?(Ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Te,ke]}),t[100]=Te,t[101]=ke,t[102]=Ae):Ae=t[102];let Me;t[103]!==a.createModalCancel||t[104]!==s?(Me=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Me):Me=t[105];let Ne;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(J,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=Ne):Ne=t[106];let Fe;t[107]!==a.create||t[108]!==s?(Fe=(0,Q.jsxs)(Y,{type:`submit`,disabled:s,children:[Ne,a.create]}),t[107]=a.create,t[108]=s,t[109]=Fe):Fe=t[109];let Ie;t[110]!==Me||t[111]!==Fe?(Ie=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Me,Fe]}),t[110]=Me,t[111]=Fe,t[112]=Ie):Ie=t[112];let Re;t[113]!==C||t[114]!==H||t[115]!==K||t[116]!==pe||t[117]!==ve||t[118]!==we||t[119]!==Ae||t[120]!==Ie||t[121]!==V?(Re=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:C,children:[V,H,K,pe,ve,we,Ae,Ie]}),t[113]=C,t[114]=H,t[115]=K,t[116]=pe,t[117]=ve,t[118]=we,t[119]=Ae,t[120]=Ie,t[121]=V,t[122]=Re):Re=t[122];let ze;t[123]!==k||t[124]!==Re||t[125]!==B?(ze=(0,Q.jsxs)(Pe,{children:[j,(0,Q.jsx)(x,{ref:A,className:M,onOpenAutoFocus:Un,children:(0,Q.jsxs)(ce,{layer:`modal`,portalContainer:k,children:[B,Re]})})]}),t[123]=k,t[124]=Re,t[125]=B,t[126]=ze):ze=t[126];let Be;return t[127]!==r||t[128]!==n||t[129]!==ze?(Be=(0,Q.jsx)(m,{open:n,onOpenChange:r,children:ze}),t[127]=r,t[128]=n,t[129]=ze,t[130]=Be):Be=t[130],Be}function Un(e){return e.preventDefault()}var Wn=`~/.xopc/workspace`;function Gn(e){let t=e.trim();return t?`${Wn}/${st(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)(j,{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 bg-surface-panel 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)(Ve,{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)(Y,{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=rt(async()=>{if(!t)return null;let[e,n]=await Promise.all([ve(t,`IDENTITY.md`).catch(()=>``),ve(t,`SOUL.md`).catch(()=>``)]),r=L(e);return{identity:r,soulTemplate:O(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]),_=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=B.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),v=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),y=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),b=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),x=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([X(e,`IDENTITY.md`,ut(f.identity)),X(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=x,()=>{r.current=null}},[x,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:_,handleSoulContentChange:v,setAvatarDialogOpen:y,toggleSoulPreviewMode:b}}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=rt(()=>n?U(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),[_,v]=(0,$.useState)(`edit`),y=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==y.current&&(y.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 b=p.draft,x=p.editorNonce,S=(0,$.useRef)(b);S.current=b;let C=(0,$.useRef)(n);C.current=n;let w=(0,$.useRef)(d);w.current=d;let T=(0,$.useRef)(null),E=(0,$.useRef)(``),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(()=>{}),A=rt(()=>d&&n?ve(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),j=A.loading,M=ge(async()=>{let e=C.current,t=w.current;if(!e||!t||`${e}:${t}`!==E.current)return;let n=S.current;if(n!==D.current){g(!0),o(null);try{await X(e,t,n),D.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);k.current=M.flush,(0,$.useEffect)(()=>()=>{k.current()},[]);let N=(0,$.useRef)(t);N.current!==t&&(N.current===`behavior`&&k.current(),N.current=t);let P=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{P!==O.current&&(k.current(),O.current=P)},[P]),(0,$.useEffect)(()=>{if(!P){m({type:`clear`});return}j||(E.current=P,D.current=A.data,m({type:`load`,key:P,content:A.data}))},[P,j,A.data]);let F=(0,$.useRef)({activeFile:d,selectedId:n});return(F.current.activeFile!==d||F.current.selectedId!==n)&&(F.current={activeFile:d,selectedId:n},v(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{k.current(),f(e)},[]),fileDraft:b,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(S.current):e}),M()},[M]),fileSaving:h,filesViewMode:_,setFilesViewMode:v,profileFileLoading:j,profileEditorNonce:x,overviewSaveProfileMarkdownRef:T,saveProfileMarkdownDebounced:M}}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=rt(()=>vt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,b]=(0,$.useState)(``),x=(0,$.useRef)(v);t===`connections`&&!_&&v&&x.current!==v&&(!y||!g.some(e=>e.name===y))&&(x.current=v,b(v)),x.current=v;let S=y.trim(),C=m&&S.length>0,w=rt(()=>yt(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,k]=(0,$.useState)(null),[A,j]=(0,$.useState)(``),M=(0,$.useRef)(S);M.current!==S&&(M.current=S,k(null));let N=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),P=(0,$.useCallback)(()=>{let e=y.trim();e&&yt(e).then(e=>{D(e),k(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),k(null)})},[y,D]),F=!_&&g.length===0,I=t===`connections`&&n&&i,L=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await Ae(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:N,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:T,bindSessionsLoading:E,bindingsLoading:I,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:O,setNewBindSessionIdx:k,newBindCustomPeer:A,setNewBindCustomPeer:j,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=xt(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await Ae(n),l.current=!0,d(n),k(null),j(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,A,O,o,a,s,c]),onRemoveBinding:L,refreshBindSessions:P,useManualChannel:F}}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}=rt(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 $e()}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,_=t.chat,v=!!c(e=>e.token),[y,b]=De(),x=et(),{agentId:S}=Ce(),C=R(e=>e.setPageHeader),w=R(e=>e.clearPageHeader),{data:T,error:E,isLoading:D,mutate:O}=d(v?`settings-gateway-agents`:null,we,{revalidateOnFocus:!1}),{data:k,mutate:j}=d(v?`settings-capability-presets`:null,jt,{revalidateOnFocus:!1}),M=qe(v),{data:N}=M,P=(0,$.useMemo)(()=>Ye(N?.payload?.config??{}),[N]),F=T??null,I=(0,$.useMemo)(()=>F?F.agents.find(e=>e.id===F.defaultId)??F.agents[0]??null:null,[F]),L=!!(v&&D),[z,B]=(0,$.useState)(null),ee=E instanceof Error?E.message:E?n.loadError:null,V=z??ee,[te,H]=(0,$.useState)(null),[U,ne]=(0,$.useState)(`overview`),[re,ie]=(0,$.useState)(``),[G,K]=(0,$.useState)(``),[q,ae]=(0,$.useState)(``),[oe,se]=(0,$.useState)(``),[ce,le]=(0,$.useState)(``),[ue,fe]=(0,$.useState)(null),[pe,he]=(0,$.useState)(!1),ge=(0,$.useRef)(``),[_e,ve]=(0,$.useState)(null),[ye,J]=(0,$.useState)(!1),[Se,Te]=(0,$.useState)(``),[Ee,Y]=(0,$.useState)(``),[Oe,ke]=(0,$.useState)(``),[Ae,je]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),[Pe,Fe]=(0,$.useState)(``),Ie=(0,$.useRef)(null),[Le,ze]=(0,$.useState)(!1),Be=(0,$.useRef)({data:null,routeAgentId:void 0});F&&(F!==Be.current.data||S!==Be.current.routeAgentId)&&(Be.current={data:F,routeAgentId:S},S&&F.agents.some(e=>e.id===S)?H(S):H(e=>e&&F.agents.some(t=>t.id===e)?e:F.defaultId)),(0,$.useEffect)(()=>{!F||!S||F.agents.some(e=>e.id===S)||x(Ze,{replace:!0})},[F,S,x]),(0,$.useEffect)(()=>{S&&ne(`overview`)},[S]),(0,$.useEffect)(()=>{y.get(`panel`)===`defaults`&&x(S?Re(S):Ze,{replace:!0,state:{[g]:S?Re(S):Ze}})},[y,S,x]),(0,$.useEffect)(()=>{if(y.get(`focus`)!==`avatar`||!S||(ne(`overview`),L||!F?.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)},[y,S,L,F,b]);let X=(0,$.useMemo)(()=>F?.agents.find(e=>e.id===te)??null,[F,te]),Ve=(0,$.useMemo)(()=>{let e=N?.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():``},[N]),He=(0,$.useMemo)(()=>!F||Ve&&F.agents.some(e=>e.id===Ve)?Ve:F.defaultId||F.agents[0]?.id||Ve,[F,Ve]),Ue=!!(F&&Ve&&!F.agents.some(e=>e.id===Ve));(0,$.useEffect)(()=>{Y(Ue?``:Ve)},[Ve,Ue]);let We=(0,$.useRef)(null),Ke=X?X.id:null;X&&We.current!==Ke?(We.current=Ke,ke(X.workspace),je(X.model?.primary??``),Ne(Ge(X,a(e).agentsSettings)),Fe(X.description??``)):!X&&We.current!==null&&(We.current=null,ke(``),je(``),Ne(``),Fe(``));let Je=Jn({agentId:X?.id??null,enabled:U===`behavior`&&!!X,saveRef:Ie}),Xe=Zn({panel:U,selectedId:te,hasToken:v,dataAgentsLength:F?.agents.length,saveErrorMessage:n.saveError,setError:B}),Qe=or({panel:U,selected:X}),$e=Qn({panel:U,hasToken:v,bindingsFromConfig:P,gatewayCfgLoading:N===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:J,setError:B}),tt=rr({panel:U,hasToken:v}),nt=(0,$.useCallback)(()=>{let e=Gn(G.trim()||re);se(t=>t===``||t===ge.current?(ge.current=e,e):t)},[G,re]),rt=(0,$.useCallback)(()=>{ge.current=``,ie(``),K(``),ae(``),se(``),le(``),fe(null),ve(null),he(!0)},[]),it=(0,$.useCallback)(e=>{let t=new Set(F?.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,F]),at=(0,$.useCallback)(e=>{if(ve(e),!e)return;let t=F?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=it(t.id),o=t.description??``;ge.current=``,ie(i),K(a),ae(o),se(t.workspace),le(t.model?.primary??``),fe(null)},[n.duplicateName,F,it]),ot=(0,$.useCallback)(e=>{at(e),he(!0)},[at]),st=(0,$.useMemo)(()=>(0,Q.jsx)(Kn,{a:n,busy:ye,listSearchQuery:Se,onListSearchQueryChange:Te,onAddAgent:()=>rt()}),[n,ye,Se,rt]);(0,$.useLayoutEffect)(()=>v?(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:st}),()=>w()):(w(),()=>w()),[n.title,st,w,v,C]);async function ct(t){t.preventDefault();let r=re.trim();if(!r)return;let i=W(G,r);if(i.ok===!1){fe(i.error);return}let a=oe.trim()||Gn(G.trim()||r);if(a){J(!0),fe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${q.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
-
`),{createdAgentId:n,...i}=await A({workspace:a,...G.trim()?{id:G.trim()}:{},...ce.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:ce.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},..._e?{cloneFrom:_e}:{}});O(i,{revalidate:!1}),ie(``),K(``),ae(``),se(``),le(``),fe(null),he(!1),H(n),x(Re(n))}catch(e){fe(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function lt(){if(X){J(!0),B(null);try{O(await xe(X.id,{workspace:Oe.trim()||void 0,...Ae.trim()?{models:sr(X,Ae.trim())}:{}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function ut(e){J(!0),B(null);try{O(await xe(e.id,{setDefault:!0}),{revalidate:!1}),H(e.id)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function dt(){let e=Ee.trim().toLowerCase();if(e&&!F?.agents.some(t=>t.id===e)){B(n.tuiDefaultAgentInvalid);return}J(!0),B(null);try{await be(e||null),await M.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ft(e){J(!0),B(null);try{await be(e.id),Y(e.id),await M.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function pt(){J(!0),B(null);try{await be(null),Y(``),await M.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function mt(e,t){J(!0),B(null);try{let n=await de(e.id,t);O(n,{revalidate:!1}),H(n.defaultId),ne(`overview`),S===e.id&&x(Ze,{replace:!0}),i(!1),l(null),m(``)}catch(e){B(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(X){J(!0),B(null);try{O(await xe(X.id,{tools:{builtin:lr(Qe.toolEntryDisable)}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function _t(){if(X){J(!0),B(null);try{O(await xe(X.id,{tools:null}),{revalidate:!1}),Qe.setToolEntryDisable(new Set)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function vt(){if(!X)return;let e=wt(Qe.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){B(e);return}J(!0),B(null);try{O(await xe(X.id,{models:{roles:Ot(Qe.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function yt(){if(!X)return;let e=cr(X),t=Ot(e);if(!t?.roles?.[X.typedModels.defaultRole]){B(n.typedModelsInvalidModel);return}J(!0),B(null);try{O(await xe(X.id,{models:{defaultRole:X.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Qe.setModelRows(e)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function bt(){if(X){J(!0),B(null);try{O(await xe(X.id,{skills:Qe.skillsInherit?null:[...Qe.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function xt(e){if(X){J(!0),B(null);try{O(await xe(X.id,{extends:e}),{revalidate:!1}),j()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}let St=U!==`behavior`,Ct=(()=>{if(!X||U!==`behavior`)return!1;let e=X.workspace,t=X.model?.primary??``;return Oe.trim()!==e||Ae.trim()!==t})(),Tt=(()=>{if(St||!X)return!1;switch(U){case`behavior`:return Ct||Je.dirty;default:return!0}})(),Et=St||!Tt;function Dt(){ze(!0),setTimeout(()=>ze(!1),2e3)}async function kt(){switch(U){case`behavior`:await Promise.all([lt(),Ie.current?.()??Promise.resolve()]),Dt();break;default:break}}function At(e){e||x(Ze)}let Mt=X?Me.trim()||Ge(X,n):S??``,Nt=X?.id??S??``,Z=(0,$.useCallback)(async()=>{if(X){await kt(),Xe.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(me,X.id)}catch{}x(`/chat/new`,{state:{agentId:X.id,fromAgentEditor:!0}})}},[X,kt,Xe.saveProfileMarkdownDebounced,x]),Pt={a:n,chat:_,cCron:h,selected:X,panel:U,data:F,busy:ye,editName:Me,setEditName:Ne,editDescription:Pe,setEditDescription:Fe,editWorkspace:Oe,setEditWorkspace:ke,editModel:Ae,setEditModel:je,defaultModel:I?.model?.primary??``,defaultWorkspace:I?.workspace??``,onSetDefault:()=>{X&&ut(X)},onSetTuiDefault:()=>{X&&ft(X)},isTuiDefault:!!(X&&X.id===He),isTuiDefaultInherited:!!(X&&X.id===He&&(!Ve||Ue)),onSaveAgentEdits:()=>void lt(),onDelete:e=>{X&&ht(X,e)},onTryInChat:()=>void Z(),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:Ie,overviewProfile:Je,filesLoading:Xe.filesLoading,files:Xe.files,activeFile:Xe.activeFile,setActiveFile:Xe.setActiveFile,filesViewMode:Xe.filesViewMode,setFilesViewMode:Xe.setFilesViewMode,fileDraft:Xe.fileDraft,setFileDraft:Xe.setFileDraft,fileSaving:Xe.fileSaving,profileFileLoading:Xe.profileFileLoading,profileEditorNonce:Xe.profileEditorNonce,toolEntryDisable:Qe.toolEntryDisable,setToolEntryDisable:Qe.setToolEntryDisable,onSaveTools:()=>void gt(),onClearToolsEntry:()=>void _t(),modelRows:Qe.modelRows,setModelRows:Qe.setModelRows,onSaveModels:()=>void vt(),onClearModelsEntry:()=>void yt(),skillsCatalogLoading:tt.skillsCatalogLoading,catalogForPick:tt.catalogForPick,skillsInherit:Qe.skillsInherit,setSkillsInherit:Qe.setSkillsInherit,skillsPick:Qe.skillsPick,setSkillsPick:Qe.setSkillsPick,onSaveSkills:()=>void bt(),bindingsLoading:$e.bindingsLoading,agentBindings:$e.agentBindings,bindChannelStatuses:$e.bindChannelStatuses,bindChannelsLoading:$e.bindChannelsLoading,useManualChannel:$e.useManualChannel,newBindChannel:$e.newBindChannel,setNewBindChannel:$e.setNewBindChannel,bindSessionChats:$e.bindSessionChats,bindSessionsLoading:$e.bindSessionsLoading,newBindSessionIdx:$e.newBindSessionIdx,setNewBindSessionIdx:$e.setNewBindSessionIdx,newBindCustomPeer:$e.newBindCustomPeer,setNewBindCustomPeer:$e.setNewBindCustomPeer,refreshBindSessions:$e.refreshBindSessions,onRemoveBinding:e=>void $e.onRemoveBinding(e),onAddBinding:$e.onAddBinding};return{hasToken:v,a:n,chat:_,language:e,data:F,savedTuiDefaultAgentId:Ve,effectiveTuiDefaultAgentId:He,tuiDefaultAgentDraft:Ee,setTuiDefaultAgentDraft:Y,tuiDefaultAgentUnavailable:Ue,onSaveTuiDefaultAgent:dt,onSetTuiDefaultAgent:ft,onClearTuiDefaultAgent:pt,onSetDefaultAgent:ut,loading:L,displayError:V,navigate:x,routeAgentId:S,busy:ye,listSearchQuery:Se,openAddAgentModal:rt,openDuplicateAgentModal:ot,duplicateSourceId:_e,onSelectDuplicateSource:at,panel:U,setPanel:ne,modalTitle:Mt,modalSubtitle:Nt,footerSaveDisabled:Et,savedFlash:Le,handleModalFooterSave:kt,onAgentModalOpenChange:At,addAgentModalOpen:pe,setAddAgentModalOpen:he,createWorkspaceSuggestedRef:ge,createModalError:ue,setCreateModalError:fe,createDisplayName:re,setCreateDisplayName:ie,createAgentId:G,setCreateAgentId:K,createDescription:q,setCreateDescription:ae,createWorkspace:oe,setCreateWorkspace:se,createModel:ce,setCreateModel:le,onCreate:ct,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:nt,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-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 shadow-surface dark:text-red-300`,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(Re(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(me,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Rt,{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)(Pt,{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-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,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,4 +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-C22hxE1N.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{Aa as l,Ea as u,Ic as d,Ma as f,Oa as p,Ro as m,Ta as h,To as g,Ua as _,Va as v,Vc as y,cs as b,ea as x,ec as S,es as C,fc as w,fl as T,fo as E,ja as D,ka as O,mo as k,mt as ee,ol as A,os as j,po as M,ps as te,sl as ne,ui as N,y as P}from"./index-CA2tR2vm.js";import{t as F}from"./format-cron-label-arqgGlVV.js";import{i as I,n as L,o as re,r as ie,t as ae}from"./dist-By6Rh2ee.js";import{i as oe,n as R,r as se,t as z}from"./workflow-run-setup-panel-BTkRVNAh.js";var B=n(),V=e(t(),1),H=r(),U={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 ce(e){return e===`zh`?`zh-CN`:`en-US`}function W(e,t,n){return e?new Intl.DateTimeFormat(ce(n),{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)):t.never}function G(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}`,W(Date.parse(i.at),t,r)):i.kind===`interval`?t.trigger.everyMinutes.replace(`{minutes}`,String(Math.round(i.everyMs/6e4))):F(i.expr,ce(r),n.scheduleBadge,{timezone:i.tz})}function K(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 q(e){return e.safety?.mode??`auto_apply`}function le(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 ue(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 J(e){return e.status===`running`||e.status===`queued`}function de(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function Y(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function fe(e){return!!Y(e)}function pe(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function X(e){return J(e)?0:de(e)?1:e.status===`succeeded`?2:3}function me(e){return[...e].sort((e,t)=>{let n=X(e)-X(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function he(e){let t=(0,B.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,V.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,V.useEffect)(a,o),r}function ge(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 _e(){let e=o(e=>e.language),t=a(e),n=t.automations,r=t.cron,d=f(e=>e.setPageHeader),m=f(e=>e.clearPageHeader),[g,_]=T(),v=g.get(`run`)?.trim()??``,y=g.get(`draft`)?.trim()??``,b=g.get(`action`)?.trim()??``,S=g.get(`projectId`)?.trim()??``,C=g.get(`autogenerate`)===`1`,w=(0,V.useRef)(``),A=he(`(min-width: 1280px)`),[M,te]=(0,V.useState)(`activity`),[ne,F]=(0,V.useState)(!1),[oe,R]=(0,V.useState)(`blank`),[z,B]=(0,V.useState)(U),[ce,G]=(0,V.useState)(null),[K,q]=(0,V.useState)(null),[le,ue]=(0,V.useState)(!1),[J,Y]=(0,V.useState)(null),[pe,X]=(0,V.useState)(``),[_e,be]=(0,V.useState)(null),[xe,we]=(0,V.useState)(!1),[Te,Ee]=(0,V.useState)(!1),[Z,ke]=(0,V.useState)(null),[Ae,je]=(0,V.useState)(!1),[Ne,Pe]=(0,V.useState)(!1),[Q,$]=(0,V.useState)(!1),[Fe,Ie]=(0,V.useState)(null),Le=c([`automations`,S],()=>P.list(S?{projectId:S}:void 0),{refreshInterval:15e3}),Re=c([`automation-runs`,S],()=>P.runs(50,void 0,S?{projectId:S}:void 0),{refreshInterval:1e4}),ze=c(`automation-metrics`,()=>P.metrics(),{refreshInterval:15e3}),Be=c(K?`automation-run-events:${K}`:null,()=>P.runEvents(K),{refreshInterval:5e3}),Ve=c(`automation-workflow-definitions`,ee),He=c(`automation-chat-agents`,x),Ue=Le.data?.automations??[],We=(0,V.useMemo)(()=>me(Re.data?.runs??[]),[Re.data?.runs]),Ge=(0,V.useMemo)(()=>Ue.filter(e=>!fe(e)),[Ue]),Ke=(0,V.useMemo)(()=>Ue.filter(fe),[Ue]),qe=(0,V.useMemo)(()=>new Set(Ke.map(e=>e.id)),[Ke]),Je=(0,V.useMemo)(()=>We.filter(e=>!qe.has(e.automationId)),[We,qe]),Ye=(0,V.useMemo)(()=>{let e;for(let t of Ge){let n=t.state.nextRunAtMs;n&&(e==null||n<e)&&(e=n)}return e},[Ge]),Xe=(0,V.useMemo)(()=>We.find(e=>e.id===K)??null,[We,K]),Ze=(0,V.useMemo)(()=>Ue.find(e=>e.id===J)??null,[Ue,J]),Qe=(0,V.useMemo)(()=>We.filter(e=>e.automationId===J),[We,J]),$e=Be.data?.events??[],et=(0,V.useMemo)(()=>Je.filter(de),[Je]),tt=Je[0]??null,nt=(0,V.useMemo)(()=>Ve.data??[],[Ve.data]),rt=He.data?.items??[],it=(0,V.useMemo)(()=>nt.find(e=>e.id===z.workflowId.trim())??null,[z.workflowId,nt]),at=z.actionMode===`workflow`&&(!z.workflowId.trim()||nt.length>0&&!nt.some(e=>e.id===z.workflowId)),ot=z.actionMode===`workflow`&&it?!se(it,z.workflowInput,z.workflowInputValid).valid:!1,st=!!z.name.trim()&&(z.actionMode===`workflow`?!at&&!ot:!!z.instruction.trim())&&(z.afterRunMode!==`webhook`||!!z.webhookUrl.trim()),ct=(0,V.useMemo)(()=>[{name:n.templates.dailyAgent.name,description:n.templates.dailyAgent.description,form:{...U,name:n.templates.dailyAgent.name,instruction:n.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:n.templates.morningWorkflow.name,description:n.templates.morningWorkflow.description,form:{...U,name:n.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:nt[0]?.id??``}},{name:n.templates.webhookAgent.name,description:n.templates.webhookAgent.description,form:{...U,name:n.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:n.templates.blockedGoal.name,description:n.templates.blockedGoal.description,form:{...U,name:n.templates.blockedGoal.formName,triggerMode:`goalBlocked`,instruction:n.templates.blockedGoal.instruction}},{name:n.templates.noteCreated.name,description:n.templates.noteCreated.description,form:{...U,name:n.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:n.templates.noteCreated.instruction}}],[n,nt]),lt=(0,V.useCallback)(async()=>{await Promise.all([Le.mutate(),Re.mutate(),ze.mutate(),Be.mutate()])},[Le.mutate,ze.mutate,Be.mutate,Re.mutate]),ut=(0,V.useCallback)(e=>{R(e),F(!0),e===`blank`&&B(U)},[]),dt=(0,V.useCallback)(async()=>{$(!0),G(null);try{await lt()}catch(e){let t=e instanceof Error?e.message:String(e);G(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}finally{$(!1)}},[n.feedback.actionFailed,lt]);(0,V.useEffect)(()=>{v&&(te(`activity`),q(v),A||ue(!0))},[v,A]),(0,V.useEffect)(()=>{A&&ue(!1)},[A]),(0,V.useEffect)(()=>{b===`create`&&(ut(`blank`),_(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[b,ut,_]),(0,V.useEffect)(()=>{if(!y)return;let t=`${e}:${C?`auto`:`seed`}:${y}`;w.current!==t&&(w.current=t,X(y),be(null),Ee(!1),R(`draft`),F(!0),_(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),C&&(G(null),we(!0),P.draft({prompt:y,language:e}).then(e=>{be(e.draft),Ee(!1)}).catch(e=>{G(e instanceof Error?e.message:String(e))}).finally(()=>{we(!1)})))},[C,y,e,_]);let ft=(0,V.useCallback)(e=>{q(e),A||ue(!0),_(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[_,A]);(0,V.useEffect)(()=>{ke(null),Pe(!1)},[K]);async function pt(){if(G(null),st)try{await P.create({...ge(z,it),...S?{projectId:S}:{}}),B(U),F(!1),await lt(),s({type:`success`,title:n.dashboard.created})}catch(e){let t=e instanceof Error?e.message:String(e);G(t),s({type:`error`,title:n.feedback.actionFailed,message:t})}}async function mt(e,t,r){G(null),Ie(e);try{return await t(),await lt(),r&&s({type:`success`,title:r}),!0}catch(e){let t=e instanceof Error?e.message:String(e);return G(t),s({type:`error`,title:n.feedback.actionFailed,message:t}),!1}finally{Ie(null)}}async function ht(){let t=pe.trim();if(t){G(null),we(!0);try{be((await P.draft({prompt:t,language:e})).draft),Ee(!1)}catch(e){G(e instanceof Error?e.message:String(e))}finally{we(!1)}}}async function gt(){_e&&await mt(`draft:publish`,async()=>{await P.create({..._e.automation,...S?{projectId:S}:{}}),be(null),X(``),Ee(!1),F(!1)},n.dashboard.created)}async function _t(t){G(null),je(!0),ke(null),Pe(!1);try{ke((await P.repairDraft(t.id,{language:e})).repair)}catch(e){G(e instanceof Error?e.message:String(e))}finally{je(!1)}}async function vt(e){Z&&await mt(`run:${e.id}:repair`,async()=>{await P.update(e.automationId,Z.patch),ke(null),Pe(!1)},n.feedback.repairApplied)}let yt=(0,V.useMemo)(()=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(N,{className:`size-9 shrink-0 p-0`,loading:Q,label:n.refresh,onClick:dt}),(0,H.jsxs)(I,{children:[(0,H.jsx)(re,{asChild:!0,children:(0,H.jsxs)(E,{variant:`primary`,children:[(0,H.jsx)(j,{className:`size-4`}),n.new]})}),(0,H.jsx)(ie,{children:(0,H.jsxs)(ae,{align:`end`,className:`z-70 min-w-52 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,H.jsx)(L,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>ut(`draft`),children:n.createMenu.draft}),(0,H.jsx)(L,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>ut(`template`),children:n.createMenu.template}),(0,H.jsx)(L,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>ut(`blank`),children:n.createMenu.blank})]})})]})]}),[n.createMenu.blank,n.createMenu.draft,n.createMenu.template,n.new,n.refresh,ut,Q,dt]);return(0,V.useLayoutEffect)(()=>(d({startExtra:null,main:(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,H.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:yt}),()=>m()),[m,yt,n.subtitle,n.title,d]),(0,H.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,H.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,H.jsx)(ve,{label:n.dashboard.needsAttention,value:et.length,tone:et.length>0?`danger`:`neutral`}),(0,H.jsx)(ve,{label:n.metrics.running,value:Je.filter(e=>e.status===`running`).length}),(0,H.jsx)(ve,{label:n.dashboard.latestResult,value:tt?n.status[tt.status]:n.none,tone:tt&&de(tt)?`danger`:`neutral`}),(0,H.jsx)(ve,{label:n.metrics.next,value:Ye?W(Ye,n,e):n.none})]}),(0,H.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:Je.length},{id:`automations`,label:n.dashboard.manage,count:Ge.length},{id:`system`,label:n.system.title,count:Ke.length}].map(e=>(0,H.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`&&ue(!1)},children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.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,H.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,H.jsxs)(`section`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(Ce,{runs:Je.slice(0,12),labels:n,cronLabels:r,language:e,selectedRunId:K,busyAction:Fe,className:`h-auto`,onSelectRun:ft,onAction:mt})}),(0,H.jsx)(De,{className:`hidden xl:block`,run:Xe,events:$e,labels:n,cronLabels:r,language:e,loading:Be.isLoading,repairDraft:Z,repairLoading:Ae,repairApproved:Ne,busyAction:Fe,onRepairApprovedChange:Pe,onSuggestRepair:_t,onApplyRepair:vt})]}):M===`automations`?(0,H.jsx)(`section`,{children:(0,H.jsx)(Se,{automations:Ge,runs:Je,labels:n,cronLabels:r,language:e,busyAction:Fe,onOpenDetails:Y,onAction:mt})}):(0,H.jsx)(`section`,{children:(0,H.jsx)(Se,{automations:Ke,runs:We,labels:n,cronLabels:r,language:e,busyAction:Fe,readOnly:!0,onOpenDetails:Y,onAction:mt})})]}),(0,H.jsx)(l,{open:ne,onOpenChange:F,children:(0,H.jsxs)(O,{children:[(0,H.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,H.jsxs)(u,{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,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,H.jsx)(D,{className:`text-base font-semibold text-fg`,children:oe===`draft`?n.draft.title:oe===`template`?n.createMenu.templatesTitle:n.createTitle}),(0,H.jsx)(h,{asChild:!0,children:(0,H.jsx)(E,{variant:`ghost`,"aria-label":n.close,children:(0,H.jsx)(k,{className:`size-4`})})})]}),oe===`draft`?(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,H.jsx)(ye,{labels:n,prompt:pe,draft:_e,loading:xe,approved:Te,publishBusy:Fe===`draft:publish`,onPromptChange:X,onGenerate:ht,onPublish:gt,onApprovedChange:Ee,onDiscard:()=>{be(null),Ee(!1)}})}):oe===`template`?(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,H.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:ct.map(e=>(0,H.jsxs)(`button`,{className:`rounded-lg bg-surface-base p-4 text-left hover:bg-surface-hover`,onClick:()=>{B(e.form),R(`blank`)},children:[(0,H.jsx)(`div`,{className:`font-medium text-fg`,children:e.name}),(0,H.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:e.description})]},e.name))})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Me,{form:z,labels:n,setForm:B,workflowDefinitions:nt,selectedWorkflow:it,workflowsLoading:Ve.isLoading,agentOptions:rt,agentsLoading:He.isLoading,language:e}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,H.jsx)(h,{asChild:!0,children:(0,H.jsx)(E,{variant:`ghost`,children:n.cancel})}),(0,H.jsx)(E,{variant:`primary`,onClick:pt,disabled:!st,children:n.create})]})]})]})]})}),(0,H.jsx)(Oe,{automation:Ze,runs:Qe,labels:n,cronLabels:r,language:e,busyAction:Fe,onClose:()=>Y(null),onSelectRun:e=>{ft(e),Y(null)},onAction:mt}),(0,H.jsx)(l,{open:!A&&le&&!!Xe,onOpenChange:ue,children:(0,H.jsxs)(O,{children:[(0,H.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,H.jsxs)(u,{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,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,H.jsx)(D,{className:`truncate text-base font-semibold text-fg`,children:Xe?.automationName??n.dashboard.result}),(0,H.jsx)(h,{asChild:!0,children:(0,H.jsx)(E,{variant:`ghost`,"aria-label":n.close,children:(0,H.jsx)(k,{className:`size-4`})})})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,H.jsx)(De,{className:`rounded-none border-0`,run:Xe,events:$e,labels:n,cronLabels:r,language:e,loading:Be.isLoading,repairDraft:Z,repairLoading:Ae,repairApproved:Ne,busyAction:Fe,onRepairApprovedChange:Pe,onSuggestRepair:_t,onApplyRepair:vt})})]})]})})]})}function ve(e){let t=(0,B.c)(13),{label:n,value:r,tone:a}=e,o=a===void 0?`neutral`:a,s=o===`danger`&&`bg-red-500/10`,c;t[0]===s?c=t[1]:(c=i(`rounded-lg border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,s),t[0]=s,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,H.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,H.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,H.jsxs)(`div`,{className:c,children:[l,f]}),t[9]=c,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function ye(e){let t=(0,B.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,H.jsx)(m,{className:`size-4 text-accent`}),t[0]=g):g=t[0];let _;t[1]===n.draft.title?_=t[2]:(_=(0,H.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,H.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,H.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,H.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,H.jsxs)(E,{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,H.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 D;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==T?(D=(0,H.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]=D):D=t[24];let O;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?(O=i?(0,H.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,H.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,H.jsx)(Ae,{label:n.info.when,value:i.simulation.triggerSummary}),(0,H.jsx)(Ae,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,H.jsx)(be,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,H.jsx)(be,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,H.jsx)(be,{title:n.draft.risks,items:i.risks,empty:n.none}),h?(0,H.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,H.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>d(e.target.checked)}),(0,H.jsx)(`span`,{children:n.draft.approval})]}):null,(0,H.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,H.jsx)(E,{variant:`ghost`,onClick:f,children:n.draft.discard}),(0,H.jsx)(E,{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]=O):O=t[42];let k;return t[43]!==w||t[44]!==D||t[45]!==O?(k=(0,H.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[w,D,O]}),t[43]=w,t[44]=D,t[45]=O,t[46]=k):k=t[46],k}function be(e){let t=(0,B.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,H.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(xe):(0,H.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,H.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,H.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function xe(e){return(0,H.jsxs)(`li`,{children:[`- `,e]},e)}function Se(e){let t=(0,B.c)(24),{automations:n,runs:r,labels:a,cronLabels:o,language:s,busyAction:c,readOnly:l,onOpenDetails:u,onAction:d}=e,f=l===void 0?!1:l;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(M,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===a.empty.automations?n=t[2]:(n=(0,H.jsx)(je,{icon:e,title:a.empty.automations}),t[1]=a.empty.automations,t[2]=n),n}let p;if(t[3]!==n||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==s||t[8]!==d||t[9]!==u||t[10]!==f||t[11]!==r){let e;t[13]!==c||t[14]!==o||t[15]!==a||t[16]!==s||t[17]!==d||t[18]!==u||t[19]!==f||t[20]!==r?(e=e=>{let t=pe(e),n=r.filter(t=>t.automationId===e.id),l=n.find(J),p=n[0],m=c===`automation:${e.id}:run`,h=c===`automation:${e.id}:toggle`,_=c===`automation:${e.id}:delete`;return(0,H.jsxs)(`article`,{className:`flex min-h-44 cursor-pointer flex-col rounded-lg border border-edge-subtle bg-surface-base p-3.5 shadow-surface outline-none transition-colors hover:bg-surface-hover`,role:`button`,tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&u(e.id)},children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.name}),l?(0,H.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-blue-500`}):null]}),t?(0,H.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:t}):null]}),(0,H.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,H.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase text-fg-muted`,children:a.info.when}),(0,H.jsx)(`span`,{className:`truncate`,children:G(e.trigger,a,o,s)})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-fg-muted`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-xs font-medium uppercase`,children:a.info.run}),(0,H.jsx)(`span`,{className:`truncate`,children:K(e.action,a)})]})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,H.jsxs)(`span`,{children:[a.last,`: `,W(e.state.lastRunAtMs,a,s)]}),(0,H.jsxs)(`span`,{children:[a.next,`: `,W(e.state.nextRunAtMs,a,s)]}),(0,H.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5`,le(e.state.lastRunStatus)),children:e.state.lastRunStatus?a.status[e.state.lastRunStatus]:a.status.notRun}),p?.error?(0,H.jsx)(`p`,{className:`basis-full line-clamp-1 text-red-700 dark:text-red-300`,children:p.error}):null]}),f?null:(0,H.jsx)(`div`,{className:`mt-auto flex justify-end pt-3`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(E,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":a.dashboard.runNow,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:run`,()=>P.runNow(e.id),a.feedback.rerunQueued)},children:(0,H.jsx)(b,{className:i(`size-4`,m&&`animate-pulse`)})}),(0,H.jsx)(E,{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(),d(`automation:${e.id}:toggle`,()=>e.enabled?P.pause(e.id):P.resume(e.id),e.enabled?a.feedback.paused:a.dashboard.resumed)},children:h?(0,H.jsx)(C,{className:`size-4 animate-spin`}):e.enabled?(0,H.jsx)(te,{className:`size-4`}):(0,H.jsx)(b,{className:`size-4`})}),(0,H.jsx)(E,{variant:`ghost`,className:`size-8 rounded-md p-0`,"aria-label":a.dashboard.delete,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`automation:${e.id}:delete`,()=>P.remove(e.id),a.dashboard.deleted)},children:_?(0,H.jsx)(C,{className:`size-4 animate-spin`}):(0,H.jsx)(g,{className:`size-4`})})]})})]},e.id)},t[13]=c,t[14]=o,t[15]=a,t[16]=s,t[17]=d,t[18]=u,t[19]=f,t[20]=r,t[21]=e):e=t[21],p=n.map(e),t[3]=n,t[4]=c,t[5]=o,t[6]=a,t[7]=s,t[8]=d,t[9]=u,t[10]=f,t[11]=r,t[12]=p}else p=t[12];let m;return t[22]===p?m=t[23]:(m=(0,H.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:p}),t[22]=p,t[23]=m),m}function Ce(e){let t=(0,B.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,H.jsx)(A,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===r.empty.runs?n=t[2]:(n=(0,H.jsx)(je,{icon:e,title:r.empty.runs}),t[1]=r.empty.runs,t[2]=n),n}let f;t[3]===l?f=t[4]:(f=i(`overflow-hidden rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,l),t[3]=l,t[4]=f);let p;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,H.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,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-fg`,children:e.automationName}),(0,H.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,le(e.status)),children:r.status[e.status]}),e.workflowRunId?(0,H.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[r.workflowPrefix,` `,e.workflowRunId.slice(0,8)]}):null]}),(0,H.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:e.error||e.summary||K(e.actionSnapshot,r)}),(0,H.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[W(e.createdAtMs,r,o),` · `,e.manual?r.trigger.manual:G(e.triggerSnapshot,r,a,o)]})]}),e.status===`running`||e.status===`queued`?(0,H.jsx)(E,{variant:`ghost`,disabled:c!==null,onClick:t=>{t.stopPropagation(),d(`run:${e.id}:cancel`,()=>P.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],p=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]=p}else p=t[13];let m;return t[22]!==f||t[23]!==p?(m=(0,H.jsx)(`div`,{className:f,children:p}),t[22]=f,t[23]=p,t[24]=m):m=t[24],m}function we(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`after_run.started`:return n.afterRunStarted;case`after_run.completed`:return n.afterRunCompleted;case`after_run.failed`:return n.afterRunFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Te(e){let t=(0,B.c)(17),{value:n,labels:r,title:a,defaultExpanded:o}=e,[s,c]=(0,V.useState)(o===void 0?!1:o),l;t[0]===n?l=t[1]:(l=JSON.stringify(n,null,2),t[0]=n,t[1]=l);let u=l,d;t[2]===u?d=t[3]:(d=u.split(`
|
|
2
|
-
`),t[2]=u,t[3]=d);let f=d.length,p=u.length>720||f>18,m;t[4]!==p||t[5]!==u?(m=p?`${u.split(`
|
|
3
|
-
`).slice(0,10).join(`
|
|
4
|
-
`).trimEnd()}...`:u,t[4]=p,t[5]=u,t[6]=m):m=t[6];let h=m,g;t[7]!==s||t[8]!==p||t[9]!==r||t[10]!==a?(g=p?(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(Ee),"aria-expanded":s,children:[(0,H.jsx)(`span`,{children:a}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[s?r.details.hideDetails:r.details.showDetails,(0,H.jsx)(y,{className:i(`size-3.5 transition-transform`,s&&`rotate-180`),"aria-hidden":!0})]})]}):(0,H.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:a}),t[7]=s,t[8]=p,t[9]=r,t[10]=a,t[11]=g):g=t[11];let _=s||!p?u:h,v;t[12]===_?v=t[13]:(v=(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let b;return t[14]!==g||t[15]!==v?(b=(0,H.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=b):b=t[16],b}function Ee(e){return!e}function De(e){let t=(0,B.c)(125),{className:n,run:r,events:a,labels:o,cronLabels:s,language:c,loading:l,repairDraft:u,repairLoading:d,repairApproved:f,busyAction:p,onRepairApprovedChange:h,onSuggestRepair:g,onApplyRepair:_}=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-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,H.jsx)(A,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let a;t[3]===o.selectRun?a=t[4]:(a=(0,H.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,H.jsxs)(`aside`,{className:e,children:[r,a]}),t[5]=e,t[6]=a,t[7]=s):s=t[7],s}let v;t[8]===n?v=t[9]:(v=i(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=v);let y;t[10]===r.automationName?y=t[11]:(y=(0,H.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=y);let b;t[12]===r.id?b=t[13]:(b=r.id.slice(0,8),t[12]=r.id,t[13]=b);let x;t[14]===b?x=t[15]:(x=(0,H.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:b}),t[14]=b,t[15]=x);let C;t[16]!==y||t[17]!==x?(C=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[y,x]}),t[16]=y,t[17]=x,t[18]=C):C=t[18];let T;t[19]===r.status?T=t[20]:(T=i(`shrink-0 rounded-full px-2 py-0.5 text-xs`,le(r.status)),t[19]=r.status,t[20]=T);let D=o.status[r.status],O;t[21]!==T||t[22]!==D?(O=(0,H.jsx)(`span`,{className:T,children:D}),t[21]=T,t[22]=D,t[23]=O):O=t[23];let k;t[24]!==C||t[25]!==O?(k=(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,O]}),t[24]=C,t[25]=O,t[26]=k):k=t[26];let ee=o.details.created,j;t[27]!==o||t[28]!==c||t[29]!==r.createdAtMs?(j=W(r.createdAtMs,o,c),t[27]=o,t[28]=c,t[29]=r.createdAtMs,t[30]=j):j=t[30];let M;t[31]!==o.details.created||t[32]!==j?(M=(0,H.jsx)(Z,{label:ee,value:j}),t[31]=o.details.created,t[32]=j,t[33]=M):M=t[33];let te=o.details.started,N;t[34]!==o||t[35]!==c||t[36]!==r.startedAtMs?(N=W(r.startedAtMs,o,c),t[34]=o,t[35]=c,t[36]=r.startedAtMs,t[37]=N):N=t[37];let P;t[38]!==o.details.started||t[39]!==N?(P=(0,H.jsx)(Z,{label:te,value:N}),t[38]=o.details.started,t[39]=N,t[40]=P):P=t[40];let F=o.details.duration,I;t[41]!==o||t[42]!==r.durationMs?(I=ue(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,H.jsx)(Z,{label:F,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,H.jsx)(Z,{label:o.details.model,value:r.model}):null,t[47]=o.details.model,t[48]=r.model,t[49]=re):re=t[49];let ie;t[50]!==M||t[51]!==P||t[52]!==L||t[53]!==re?(ie=(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[M,P,L,re]}),t[50]=M,t[51]=P,t[52]=L,t[53]=re,t[54]=ie):ie=t[54];let ae;t[55]===o.dashboard.result?ae=t[56]:(ae=(0,H.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.dashboard.result}),t[55]=o.dashboard.result,t[56]=ae);let oe;t[57]===r?oe=t[58]:(oe=de(r)?`text-red-700 dark:text-red-300`:`text-fg`,t[57]=r,t[58]=oe);let R;t[59]===oe?R=t[60]:(R=i(`mt-1 break-words text-sm`,oe),t[59]=oe,t[60]=R);let se;t[61]!==o||t[62]!==r.actionSnapshot||t[63]!==r.error||t[64]!==r.summary?(se=r.error||r.summary||K(r.actionSnapshot,o),t[61]=o,t[62]=r.actionSnapshot,t[63]=r.error,t[64]=r.summary,t[65]=se):se=t[65];let z;t[66]!==R||t[67]!==se?(z=(0,H.jsx)(`p`,{className:R,children:se}),t[66]=R,t[67]=se,t[68]=z):z=t[68];let V;t[69]!==s||t[70]!==o||t[71]!==c||t[72]!==r.manual||t[73]!==r.triggerSnapshot?(V=r.manual?o.trigger.manual:G(r.triggerSnapshot,o,s,c),t[69]=s,t[70]=o,t[71]=c,t[72]=r.manual,t[73]=r.triggerSnapshot,t[74]=V):V=t[74];let U;t[75]!==o.explain.whyRan||t[76]!==V?(U=(0,H.jsx)(Z,{label:o.explain.whyRan,value:V}),t[75]=o.explain.whyRan,t[76]=V,t[77]=U):U=t[77];let ce;t[78]!==o.dashboard.openSession||t[79]!==r.sessionKey?(ce=r.sessionKey?(0,H.jsx)(E,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,H.jsxs)(ne,{to:`/chat/${encodeURIComponent(r.sessionKey)}`,children:[(0,H.jsx)(w,{className:`size-3.5`}),o.dashboard.openSession]})}):null,t[78]=o.dashboard.openSession,t[79]=r.sessionKey,t[80]=ce):ce=t[80];let q;t[81]!==o.feedback||t[82]!==r.workflowRunId?(q=r.workflowRunId?(0,H.jsx)(E,{asChild:!0,variant:`secondary`,className:`h-8 justify-start rounded-md px-2 text-xs`,children:(0,H.jsxs)(ne,{to:`/workflows?run=${encodeURIComponent(r.workflowRunId)}`,children:[(0,H.jsx)(S,{className:`size-3.5`}),o.feedback.workflow]})}):null,t[81]=o.feedback,t[82]=r.workflowRunId,t[83]=q):q=t[83];let J;t[84]!==U||t[85]!==ce||t[86]!==q?(J=(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[U,ce,q]}),t[84]=U,t[85]=ce,t[86]=q,t[87]=J):J=t[87];let Y;t[88]!==ae||t[89]!==z||t[90]!==J?(Y=(0,H.jsxs)(`div`,{className:`mt-3 rounded-md border border-edge/70 bg-surface-base/50 p-3`,children:[ae,z,J]}),t[88]=ae,t[89]=z,t[90]=J,t[91]=Y):Y=t[91];let fe;t[92]!==o.repair||t[93]!==g||t[94]!==d||t[95]!==r?(fe=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,H.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,H.jsxs)(E,{variant:`secondary`,onClick:()=>g(r),disabled:d,children:[(0,H.jsx)(m,{className:`size-4`}),d?o.repair.generating:o.repair.suggest]})}):null,t[92]=o.repair,t[93]=g,t[94]=d,t[95]=r,t[96]=fe):fe=t[96];let pe;t[97]!==ie||t[98]!==Y||t[99]!==fe||t[100]!==k?(pe=(0,H.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[k,ie,Y,fe]}),t[97]=ie,t[98]=Y,t[99]=fe,t[100]=k,t[101]=pe):pe=t[101];let X;t[102]!==p||t[103]!==o||t[104]!==_||t[105]!==h||t[106]!==f||t[107]!==u||t[108]!==r?(X=u?(0,H.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,H.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,H.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:u.explanation}),u.expectedEffect?(0,H.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:u.expectedEffect}):null,(0,H.jsx)(be,{title:o.repair.risks,items:u.risks,empty:o.none}),(0,H.jsx)(Te,{value:u.patch,labels:o,title:o.details.repairPatch}),u.requiresApproval?(0,H.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,H.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:f,onChange:e=>h(e.target.checked)}),(0,H.jsx)(`span`,{children:o.repair.approval})]}):null,(0,H.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,H.jsx)(E,{variant:`primary`,onClick:()=>_(r),disabled:p===`run:${r.id}:repair`||u.requiresApproval&&!f,children:p===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[102]=p,t[103]=o,t[104]=_,t[105]=h,t[106]=f,t[107]=u,t[108]=r,t[109]=X):X=t[109];let me;t[110]===o.timeline?me=t[111]:(me=(0,H.jsx)(`div`,{className:`mb-3 text-xs font-semibold uppercase text-fg-muted`,children:o.timeline}),t[110]=o.timeline,t[111]=me);let he;t[112]!==a||t[113]!==o||t[114]!==c||t[115]!==l?(he=l?(0,H.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.loading}):a.length===0?(0,H.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,H.jsx)(`ol`,{className:`space-y-3`,children:a.map(e=>(0,H.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,H.jsx)(`span`,{className:i(`mt-1 size-2 rounded-full`,ke(e.type))}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-sm text-fg`,children:we(e,o)}),(0,H.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[W(e.createdAtMs,o,c),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,H.jsx)(Te,{value:e.data,labels:o,title:o.details.eventData}):null]})]},e.id))}),t[112]=a,t[113]=o,t[114]=c,t[115]=l,t[116]=he):he=t[116];let ge;t[117]!==me||t[118]!==he?(ge=(0,H.jsxs)(`div`,{className:`px-4 py-3`,children:[me,he]}),t[117]=me,t[118]=he,t[119]=ge):ge=t[119];let _e;return t[120]!==v||t[121]!==pe||t[122]!==X||t[123]!==ge?(_e=(0,H.jsxs)(`aside`,{className:v,children:[pe,X,ge]}),t[120]=v,t[121]=pe,t[122]=X,t[123]=ge,t[124]=_e):_e=t[124],_e}function Oe(e){let t=(0,B.c)(25),{automation:n,runs:r,labels:a,cronLabels:o,language:s,busyAction:c,onClose:f,onSelectRun:m,onAction:_}=e,v;t[0]===n?v=t[1]:(v=n?q(n):`suggest_only`,t[0]=n,t[1]=v);let y=v,x=n?c===`automation:${n.id}:run`:!1,T=n?c===`automation:${n.id}:toggle`:!1,ee=n?c===`automation:${n.id}:delete`:!1,j=!!n,M;t[2]===f?M=t[3]:(M=e=>!e&&f(),t[2]=f,t[3]=M);let N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,H.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[4]=N):N=t[4];let F;t[5]!==n||t[6]!==c||t[7]!==o||t[8]!==ee||t[9]!==a||t[10]!==s||t[11]!==y||t[12]!==_||t[13]!==f||t[14]!==m||t[15]!==x||t[16]!==r||t[17]!==T?(F=n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(D,{className:`truncate text-base font-semibold text-fg`,children:n.name}),n.description?(0,H.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:n.description}):null]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,H.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,H.jsx)(h,{asChild:!0,children:(0,H.jsx)(E,{variant:`ghost`,"aria-label":a.close,children:(0,H.jsx)(k,{className:`size-4`})})})]})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,H.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[18rem_1fr]`,children:[(0,H.jsxs)(`aside`,{className:`grid h-fit gap-3 rounded-lg bg-surface-base p-4`,children:[(0,H.jsx)(Ae,{label:a.info.when,value:G(n.trigger,a,o,s)}),(0,H.jsx)(Ae,{label:a.info.run,value:K(n.action,a)}),(0,H.jsx)(Ae,{label:a.info.safety,value:a.safety[y]}),(0,H.jsx)(Z,{label:a.last,value:W(n.state.lastRunAtMs,a,s)}),(0,H.jsx)(Z,{label:a.next,value:W(n.state.nextRunAtMs,a,s)}),n.state.consecutiveFailures?(0,H.jsx)(Z,{label:a.dashboard.failures,value:String(n.state.consecutiveFailures)}):null,n.state.lastError?(0,H.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null]}),(0,H.jsxs)(`section`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.dashboard.runHistory}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.dashboard.runHistoryDescription})]}),(0,H.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length})]}),r.length===0?(0,H.jsx)(je,{icon:(0,H.jsx)(A,{className:`size-5`}),title:a.empty.runs}):(0,H.jsx)(`div`,{className:`grid gap-2`,children:r.map(e=>(0,H.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`button`,{className:`min-w-0 text-left outline-none`,onClick:()=>m(e.id),children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,H.jsx)(d,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,H.jsx)(A,{className:`size-4 shrink-0 text-fg-muted`}),(0,H.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:W(e.createdAtMs,a,s)}),(0,H.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs`,le(e.status)),children:a.status[e.status]})]}),(0,H.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.error||e.summary||K(e.actionSnapshot,a)})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[e.sessionKey?(0,H.jsx)(E,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,H.jsxs)(ne,{to:`/chat/${encodeURIComponent(e.sessionKey)}`,children:[(0,H.jsx)(w,{className:`size-3.5`}),a.dashboard.openSession]})}):null,e.workflowRunId?(0,H.jsx)(E,{asChild:!0,variant:`ghost`,className:`h-8 rounded-md px-2 text-xs`,children:(0,H.jsxs)(ne,{to:`/workflows?run=${encodeURIComponent(e.workflowRunId)}`,children:[(0,H.jsx)(S,{className:`size-3.5`}),a.feedback.workflow]})}):null]})]})},e.id))})]})]})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2 border-t border-edge px-5 py-4`,children:[(0,H.jsxs)(E,{variant:`ghost`,disabled:c!==null,onClick:()=>void _(`automation:${n.id}:delete`,()=>P.remove(n.id),a.dashboard.deleted).then(e=>{e&&f()}),children:[ee?(0,H.jsx)(C,{className:`size-4 animate-spin`}):(0,H.jsx)(g,{className:`size-4`}),a.dashboard.delete]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(E,{variant:`secondary`,disabled:c!==null,onClick:()=>void _(`automation:${n.id}:toggle`,()=>n.enabled?P.pause(n.id):P.resume(n.id),n.enabled?a.feedback.paused:a.dashboard.resumed),children:[T?(0,H.jsx)(C,{className:`size-4 animate-spin`}):n.enabled?(0,H.jsx)(te,{className:`size-4`}):(0,H.jsx)(b,{className:`size-4`}),n.enabled?a.dashboard.pause:a.dashboard.resume]}),(0,H.jsxs)(E,{variant:`primary`,disabled:c!==null,onClick:()=>void _(`automation:${n.id}:run`,()=>P.runNow(n.id),a.feedback.rerunQueued),children:[x?(0,H.jsx)(C,{className:`size-4 animate-spin`}):(0,H.jsx)(b,{className:`size-4`}),a.dashboard.runNow]})]})]})]}):null,t[5]=n,t[6]=c,t[7]=o,t[8]=ee,t[9]=a,t[10]=s,t[11]=y,t[12]=_,t[13]=f,t[14]=m,t[15]=x,t[16]=r,t[17]=T,t[18]=F):F=t[18];let I;t[19]===F?I=t[20]:(I=(0,H.jsxs)(O,{children:[N,(0,H.jsx)(u,{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:F})]}),t[19]=F,t[20]=I);let L;return t[21]!==j||t[22]!==M||t[23]!==I?(L=(0,H.jsx)(l,{open:j,onOpenChange:M,children:I}),t[21]=j,t[22]=M,t[23]=I,t[24]=L):L=t[24],L}function Z(e){let t=(0,B.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,H.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,H.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,H.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 ke(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Ae(e){let t=(0,B.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,H.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,H.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,H.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function je(e){let t=(0,B.c)(5),{icon:n,title:r}=e,i;t[0]===r?i=t[1]:(i=(0,H.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,H.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge-subtle bg-surface-base text-fg-muted shadow-surface`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Me(e){let t=(0,B.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,V.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 y;t[10]!==n.name||t[11]!==g?(y=(0,H.jsx)(`input`,{className:Q,value:n.name,onChange:g}),t[10]=n.name,t[11]=g,t[12]=y):y=t[12];let b;t[13]!==r.form.name||t[14]!==y?(b=(0,H.jsx)($,{label:r.form.name,children:y}),t[13]=r.form.name,t[14]=y,t[15]=b):b=t[15];let x;t[16]===p?x=t[17]:(x=e=>p({description:e.target.value}),t[16]=p,t[17]=x);let S;t[18]!==n.description||t[19]!==x?(S=(0,H.jsx)(`input`,{className:Q,value:n.description,onChange:x}),t[18]=n.description,t[19]=x,t[20]=S):S=t[20];let C;t[21]!==r.form.description||t[22]!==S?(C=(0,H.jsx)($,{label:r.form.description,children:S}),t[21]=r.form.description,t[22]=S,t[23]=C):C=t[23];let w;t[24]===r.form.trigger?w=t[25]:(w=(0,H.jsx)(Fe,{title:r.form.trigger}),t[24]=r.form.trigger,t[25]=w);let T;t[26]===p?T=t[27]:(T=e=>p({triggerMode:e.target.value}),t[26]=p,t[27]=T);let E;t[28]===r.trigger.manual?E=t[29]:(E=(0,H.jsx)(_,{value:`manual`,children:r.trigger.manual}),t[28]=r.trigger.manual,t[29]=E);let D;t[30]===r.trigger.daily?D=t[31]:(D=(0,H.jsx)(_,{value:`daily`,children:r.trigger.daily}),t[30]=r.trigger.daily,t[31]=D);let O;t[32]===r.trigger.weekly?O=t[33]:(O=(0,H.jsx)(_,{value:`weekly`,children:r.trigger.weekly}),t[32]=r.trigger.weekly,t[33]=O);let k;t[34]===r.trigger.interval?k=t[35]:(k=(0,H.jsx)(_,{value:`interval`,children:r.trigger.interval}),t[34]=r.trigger.interval,t[35]=k);let ee;t[36]===r.trigger.customCron?ee=t[37]:(ee=(0,H.jsx)(_,{value:`cron`,children:r.trigger.customCron}),t[36]=r.trigger.customCron,t[37]=ee);let A;t[38]===r.trigger.webhook?A=t[39]:(A=(0,H.jsx)(_,{value:`webhook`,children:r.trigger.webhook}),t[38]=r.trigger.webhook,t[39]=A);let j;t[40]===r.trigger.goalBlocked?j=t[41]:(j=(0,H.jsx)(_,{value:`goalBlocked`,children:r.trigger.goalBlocked}),t[40]=r.trigger.goalBlocked,t[41]=j);let M;t[42]===r.trigger.noteCreated?M=t[43]:(M=(0,H.jsx)(_,{value:`noteCreated`,children:r.trigger.noteCreated}),t[42]=r.trigger.noteCreated,t[43]=M);let te;t[44]===r.trigger.workflowFailed?te=t[45]:(te=(0,H.jsx)(_,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[44]=r.trigger.workflowFailed,t[45]=te);let ne;t[46]===r.trigger.sessionUpdated?ne=t[47]:(ne=(0,H.jsx)(_,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[46]=r.trigger.sessionUpdated,t[47]=ne);let N;t[48]!==n.triggerMode||t[49]!==T||t[50]!==E||t[51]!==D||t[52]!==O||t[53]!==k||t[54]!==ee||t[55]!==A||t[56]!==j||t[57]!==M||t[58]!==te||t[59]!==ne?(N=(0,H.jsxs)(v,{className:Q,value:n.triggerMode,onChange:T,children:[E,D,O,k,ee,A,j,M,te,ne]}),t[48]=n.triggerMode,t[49]=T,t[50]=E,t[51]=D,t[52]=O,t[53]=k,t[54]=ee,t[55]=A,t[56]=j,t[57]=M,t[58]=te,t[59]=ne,t[60]=N):N=t[60];let P;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?(P=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)($,{label:r.form.time,children:(0,H.jsx)(`input`,{className:Q,type:`time`,value:n.time,onChange:e=>p({time:e.target.value})})}),n.triggerMode===`weekly`?(0,H.jsx)($,{label:r.form.day,children:(0,H.jsxs)(v,{className:Q,value:n.weekday,onChange:e=>p({weekday:e.target.value}),children:[(0,H.jsx)(_,{value:`1`,children:r.weekdays.monday}),(0,H.jsx)(_,{value:`2`,children:r.weekdays.tuesday}),(0,H.jsx)(_,{value:`3`,children:r.weekdays.wednesday}),(0,H.jsx)(_,{value:`4`,children:r.weekdays.thursday}),(0,H.jsx)(_,{value:`5`,children:r.weekdays.friday}),(0,H.jsx)(_,{value:`6`,children:r.weekdays.saturday}),(0,H.jsx)(_,{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]=P):P=t[68];let F;t[69]!==n.intervalMinutes||t[70]!==n.triggerMode||t[71]!==r.form.everyMinutes||t[72]!==p?(F=n.triggerMode===`interval`?(0,H.jsx)($,{label:r.form.everyMinutes,children:(0,H.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]=F):F=t[73];let I;t[74]!==n.cronExpr||t[75]!==n.triggerMode||t[76]!==r.form.expression||t[77]!==p?(I=n.triggerMode===`cron`?(0,H.jsx)($,{label:r.form.expression,children:(0,H.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]=I):I=t[78];let L;t[79]!==n.triggerMode||t[80]!==n.webhookSecretId||t[81]!==r.form.secretId||t[82]!==p?(L=n.triggerMode===`webhook`?(0,H.jsx)($,{label:r.form.secretId,children:(0,H.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]=L):L=t[83];let re;t[84]===r.form.action?re=t[85]:(re=(0,H.jsx)(Fe,{title:r.form.action}),t[84]=r.form.action,t[85]=re);let ie;t[86]!==n.workflowId||t[87]!==p||t[88]!==o?(ie=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]=ie):ie=t[89];let ae;t[90]===r.action.runAgent?ae=t[91]:(ae=(0,H.jsx)(_,{value:`agent`,children:r.action.runAgent}),t[90]=r.action.runAgent,t[91]=ae);let R;t[92]===r.action.runWorkflow?R=t[93]:(R=(0,H.jsx)(_,{value:`workflow`,children:r.action.runWorkflow}),t[92]=r.action.runWorkflow,t[93]=R);let se;t[94]!==n.actionMode||t[95]!==ie||t[96]!==ae||t[97]!==R?(se=(0,H.jsxs)(v,{className:Q,value:n.actionMode,onChange:ie,children:[ae,R]}),t[94]=n.actionMode,t[95]=ie,t[96]=ae,t[97]=R,t[98]=se):se=t[98];let U=r.form.agent,ce=n.agentId,W;t[99]===p?W=t[100]:(W=e=>p({agentId:e.target.value}),t[99]=p,t[100]=W);let G=u?r.form.loadingAgents:r.form.defaultAgent,K;t[101]===G?K=t[102]:(K=(0,H.jsx)(_,{value:``,children:G}),t[101]=G,t[102]=K);let q;t[103]===l?q=t[104]:(q=l.map(Pe),t[103]=l,t[104]=q);let le;t[105]!==n.agentId||t[106]!==W||t[107]!==K||t[108]!==q?(le=(0,H.jsxs)(v,{className:Q,value:ce,onChange:W,children:[K,q]}),t[105]=n.agentId,t[106]=W,t[107]=K,t[108]=q,t[109]=le):le=t[109];let ue;t[110]!==r.form.agent||t[111]!==le?(ue=(0,H.jsx)($,{label:U,children:le}),t[110]=r.form.agent,t[111]=le,t[112]=ue):ue=t[112];let J;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?(J=n.actionMode===`agent`?(0,H.jsxs)($,{label:r.form.instruction,children:[(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsx)(oe,{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,H.jsx)(`textarea`,{className:i(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>p({instruction:e.target.value})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)($,{label:r.form.workflow,children:(0,H.jsxs)(v,{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,H.jsx)(_,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,H.jsx)(_,{value:``,children:r.form.noWorkflows}):null,o.map(Ne)]})}),s?(0,H.jsx)(z,{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]=J):J=t[131];let de;t[132]===r.form.safety?de=t[133]:(de=(0,H.jsx)(Fe,{title:r.form.safety}),t[132]=r.form.safety,t[133]=de);let Y;t[134]!==n.afterRunMode||t[135]!==p?(Y=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]=Y):Y=t[136];let fe;t[137]===r.safety.suggest_only?fe=t[138]:(fe=(0,H.jsx)(_,{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,H.jsx)(_,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),t[139]=r.safety.ask_before_apply,t[140]=pe);let X;t[141]===r.safety.auto_apply?X=t[142]:(X=(0,H.jsx)(_,{value:`auto_apply`,children:r.safety.auto_apply}),t[141]=r.safety.auto_apply,t[142]=X);let me;t[143]!==n.safetyMode||t[144]!==Y||t[145]!==fe||t[146]!==pe||t[147]!==X?(me=(0,H.jsxs)(v,{className:Q,value:n.safetyMode,onChange:Y,children:[fe,pe,X]}),t[143]=n.safetyMode,t[144]=Y,t[145]=fe,t[146]=pe,t[147]=X,t[148]=me):me=t[148];let he=n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription,ge;t[149]===he?ge=t[150]:(ge=(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:he}),t[149]=he,t[150]=ge);let _e;t[151]!==r.form.safety||t[152]!==me||t[153]!==ge?(_e=(0,H.jsxs)($,{label:r.form.safety,children:[me,ge]}),t[151]=r.form.safety,t[152]=me,t[153]=ge,t[154]=_e):_e=t[154];let ve;t[155]===r.form.afterRun?ve=t[156]:(ve=(0,H.jsx)(Fe,{title:r.form.afterRun}),t[155]=r.form.afterRun,t[156]=ve);let ye;t[157]===p?ye=t[158]:(ye=e=>p({afterRunMode:e.target.value}),t[157]=p,t[158]=ye);let be;t[159]===r.afterRun.none?be=t[160]:(be=(0,H.jsx)(_,{value:`none`,children:r.afterRun.none}),t[159]=r.afterRun.none,t[160]=be);let xe;t[161]===r.afterRun.saveToSession?xe=t[162]:(xe=(0,H.jsx)(_,{value:`saveToSession`,children:r.afterRun.saveToSession}),t[161]=r.afterRun.saveToSession,t[162]=xe);let Se=n.safetyMode!==`auto_apply`,Ce;t[163]!==r.afterRun.webhook||t[164]!==Se?(Ce=(0,H.jsx)(_,{value:`webhook`,disabled:Se,children:r.afterRun.webhook}),t[163]=r.afterRun.webhook,t[164]=Se,t[165]=Ce):Ce=t[165];let we;t[166]!==n.afterRunMode||t[167]!==ye||t[168]!==be||t[169]!==xe||t[170]!==Ce?(we=(0,H.jsxs)(v,{className:Q,value:n.afterRunMode,onChange:ye,children:[be,xe,Ce]}),t[166]=n.afterRunMode,t[167]=ye,t[168]=be,t[169]=xe,t[170]=Ce,t[171]=we):we=t[171];let Te;t[172]!==n.afterRunMode||t[173]!==n.webhookUrl||t[174]!==r.form.webhookUrl||t[175]!==p?(Te=n.afterRunMode===`webhook`?(0,H.jsx)($,{label:r.form.webhookUrl,children:(0,H.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]=Te):Te=t[176];let Ee;t[177]===r.form.reliability?Ee=t[178]:(Ee=(0,H.jsx)(Fe,{title:r.form.reliability}),t[177]=r.form.reliability,t[178]=Ee);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,H.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 Z;t[184]!==r.form.timeoutSeconds||t[185]!==Oe?(Z=(0,H.jsx)($,{label:r.form.timeoutSeconds,children:Oe}),t[184]=r.form.timeoutSeconds,t[185]=Oe,t[186]=Z):Z=t[186];let ke;t[187]===p?ke=t[188]:(ke=e=>p({disableAfterFailures:e.target.value}),t[187]=p,t[188]=ke);let Ae;t[189]!==n.disableAfterFailures||t[190]!==ke?(Ae=(0,H.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:ke}),t[189]=n.disableAfterFailures,t[190]=ke,t[191]=Ae):Ae=t[191];let je;t[192]!==r.form.disableAfterFailures||t[193]!==Ae?(je=(0,H.jsx)($,{label:r.form.disableAfterFailures,children:Ae}),t[192]=r.form.disableAfterFailures,t[193]=Ae,t[194]=je):je=t[194];let Me;t[195]!==Z||t[196]!==je?(Me=(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Z,je]}),t[195]=Z,t[196]=je,t[197]=Me):Me=t[197];let Ie;return t[198]!==w||t[199]!==N||t[200]!==P||t[201]!==F||t[202]!==I||t[203]!==L||t[204]!==re||t[205]!==se||t[206]!==ue||t[207]!==J||t[208]!==de||t[209]!==_e||t[210]!==ve||t[211]!==we||t[212]!==Te||t[213]!==Ee||t[214]!==b||t[215]!==Me||t[216]!==C?(Ie=(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[b,C,w,N,P,F,I,L,re,se,ue,J,de,_e,ve,we,Te,Ee,Me]})}),t[198]=w,t[199]=N,t[200]=P,t[201]=F,t[202]=I,t[203]=L,t[204]=re,t[205]=se,t[206]=ue,t[207]=J,t[208]=de,t[209]=_e,t[210]=ve,t[211]=we,t[212]=Te,t[213]=Ee,t[214]=b,t[215]=Me,t[216]=C,t[217]=Ie):Ie=t[217],Ie}function Ne(e){return(0,H.jsx)(_,{value:e.id,children:e.title||e.name},e.id)}function Pe(e){return(0,H.jsx)(_,{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,B.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,H.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,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Fe(e){let t=(0,B.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,H.jsx)(S,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,H.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{_e as AutomationsPage};
|