@xopcai/xopc 0.0.170 → 0.0.172
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/{activity-store-CkUp1qvf.js → activity-store-C3Y-bESI.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DDuem4HM.js → agent-avatar-dicebear-CPyev9P7.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bf_kK2Ay.js +2 -0
- package/dist/gateway/static/root/assets/{api-BnuPQhJW.js → api-B7qEr_Rw.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DdZw8Hi1.js → app-management-settings-panel-Br_9-7fs.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BN8Vk2bX.js → appearance-settings-uyLcRPai.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DXFCP5-1.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C82MaDQj.js → archive-plugin-B19REnR5.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-uilrwSdW.js → attachment-load-DLWCC4Yi.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CkDZjAmy.js → automation-suggestion-card-ky5S5lly.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-D8pT1o2O.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B7NTL0_T.js → binary-plugins-CtPEzLlo.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D_LDNlB-.js → block-editor-CQVR4Xij.js} +32 -32
- package/dist/gateway/static/root/assets/browser-settings-page-Bav_skKN.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-UFVUzn4v.js → browser-workflow-inputs-CimCGbhq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CGgC0N92.js → browser-workflows-page-DewuCw3p.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BHaYYo9E.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DUIorGUd.js → capability-presets-api-B5RTs-Az.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-PTz00nR4.js → capability-presets-settings-panel-BgchTh81.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-BYwSB8c6.js → channel-recipient-api-Czu0YzIZ.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BP0e62wt.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DBWKfeGe.js +1 -0
- package/dist/gateway/static/root/assets/connector-logo-Di3gnR_D.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-CC5kh0de.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CkT98fPT.js → desktop-pet-D-ZUNHhn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DkbIzdA3.js → desktop-pet-settings-C3L6AI8_.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-dBQvj1sG.js → directory-picker-path-field-Dvq4iG6P.js} +1 -1
- package/dist/gateway/static/root/assets/dreaming-settings-D9i54kWO.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BfxoIiNo.js → extension-debug-page-BecQjU0J.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-EIJ3wIb7.js → extension-page-BeVkPSm-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DBBec51N.js → extension-settings-page-DMoo2mKx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-4_u53Ufq.js → gateway-config-api-Bthb3_6v.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-v9kJM59H.js → gateway-settings-Bh8nPvJQ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CXITih5d.js → gateway-startup-retry-D3USVm9D.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Dp0AyDHI.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-CNt7nrdS.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-D54YQPon.js → goals-config-api-C_2QWBtb.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-Bm_NZFiZ.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DDezXaVi.js → goals-settings-DhL643tc.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CRsIUeZN.js → heartbeat-settings-COVFwp7C.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-CY6cQUHL.js → image-generation-api-BNQlnwpU.js} +1 -1
- package/dist/gateway/static/root/assets/index-C_XSKOH6.css +1 -0
- package/dist/gateway/static/root/assets/{index-Dfq2laZe.js → index-DUasAutC.js} +67 -67
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D9k7EDdY.js → keyboard-shortcuts-settings-DfdJRJVy.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DZwkD1co.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DbaiBolh.js → local-apps-page-BvCPOgoi.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dqp9H2Uf.js → locale-store-BP0vD37A.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DoCY0Mm9.js → logs-page-dNL0Y1dA.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-BGlQR-Be.js → markdown-split-YO1rDk9m.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BpaeV6f_.js → media-plugins-CU_RRf-q.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BWtP5TFz.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-Cd2HpciM.js → notes-page-CeFiOK3S.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-B8MKxpZb.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-DyimBUp_.js → page-tabs-tiHmRJUA.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BKZulEYr.js → preview-open-alternatives-CU6XgaCz.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Bjz9BxBY.js → product-open-page-Dn4_qor4.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CWBuuX-S.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BJSsLsXH.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DXJDb8vB.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BPTqb2_r.js → save-bar-controls-edDUIbXo.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-YN0D81Dk.js → schedule-field-DqJO_5Yb.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BmY5PSS2.js → schema-form-CMh0jzy5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DeHpWgxM.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cf-TEYUd.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B-RhgD_p.js → settings-form-section-Bb0Bc3nJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkPupX2B.js → settings-loading-skeleton-DQhADvz1.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-2QBMvaxj.js → settings-page-b0M5HukN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CtrW-LD6.js → settings-page-layout-hvjtIjvh.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BFyfed_g.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BezIW1n9.js → share-preview-page-rbeaOpTg.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CYnH9sTt.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-Cr8_m-jS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Chtc1xDO.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-WAFhKyAu.js → system-settings-panel-BHo_hgnL.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BiC0gIBa.js → theme-store-C3KnnjcU.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-D-G-uwVJ.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-WAQO3F_8.js → typed-models-lib-DtRnG-YI.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CKlfsSeU.js → use-channel-catalog-CWWItX2g.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-D7qMR26X.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BAFHF0_v.js → voice-api-key-field-BTnltQHZ.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CpqFZze9.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-t4dXpGC0.js +1 -0
- package/dist/gateway/static/root/assets/work-page-BXwDKiMZ.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-1OP4HyvS.js → workflow-run-setup-panel-D7vKChFZ.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bos9HyqT.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +71 -24
- package/dist/src/agent/embedded/run-turn.js +68 -4
- package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
- package/dist/src/agent/inbound/inbound-loop.js +0 -2
- package/dist/src/agent/memory/builtin-provider.js +4 -4
- package/dist/src/agent/memory/compaction-planner.d.ts +16 -0
- package/dist/src/agent/memory/compaction-planner.js +152 -0
- package/dist/src/agent/memory/compaction-policy.d.ts +10 -0
- package/dist/src/agent/memory/compaction-policy.js +24 -0
- package/dist/src/agent/memory/compaction.d.ts +21 -22
- package/dist/src/agent/memory/compaction.js +220 -194
- package/dist/src/agent/memory/context-budget.d.ts +40 -0
- package/dist/src/agent/memory/context-budget.js +106 -0
- package/dist/src/agent/memory/manager.d.ts +4 -1
- package/dist/src/agent/memory/manager.js +8 -3
- package/dist/src/agent/memory/understanding/service.d.ts +2 -0
- package/dist/src/agent/memory/understanding/service.js +11 -9
- package/dist/src/agent/orchestration/context-overflow.d.ts +1 -0
- package/dist/src/agent/orchestration/context-overflow.js +19 -0
- package/dist/src/agent/orchestration/loop-guard.js +13 -9
- package/dist/src/agent/reply/post-compaction-context.d.ts +4 -0
- package/dist/src/agent/reply/post-compaction-context.js +5 -3
- package/dist/src/agent/service/process-direct-one-shot.js +1 -2
- package/dist/src/agent/service/process-direct-streaming.js +1 -2
- package/dist/src/agent/service.d.ts +1 -2
- package/dist/src/agent/service.js +16 -44
- package/dist/src/agent/session/session-inspector.js +10 -2
- package/dist/src/automations/domain/validation.d.ts +8 -8
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +17 -1
- package/dist/src/connectors/composio-sessions.d.ts +1 -0
- package/dist/src/connectors/composio-sessions.js +14 -5
- package/dist/src/connectors/composio-triggers.d.ts +1 -1
- package/dist/src/connectors/composio-triggers.js +4 -3
- package/dist/src/connectors/composio.js +1 -0
- package/dist/src/connectors/{connector-memory-sync.d.ts → connected-source-ingestion.d.ts} +11 -4
- package/dist/src/connectors/{connector-memory-sync.js → connected-source-ingestion.js} +49 -101
- package/dist/src/connectors/connected-source-normalizers.d.ts +15 -0
- package/dist/src/connectors/connected-source-normalizers.js +186 -0
- package/dist/src/connectors/connector-identity.d.ts +2 -0
- package/dist/src/connectors/connector-identity.js +29 -0
- package/dist/src/connectors/learning-coordinator.d.ts +25 -0
- package/dist/src/connectors/learning-coordinator.js +214 -0
- package/dist/src/connectors/learning-recipes.d.ts +22 -0
- package/dist/src/connectors/learning-recipes.js +121 -0
- package/dist/src/connectors/runtime-status.d.ts +1 -8
- package/dist/src/connectors/runtime-status.js +4 -29
- package/dist/src/gateway/hono/lib/config-payload.d.ts +23 -0
- package/dist/src/gateway/hono/lib/config-payload.js +3 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +28 -0
- package/dist/src/gateway/hono/routes/connectors.js +76 -118
- package/dist/src/gateway/hono/routes/models.js +24 -0
- package/dist/src/gateway/hono/routes/public-gateway.js +3 -2
- package/dist/src/gateway/hono/routes/sessions.js +17 -42
- package/dist/src/gateway/hono/routes/you.js +86 -5
- package/dist/src/gateway/service/sessions-api.d.ts +2 -3
- package/dist/src/gateway/service/sessions-api.js +4 -7
- package/dist/src/gateway/service.d.ts +5 -2
- package/dist/src/gateway/service.js +16 -11
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +19 -0
- package/dist/src/knowledge/connected-understanding-pipeline.js +268 -0
- package/dist/src/knowledge/index.d.ts +1 -0
- package/dist/src/knowledge/index.js +2 -1
- package/dist/src/knowledge/ingestion-service.d.ts +6 -4
- package/dist/src/knowledge/ingestion-service.js +13 -10
- package/dist/src/knowledge/local-folder-adapter.js +1 -0
- package/dist/src/knowledge/people-graph.js +43 -110
- package/dist/src/knowledge/types.d.ts +3 -0
- package/dist/src/providers/xopc-cloud-account-service.d.ts +40 -0
- package/dist/src/providers/xopc-cloud-account-service.js +65 -0
- package/dist/src/session/index.d.ts +1 -2
- package/dist/src/session/index.js +1 -2
- package/dist/src/session/init-session-turn.d.ts +0 -1
- package/dist/src/session/init-session-turn.js +1 -2
- package/dist/src/session/manager.d.ts +11 -17
- package/dist/src/session/manager.js +11 -14
- package/dist/src/session/session-context-for-llm.d.ts +19 -1
- package/dist/src/session/session-context-for-llm.js +87 -129
- package/dist/src/session/store.d.ts +28 -23
- package/dist/src/session/store.js +94 -83
- package/dist/src/session/transcript-format.d.ts +2 -8
- package/dist/src/session/types.d.ts +8 -6
- package/dist/src/session/user-round-delete.d.ts +3 -6
- package/dist/src/session/user-round-delete.js +12 -16
- package/dist/src/storage/sqlite/connector-learning-repository.d.ts +47 -0
- package/dist/src/storage/sqlite/connector-learning-repository.js +110 -0
- package/dist/src/storage/sqlite/index.d.ts +4 -2
- package/dist/src/storage/sqlite/index.js +5 -3
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +4 -2
- package/dist/src/storage/sqlite/knowledge-repository.js +24 -13
- package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +45 -0
- package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +2 -0
- package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +27 -0
- package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +14 -0
- package/dist/src/storage/sqlite/migrations/064_user_claims.sql +60 -0
- package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +116 -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.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -19
- package/dist/src/storage/sqlite/transcript-repository.d.ts +6 -11
- package/dist/src/storage/sqlite/transcript-repository.js +90 -84
- package/dist/src/storage/sqlite/user-claims-repository.d.ts +101 -0
- package/dist/src/storage/sqlite/user-claims-repository.js +241 -0
- package/dist/src/user-context/config.d.ts +67 -2
- package/dist/src/user-context/config.js +36 -3
- package/dist/src/user-context/projection.d.ts +36 -1
- package/dist/src/user-context/projection.js +84 -6
- package/dist/src/work-discovery/service.js +1 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-BiaQhiQp.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-CuL8Q4yF.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-TZOluRNp.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C-l6O68Z.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BW8c0xPp.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-h9CsE0GT.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-C058Mcfr.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-CsbegNqi.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BWALafGW.js +0 -2
- package/dist/gateway/static/root/assets/dreaming-settings-DkdnKMZx.js +0 -3
- package/dist/gateway/static/root/assets/goal-create-dialog-y2Y3p7_k.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DuzL-alv.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-OeLtfKI2.js +0 -2
- package/dist/gateway/static/root/assets/index-o4uaOGKT.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-3ssYIEK6.js +0 -2
- package/dist/gateway/static/root/assets/messages-KEk-hTFt.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CatZNAPc.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DJUOgqm4.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BQQAD_nu.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-fIGXTTnA.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BuU-8FCe.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DlKoeZm3.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BSUcDFnb.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bk2-SwGJ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-e_Fx1kVC.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D_cCADfj.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-fqRXpNJV.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-9Ov4htPW.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DGN2FxWv.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-HmyWSgUo.js +0 -1
- package/dist/gateway/static/root/assets/work-page-D3iKVjFq.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B5L4SFw4.js +0 -11
- package/dist/src/agent/lifecycle/handlers/compaction.d.ts +0 -13
- package/dist/src/agent/lifecycle/handlers/compaction.js +0 -18
- package/dist/src/connectors/memory-sync-coordinator.d.ts +0 -28
- package/dist/src/connectors/memory-sync-coordinator.js +0 -162
- package/dist/src/connectors/memory-sync-profile.d.ts +0 -13
- package/dist/src/connectors/memory-sync-profile.js +0 -73
- package/dist/src/session/compaction-checkpoints.d.ts +0 -8
- package/dist/src/session/compaction-checkpoints.js +0 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BWtP5TFz.js";import{n as u}from"./locale-store-BP0vD37A.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$l as f,$t as p,Au as m,Bc as h,Dc as g,Dl as _,Eo as v,Go as y,Gt as b,Hc as x,Hs as S,Ht as C,Jo as w,Jt as T,Ko as E,Ks as D,Kt as O,Ls as k,Os as A,Pc as j,Ps as M,Ql as N,Qo as P,Qt as F,Tu as I,Ut as L,Wo as R,Wt as z,Xo as B,Xs as V,Xt as H,Yo as ee,Yt as U,Zt as W,_u as G,an as K,cn as te,dn as q,en as ne,fu as J,gc as Y,gn as re,hn as X,hs as Z,in as ie,io as ae,kl as oe,ln as se,ls as ce,mc as le,ml as ue,ms as de,mu as fe,nn as pe,nr as me,on as he,pn as ge,qo as _e,qs as ve,qt as ye,rn as be,sn as xe,ss as Se,su as Ce,tn as we,uc as Te,un as Ee,vt as De,yu as Oe}from"./index-DUasAutC.js";import{t as ke}from"./page-tabs-tiHmRJUA.js";import{t as Ae}from"./time-picker-D-G-uwVJ.js";import{D as je,E as Me,t as Ne}from"./connector-logo-Di3gnR_D.js";var Pe=n(),Q=e(t(),1),$=r();function Fe(e){let t=(0,Pe.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,s;t[0]===n.timezone?s=t[1]:(s=()=>X.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=s);let[l,u]=(0,Q.useState)(s),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!X.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=d);let[f,p]=(0,Q.useState)(d),m;t[4]===n.pronouns?m=t[5]:(m=()=>!!n.pronouns&&!ge.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=m);let[h,g]=(0,Q.useState)(m),_;bb0:{if(f){_=`__custom__`;break bb0}_=X.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let v=_,y;t[6]!==r||t[7]!==n?(y=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=y):y=t[8];let b=y,x;t[9]===a?x=t[10]:(x=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=x);let S=x,C;t[11]===i.callName?C=t[12]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=C);let w;t[13]===b?w=t[14]:(w=e=>b({callName:e.target.value}),t[13]=b,t[14]=w);let T;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==w||t[18]!==n.callName?(T=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:w,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=w,t[18]=n.callName,t[19]=T):T=t[19];let E;t[20]!==C||t[21]!==T?(E=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[C,T]}),t[20]=C,t[21]=T,t[22]=E):E=t[22];let D;t[23]===i.pronouns?D=t[24]:(D=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=D);let O=h?`__custom__`:n.pronouns,k;t[25]!==b||t[26]!==n.pronouns?(k=e=>{if(e.target.value===`__custom__`){g(!0),ge.some(e=>e.value===n.pronouns)&&b({pronouns:``});return}g(!1),b({pronouns:e.target.value})},t[25]=b,t[26]=n.pronouns,t[27]=k):k=t[27];let j;t[28]===i.pronounsPlaceholder?j=t[29]:(j=(0,$.jsx)(ce,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=j);let M;t[30]===S?M=t[31]:(M=ge.map(e=>(0,$.jsx)(ce,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[30]=S,t[31]=M);let N;t[32]===i.custom?N=t[33]:(N=(0,$.jsx)(ce,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=N);let P;t[34]!==o||t[35]!==O||t[36]!==k||t[37]!==j||t[38]!==M||t[39]!==N?(P=(0,$.jsxs)(Se,{className:o,value:O,onChange:k,children:[j,M,N]}),t[34]=o,t[35]=O,t[36]=k,t[37]=j,t[38]=M,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==h||t[44]!==b||t[45]!==n.pronouns?(F=h?(0,$.jsx)(`input`,{className:c(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>b({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=h,t[44]=b,t[45]=n.pronouns,t[46]=F):F=t[46];let I;t[47]!==D||t[48]!==P||t[49]!==F?(I=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[D,P,F]}),t[47]=D,t[48]=P,t[49]=F,t[50]=I):I=t[50];let L;t[51]===i.timezone?L=t[52]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=L);let R;t[53]===o?R=t[54]:(R=c(o,`min-w-0 flex-1`),t[53]=o,t[54]=R);let z;t[55]===b?z=t[56]:(z=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),b({timezone:e.target.value})},t[55]=b,t[56]=z);let B;t[57]===S?B=t[58]:(B=X.map(e=>(0,$.jsx)(ce,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[57]=S,t[58]=B);let V;t[59]===i.timezoneCustom?V=t[60]:(V=(0,$.jsx)(ce,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=V);let H;t[61]!==R||t[62]!==z||t[63]!==B||t[64]!==V||t[65]!==v?(H=(0,$.jsxs)(Se,{className:R,value:v,onChange:z,children:[B,V]}),t[61]=R,t[62]=z,t[63]=B,t[64]=V,t[65]=v,t[66]=H):H=t[66];let ee;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ee=c(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,A.press),t[67]=ee):ee=t[67];let U;t[68]===b?U=t[69]:(U=()=>{let e=re();if(!e)return;let t=X.some(t=>t.value===e);p(!t),u(t?``:e),b({timezone:e})},t[68]=b,t[69]=U);let W;t[70]!==i.timezoneDetect||t[71]!==U?(W=(0,$.jsx)(`button`,{type:`button`,className:ee,onClick:U,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==H||t[74]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[H,W]}),t[73]=H,t[74]=W,t[75]=G):G=t[75];let K;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==b?(K=f?(0,$.jsx)(`input`,{className:c(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),b({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=f,t[79]=b,t[80]=K):K=t[80];let te;t[81]!==L||t[82]!==G||t[83]!==K?(te=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[L,G,K]}),t[81]=L,t[82]=G,t[83]=K,t[84]=te):te=t[84];let q;t[85]===i.notes?q=t[86]:(q=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=q);let ne;t[87]===o?ne=t[88]:(ne=c(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=ne);let J;t[89]===b?J=t[90]:(J=e=>b({notes:e.target.value}),t[89]=b,t[90]=J);let Y;t[91]!==i.notesPlaceholder||t[92]!==ne||t[93]!==J||t[94]!==n.notes?(Y=(0,$.jsx)(`textarea`,{className:ne,value:n.notes,onChange:J,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=ne,t[93]=J,t[94]=n.notes,t[95]=Y):Y=t[95];let Z;t[96]!==q||t[97]!==Y?(Z=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[q,Y]}),t[96]=q,t[97]=Y,t[98]=Z):Z=t[98];let ie;return t[99]!==E||t[100]!==I||t[101]!==te||t[102]!==Z?(ie=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[E,I,te,Z]}),t[99]=E,t[100]=I,t[101]=te,t[102]=Z,t[103]=ie):ie=t[103],ie}function Ie(e){let t=(0,Pe.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:I,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let s;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(s={icon:S,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=s):s=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:f,title:r.helpSourcesTitle,body:r.helpSourcesBody},t[6]=r.helpSourcesBody,t[7]=r.helpSourcesTitle,t[8]=l):l=t[8];let u;t[9]!==r.helpControlBody||t[10]!==r.helpControlTitle?(u={icon:le,title:r.helpControlTitle,body:r.helpControlBody},t[9]=r.helpControlBody,t[10]=r.helpControlTitle,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==s||t[14]!==l||t[15]!==u?(d=[o,s,l,u],t[12]=o,t[13]=s,t[14]=l,t[15]=u,t[16]=d):d=t[16];let p=d,m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(w,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,Z)}),t[17]=m):m=t[17];let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=c(`fixed right-3 top-1/2 flex h-[min(44rem,calc(100dvh-1.5rem))] w-[min(30rem,calc(100vw-1.5rem))] -translate-y-1/2 flex-col overflow-hidden`,de,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=h):h=t[18];let g;t[19]===r.helpTitle?g=t[20]:(g=(0,$.jsx)(B,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=g);let _;t[21]===r.helpSubtitle?_=t[22]:(_=(0,$.jsx)(_e,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=_);let v;t[23]!==g||t[24]!==_?(v=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===r.close?x=t[28]:(x=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:b})}),t[27]=r.close,t[28]=x);let C;t[29]!==v||t[30]!==x?(C=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[v,x]}),t[29]=v,t[30]=x,t[31]=C):C=t[31];let T;t[32]===p?T=t[33]:(T=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:p.map(Le)}),t[32]=p,t[33]=T);let D;t[34]!==a||t[35]!==i?(D=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=D):D=t[36];let O;t[37]!==r.tabs.sources||t[38]!==D?(O=(0,$.jsx)(M,{type:`button`,variant:`ghost`,onClick:D,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=D,t[39]=O):O=t[39];let A;t[40]!==a||t[41]!==i?(A=()=>{i(!1),a(`controls`)},t[40]=a,t[41]=i,t[42]=A):A=t[42];let j;t[43]!==r.openPrivacyControls||t[44]!==A?(j=(0,$.jsx)(M,{type:`button`,variant:`secondary`,onClick:A,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=A,t[45]=j):j=t[45];let N;t[46]!==O||t[47]!==j?(N=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[O,j]}),t[46]=O,t[47]=j,t[48]=N):N=t[48];let P;t[49]!==C||t[50]!==T||t[51]!==N?(P=(0,$.jsxs)(ee,{children:[m,(0,$.jsxs)(E,{className:h,children:[C,T,N]})]}),t[49]=C,t[50]=T,t[51]=N,t[52]=P):P=t[52];let F;return t[53]!==i||t[54]!==n||t[55]!==P?(F=(0,$.jsx)(R,{open:n,onOpenChange:i,children:P}),t[53]=i,t[54]=n,t[55]=P,t[56]=F):F=t[56],F}function Le(e){let{icon:t,title:n,body:r}=e;return(0,$.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}function Re(e){let t=(0,Pe.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,s=l(r).you,[u,d]=(0,Q.useState)(!1),p=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?s.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),m,h;t[0]===n?(m=t[1],h=t[2]):(m=()=>{n&&d(!1)},h=[n],t[0]=n,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g;t[3]!==i||t[4]!==a?(g=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=_):_=t[6];let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[7]=v):v=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>d(!1),t[8]=b):b=t[8];let x=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,S;t[9]===x?S=t[10]:(S=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,x),t[9]=x,t[10]=S);let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=C):C=t[11];let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>d(!0),t[12]=T):T=t[12];let D=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,O;t[13]===D?O=t[14]:(O=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,D),t[13]=D,t[14]=O);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=A):A=t[15];let j=s.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),N;t[16]===j?N=t[17]:(N=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:j}),t[16]=j,t[17]=N);let P;t[18]!==i||t[19]!==s.cancel?(P=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(M,{type:`button`,variant:`ghost`,disabled:i,children:s.cancel})}),t[18]=i,t[19]=s.cancel,t[20]=P):P=t[20];let F=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,I;t[21]!==u||t[22]!==o?(I=()=>o(u),t[21]=u,t[22]=o,t[23]=I):I=t[23];let L;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),t[24]=L):L=t[24];let z=i?s.disconnecting:s.disconnectAction,H;t[25]!==i||t[26]!==F||t[27]!==I||t[28]!==z?(H=(0,$.jsxs)(M,{type:`button`,variant:`secondary`,className:F,disabled:i,onClick:I,children:[L,z]}),t[25]=i,t[26]=F,t[27]=I,t[28]=z,t[29]=H):H=t[29];let U;return t[30]!==P||t[31]!==H?(U=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[P,H]}),t[30]=P,t[31]=H,t[32]=U):U=t[32],(0,$.jsx)(R,{open:n!==null,onOpenChange:g,children:(0,$.jsxs)(ee,{children:[_,(0,$.jsxs)(E,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(B,{className:`text-base font-semibold text-fg`,children:s.disconnectTitle}),(0,$.jsx)(_e,{className:`mt-1 text-sm text-fg-muted`,children:s.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":s.cancel,disabled:i,children:v})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[p?(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:s.disconnectAccount.replace(`{{account}}`,p)}):null,(0,$.jsx)(`p`,{children:s.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:b,className:S,children:[C,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectKeepTitle}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:s.disconnectKeepBody})]})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:T,disabled:!n?.derivedUnderstandingCount,className:O,children:[A,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectDeleteTitle}),N]})]})]}),U]})]})})}var ze={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function Be(e){if(e.branding?.logoUrl)return e.branding;let t=ze[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function Ve(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replace(`{{${t}}}`,String(n)),e)}function He(e){return e.status===`active`||e.status===`connected`}function Ue(e,t){return!He(e)||e.learning?.status===`failed`||e.lastSyncStatus===`failed`?{summary:t.sourceNeedsAttention,tone:`attention`,badge:t.attentionTitle}:e.learning?.status===`paused`?{summary:t.sourcePausedSummary,tone:`paused`,badge:t.paused}:e.learning?.status===`queued`||e.learning?.status===`running`?{summary:t.sourceReading,tone:`learning`}:e.learningFunnel.provisionalClaims>0?{summary:Ve(t.sourcePendingReview,{count:e.learningFunnel.provisionalClaims}),tone:`review`}:e.learningFunnel.activeClaims>0?{summary:Ve(t.sourceReliable,{count:e.learningFunnel.activeClaims}),tone:`useful`}:e.learningFunnel.attributedItems>0?{summary:Ve(t.sourceStillLearning,{count:e.learningFunnel.attributedItems}),tone:`learning`}:e.learningFunnel.indexedItems>0?{summary:Ve(t.sourceNoPersonalSignal,{count:e.learningFunnel.indexedItems}),tone:`neutral`}:e.learning?.status===`completed`?{summary:t.sourceNoRecentSignal,tone:`neutral`}:{summary:t.sourcePreparing,tone:`learning`}}function We(e,t){let n=e.id.toLocaleLowerCase();return/(github|gitlab|linear|jira)/.test(n)?t.sourcePurposeWork:/(gmail|outlook|slack|teams)/.test(n)?t.sourcePurposeCommunication:/calendar/.test(n)?t.sourcePurposeSchedule:/(docs|drive|notion|sheets|excel|onedrive|one-drive|local-files)/.test(n)?t.sourcePurposeDocuments:t.sourcePurposeDefault}function Ge(e,t){return e.accountLabel?e.accountLabel:e.accountCount&&e.accountCount>1&&e.accountOrdinal?Ve(t.sourceAccountFallback,{index:e.accountOrdinal,count:e.accountCount}):t.sourceUnknownAccount}function Ke(e){return e.lastSyncAt??e.learning?.updatedAt??e.lastActivityAt??e.lastConnectedAt}function qe(e,t){let n=Date.parse(e);return Number.isFinite(n)?De(n,t):e}function Je(e,t){return{attention:0,learning:1,review:2,useful:3,paused:4,neutral:5}[Ue(e,t).tone]}function Ye(e){let t=(0,Pe.c)(173),{source:n,language:r,t:i,busy:a,onOpenChange:o,onLearn:s,onPause:l,onConfigure:u,onDisconnect:d,onViewUnderstanding:f}=e;if(!n)return null;let p;t[0]!==n||t[1]!==i?(p=Ue(n,i),t[0]=n,t[1]=i,t[2]=p):p=t[2];let m=p,h,_,v,b,S,C,T,D,O,A,j,N,P,F,L,z;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==m.summary||t[7]!==m.tone||t[8]!==n||t[9]!==i){let e=Ke(n);b=n.learning?.status===`paused`,S=m.tone===`attention`,v=R,T=!0,D=o,_=ee,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=C):C=t[26],h=E,L=`fixed inset-y-0 right-0 z-[131] flex h-dvh w-[min(34rem,100vw)] flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-elevated`;let a=n.displayName,s;t[27]===n?s=t[28]:(s=Be(n),t[27]=n,t[28]=s);let l;t[29]!==n.displayName||t[30]!==s?(l=(0,$.jsx)(Ne,{connector:{displayName:a,branding:s},size:`sm`}),t[29]=n.displayName,t[30]=s,t[31]=l):l=t[31];let u;t[32]===n.displayName?u=t[33]:(u=(0,$.jsx)(B,{className:`truncate text-base font-semibold text-fg`,children:n.displayName}),t[32]=n.displayName,t[33]=u);let d;t[34]!==n||t[35]!==i?(d=Ge(n,i),t[34]=n,t[35]=i,t[36]=d):d=t[36];let p;t[37]===d?p=t[38]:(p=(0,$.jsx)(_e,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=p);let g;t[39]!==u||t[40]!==p?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[39]=u,t[40]=p,t[41]=g):g=t[41];let x;t[42]!==l||t[43]!==g?(x=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,g]}),t[42]=l,t[43]=g,t[44]=x):x=t[44];let V;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[45]=V):V=t[45];let H;t[46]===i.close?H=t[47]:(H=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.close,children:V})}),t[46]=i.close,t[47]=H),t[48]!==x||t[49]!==H?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[x,H]}),t[48]=x,t[49]=H,t[50]=z):z=t[50],P=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=U):U=t[51];let W;t[52]===i.sourceOutcomeTitle?W=t[53]:(W=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,i.sourceOutcomeTitle]}),t[52]=i.sourceOutcomeTitle,t[53]=W);let G=m.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,K;t[54]===G?K=t[55]:(K=c(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,G),t[54]=G,t[55]=K);let te;t[56]!==m.summary||t[57]!==K?(te=(0,$.jsx)(`p`,{className:K,children:m.summary}),t[56]=m.summary,t[57]=K,t[58]=te):te=t[58];let q;t[59]===n.learningFunnel.activeClaims?q=t[60]:(q=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=q);let ne;t[61]===i.sourceReliableMetric?ne=t[62]:(ne=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=ne);let J;t[63]!==q||t[64]!==ne?(J=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[q,ne]}),t[63]=q,t[64]=ne,t[65]=J):J=t[65];let Y;t[66]===n.learningFunnel.provisionalClaims?Y=t[67]:(Y=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.provisionalClaims}),t[66]=n.learningFunnel.provisionalClaims,t[67]=Y);let re;t[68]===i.sourcePendingMetric?re=t[69]:(re=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourcePendingMetric}),t[68]=i.sourcePendingMetric,t[69]=re);let X;t[70]!==Y||t[71]!==re?(X=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[Y,re]}),t[70]=Y,t[71]=re,t[72]=X):X=t[72];let Z;t[73]!==J||t[74]!==X?(Z=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[J,X]}),t[73]=J,t[74]=X,t[75]=Z):Z=t[75];let ie;t[76]!==f||t[77]!==n.learningFunnel.activeClaims||t[78]!==n.learningFunnel.provisionalClaims||t[79]!==i.sourceViewUnderstanding?(ie=n.learningFunnel.activeClaims>0||n.learningFunnel.provisionalClaims>0?(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})]}):null,t[76]=f,t[77]=n.learningFunnel.activeClaims,t[78]=n.learningFunnel.provisionalClaims,t[79]=i.sourceViewUnderstanding,t[80]=ie):ie=t[80],t[81]!==W||t[82]!==te||t[83]!==Z||t[84]!==ie?(F=(0,$.jsxs)(`section`,{children:[W,te,Z,ie]}),t[81]=W,t[82]=te,t[83]=Z,t[84]=ie,t[85]=F):F=t[85],O=`border-t border-edge-subtle pt-5`;let ae;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(Ce,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=ae):ae=t[86],t[87]===i.sourceRecentRunTitle?A=t[88]:(A=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[ae,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=A);let oe;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(oe=Ve(i.sourceRecentRunSummary,{indexed:n.learningFunnel.indexedItems,attributed:n.learningFunnel.attributedItems,claims:n.learningFunnel.activeClaims}),t[89]=n.learningFunnel.activeClaims,t[90]=n.learningFunnel.attributedItems,t[91]=n.learningFunnel.indexedItems,t[92]=i.sourceRecentRunSummary,t[93]=oe):oe=t[93],t[94]===oe?j=t[95]:(j=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:oe}),t[94]=oe,t[95]=j),N=e?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceUpdatedAt,{time:qe(e,r)})}):null,t[3]=r,t[4]=o,t[5]=f,t[6]=m.summary,t[7]=m.tone,t[8]=n,t[9]=i,t[10]=h,t[11]=_,t[12]=v,t[13]=b,t[14]=S,t[15]=C,t[16]=T,t[17]=D,t[18]=O,t[19]=A,t[20]=j,t[21]=N,t[22]=P,t[23]=F,t[24]=L,t[25]=z}else h=t[10],_=t[11],v=t[12],b=t[13],S=t[14],C=t[15],T=t[16],D=t[17],O=t[18],A=t[19],j=t[20],N=t[21],P=t[22],F=t[23],L=t[24],z=t[25];let V;t[96]!==O||t[97]!==A||t[98]!==j||t[99]!==N?(V=(0,$.jsxs)(`section`,{className:O,children:[A,j,N]}),t[96]=O,t[97]=A,t[98]=j,t[99]=N,t[100]=V):V=t[100];let H;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(le,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=H):H=t[101];let U;t[102]===i.sourceAccessTitle?U=t[103]:(U=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[H,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=U);let W;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(G,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=W):W=t[104];let K;t[105]===i.sourceReadAccess?K=t[106]:(K=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[W,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=K);let te;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(G,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=te):te=t[107];let q;t[108]===i.sourceMemoryAccess?q=t[109]:(q=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[te,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=q);let ne;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(le,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=ne):ne=t[110];let J=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,re;t[111]===J?re=t[112]:(re=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[ne,(0,$.jsx)(`span`,{children:J})]}),t[111]=J,t[112]=re);let X;t[113]!==K||t[114]!==q||t[115]!==re?(X=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[K,q,re]}),t[113]=K,t[114]=q,t[115]=re,t[116]=X):X=t[116];let Z;t[117]!==U||t[118]!==X?(Z=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[U,X]}),t[117]=U,t[118]=X,t[119]=Z):Z=t[119];let ie;t[120]!==V||t[121]!==Z||t[122]!==P||t[123]!==F?(ie=(0,$.jsxs)(`div`,{className:P,children:[F,V,Z]}),t[120]=V,t[121]=Z,t[122]=P,t[123]=F,t[124]=ie):ie=t[124];let ae;t[125]===i.sourceManagementTitle?ae=t[126]:(ae=(0,$.jsx)(`p`,{className:`mb-2 px-1 text-xs font-medium text-fg-subtle`,children:i.sourceManagementTitle}),t[125]=i.sourceManagementTitle,t[126]=ae);let oe;t[127]!==a||t[128]!==b||t[129]!==S||t[130]!==s||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(oe=He(n)?b||S?(0,$.jsxs)(M,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>s(n),children:[a?(0,$.jsx)(g,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(Te,{className:`size-4`,"aria-hidden":!0}),S?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(M,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=b,t[129]=S,t[130]=s,t[131]=l,t[132]=n,t[133]=i.sourcePauseLearning,t[134]=i.sourceResumeLearning,t[135]=i.sourceRetryLearning,t[136]=oe):oe=t[136];let se;t[137]!==u||t[138]!==n?(se=()=>u(n),t[137]=u,t[138]=n,t[139]=se):se=t[139];let ce;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),t[140]=ce):ce=t[140];let ue;t[141]!==i.sourceConnectionSettings||t[142]!==se?(ue=(0,$.jsxs)(M,{type:`button`,variant:`secondary`,onClick:se,children:[ce,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=se,t[143]=ue):ue=t[143];let de;t[144]!==d||t[145]!==n?(de=()=>d(n),t[144]=d,t[145]=n,t[146]=de):de=t[146];let fe;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),t[147]=fe):fe=t[147];let pe;t[148]!==i.disconnect||t[149]!==de?(pe=(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:de,children:[fe,i.disconnect]}),t[148]=i.disconnect,t[149]=de,t[150]=pe):pe=t[150];let me;t[151]!==oe||t[152]!==ue||t[153]!==pe?(me=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[oe,ue,pe]}),t[151]=oe,t[152]=ue,t[153]=pe,t[154]=me):me=t[154];let he;t[155]!==ae||t[156]!==me?(he=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[ae,me]}),t[155]=ae,t[156]=me,t[157]=he):he=t[157];let ge;t[158]!==h||t[159]!==ie||t[160]!==he||t[161]!==L||t[162]!==z?(ge=(0,$.jsxs)(h,{className:L,children:[z,ie,he]}),t[158]=h,t[159]=ie,t[160]=he,t[161]=L,t[162]=z,t[163]=ge):ge=t[163];let ye;t[164]!==_||t[165]!==C||t[166]!==ge?(ye=(0,$.jsxs)(_,{children:[C,ge]}),t[164]=_,t[165]=C,t[166]=ge,t[167]=ye):ye=t[167];let be;return t[168]!==v||t[169]!==T||t[170]!==D||t[171]!==ye?(be=(0,$.jsx)(v,{open:T,onOpenChange:D,children:ye}),t[168]=v,t[169]=T,t[170]=D,t[171]=ye,t[172]=be):be=t[172],be}function Xe(e){let t=(0,Pe.c)(69),{sources:n,language:r,t:i,busyId:a,onAddSource:o,onLearn:l,onPause:u,onConfigure:d,onDisconnect:f,onViewUnderstanding:p}=e,[m,h]=(0,Q.useState)(null),g;if(t[0]!==n||t[1]!==i){let e=n.filter(Qe),r=new Map;for(let t of e){let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}let a;t[3]===i?a=t[4]:(a=(e,t)=>Math.min(...e.accounts.map(e=>Je(e,i)))-Math.min(...t.accounts.map(e=>Je(e,i)))||e.source.displayName.localeCompare(t.source.displayName),t[3]=i,t[4]=a),g=[...r.values()].map(e=>({source:e[0],accounts:e.sort((e,t)=>Je(e,i)-Je(t,i)||Ge(e,i).localeCompare(Ge(t,i)))})).sort(a),t[0]=n,t[1]=i,t[2]=g}else g=t[2];let _=g,v,y,b,x,S,C,w,T,E;if(t[5]!==_||t[6]!==m||t[7]!==n||t[8]!==i.sourceConnectedSummary||t[9]!==i.sourcesSubtitle||t[10]!==i.sourcesTitle){let e=_.reduce(Ze,0),r;t[20]!==m||t[21]!==n?(r=m?n.find(e=>e.instanceId===m)??null:null,t[20]=m,t[21]=n,t[22]=r):r=t[22],v=r,C=`you-panel-sources`,w=`tabpanel`,T=`you-tab-sources`,E=`space-y-5`,S=`flex flex-wrap items-start justify-between gap-3`,t[23]===i.sourcesTitle?y=t[24]:(y=(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.sourcesTitle}),t[23]=i.sourcesTitle,t[24]=y),t[25]===i.sourcesSubtitle?b=t[26]:(b=(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:i.sourcesSubtitle}),t[25]=i.sourcesSubtitle,t[26]=b),x=_.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceConnectedSummary,{accounts:e,sources:_.length})}):null,t[5]=_,t[6]=m,t[7]=n,t[8]=i.sourceConnectedSummary,t[9]=i.sourcesSubtitle,t[10]=i.sourcesTitle,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=E}else v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19];let D;t[27]!==y||t[28]!==b||t[29]!==x?(D=(0,$.jsxs)(`div`,{children:[y,b,x]}),t[27]=y,t[28]=b,t[29]=x,t[30]=D):D=t[30];let O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),t[31]=O):O=t[31];let k;t[32]!==o||t[33]!==i.addSource?(k=(0,$.jsxs)(M,{type:`button`,variant:`primary`,onClick:o,children:[O,i.addSource]}),t[32]=o,t[33]=i.addSource,t[34]=k):k=t[34];let A;t[35]!==D||t[36]!==k||t[37]!==S?(A=(0,$.jsxs)(`div`,{className:S,children:[D,k]}),t[35]=D,t[36]=k,t[37]=S,t[38]=A):A=t[38];let N;t[39]!==_||t[40]!==r||t[41]!==o||t[42]!==i?(N=_.length>0?(0,$.jsx)(`div`,{className:`space-y-3`,children:_.map(e=>{let{source:t,accounts:n}=e;return(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3.5 sm:px-5`,children:[(0,$.jsx)(Ne,{connector:{displayName:t.displayName,branding:Be(t)},size:`sm`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.displayName}),n.length>1?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ve(i.sourceAccountCount,{count:n.length})}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:We(t,i)})]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>{let t=Ue(e,i),n=Ke(e);return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 sm:px-5`,onClick:()=>h(e.instanceId??null),children:[(0,$.jsx)(`span`,{className:c(`size-2 shrink-0 rounded-full`,t.tone===`attention`?`bg-warning`:t.tone===`useful`?`bg-success`:t.tone===`learning`?`bg-accent`:`bg-fg-subtle/50`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:Ge(e,i)}),t.badge?(0,$.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-[11px] font-medium`,t.tone===`attention`?`bg-warning-soft text-fg`:`bg-surface-muted text-fg-muted`),children:t.badge}):null]}),(0,$.jsx)(`span`,{className:c(`mt-1 block text-xs leading-5`,t.tone===`attention`?`text-fg`:`text-fg-muted`),children:t.summary})]}),n?(0,$.jsx)(`span`,{className:`hidden shrink-0 text-xs text-fg-subtle sm:block`,children:Ve(i.sourceUpdatedAt,{time:qe(n,r)})}):null,(0,$.jsx)(Oe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]},e.instanceId)})})]},t.id)})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center`,children:[(0,$.jsx)(s,{className:`mx-auto size-5 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i.noSources}),(0,$.jsxs)(M,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:o,children:[(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),i.addSource]})]}),t[39]=_,t[40]=r,t[41]=o,t[42]=i,t[43]=N):N=t[43];let P=v?a===`source-learning:${v.instanceId}`:!1,F;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||h(null)},t[44]=F):F=t[44];let I;t[45]===d?I=t[46]:(I=e=>{h(null),d(e)},t[45]=d,t[46]=I);let L;t[47]===f?L=t[48]:(L=e=>{h(null),f(e)},t[47]=f,t[48]=L);let R;t[49]===p?R=t[50]:(R=()=>{h(null),p()},t[49]=p,t[50]=R);let z;t[51]!==r||t[52]!==l||t[53]!==u||t[54]!==v||t[55]!==i||t[56]!==P||t[57]!==I||t[58]!==L||t[59]!==R?(z=(0,$.jsx)(Ye,{source:v,language:r,t:i,busy:P,onOpenChange:F,onLearn:l,onPause:u,onConfigure:I,onDisconnect:L,onViewUnderstanding:R}),t[51]=r,t[52]=l,t[53]=u,t[54]=v,t[55]=i,t[56]=P,t[57]=I,t[58]=L,t[59]=R,t[60]=z):z=t[60];let B;return t[61]!==A||t[62]!==N||t[63]!==z||t[64]!==C||t[65]!==w||t[66]!==T||t[67]!==E?(B=(0,$.jsxs)(`div`,{id:C,role:w,"aria-labelledby":T,className:E,children:[A,N,z]}),t[61]=A,t[62]=N,t[63]=z,t[64]=C,t[65]=w,t[66]=T,t[67]=E,t[68]=B):B=t[68],B}function Ze(e,t){return e+t.accounts.length}function Qe(e){return e.installed}var $e=new Set([`overview`,`profile`,`understanding`,`sources`,`controls`]),et=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],tt=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function nt(e,t){return e.replace(`{{count}}`,String(t))}function rt(e){let t=(0,Pe.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-flex rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function it(e,t){let n=Date.parse(e);return Number.isFinite(n)?De(n,t):e}function at(e){return e===`review`?`understanding`:e===`privacy`?`controls`:e&&$e.has(e)?e:`overview`}function ot(){let e=(0,Pe.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ae,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsx)(ae,{className:`h-64 rounded-2xl`}),(0,$.jsx)(ae,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function st(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function ct(e){let t=(0,Pe.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:s,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(n.statement),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),S=n.status!==`active`,C=S?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,w;t[0]===C?w=t[1]:(w=c(`rounded-xl border p-3.5`,C),t[0]=C,t[1]=w);let T;t[2]!==a||t[3]!==m||t[4]!==f||t[5]!==v||t[6]!==b||t[7]!==n||t[8]!==r||t[9]!==S||t[10]!==s||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(T=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(tt,`min-h-20 resize-y`),value:m,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),p(!1)},children:i.cancel}),(0,$.jsx)(M,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!m.trim(),onClick:()=>{u(m.trim()),p(!1)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Te,{className:`size-3 text-accent`,"aria-hidden":!0}),st(n,i)]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>0?(0,$.jsx)(`span`,{children:nt(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,$.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,it(n.latestEvidenceAt,r))}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:s,children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:b,onClick:()=>{if(v){y(null);return}x(!0),U(n.id).then(e=>y(e.history)).finally(()=>x(!1))},children:[(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:it(n.updatedAt,r)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:nt(i.evidenceCount,n.evidenceCount)})]}),n.evidenceBasis?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:i.evidenceRuleValue.replace(`{{events}}`,String(n.evidenceBasis.eventCount)).replace(`{{days}}`,String(n.evidenceBasis.activeDays)).replace(`{{window}}`,String(n.evidenceBasis.windowDays))})]}):null,n.confidence===void 0?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,$.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:it(n.validTo,r)})]}):null,n.expiresAt?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:it(n.expiresAt,r)})]}):null]})]}),v?(0,$.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),v.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,$.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:it(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=m,t[4]=f,t[5]=v,t[6]=b,t[7]=n,t[8]=r,t[9]=S,t[10]=s,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=T):T=t[15];let E;return t[16]!==w||t[17]!==T?(E=(0,$.jsx)(`article`,{className:w,children:T}),t[16]=w,t[17]=T,t[18]=E):E=t[18],E}function lt(e){let t=(0,Pe.c)(86),{claim:n,language:r,t:i,busy:a,onDecision:s}=e,l=typeof n.value.label==`string`?n.value.label:``,u;if(t[0]!==n.class||t[1]!==n.value.hour||t[2]!==n.value.weekday||t[3]!==l||t[4]!==r||t[5]!==i.claimProject||t[6]!==i.claimRelationship||t[7]!==i.claimRoutine){let e=r===`zh`?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];u=n.class===`relationship`?i.claimRelationship.replace(`{{label}}`,l):n.class===`project`?i.claimProject.replace(`{{label}}`,l):i.claimRoutine.replace(`{{weekday}}`,e[Number(n.value.weekday)]??``).replace(`{{hour}}`,String(n.value.hour).padStart(2,`0`)),t[0]=n.class,t[1]=n.value.hour,t[2]=n.value.weekday,t[3]=l,t[4]=r,t[5]=i.claimProject,t[6]=i.claimRelationship,t[7]=i.claimRoutine,t[8]=u}else u=t[8];let d=u,f;t[9]===n.evidence?f=t[10]:(f=new Set(n.evidence.map(ut)),t[9]=n.evidence,t[10]=f);let p;t[11]===f?p=t[12]:(p=[...f],t[11]=f,t[12]=p);let m=p,h=n.state===`provisional`||n.state===`stale`,g=h?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,_;t[13]===g?_=t[14]:(_=c(`rounded-xl border p-3.5`,g),t[13]=g,t[14]=_);let v=i.claimClasses[n.class],y;t[15]===v?y=t[16]:(y=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:v}),t[15]=v,t[16]=y);let b;t[17]===d?b=t[18]:(b=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S=i.claimStates[n.state],C;t[22]===S?C=t[23]:(C=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:S}),t[22]=S,t[23]=C);let w;t[24]!==C||t[25]!==x?(w=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[x,C]}),t[24]=C,t[25]=x,t[26]=w):w=t[26];let T;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(T=i.claimEvidence.replace(`{{events}}`,String(n.independentEvidenceCount)).replace(`{{days}}`,String(n.activeDayCount)),t[27]=n.activeDayCount,t[28]=n.independentEvidenceCount,t[29]=i.claimEvidence,t[30]=T):T=t[30];let E;t[31]===T?E=t[32]:(E=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:T}),t[31]=T,t[32]=E);let D;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(D=i.observedAt.replace(`{{time}}`,it(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=D):D=t[36];let O;t[37]===D?O=t[38]:(O=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:D}),t[37]=D,t[38]=O);let A;t[39]!==a||t[40]!==h||t[41]!==s||t[42]!==i.confirm||t[43]!==i.notTrue?(A=h?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`reject`),children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=h,t[41]=s,t[42]=i.confirm,t[43]=i.notTrue,t[44]=A):A=t[44];let j;t[45]!==O||t[46]!==A?(j=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[O,A]}),t[45]=O,t[46]=A,t[47]=j):j=t[47];let N;t[48]===i.viewEvidence?N=t[49]:(N=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=N);let P;t[50]===i.evidenceSource?P=t[51]:(P=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=P);let F=m.join(`, `),I;t[52]===F?I=t[53]:(I=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:F}),t[52]=F,t[53]=I);let L;t[54]!==P||t[55]!==I?(L=(0,$.jsxs)(`div`,{children:[P,I]}),t[54]=P,t[55]=I,t[56]=L):L=t[56];let R;t[57]===i.evidenceConfidence?R=t[58]:(R=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=R);let z;t[59]===n.confidence?z=t[60]:(z=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=z);let B;t[61]===z?B=t[62]:(B=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[z,`%`]}),t[61]=z,t[62]=B);let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;t[66]===i.evidenceRule?H=t[67]:(H=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=H);let ee;t[68]===i.claimRule?ee=t[69]:(ee=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=ee);let U;t[70]!==H||t[71]!==ee?(U=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[H,ee]}),t[70]=H,t[71]=ee,t[72]=U):U=t[72];let W;t[73]!==L||t[74]!==V||t[75]!==U?(W=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[L,V,U]}),t[73]=L,t[74]=V,t[75]=U,t[76]=W):W=t[76];let G;t[77]!==N||t[78]!==W?(G=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[N,W]}),t[77]=N,t[78]=W,t[79]=G):G=t[79];let K;return t[80]!==w||t[81]!==E||t[82]!==j||t[83]!==G||t[84]!==_?(K=(0,$.jsxs)(`article`,{className:_,children:[w,E,j,G]}),t[80]=w,t[81]=E,t[82]=j,t[83]=G,t[84]=_,t[85]=K):K=t[85],K}function ut(e){return e.sourceInstanceId}function dt(e){let t=(0,Pe.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:s,onDelete:l,onRollback:u}=e,[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),v=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,y;t[0]===v?y=t[1]:(y=c(`rounded-xl border p-4`,v),t[0]=v,t[1]=y);let b=i.playbookNames[n.id],x;t[2]===b?x=t[3]:(x=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b}),t[2]=b,t[3]=x);let S;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(S=nt(i.playbookRuleCount,n.rules.filter(mt).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=S):S=t[6];let C;t[7]===S?C=t[8]:(C=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S}),t[7]=S,t[8]=C);let w;t[9]!==x||t[10]!==C?(w=(0,$.jsxs)(`div`,{children:[x,C]}),t[9]=x,t[10]=C,t[11]=w):w=t[11];let T=n.enabled?i.pausePlaybook:i.resumePlaybook,E;t[12]!==r||t[13]!==a||t[14]!==T?(E=(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:T}),t[12]=r,t[13]=a,t[14]=T,t[15]=E):E=t[15];let D;t[16]!==w||t[17]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,E]}),t[16]=w,t[17]=E,t[18]=D):D=t[18];let O;t[19]!==r||t[20]!==p||t[21]!==g||t[22]!==l||t[23]!==u||t[24]!==s||t[25]!==n.rules||t[26]!==i.cancel||t[27]!==i.deleteRule||t[28]!==i.disableRule||t[29]!==i.edit||t[30]!==i.enableRule||t[31]!==i.moveDown||t[32]!==i.moveUp||t[33]!==i.rollbackRule||t[34]!==i.ruleChannelContext||t[35]!==i.ruleContextAny||t[36]!==i.ruleHistory||t[37]!==i.ruleSupportContext||t[38]!==i.ruleSupportNeeds||t[39]!==i.save?(O=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:c(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:p===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(tt,`min-h-16 resize-y`),value:g,onChange:e=>_(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>m(null),children:i.cancel}),(0,$.jsx)(M,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!g.trim(),onClick:()=>{s(e.id,{statement:g.trim()}),m(null)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,$.jsxs)(Se,{value:e.context.supportNeed??``,disabled:r,onChange:t=>s(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,$.jsx)(ce,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,$.jsx)(ce,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,$.jsxs)(Se,{value:e.context.channel??``,disabled:r,onChange:t=>s(e.id,{context:{channel:t.target.value||null}}),children:[(0,$.jsx)(ce,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(pt)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>s(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>s(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>s(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{m(e.id),_(e.statement)},children:[(0,$.jsx)(h,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(V,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,$.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(ft).map(t=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,$.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=p,t[21]=g,t[22]=l,t[23]=u,t[24]=s,t[25]=n.rules,t[26]=i.cancel,t[27]=i.deleteRule,t[28]=i.disableRule,t[29]=i.edit,t[30]=i.enableRule,t[31]=i.moveDown,t[32]=i.moveUp,t[33]=i.rollbackRule,t[34]=i.ruleChannelContext,t[35]=i.ruleContextAny,t[36]=i.ruleHistory,t[37]=i.ruleSupportContext,t[38]=i.ruleSupportNeeds,t[39]=i.save,t[40]=O):O=t[40];let k;t[41]===O?k=t[42]:(k=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:O}),t[41]=O,t[42]=k);let A;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>f(e.target.value),t[43]=A):A=t[43];let j;t[44]!==d||t[45]!==i.newRulePlaceholder?(j=(0,$.jsx)(`input`,{className:tt,value:d,onChange:A,placeholder:i.newRulePlaceholder}),t[44]=d,t[45]=i.newRulePlaceholder,t[46]=j):j=t[46];let N;t[47]!==r||t[48]!==d?(N=r||!d.trim(),t[47]=r,t[48]=d,t[49]=N):N=t[49];let P;t[50]!==d||t[51]!==o?(P=()=>{o(d.trim()),f(``)},t[50]=d,t[51]=o,t[52]=P):P=t[52];let F;t[53]!==i.addRule||t[54]!==N||t[55]!==P?(F=(0,$.jsx)(M,{type:`button`,variant:`secondary`,disabled:N,onClick:P,children:i.addRule}),t[53]=i.addRule,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==j||t[58]!==F?(I=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[j,F]}),t[57]=j,t[58]=F,t[59]=I):I=t[59];let L=i.playbookRuleExamples[n.id],R;t[60]===L?R=t[61]:(R=(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:L}),t[60]=L,t[61]=R);let z;t[62]!==I||t[63]!==R?(z=(0,$.jsxs)(`div`,{className:`mt-3`,children:[I,R]}),t[62]=I,t[63]=R,t[64]=z):z=t[64];let B;return t[65]!==D||t[66]!==k||t[67]!==y||t[68]!==z?(B=(0,$.jsxs)(`article`,{className:y,children:[D,k,z]}),t[65]=D,t[66]=k,t[67]=y,t[68]=z,t[69]=B):B=t[69],B}function ft(e){return!e.current}function pt(e){return(0,$.jsx)(ce,{value:e,children:e},e)}function mt(e){return e.enabled}function ht(e){let t=(0,Pe.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:s,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,$.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,p;t[6]===f?p=t[7]:(p=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let m;t[8]===l.callName?m=t[9]:(m=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=m);let h;t[10]===a?h=t[11]:(h=e=>a(e.target.value),t[10]=a,t[11]=h);let g;t[12]!==i||t[13]!==r||t[14]!==o?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=g):g=t[15];let _=l.meetPlaceholder,v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=c(tt,`h-10 flex-1 bg-surface-base/90`),t[16]=v):v=t[16];let y;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==h||t[20]!==g?(y=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:h,onKeyDown:g,placeholder:_,className:v}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=h,t[20]=g,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==r?(b=i||!r.trim(),t[22]=i,t[23]=r,t[24]=b):b=t[24];let x=i?l.meetSaving:l.meetSave,S;t[25]!==o||t[26]!==b||t[27]!==x?(S=(0,$.jsx)(M,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:b,onClick:o,children:x}),t[25]=o,t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;t[29]!==y||t[30]!==S||t[31]!==m?(C=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[m,y,S]}),t[29]=y,t[30]=S,t[31]=m,t[32]=C):C=t[32];let w;t[33]!==n||t[34]!==l.meetSource?(w=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(le,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=w):w=t[35];let T;t[36]!==i||t[37]!==s||t[38]!==l.meetLater?(T=(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:s,children:l.meetLater}),t[36]=i,t[37]=s,t[38]=l.meetLater,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==w||t[42]!==T||t[43]!==d||t[44]!==p?(E=(0,$.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,C,w,T]})}),t[40]=C,t[41]=w,t[42]=T,t[43]=d,t[44]=p,t[45]=E):E=t[45],E}function gt(){let e=u(e=>e.language),t=l(e).you,n=a(),[r,s]=i(),g=at(r.get(`tab`)),_=v(e=>e.setPageHeader),y=v(e=>e.clearPageHeader),{data:x,error:S,isLoading:w,mutate:E}=d(`/api/you`,H),[k,A]=(0,Q.useState)(null),[R,B]=(0,Q.useState)(!1),[V,ee]=(0,Q.useState)(``),[U,G]=(0,Q.useState)(`preference`),[Y,X]=(0,Q.useState)(null),[Z,ae]=(0,Q.useState)(!1),[de,ge]=(0,Q.useState)(null),[_e,ve]=(0,Q.useState)(!1),[Ce,Te]=(0,Q.useState)(``),[De,Ne]=(0,Q.useState)(!1),[Pe,Le]=(0,Q.useState)(null),[ze,Be]=(0,Q.useState)(!1),[Ve,He]=(0,Q.useState)(!1),[Ue,We]=(0,Q.useState)(!1),[Ge,Ke]=(0,Q.useState)(null),[qe,Je]=(0,Q.useState)(!1),[Ye,Ze]=(0,Q.useState)(null),[Qe,$e]=(0,Q.useState)(null),[ut,ft]=(0,Q.useState)(!1),[pt,mt]=(0,Q.useState)(null),gt=(0,Q.useRef)(null),_t=(0,Q.useRef)(null),vt=x?.profile??{callName:``,pronouns:``,timezone:``,notes:``},yt=(0,Q.useMemo)(()=>x?.understanding.filter(e=>e.status===`active`)??[],[x]),bt=(0,Q.useMemo)(()=>x?.understanding.filter(e=>e.status!==`active`)??[],[x]),xt=(0,Q.useMemo)(()=>x?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[x]),St=(0,Q.useMemo)(()=>xt.filter(e=>e.state!==`active`),[xt]),Ct=(0,Q.useMemo)(()=>new Map(et.map(e=>[e,yt.filter(t=>t.facet===e)])),[yt]),wt=Pe??x?.controls??null,Tt=x?.sources.filter(e=>e.installed&&e.enabled)??[],Et=Tt.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{E()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[E]);async function Dt(e){if(!(!x||Ue)){We(!0);try{let t=await he(e);await E({...x,relationship:t.relationship},{revalidate:!1})}catch{P({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{We(!1)}}}async function Ot(e,n){A(`claim:${e.id}`);try{let t=await be(e.id,n);await E(e=>e&&{...e,connectedClaims:e.connectedClaims.map(e=>e.id===t.id?t:e)},{revalidate:!1})}catch{P({type:`error`,title:t.connectedClaimsTitle,message:t.saveError})}finally{A(null)}}let kt=(e,t)=>{let n=new URLSearchParams(r);e===`overview`?n.delete(`tab`):n.set(`tab`,e),t?n.set(`status`,t):n.delete(`status`),s(n,{replace:!0})},At=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)},jt=async e=>{if(e.instanceId){A(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Me(e.instanceId,!1):await je(e.instanceId),await E(),P({type:`success`,title:e.displayName,message:t.sourceLearningStarted})}catch(n){P({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{A(null)}}},Mt=async e=>{if(e.instanceId){A(`source-learning:${e.instanceId}`);try{await Me(e.instanceId,!0),await E()}catch(n){P({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{A(null)}}};(0,Q.useLayoutEffect)(()=>(_({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,$.jsxs)(M,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>Je(!0),children:[(0,$.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>y()),[y,_,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!x||x.profile.callName||Te(x.profileSetup.callNameSuggestion?.value??``)},[x,x?.profile.callName,x?.profileSetup.callNameSuggestion?.id]);async function Nt(e,n,r){A(e.id);try{let t=await xe(e.id,{action:n,content:r});await E(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),E()}catch{P({type:`error`,title:t.title,message:t.saveError})}finally{A(null)}}async function Pt(e,n){A(`consent:${e}`);try{await b(e,n),await E(),P({type:`success`,title:t.title,message:t.saved})}catch{P({type:`error`,title:t.title,message:t.saveError})}finally{A(null)}}async function Ft(){let e=V.trim();if(e){A(`understanding:new`);try{await z({content:e,kind:U}),ee(``),B(!1),await E(),P({type:`success`,title:t.understandingTitle,message:t.saved})}catch{P({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{A(null)}}}async function It(){if(bt.length){A(`understanding:batch`);try{await C(bt.map(e=>e.id),`confirm`),await E()}catch{P({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{A(null)}}}async function Lt(e,n){A(`conflict:${e}`);try{await p(e,n),await E()}catch{P({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{A(null)}}async function Rt(e){A(`grant:${e}`);try{await ne(e),await E()}catch{P({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{A(null)}}async function zt(r,i){A(`insight:${r.id}`);try{let t=await ie(r.id,{action:i,uiLocale:e});await E(),i===`apply`&&t.href&&n(t.href)}catch{P({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{A(null)}}async function Bt(e){A(`playbook:${e.id}`);try{await pe(e.id,!e.enabled),await E()}catch{P({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{A(null)}}async function Vt(e,n){A(`playbook:${e}`);try{await n(),await E()}catch{P({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{A(null)}}async function Ht(){if(Y){A(Y.id);try{await W(Y.id);let e=Y.id;X(null),await E(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),E()}catch{P({type:`error`,title:t.title,message:t.saveError})}finally{A(null)}}}async function Ut(){if(de){ve(!0);try{let e=await se(de);ae(!1),ge(null),await E(t=>t&&{...t,...e},{revalidate:!1})}catch{P({type:`error`,title:t.title,message:t.saveError})}finally{ve(!1)}}}async function Wt(){let e=Ce.trim();if(!(!e||De)){Ne(!0);try{let t=await se({callName:e,timezone:vt.timezone||re()});await E(e=>e&&{...e,...t},{revalidate:!1})}catch{P({type:`error`,title:t.title,message:t.saveError})}finally{Ne(!1)}}}async function Gt(){if(!De){Ne(!0);try{let e=await Ee(`snooze`);await E(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{P({type:`error`,title:t.title,message:t.saveError})}finally{Ne(!1)}}}function Kt(){ge(vt),ae(!0),kt(`profile`),requestAnimationFrame(()=>gt.current?.scrollIntoView({behavior:`smooth`,block:`start`}))}function qt(e){G(e),B(!0),kt(`understanding`)}async function Jt(){if(wt){Be(!0);try{Le(await te(wt)),await E(),P({type:`success`,title:t.title,message:t.saved})}catch{P({type:`error`,title:t.title,message:t.saveError})}finally{Be(!1)}}}async function Yt(e){if(!(Ve||e===x?.trust.defaultActionLevel)){He(!0);try{let t=await q(e);await E(e=>e&&{...e,trust:t},{revalidate:!1})}catch{P({type:`error`,title:t.trustTitle,message:t.saveError})}finally{He(!1),Ke(null)}}}async function Xt(e){if(!(!Qe?.instanceId||ut)){ft(!0);try{let n=await ye(Qe.instanceId,e);$e(null),await E(),P({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{P({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{ft(!1)}}}async function Zt(){if(!pt){mt(`export`);try{let e=await T(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{P({type:`error`,title:t.transferTitle,message:t.saveError})}finally{mt(null)}}}async function Qt(e){if(!(!e||pt)){mt(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await F(JSON.parse(await e.text()));await E(),kt(`understanding`,`review`),P({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{P({type:`error`,title:t.transferTitle,message:t.importError})}finally{_t.current&&(_t.current.value=``),Ze(null),mt(null)}}}function $t(){Ze(null),_t.current&&(_t.current.value=``)}return(0,$.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ke,{items:[{id:`overview`,label:t.tabs.overview,icon:oe},{id:`profile`,label:t.tabs.profile,icon:J},{id:`understanding`,label:t.tabs.understanding,icon:I,count:bt.length+St.length||void 0},{id:`sources`,label:t.tabs.sources,icon:f},{id:`controls`,label:t.tabs.controls,icon:le}],activeTab:g,onChange:kt,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),w?(0,$.jsx)(ot,{}):S||!x?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,x&&g===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!vt.callName&&x.profileSetup.shouldPrompt?(0,$.jsx)(ht,{suggestion:x.profileSetup.callNameSuggestion,draft:Ce,busy:De,onDraftChange:Te,onSave:()=>void Wt(),onLater:()=>void Gt(),t}):null,bt.length>0||Et.length>0||!vt.callName?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[bt.length>0?(0,$.jsxs)(M,{type:`button`,variant:`secondary`,onClick:()=>kt(`understanding`,`review`),children:[nt(t.reviewCount,bt.length),(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})]}):null,Et.length>0?(0,$.jsxs)(M,{type:`button`,variant:`secondary`,onClick:()=>kt(`sources`),children:[nt(t.sourceIssues,Et.length),(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})]}):null,vt.callName?null:(0,$.jsxs)(M,{type:`button`,variant:`secondary`,onClick:Kt,children:[t.completeProfile,(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>kt(`understanding`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:yt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>kt(`sources`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Tt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>kt(`understanding`,`review`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:bt.length+St.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(oe,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,$.jsx)(Se,{value:x.relationship.supportMode,disabled:Ue,onChange:e=>void Dt({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,$.jsx)(ce,{value:e,children:t},e))})]})]}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-edge-subtle pt-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:x.relationship.proactiveEnabled,disabled:Ue,onChange:e=>void Dt({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(Ae,{value:x.relationship.quietStart??``,disabled:Ue,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Dt({quietStart:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(Ae,{value:x.relationship.quietEnd??``,disabled:Ue,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Dt({quietEnd:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,$.jsx)(`input`,{className:tt,defaultValue:x.relationship.blockedTopics.join(`, `),disabled:Ue,onBlur:e=>void Dt({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]})]}),x.insights.length>0?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(ue,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,$.jsx)(rt,{children:t.confirmedContextBadge})]}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:x.insights.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?nt(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:k===`insight:${e.id}`,onClick:()=>void zt(e,`dismiss`),children:t.notNow}),(0,$.jsx)(M,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:k===`insight:${e.id}`,onClick:()=>void zt(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(J,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>kt(`profile`),children:(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:vt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:vt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:vt.pronouns||`—`})]}),vt.notes?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:vt.notes})]}):null]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>kt(`understanding`),children:(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[yt.slice(0,4).map(e=>(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),yt.length===0?(0,$.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,x&&g===`profile`?(0,$.jsxs)(`div`,{id:`you-panel-profile`,role:`tabpanel`,"aria-labelledby":`you-tab-profile`,className:`space-y-5`,children:[(0,$.jsxs)(`section`,{ref:gt,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(J,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(rt,{children:t.onlyYouEditBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),Z?null:(0,$.jsxs)(M,{type:`button`,variant:`secondary`,onClick:Kt,children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),Z&&de?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(Fe,{value:de,onChange:ge,language:e,inputClassName:tt,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(M,{type:`button`,variant:`ghost`,onClick:()=>{ae(!1),ge(null)},children:t.cancel}),(0,$.jsx)(M,{type:`button`,variant:`primary`,disabled:_e,onClick:()=>void Ut(),children:_e?t.saving:t.save})]})]}):(0,$.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:vt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:vt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:vt.pronouns||`—`})]}),(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:vt.notes||`—`})]})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>qt(`preference`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>qt(`boundary`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>qt(`current_state`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(m,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(rt,{children:t.affectsAgentsBadge})]}),x.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:x.playbooks.map(e=>(0,$.jsx)(dt,{playbook:e,busy:k===`playbook:${e.id}`,t,onToggleGroup:()=>void Bt(e),onCreate:t=>void Vt(e.id,()=>L(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void Vt(e.id,()=>K(e.id,t,n)),onDelete:t=>void Vt(e.id,()=>O(e.id,t)),onRollback:(t,n)=>void Vt(e.id,()=>we(e.id,t,n))},e.id))}):(0,$.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,x&&g===`understanding`?(0,$.jsxs)(`div`,{id:`you-panel-understanding`,role:`tabpanel`,"aria-labelledby":`you-tab-understanding`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{className:`border-b border-edge pb-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.addUnderstanding}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.addUnderstandingHint})]}),R?null:(0,$.jsxs)(M,{type:`button`,variant:`secondary`,onClick:()=>B(!0),children:[(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),t.add]})]}),R?(0,$.jsxs)(`div`,{className:`mt-3 rounded-xl border border-edge bg-surface-panel p-3`,children:[(0,$.jsx)(`textarea`,{className:c(tt,`min-h-24 resize-y`),value:V,onChange:e=>ee(e.target.value),placeholder:t.understandingPlaceholder}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(Se,{value:U,onChange:e=>G(e.target.value),children:Object.entries(t.understandingKinds).map(([e,t])=>(0,$.jsx)(ce,{value:e,children:t},e))})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(M,{type:`button`,variant:`ghost`,onClick:()=>{B(!1),ee(``)},children:t.cancel}),(0,$.jsx)(M,{type:`button`,variant:`primary`,disabled:!V.trim()||k===`understanding:new`,onClick:()=>void Ft(),children:t.add})]})]})]}):null]}),x.conflictGroups.some(e=>e.unresolved)?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,$.jsx)(`div`,{className:`mt-3 space-y-3`,children:x.conflictGroups.filter(e=>e.unresolved).map(n=>(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[st(r,t),` · `,it(r.updatedAt,e)]})]}),(0,$.jsx)(M,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:k===`conflict:${n.id}`,onClick:()=>void Lt(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,x.consentRequests.length>0?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),x.consentRequests.map(e=>(0,$.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(M,{type:`button`,variant:`ghost`,disabled:k===`consent:${e.id}`,onClick:()=>void Pt(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(M,{type:`button`,variant:`secondary`,disabled:k===`consent:${e.id}`,onClick:()=>void Pt(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(M,{type:`button`,variant:`secondary`,disabled:k===`consent:${e.id}`,onClick:()=>void Pt(e.id,`session`),children:t.consentSession}),(0,$.jsx)(M,{type:`button`,variant:`primary`,disabled:k===`consent:${e.id}`,onClick:()=>void Pt(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,xt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.connectedClaimsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectedClaimsHint})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:xt.map(n=>(0,$.jsx)(lt,{claim:n,language:e,t,busy:k===`claim:${n.id}`,onDecision:e=>void Ot(n,e)},n.id))})]}):null,bt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,$.jsx)(M,{type:`button`,variant:`secondary`,disabled:k===`understanding:batch`,onClick:()=>void It(),children:t.reviewAll})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:bt.map(n=>(0,$.jsx)(ct,{item:n,language:e,t,busy:k===n.id,onConfirm:()=>void Nt(n,`confirm`),onReject:()=>void Nt(n,`reject`),onUpdate:e=>void Nt(n,`update`,e),onForget:()=>X(n)},n.id))})]}):yt.length>0||xt.some(e=>e.state===`active`)?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,$.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null,et.map(n=>{let r=Ct.get(n)??[];return r.length===0?null:(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,$.jsx)(ct,{item:n,language:e,t,busy:k===n.id,onConfirm:()=>void Nt(n,`confirm`),onReject:()=>void Nt(n,`reject`),onUpdate:e=>void Nt(n,`update`,e),onForget:()=>X(n)},n.id))})]},n)}),x.understanding.length===0&&xt.length===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,x&&g===`sources`?(0,$.jsx)(Xe,{sources:x.sources,language:e,t,busyId:k,onAddSource:()=>n(`/connectors?personalContext=1`),onLearn:e=>void jt(e),onPause:e=>void Mt(e),onConfigure:At,onDisconnect:$e,onViewUnderstanding:()=>kt(`understanding`)}):null,x&&g===`controls`&&wt?(0,$.jsxs)(`div`,{id:`you-panel-controls`,role:`tabpanel`,"aria-labelledby":`you-tab-controls`,className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,$.jsx)(Se,{value:wt.mode,onChange:e=>Le({...wt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,$.jsx)(ce,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,$.jsx)(Se,{value:wt.sensitiveWritePolicy,onChange:e=>Le({...wt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,$.jsx)(ce,{value:e,children:t},e))}),(0,$.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[wt.sensitiveWritePolicy]})]}),(0,$.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,$.jsx)(M,{type:`button`,variant:`primary`,disabled:ze,onClick:()=>void Jt(),children:ze?t.saving:t.save})})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:x.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===x.trust.defaultActionLevel,disabled:Ve,onClick:()=>{e!==x.trust.defaultActionLevel&&(e===`auto`?Ke(e):Yt(e))},className:c(`rounded-xl border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-70`,e===x.trust.defaultActionLevel?`border-accent/35 bg-accent-soft/35`:`border-edge-subtle bg-surface-panel hover:border-accent/25 hover:bg-surface-hover`),children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===x.trust.defaultActionLevel?(0,$.jsx)(`span`,{className:`mt-2 inline-block rounded-full bg-accent-soft px-2 py-0.5 text-[11px] text-accent-fg`,children:t.defaultTrust}):null]},e))})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),x.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:x.referenceGrants.map(n=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${it(n.expiresAt,e)}`:``]})]}),(0,$.jsx)(M,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:k===`grant:${n.id}`,onClick:()=>void Rt(n.id),children:t.revoke})]},n.id))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsxs)(M,{type:`button`,variant:`secondary`,disabled:pt!==null,onClick:()=>void Zt(),children:[(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0}),pt===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(M,{type:`button`,variant:`secondary`,disabled:pt!==null,onClick:()=>_t.current?.click(),children:[(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),pt===`import`?t.importing:t.importAction]}),(0,$.jsx)(`input`,{ref:_t,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>Ze(e.target.files?.[0]??null)})]})]})]}):null,(0,$.jsx)(me,{open:Y!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Ht(),onCancel:()=>X(null)}),(0,$.jsx)(me,{open:Ge===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void Yt(`auto`),onCancel:()=>Ke(null)}),(0,$.jsx)(me,{open:Ye!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,Ye?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=Ye;Ze(null),Qt(e)},onCancel:$t}),(0,$.jsx)(Re,{source:Qe,language:e,busy:ut,onOpenChange:e=>{e||$e(null)},onConfirm:e=>void Xt(e)}),(0,$.jsx)(Ie,{open:qe,t,onOpenChange:Je,onNavigate:kt})]})}export{gt as UserContextPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-BP0vD37A.js";import{Ts as o,no as s}from"./index-DUasAutC.js";e();var c=t();function l(){return{enabled:!0,provider:`xopc-local`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},providers:{"xopc-local":{model:`sensevoice-small`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function u(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function p(e,t,n){let r=d(e.providers)?e.providers:void 0,i=r&&d(r[t])?r[t]:void 0;return{...n,...i??{}}}function m(e){let t=l();if(!d(e))return t;let n=f(e.provider),r=p(e,`alibaba`,t.alibaba??{}),i=p(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(d(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=u();if(!d(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i=t[`tts-local-cli`]??{},a=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,...a?{providers:a}:{},alibaba:p(e,`alibaba`,t.alibaba??{}),openai:p(e,`openai`,t.openai??{}),edge:p(e,`edge`,t.edge??{}),minimax:p(e,`minimax`,t.minimax??{}),"tts-local-cli":p(e,`tts-local-cli`,i)}}function _(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function v(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function y(e){let t=d(e)?e:{},n=d(t.voice)?t.voice:{},r=d(n.input)?n.input:{},i=d(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),s()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:s,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==s?(_=(0,A.jsx)(o,{id:a,value:s,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=s,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{b as a,y as c,O as d,C as i,x as l,T as n,w as o,S as r,E as s,j as t,D as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./messages-BWtP5TFz.js";import{n as ee}from"./locale-store-BP0vD37A.js";import{Ao as te,At as ne,Bo as s,Do as c,Fo as l,Fs as re,Hl as ie,Ho as ae,Lo as oe,Ls as u,No as se,Oo as ce,Pl as le,Po as d,Ps as f,Pt as ue,Rl as p,Ro as de,Uo as fe,Vo as m,al as h,io as g,jo as pe,ko as me,mc as _,ql as he,su as ge,xu as _e,yu as ve,zo as ye}from"./index-DUasAutC.js";var v=e(t(),1),y=new Set([`completed`,`failed`,`canceled`]);function be(){return new Promise(e=>window.setTimeout(e,1200))}async function xe(e,t){let n=[],r=t.wait??be;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!y.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var b=n(),Se=[`folder_structure`,`recent_progress`,`next_steps`];function x(e){return e instanceof Error?e.message:String(e)}function S(){let e=ee(e=>e.language),t=o(e).onboarding.workDiscovery,n=o(e).chat.workingDirectory,y=i(),[be]=r(),S=be.get(`new`)===`1`,[C,w]=(0,v.useState)(`loading`),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(null),[Ce,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(!1),[we,R]=(0,v.useState)(()=>new Set),[z,Te]=(0,v.useState)(!1),[B,Ee]=(0,v.useState)([]),[V,De]=(0,v.useState)(()=>new Set),[Oe,H]=(0,v.useState)([]),[ke,Ae]=(0,v.useState)(!1),[U,W]=(0,v.useState)({current:0,total:0}),G=(0,v.useRef)(!1),K=(0,v.useCallback)(e=>{c.getState().updateDirectoryRun(e),O(e),e.status===`completed`?(R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},[]),je=async()=>{A(!0),M(null);try{let e=await te();if(!e.length){M(t.noCandidates);return}Ee(e),De(new Set([e[0].rootPath])),w(`candidates`)}catch(e){M(x(e))}finally{A(!1)}},Me=e=>{De(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ne=(0,v.useCallback)((e,t,n)=>{c.getState().updateDirectoryRun(e),O(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),w(`running`)},[]),Pe=(0,v.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Fe=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;A(!0),M(null),H([]),W({current:1,total:e.length}),Ae(!0),G.current=!1;let n=!1;try{let r=await xe(e,{grantDirectory:l,startRun:s,fetchRun:d,shouldStop:()=>G.current,onRun:(e,t,r)=>{Ne(e,t,r),n||(n=!0,c.getState().scanPersonalContext(e.id))},onError:(n,r,i)=>{W({current:i+1,total:e.length}),M(t.folderAnalysisFailed.replace(`{{folder}}`,r.displayName).replace(`{{error}}`,x(n)))}});if(G.current)return;let i=r.find(e=>e.status===`completed`)??r.at(-1);i?K(i):w(`candidates`)}catch(e){M(x(e)),w(`candidates`)}finally{Ae(!1),A(!1)}},q=ue({onPicked:(0,v.useCallback)(async e=>{A(!0),M(null);try{E(await oe(e)),w(`consent`)}catch(e){M(x(e)),w(`intro`)}finally{A(!1)}},[])});(0,v.useEffect)(()=>{let e=!1;return se().then(async({enabled:t,state:n})=>{if(!e){if(!t){y(`/chat`,{replace:!0});return}if(!S&&n.activeRunId)try{let t=await d(n.activeRunId);e||K(t);return}catch{}e||w(`intro`)}}).catch(t=>{e||(M(x(t)),w(`intro`))}),()=>{e=!0}},[K,y,S]),(0,v.useEffect)(()=>{if(!D||C!==`running`||ke)return;let e=!1,t=async()=>{try{let t=await d(D.id);e||K(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===D.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[K,ke,C,D]);let J=async()=>{A(!0);try{await pe()}finally{y(`/chat`,{replace:!0})}},Ie=async()=>{if(T){A(!0),M(null),H([]),W({current:0,total:0});try{await l(T.canonicalRootPath);let e=await s(T.canonicalRootPath);K(e),c.getState().scanPersonalContext(e.id)}catch(e){M(x(e)),w(`consent`)}finally{A(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;y(`/chat/${encodeURIComponent(e)}${n}`)},Le=e=>{O(e),Te(!1),N(!1),L(!1),R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},Re=async()=>{D&&(G.current=!0,K(await me(D.id)))},X=async(t,n)=>{if(!D)return;await ye(D.id,t.id).catch(()=>{});let r=n?`${e===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${t.actionPrompt}`:t.actionPrompt;Y(D.sessionKey,r)},ze=async()=>{if(D){A(!0),M(null);try{let e=D.result?.profileCandidates??[],t=e.length>0?await ae(D.id,e.map(e=>({id:e.id,status:we.has(e.id)?`accepted`:`rejected`}))):D;await Promise.all((t.result?.workThreads??[]).filter(e=>e.userStatus===`unreviewed`).map(e=>fe(e.id,{decision:`confirmed`})));let n=await m(t.id,`confirmed`);O(n),Pe(n),w(`recommendation`)}catch(e){M(x(e))}finally{A(!1)}}},Z=async e=>{if(!(!D||!P.trim())){A(!0),M(null);try{let t=D.result?.workThreads?.find(e=>e.horizon===`current`)??D.result?.workThreads?.[0];t&&await fe(t.id,{decision:`corrected`,correctedSummary:P.trim()});let n=await m(D.id,e,P.trim());O(n),Y(n.sessionKey,P.trim())}catch(e){M(x(e)),A(!1)}}},Be=async()=>{if(D){A(!0);try{Y((await m(D.id,`dismissed`)).sessionKey)}catch(e){M(x(e)),A(!1)}}},Ve=async()=>{let e=D?.result?.workThreads?.find(e=>e.horizon===`current`)??D?.result?.workThreads?.[0];if(e){A(!0),M(null);try{await ce(e.id),Te(!0)}catch(e){M(x(e))}finally{A(!1)}}},Q=D?.result?.suggestions.find(e=>e.id===D.result?.primarySuggestionId)??D?.result?.suggestions[0],He=D?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ue=e=>e===`command`?t.riskCommand:e===`file_write`?t.riskFileWrite:t.riskAnalysis,We=Oe.filter(e=>e?.status===`completed`),$=We.length>1?(0,b.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,b.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:t.analysisResults}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:We.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===D?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Le(e),children:t},e.id)})})]}):null;return(0,b.jsxs)(`div`,{className:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,b.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[(0,b.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,b.jsx)(re,{className:`size-11`})}),C===`loading`?(0,b.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,b.jsx)(g,{className:`mx-auto h-8 w-64`}),(0,b.jsx)(g,{className:`mx-auto h-4 w-full max-w-lg`}),(0,b.jsx)(g,{className:`mx-auto size-4/5 max-w-md`}),(0,b.jsx)(g,{className:`mt-8 h-12 w-full rounded-xl`})]}):null,C===`intro`?(0,b.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,b.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.title}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:t.subtitle})]}),(0,b.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[(0,b.jsxs)(f,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void je(),disabled:k||q.picking,children:[k?(0,b.jsx)(h,{className:`size-4 animate-spin`}):(0,b.jsx)(_,{className:`size-4`}),t.quickScan]}),(0,b.jsxs)(f,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:q.pick,disabled:k||q.picking,children:[q.picking?(0,b.jsx)(h,{className:`size-4 animate-spin`}):(0,b.jsx)(p,{className:`size-4`}),t.chooseFolderManually]}),(0,b.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(_,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:t.quickScanNote})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),disabled:k,children:t.skip})]}):null,C===`candidates`?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-candidates-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.candidatesTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.candidatesSubtitle})]}),(0,b.jsx)(`div`,{className:`mt-7 space-y-2`,children:B.map((e,n)=>{let r=V.has(e.rootPath);return(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":r,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${r?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Me(e.rootPath),children:[(0,b.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${r?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,b.jsx)(a,{className:`size-3.5`})}),(0,b.jsx)(p,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),n===0?(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:t.recommendedCandidate}):null]}),(0,b.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,b.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,b.jsx)(`span`,{children:e.projectKind===`coding`?t.codingProject:e.projectKind===`general`?t.generalProject:t.unknownProject}),e.branch?(0,b.jsx)(`span`,{children:t.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,b.jsx)(`span`,{children:t.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:`mt-5 flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(_,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:t.multiFolderPrivacyNote})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(f,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k||V.size===0,onClick:()=>void Fe(),children:[k?(0,b.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,b.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:q.pick,children:t.chooseFolderManually})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>w(`intro`),children:t.back})]}):null,C===`consent`&&T?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.selectedTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.selectedSubtitle})]}),(0,b.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,b.jsx)(p,{className:`size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:T.displayName}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:T.canonicalRootPath})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:T.projectKind===`coding`?t.codingProject:T.projectKind===`general`?t.generalProject:t.unknownProject})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.localFingerprint}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:T.fingerprint.branch?t.branchValue.replace(`{{branch}}`,T.fingerprint.branch):t.noGitBranch})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentActivity}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:t.changedFiles.replace(`{{count}}`,String(T.fingerprint.changedFileCount))})]}),T.fingerprint.recentAreas.length>0?(0,b.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentAreas}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:T.fingerprint.recentAreas.map(e=>(0,b.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,b.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willRead}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willReadValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willIgnore}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willIgnoreValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(_,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:T.remoteModel?t.providerDisclosure.replace(`{{provider}}`,T.provider):t.localDisclosure})]})]})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(f,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Ie(),children:[k?(0,b.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,b.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:q.pick,children:t.changeFolder})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),children:t.skip})]}):null,C===`running`&&D?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.analyzingTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.analyzingSubtitle}),U.total>1?(0,b.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:t.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,b.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Se.map((e,n)=>{let r=Math.max(0,Se.indexOf(D.stage??`folder_structure`)),i=n<r,o=n===r;return(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,b.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${i?`bg-accent text-white`:o?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:i?(0,b.jsx)(a,{className:`size-4`}):o?(0,b.jsx)(h,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,b.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,b.jsx)(`span`,{className:o||i?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:t.stages[e]})]},e)})}),(0,b.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:D.rootPath}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,b.jsx)(f,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>y(`/chat`),children:t.continueInBackground}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Re(),children:t.cancelAnalysis})]})]}):null,C===`recognition`&&D?.result?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.recognitionEyebrow}),(0,b.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:D.result.lowConfidence?t.lowConfidenceTitle:t.recognitionTitle})]}),$,(0,b.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,b.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:D.result.projectSummary}),(0,b.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:D.result.currentState}),!D.result.lowConfidence&&Q?.evidence.length?(0,b.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(le,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{children:[e.path?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),D.result.workThreads?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.workThreadsTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.workThreadsSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:D.result.workThreads.map(e=>(0,b.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?t.workThreadCurrent:e.horizon===`ongoing`?t.workThreadOngoing:t.workThreadLongTerm}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,D.result.profileCandidates?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.profileCandidatesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.profileCandidatesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:D.result.profileCandidates.map(e=>(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:we.has(e.id),onChange:()=>R(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,b.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,D.result.lowConfidence?(0,b.jsxs)(`div`,{className:`mt-5`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:D.result.contextQuestion}),(0,b.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsx)(f,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:k||!P.trim(),onClick:()=>void Z(`different_goal`),children:t.continueWithCorrection})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(f,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void ze(),children:[k?(0,b.jsx)(h,{className:`size-4 animate-spin`}):(0,b.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,b.jsx)(f,{variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:()=>N(e=>!e),children:t.notQuiteRight})]}),Ce?(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:t.correctionLabel}),(0,b.jsx)(`textarea`,{id:`work-discovery-correction`,value:P,onChange:e=>F(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(f,{variant:`ghost`,disabled:k||!P.trim(),onClick:()=>void Z(`different_goal`),children:t.differentGoal}),(0,b.jsx)(f,{variant:`primary`,disabled:k||!P.trim(),onClick:()=>void Z(`corrected`),children:t.useCorrection})]})]}):null]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsx)(`button`,{type:`button`,disabled:k,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Be(),children:t.openConversation})]}):null,C===`recommendation`&&D?.result&&Q?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.understandingConfirmed}),(0,b.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:t.primaryRecommendationTitle})]}),$,(0,b.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,b.jsx)(ve,{className:`size-5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,b.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,b.jsx)(ge,{className:`size-3.5`}),t.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,b.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ue(Q.risk)})]}),(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.expectedOutcome}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedOutcome})]}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,b.jsx)(f,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:t.startRecommendedAction}),(0,b.jsx)(f,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:t.explainFirst})]})]})]})}),D.result.workThreads?.length?(0,b.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:z?(0,b.jsx)(a,{className:`size-4`}):(0,b.jsx)(he,{className:`size-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:z?t.focusTrialActive:t.focusTrialTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:z?t.focusTrialActiveDescription:t.focusTrialDescription}),z?null:(0,b.jsxs)(f,{className:`mt-3 h-9`,variant:`secondary`,disabled:k,onClick:()=>void Ve(),children:[k?(0,b.jsx)(h,{className:`size-4 animate-spin`}):(0,b.jsx)(he,{className:`size-4`}),t.activateFocusTrial]})]})]})}):null,He.length>0?(0,b.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>L(e=>!e),children:[t.otherDirections,(0,b.jsx)(_e,{className:`size-4 transition-transform ${I?`rotate-180`:``}`})]}),I?(0,b.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:He.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,b.jsx)(ve,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedOutcome})]})]},e.id))}):null]}):null,(0,b.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(D.sessionKey),children:t.doSomethingElse}),(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{N(!0),w(`recognition`)},children:t.correctUnderstanding})]})]}):null,C===`error`&&D?(0,b.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,b.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,b.jsx)(u,{className:`size-5`})}),(0,b.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:t.errorTitle}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:D.errorMessage}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsx)(f,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void de(D.id).then(K),children:t.retry}),(0,b.jsx)(f,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{O(null),E(null),w(`intro`)},children:t.chooseDifferent})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(D.sessionKey),children:t.openConversation})]}):null]}),q.hasNativePicker?null:(0,b.jsx)(ne,{open:q.modalOpen,onOpenChange:q.setModalOpen,initialAbsolutePath:T?.canonicalRootPath,onConfirm:q.confirmPick,wd:n})]})}export{S as WorkDiscoveryPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-BWtP5TFz.js";import{n as ee}from"./locale-store-BP0vD37A.js";import{A as te,Dc as ne,Ec as re,Eo as l,Hl as u,Ia as ie,Jl as d,Lu as f,Pc as ae,Pl as oe,Ps as p,Ql as se,Uc as m,Xs as ce,_u as h,a as le,ec as g,el as _,f as ue,l as de,ls as v,m as fe,o as pe,p as me,s as y,ss as b,u as x,vt as S,wu as C}from"./index-DUasAutC.js";var w=n(),T=e(t(),1),E=r();function he(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function D(e){return e?S(new Date(e)):``}function ge(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function _e(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function O(e){let t=(0,w.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,E.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,E.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ve(e){let t=(0,w.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,E.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,E.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,E.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:D(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,E.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function k(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function A(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=k(i),s=0;for(let e of k(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function ye(e,t,n){return[...n].sort((n,r)=>A(e,t,r)-A(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=i(),t=a(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,S]=(0,T.useState)(null),[w,k]=(0,T.useState)(null),[j,M]=(0,T.useState)([]),[N,be]=(0,T.useState)([]),[P,F]=(0,T.useState)(``),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(!0),[B,V]=(0,T.useState)(!1),[H,U]=(0,T.useState)(null),W=(0,T.useRef)(null),G=l(e=>e.setPageHeader),K=l(e=>e.clearPageHeader),q=(0,T.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,T.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([de(e),x(e).catch(()=>({events:[]}))]);S(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([ie(t.item.projectId).catch(()=>null),te().catch(()=>[])]),a=ye(t.item,r,i);k(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,T.useEffect)(()=>{J()},[J]);let Y=(0,T.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await ue(r.id);S(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,T.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await le(r.id);S(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,T.useCallback)(async e=>{M((await x(e).catch(()=>({events:[]}))).events)},[]),xe=(0,T.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await me(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});S(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,T.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await fe(r.id,e);S(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,T.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await pe(r.id,e.id);S(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,T.useCallback)(async e=>{if(r){U(null);try{await y(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,T.useMemo)(()=>r?N.filter(e=>A(r,w,e)>0).slice(0,3):[],[r,w,N]),$=(0,T.useMemo)(()=>(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,E.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,E.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,E.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,E.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,T.useLayoutEffect)(()=>(G({startExtra:(0,E.jsx)(o,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":w?.name?n.detail.backToProject.replace(`{{name}}`,w.name):n.detail.backToProjects,children:(0,E.jsx)(f,{className:`size-4`,"aria-hidden":!0})}),main:(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(C,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,E.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,E.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,w?.name||r.projectId,` · `,n.updated,`: `,D(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,w?.name,q,G,n,w]),R?(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,E.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,E.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,E.jsxs)(o,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,E.jsx)(f,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,E.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface sm:px-5`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(C,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,E.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,E.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,E.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,he(r.status)),children:n.statuses[r.status]}),(0,E.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,E.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,E.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,E.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,E.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,E.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,E.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,E.jsx)(O,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,E.jsx)(O,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,E.jsx)(O,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,E.jsx)(O,{label:n.updated,value:D(r.updatedAt)})]})]}),(0,E.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,E.jsxs)(`section`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,E.jsx)(u,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,E.jsx)(ve,{events:j,t:n})]}),(0,E.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,E.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,E.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,E.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,E.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,E.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,E.jsxs)(b,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,E.jsx)(v,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,E.jsx)(v,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[(0,E.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,E.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,E.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,E.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,E.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,E.jsxs)(p,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,E.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,E.jsx)(m,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,E.jsxs)(p,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,E.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,E.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,E.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base p-2 text-sm`,children:[(0,E.jsx)(u,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,E.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,ge(e.size)]})]}),(0,E.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,E.jsx)(se,{className:`size-3.5`,"aria-hidden":!0})}),(0,E.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,E.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,E.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,E.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,E.jsxs)(o,{to:_e(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,E.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,E.jsx)(d,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,E.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,E.jsxs)(o,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,E.jsx)(h,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`min-w-0 truncate`,children:w?.name||r.projectId})]})]})]})]})]})}export{j as WorkItemDetailPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BWtP5TFz.js";import{n as u,o as d,r as f,s as p}from"./locale-store-BP0vD37A.js";import{n as m}from"./activity-store-C3Y-bESI.js";import{Eo as h,Go as g,Ha as _,Hu as v,Io as y,Iu as b,Jo as x,Ko as S,Ls as C,Mo as w,Oo as T,Pa as E,Pc as D,Ps as O,Sl as k,Su as A,Wo as j,Xo as M,Xs as N,Yo as ee,Ys as te,_u as P,al as F,bc as ne,io as I,nl as re,ql as ie,qo as ae,su as oe,tt as se,uc as ce,vt as L,yu as le,zl as ue}from"./index-DUasAutC.js";var R=e(t(),1),z=n();function B(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function V(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/goals\/([^/]+)\/?$/.exec(t);if(n){let e=B(n[1]);return e?{kind:`goal`,id:e}:null}let r=/^\/chat\/([^/]+)\/?$/.exec(t);if(r){let e=B(r[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function H(e,t){let n=e.kind===`goal`?`/api/goals/${encodeURIComponent(e.id)}`:`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await d(f(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var U=r(),W=3,de={info:{Icon:k,className:`text-accent-fg bg-accent-soft`},success:{Icon:P,className:`text-success bg-success-soft`},warning:{Icon:te,className:`text-warning bg-warning-soft`},error:{Icon:s,className:`text-danger bg-danger-soft`}};function G(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function K(e){let t=(0,z.c)(55),{item:n,targetAvailability:r}=e,i=u(J),o;t[0]===i?o=t[1]:(o=l(i),t[0]=i,t[1]=o);let s=o.projectsPage.workHome,d=m(q),{Icon:f,className:p}=de[n.tone],h;t[2]===p?h=t[3]:(h=c(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,p),t[2]=p,t[3]=h);let g;t[4]!==f||t[5]!==n.status?(g=n.status===`running`?(0,U.jsx)(F,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,U.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,U.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,U.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,U.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,U.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let S;t[20]===n.source?S=t[21]:(S=n.source?(0,U.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=S);let w;t[22]!==n.updatedAt||t[23]!==i?(w=G(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=w):w=t[24];let T;t[25]===w?T=t[26]:(T=(0,U.jsx)(`span`,{children:w}),t[25]=w,t[26]=T);let E;t[27]===n.occurrences?E=t[28]:(E=n.occurrences>1?(0,U.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=E);let D;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(D=n.href&&r===`available`?(0,U.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,U.jsx)(le,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,U.jsx)(I,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,U.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=D):D=t[34];let O;t[35]!==T||t[36]!==E||t[37]!==D||t[38]!==S?(O=(0,U.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[S,T,E,D]}),t[35]=T,t[36]=E,t[37]=D,t[38]=S,t[39]=O):O=t[39];let k;t[40]!==O||t[41]!==b||t[42]!==x?(k=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,O]}),t[40]=O,t[41]=b,t[42]=x,t[43]=k):k=t[43];let A;t[44]!==n.id||t[45]!==d?(A=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=A):A=t[46];let j;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,U.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t[47]=j):j=t[47];let M;t[48]!==s.activityRemove||t[49]!==A?(M=(0,U.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:A,children:j}),t[48]=s.activityRemove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==k||t[52]!==M||t[53]!==_?(N=(0,U.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,k,M]}),t[51]=k,t[52]=M,t[53]=_,t[54]=N):N=t[54],N}function q(e){return e.remove}function J(e){return e.language}function fe(){let e=(0,z.c)(12),t=l(u(ve)).projectsPage.workHome,n=m(_e),r=m(ge),i=m(he),[a,s]=(0,R.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,R.useState)(c),p;e[1]===n?p=e[2]:(p=n.filter(me),e[1]=n,e[2]=p);let h=p.length,g;e[3]===n?g=e[4]:(g=n.filter(pe),e[3]=n,e[4]=g);let _=g.length,y;e[5]!==a||e[6]!==n?(y=a?n:n.slice(0,W),e[5]=a,e[6]=n,e[7]=y):y=e[7];let b=y,x,S;e[8]===n?(x=e[9],S=e[10]):(x=()=>{let e=new AbortController,t=new Map(n.flatMap($));return f(Object.fromEntries([...t.keys()].map(Q))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await H(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(Z),()=>e.abort()},S=[n],e[8]=n,e[9]=x,e[10]=S),(0,R.useEffect)(x,S);let C;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,U.jsx)(v,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[11]=C):C=e[11],(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsx)(`div`,{children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,(0,U.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,U.jsx)(F,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):_>0?(0,U.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[_,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_>0?(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,U.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(X)?(0,U.jsxs)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,U.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,U.jsxs)(`div`,{className:`mt-3 px-1`,children:[b.map(e=>(0,U.jsx)(K,{item:e,targetAvailability:e.href&&V(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>W?(0,U.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(Y),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,U.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,U.jsx)(oe,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`p`,{children:t.activityEmpty})]})]})}function Y(e){return!e}function X(e){return e.status===`done`}function Z(){}function Q(e){return[e,`checking`]}function $(e){let t=V(e.href);return e.href&&t?[[e.href,t]]:[]}function pe(e){return!e.read}function me(e){return e.status===`running`}function he(e){return e.clearFinished}function ge(e){return e.markAllRead}function _e(e){return e.items}function ve(e){return e.language}function ye(e){return p(f(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function be(e,t){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})})}function xe(e){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}/approve`),{method:`POST`})}function Se(e,t){return p(f(`/api/focuses/${encodeURIComponent(e)}/calendar/${encodeURIComponent(t)}/prepare`),{method:`POST`})}function Ce(e,t){return p(f(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function we(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Te(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:L(n)}function Ee(e){let t=(0,z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function De(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,U.jsx)(I,{className:`h-20 rounded-2xl`}),(0,U.jsx)(I,{className:`h-72 rounded-2xl`}),(0,U.jsx)(I,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Oe(e){let t=(0,z.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=o);let s;t[2]===n.projectName?s=t[3]:(s=(0,U.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[2]=n.projectName,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:r}),t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==n.blockedReason||t[13]!==n.nextAction?(d=n.blockedReason||n.nextAction?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[12]=n.blockedReason,t[13]=n.nextAction,t[14]=d):d=t[14];let f;return t[15]!==i||t[16]!==u||t[17]!==d?(f=(0,U.jsxs)(a,{to:i,className:`group block rounded-lg px-1 py-2.5 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[15]=i,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function ke(e){let t=(0,z.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,U.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,U.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,U.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,U.jsx)(O,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,U.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function Ae(e){let t=(0,z.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(ue,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,U.jsx)(b,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=Te(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,U.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let g;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(g=(0,U.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=g):g=t[18],g}function je(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=i(),o=h(e=>e.setPageHeader),c=h(e=>e.clearPageHeader),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)([]),[v,b]=(0,R.useState)([]),[k,N]=(0,R.useState)(!0),[te,P]=(0,R.useState)(null),[F,I]=(0,R.useState)(null),[L,le]=(0,R.useState)(``),[ue,z]=(0,R.useState)(!1),[B,V]=(0,R.useState)(``),[H,W]=(0,R.useState)(!1),[de,G]=(0,R.useState)(null),[K,q]=(0,R.useState)(null),[J,Y]=(0,R.useState)(null),X=(0,R.useCallback)(async()=>{N(!0),P(null);try{let[t,n,r]=await Promise.all([ye(e),_({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),w()]);f(t),m(n.items),b(r)}catch(e){P(e instanceof Error?e.message:String(e))}finally{N(!1)}},[e]);(0,R.useEffect)(()=>{X()},[X]);let Z=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase(),t=p.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,6)},[p,L]),Q=(0,R.useMemo)(()=>d?.decisions??[],[d]),$=(0,R.useMemo)(()=>d?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[d]),pe=(0,R.useCallback)(async t=>{t.preventDefault();let n=B.trim();if(!(!n||H)){W(!0),I(null);try{let t=await E({outcome:n,uiLocale:e});V(``),z(!1),r(`/projects/${encodeURIComponent(t.project.id)}`)}catch(e){I(e instanceof Error?e.message:String(e))}finally{W(!1)}}},[H,e,r,B]),me=(0,R.useMemo)(()=>(0,U.jsxs)(O,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>z(!0),children:[(0,U.jsx)(D,{className:`size-4`,"aria-hidden":!0}),n.workHome.newWork]}),[n.workHome.newWork]),he=(0,R.useCallback)(async(e,t)=>{if(e.response){G(e.id),P(null);try{await Ce(e.response,t),await X()}catch(e){P(e instanceof Error?e.message:String(e))}finally{G(null)}}},[X]),ge=(0,R.useCallback)(async(e,t)=>{q(e.id),P(null);try{let n=e.watches.find(e=>e.kind===t&&e.status===`active`);n?await y(e.id,n.id):await T(e.id,t),b(await w())}catch(e){P(e instanceof Error?e.message:String(e))}finally{q(null)}},[]),_e=(0,R.useCallback)(async(e,t)=>{Y(e),P(null);try{t===`approved`?await xe(e):await be(e,`dismissed`),f(t=>t&&{...t,proactiveInsights:t.proactiveInsights.filter(t=>t.id!==e)})}catch(e){P(e instanceof Error?e.message:String(e))}finally{Y(null)}},[]),ve=(0,R.useCallback)(async(e,t)=>{q(e),P(null);try{await Se(e,t),b(await w())}catch(e){P(e instanceof Error?e.message:String(e))}finally{q(null)}},[]);return(0,R.useLayoutEffect)(()=>(o({startExtra:null,main:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,U.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:me}),()=>c()),[c,me,o,n.title,n.workHome.subtitle]),(0,U.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,U.jsx)(j,{open:ue,onOpenChange:e=>{!e&&H||(z(e),e||I(null))},children:(0,U.jsxs)(ee,{children:[(0,U.jsx)(x,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,U.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(M,{className:`text-base font-semibold text-fg`,children:n.workHome.delegateTitle}),(0,U.jsx)(ae,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.workHome.delegateDescription})]}),(0,U.jsx)(g,{asChild:!0,children:(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,disabled:H,children:(0,U.jsx)(C,{className:`size-4`,"aria-hidden":!0})})})]}),(0,U.jsxs)(`form`,{onSubmit:pe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,U.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.workHome.outcomeLabel}),(0,U.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:B,onChange:e=>V(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:n.workHome.outcomePlaceholder,maxLength:12e3,disabled:H,autoFocus:!0}),(0,U.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,U.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,U.jsxs)(`span`,{className:`tabular-nums`,children:[B.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),F?(0,U.jsx)(`p`,{className:`mt-3 rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:F}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,U.jsx)(g,{asChild:!0,children:(0,U.jsx)(O,{type:`button`,variant:`ghost`,disabled:H,children:n.cancel})}),(0,U.jsxs)(O,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:H||!B.trim(),children:[(0,U.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),H?n.workHome.delegating:n.workHome.delegate]})]})]})]})]})}),te?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,U.jsx)(`span`,{children:te}),(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:n.workHome.retry})]}):null,k?(0,U.jsx)(De,{}):d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:d.decisions.length>0?we(n.workHome.todaySummary,{attention:d.decisions.length,moving:d.briefing.progress.movingCount}):we(n.workHome.todaySummaryClear,{moving:d.briefing.progress.movingCount})}),d.briefing.summary?(0,U.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:d.briefing.summary}):null]}),d.proactiveInsights.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/20 p-5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(ce,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.insightsTitle}),(0,U.jsx)(Ee,{children:n.workHome.insightsBadge})]}),(0,U.jsx)(`div`,{className:`mt-4 space-y-3`,children:d.proactiveInsights.map(e=>(0,U.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,U.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.whyItMatters,`: `]}),e.whyItMatters]}),(0,U.jsxs)(`p`,{className:`mt-2 rounded-lg bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.suggestedNext,`: `]}),e.nextAction]}),(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.evidence.map((e,t)=>(0,U.jsxs)(`span`,{className:`rounded-full border border-edge-subtle px-2 py-1 text-[11px] text-fg-subtle`,children:[e.label,e.source?` · ${e.source}`:``]},`${e.label}-${t}`))}),(0,U.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-edge-subtle pt-3`,children:[(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void _e(e.id,`dismissed`),children:n.workHome.dismissInsight}),(0,U.jsx)(O,{type:`button`,variant:`primary`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void _e(e.id,`approved`),children:n.workHome.investigateInsight})]})]},e.id))})]}):null,d.calendarSignals.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(A,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.relatedCalendarTitle}),(0,U.jsx)(Ee,{children:n.workHome.relatedCalendarBadge})]}),(0,U.jsx)(`div`,{className:`mt-4 divide-y divide-edge-subtle`,children:d.calendarSignals.map(e=>(0,U.jsxs)(`article`,{className:`flex flex-col gap-3 py-3 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.focusTitle,` · `,Te(e.startsAt,``)]})]}),(0,U.jsx)(O,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2 text-xs`,disabled:K===e.focusId,onClick:()=>void ve(e.focusId,e.id),children:K===e.focusId?n.workHome.focusWatchUpdating:n.workHome.prepareForEvent})]},e.id))})]}):null,v.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.focusesTitle}),(0,U.jsx)(Ee,{children:n.workHome.focusesBadge})]}),(0,U.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2`,children:v.slice(0,6).map(e=>{let t=e.watches.some(e=>e.kind===`progress`&&e.status===`active`),r=e.watches.some(e=>e.kind===`intelligence`&&e.status===`active`),i=t||r;return(0,U.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.summary})]}),(0,U.jsx)(`span`,{className:`mt-0.5 size-2 shrink-0 rounded-full ${i?`bg-success`:`bg-fg-subtle/40`}`,"aria-hidden":!0})]}),e.blockedReason||e.nextAction?(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.blockedReason||e.nextAction}):null,(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:i?n.workHome.focusWatchActive:n.workHome.focusWatchInactive}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:K===e.id,onClick:()=>void ge(e,`progress`),children:K===e.id?n.workHome.focusWatchUpdating:t?n.workHome.pauseProgressWatch:n.workHome.startFocusWatch}),(0,U.jsx)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:K===e.id,onClick:()=>void ge(e,`intelligence`),children:K===e.id?n.workHome.focusWatchUpdating:r?n.workHome.pauseNewsWatch:n.workHome.startNewsWatch})]})]})]},e.id)})})]}):null,d.work.current.length===0&&d.workflowRuns.active.length===0&&d.decisions.length===0&&d.upcomingAutomations.length===0&&v.length===0?(0,U.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,U.jsx)(re,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,U.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,U.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,U.jsx)(O,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:n.workHome.startChat}),(0,U.jsx)(O,{type:`button`,variant:`secondary`,onClick:()=>z(!0),children:n.workHome.startLongWork})]})]}):null,(0,U.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Q.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(s,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.needsYou})]}),(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:Q.map(e=>(0,U.jsx)(ke,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:de===e.id,onRespond:t=>void he(e,t)},e.id))})]}):(0,U.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),n.workHome.nothingNeedsYou]}),(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(oe,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.continueTitle})]}),(0,U.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[d.workflowRuns.active.map(e=>(0,U.jsxs)(a,{to:se(e.id),className:`flex items-center justify-between gap-3 rounded-lg px-2 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),$.map(e=>(0,U.jsx)(`div`,{className:`py-1`,children:(0,U.jsx)(Oe,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),d.workflowRuns.active.length===0&&$.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.workHome.noCurrentWork}):null]})]})]}),(0,U.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,U.jsx)(`div`,{className:`px-1`,children:(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle})}),d.upcomingAutomations.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(A,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,U.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:d.upcomingAutomations.slice(0,3).map(e=>(0,U.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,U.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Te(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,U.jsx)(fe,{}),d.briefing.wins.length>0?(0,U.jsxs)(a,{to:d.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,U.jsx)(`span`,{children:we(n.workHome.completedSummary,{count:d.briefing.wins.length})}),(0,U.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]})]}):null,(0,U.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.spacesTitle}),(0,U.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),p.filter(e=>e.status!==`archived`).length>6?(0,U.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,U.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,U.jsx)(ne,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>le(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,U.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Z.map(e=>(0,U.jsx)(Ae,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!k&&Z.length===0?(0,U.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{je as WorkPage};
|