@xopcai/xopc 0.0.161 → 0.0.162
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-o7GRljfD.js → activity-store-hpcNv9MZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9R3szLMc.js → agent-avatar-dicebear-Zf9UQEmQ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +2 -0
- package/dist/gateway/static/root/assets/{api-jSTqFMq9.js → api-Dnatri09.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D81cyE76.js → app-management-settings-panel-BBTR9wJP.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Ct6bZQCV.js → appearance-settings-C2zpLCHD.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-9eR_ODY1.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CP_Gaxt3.js → attachment-load-DPuWYUeX.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BGKM_NDZ.js → automation-suggestion-card-Dw49OJRl.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-IPr2EVnS.js → binary-plugins-BdkJpDFm.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B6aHEGA6.js → block-editor-CAi7SXYU.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-Dx6wkGz1.js +1 -0
- package/dist/gateway/static/root/assets/browser-workflows-page-Skertc-A.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CCX9-LjU.js → capability-presets-api-CNFl7dM3.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-MmLMLDWf.js → channel-recipient-api-DYQyGDw4.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BbjzIs87.js → connector-logo-Bng6kxYF.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-Bpf6oegd.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DQLqGLc0.js → desktop-pet-settings-BVUyefSd.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ClsiXhmz.js → directory-picker-path-field-DjSZAPz_.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CjMPPdzg.js → dreaming-settings-CAZk2AM4.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-57eizjhB.js → extension-debug-page-C2F6vTTd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CsbSb3u1.js → extension-page-AnIt4bn4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DKA9-lyP.js → extension-settings-page-CLSc6682.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DIPJuzBZ.js → gateway-config-api-DLFyZv33.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CDLqAQY7.js → gateway-settings-DnQAA-qq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DrfSJtvT.js → gateway-startup-retry-DbzLyJ3R.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-lGC10UkU.js → goals-config-api-REmr3QCr.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-BWq0pdrA.js → goals-settings-Dz0F3uRO.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D4o8BJVv.js → heartbeat-settings-CQFY5gYs.js} +1 -1
- package/dist/gateway/static/root/assets/index-C8JkTS6d.js +199 -0
- package/dist/gateway/static/root/assets/index-hmrG55qg.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6T2QYehS.js → keyboard-shortcuts-settings-BnOQXU5k.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DCjg2K9f.js → local-apps-page-KsOtWOyM.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dar-xqQr.js → locale-store-0lpYdNDr.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CyYCBqym.js → logs-page-CwLPgrWh.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-rt1XO43g.js → markdown-split-D5GRg10r.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bwo8CJuh.js → media-plugins-C1ryULGs.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-Dp-pkX7d.js → notes-page-CIeZ1_DT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-CzZ4iKOb.js → page-tabs-Caj1-E_X.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-3E_Qa-58.js → preview-open-alternatives-DKwEce-9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B2T48Sbt.js → product-open-page-B90ZskkN.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +1 -0
- package/dist/gateway/static/root/assets/save-bar-controls-BDYt53uQ.js +1 -0
- package/dist/gateway/static/root/assets/{schedule-field-TkqUL3wm.js → schedule-field-Bcdni4Pj.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DC-iU5IG.js → schema-form-D7oCARF7.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-Dpqth3oA.js → settings-collapsible-section-6eNF8Jey.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CNqF6IwY.js → settings-form-section-CARTHCxH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkvwitK_.js → settings-loading-skeleton-DEwYqESe.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-B6vVdHeQ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DWvNgISx.js → settings-page-layout-D3srt5Bi.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DGpSPW-n.js → share-preview-page-Ck9SxiXw.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-8TxxSbUw.js → system-settings-panel-DLBUQSk2.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B5FzMWOx.js → theme-store-C1oaqeD2.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DEGtSA5h.js → typed-models-lib-Divbg_C4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BDU6FneG.js → use-channel-catalog-CP9a_rAf.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cwi8Pz7n.js → workflow-run-setup-panel-DbDPYQwB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/client-error-format.js +3 -3
- package/dist/src/agent/outcomes/task-evaluation.d.ts +20 -0
- package/dist/src/agent/outcomes/task-evaluation.js +48 -0
- package/dist/src/agent/outcomes/task-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/task-verifier.js +71 -0
- package/dist/src/agent/prompt/memory/index.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +32 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +1 -7
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +2 -73
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -13
- package/dist/src/agent/tools/browser/tool/schemas.js +1 -9
- package/dist/src/agent/tools/browser-recipe-tool.d.ts +12 -0
- package/dist/src/agent/tools/browser-recipe-tool.js +113 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/automations/domain/types.d.ts +13 -0
- package/dist/src/automations/domain/validation.d.ts +44 -24
- package/dist/src/automations/domain/validation.js +27 -18
- package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -1
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +22 -0
- package/dist/src/browser/index.d.ts +0 -1
- package/dist/src/browser/index.js +1 -2
- package/dist/src/browser/pipeline/runner.d.ts +9 -2
- package/dist/src/browser/pipeline/runner.js +151 -105
- package/dist/src/browser/pipeline/schema.d.ts +21 -15
- package/dist/src/browser/pipeline/schema.js +93 -99
- package/dist/src/browser/recipes/index.d.ts +3 -0
- package/dist/src/browser/recipes/index.js +3 -0
- package/dist/src/browser/recipes/repository.d.ts +13 -0
- package/dist/src/browser/recipes/repository.js +81 -0
- package/dist/src/browser/recipes/runtime-service.d.ts +6 -0
- package/dist/src/browser/recipes/runtime-service.js +30 -0
- package/dist/src/browser/recipes/service.d.ts +36 -0
- package/dist/src/browser/recipes/service.js +186 -0
- package/dist/src/browser/recipes/types.d.ts +36 -0
- package/dist/src/browser/recipes/types.js +1 -0
- package/dist/src/cli/commands/browser-cli-helpers.js +6 -12
- package/dist/src/cli/commands/browser.js +4 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +3 -3
- package/dist/src/config/schema.js +21 -21
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/routes/browser-workflows.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-workflows.js +78 -0
- package/dist/src/gateway/hono/routes/home.js +1 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/interaction-state.d.ts +3 -0
- package/dist/src/gateway/hono/routes/interaction-state.js +45 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/memory.js +33 -4
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/task-outcomes.js +109 -0
- package/dist/src/gateway/hono/routes/you.d.ts +10 -2
- package/dist/src/gateway/hono/routes/you.js +184 -28
- package/dist/src/gateway/service/run-gateway-agent.js +84 -0
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +14 -0
- package/dist/src/proactive/insight-repository.d.ts +2 -0
- package/dist/src/proactive/insight-repository.js +5 -2
- package/dist/src/proactive/run-processor.js +22 -1
- package/dist/src/proactive/types.d.ts +2 -0
- package/dist/src/proactive/value-score.d.ts +13 -0
- package/dist/src/proactive/value-score.js +30 -0
- package/dist/src/share/share-types.js +5 -5
- package/dist/src/share/site-share-types.d.ts +1 -1
- package/dist/src/share/site-share-types.js +5 -5
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/interaction-state-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/interaction-state-repository.js +60 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +45 -0
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +24 -0
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +14 -0
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +6 -0
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +11 -0
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +3 -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/relationship-settings-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/relationship-settings-repository.js +64 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +46 -0
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +90 -0
- package/dist/src/storage/sqlite/task-outcome-repository.js +138 -0
- package/dist/src/user-context/interaction-state.d.ts +13 -0
- package/dist/src/user-context/interaction-state.js +69 -0
- package/dist/src/user-context/memory-use-audit.d.ts +10 -0
- package/dist/src/user-context/memory-use-audit.js +25 -0
- package/dist/src/user-context/personal-playbook.d.ts +11 -0
- package/dist/src/user-context/personal-playbook.js +41 -0
- package/dist/src/user-context/projection.d.ts +4 -0
- package/dist/src/user-context/projection.js +5 -1
- package/dist/src/user-context/relationship-continuity.d.ts +14 -0
- package/dist/src/user-context/relationship-continuity.js +51 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/action-boundary-settings-panel-BIVBUiNT.js +0 -1
- package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dva9SiPK.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-CYH5ZSXy.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +0 -2
- package/dist/gateway/static/root/assets/index-CkUHH170.css +0 -1
- package/dist/gateway/static/root/assets/index-vq_cJZJC.js +0 -199
- package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +0 -2
- package/dist/gateway/static/root/assets/messages-CxySDn9d.js +0 -5
- package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +0 -1
- package/dist/gateway/static/root/assets/save-bar-controls-CkeKasGm.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-qPG7I2zd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +0 -11
- package/dist/src/browser/pipeline/source.d.ts +0 -9
- package/dist/src/browser/pipeline/source.js +0 -77
|
@@ -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}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./copy-to-clipboard-HOJ79TWv.js";import{t as c}from"./messages-BwQ3WssU.js";import{l,n as u,r as d,s as f}from"./locale-store-0lpYdNDr.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{$i as m,Ai as h,Bo as g,Bs as _,Ci as v,Cs as y,Di as b,Dl as x,Ds as S,Ei as C,Ho as w,Jc as T,Mr as ee,Nt as E,Oi as D,Qa as O,Ro as k,Ti as A,Uo as j,Wl as M,Wo as N,Xa as P,Xn as F,Yl as I,Za as L,_c as te,ji as ne,jl as R,ki as re,rs as z,ts as ie,uu as B,wc as ae,wi as V,ws as H,xi as oe,zo as se,zr as ce}from"./index-C8JkTS6d.js";import{n as U,r as W,t as G}from"./settings-page-layout-D3srt5Bi.js";import{t as K}from"./settings-loading-skeleton-DEwYqESe.js";import{t as q}from"./settings-form-section-CARTHCxH.js";import{t as le}from"./page-tabs-Caj1-E_X.js";var J=e(t(),1),ue=n(),Y={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function de(){return structuredClone(Y)}var fe=36e5,X=864e5,Z=1048576;function pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function me(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function he(e){let t=pe(e)?e:{},n=pe(t.gateway)?t.gateway:{},r=pe(n.share)?n.share:{},i=pe(r.directory)?r.directory:{},a=pe(n.siteShare)?n.siteShare:{},o=pe(a.static)?a.static:{},s=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):Y.defaultTtlHours*fe,c=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):Y.maxTtlDays*X,l=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):Y.maxFileSizeMb*Z,u=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):Y.directoryMaxFolderSizeMb*Z,d=typeof a.defaultTtlMs==`number`&&Number.isFinite(a.defaultTtlMs)?Math.floor(a.defaultTtlMs):Y.siteDefaultTtlHours*fe,f=typeof a.maxTtlMs==`number`&&Number.isFinite(a.maxTtlMs)?Math.floor(a.maxTtlMs):Y.siteMaxTtlDays*X,p=typeof o.maxRootDirSize==`number`&&Number.isFinite(o.maxRootDirSize)?Math.floor(o.maxRootDirSize):Y.siteMaxRootDirSizeMb*Z;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(s/fe)),maxTtlDays:Math.max(1,Math.round(c/X)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):Y.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(l/Z)),directoryMaxFolderSizeMb:Math.max(1,Math.round(u/Z)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):Y.directoryMaxFileCount,inlinePreviewMimes:me(r.inlinePreviewMimes,32).length?me(r.inlinePreviewMimes,32):[...Y.inlinePreviewMimes],siteEnabled:a.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(d/fe)),siteMaxTtlDays:Math.max(1,Math.round(f/X)),maxActiveSites:typeof a.maxActiveSites==`number`&&Number.isFinite(a.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(a.maxActiveSites))):Y.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(p/Z)),siteMaxFileCount:typeof o.maxFileCount==`number`&&Number.isFinite(o.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(o.maxFileCount))):Y.siteMaxFileCount}}function ge(e){let t=e.defaultTtlHours*fe,n=e.maxTtlDays*X,r=e.siteDefaultTtlHours*fe,i=e.siteMaxTtlDays*X;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function _e(e){let t=ge(e);if(t)throw Error(t);await f(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*fe,maxTtlMs:e.maxTtlDays*X,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Z,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Z,maxFileCount:e.directoryMaxFileCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*fe,maxTtlMs:e.siteMaxTtlDays*X,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Z,maxFileCount:e.siteMaxFileCount}}}})}),P()}var Q=r();function ve(){return o(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,y,`dark:border-edge`)}function ye({hasToken:e}){let t=c(u(e=>e.language)).sharesSettings,{data:n,isLoading:r}=L(e),i=(0,J.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(he(n.payload.config)),[n]),a=(0,J.useRef)(!1),[o,s]=(0,J.useState)(null),[l,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=o??i,_=i,v=(0,J.useMemo)(()=>!g||!_?!1:JSON.stringify(g)!==JSON.stringify(_),[g,_]),y=(0,J.useCallback)(e=>{a.current=!0,s(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),b=(0,J.useCallback)(async()=>{if(!(!g||l)){d(!0),p(null),h(!1);try{await _e(g),a.current=!1,s(null),h(!0),window.setTimeout(()=>h(!1),2500)}catch(e){p(e instanceof Error?e.message:t.policySaveError)}finally{d(!1)}}},[g,l,t.policySaveError]),x=(0,J.useCallback)(()=>{a.current=!1,s(null),p(null),h(!1)},[]);return!e||!g?r?(0,Q.jsx)(q,{children:(0,Q.jsx)(K,{rows:2})}):null:(0,Q.jsxs)(q,{children:[(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[m?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Q.jsx)(H,{type:`button`,variant:`secondary`,disabled:l,onClick:()=>y(de()),children:t.policyUseRecommended}),(0,Q.jsx)(H,{type:`button`,variant:`secondary`,disabled:!v||l,onClick:x,children:t.policyDiscard}),(0,Q.jsx)(H,{type:`button`,variant:`primary`,disabled:!v||l,onClick:()=>void b(),children:l?t.policySaving:t.policySave})]})]}),v?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,f?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Q.jsx)(be,{t,form:g,onChange:y})]})}function be(e){let t=(0,ue.c)(150),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,Q.jsx)($,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,Q.jsx)($,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,Q.jsx)($,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,Q.jsx)($,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let T;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(T=(0,Q.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=T):T=t[54];let ee=!r.enabled,E;t[55]===i?E=t[56]:(E=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=E);let D;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==ee||t[61]!==E?(D=(0,Q.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:ee,onChange:E}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=ee,t[61]=E,t[62]=D):D=t[62];let O;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==T||t[67]!==D||t[68]!==p?(O=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,T,D]}),t[63]=g,t[64]=y,t[65]=S,t[66]=T,t[67]=D,t[68]=p,t[69]=O):O=t[69];let k=!r.enabled,A;t[70]===i?A=t[71]:(A=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=A);let j;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==k||t[75]!==A?(j=(0,Q.jsx)(xe,{t:n,values:r.inlinePreviewMimes,disabled:k,onChange:A}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=k,t[75]=A,t[76]=j):j=t[76];let M;t[77]!==O||t[78]!==j||t[79]!==s||t[80]!==u?(M=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,O,j]}),t[77]=O,t[78]=j,t[79]=s,t[80]=u,t[81]=M):M=t[81];let N;t[82]===n.policySiteSection?N=t[83]:(N=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[82]=n.policySiteSection,t[83]=N);let P;t[84]===n.policySiteSectionHint?P=t[85]:(P=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[84]=n.policySiteSectionHint,t[85]=P);let F;t[86]!==N||t[87]!==P?(F=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[N,P]}),t[86]=N,t[87]=P,t[88]=F):F=t[88];let I;t[89]===i?I=t[90]:(I=e=>i({siteEnabled:e.target.checked}),t[89]=i,t[90]=I);let L;t[91]!==r.siteEnabled||t[92]!==I?(L=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:I}),t[91]=r.siteEnabled,t[92]=I,t[93]=L):L=t[93];let te;t[94]!==n.policySiteEnabled||t[95]!==L?(te=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[L,n.policySiteEnabled]}),t[94]=n.policySiteEnabled,t[95]=L,t[96]=te):te=t[96];let ne=!r.siteEnabled,R;t[97]===i?R=t[98]:(R=e=>i({siteDefaultTtlHours:e}),t[97]=i,t[98]=R);let re;t[99]!==r.siteDefaultTtlHours||t[100]!==n.policySiteDefaultTtlHint||t[101]!==n.policySiteDefaultTtlHours||t[102]!==ne||t[103]!==R?(re=(0,Q.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:ne,onChange:R}),t[99]=r.siteDefaultTtlHours,t[100]=n.policySiteDefaultTtlHint,t[101]=n.policySiteDefaultTtlHours,t[102]=ne,t[103]=R,t[104]=re):re=t[104];let z=!r.siteEnabled,ie;t[105]===i?ie=t[106]:(ie=e=>i({siteMaxTtlDays:e}),t[105]=i,t[106]=ie);let B;t[107]!==r.siteMaxTtlDays||t[108]!==n.policySiteMaxTtlDays||t[109]!==n.policySiteMaxTtlHint||t[110]!==z||t[111]!==ie?(B=(0,Q.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:z,onChange:ie}),t[107]=r.siteMaxTtlDays,t[108]=n.policySiteMaxTtlDays,t[109]=n.policySiteMaxTtlHint,t[110]=z,t[111]=ie,t[112]=B):B=t[112];let ae=!r.siteEnabled,V;t[113]===i?V=t[114]:(V=e=>i({maxActiveSites:e}),t[113]=i,t[114]=V);let H;t[115]!==r.maxActiveSites||t[116]!==n.policyMaxActiveSites||t[117]!==n.policyMaxActiveSitesHint||t[118]!==ae||t[119]!==V?(H=(0,Q.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:ae,onChange:V}),t[115]=r.maxActiveSites,t[116]=n.policyMaxActiveSites,t[117]=n.policyMaxActiveSitesHint,t[118]=ae,t[119]=V,t[120]=H):H=t[120];let oe=!r.siteEnabled,se;t[121]===i?se=t[122]:(se=e=>i({siteMaxRootDirSizeMb:e}),t[121]=i,t[122]=se);let ce;t[123]!==r.siteMaxRootDirSizeMb||t[124]!==n.policySiteMaxRootDirSizeHint||t[125]!==n.policySiteMaxRootDirSizeMb||t[126]!==oe||t[127]!==se?(ce=(0,Q.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:oe,onChange:se}),t[123]=r.siteMaxRootDirSizeMb,t[124]=n.policySiteMaxRootDirSizeHint,t[125]=n.policySiteMaxRootDirSizeMb,t[126]=oe,t[127]=se,t[128]=ce):ce=t[128];let U=!r.siteEnabled,W;t[129]===i?W=t[130]:(W=e=>i({siteMaxFileCount:e}),t[129]=i,t[130]=W);let G;t[131]!==r.siteMaxFileCount||t[132]!==n.policySiteMaxFileCount||t[133]!==n.policySiteMaxFileCountHint||t[134]!==U||t[135]!==W?(G=(0,Q.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:U,onChange:W}),t[131]=r.siteMaxFileCount,t[132]=n.policySiteMaxFileCount,t[133]=n.policySiteMaxFileCountHint,t[134]=U,t[135]=W,t[136]=G):G=t[136];let K;t[137]!==re||t[138]!==B||t[139]!==H||t[140]!==ce||t[141]!==G?(K=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[re,B,H,ce,G]}),t[137]=re,t[138]=B,t[139]=H,t[140]=ce,t[141]=G,t[142]=K):K=t[142];let q;t[143]!==F||t[144]!==te||t[145]!==K?(q=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[F,te,K]}),t[143]=F,t[144]=te,t[145]=K,t[146]=q):q=t[146];let le;return t[147]!==M||t[148]!==q?(le=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[M,q]}),t[147]=M,t[148]=q,t[149]=le):le=t[149],le}function $(e){let t=(0,ue.c)(21),{id:n,label:r,hint:i,value:a,min:s,max:c,disabled:l,onChange:u}=e,d;t[0]!==n||t[1]!==r?(d=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=d):d=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=o(ve(),`max-w-xs font-mono text-xs`),t[3]=f):f=t[3];let p;t[4]!==c||t[5]!==s||t[6]!==u?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&u(Math.max(s,Math.min(c,Math.floor(t))))},t[4]=c,t[5]=s,t[6]=u,t[7]=p):p=t[7];let m;t[8]!==l||t[9]!==n||t[10]!==c||t[11]!==s||t[12]!==p||t[13]!==a?(m=(0,Q.jsx)(`input`,{id:n,type:`number`,min:s,max:c,disabled:l,className:f,value:a,onChange:p}),t[8]=l,t[9]=n,t[10]=c,t[11]=s,t[12]=p,t[13]=a,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,Q.jsxs)(`div`,{children:[d,m,h]}),t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function xe(e){let t=(0,ue.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,s;t[0]!==a||t[1]!==r?(s=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]===n.policyInlinePreviewMimes?l=t[4]:(l=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=l);let u;t[5]===n.policyInlinePreviewMimesHint?u=t[6]:(u=(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=u);let d;t[7]!==i||t[8]!==a||t[9]!==r?(d=r.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,Q.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=d):d=t[10];let f;t[11]===d?f=t[12]:(f=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d}),t[11]=d,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=o(ve(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===c?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),c(e.target.value),e.target.value=``)},t[14]=c,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,Q.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==l||t[21]!==u||t[22]!==f||t[23]!==g?(_=(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[l,u,f,g]}),t[20]=l,t[21]=u,t[22]=f,t[23]=g,t[24]=_):_=t[24],_}function Se(e){let t=(0,ue.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:s,sessionKey:d,agentId:f}=e,h=s===void 0?`any`:s,_=c(u(Te)),y=_.workspace,b=_.sharesSettings,C=oe(we),{data:E}=p(l(Ce)?`picker-agents-list`:null,ce),D;bb0:{let e;t[0]===f?e=t[1]:(e=f?.trim(),t[0]=f,t[1]=e);let n=e;if(n){D=n;break bb0}let r;t[2]===C?r=t[3]:(r=C.trim(),t[2]=C,t[3]=r);let i=r;if(i){D=i;break bb0}if(E?.defaultId){D=E.defaultId;break bb0}if(E?.agents?.[0]?.id){D=E.agents[0].id;break bb0}D=``}let O=D,[A,M]=(0,J.useState)(O),P,F;t[4]===O?(P=t[5],F=t[6]):(P=()=>{M(O)},F=[O],t[4]=O,t[5]=P,t[6]=F),(0,J.useEffect)(P,F);let{tree:I,loading:L,error:ne,loadRoot:R,loadChildren:re,reset:B}=v(A,d??null),ae;t[7]===a?ae=t[8]:(ae=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=ae);let[V,U]=(0,J.useState)(ae),W;t[9]!==a||t[10]!==R||t[11]!==n||t[12]!==B||t[13]!==U?(W=()=>{if(!n){B(),U(a?{path:a,isDirectory:!1}:null);return}R()},t[9]=a,t[10]=R,t[11]=n,t[12]=B,t[13]=U,t[14]=W):W=t[14];let G;t[15]!==a||t[16]!==R||t[17]!==n||t[18]!==A||t[19]!==B||t[20]!==d?(G=[n,A,d,R,B,a],t[15]=a,t[16]=R,t[17]=n,t[18]=A,t[19]=B,t[20]=d,t[21]=G):G=t[21],(0,J.useEffect)(W,G);let K;t[22]===re?K=t[23]:(K=e=>{re(e)},t[22]=re,t[23]=K);let q=K,le=V!==null&&(h===`any`||h===`file`&&!V.isDirectory||h===`directory`&&V.isDirectory),Y;bb1:{if(!V){Y=b.pickerHintNone;break bb1}if(h===`file`&&V.isDirectory){Y=b.pickerHintNeedsFile;break bb1}if(h===`directory`&&!V.isDirectory){Y=b.pickerHintNeedsDirectory;break bb1}Y=`${V.isDirectory?`📁`:`📄`} ${V.path}`}let de=Y,fe=E?.agents??[],X;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(w,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=X):X=t[24];let Z;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Z=o(`fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=Z):Z=t[25];let pe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(x,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=pe):pe=t[26];let me=_.cron.refresh,he=_.cron.refresh,ge;t[27]===R?ge=t[28]:(ge=()=>void R(),t[27]=R,t[28]=ge);let _e=L&&`animate-spin`,ve;t[29]===_e?ve=t[30]:(ve=o(`size-4`,_e),t[29]=_e,t[30]=ve);let ye;t[31]===ve?ye=t[32]:(ye=(0,Q.jsx)(te,{className:ve,"aria-hidden":!0}),t[31]=ve,t[32]=ye);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(S,{className:`size-4`}),t[33]=be):be=t[33];let $;t[34]!==ne||t[35]!==y.loadError?($=ne?(0,Q.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[y.loadError,`: `,ne]}):null,t[34]=ne,t[35]=y.loadError,t[36]=$):$=t[36];let xe;t[37]!==q||t[38]!==L||t[39]!==V?.path||t[40]!==U||t[41]!==y.emptyDir||t[42]!==y.title||t[43]!==I?(xe=L&&I.length===0?(0,Q.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Q.jsx)(T,{className:`size-4 animate-spin`}),y.title,`…`]}):(0,Q.jsx)(m,{tree:I,selectedPath:V?.path??null,onSelectFile:e=>U({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>U({path:e,isDirectory:t}),onExpandDir:q,onAction:void 0,emptyHint:y.emptyDir}),t[37]=q,t[38]=L,t[39]=V?.path,t[40]=U,t[41]=y.emptyDir,t[42]=y.title,t[43]=I,t[44]=xe):xe=t[44];let Se;t[45]!==$||t[46]!==xe?(Se=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[$,xe]}),t[45]=$,t[46]=xe,t[47]=Se):Se=t[47];let Ee;t[48]===de?Ee=t[49]:(Ee=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:de}),t[48]=de,t[49]=Ee);let De;t[50]===r?De=t[51]:(De=()=>r(!1),t[50]=r,t[51]=De);let Oe;t[52]!==b.cancel||t[53]!==De?(Oe=(0,Q.jsx)(H,{type:`button`,variant:`ghost`,onClick:De,children:b.cancel}),t[52]=b.cancel,t[53]=De,t[54]=Oe):Oe=t[54];let ke=!le,Ae;t[55]!==i||t[56]!==r||t[57]!==A||t[58]!==V?(Ae=()=>{V&&(i({...V,agentId:A}),r(!1))},t[55]=i,t[56]=r,t[57]=A,t[58]=V,t[59]=Ae):Ae=t[59];let je;t[60]!==b.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Q.jsx)(H,{type:`button`,disabled:ke,onClick:Ae,children:b.pickerConfirm}),t[60]=b.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ee||t[68]!==Me?(Ne=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ee,Me]}),t[67]=Ee,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Q.jsx)(k,{open:n,onOpenChange:r,children:(0,Q.jsxs)(j,{children:[X,(0,Q.jsxs)(g,{className:Z,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[pe,(0,Q.jsx)(N,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:b.pickerTitle}),(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:me,"aria-label":he,disabled:L,onClick:ge,children:ye}),(0,Q.jsx)(se,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":y.close,children:be})})]}),fe.length>0?(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Q.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:b.pickerAgentLabel}),(0,Q.jsx)(ie,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:A,onChange:e=>{M(e.target.value),U(null)},children:fe.map(e=>(0,Q.jsxs)(z,{value:e.id,children:[ee(e,_.agentsSettings),e.id===E?.defaultId?` ★`:``]},e.id))})]}):null,Se,Ne]})]})})}function Ce(e){return e.token}function we(e){return e.agentId}function Te(e){return e.language}var Ee=[`shares`,`policy`];function De(e){let t=(e??``).trim();return Ee.includes(t)?t:`shares`}function Oe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function ke(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var Ae=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function je(){let e=(0,ue.c)(24),t=u(Ne),n=c(t).sharesSettings,r=!!l(Me),[a,o]=i(),s;e[0]===a?s=e[1]:(s=De(a.get(`tab`)),e[0]=a,e[1]=s);let d=s,f;e[2]===o?f=e[3]:(f=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=f);let p=f;if(!r)return(0,Q.jsx)(W,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let m={shares:n.tabShares,policy:n.tabPolicy},h=Ee.map(e=>({id:e,label:m[e]})),g;e[4]!==n.subtitle||e[5]!==n.title?(g=(0,Q.jsx)(U,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=g):g=e[6];let _;e[7]!==d||e[8]!==p||e[9]!==n.tabsAria||e[10]!==h?(_=(0,Q.jsx)(le,{items:h,activeTab:d,onChange:p,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=d,e[8]=p,e[9]=n.tabsAria,e[10]=h,e[11]=_):_=e[11];let v;e[12]!==d||e[13]!==r||e[14]!==t||e[15]!==n?(v=d===`shares`?(0,Q.jsx)(Pe,{t:n,language:t}):(0,Q.jsx)(ye,{hasToken:r}),e[12]=d,e[13]=r,e[14]=t,e[15]=n,e[16]=v):v=e[16];let y;e[17]!==d||e[18]!==v?(y=(0,Q.jsx)(G,{id:d,activeTab:d,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:v}),e[17]=d,e[18]=v,e[19]=y):y=e[19];let b;return e[20]!==g||e[21]!==_||e[22]!==y?(b=(0,Q.jsxs)(W,{children:[g,_,y]}),e[20]=g,e[21]=_,e[22]=y,e[23]=b):b=e[23],b}function Me(e){return e.token}function Ne(e){return e.language}function Pe(e){let t=(0,ue.c)(60),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:s,isLoading:c,mutate:l}=p(`shares-list`,b,i),u;t[1]===a?.payload?.shares?u=t[2]:(u=a?.payload?.shares??[],t[1]=a?.payload?.shares,t[2]=u);let d=u,[f,m]=(0,J.useState)(!1),h;bb0:{if(f){h=d;break bb0}let e;t[3]===d?e=t[4]:(e=d.filter(ze),t[3]=d,t[4]=e),h=e}let g=h,_;t[5]===d?_=t[6]:(_=d.filter(Re),t[5]=d,t[6]=_);let v=_.length,y;t[7]===d?y=t[8]:(y=d.filter(Le),t[7]=d,t[8]=y);let x=y.length,S;t[9]===l?S=t[10]:(S=()=>void l(),t[9]=l,t[10]=S);let C;t[11]!==n||t[12]!==S?(C=(0,Q.jsx)(Ve,{t:n,onCreated:S}),t[11]=n,t[12]=S,t[13]=C):C=t[13];let w=f?n.allSharesTitle:n.listTitle,T;t[14]===v?T=t[15]:(T=v>0&&(0,Q.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[14]=v,t[15]=T);let ee;t[16]!==w||t[17]!==T?(ee=(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[w,T]}),t[16]=w,t[17]=T,t[18]=ee):ee=t[18];let E;t[19]===l?E=t[20]:(E=()=>void l(),t[19]=l,t[20]=E);let D=c&&`animate-spin`,O;t[21]===D?O=t[22]:(O=o(`size-3.5`,D),t[21]=D,t[22]=O);let k;t[23]===O?k=t[24]:(k=(0,Q.jsx)(te,{className:O}),t[23]=O,t[24]=k);let A;t[25]!==c||t[26]!==E||t[27]!==k?(A=(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:E,disabled:c,children:k}),t[25]=c,t[26]=E,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==x||t[30]!==f||t[31]!==n.hideExpired||t[32]!==n.showExpired?(j=x>0&&(0,Q.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Ie),children:f?n.hideExpired:n.showExpired}),t[29]=x,t[30]=f,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=j):j=t[33];let M;t[34]!==A||t[35]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,j]}),t[34]=A,t[35]=j,t[36]=M):M=t[36];let N;t[37]!==ee||t[38]!==M?(N=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[ee,M]}),t[37]=ee,t[38]=M,t[39]=N):N=t[39];let P;t[40]!==a||t[41]!==s||t[42]!==g||t[43]!==c||t[44]!==r||t[45]!==l||t[46]!==n?(P=c&&!a?(0,Q.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Fe)}):s?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Q.jsx)(`span`,{children:n.error}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void l(),children:n.retry})]}):g.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,Q.jsx)(Ue,{share:e,t:n,language:r,onRevoked:()=>void l(),onExtended:()=>void l()},e.id))}),t[40]=a,t[41]=s,t[42]=g,t[43]=c,t[44]=r,t[45]=l,t[46]=n,t[47]=P):P=t[47];let F;t[48]!==x||t[49]!==l||t[50]!==f||t[51]!==n?(F=x>0&&f&&(0,Q.jsx)(We,{t:n,onCleaned:()=>void l()}),t[48]=x,t[49]=l,t[50]=f,t[51]=n,t[52]=F):F=t[52];let I;t[53]!==N||t[54]!==P||t[55]!==F?(I=(0,Q.jsxs)(q,{children:[N,P,F]}),t[53]=N,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;return t[57]!==I||t[58]!==C?(L=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[C,I]}),t[57]=I,t[58]=C,t[59]=L):L=t[59],L}function Fe(e,t){return(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(O,{className:`h-4 w-2/3`}),(0,Q.jsx)(O,{className:`mt-2 h-3 w-1/2`})]}),(0,Q.jsx)(O,{className:`h-7 w-20 rounded-md`})]})},t)}function Ie(e){return!e}function Le(e){return e.expired||e.revoked}function Re(e){return!e.expired&&!e.revoked}function ze(e){return!e.expired&&!e.revoked}var Be={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function Ve({t:e,onCreated:t}){let[n,r]=(0,J.useReducer)(E,Be),{expanded:i,path:a,isDirectory:s,agentId:c,ttlMs:l,maxViews:u,description:d,directoryMode:f,creating:p,result:m,errorMsg:g,resultDialogOpen:_,pickerOpen:v}=n,y=(0,J.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await A({path:a.trim(),ttlMs:l,maxViews:u,description:d.trim()||void 0,...c?{agentId:c}:{},...s?{kind:`directory`,directoryMode:f}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,s,c,l,u,d,f,t]),b=(0,J.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Q.jsxs)(q,{children:[(0,Q.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:o(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,children:s?`📁`:`📄`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,Q.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Q.jsx)(R,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),s?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Q.jsxs)(ie,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:f,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Q.jsx)(z,{value:`browse`,children:e.directoryModeBrowse}),(0,Q.jsx)(z,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Q.jsx)(ie,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:l,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Ae.map(t=>(0,Q.jsx)(z,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Q.jsxs)(ie,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:u??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Q.jsx)(z,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Q.jsx)(z,{value:`1`,children:`1`}),(0,Q.jsx)(z,{value:`5`,children:`5`}),(0,Q.jsx)(z,{value:`10`,children:`10`}),(0,Q.jsx)(z,{value:`50`,children:`50`}),(0,Q.jsx)(z,{value:`100`,children:`100`})]})]})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Q.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:d,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Q.jsxs)(H,{type:`button`,disabled:p||!a.trim(),onClick:()=>void y(),children:[p?(0,Q.jsx)(T,{className:`size-4 animate-spin`}):(0,Q.jsx)(ae,{className:`size-4`}),p?e.creating:e.createButton]}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,onClick:()=>{b(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),g&&(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:g})]}),(0,Q.jsx)(h,{open:_,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:m}),(0,Q.jsx)(Se,{open:v,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Q.jsxs)(H,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Q.jsx)(ae,{className:`size-4`}),e.createTitle]})}var He={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function Ue({share:e,t,language:n,onRevoked:r,onExtended:i}){let[c,l]=(0,J.useReducer)(E,He),{revokeOpen:u,revoking:d,linksOpen:f,urlCopied:p,copyFailed:m,extending:h}=c,g=!e.expired&&!e.revoked,v=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,y=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,b=(0,J.useCallback)(async()=>{l({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await D(e.id),r()}catch{}finally{l({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),x=(0,J.useCallback)(async()=>{if(l({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await s(e.shareUrl)){l({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>l({type:`patch`,patch:{copyFailed:!1}}),2500);return}l({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>l({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),S=(0,J.useCallback)(async()=>{l({type:`patch`,patch:{extending:!0}});try{await C(e.id,864e5),i()}catch{}finally{l({type:`patch`,patch:{extending:!1}})}},[e.id,i]),w=`share-links-${e.id}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:o(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":f,"aria-controls":w,onClick:()=>l({type:`patch`,patch:{linksOpen:!f}}),children:[(0,Q.jsx)(B,{className:o(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,f?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),(0,Q.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:o(`text-xs font-medium`,y),children:v})]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.workspaceRelativePath}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Oe(e.fileSize)}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(I,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:ke(e.expiresAt,n)]}),(0,Q.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Q.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:g&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void x(),children:p?(0,Q.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,Q.jsx)(M,{className:`size-3.5`})}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void S(),disabled:h,title:t.extend,children:h?(0,Q.jsx)(T,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(I,{className:`size-3.5`})}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>l({type:`patch`,patch:{revokeOpen:!0}}),disabled:d,children:d?(0,Q.jsx)(T,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(_,{className:`size-3.5`})})]})})]}),g&&f?(0,Q.jsxs)(`div`,{id:w,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Q.jsx)(ne,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),m?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(re,{reachability:e.reachability})})]}):null]}),(0,Q.jsx)(F,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void b(),onCancel:()=>l({type:`patch`,patch:{revokeOpen:!1}})})]})}function We({t:e,onCleaned:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(async()=>{r(!1),a(!0);try{await V(),t()}catch{}finally{a(!1)}},[t]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,Q.jsx)(T,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(_,{className:`size-3.5`}),e.cleanExpired]})}),(0,Q.jsx)(F,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{je as SharesSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./locale-store-0lpYdNDr.js";import{Jr as r}from"./index-C8JkTS6d.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{c as a,d as o,l as s}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./messages-BwQ3WssU.js";import{l as d,n as f,o as p,r as m}from"./locale-store-0lpYdNDr.js";import{t as h}from"./config-reload-event-Bjh2zoKp.js";import{Bi as g,Bo as _,Bs as v,Ds as y,Fl as b,Hi as x,Ho as S,Jc as C,Jr as w,Ll as T,Ro as E,Uo as D,Wo as O,Xs as k,bo as A,cu as j,dl as M,ea as N,es as P,lu as F,ou as I,qr as L,uc as R,vs as z,wc as B,ws as V,yo as H,zo as ee,zs as U}from"./index-C8JkTS6d.js";import{t as W}from"./page-tabs-Caj1-E_X.js";import{t as te}from"./skill-reload-api-B7p2QNXt.js";var ne=n(),G=e(t(),1),K=r(),re=(0,G.memo)(function(e){let t=(0,ne.c)(23),{loading:n,onReloadClick:r,searchQuery:i,setSearchQuery:a,mainTab:o,sk:s,setPendingFile:c,setInstallOpen:l}=e,u;t[0]!==n||t[1]!==r||t[2]!==s.reloadDiskAria||t[3]!==s.reloadRuntime?(u=(0,K.jsx)(N,{className:`size-9 shrink-0 p-0`,loading:n,label:s.reloadDiskAria,title:s.reloadRuntime,onClick:r}),t[0]=n,t[1]=r,t[2]=s.reloadDiskAria,t[3]=s.reloadRuntime,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(R,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=d):d=t[5];let f;t[6]===a?f=t[7]:(f=e=>a(e.target.value),t[6]=a,t[7]=f);let p=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,m;t[8]!==i||t[9]!==f||t[10]!==p?(m=(0,K.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,K.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:f,placeholder:p,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[8]=i,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==l||t[13]!==c?(h=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,K.jsx)(B,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=g):g=t[15];let _;t[16]!==s.installCta||t[17]!==h?(_=(0,K.jsxs)(V,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:h,children:[g,s.installCta]}),t[16]=s.installCta,t[17]=h,t[18]=_):_=t[18];let v;return t[19]!==u||t[20]!==m||t[21]!==_?(v=(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,m,_]}),t[19]=u,t[20]=m,t[21]=_,t[22]=v):v=t[22],v}),q=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function J(){let e=(0,ne.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:l(`h-4 min-w-0 flex-1`,q)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,K.jsx)(`div`,{className:l(`size-8 shrink-0 rounded-lg`,q)}),(0,K.jsx)(`div`,{className:l(`h-8 w-[4.5rem] shrink-0 rounded-lg`,q)})]})]}),r=(0,K.jsx)(`div`,{className:l(`h-3 w-full`,q)}),i=(0,K.jsx)(`div`,{className:l(`h-3 w-[92%]`,q)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,K.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,K.jsx)(`div`,{className:l(`h-3 w-full`,q)}),(0,K.jsx)(`div`,{className:l(`h-2.5 w-4/5`,q)})]})]})})}),e[4]=a):a=e[4],a}function Y(){let e=(0,ne.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(J,{}),e[0]=t):t=e[0],t}var X=new Set([`installed`,`marketplace`]),Z=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),ie=new Set([`all`,`enabled`,`disabled`]),ae=`mprov`,oe=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],se=[`business`,`creative`,`documents`,`engineering`,`tools`];function ce(e){let t=(0,ne.c)(27),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:u,catalogDisplayRows:d,catalogStatusFilter:f,resolveSkillEnabled:p,categoryLabel:m,sourceLabel:h,openSkillDetail:g,onSkillToggle:_,onUseSkillInChat:v,usingSkillInChatName:y,togglingSkillName:b}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=oe.map(le),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(i.length===0){let e;return t[3]===n.empty?e=t[4]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.empty}),t[3]=n.empty,t[4]=e),e}if(a.length===0){let e;return t[5]===n.noSearchResults?e=t[6]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.noSearchResults}),t[5]=n.noSearchResults,t[6]=e),e}let x;t[7]!==o||t[8]!==s||t[9]!==m||t[10]!==u||t[11]!==n?(x=o.length>1?(0,K.jsx)(W,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:m(e),title:m(e)}))],activeTab:s,onChange:u,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[7]=o,t[8]=s,t[9]=m,t[10]=u,t[11]=n,t[12]=x):x=t[12];let S;t[13]!==d||t[14]!==f||t[15]!==_||t[16]!==v||t[17]!==g||t[18]!==p||t[19]!==n||t[20]!==h||t[21]!==b||t[22]!==y?(S=d.length===0?(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:f===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:d.map(e=>{let t=p(e);return(0,K.jsxs)(`article`,{className:l(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,K.jsx)(`button`,{type:`button`,className:l(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,z.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void g(e),children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,K.jsxs)(`span`,{className:l(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:[t?(0,K.jsx)(I,{className:`size-3`,"aria-hidden":!0}):(0,K.jsx)(c,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,K.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:h(e.source)}),e.managed?(0,K.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,K.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]})]})})}),(0,K.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:t?(0,K.jsx)(V,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:y===e.name||b===e.name,onClick:()=>void v({name:e.name,source:`catalog`}),children:y===e.name?n.previewUseInChatBusy:n.previewUseInChat}):(0,K.jsx)(V,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:b===e.name,onClick:()=>void _(e.name,!0),children:b===e.name?n.uploading:n.detailModalEnable})})]},`${e.directoryId}-${e.path}`)})}),t[13]=d,t[14]=f,t[15]=_,t[16]=v,t[17]=g,t[18]=p,t[19]=n,t[20]=h,t[21]=b,t[22]=y,t[23]=S):S=t[23];let C;return t[24]!==x||t[25]!==S?(C=(0,K.jsxs)(K.Fragment,{children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26],C}function le(e){return(0,K.jsx)(Y,{},e)}var ue=`https://skillhub.cn`,de=`https://clawhub.ai`;function fe(e){let t=e.trim();return t?`${ue}/skills/${encodeURIComponent(t)}`:null}function Q(e){let t=e.trim();return t?`${de}/${encodeURIComponent(t)}`:null}function pe(e,t){return e===`skillhub`?fe(t):e===`clawhub`?Q(t):null}function me(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function he(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function ge(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function _e(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}function ve(e){let t=(0,ne.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(S,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,K.jsx)(O,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?he(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let f;t[9]===d?f=t[10]:(f=(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]!==n.cancel||t[14]!==p?(m=(0,K.jsx)(V,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=m):m=t[15];let h;t[16]===s?h=t[17]:(h=()=>void s(),t[16]=s,t[17]=h);let g;t[18]!==n.deleteConfirm||t[19]!==h?(g=(0,K.jsx)(V,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:h,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=h,t[20]=g):g=t[20];let v;t[21]!==m||t[22]!==g?(v=(0,K.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[m,g]}),t[21]=m,t[22]=g,t[23]=v):v=t[23];let y;t[24]!==v||t[25]!==u||t[26]!==f?(y=(0,K.jsxs)(D,{children:[l,(0,K.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[u,f,v]})]}),t[24]=v,t[25]=u,t[26]=f,t[27]=y):y=t[27];let b;return t[28]!==r||t[29]!==c||t[30]!==y?(b=(0,K.jsx)(E,{open:r,onOpenChange:c,children:y}),t[28]=r,t[29]=c,t[30]=y,t[31]=b):b=t[31],b}var ye=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function be(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function xe(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function Se(e){let t=(0,ne.c)(9),{name:n,className:r}=e,i;t[0]===n?i=t[1]:(i=xe(n),t[0]=n,t[1]=i);let a=i,o=ye[be(n)%ye.length],s;t[2]!==r||t[3]!==o.dark||t[4]!==o.light?(s=l(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,o.light,o.dark,r),t[2]=r,t[3]=o.dark,t[4]=o.light,t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==s?(c=(0,K.jsx)(`div`,{className:s,"aria-hidden":!0,children:a}),t[6]=a,t[7]=s,t[8]=c):c=t[8],c}function Ce(e){let t=(0,ne.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,K.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,K.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function we(e){let t=(0,ne.c)(118),{preview:n,sk:r}=e,i=n.metadata,a=n.toolConditions,o=!!a&&(a.requiresTools.length>0||a.requiresToolsets.length>0||a.fallbackForTools.length>0||a.fallbackForToolsets.length>0),s=i.requires,c=s&&((s.bins?.length??0)>0||(s.env?.length??0)>0||(s.anyBins?.length??0)>0),u,d,f,p,m,h,g,_,v,y,b,S,C,w,T;if(t[0]!==a||t[1]!==c||t[2]!==o||t[3]!==i.emoji||t[4]!==i.homepage||t[5]!==i.install||t[6]!==i.os||t[7]!==n.description||t[8]!==n.disableModelInvocation||t[9]!==n.requiredEnvVarNames||t[10]!==s||t[11]!==r.detailEnvVarsLabel||t[12]!==r.detailHomepageLabel||t[13]!==r.detailInstallLabel||t[14]!==r.detailNotInjectedNote||t[15]!==r.detailPlatformsLabel||t[16]!==r.detailRequiresAnyBins||t[17]!==r.detailRequiresBins||t[18]!==r.detailRequiresEnv||t[19]!==r.detailRequiresLabel||t[20]!==r.detailSummaryHeading||t[21]!==r.detailToolGatingLabel||t[22]!==r.detailToolsFallbackList||t[23]!==r.detailToolsRequiresList||t[24]!==r.detailToolsetsFallbackList||t[25]!==r.detailToolsetsRequiresList){let e=i.install?.filter(De)??[],x=n.requiredEnvVarNames?.filter(Ee)??[];g=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(0,K.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailSummaryHeading}),t[41]=r.detailSummaryHeading,t[42]=h),v=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?y=t[44]:(y=i.emoji?.trim()?(0,K.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=y);let E;t[45]===i.emoji?E=t[46]:(E=i.emoji?.trim()?`mt-2`:``,t[45]=i.emoji,t[46]=E);let D;t[47]===E?D=t[48]:(D=l(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(b=(0,K.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=b):b=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(S=n.disableModelInvocation?(0,K.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:r.detailNotInjectedNote}):null,t[52]=n.disableModelInvocation,t[53]=r.detailNotInjectedNote,t[54]=S):S=t[54];let O;t[55]===i.homepage?O=t[56]:(O=i.homepage?.trim()?(0,K.jsx)(`a`,{href:i.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:i.homepage.trim()}):null,t[55]=i.homepage,t[56]=O),t[57]!==r.detailHomepageLabel||t[58]!==O?(C=(0,K.jsx)(Ce,{label:r.detailHomepageLabel,children:O}),t[57]=r.detailHomepageLabel,t[58]=O,t[59]=C):C=t[59];let k;t[60]===i.os?k=t[61]:(k=i.os&&i.os.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:i.os.join(`, `)}):null,t[60]=i.os,t[61]=k),t[62]!==r.detailPlatformsLabel||t[63]!==k?(w=(0,K.jsx)(Ce,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=w):w=t[64];let A;t[65]!==c||t[66]!==s||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=c&&s?(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[s.bins&&s.bins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),s.bins.join(`, `)]}):null,s.env&&s.env.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,K.jsx)(`span`,{className:`font-mono text-xs`,children:s.env.join(`, `)})]}):null,s.anyBins&&s.anyBins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresAnyBins,`: `]}),s.anyBins.join(`, `)]}):null]}):null,t[65]=c,t[66]=s,t[67]=r.detailRequiresAnyBins,t[68]=r.detailRequiresBins,t[69]=r.detailRequiresEnv,t[70]=A):A=t[70],t[71]!==r.detailRequiresLabel||t[72]!==A?(T=(0,K.jsx)(Ce,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=T):T=t[73];let j=e.length>0?(0,K.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Te)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,K.jsx)(Ce,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=f):f=t[76];let M;t[77]!==a||t[78]!==o||t[79]!==r.detailToolsFallbackList||t[80]!==r.detailToolsRequiresList||t[81]!==r.detailToolsetsFallbackList||t[82]!==r.detailToolsetsRequiresList?(M=o&&a?(0,K.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[a.requiresTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),a.requiresTools.join(`, `)]}):null,a.requiresToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),a.requiresToolsets.join(`, `)]}):null,a.fallbackForTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),a.fallbackForTools.join(`, `)]}):null,a.fallbackForToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsFallbackList,`: `]}),a.fallbackForToolsets.join(`, `)]}):null]}):null,t[77]=a,t[78]=o,t[79]=r.detailToolsFallbackList,t[80]=r.detailToolsRequiresList,t[81]=r.detailToolsetsFallbackList,t[82]=r.detailToolsetsRequiresList,t[83]=M):M=t[83],t[84]!==r.detailToolGatingLabel||t[85]!==M?(p=(0,K.jsx)(Ce,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],u=Ce,d=r.detailEnvVarsLabel,_=x.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:x.join(`, `)}):null,t[0]=a,t[1]=c,t[2]=o,t[3]=i.emoji,t[4]=i.homepage,t[5]=i.install,t[6]=i.os,t[7]=n.description,t[8]=n.disableModelInvocation,t[9]=n.requiredEnvVarNames,t[10]=s,t[11]=r.detailEnvVarsLabel,t[12]=r.detailHomepageLabel,t[13]=r.detailInstallLabel,t[14]=r.detailNotInjectedNote,t[15]=r.detailPlatformsLabel,t[16]=r.detailRequiresAnyBins,t[17]=r.detailRequiresBins,t[18]=r.detailRequiresEnv,t[19]=r.detailRequiresLabel,t[20]=r.detailSummaryHeading,t[21]=r.detailToolGatingLabel,t[22]=r.detailToolsFallbackList,t[23]=r.detailToolsRequiresList,t[24]=r.detailToolsetsFallbackList,t[25]=r.detailToolsetsRequiresList,t[26]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=S,t[38]=C,t[39]=w,t[40]=T}else u=t[26],d=t[27],f=t[28],p=t[29],m=t[30],h=t[31],g=t[32],_=t[33],v=t[34],y=t[35],b=t[36],S=t[37],C=t[38],w=t[39],T=t[40];let E;t[87]!==u||t[88]!==d||t[89]!==_?(E=(0,K.jsx)(u,{label:d,children:_}),t[87]=u,t[88]=d,t[89]=_,t[90]=E):E=t[90];let D;t[91]!==f||t[92]!==p||t[93]!==E||t[94]!==v||t[95]!==y||t[96]!==b||t[97]!==S||t[98]!==C||t[99]!==w||t[100]!==T?(D=(0,K.jsxs)(`div`,{className:v,children:[y,b,S,C,w,T,f,p,E]}),t[91]=f,t[92]=p,t[93]=E,t[94]=v,t[95]=y,t[96]=b,t[97]=S,t[98]=C,t[99]=w,t[100]=T,t[101]=D):D=t[101];let O;t[102]!==m||t[103]!==h||t[104]!==D?(O=(0,K.jsxs)(`section`,{"aria-labelledby":m,children:[h,D]}),t[102]=m,t[103]=h,t[104]=D,t[105]=O):O=t[105];let k;t[106]===r.detailInstructionsHeading?k=t[107]:(k=(0,K.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailInstructionsHeading}),t[106]=r.detailInstructionsHeading,t[107]=k);let A;t[108]!==n.bodyMarkdown||t[109]!==r.detailNoInstructionsBody?(A=n.bodyMarkdown.trim()?(0,K.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,K.jsx)(x,{content:n.bodyMarkdown})}):(0,K.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:r.detailNoInstructionsBody}),t[108]=n.bodyMarkdown,t[109]=r.detailNoInstructionsBody,t[110]=A):A=t[110];let j;t[111]!==k||t[112]!==A?(j=(0,K.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[k,A]}),t[111]=k,t[112]=A,t[113]=j):j=t[113];let M;return t[114]!==g||t[115]!==O||t[116]!==j?(M=(0,K.jsxs)(`div`,{className:g,children:[O,j]}),t[114]=g,t[115]=O,t[116]=j,t[117]=M):M=t[117],M}function Te(e,t){return(0,K.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,K.jsx)(`span`,{className:`text-fg`,children:ge(e)})},e.id||`${e.kind}-${t}`)}function Ee(e){return e.trim()}function De(e){return e&&typeof e.kind==`string`}var Oe=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function ke(e){let t=(0,ne.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:c,detailCatalogPreview:u,setDetailCatalogPreview:d,detailMarketplacePreview:f,setDetailMarketplacePreview:p,detailLoading:m,detailError:h,setDetailError:g,detailEnabled:b,detailDirectoryId:x,detailManaged:C,detailExternalUrl:w,usingSkillInChatName:k,installingMarketName:A,togglingSkillName:j,isSkillInstalledByName:N,onUseSkillInChat:P,onMarketInstall:F,onSkillToggle:I,setConfirmId:L,setConfirmOpen:R}=e,B;t[0]!==d||t[1]!==g||t[2]!==p||t[3]!==i||t[4]!==o||t[5]!==c?(B=e=>{i(e),e||(o(`catalog`),d(null),p(null),g(null),c(``))},t[0]=d,t[1]=g,t[2]=p,t[3]=i,t[4]=o,t[5]=c,t[6]=B):B=t[6];let H;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,K.jsx)(S,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=H):H=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=l(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[8]=W):W=t[8];let te=s||`?`,G;t[9]===te?G=t[10]:(G=(0,K.jsx)(Se,{name:te}),t[9]=te,t[10]=G);let re=s||`—`,q;t[11]===re?q=t[12]:(q=(0,K.jsx)(O,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:re}),t[11]=re,t[12]=q);let J;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(J=l(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,z.focusRingPanel),t[13]=J):J=t[13];let Y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,K.jsx)(y,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=Y):Y=t[14];let X;t[15]===n.detailCloseAria?X=t[16]:(X=(0,K.jsx)(ee,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,className:J,"aria-label":n.detailCloseAria,children:Y})}),t[15]=n.detailCloseAria,t[16]=X);let Z;t[17]!==G||t[18]!==q||t[19]!==X?(Z=(0,K.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[G,q,X]}),t[17]=G,t[18]=q,t[19]=X,t[20]=Z):Z=t[20];let ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,K.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ie):ie=t[21];let ae=a===`store`&&f?n.detailModalBanner:a===`store`?n.detailModalBannerStore:n.detailModalBanner,oe;t[22]===ae?oe=t[23]:(oe=(0,K.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[ie,(0,K.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:ae})]}),t[22]=ae,t[23]=oe);let se;t[24]!==u||t[25]!==b||t[26]!==h||t[27]!==m||t[28]!==f||t[29]!==a||t[30]!==n?(se=(0,K.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:m?(0,K.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:Oe.map(Ae)}):h?(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h}):a===`catalog`&&u?(0,K.jsxs)(K.Fragment,{children:[b?null:(0,K.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,K.jsx)(U,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,K.jsx)(we,{preview:u,sk:n})]}):a===`store`&&f?(0,K.jsx)(we,{preview:f,sk:n}):(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[24]=u,t[25]=b,t[26]=h,t[27]=m,t[28]=f,t[29]=a,t[30]=n,t[31]=se):se=t[31];let ce;t[32]!==w||t[33]!==a||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(ce=a===`store`&&w?(0,K.jsxs)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,className:l(`inline-flex h-9 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted`,`hover:bg-surface-hover hover:text-fg dark:border-edge`,z.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,K.jsx)(T,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=w,t[33]=a,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=ce):ce=t[36];let le;t[37]!==x||t[38]!==C||t[39]!==a||t[40]!==L||t[41]!==R||t[42]!==n.delete?(le=a===`catalog`&&C&&x?(0,K.jsxs)(V,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300`,onClick:()=>{L(x),R(!0)},children:[(0,K.jsx)(v,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=x,t[38]=C,t[39]=a,t[40]=L,t[41]=R,t[42]=n.delete,t[43]=le):le=t[43];let ue;t[44]!==ce||t[45]!==le?(ue=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ce,le]}),t[44]=ce,t[45]=le,t[46]=ue):ue=t[46];let de;t[47]!==b||t[48]!==m||t[49]!==a||t[50]!==s||t[51]!==A||t[52]!==N||t[53]!==F||t[54]!==I||t[55]!==P||t[56]!==i||t[57]!==n.cancel||t[58]!==n.detailModalDisable||t[59]!==n.detailModalEnable||t[60]!==n.marketplaceInstall||t[61]!==n.marketplaceReinstall||t[62]!==n.previewUseInChat||t[63]!==n.previewUseInChatBusy||t[64]!==n.uploading||t[65]!==n.useRequiresEnabled||t[66]!==j||t[67]!==k?(de=(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,K.jsx)(V,{type:`button`,variant:`secondary`,disabled:!s||m||k===s||A===s,onClick:()=>void P(),children:k===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,K.jsx)(V,{type:`button`,variant:N(s)?`secondary`:`primary`,disabled:!s||A===s,onClick:()=>{s&&F(s,{useDetailProvider:!0})},children:A===s?n.uploading:N(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,K.jsxs)(K.Fragment,{children:[b?(0,K.jsx)(V,{type:`button`,variant:`secondary`,disabled:!s||j===s,onClick:()=>{s&&I(s,!1)},children:j===s?n.uploading:n.detailModalDisable}):(0,K.jsx)(V,{type:`button`,variant:`primary`,disabled:!s||j===s,onClick:()=>{s&&I(s,!0)},children:j===s?n.uploading:n.detailModalEnable}),(0,K.jsx)(V,{type:`button`,variant:`secondary`,disabled:!s||!b||m||k===s||j===s,title:b?void 0:n.useRequiresEnabled,onClick:()=>void P(),children:k===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=b,t[48]=m,t[49]=a,t[50]=s,t[51]=A,t[52]=N,t[53]=F,t[54]=I,t[55]=P,t[56]=i,t[57]=n.cancel,t[58]=n.detailModalDisable,t[59]=n.detailModalEnable,t[60]=n.marketplaceInstall,t[61]=n.marketplaceReinstall,t[62]=n.previewUseInChat,t[63]=n.previewUseInChatBusy,t[64]=n.uploading,t[65]=n.useRequiresEnabled,t[66]=j,t[67]=k,t[68]=de):de=t[68];let fe;t[69]!==ue||t[70]!==de?(fe=(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[ue,de]}),t[69]=ue,t[70]=de,t[71]=fe):fe=t[71];let Q;t[72]!==Z||t[73]!==oe||t[74]!==se||t[75]!==fe?(Q=(0,K.jsxs)(D,{children:[H,(0,K.jsxs)(_,{className:W,children:[Z,oe,se,fe]})]}),t[72]=Z,t[73]=oe,t[74]=se,t[75]=fe,t[76]=Q):Q=t[76];let pe;return t[77]!==r||t[78]!==B||t[79]!==Q?(pe=(0,K.jsx)(E,{open:r,onOpenChange:B,children:Q}),t[77]=r,t[78]=B,t[79]=Q,t[80]=pe):pe=t[80],pe}function Ae(e){return(0,K.jsx)(`div`,{className:l(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function je(e){let t=(0,ne.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:c,uploading:u,onModalDragOver:d,onModalDragLeave:f,onModalDrop:p,onFileInputChange:m,onInstallSubmit:h}=e,g;t[0]!==c||t[1]!==i||t[2]!==o?(g=e=>{i(e),e||(o(null),c(!1))},t[0]=c,t[1]=i,t[2]=o,t[3]=g):g=t[3];let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(S,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=v):v=t[4];let x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),t[5]=x):x=t[5];let C;t[6]===n.installModalTitle?C=t[7]:(C=(0,K.jsx)(O,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=C);let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=l(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,z.focusRingPanel),t[8]=w):w=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,K.jsx)(y,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=T):T=t[9];let k;t[10]===n.installClose?k=t[11]:(k=(0,K.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=k);let A;t[12]!==n.installClose||t[13]!==k?(A=(0,K.jsx)(ee,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:w,"aria-label":n.installClose,children:[T,k]})}),t[12]=n.installClose,t[13]=k,t[14]=A):A=t[14];let j;t[15]!==C||t[16]!==A?(j=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,A]}),t[15]=C,t[16]=A,t[17]=j):j=t[17];let M=s?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,N;t[18]===M?N=t[19]:(N=l(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,M),t[18]=M,t[19]=N);let P;t[20]!==m||t[21]!==n.installModalDropHint||t[22]!==u?(P=(0,K.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:u,onChange:m}),t[20]=m,t[21]=n.installModalDropHint,t[22]=u,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,K.jsx)(b,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=F):F=t[24];let I;t[25]===n.installModalDropHint?I=t[26]:(I=(0,K.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=I);let L;t[27]===a?L=t[28]:(L=a?(0,K.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=L);let R;t[29]!==f||t[30]!==d||t[31]!==p||t[32]!==N||t[33]!==P||t[34]!==I||t[35]!==L?(R=(0,K.jsxs)(`label`,{className:N,onDragLeave:f,onDragOver:d,onDrop:p,children:[P,F,I,L]}),t[29]=f,t[30]=d,t[31]=p,t[32]=N,t[33]=P,t[34]=I,t[35]=L,t[36]=R):R=t[36];let B;t[37]===n.installModalReqTitle?B=t[38]:(B=(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=B);let V;t[39]===n.installModalReq1?V=t[40]:(V=(0,K.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=V);let H;t[41]===n.installModalReq2?H=t[42]:(H=(0,K.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=H);let U;t[43]!==V||t[44]!==H?(U=(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[V,H]}),t[43]=V,t[44]=H,t[45]=U):U=t[45];let W;t[46]!==B||t[47]!==U?(W=(0,K.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[B,U]}),t[46]=B,t[47]=U,t[48]=W):W=t[48];let te=!a||u,G=!a||u?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,re;t[49]===G?re=t[50]:(re=l(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,G,z.focusRingPanel),t[49]=G,t[50]=re);let q;t[51]===h?q=t[52]:(q=()=>void h(),t[51]=h,t[52]=q);let J=u?n.uploading:n.installAction,Y;t[53]!==te||t[54]!==re||t[55]!==q||t[56]!==J?(Y=(0,K.jsx)(`button`,{type:`button`,disabled:te,className:re,onClick:q,children:J}),t[53]=te,t[54]=re,t[55]=q,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==R||t[59]!==W||t[60]!==Y||t[61]!==j?(X=(0,K.jsxs)(D,{children:[v,(0,K.jsxs)(_,{className:x,children:[j,R,W,Y]})]}),t[58]=R,t[59]=W,t[60]=Y,t[61]=j,t[62]=X):X=t[62];let Z;return t[63]!==r||t[64]!==g||t[65]!==X?(Z=(0,K.jsx)(E,{open:r,onOpenChange:g,children:X}),t[63]=r,t[64]=g,t[65]=X,t[66]=Z):Z=t[66],Z}function Me(e){let t=(0,ne.c)(66),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:c,marketCategoryId:u,setMarketCategoryId:d,marketPage:f,setMarketPage:p,isSkillInstalledByName:m,openMarketplaceDetail:h,onMarketInstall:g,installingMarketName:_,onUseSkillInChat:v,usingSkillInChatName:y,searchInputActive:b,searchQuery:x,setSearchQuery:S,registeredProviders:w,marketBrowseProvider:T,setMarketBrowseProvider:E}=e,D=!b,O,A,M;if(t[0]!==_||t[1]!==m||t[2]!==T||t[3]!==u||t[4]!==f||t[5]!==r||t[6]!==a||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==g||t[12]!==v||t[13]!==h||t[14]!==w||t[15]!==b||t[16]!==x||t[17]!==E||t[18]!==d||t[19]!==p||t[20]!==S||t[21]!==D||t[22]!==n.loading||t[23]!==n.marketplaceAuthor||t[24]!==n.marketplaceCategoriesAria||t[25]!==n.marketplaceCategoryAll||t[26]!==n.marketplaceDownloads||t[27]!==n.marketplaceEmpty||t[28]!==n.marketplaceEmptySearch||t[29]!==n.marketplaceEmptySearchClear||t[30]!==n.marketplaceEmptySearchTryProvider||t[31]!==n.marketplaceInstall||t[32]!==n.marketplaceInstalled||t[33]!==n.marketplacePageNext||t[34]!==n.marketplacePagePrev||t[35]!==n.marketplacePageStatus||t[36]!==n.marketplaceVersion||t[37]!==n.previewUseInChat||t[38]!==n.previewUseInChatBusy||t[39]!==n.uploading||t[40]!==y){let e;t[44]===T?e=t[45]:(e=e=>e.id!==T,t[44]=T,t[45]=e);let N=w.filter(e),P=x.trim(),L;t[46]===n.marketplaceCategoryAll?L=t[47]:(L={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=L);let R;t[48]!==r||t[49]!==L?(R=[L,...r.map(Ie)],t[48]=r,t[49]=L,t[50]=R):R=t[50];let B=R;t[51]!==B||t[52]!==u||t[53]!==r.length||t[54]!==i||t[55]!==d||t[56]!==D||t[57]!==n.marketplaceCategoriesAria?(O=D?r.length>0?(0,K.jsx)(W,{items:B,activeTab:u,onChange:d,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,K.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Fe)}):null:null,t[51]=B,t[52]=u,t[53]=r.length,t[54]=i,t[55]=d,t[56]=D,t[57]=n.marketplaceCategoriesAria,t[58]=O):O=t[58],t[59]!==a||t[60]!==D?(A=D&&a?(0,K.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[59]=a,t[60]=D,t[61]=A):A=t[61],M=!o&&!c?(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:oe.map(Pe)}):c&&!o?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:c}):o?(0,K.jsxs)(`div`,{className:`relative`,children:[s?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":n.loading,children:(0,K.jsx)(C,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,o.items.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-edge py-12 text-center text-sm text-fg-muted`,children:[(0,K.jsx)(`p`,{className:`px-4`,children:b&&P?he(n.marketplaceEmptySearch,{query:P}):n.marketplaceEmpty}),b?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[N.map(e=>(0,K.jsx)(V,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>E(e.id),children:he(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>S(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,K.jsx)(`div`,{className:l(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,s&&`pointer-events-none opacity-[0.52] motion-reduce:opacity-100`),children:o.items.map(e=>{let t=me(e,e.providerId??T),r=m(t);return(0,K.jsxs)(`article`,{className:l(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,K.jsx)(`button`,{type:`button`,className:l(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,z.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void h(t,e.name,e.providerId??void 0),children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),r?(0,K.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,K.jsx)(I,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):null]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,K.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${r?` · ${n.marketplaceInstalled}`:``}`,children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,K.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,K.jsx)(k,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,K.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),(0,K.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:r?(0,K.jsx)(V,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||y===t,onClick:()=>void v({name:t,source:`store`,providerOverride:e.providerId??null}),children:y===t?n.previewUseInChatBusy:n.previewUseInChat}):(0,K.jsx)(V,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||_===t,onClick:()=>void g(t,{providerOverride:e.providerId??null}),children:_===t?n.uploading:n.marketplaceInstall})})]},e.id)})}),o.items.length>0?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,K.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:he(n.marketplacePageStatus,{page:o.meta.page,totalPages:o.meta.totalPages,total:o.meta.total})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f<=1,"aria-label":n.marketplacePagePrev,onClick:()=>p(Ne),children:[(0,K.jsx)(F,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePagePrev})]}),(0,K.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f>=o.meta.totalPages,"aria-label":n.marketplacePageNext,onClick:()=>p(e=>Math.min(o.meta.totalPages,e+1)),children:[(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePageNext}),(0,K.jsx)(j,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]}):null]}):null,t[0]=_,t[1]=m,t[2]=T,t[3]=u,t[4]=f,t[5]=r,t[6]=a,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=g,t[12]=v,t[13]=h,t[14]=w,t[15]=b,t[16]=x,t[17]=E,t[18]=d,t[19]=p,t[20]=S,t[21]=D,t[22]=n.loading,t[23]=n.marketplaceAuthor,t[24]=n.marketplaceCategoriesAria,t[25]=n.marketplaceCategoryAll,t[26]=n.marketplaceDownloads,t[27]=n.marketplaceEmpty,t[28]=n.marketplaceEmptySearch,t[29]=n.marketplaceEmptySearchClear,t[30]=n.marketplaceEmptySearchTryProvider,t[31]=n.marketplaceInstall,t[32]=n.marketplaceInstalled,t[33]=n.marketplacePageNext,t[34]=n.marketplacePagePrev,t[35]=n.marketplacePageStatus,t[36]=n.marketplaceVersion,t[37]=n.previewUseInChat,t[38]=n.previewUseInChatBusy,t[39]=n.uploading,t[40]=y,t[41]=O,t[42]=A,t[43]=M}else O=t[41],A=t[42],M=t[43];let N;return t[62]!==O||t[63]!==A||t[64]!==M?(N=(0,K.jsxs)(K.Fragment,{children:[O,A,M]}),t[62]=O,t[63]=A,t[64]=M,t[65]=N):N=t[65],N}function Ne(e){return Math.max(1,e-1)}function Pe(e){return(0,K.jsx)(J,{},e)}function Fe(e){return(0,K.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function Ie(e){return{id:e.id,label:e.label,title:e.label}}function Le(e){let t=(0,ne.c)(118),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:c,setMainTab:u,sourceFilter:d,setSourceFilter:f,builtinTabStats:p,userTabStats:m,catalogDisabledCount:h,catalogStatusFilter:g,setCatalogStatusFilter:_,marketSort:v,setMarketSort:y,marketBrowseProvider:b,setMarketBrowseProvider:x,registeredProviders:S,inSettingsShell:C,searchInputActive:w,resultTab:T,setResultTab:E,aggregatedTabCounts:D,aggregatedProviderStatus:O}=n;if(!i){let e;t[0]===n?e=t[1]:(e=(0,K.jsx)(Ue,{vm:n}),t[0]=n,t[1]=e);let i;t[2]===r.needToken?i=t[3]:(i=(0,K.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.needToken}),t[2]=r.needToken,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,K.jsxs)(K.Fragment,{children:[e,i]}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}let k=p.total+m.total,A=p.enabled+m.enabled,j=p.total+m.total-p.enabled-m.enabled,M;t[7]!==k||t[8]!==A||t[9]!==j||t[10]!==m.total?(M={total:k,ready:A,needsAttention:j,added:m.total},t[7]=k,t[8]=A,t[9]=j,t[10]=m.total,t[11]=M):M=t[11];let N=M,F;t[12]!==N.total||t[13]!==r.tabInstalled?(F={id:`installed`,label:r.tabInstalled,count:N.total},t[12]=N.total,t[13]=r.tabInstalled,t[14]=F):F=t[14];let I;t[15]===r.tabDiscover?I=t[16]:(I={id:`marketplace`,label:r.tabDiscover},t[15]=r.tabDiscover,t[16]=I);let L;t[17]!==F||t[18]!==I?(L=[F,I],t[17]=F,t[18]=I,t[19]=L):L=t[19];let R=L,z;t[20]===S?z=t[21]:(z=[`all`,...S.map(He)],t[20]=S,t[21]=z);let B=z,V;t[22]!==O||t[23]!==D||t[24]!==S||t[25]!==r.marketplaceLoadFailed||t[26]!==r.marketplaceResultsTabAll||t[27]!==B?(V=B.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:S.find(t=>t.id===e)?.displayName??e,n=D[e]??0,i=e===`all`?null:O[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,K.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,K.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,K.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[22]=O,t[23]=D,t[24]=S,t[25]=r.marketplaceLoadFailed,t[26]=r.marketplaceResultsTabAll,t[27]=B,t[28]=V):V=t[28];let H=V,ee;t[29]===n?ee=t[30]:(ee=(0,K.jsx)(Ue,{vm:n}),t[29]=n,t[30]=ee);let U;t[31]!==o||t[32]!==a?(U=o?(0,K.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:l(`rounded-xl border px-3 py-2 text-sm`,o.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:o.message}):a?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:a}):null,t[31]=o,t[32]=a,t[33]=U):U=t[33];let te;t[34]!==r.diagnosticsHint||t[35]!==r.diagnosticsTitle||t[36]!==s?(te=s.length>0?(0,K.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,K.jsx)(`div`,{className:`font-medium`,children:he(r.diagnosticsTitle,{count:s.length})}),(0,K.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:r.diagnosticsHint}),(0,K.jsx)(`ul`,{className:`mt-1 space-y-1`,children:s.slice(0,3).map(Ve)})]}):null,t[34]=r.diagnosticsHint,t[35]=r.diagnosticsTitle,t[36]=s,t[37]=te):te=t[37];let G;t[38]!==C||t[39]!==n.loading||t[40]!==n.mainTab||t[41]!==n.onReloadClick||t[42]!==n.searchQuery||t[43]!==n.setInstallOpen||t[44]!==n.setPendingFile||t[45]!==n.setSearchQuery||t[46]!==n.sk?(G=C?(0,K.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,K.jsx)(re,{loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[38]=C,t[39]=n.loading,t[40]=n.mainTab,t[41]=n.onReloadClick,t[42]=n.searchQuery,t[43]=n.setInstallOpen,t[44]=n.setPendingFile,t[45]=n.setSearchQuery,t[46]=n.sk,t[47]=G):G=t[47];let q;t[48]!==c||t[49]!==R||t[50]!==u||t[51]!==r.skillsNavAria?(q=(0,K.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,K.jsx)(W,{items:R,activeTab:c,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[48]=c,t[49]=R,t[50]=u,t[51]=r.skillsNavAria,t[52]=q):q=t[52];let J;t[53]!==h||t[54]!==g||t[55]!==N.added||t[56]!==N.needsAttention||t[57]!==N.ready||t[58]!==c||t[59]!==b||t[60]!==v||t[61]!==S||t[62]!==T||t[63]!==H||t[64]!==w||t[65]!==_||t[66]!==x||t[67]!==y||t[68]!==E||t[69]!==f||t[70]!==r.discoverHeading||t[71]!==r.discoverHint||t[72]!==r.filterAll||t[73]!==r.filterDisabledOnly||t[74]!==r.filterEnabled||t[75]!==r.filterExtra||t[76]!==r.filterGlobal||t[77]!==r.filterInstalled||t[78]!==r.filterWorkspace||t[79]!==r.installedHeading||t[80]!==r.installedHint||t[81]!==r.marketplaceBrowseSwitchAria||t[82]!==r.marketplaceResultsTabsAria||t[83]!==r.marketplaceSortDownloads||t[84]!==r.marketplaceSortLabel||t[85]!==r.marketplaceSortNewest||t[86]!==r.sourceFilterAria||t[87]!==r.statusFilterAria||t[88]!==r.summaryAdded||t[89]!==r.summaryNeedsAttention||t[90]!==r.summaryReady||t[91]!==r.tabBuiltin||t[92]!==d?(J=c===`installed`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.installedHeading}),(0,K.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.installedHint})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[(0,K.jsx)(P,{value:d,placeholder:r.filterAll,ariaLabel:r.sourceFilterAria,options:[{value:`all`,label:r.filterAll},{value:`builtin`,label:r.tabBuiltin},{value:`installed`,label:r.filterInstalled},{value:`workspace`,label:r.filterWorkspace},{value:`global`,label:r.filterGlobal},{value:`extra`,label:r.filterExtra}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>f(e)}),(0,K.jsx)(P,{value:g,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:he(r.filterDisabledOnly,{count:h})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>_(e)})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,"aria-label":r.installedHeading,children:[(0,K.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`enabled`&&`border-emerald-500/40 bg-emerald-500/5`),"aria-pressed":g===`enabled`,onClick:()=>_(Be),children:[(0,K.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:N.ready}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryReady})]}),(0,K.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`disabled`&&`border-amber-500/50 bg-amber-500/5`),"aria-pressed":g===`disabled`,onClick:()=>_($),children:[(0,K.jsx)(`div`,{className:l(`text-xl font-semibold tabular-nums`,N.needsAttention>0?`text-warning`:`text-fg`),children:N.needsAttention}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryNeedsAttention})]}),(0,K.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,d===`installed`&&`border-accent/40 bg-accent/5`),"aria-pressed":d===`installed`,onClick:()=>f(ze),children:[(0,K.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:N.added}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryAdded})]})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.discoverHeading}),(0,K.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.discoverHint})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[w?null:(0,K.jsx)(P,{value:b??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:S.map(Re),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:x}),(0,K.jsx)(P,{value:v,placeholder:r.marketplaceSortLabel,ariaLabel:r.marketplaceSortLabel,options:[{value:`downloads`,label:r.marketplaceSortDownloads},{value:`newest`,label:r.marketplaceSortNewest}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>y(e)})]})]}),w?(0,K.jsx)(W,{items:H,activeTab:T,onChange:E,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`min-h-9 gap-1 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):null]}),t[53]=h,t[54]=g,t[55]=N.added,t[56]=N.needsAttention,t[57]=N.ready,t[58]=c,t[59]=b,t[60]=v,t[61]=S,t[62]=T,t[63]=H,t[64]=w,t[65]=_,t[66]=x,t[67]=y,t[68]=E,t[69]=f,t[70]=r.discoverHeading,t[71]=r.discoverHint,t[72]=r.filterAll,t[73]=r.filterDisabledOnly,t[74]=r.filterEnabled,t[75]=r.filterExtra,t[76]=r.filterGlobal,t[77]=r.filterInstalled,t[78]=r.filterWorkspace,t[79]=r.installedHeading,t[80]=r.installedHint,t[81]=r.marketplaceBrowseSwitchAria,t[82]=r.marketplaceResultsTabsAria,t[83]=r.marketplaceSortDownloads,t[84]=r.marketplaceSortLabel,t[85]=r.marketplaceSortNewest,t[86]=r.sourceFilterAria,t[87]=r.statusFilterAria,t[88]=r.summaryAdded,t[89]=r.summaryNeedsAttention,t[90]=r.summaryReady,t[91]=r.tabBuiltin,t[92]=d,t[93]=J):J=t[93];let Y;t[94]!==c||t[95]!==n?(Y=c===`marketplace`?(0,K.jsx)(Me,{...n}):(0,K.jsx)(ce,{...n}),t[94]=c,t[95]=n,t[96]=Y):Y=t[96];let X;t[97]!==q||t[98]!==J||t[99]!==Y?(X=(0,K.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[q,J,Y]}),t[97]=q,t[98]=J,t[99]=Y,t[100]=X):X=t[100];let Z;t[101]!==U||t[102]!==te||t[103]!==G||t[104]!==X?(Z=(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[U,te,G,X]}),t[101]=U,t[102]=te,t[103]=G,t[104]=X,t[105]=Z):Z=t[105];let ie,ae,oe;t[106]===n?(ie=t[107],ae=t[108],oe=t[109]):(ie=(0,K.jsx)(ke,{...n}),ae=(0,K.jsx)(je,{...n}),oe=(0,K.jsx)(ve,{...n}),t[106]=n,t[107]=ie,t[108]=ae,t[109]=oe);let se;t[110]!==Z||t[111]!==ie||t[112]!==ae||t[113]!==oe?(se=(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[Z,ie,ae,oe]}),t[110]=Z,t[111]=ie,t[112]=ae,t[113]=oe,t[114]=se):se=t[114];let le;return t[115]!==ee||t[116]!==se?(le=(0,K.jsxs)(K.Fragment,{children:[ee,se]}),t[115]=ee,t[116]=se,t[117]=le):le=t[117],le}function Re(e){return{value:e.id,label:e.displayName}}function ze(e){return e===`installed`?`all`:`installed`}function $(e){return e===`disabled`?`all`:`disabled`}function Be(e){return e===`enabled`?`all`:`enabled`}function Ve(e,t){return(0,K.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function He(e){return e.id}function Ue(e){let t=(0,ne.c)(17),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=A(Ge),m=A(We),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r?(h=(0,K.jsx)(re,{loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=h):h=t[8];let g=h,_,v;return t[9]!==m||t[10]!==i||t[11]!==f||t[12]!==p||t[13]!==r.title||t[14]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[9]=m,t[10]=i,t[11]=f,t[12]=p,t[13]=r.title,t[14]=g,t[15]=_,t[16]=v):(_=t[15],v=t[16]),(0,G.useLayoutEffect)(_,v),null}function We(e){return e.clearPageHeader}function Ge(e){return e.setPageHeader}async function Ke(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`workspace`);let r=d.getState().token,i=new Headers;r&&i.set(`Authorization`,`Bearer ${r}`);let a=await fetch(m(`/api/skills/upload`),{method:`POST`,headers:i,body:n});a.status===401&&d.getState().onUnauthorized();let o=await a.json().catch(()=>({}));if(!a.ok)throw Error(o.error||`HTTP ${a.status}`);if(!o.payload?.skillId)throw Error(`Invalid response`);return o.payload}async function qe(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await p(m(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await w(r))}async function Je(e,t){let n=await p(m(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await w(n))}function Ye(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function Xe(e){let t=new URLSearchParams;Ye(t,e?.provider);let n=t.toString(),r=await p(m(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await w(r));let i=await r.json();if(!i.payload||!Array.isArray(i.payload.items))throw Error(`Invalid response`);return{items:i.payload.items}}async function Ze(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),Ye(t,e.provider);let n=t.toString(),r=await p(m(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await w(r));let i=await r.json();if(!i.payload?.items||!i.payload.meta)throw Error(`Invalid response`);return i.payload}async function Qe(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;Ye(r,t?.provider);let i=r.toString(),a=await p(m(`/api/skills/marketplace/packages/${n}${i?`?${i}`:``}`),{cache:`no-store`});if(!a.ok)throw Error(await w(a));let o=(await a.json()).payload;if(!o?.name||!o.skillDocPreview||typeof o.skillDocPreview.name!=`string`||typeof o.skillDocPreview.description!=`string`||typeof o.skillDocPreview.bodyMarkdown!=`string`||typeof o.skillDocPreview.disableModelInvocation!=`boolean`||!o.skillDocPreview.metadata||typeof o.skillDocPreview.metadata!=`object`||typeof o.skillDocPreview.metadata.name!=`string`||typeof o.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return o}async function $e(e){let t=await p(m(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`workspace`,...e})});if(!t.ok)throw Error(await w(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function et(e){let t=await p(m(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await w(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function tt(){let e=await p(m(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await w(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function nt(){let e=await p(m(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await w(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}async function rt(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function it(){let e=u(f(e=>e.language)).skills,t=!!d(e=>e.token),n=s(),[r,i]=o(),c=r.get(`mprov`)?.trim()||null,[l,p]=(0,G.useState)(!1),[m,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(!1),b=r.get(`q`)??``,x=r.get(`tab`),S=r.get(`source`),C=r.get(`status`),w=X.has(x)?x:`installed`,T=x===`builtin`?`builtin`:x===`user`?`installed`:null,E=Z.has(S)?S:T??`all`,D=ie.has(C)?C:`all`,[O,k]=(0,G.useState)(b),[A]=g(O,250),j=A.trim(),M=O.trim().length>0,N=j.length>0,[P,F]=(0,G.useState)(null),[I,R]=(0,G.useState)(w),[z,B]=(0,G.useState)(E),[V,ee]=(0,G.useState)(``),[U,W]=(0,G.useState)(D),[ne,K]=(0,G.useState)(!1),[re,q]=(0,G.useState)(null),[J,Y]=(0,G.useState)(!1),[oe,ce]=(0,G.useState)(!1),[le,ue]=(0,G.useState)(null),[de,fe]=(0,G.useState)(null),[Q,me]=(0,G.useState)({}),[he,ge]=(0,G.useState)(!1),[ve,ye]=(0,G.useState)(`catalog`),[be,xe]=(0,G.useState)(``),[Se,Ce]=(0,G.useState)(null),[we,Te]=(0,G.useState)(null),[Ee,De]=(0,G.useState)(!1),[Oe,ke]=(0,G.useState)(null),[Ae,je]=(0,G.useState)(`downloads`),[Me,Ne]=(0,G.useState)(1),[Pe,Fe]=(0,G.useState)(null),[Ie,Le]=(0,G.useState)(null),[Re,ze]=(0,G.useState)(``),[$,Be]=(0,G.useState)(()=>c),[Ve,He]=(0,G.useState)(0),[Ue,We]=(0,G.useState)(0),[Ge,Ye]=(0,G.useState)([]),it=(0,G.useRef)(null),at=(0,G.useRef)(c),ot=(0,G.useRef)(null),st=(0,G.useRef)(``),ct=(0,G.useRef)(null),lt=(0,G.useRef)(!1),[ut,dt]=(0,G.useState)({query:``,byProvider:{}}),[ft,pt]=(0,G.useState)(`all`),mt=(0,G.useRef)(0),ht=(0,G.useRef)(j);ht.current!==j&&(ht.current=j,pt(e=>e===`all`?e:`all`));let gt=H(()=>L().then(e=>(Ye(e.diagnostics??[]),e.catalog.map(_e))),[t,Ue],{enabled:t,initial:[],errorData:[]}),{data:_t,loading:vt,setData:yt}=gt,bt=H(async()=>{try{let{providers:e,current:t}=await nt();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await tt()).provider}}catch{return{providers:[],current:`store`}}}},[t,Ve],{enabled:t,initial:{providers:[],current:null}}),xt=l||vt,St=bt.data.providers;(0,G.useEffect)(()=>{let e=e=>{if(h(e.detail)===`skills`){if(lt.current){lt.current=!1;return}We(e=>e+1)}else He(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let Ct=r.toString(),wt=(0,G.useRef)(Ct);if(wt.current!==Ct){wt.current=Ct;let e=r.get(`q`)??``,t=r.get(`tab`),n=r.get(`source`),i=r.get(`status`),a=X.has(t)?t:`installed`,o=t===`builtin`?`builtin`:t===`user`?`installed`:null,s=Z.has(n)?n:o??`all`,c=ie.has(i)?i:`all`;k(t=>t===e?t:e),R(e=>e===a?e:a),B(e=>e===s?e:s),W(e=>e===c?e:c);let l=r.get(`mcat`)??``;ze(a===`marketplace`?e=>e===l?e:l:``)}let Tt=(0,G.useRef)(t);!t&&Tt.current&&(Be(null),it.current=null),Tt.current=t,t&&c&&at.current!==c&&(at.current=c,Be(c)),t&&c==null&&bt.data.current&&bt.data.current!==ot.current&&(ot.current=bt.data.current,Be(e=>e??bt.data.current));let Et=`${j}|${Ae}|${I}|${Re}|${$??``}|${ft}`;st.current!==Et&&(st.current=Et,Ne(1)),I===`marketplace`&&$&&ct.current!=null&&ct.current!==$&&ze(``),ct.current=$;let Dt=H(()=>Ze({page:Me,pageSize:20,sort:Ae,category:Re.trim()||void 0,provider:$}),[t,I,Re,Me,Ae,N,$],{enabled:t&&I===`marketplace`&&!!$&&!N,initial:null,errorData:null});(0,G.useEffect)(()=>{if(!t||!N||I!==`marketplace`||St.length===0)return;let n=++mt.current,r={};for(let e of St)r[e.id]={status:`loading`,rows:[]};dt({query:j,byProvider:r});let i=[],a=[];for(let t of St){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),Ze({provider:t.id,q:j,page:1,pageSize:40,sort:Ae,signal:r.signal}).then(e=>{if(window.clearTimeout(o),n!==mt.current)return;let r=e.items.map(e=>({...e,providerId:t.id}));dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),n!==mt.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?e.marketplaceLoadFailed:r instanceof Error?r.message:e.marketplaceLoadFailed;dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[t,I,N,j,St,Ae,e.marketplaceLoadFailed]);let Ot=H(()=>Xe({provider:$}).then(e=>e.items),[t,I,$],{enabled:t&&I===`marketplace`&&!!$,initial:[],errorData:[]}),kt=(0,G.useMemo)(()=>{if(!N||ut.query!==j)return[];let e=St.map(e=>({id:e.id,rows:[...ut.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[N,j,ut,St]),At=(0,G.useMemo)(()=>{if(!N)return{};let e={all:kt.length};for(let t of St)e[t.id]=kt.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[N,kt,St]),jt=(0,G.useMemo)(()=>N?ft===`all`?kt:kt.filter(e=>e.providerId===ft||(e.additionalSources??[]).some(e=>e.providerId===ft)):[],[N,kt,ft]),Mt=(0,G.useMemo)(()=>{if(!N)return{};let e={};for(let t of St)e[t.id]=ut.byProvider[t.id]?.status??`loading`;return e},[N,ut,St]),Nt=(0,G.useMemo)(()=>Object.values(Mt).some(e=>e===`loading`),[Mt]),Pt=(0,G.useMemo)(()=>{if(!N)return!1;let e=Object.values(Mt);return e.length>0&&e.every(e=>e===`error`)},[N,Mt]),Ft=(0,G.useMemo)(()=>{if(!N||kt.length===0&&Nt)return null;let e=jt.length,t=(Me-1)*20;return{items:jt.slice(t,t+20),meta:{page:Me,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:ft}},[N,kt,Nt,jt,Me,ft]),It=I===`marketplace`?M?N?Ft:null:Dt.data:null,Lt=I===`marketplace`?M?N?Nt:!0:Dt.loading:!1,Rt=N?Pt?e.marketplaceLoadFailed:null:Dt.error instanceof Error?Dt.error.message:Dt.error?e.marketplaceLoadFailed:null,zt=I===`marketplace`?Ot.data:[],Bt=I===`marketplace`?Ot.loading:!1,Vt=Ot.error instanceof Error?Ot.error.message:Ot.error?e.marketplaceCategoriesFailed:null;Re.trim()&&zt.length>0&&!zt.some(e=>e.id===Re)&&ze(``);let Ht=(0,G.useCallback)(async t=>{let n=t?.silent===!0;n||p(!0),_(null);try{let e=await L();return Ye(e.diagnostics??[]),yt(e.catalog.map(_e)),{ok:!0}}catch(t){let n=t instanceof Error?t.message:e.loadFailed;return _(n),{ok:!1,message:n}}finally{n||p(!1)}},[yt,e.loadFailed]),Ut=!l&>.error?gt.error instanceof Error?gt.error.message:e.loadFailed:null,Wt=m??Ut;(0,G.useEffect)(()=>{i(e=>{let t=new URLSearchParams(e);return j?t.set(`q`,j):t.delete(`q`),I===`marketplace`?t.set(`tab`,I):t.delete(`tab`),z===`all`?t.delete(`source`):t.set(`source`,z),I===`installed`&&U!==`all`?t.set(`status`,U):t.delete(`status`),I===`marketplace`&&Re.trim()?t.set(`mcat`,Re.trim()):t.delete(`mcat`),I===`marketplace`&&$?t.set(ae,$):t.delete(ae),t.toString()===e.toString()?e:t},{replace:!0})},[I,Re,$,j,U,i,z]);let Gt=(0,G.useCallback)((e,t,n=5e3)=>{F({kind:e,message:t}),window.setTimeout(()=>F(null),n)},[]),Kt=(0,G.useCallback)(t=>{let n=t.availability;if(!n)return e.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[e.installSuccess]),qt=(0,G.useCallback)(async t=>{ye(`catalog`),ge(!0),xe(t.name),Ce(null),Te(null),ke(null),De(!0);try{let e=await et(t.name);Ce(e),xe(e.name)}catch(t){Ce(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}},[e.detailLoadFailed]),Jt=(0,G.useCallback)(async t=>{let n=t.trim();if(n){ye(`catalog`),ge(!0),xe(n),Ce(null),Te(null),ke(null),De(!0);try{let e=await et(n);Ce(e),xe(e.name)}catch(t){Ce(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}}},[e.detailLoadFailed]),Yt=(0,G.useCallback)(async(t,n,r)=>{let i=r?.trim()||$;if(i){it.current=i,ye(`store`),ge(!0),xe(n?.trim()||t),Ce(null),Te(null),ke(null),De(!0);try{let e=await Qe(t,{provider:i});xe(e.name),Te(e.skillDocPreview)}catch(t){Te(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}}},[$,e.detailLoadFailed]),Xt=(0,G.useCallback)(async(t,n)=>{fe(t),me(e=>({...e,[t]:n})),F(null);try{return await Je(t,n),await Ht({silent:!0}),!0}catch(n){return me(e=>{let{[t]:n,...r}=e;return r}),Gt(`error`,n instanceof Error?n.message:e.skillToggleFailed),!1}finally{fe(null),me(e=>{let{[t]:n,...r}=e;return r})}},[Ht,Gt,e.skillToggleFailed]),Zt=(0,G.useCallback)(async()=>{F(null),p(!0),_(null);try{await te()}catch(t){_(t instanceof Error?t.message:e.reloadFailed),p(!1);return}await Ht()},[Ht,e.reloadFailed]),Qt=(0,G.useMemo)(()=>{let e=O.trim().toLowerCase();return e?_t.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):_t},[_t,O]),$t=(0,G.useMemo)(()=>{let e=_t.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>Q[e.name]??e.enabled).length}},[_t,Q]),en=(0,G.useMemo)(()=>{let e=_t.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>Q[e.name]??e.enabled).length}},[_t,Q]),tn=(0,G.useMemo)(()=>be?_t.find(e=>e.name===be):void 0,[_t,be]),nn=tn==null?!0:Q[be]??tn.enabled,rn=tn?.directoryId??null,an=tn?.managed??!1,on=(0,G.useMemo)(()=>ve!==`store`||!be?null:pe(it.current??$,be),[ve,be,$]),sn=(0,G.useMemo)(()=>{let e=Qt;return I===`installed`&&z!==`all`&&(e=z===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===z)),e},[Qt,I,z]),cn=(0,G.useMemo)(()=>{let e=new Set,t=[];for(let n of sn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=se.indexOf(e),r=se.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[sn]),ln=(0,G.useCallback)(t=>e.categoryLabel?.[t]||t,[e.categoryLabel]),un=(0,G.useMemo)(()=>V?sn.filter(e=>e.category===V):sn,[sn,V]);(0,G.useEffect)(()=>{ee(``)},[z]);let dn=(0,G.useCallback)(e=>Q[e.name]??e.enabled,[Q]),fn=(0,G.useMemo)(()=>un.filter(e=>!dn(e)).length,[un,dn]),pn=(0,G.useMemo)(()=>{let e=un;return U===`disabled`&&(e=e.filter(e=>!dn(e))),U===`enabled`&&(e=e.filter(e=>dn(e))),[...e].toSorted((e,t)=>{let n=dn(e);return n===dn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[un,U,dn]),mn=async t=>{F(null),y(!0),_(null);try{let n;try{n=await rt(t)}catch{_(e.invalidFile),Gt(`error`,e.invalidFile);return}let r=await Ke(n,{overwrite:!0});lt.current=!0,await Ht(),Gt(`success`,Kt(r)),K(!1),q(null),R(`installed`),B(`installed`),await Jt(r.availability?.skillName||r.skillId)}catch(t){_(t instanceof Error?t.message:e.uploadFailed),Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{y(!1)}},hn=()=>{re&&mn(re)},gn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&q(t)},_n=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(Y(!0),e.dataTransfer.dropEffect=`copy`)},vn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||Y(!1)},yn=e=>{e.preventDefault(),e.stopPropagation(),Y(!1);let t=e.dataTransfer?.files?.[0];t&&q(t)},bn=t=>{switch(t){case`builtin`:return e.source.builtin;case`workspace`:return e.source.workspace;case`global`:return e.source.global;case`extra`:return e.source.extra;default:return t}},xn=async()=>{let t=le,n=he&&ve===`catalog`&&rn===t;if(ce(!1),ue(null),t){F(null);try{await qe(t),lt.current=!0,await Ht(),n&&(ge(!1),ye(`catalog`),xe(``),Ce(null),Te(null),ke(null))}catch(t){_(t instanceof Error?t.message:e.deleteFailed)}}},Sn=(0,G.useCallback)(e=>_t.some(t=>t.name===e),[_t]),Cn=(0,G.useCallback)(async t=>{let r=(t?.name??be).trim();if(!r)return;let i=t?.source??ve;if(i===`catalog`){let e=_t.find(e=>e.name===r);if(e&&!(Q[e.name]??e.enabled))return}F(null);let a=i===`store`&&!Sn(r);Le(r);try{if(a){let e=t?.providerOverride?.trim()||it.current||$;await $e({name:r,overwrite:!1,...e?{provider:e}:{}}),lt.current=!0,await Ht({silent:!0})}ge(!1),n(`/chat/new?skill=${encodeURIComponent(r)}`)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Le(null)}},[_t,be,ve,Q,Sn,Ht,n,Gt,e.uploadFailed,$]),wn=(0,G.useCallback)(async(t,n)=>{let r=Sn(t);if(!(r&&!window.confirm(e.marketplaceReinstallConfirm))){F(null),Fe(t);try{let e=n?.providerOverride?.trim()||(n?.useDetailProvider?it.current??$:$),i=await $e({name:t,overwrite:r,...e?{provider:e}:{}});lt.current=!0,await Ht({silent:!0}),Gt(`success`,Kt(i)),R(`installed`),B(`installed`),await Jt(i.availability?.skillName||i.skillId||t)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Fe(null)}}},[Sn,Kt,Ht,$,Jt,Gt,e.marketplaceReinstallConfirm,e.uploadFailed]),{pathname:Tn}=a();return{sk:e,hasToken:t,catalog:_t,loading:xt,error:Wt,uploading:v,searchQuery:O,setSearchQuery:k,actionFeedback:P,skillDiagnostics:Ge,mainTab:I,setMainTab:R,sourceFilter:z,setSourceFilter:B,builtinCategoryFilter:V,setBuiltinCategoryFilter:ee,installOpen:ne,setInstallOpen:K,pendingFile:re,setPendingFile:q,dropActive:J,setDropActive:Y,confirmOpen:oe,setConfirmOpen:ce,confirmId:le,setConfirmId:ue,togglingSkillName:de,enabledOverride:Q,detailOpen:he,setDetailOpen:ge,detailSource:ve,setDetailSource:ye,detailTitle:be,setDetailTitle:xe,detailCatalogPreview:Se,setDetailCatalogPreview:Ce,detailMarketplacePreview:we,setDetailMarketplacePreview:Te,detailLoading:Ee,detailError:Oe,setDetailError:ke,marketSort:Ae,setMarketSort:je,marketPage:Me,setMarketPage:Ne,mpLoading:Lt,mpError:Rt,mpPayload:It,searchActive:N,searchInputActive:M,resultTab:ft,setResultTab:pt,aggregatedTabCounts:At,aggregatedProviderStatus:Mt,aggregatedAllFailed:Pt,installingMarketName:Pe,usingSkillInChatName:Ie,onUseSkillInChat:Cn,marketCategoryId:Re,setMarketCategoryId:ze,mpCategories:zt,mpCategoriesError:Vt,mpCategoriesLoading:Bt,marketBrowseProvider:$,setMarketBrowseProvider:Be,registeredProviders:St,builtinTabStats:$t,userTabStats:en,detailEnabled:nn,detailDirectoryId:rn,detailManaged:an,detailExternalUrl:on,filteredCatalog:sn,builtinCategories:cn,categoryFilteredCatalog:un,catalogDisplayRows:pn,catalogDisabledCount:fn,catalogStatusFilter:U,setCatalogStatusFilter:W,resolveSkillEnabled:dn,inSettingsShell:Tn.startsWith(`/settings/`),categoryLabel:ln,onReloadClick:Zt,openSkillDetail:qt,openMarketplaceDetail:Yt,onSkillToggle:Xt,onInstallSubmit:hn,onFileInputChange:gn,onModalDragOver:_n,onModalDragLeave:vn,onModalDrop:yn,sourceLabel:bn,runDelete:xn,onMarketInstall:wn,isSkillInstalledByName:Sn}}function at(){let e=(0,ne.c)(2),t=it(),n;return e[0]===t?n=e[1]:(n=(0,K.jsx)(Le,{vm:t}),e[0]=t,e[1]=n),n}export{at as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-CxySDn9d.js";import{n as a}from"./locale-store-Dar-xqQr.js";import{Fl as o,Go as s,Nt as c,di as l,fi as u,gs as d,hc as f,tc as p}from"./index-vq_cJZJC.js";import{n as m,r as h}from"./settings-page-layout-DWvNgISx.js";import{r as g,t as _}from"./settings-form-section-CNqF6IwY.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(c,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{s()&&R&&z()},[R,z]),!s()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&l()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(p,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,d.press),onClick:()=>void B(),children:[(0,y.jsx)(f,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),s=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return s?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,d.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,d.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,d.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,d.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,d.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(o,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-BwQ3WssU.js";import{n as a}from"./locale-store-0lpYdNDr.js";import{Go as o,Ll as s,Nt as c,_c as l,mi as u,pi as d,rc as f,vs as p}from"./index-C8JkTS6d.js";import{n as m,r as h}from"./settings-page-layout-D3srt5Bi.js";import{r as g,t as _}from"./settings-form-section-CARTHCxH.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(c,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{o()&&R&&z()},[R,z]),!o()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&d()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(f,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,p.press),onClick:()=>void B(),children:[(0,y.jsx)(l,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,p.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(s,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-0lpYdNDr.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-JdwAhgNB.js";import{
|
|
1
|
+
import{t as e}from"./cn-JdwAhgNB.js";import{Cs as t,Ss as n,xs as r}from"./index-C8JkTS6d.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(n,r)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./vendor-react-BOUWij0V.js";import{r as t,s as n}from"./locale-store-
|
|
1
|
+
import{n as e}from"./vendor-react-BOUWij0V.js";import{r as t,s as n}from"./locale-store-0lpYdNDr.js";import{i as r}from"./vendor-swr-BIWyz7Rc.js";var i=e();function a(e){return t(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function o(e){return(await n(a(e))).payload?.channels??[]}function s(e,t){let n=(0,i.c)(14),s;n[0]!==e||n[1]!==t?(s=e?a(t):null,n[0]=e,n[1]=t,n[2]=s):s=n[2];let c;n[3]===t?c=n[4]:(c=()=>o(t),n[3]=t,n[4]=c);let l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={revalidateOnFocus:!1},n[5]=l):l=n[5];let{data:u,error:d,isLoading:f,isValidating:p,mutate:m}=r(s,c,l),h;n[6]===u?h=n[7]:(h=u??[],n[6]=u,n[7]=h);let g;return n[8]!==d||n[9]!==f||n[10]!==p||n[11]!==m||n[12]!==h?(g={entries:h,isLoading:f,isValidating:p,error:d,mutate:m},n[8]=d,n[9]=f,n[10]=p,n[11]=m,n[12]=h,n[13]=g):g=n[13],g}export{s as t};
|
|
@@ -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}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-BwQ3WssU.js";import{n as l}from"./locale-store-0lpYdNDr.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$t as d,Ac as f,Bo as p,Bs as m,Ds as h,Gt as g,Hl as _,Ho as v,Is as y,Jt as b,Ko as x,Kt as S,Ls as C,Ms as w,Qa as T,Qt as E,Ro as D,Uo as O,Vl as k,Vo as A,Wo as j,Ws as M,Wt as N,Xn as P,Xt as F,Yt as I,Zt as L,_n as R,an as z,as as B,bo as V,cn as H,cu as U,dn as W,ec as G,en as ee,et as te,fn as ne,gl as re,gn as K,ic as ie,in as ae,ln as oe,mn as se,mu as ce,nn as le,on as ue,os as de,qt as fe,rl as pe,rn as me,rs as q,ru as he,sn as ge,tn as _e,ts as ve,tu as ye,un as be,vl as xe,vs as Se,wc as Ce,ws as J,yu as we,zo as Te}from"./index-C8JkTS6d.js";import{t as Ee}from"./page-tabs-Caj1-E_X.js";import{t as De}from"./connector-logo-Bng6kxYF.js";var Y=n(),X=e(t(),1),Z=r();function Oe(e){let t=(0,Y.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,c;t[0]===n.timezone?c=t[1]:(c=()=>K.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=c);let[l,u]=(0,X.useState)(c),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!K.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=d);let[f,p]=(0,X.useState)(d),m;t[4]===n.pronouns?m=t[5]:(m=()=>!!n.pronouns&&!se.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=m);let[h,g]=(0,X.useState)(m),_;bb0:{if(f){_=`__custom__`;break bb0}_=K.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,Z.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,Z.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,Z.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,Z.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),se.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 A;t[28]===i.pronounsPlaceholder?A=t[29]:(A=(0,Z.jsx)(q,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=A);let j;t[30]===S?j=t[31]:(j=se.map(e=>(0,Z.jsx)(q,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[30]=S,t[31]=j);let M;t[32]===i.custom?M=t[33]:(M=(0,Z.jsx)(q,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=M);let N;t[34]!==o||t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==j||t[39]!==M?(N=(0,Z.jsxs)(ve,{className:o,value:O,onChange:k,children:[A,j,M]}),t[34]=o,t[35]=O,t[36]=k,t[37]=A,t[38]=j,t[39]=M,t[40]=N):N=t[40];let P;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==h||t[44]!==b||t[45]!==n.pronouns?(P=h?(0,Z.jsx)(`input`,{className:s(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]=P):P=t[46];let F;t[47]!==D||t[48]!==N||t[49]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[D,N,P]}),t[47]=D,t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]===i.timezone?I=t[52]:(I=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=I);let L;t[53]===o?L=t[54]:(L=s(o,`min-w-0 flex-1`),t[53]=o,t[54]=L);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=K.map(e=>(0,Z.jsx)(q,{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,Z.jsx)(q,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=V);let H;t[61]!==L||t[62]!==z||t[63]!==B||t[64]!==V||t[65]!==v?(H=(0,Z.jsxs)(ve,{className:L,value:v,onChange:z,children:[B,V]}),t[61]=L,t[62]=z,t[63]=B,t[64]=V,t[65]=v,t[66]=H):H=t[66];let U;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(U=s(`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`,Se.press),t[67]=U):U=t[67];let W;t[68]===b?W=t[69]:(W=()=>{let e=R();if(!e)return;let t=K.some(t=>t.value===e);p(!t),u(t?``:e),b({timezone:e})},t[68]=b,t[69]=W);let G;t[70]!==i.timezoneDetect||t[71]!==W?(G=(0,Z.jsx)(`button`,{type:`button`,className:U,onClick:W,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=W,t[72]=G):G=t[72];let ee;t[73]!==H||t[74]!==G?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[H,G]}),t[73]=H,t[74]=G,t[75]=ee):ee=t[75];let te;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==b?(te=f?(0,Z.jsx)(`input`,{className:s(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]=te):te=t[80];let ne;t[81]!==I||t[82]!==ee||t[83]!==te?(ne=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[I,ee,te]}),t[81]=I,t[82]=ee,t[83]=te,t[84]=ne):ne=t[84];let re;t[85]===i.notes?re=t[86]:(re=(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=re);let ie;t[87]===o?ie=t[88]:(ie=s(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=ie);let ae;t[89]===b?ae=t[90]:(ae=e=>b({notes:e.target.value}),t[89]=b,t[90]=ae);let oe;t[91]!==i.notesPlaceholder||t[92]!==ie||t[93]!==ae||t[94]!==n.notes?(oe=(0,Z.jsx)(`textarea`,{className:ie,value:n.notes,onChange:ae,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=ie,t[93]=ae,t[94]=n.notes,t[95]=oe):oe=t[95];let ce;t[96]!==re||t[97]!==oe?(ce=(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[re,oe]}),t[96]=re,t[97]=oe,t[98]=ce):ce=t[98];let le;return t[99]!==E||t[100]!==F||t[101]!==ne||t[102]!==ce?(le=(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[E,F,ne,ce]}),t[99]=E,t[100]=F,t[101]=ne,t[102]=ce,t[103]=le):le=t[103],le}var ke={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function Ae(e){if(e.branding?.logoUrl)return e.branding;let t=ke[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function je(e){let t=(0,Y.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:ce,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let c;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(c={icon:w,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=c):c=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:_,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:ie,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]!==c||t[14]!==l||t[15]!==u?(d=[o,c,l,u],t[12]=o,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(v,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,de)}),t[17]=m):m=t[17];let g;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=s(`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`,B,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=g):g=t[18];let y;t[19]===r.helpTitle?y=t[20]:(y=(0,Z.jsx)(j,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=y);let b;t[21]===r.helpSubtitle?b=t[22]:(b=(0,Z.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=b);let x;t[23]!==y||t[24]!==b?(x=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[y,b]}),t[23]=y,t[24]=b,t[25]=x):x=t[25];let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[26]=S):S=t[26];let C;t[27]===r.close?C=t[28]:(C=(0,Z.jsx)(Te,{asChild:!0,children:(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:S})}),t[27]=r.close,t[28]=C);let T;t[29]!==x||t[30]!==C?(T=(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[x,C]}),t[29]=x,t[30]=C,t[31]=T):T=t[31];let E;t[32]===f?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(Me)}),t[32]=f,t[33]=E);let k;t[34]!==a||t[35]!==i?(k=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=k):k=t[36];let M;t[37]!==r.tabs.sources||t[38]!==k?(M=(0,Z.jsx)(J,{type:`button`,variant:`ghost`,onClick:k,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=k,t[39]=M):M=t[39];let N;t[40]!==a||t[41]!==i?(N=()=>{i(!1),a(`controls`)},t[40]=a,t[41]=i,t[42]=N):N=t[42];let P;t[43]!==r.openPrivacyControls||t[44]!==N?(P=(0,Z.jsx)(J,{type:`button`,variant:`secondary`,onClick:N,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=N,t[45]=P):P=t[45];let F;t[46]!==M||t[47]!==P?(F=(0,Z.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[M,P]}),t[46]=M,t[47]=P,t[48]=F):F=t[48];let I;t[49]!==T||t[50]!==E||t[51]!==F?(I=(0,Z.jsxs)(O,{children:[m,(0,Z.jsxs)(p,{className:g,children:[T,E,F]})]}),t[49]=T,t[50]=E,t[51]=F,t[52]=I):I=t[52];let L;return t[53]!==i||t[54]!==n||t[55]!==I?(L=(0,Z.jsx)(D,{open:n,onOpenChange:i,children:I}),t[53]=i,t[54]=n,t[55]=I,t[56]=L):L=t[56],L}function Me(e){let{icon:t,title:n,body:r}=e;return(0,Z.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,Z.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}function Ne(e){let t=(0,Y.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,l=c(r).you,[u,d]=(0,X.useState)(!1),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?l.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),g,y;t[0]===n?(g=t[1],y=t[2]):(g=()=>{n&&d(!1)},y=[n],t[0]=n,t[1]=g,t[2]=y),(0,X.useEffect)(g,y);let b;t[3]!==i||t[4]!==a?(b=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=b):b=t[5];let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=x):x=t[6];let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[7]=S):S=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!1),t[8]=w):w=t[8];let T=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,E;t[9]===T?E=t[10]:(E=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,T),t[9]=T,t[10]=E);let k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(_,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=k):k=t[11];let M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>d(!0),t[12]=M):M=t[12];let N=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,P;t[13]===N?P=t[14]:(P=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,N),t[13]=N,t[14]=P);let F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=F):F=t[15];let I=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),L;t[16]===I?L=t[17]:(L=(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:I}),t[16]=I,t[17]=L);let R;t[18]!==i||t[19]!==l.cancel?(R=(0,Z.jsx)(Te,{asChild:!0,children:(0,Z.jsx)(J,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=R):R=t[20];let z=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,B;t[21]!==u||t[22]!==o?(B=()=>o(u),t[21]=u,t[22]=o,t[23]=B):B=t[23];let V;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t[24]=V):V=t[24];let H=i?l.disconnecting:l.disconnectAction,U;t[25]!==i||t[26]!==z||t[27]!==B||t[28]!==H?(U=(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,className:z,disabled:i,onClick:B,children:[V,H]}),t[25]=i,t[26]=z,t[27]=B,t[28]=H,t[29]=U):U=t[29];let W;return t[30]!==R||t[31]!==U?(W=(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[R,U]}),t[30]=R,t[31]=U,t[32]=W):W=t[32],(0,Z.jsx)(D,{open:n!==null,onOpenChange:b,children:(0,Z.jsxs)(O,{children:[x,(0,Z.jsxs)(p,{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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(j,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,Z.jsx)(A,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,Z.jsx)(Te,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:S})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:l.disconnectAccount.replace(`{{account}}`,f)}):null,(0,Z.jsx)(`p`,{children:l.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:w,className:E,children:[k,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:M,disabled:!n?.derivedUnderstandingCount,className:P,children:[F,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),L]})]})]}),W]})]})})}var Pe=new Set([`overview`,`profile`,`understanding`,`sources`,`controls`]),Fe=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],Ie=`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 Le(e,t){return e.replace(`{{count}}`,String(t))}function Re(e){let t=(0,Y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.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 ze(e,t){let n=Date.parse(e);return Number.isFinite(n)?te(n,t):e}function Be(e){return e===`review`?`understanding`:e===`privacy`?`controls`:e&&Pe.has(e)?e:`overview`}function Ve(){let e=(0,Y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(T,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,Z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,Z.jsx)(T,{className:`h-64 rounded-2xl`}),(0,Z.jsx)(T,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function He(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function Ue(e){let t=(0,Y.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:d}=e,[p,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(n.statement),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(!1),C=n.status!==`active`,w=C?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,T;t[0]===w?T=t[1]:(T=s(`rounded-xl border p-3.5`,w),t[0]=w,t[1]=T);let E;t[2]!==a||t[3]!==_||t[4]!==p||t[5]!==y||t[6]!==x||t[7]!==n||t[8]!==r||t[9]!==C||t[10]!==c||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(E=p?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`textarea`,{className:s(Ie,`min-h-20 resize-y`),value:_,onChange:e=>v(e.target.value),placeholder:i.updatePlaceholder}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{v(n.statement),g(!1)},children:i.cancel}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!_.trim(),onClick:()=>{u(_.trim()),g(!1)},children:i.save})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(G,{className:`size-3 text-accent`,"aria-hidden":!0}),He(n,i)]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>1?(0,Z.jsx)(`span`,{children:Le(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,Z.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,ze(n.latestEvidenceAt,r))}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[C?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,Z.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,Z.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>g(!0),children:[(0,Z.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:x,onClick:()=>{if(y){b(null);return}S(!0),L(n.id).then(e=>b(e.history)).finally(()=>S(!1))},children:[(0,Z.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,Z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,Z.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,Z.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ze(n.updatedAt,r)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Le(i.evidenceCount,n.evidenceCount)})]}),n.confidence===void 0?null:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,Z.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ze(n.validTo,r)})]}):null,n.expiresAt?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,Z.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ze(n.expiresAt,r)})]}):null]})]}),y?(0,Z.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),y.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,Z.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:ze(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=_,t[4]=p,t[5]=y,t[6]=x,t[7]=n,t[8]=r,t[9]=C,t[10]=c,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=E):E=t[15];let D;return t[16]!==T||t[17]!==E?(D=(0,Z.jsx)(`article`,{className:T,children:E}),t[16]=T,t[17]=E,t[18]=D):D=t[18],D}function We(e){let t=(0,Y.c)(84),{source:n,language:r,t:i,onConfigure:a,onDisconnect:o}=e,c=n.installed?n.enabled?i.connected:i.paused:i.available,l;t[0]!==n.accountCount||t[1]!==n.accountLabel||t[2]!==n.accountOrdinal||t[3]!==i.sourceAccountFallback?(l=n.accountLabel??(n.accountCount&&n.accountCount>1&&n.accountOrdinal?i.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),t[0]=n.accountCount,t[1]=n.accountLabel,t[2]=n.accountOrdinal,t[3]=i.sourceAccountFallback,t[4]=l):l=t[4];let u=l,d;t[5]!==n.lastHealthStatus||t[6]!==i.healthIssue||t[7]!==i.healthOk||t[8]!==i.sourceHealth?(d=n.lastHealthStatus?i.sourceHealth.replace(`{{status}}`,n.lastHealthStatus===`ok`?i.healthOk:i.healthIssue):null,t[5]=n.lastHealthStatus,t[6]=i.healthIssue,t[7]=i.healthOk,t[8]=i.sourceHealth,t[9]=d):d=t[9];let f=d,p=`${i.manageSources}: ${n.displayName}`,m;t[10]===a?m=t[11]:(m=e=>{e.target===e.currentTarget&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a()))},t[10]=a,t[11]=m);let h=n.displayName,g;t[12]===n?g=t[13]:(g=Ae(n),t[12]=n,t[13]=g);let _;t[14]!==n.displayName||t[15]!==g?(_=(0,Z.jsx)(De,{connector:{displayName:h,branding:g},size:`sm`}),t[14]=n.displayName,t[15]=g,t[16]=_):_=t[16];let v;t[17]===n.displayName?v=t[18]:(v=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.displayName}),t[17]=n.displayName,t[18]=v);let y;t[19]===u?y=t[20]:(y=u?(0,Z.jsx)(`p`,{className:`mt-0.5 truncate text-xs font-medium text-fg-muted`,children:u}):null,t[19]=u,t[20]=y);let b;t[21]===n.description?b=t[22]:(b=(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.description}),t[21]=n.description,t[22]=b);let x;t[23]!==b||t[24]!==v||t[25]!==y?(x=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[v,y,b]}),t[23]=b,t[24]=v,t[25]=y,t[26]=x):x=t[26];let S;t[27]!==x||t[28]!==_?(S=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[_,x]}),t[27]=x,t[28]=_,t[29]=S):S=t[29];let C=n.installed&&n.enabled?`bg-success-soft text-fg`:`bg-surface-hover text-fg-muted`,w;t[30]===C?w=t[31]:(w=s(`shrink-0 rounded-full px-2 py-1 text-[11px] font-medium`,C),t[30]=C,t[31]=w);let T;t[32]!==c||t[33]!==w?(T=(0,Z.jsx)(`span`,{className:w,children:c}),t[32]=c,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==S||t[36]!==T?(E=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,T]}),t[35]=S,t[36]=T,t[37]=E):E=t[37];let D;t[38]!==n.access.context||t[39]!==i.sourceContext?(D=n.access.context?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceContext}):null,t[38]=n.access.context,t[39]=i.sourceContext,t[40]=D):D=t[40];let O;t[41]!==n.access.memory||t[42]!==i.sourceMemory?(O=n.access.memory?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceMemory}):null,t[41]=n.access.memory,t[42]=i.sourceMemory,t[43]=O):O=t[43];let k;t[44]!==n.access.read||t[45]!==i.sourceRead?(k=n.access.read?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceRead}):null,t[44]=n.access.read,t[45]=i.sourceRead,t[46]=k):k=t[46];let A;t[47]!==n.access.write||t[48]!==i.sourceWrite?(A=n.access.write?(0,Z.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-fg`,children:i.sourceWrite}):null,t[47]=n.access.write,t[48]=i.sourceWrite,t[49]=A):A=t[49];let j;t[50]!==D||t[51]!==O||t[52]!==k||t[53]!==A?(j=(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[D,O,k,A]}),t[50]=D,t[51]=O,t[52]=k,t[53]=A,t[54]=j):j=t[54];let M;t[55]!==f||t[56]!==r||t[57]!==n.derivedUnderstandingCount||t[58]!==n.installed||t[59]!==n.knowledgeItemCount||t[60]!==n.lastActivityAt||t[61]!==n.lastSyncAt||t[62]!==n.lastSyncError||t[63]!==n.lastSyncStatus||t[64]!==i.sourceDerivedCount||t[65]!==i.sourceKnowledgeCount||t[66]!==i.sourceLastSync||t[67]!==i.sourceLastUsed||t[68]!==i.sourceNeverUsed||t[69]!==i.sourceSyncFailed?(M=n.installed?(0,Z.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-edge-subtle pt-3 text-xs text-fg-muted`,children:[f?(0,Z.jsx)(`p`,{children:f}):null,(0,Z.jsx)(`p`,{children:n.lastActivityAt?i.sourceLastUsed.replace(`{{time}}`,ze(n.lastActivityAt,r)):i.sourceNeverUsed}),n.lastSyncAt?(0,Z.jsx)(`p`,{children:i.sourceLastSync.replace(`{{time}}`,ze(n.lastSyncAt,r))}):null,n.lastSyncStatus===`failed`&&n.lastSyncError?(0,Z.jsx)(`p`,{className:`text-danger`,children:i.sourceSyncFailed.replace(`{{error}}`,n.lastSyncError)}):null,(0,Z.jsx)(`p`,{children:i.sourceKnowledgeCount.replace(`{{count}}`,String(n.knowledgeItemCount))}),(0,Z.jsx)(`p`,{children:i.sourceDerivedCount.replace(`{{count}}`,String(n.derivedUnderstandingCount))})]}):null,t[55]=f,t[56]=r,t[57]=n.derivedUnderstandingCount,t[58]=n.installed,t[59]=n.knowledgeItemCount,t[60]=n.lastActivityAt,t[61]=n.lastSyncAt,t[62]=n.lastSyncError,t[63]=n.lastSyncStatus,t[64]=i.sourceDerivedCount,t[65]=i.sourceKnowledgeCount,t[66]=i.sourceLastSync,t[67]=i.sourceLastUsed,t[68]=i.sourceNeverUsed,t[69]=i.sourceSyncFailed,t[70]=M):M=t[70];let N;t[71]!==o||t[72]!==n.installed||t[73]!==n.instanceId||t[74]!==i.disconnect?(N=n.installed&&n.instanceId?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-danger hover:bg-danger-soft hover:text-danger`,onClick:e=>{e.stopPropagation(),o()},children:i.disconnect})}):null,t[71]=o,t[72]=n.installed,t[73]=n.instanceId,t[74]=i.disconnect,t[75]=N):N=t[75];let P;return t[76]!==a||t[77]!==E||t[78]!==j||t[79]!==M||t[80]!==N||t[81]!==p||t[82]!==m?(P=(0,Z.jsxs)(`article`,{role:`button`,tabIndex:0,"aria-label":p,className:`cursor-pointer rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-accent/30 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:a,onKeyDown:m,children:[E,j,M,N]}),t[76]=a,t[77]=E,t[78]=j,t[79]=M,t[80]=N,t[81]=p,t[82]=m,t[83]=P):P=t[83],P}function Ge(e){let t=(0,Y.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:c,onDelete:l,onRollback:u}=e,[d,p]=(0,X.useState)(``),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(``),y=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,b;t[0]===y?b=t[1]:(b=s(`rounded-xl border p-4`,y),t[0]=y,t[1]=b);let x=i.playbookNames[n.id],S;t[2]===x?S=t[3]:(S=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:x}),t[2]=x,t[3]=S);let C;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(C=Le(i.playbookRuleCount,n.rules.filter(Je).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=C):C=t[6];let w;t[7]===C?w=t[8]:(w=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C}),t[7]=C,t[8]=w);let T;t[9]!==S||t[10]!==w?(T=(0,Z.jsxs)(`div`,{children:[S,w]}),t[9]=S,t[10]=w,t[11]=T):T=t[11];let E=n.enabled?i.pausePlaybook:i.resumePlaybook,D;t[12]!==r||t[13]!==a||t[14]!==E?(D=(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:E}),t[12]=r,t[13]=a,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D?(O=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,D]}),t[16]=T,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==r||t[20]!==h||t[21]!==_||t[22]!==l||t[23]!==u||t[24]!==c||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?(k=n.rules.map((e,t)=>(0,Z.jsx)(`li`,{className:s(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:h===e.id?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`textarea`,{className:s(Ie,`min-h-16 resize-y`),value:_,onChange:e=>v(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>g(null),children:i.cancel}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!_.trim(),onClick:()=>{c(e.id,{statement:_.trim()}),g(null)},children:i.save})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,Z.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,Z.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,Z.jsxs)(ve,{value:e.context.supportNeed??``,disabled:r,onChange:t=>c(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,Z.jsx)(q,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,Z.jsx)(q,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,Z.jsxs)(ve,{value:e.context.channel??``,disabled:r,onChange:t=>c(e.id,{context:{channel:t.target.value||null}}),children:[(0,Z.jsx)(q,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(qe)]})]})]}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>c(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>c(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>c(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{g(e.id),v(e.statement)},children:[(0,Z.jsx)(f,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,Z.jsx)(m,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,Z.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,Z.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(Ke).map(t=>(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,Z.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,Z.jsx)(J,{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]=h,t[21]=_,t[22]=l,t[23]=u,t[24]=c,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]=k):k=t[40];let A;t[41]===k?A=t[42]:(A=(0,Z.jsx)(`ul`,{className:`mt-3 space-y-2`,children:k}),t[41]=k,t[42]=A);let j;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>p(e.target.value),t[43]=j):j=t[43];let M;t[44]!==d||t[45]!==i.newRulePlaceholder?(M=(0,Z.jsx)(`input`,{className:Ie,value:d,onChange:j,placeholder:i.newRulePlaceholder}),t[44]=d,t[45]=i.newRulePlaceholder,t[46]=M):M=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()),p(``)},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,Z.jsx)(J,{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]!==M||t[58]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[M,F]}),t[57]=M,t[58]=F,t[59]=I):I=t[59];let L=i.playbookRuleExamples[n.id],R;t[60]===L?R=t[61]:(R=(0,Z.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,Z.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]!==O||t[66]!==A||t[67]!==b||t[68]!==z?(B=(0,Z.jsxs)(`article`,{className:b,children:[O,A,z]}),t[65]=O,t[66]=A,t[67]=b,t[68]=z,t[69]=B):B=t[69],B}function Ke(e){return!e.current}function qe(e){return(0,Z.jsx)(q,{value:e,children:e},e)}function Je(e){return e.enabled}function Ye(e){let t=(0,Y.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:c,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,Z.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,Z.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,Z.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=s(Ie,`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,Z.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,Z.jsx)(J,{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,Z.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,Z.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,Z.jsx)(ie,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,Z.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]!==c||t[38]!==l.meetLater?(T=(0,Z.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:c,children:l.meetLater}),t[36]=i,t[37]=c,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,Z.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,Z.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 Xe(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,p]=i(),m=Be(r.get(`tab`)),h=V(e=>e.setPageHeader),v=V(e=>e.clearPageHeader),{data:C,error:w,isLoading:T,mutate:D}=u(`/api/you`,E),[O,A]=(0,X.useState)(null),[j,L]=(0,X.useState)(!1),[B,G]=(0,X.useState)(``),[te,re]=(0,X.useState)(`preference`),[K,se]=(0,X.useState)(null),[de,Se]=(0,X.useState)(!1),[Te,De]=(0,X.useState)(null),[Y,ke]=(0,X.useState)(!1),[Ae,Me]=(0,X.useState)(``),[Pe,Ke]=(0,X.useState)(!1),[qe,Je]=(0,X.useState)(null),[Xe,Ze]=(0,X.useState)(!1),[Qe,$e]=(0,X.useState)(!1),[et,tt]=(0,X.useState)(!1),[nt,rt]=(0,X.useState)(null),[it,at]=(0,X.useState)(!1),[ot,st]=(0,X.useState)(null),[ct,lt]=(0,X.useState)(null),[ut,dt]=(0,X.useState)(!1),[ft,pt]=(0,X.useState)(null),mt=(0,X.useRef)(null),ht=(0,X.useRef)(null),Q=C?.profile??{callName:``,pronouns:``,timezone:``,notes:``},gt=(0,X.useMemo)(()=>C?.understanding.filter(e=>e.status===`active`)??[],[C]),_t=(0,X.useMemo)(()=>C?.understanding.filter(e=>e.status!==`active`)??[],[C]),vt=(0,X.useMemo)(()=>new Map(Fe.map(e=>[e,gt.filter(t=>t.facet===e)])),[gt]),yt=qe??C?.controls??null,bt=C?.sources.filter(e=>e.installed&&e.enabled)??[],xt=bt.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));async function St(e){if(!(!C||et)){tt(!0);try{let t=await ge(e);await D({...C,relationship:t.relationship},{revalidate:!1})}catch{x({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{tt(!1)}}}let $=(e,t)=>{let n=new URLSearchParams(r);e===`overview`?n.delete(`tab`):n.set(`tab`,e),t?n.set(`status`,t):n.delete(`status`),p(n,{replace:!0})},Ct=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)};(0,X.useLayoutEffect)(()=>(h({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>at(!0),children:[(0,Z.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>v()),[v,h,t.howItWorks,t.subtitle,t.title]),(0,X.useEffect)(()=>{!C||C.profile.callName||Me(C.profileSetup.callNameSuggestion?.value??``)},[C,C?.profile.callName,C?.profileSetup.callNameSuggestion?.id]);async function wt(e,n,r){A(e.id);try{let t=await H(e.id,{action:n,content:r});await D(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}),D()}catch{x({type:`error`,title:t.title,message:t.saveError})}finally{A(null)}}async function Tt(e,n){A(`consent:${e}`);try{await fe(e,n),await D(),x({type:`success`,title:t.title,message:t.saved})}catch{x({type:`error`,title:t.title,message:t.saveError})}finally{A(null)}}async function Et(){let e=B.trim();if(e){A(`understanding:new`);try{await S({content:e,kind:te}),G(``),L(!1),await D(),x({type:`success`,title:t.understandingTitle,message:t.saved})}catch{x({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{A(null)}}}async function Dt(){if(_t.length){A(`understanding:batch`);try{await N(_t.map(e=>e.id),`confirm`),await D()}catch{x({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{A(null)}}}async function Ot(e,n){A(`conflict:${e}`);try{await _e(e,n),await D()}catch{x({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{A(null)}}async function kt(e){A(`grant:${e}`);try{await le(e),await D()}catch{x({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{A(null)}}async function At(r,i){A(`insight:${r.id}`);try{let t=await z(r.id,{action:i,uiLocale:e});await D(),i===`apply`&&t.href&&n(t.href)}catch{x({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{A(null)}}async function jt(e){A(`playbook:${e.id}`);try{await ae(e.id,!e.enabled),await D()}catch{x({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{A(null)}}async function Mt(e,n){A(`playbook:${e}`);try{await n(),await D()}catch{x({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{A(null)}}async function Nt(){if(K){A(K.id);try{await d(K.id);let e=K.id;se(null),await D(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),D()}catch{x({type:`error`,title:t.title,message:t.saveError})}finally{A(null)}}}async function Pt(){if(Te){ke(!0);try{let e=await be(Te);Se(!1),De(null),await D(t=>t&&{...t,...e},{revalidate:!1})}catch{x({type:`error`,title:t.title,message:t.saveError})}finally{ke(!1)}}}async function Ft(){let e=Ae.trim();if(!(!e||Pe)){Ke(!0);try{let t=await be({callName:e,timezone:Q.timezone||R()});await D(e=>e&&{...e,...t},{revalidate:!1})}catch{x({type:`error`,title:t.title,message:t.saveError})}finally{Ke(!1)}}}async function It(){if(!Pe){Ke(!0);try{let e=await W(`snooze`);await D(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{x({type:`error`,title:t.title,message:t.saveError})}finally{Ke(!1)}}}function Lt(){De(Q),Se(!0),$(`profile`),requestAnimationFrame(()=>mt.current?.scrollIntoView({behavior:`smooth`,block:`start`}))}function Rt(e){re(e),L(!0),$(`understanding`)}async function zt(){if(yt){Ze(!0);try{Je(await oe(yt)),await D(),x({type:`success`,title:t.title,message:t.saved})}catch{x({type:`error`,title:t.title,message:t.saveError})}finally{Ze(!1)}}}async function Bt(e){if(!(Qe||e===C?.trust.defaultActionLevel)){$e(!0);try{let t=await ne(e);await D(e=>e&&{...e,trust:t},{revalidate:!1})}catch{x({type:`error`,title:t.trustTitle,message:t.saveError})}finally{$e(!1),rt(null)}}}async function Vt(e){if(!(!ct?.instanceId||ut)){dt(!0);try{let n=await I(ct.instanceId,e);lt(null),await D(),x({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{x({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{dt(!1)}}}async function Ht(){if(!ft){pt(`export`);try{let e=await F(),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{x({type:`error`,title:t.transferTitle,message:t.saveError})}finally{pt(null)}}}async function Ut(e){if(!(!e||ft)){pt(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await ee(JSON.parse(await e.text()));await D(),$(`understanding`,`review`),x({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{x({type:`error`,title:t.transferTitle,message:t.importError})}finally{ht.current&&(ht.current.value=``),st(null),pt(null)}}}function Wt(){st(null),ht.current&&(ht.current.value=``)}return(0,Z.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(Ee,{items:[{id:`overview`,label:t.tabs.overview,icon:xe},{id:`profile`,label:t.tabs.profile,icon:ye},{id:`understanding`,label:t.tabs.understanding,icon:ce,count:_t.length||void 0},{id:`sources`,label:t.tabs.sources,icon:_},{id:`controls`,label:t.tabs.controls,icon:ie}],activeTab:m,onChange:$,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,Z.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})]}),T?(0,Z.jsx)(Ve,{}):w||!C?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,C&&m===`overview`?(0,Z.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Q.callName&&C.profileSetup.shouldPrompt?(0,Z.jsx)(Ye,{suggestion:C.profileSetup.callNameSuggestion,draft:Ae,busy:Pe,onDraftChange:Me,onSave:()=>void Ft(),onLater:()=>void It(),t}):null,_t.length>0||xt.length>0||!Q.callName?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[_t.length>0?(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,onClick:()=>$(`understanding`,`review`),children:[Le(t.reviewCount,_t.length),(0,Z.jsx)(U,{className:`size-4`,"aria-hidden":!0})]}):null,xt.length>0?(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,onClick:()=>$(`sources`),children:[Le(t.sourceIssues,xt.length),(0,Z.jsx)(U,{className:`size-4`,"aria-hidden":!0})]}):null,Q.callName?null:(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,onClick:Lt,children:[t.completeProfile,(0,Z.jsx)(U,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,Z.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>$(`understanding`),children:[(0,Z.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:gt.length}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>$(`sources`),children:[(0,Z.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:bt.length}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>$(`understanding`,`review`),children:[(0,Z.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:_t.length}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,Z.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,Z.jsx)(ve,{value:C.relationship.supportMode,disabled:et,onChange:e=>void St({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,Z.jsx)(q,{value:e,children:t},e))})]})]}),(0,Z.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,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:C.relationship.proactiveEnabled,disabled:et,onChange:e=>void St({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Z.jsx)(`input`,{type:`time`,className:Ie,value:C.relationship.quietStart??``,disabled:et,onChange:e=>void St({quietStart:e.target.value||null})})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Z.jsx)(`input`,{type:`time`,className:Ie,value:C.relationship.quietEnd??``,disabled:et,onChange:e=>void St({quietEnd:e.target.value||null})})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,Z.jsx)(`input`,{className:Ie,defaultValue:C.relationship.blockedTopics.join(`, `),disabled:et,onBlur:e=>void St({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]})]}),C.insights.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(pe,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,Z.jsx)(Re,{children:t.confirmedContextBadge})]}),(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:C.insights.map(e=>(0,Z.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?Le(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,Z.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:O===`insight:${e.id}`,onClick:()=>void At(e,`dismiss`),children:t.notNow}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:O===`insight:${e.id}`,onClick:()=>void At(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(ye,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>$(`profile`),children:(0,Z.jsx)(U,{className:`size-4`,"aria-hidden":!0})})]}),(0,Z.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.callName||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.timezone||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.pronouns||`—`})]}),Q.notes?(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,Z.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:Q.notes})]}):null]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(ce,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>$(`understanding`),children:(0,Z.jsx)(U,{className:`size-4`,"aria-hidden":!0})})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[gt.slice(0,4).map(e=>(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),gt.length===0?(0,Z.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,C&&m===`profile`?(0,Z.jsxs)(`div`,{id:`you-panel-profile`,role:`tabpanel`,"aria-labelledby":`you-tab-profile`,className:`space-y-5`,children:[(0,Z.jsxs)(`section`,{ref:mt,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Z.jsx)(ye,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,Z.jsx)(Re,{children:t.onlyYouEditBadge})]}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),de?null:(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,onClick:Lt,children:[(0,Z.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),de&&Te?(0,Z.jsxs)(`div`,{className:`mt-5`,children:[(0,Z.jsx)(Oe,{value:Te,onChange:De,language:e,inputClassName:Ie,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,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>{Se(!1),De(null)},children:t.cancel}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,disabled:Y,onClick:()=>void Pt(),children:Y?t.saving:t.save})]})]}):(0,Z.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.callName||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.timezone||`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,Z.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Q.pronouns||`—`})]}),(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,Z.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:Q.notes||`—`})]})]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,Z.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:()=>Rt(`preference`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,Z.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:()=>Rt(`boundary`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,Z.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:()=>Rt(`current_state`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]})]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Z.jsx)(we,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,Z.jsx)(Re,{children:t.affectsAgentsBadge})]}),C.playbooks.length>0?(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:C.playbooks.map(e=>(0,Z.jsx)(Ge,{playbook:e,busy:O===`playbook:${e.id}`,t,onToggleGroup:()=>void jt(e),onCreate:t=>void Mt(e.id,()=>g(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void Mt(e.id,()=>ue(e.id,t,n)),onDelete:t=>void Mt(e.id,()=>b(e.id,t)),onRollback:(t,n)=>void Mt(e.id,()=>me(e.id,t,n))},e.id))}):(0,Z.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,C&&m===`understanding`?(0,Z.jsxs)(`div`,{id:`you-panel-understanding`,role:`tabpanel`,"aria-labelledby":`you-tab-understanding`,className:`space-y-6`,children:[(0,Z.jsxs)(`section`,{className:`border-b border-edge pb-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.addUnderstanding}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.addUnderstandingHint})]}),j?null:(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,onClick:()=>L(!0),children:[(0,Z.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),t.add]})]}),j?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-xl border border-edge bg-surface-panel p-3`,children:[(0,Z.jsx)(`textarea`,{className:s(Ie,`min-h-24 resize-y`),value:B,onChange:e=>G(e.target.value),placeholder:t.understandingPlaceholder}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[(0,Z.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,Z.jsx)(ve,{value:te,onChange:e=>re(e.target.value),children:Object.entries(t.understandingKinds).map(([e,t])=>(0,Z.jsx)(q,{value:e,children:t},e))})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>{L(!1),G(``)},children:t.cancel}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,disabled:!B.trim()||O===`understanding:new`,onClick:()=>void Et(),children:t.add})]})]})]}):null]}),C.conflictGroups.some(e=>e.unresolved)?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,Z.jsx)(`div`,{className:`mt-3 space-y-3`,children:C.conflictGroups.filter(e=>e.unresolved).map(n=>(0,Z.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,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[He(r,t),` · `,ze(r.updatedAt,e)]})]}),(0,Z.jsx)(J,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:O===`conflict:${n.id}`,onClick:()=>void Ot(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,C.consentRequests.length>0?(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),C.consentRequests.map(e=>(0,Z.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,disabled:O===`consent:${e.id}`,onClick:()=>void Tt(e.id,`deny`),children:t.consentDeny}),(0,Z.jsx)(J,{type:`button`,variant:`secondary`,disabled:O===`consent:${e.id}`,onClick:()=>void Tt(e.id,`once`),children:t.consentOnce}),(0,Z.jsx)(J,{type:`button`,variant:`secondary`,disabled:O===`consent:${e.id}`,onClick:()=>void Tt(e.id,`session`),children:t.consentSession}),(0,Z.jsx)(J,{type:`button`,variant:`primary`,disabled:O===`consent:${e.id}`,onClick:()=>void Tt(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,_t.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,Z.jsx)(J,{type:`button`,variant:`secondary`,disabled:O===`understanding:batch`,onClick:()=>void Dt(),children:t.reviewAll})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:_t.map(n=>(0,Z.jsx)(Ue,{item:n,language:e,t,busy:O===n.id,onConfirm:()=>void wt(n,`confirm`),onReject:()=>void wt(n,`reject`),onUpdate:e=>void wt(n,`update`,e),onForget:()=>se(n)},n.id))})]}):gt.length>0?(0,Z.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,Z.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null,Fe.map(n=>{let r=vt.get(n)??[];return r.length===0?null:(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,Z.jsx)(Ue,{item:n,language:e,t,busy:O===n.id,onConfirm:()=>void wt(n,`confirm`),onReject:()=>void wt(n,`reject`),onUpdate:e=>void wt(n,`update`,e),onForget:()=>se(n)},n.id))})]},n)}),C.understanding.length===0?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,C&&m===`sources`?(0,Z.jsxs)(`div`,{id:`you-panel-sources`,role:`tabpanel`,"aria-labelledby":`you-tab-sources`,className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.sourcesTitle}),(0,Z.jsx)(Re,{children:t.personalContextBadge})]})}),(0,Z.jsxs)(J,{type:`button`,variant:`primary`,onClick:()=>n(`/connectors?tab=connected&personalContext=1`),children:[t.manageSources,(0,Z.jsx)(U,{className:`size-4`,"aria-hidden":!0})]})]}),C.sourceRecommendations.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/25 p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Z.jsx)(M,{className:`size-4 text-accent`,"aria-hidden":!0}),t.recommendationsTitle]}),(0,Z.jsx)(Re,{children:t.permissionsBeforeConnectBadge})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 lg:grid-cols-3`,children:C.sourceRecommendations.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>Ct({id:e.sourceId}),children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e.sourceName}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.recommendationReason.replace(`{{goal}}`,e.goalTitle)})]},e.sourceId))})]}):null,(0,Z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:C.sources.map(n=>(0,Z.jsx)(We,{source:n,language:e,t,onConfigure:()=>Ct(n),onDisconnect:()=>lt(n)},`${n.id}:${n.instanceId??`catalog`}`))}),C.sources.length===0?(0,Z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.noSources}):null]}):null,C&&m===`controls`&&yt?(0,Z.jsxs)(`div`,{id:`you-panel-controls`,role:`tabpanel`,"aria-labelledby":`you-tab-controls`,className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,Z.jsx)(ve,{value:yt.mode,onChange:e=>Je({...yt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,Z.jsx)(q,{value:e,children:t},e))})]}),(0,Z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,Z.jsx)(ve,{value:yt.sensitiveWritePolicy,onChange:e=>Je({...yt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,Z.jsx)(q,{value:e,children:t},e))}),(0,Z.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[yt.sensitiveWritePolicy]})]}),(0,Z.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,Z.jsx)(J,{type:`button`,variant:`primary`,disabled:Xe,onClick:()=>void zt(),children:Xe?t.saving:t.save})})]})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:C.trust.levels.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":e===C.trust.defaultActionLevel,disabled:Qe,onClick:()=>{e!==C.trust.defaultActionLevel&&(e===`auto`?rt(e):Bt(e))},className:s(`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===C.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,Z.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===C.trust.defaultActionLevel?(0,Z.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,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),C.referenceGrants.length>0?(0,Z.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:C.referenceGrants.map(n=>(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${ze(n.expiresAt,e)}`:``]})]}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:O===`grant:${n.id}`,onClick:()=>void kt(n.id),children:t.revoke})]},n.id))}):(0,Z.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,disabled:ft!==null,onClick:()=>void Ht(),children:[(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":!0}),ft===`export`?t.exporting:t.exportAction]}),(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,disabled:ft!==null,onClick:()=>ht.current?.click(),children:[(0,Z.jsx)(y,{className:`size-4`,"aria-hidden":!0}),ft===`import`?t.importing:t.importAction]}),(0,Z.jsx)(`input`,{ref:ht,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>st(e.target.files?.[0]??null)})]})]})]}):null,(0,Z.jsx)(P,{open:K!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Nt(),onCancel:()=>se(null)}),(0,Z.jsx)(P,{open:nt===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void Bt(`auto`),onCancel:()=>rt(null)}),(0,Z.jsx)(P,{open:ot!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,ot?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=ot;st(null),Ut(e)},onCancel:Wt}),(0,Z.jsx)(Ne,{source:ct,language:e,busy:ut,onOpenChange:e=>{e||lt(null)},onConfirm:e=>void Vt(e)}),(0,Z.jsx)(je,{open:it,t,onOpenChange:at,onNavigate:$})]})}export{Xe as UserContextPage};
|