@xopcai/xopc 0.0.283 → 0.0.285
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-iPtG94qr.js → activity-store-B0BTIk9j.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DQ74xqLi.js → agent-avatar-dicebear-Dc-0QZTQ.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CcmqK1Sc.js +1 -0
- package/dist/gateway/static/root/assets/agents-B_7PVt7S.js +1 -0
- package/dist/gateway/static/root/assets/api-COG_Tzpv.js +1 -0
- package/dist/gateway/static/root/assets/{api-KMJzMqvZ.js → api-Coly9ab6.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B42TpqIb.js → app-management-settings-panel-TWBO-msg.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-D9Lfe7Sk.js → appearance-settings-CpTZ2KuT.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-6qxxKFsK.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BdmQwj4x.js → archive-plugin-z_u6alob.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B4S0_nji.js → attachment-load-C2nS04TC.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B3TmHNjQ.js → automations-page-aIBsw9zR.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BRQlU4qk.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B3cXF_DP.js → binary-plugins-CGmXoZnl.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-05zyBXBe.js → block-editor-CtvzCZhC.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BTIufVbM.js → browser-automation-inputs-BOTU1isH.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-DRBA9nwe.js → browser-automations-page-BwU5V8J0.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DDjbDeHQ.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DM1Bcf1x.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-Bq36CUxL.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-DMYQNs-J.js → channels-status-swr-Dfi0Desh.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Dx5KQyo5.js → chat-terminal-dock-B0MvcO6j.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-L8JehrxF.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-CkDROZoe.js → date-picker-DXOvbHCr.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Bl8HcvzL.js → dependency-picker-BEnC-eS0.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BcknAjbW.js → desktop-pet-DtPNvznL.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BuCpXQPm.js → desktop-pet-settings-CYyjcSn6.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-BPMGvAKE.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-qRpb2FFa.js → extension-debug-page-H_aPMGXW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C7gs9wu4.js → extension-page-C1JnpeMt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CyJP1CMZ.js → extension-settings-page-C75kCOqe.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Cpmyrr6j.js → gateway-config-swr-G2lQt7Ak.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BCF732TU.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DoiPeb65.js → gateway-startup-retry-GP31PUrG.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CV6Dolcn.js → heartbeat-settings-C7fjiowt.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-DZXeXdUL.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CqjHWl2T.js → image-generation-api-CKFhfHSw.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-GROumhj8.js +1 -0
- package/dist/gateway/static/root/assets/{index-CHgOG1aR.js → index-ChIrvv3t.js} +47 -47
- package/dist/gateway/static/root/assets/index-R1VNlHjj.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B3XqA41D.js → keyboard-shortcuts-settings-zcI822m_.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CAEKGTAg.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BcIVYp0J.js → local-apps-page-BtgDJ92Q.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-1urrBBCQ.js → locale-store-DlOv7896.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DHZ4BEkG.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-DNFCdgzR.js → management-settings-DasZxCyD.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BZmcFIWa.js → markdown-view-6oYdBahT.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BDxNhoBC.js → media-plugins-CxthbBvk.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Ls1Aaiqd.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-BcWq3ddw.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-DfZ8QWyv.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-agH3a2PI.js → page-tabs-BG39KidE.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-XEZ7zDOP.js → preview-open-alternatives-Bevpbq9f.js} +1 -1
- package/dist/gateway/static/root/assets/proactive-page-D2U_xQaS.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-lXAbj85Z.js → product-open-page-Bi1seZpM.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CzlGTW4F.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-mQsM-TsP.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CxQstD00.js → registry-api-D0ddwBFj.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cb56JcO1.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DErKZlVJ.js → runtime-tools-settings-panel-Wkru8_My.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DhCmJQVJ.js → schema-form-CSMRzj9Y.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Hj9uFcIO.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CV4-_EVA.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Dg6chotg.js → settings-form-section-wcAdCkK8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-LyuN5N3M.js → settings-page-BcQGAnCs.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DzxmsaQG.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CZvmf4Ob.js → share-preview-page-DQocUl-1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-xlJh1ccG.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-wSXJRSxX.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-AmqtBJo7.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-Eu0WVHTS.js → skills-page.utils-DtlfCgJp.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DQKkM7B2.js → system-settings-panel-Ct698Nf-.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-sQpwq5-c.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Dc5s20V3.js → theme-store-ng8KJsAT.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-TKQpPVd6.js → tunnel-api-Boajol0M.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CkVlrFk1.js → use-autosave-BSyxRHt2.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DIEHnAER.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-B12fFN-L.js → voice-api-key-field-SE3OQI1s.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-Mk78BrpP.js → voice-config-api-VNuCmdFe.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CT9Zy36i.js → work-discovery-overlay-Dn1vy2oq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BwefQliE.js → workflow-run-setup-panel-BJEfGY-k.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DgRNIyr7.js +6 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/proactive.js +13 -4
- package/dist/src/agent/coding/repository-instructions.js +1 -1
- package/dist/src/agent/coding/workspace-revision.js +1 -1
- package/dist/src/agent/commands/command-isolation.js +1 -1
- package/dist/src/agent/tools/factory.js +7 -3
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +10 -2
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/gateway/run-foreground.js +3 -0
- package/dist/src/cli/commands/import.d.ts +2 -0
- package/dist/src/cli/commands/import.js +78 -0
- package/dist/src/discussions/action-tasks.js +1 -1
- package/dist/src/discussions/edits.js +1 -1
- package/dist/src/discussions/index.js +1 -1
- package/dist/src/discussions/organizer.js +1 -1
- package/dist/src/discussions/recording.js +1 -1
- package/dist/src/discussions/sealer.js +1 -1
- package/dist/src/discussions/service.js +2 -2
- package/dist/src/endpoint-tools/invocation-service.d.ts +2 -0
- package/dist/src/endpoint-tools/invocation-service.js +48 -19
- package/dist/src/gateway/heartbeat/check-store.d.ts +18 -0
- package/dist/src/gateway/heartbeat/check-store.js +73 -0
- package/dist/src/gateway/heartbeat/service.d.ts +12 -3
- package/dist/src/gateway/heartbeat/service.js +61 -44
- package/dist/src/gateway/hono/routes/discussions.js +2 -2
- package/dist/src/gateway/hono/routes/imports.d.ts +3 -0
- package/dist/src/gateway/hono/routes/imports.js +56 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/proactive-control.js +2 -1
- package/dist/src/gateway/service.d.ts +7 -0
- package/dist/src/gateway/service.js +26 -9
- package/dist/src/imports/compatibility.d.ts +7 -0
- package/dist/src/imports/compatibility.js +174 -0
- package/dist/src/imports/contextImport.d.ts +3 -0
- package/dist/src/imports/contextImport.js +56 -0
- package/dist/src/imports/files.d.ts +13 -0
- package/dist/src/imports/files.js +77 -0
- package/dist/src/imports/importService.d.ts +50 -0
- package/dist/src/imports/importService.js +414 -0
- package/dist/src/imports/inventory.d.ts +11 -0
- package/dist/src/imports/inventory.js +202 -0
- package/dist/src/imports/planner.d.ts +11 -0
- package/dist/src/imports/planner.js +98 -0
- package/dist/src/imports/productImport.d.ts +10 -0
- package/dist/src/imports/productImport.js +241 -0
- package/dist/src/imports/runtime.d.ts +5 -0
- package/dist/src/imports/runtime.js +61 -0
- package/dist/src/imports/scanner.d.ts +14 -0
- package/dist/src/imports/scanner.js +159 -0
- package/dist/src/imports/secrets.d.ts +2 -0
- package/dist/src/imports/secrets.js +9 -0
- package/dist/src/imports/sources.d.ts +37 -0
- package/dist/src/imports/sources.js +75 -0
- package/dist/src/imports/types.d.ts +144 -0
- package/dist/src/imports/types.js +11 -0
- package/dist/src/infra/background-task.d.ts +2 -0
- package/dist/src/infra/background-task.js +25 -0
- package/dist/src/infra/process-diagnostics.d.ts +5 -0
- package/dist/src/infra/process-diagnostics.js +97 -0
- package/dist/src/infra/unhandled-rejections.js +6 -3
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/knowledge/ingestion-service.js +1 -0
- package/dist/src/knowledge-memory/repository.js +4 -2
- package/dist/src/media-shared/http/ssrf-guard.js +1 -1
- package/dist/src/notifications/proactive-policy.js +7 -5
- package/dist/src/proactive/execution/authorization.d.ts +2 -0
- package/dist/src/proactive/execution/authorization.js +10 -1
- package/dist/src/proactive/execution/context.js +1 -0
- package/dist/src/proactive/execution/repository.d.ts +2 -0
- package/dist/src/proactive/execution/repository.js +19 -2
- package/dist/src/proactive/execution/worker.js +14 -4
- package/dist/src/proactive/experience.d.ts +4 -1
- package/dist/src/proactive/experience.js +3 -0
- package/dist/src/proactive/follow-ups.d.ts +5 -0
- package/dist/src/proactive/follow-ups.js +18 -7
- package/dist/src/proactive/inbox/cards.js +2 -1
- package/dist/src/proactive/inbox/delivery.js +6 -7
- package/dist/src/proactive/inbox/digest.d.ts +1 -1
- package/dist/src/proactive/inbox/digest.js +23 -13
- package/dist/src/proactive/inbox/notification-policy.d.ts +1 -1
- package/dist/src/proactive/inbox/notification-policy.js +9 -6
- package/dist/src/proactive/inbox/repository.js +3 -2
- package/dist/src/proactive/inbox/service.d.ts +6 -0
- package/dist/src/proactive/inbox/service.js +18 -0
- package/dist/src/proactive/inbox/types.d.ts +1 -0
- package/dist/src/proactive/policy/presence.d.ts +1 -1
- package/dist/src/proactive/policy/presence.js +7 -5
- package/dist/src/proactive/policy/service.d.ts +8 -5
- package/dist/src/proactive/policy/service.js +12 -12
- package/dist/src/proactive/scenarios/control.d.ts +3 -3
- package/dist/src/proactive/scenarios/control.js +12 -2
- package/dist/src/proactive/source-freshness.d.ts +8 -0
- package/dist/src/proactive/source-freshness.js +27 -0
- package/dist/src/proactive/status.d.ts +2 -0
- package/dist/src/proactive/status.js +21 -0
- package/dist/src/proactive/temporal/worker.js +2 -1
- package/dist/src/realtime/runtime.js +31 -5
- package/dist/src/realtime/writer.js +16 -9
- package/dist/src/storage/sqlite/import-repository.d.ts +18 -0
- package/dist/src/storage/sqlite/import-repository.js +35 -0
- package/dist/src/storage/sqlite/import-selection-repository.d.ts +15 -0
- package/dist/src/storage/sqlite/import-selection-repository.js +28 -0
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +2 -2
- package/dist/src/storage/sqlite/migrations/174_capability_imports.sql +11 -0
- package/dist/src/storage/sqlite/migrations/175_import_selections.sql +8 -0
- package/dist/src/storage/sqlite/migrations/176_proactive_quality.sql +5 -0
- package/dist/src/storage/sqlite/migrations/177_proactive_check_controls.sql +25 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/work-discovery/candidate-discovery.js +1 -1
- package/dist/src/work-discovery/probe.js +1 -1
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-SElFkQd6.js +0 -1
- package/dist/gateway/static/root/assets/agents-DYazUaZ6.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BzrodN8C.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace--A4I0jMu.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DDTXUNWK.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Ll5UeXq5.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-BzL15bkU.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-RPw1AOMb.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-D0_tCX49.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DOeeTdWE.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Djw1H_Go.js +0 -1
- package/dist/gateway/static/root/assets/index-B_Sg5BKz.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-BPqgyYJq.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BHax3XlS.js +0 -2
- package/dist/gateway/static/root/assets/messages-DYFcjtmG.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-Cs46LFXO.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BUkcn_0t.js +0 -8
- package/dist/gateway/static/root/assets/proactive-page-Bn484J9v.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-LcH21ixD.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DelBiwyB.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-3BjFYXCf.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CVFirgVd.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DyfBpqkY.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CrXhTzHr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DyM_D8hM.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bys58-15.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-sWNvFo6D.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-B18NcZQJ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-ul-zr58b.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BY_AWs7S.js +0 -6
|
@@ -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{d as a,h as o,t as s,u as c}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as l}from"./popover-select-DGmMQt4t.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./external-link-DjqjBmc3.js";import{t as f}from"./markdown-view-6oYdBahT.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-JdwAhgNB.js";import{c as _,n as v}from"./locale-store-DlOv7896.js";import{t as y}from"./messages-Ls1Aaiqd.js";import{a as b,n as x,o as S,r as C,s as w,t as T}from"./dist-BGTk37IG.js";import{t as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-BA45yciM.js";import{i as O}from"./gateway-config-swr-G2lQt7Ak.js";import{Ca as k,Sc as A,Xs as j,Yi as M,Zs as N,_n as P,_u as F,ca as I,dc as L,gn as R,gs as z,mo as B,oc as V,po as H,ql as U}from"./index-ChIrvv3t.js";import{t as W}from"./page-tabs-BG39KidE.js";import{t as G}from"./skill-reload-api-wSXJRSxX.js";import{_ as K,a as q,c as J,d as Y,f as ee,g as te,h as ne,i as re,l as ie,m as ae,n as oe,o as se,p as ce,r as le,s as ue,t as de,u as fe}from"./skills-page.utils-DtlfCgJp.js";var X=e(t(),1),Z=n(),Q=r();function pe(e){let t=(0,Z.c)(12),{sk:n,findingSkills:r,onFindSkills:i,secondary:a}=e,o=a===void 0?!1:a,s=r?p:L,c=o?`secondary`:`primary`,l;t[0]===i?l=t[1]:(l=()=>void i(),t[0]=i,t[1]=l);let u=r?`size-4 animate-spin`:`size-4`,d;t[2]!==s||t[3]!==u?(d=(0,Q.jsx)(s,{className:u,"aria-hidden":!0}),t[2]=s,t[3]=u,t[4]=d):d=t[4];let f;return t[5]!==r||t[6]!==n.findCta||t[7]!==n.findHint||t[8]!==c||t[9]!==l||t[10]!==d?(f=(0,Q.jsxs)(D,{variant:c,className:`shrink-0`,title:n.findHint,disabled:r,"aria-busy":r,onClick:l,children:[d,n.findCta]}),t[5]=r,t[6]=n.findCta,t[7]=n.findHint,t[8]=c,t[9]=l,t[10]=d,t[11]=f):f=t[11],f}var me=(0,X.memo)(function(e){let t=(0,Z.c)(33),{findingSkills:n,onFindSkills:r,loading:i,onReloadClick:a,searchQuery:o,setSearchQuery:c,mainTab:l,sk:u,setPendingFile:d,setInstallOpen:f}=e,p=v(he),h;t[0]===p?h=t[1]:(h=y(p),t[0]=p,t[1]=h);let g=h.imports.title,_;t[2]===g?_=t[3]:(_=(0,Q.jsx)(s,{to:`/settings/imports`,className:`text-sm text-accent hover:underline`,children:g}),t[2]=g,t[3]=_);let b;t[4]!==i||t[5]!==a||t[6]!==u.reloadDiskAria||t[7]!==u.reloadRuntime?(b=(0,Q.jsx)(M,{className:`size-9 shrink-0 p-0`,loading:i,label:u.reloadDiskAria,title:u.reloadRuntime,onClick:a}),t[4]=i,t[5]=a,t[6]=u.reloadDiskAria,t[7]=u.reloadRuntime,t[8]=b):b=t[8];let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(A,{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[9]=x):x=t[9];let S;t[10]===c?S=t[11]:(S=e=>c(e.target.value),t[10]=c,t[11]=S);let C=l===`marketplace`?u.marketplaceSearchPackages:u.searchPlaceholder,w;t[12]!==o||t[13]!==S||t[14]!==C?(w=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[x,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:o,onChange:S,placeholder:C,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[12]=o,t[13]=S,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==f||t[17]!==d?(T=()=>{d(null),f(!0)},t[16]=f,t[17]=d,t[18]=T):T=t[18];let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(m,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[19]=E):E=t[19];let O;t[20]!==u.installCta||t[21]!==T?(O=(0,Q.jsxs)(D,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,onClick:T,children:[E,u.installCta]}),t[20]=u.installCta,t[21]=T,t[22]=O):O=t[22];let k;t[23]!==n||t[24]!==r||t[25]!==u?(k=(0,Q.jsx)(pe,{sk:u,findingSkills:n,onFindSkills:r}),t[23]=n,t[24]=r,t[25]=u,t[26]=k):k=t[26];let j;return t[27]!==O||t[28]!==k||t[29]!==_||t[30]!==b||t[31]!==w?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[_,b,w,O,k]}),t[27]=O,t[28]=k,t[29]=_,t[30]=b,t[31]=w,t[32]=j):j=t[32],j});function he(e){return e.language}var ge=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function _e(){let e=(0,Z.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:g(`h-4 min-w-0 flex-1`,ge)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(`div`,{className:g(`size-8 shrink-0 rounded-lg`,ge)}),(0,Q.jsx)(`div`,{className:g(`h-8 w-[4.5rem] shrink-0 rounded-lg`,ge)})]})]}),r=(0,Q.jsx)(`div`,{className:g(`h-3 w-full`,ge)}),i=(0,Q.jsx)(`div`,{className:g(`h-3 w-[92%]`,ge)}),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,Q.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,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,Q.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,Q.jsx)(`div`,{className:g(`h-3 w-full`,ge)}),(0,Q.jsx)(`div`,{className:g(`h-2.5 w-4/5`,ge)})]})]})})}),e[4]=a):a=e[4],a}function ve(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(_e,{}),e[0]=t):t=e[0],t}var ye=new Set([`installed`,`marketplace`]),be=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),xe=new Set([`all`,`enabled`,`disabled`]),Se=`mprov`,Ce=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],we=[`business`,`creative`,`documents`,`engineering`,`tools`];function Te(e){let t=(0,Z.c)(41),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:c,catalogDisplayRows:l,catalogStatusFilter:d,resolveSkillEnabled:f,categoryLabel:p,sourceLabel:m,openSkillDetail:h,onSkillToggle:_,onUseSkillInChat:v,usingSkillInChatName:y,togglingSkillName:b}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Ce.map(Ee),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,Q.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 r;t[3]===n.empty?r=t[4]:(r=(0,Q.jsx)(`p`,{className:`mb-3`,children:n.empty}),t[3]=n.empty,t[4]=r);let i;t[5]!==e.findingSkills||t[6]!==e.onFindSkills||t[7]!==n?(i=(0,Q.jsx)(pe,{sk:n,findingSkills:e.findingSkills,onFindSkills:e.onFindSkills,secondary:!0}),t[5]=e.findingSkills,t[6]=e.onFindSkills,t[7]=n,t[8]=i):i=t[8];let a;return t[9]!==r||t[10]!==i?(a=(0,Q.jsxs)(`div`,{className:`py-16 text-center text-sm text-fg-muted`,children:[r,i]}),t[9]=r,t[10]=i,t[11]=a):a=t[11],a}if(a.length===0){let r;t[12]===n.noSearchResults?r=t[13]:(r=(0,Q.jsx)(`p`,{className:`mb-3`,children:n.noSearchResults}),t[12]=n.noSearchResults,t[13]=r);let i;t[14]!==e.findingSkills||t[15]!==e.onFindSkills||t[16]!==n?(i=(0,Q.jsx)(pe,{sk:n,findingSkills:e.findingSkills,onFindSkills:e.onFindSkills,secondary:!0}),t[14]=e.findingSkills,t[15]=e.onFindSkills,t[16]=n,t[17]=i):i=t[17];let a;return t[18]!==r||t[19]!==i?(a=(0,Q.jsxs)(`div`,{className:`py-16 text-center text-sm text-fg-muted`,children:[r,i]}),t[18]=r,t[19]=i,t[20]=a):a=t[20],a}let x;t[21]!==o||t[22]!==s||t[23]!==p||t[24]!==c||t[25]!==n?(x=o.length>1?(0,Q.jsx)(W,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:p(e),title:p(e)}))],activeTab:s,onChange:c,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,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[21]=o,t[22]=s,t[23]=p,t[24]=c,t[25]=n,t[26]=x):x=t[26];let S;t[27]!==l||t[28]!==d||t[29]!==_||t[30]!==v||t[31]!==h||t[32]!==f||t[33]!==n||t[34]!==m||t[35]!==b||t[36]!==y?(S=l.length===0?(0,Q.jsx)(`div`,{className:`py-16 text-center text-sm text-fg-muted`,children:d===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>{let t=f(e);return(0,Q.jsxs)(`article`,{className:g(`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,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:g(`min-w-0 flex-1 cursor-pointer rounded-lg text-left outline-none`,z.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void h(e),children:(0,Q.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`truncate text-[15px] font-semibold leading-8 tracking-tight text-fg`,children:e.name})}),t?(0,Q.jsx)(D,{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,Q.jsx)(D,{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})]}),(0,Q.jsx)(`button`,{type:`button`,className:g(`mt-2 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 h(e),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:m(e)}),(0,Q.jsxs)(`span`,{className:g(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 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,Q.jsx)(u,{className:`size-3`,"aria-hidden":!0}):(0,Q.jsx)(F,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]}),e.managed?(0,Q.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,Q.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]})]})})})]},`${e.directoryId}-${e.path}`)})}),t[27]=l,t[28]=d,t[29]=_,t[30]=v,t[31]=h,t[32]=f,t[33]=n,t[34]=m,t[35]=b,t[36]=y,t[37]=S):S=t[37];let C;return t[38]!==x||t[39]!==S?(C=(0,Q.jsxs)(Q.Fragment,{children:[x,S]}),t[38]=x,t[39]=S,t[40]=C):C=t[40],C}function Ee(e){return(0,Q.jsx)(ve,{},e)}function De(e){let t=(0,Z.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,Q.jsx)(b,{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,Q.jsx)(w,{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?le(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,Q.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,Q.jsx)(D,{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,Q.jsx)(D,{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 _;t[21]!==m||t[22]!==g?(_=(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[m,g]}),t[21]=m,t[22]=g,t[23]=_):_=t[23];let v;t[24]!==_||t[25]!==u||t[26]!==f?(v=(0,Q.jsxs)(S,{children:[l,(0,Q.jsxs)(C,{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,_]})]}),t[24]=_,t[25]=u,t[26]=f,t[27]=v):v=t[27];let y;return t[28]!==r||t[29]!==c||t[30]!==v?(y=(0,Q.jsx)(T,{open:r,onOpenChange:c,children:v}),t[28]=r,t[29]=c,t[30]=v,t[31]=y):y=t[31],y}function Oe(e){let t=(0,Z.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.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,Q.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,Q.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 ke(e){let t=(0,Z.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),l,u,d,p,m,h,_,v,y,b,x,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(Me)??[],f=n.requiredEnvVarNames?.filter(je)??[];_=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(0,Q.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),y=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?b=t[44]:(b=i.emoji?.trim()?(0,Q.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=b);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=g(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(x=(0,Q.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=x):x=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(S=n.disableModelInvocation?(0,Q.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,Q.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,Q.jsx)(Oe,{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,Q.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,Q.jsx)(Oe,{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,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[s.bins&&s.bins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),s.bins.join(`, `)]}):null,s.env&&s.env.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:s.env.join(`, `)})]}):null,s.anyBins&&s.anyBins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.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,Q.jsx)(Oe,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=T):T=t[73];let j=e.length>0?(0,Q.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Ae)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(d=(0,Q.jsx)(Oe,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=d):d=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,Q.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[a.requiresTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),a.requiresTools.join(`, `)]}):null,a.requiresToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),a.requiresToolsets.join(`, `)]}):null,a.fallbackForTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),a.fallbackForTools.join(`, `)]}):null,a.fallbackForToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.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,Q.jsx)(Oe,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],l=Oe,u=r.detailEnvVarsLabel,v=f.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:f.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]=l,t[27]=u,t[28]=d,t[29]=p,t[30]=m,t[31]=h,t[32]=_,t[33]=v,t[34]=y,t[35]=b,t[36]=x,t[37]=S,t[38]=C,t[39]=w,t[40]=T}else l=t[26],u=t[27],d=t[28],p=t[29],m=t[30],h=t[31],_=t[32],v=t[33],y=t[34],b=t[35],x=t[36],S=t[37],C=t[38],w=t[39],T=t[40];let E;t[87]!==l||t[88]!==u||t[89]!==v?(E=(0,Q.jsx)(l,{label:u,children:v}),t[87]=l,t[88]=u,t[89]=v,t[90]=E):E=t[90];let D;t[91]!==d||t[92]!==p||t[93]!==E||t[94]!==y||t[95]!==b||t[96]!==x||t[97]!==S||t[98]!==C||t[99]!==w||t[100]!==T?(D=(0,Q.jsxs)(`div`,{className:y,children:[b,x,S,C,w,T,d,p,E]}),t[91]=d,t[92]=p,t[93]=E,t[94]=y,t[95]=b,t[96]=x,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,Q.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,Q.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,Q.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,Q.jsx)(f,{content:n.bodyMarkdown})}):(0,Q.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,Q.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]!==_||t[115]!==O||t[116]!==j?(M=(0,Q.jsxs)(`div`,{className:_,children:[O,j]}),t[114]=_,t[115]=O,t[116]=j,t[117]=M):M=t[117],M}function Ae(e,t){return(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,Q.jsx)(`span`,{className:`text-fg`,children:oe(e)})},e.id||`${e.kind}-${t}`)}function je(e){return e.trim()}function Me(e){return e&&typeof e.kind==`string`}var Ne=[{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 Pe(e){let t=(0,Z.c)(77),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:c,detailCatalogPreview:l,setDetailCatalogPreview:u,detailMarketplacePreview:f,setDetailMarketplacePreview:p,detailLoading:m,detailError:_,setDetailError:v,detailEnabled:y,detailDirectoryId:E,detailManaged:O,detailExternalUrl:k,usingSkillInChatName:A,installingMarketName:M,togglingSkillName:P,isSkillInstalledByName:F,onUseSkillInChat:I,onMarketInstall:L,onSkillToggle:R,setConfirmId:B,setConfirmOpen:V}=e,H;t[0]!==u||t[1]!==v||t[2]!==p||t[3]!==i||t[4]!==o||t[5]!==c?(H=e=>{i(e),e||(o(`catalog`),u(null),p(null),v(null),c(``))},t[0]=u,t[1]=v,t[2]=p,t[3]=i,t[4]=o,t[5]=c,t[6]=H):H=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=U):U=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=g(`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 G=s||`?`,K;t[9]===G?K=t[10]:(K=(0,Q.jsx)(ue,{name:G}),t[9]=G,t[10]=K);let q=s||`—`,J;t[11]===q?J=t[12]:(J=(0,Q.jsx)(w,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:q}),t[11]=q,t[12]=J);let Y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Y=g(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,z.focusRingPanel),t[13]=Y):Y=t[13];let ee;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(h,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=ee):ee=t[14];let te;t[15]===n.detailCloseAria?te=t[16]:(te=(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:Y,"aria-label":n.detailCloseAria,children:ee})}),t[15]=n.detailCloseAria,t[16]=te);let ne;t[17]!==K||t[18]!==J||t[19]!==te?(ne=(0,Q.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[K,J,te]}),t[17]=K,t[18]=J,t[19]=te,t[20]=ne):ne=t[20];let re;t[21]!==l||t[22]!==y||t[23]!==_||t[24]!==m||t[25]!==f||t[26]!==a||t[27]!==n?(re=(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:m?(0,Q.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:Ne.map(Fe)}):_?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:_}):a===`catalog`&&l?(0,Q.jsxs)(Q.Fragment,{children:[y?null:(0,Q.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,Q.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,Q.jsx)(ke,{preview:l,sk:n})]}):a===`store`&&f?(0,Q.jsx)(ke,{preview:f,sk:n}):(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[21]=l,t[22]=y,t[23]=_,t[24]=m,t[25]=f,t[26]=a,t[27]=n,t[28]=re):re=t[28];let ie;t[29]!==k||t[30]!==a||t[31]!==n.marketplaceOpenExternal||t[32]!==n.marketplaceOpenExternalAria?(ie=a===`store`&&k?(0,Q.jsxs)(`a`,{href:k,target:`_blank`,rel:`noopener noreferrer`,className:g(`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,Q.jsx)(d,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[29]=k,t[30]=a,t[31]=n.marketplaceOpenExternal,t[32]=n.marketplaceOpenExternalAria,t[33]=ie):ie=t[33];let ae;t[34]!==E||t[35]!==O||t[36]!==a||t[37]!==B||t[38]!==V||t[39]!==n.delete?(ae=a===`catalog`&&O&&E?(0,Q.jsxs)(D,{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:()=>{B(E),V(!0)},children:[(0,Q.jsx)(N,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[34]=E,t[35]=O,t[36]=a,t[37]=B,t[38]=V,t[39]=n.delete,t[40]=ae):ae=t[40];let oe;t[41]!==ie||t[42]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ie,ae]}),t[41]=ie,t[42]=ae,t[43]=oe):oe=t[43];let se;t[44]!==y||t[45]!==m||t[46]!==a||t[47]!==s||t[48]!==M||t[49]!==F||t[50]!==L||t[51]!==R||t[52]!==I||t[53]!==i||t[54]!==n.cancel||t[55]!==n.detailModalDisable||t[56]!==n.detailModalEnable||t[57]!==n.marketplaceInstall||t[58]!==n.marketplaceReinstall||t[59]!==n.previewUseInChat||t[60]!==n.previewUseInChatBusy||t[61]!==n.uploading||t[62]!==n.useRequiresEnabled||t[63]!==P||t[64]!==A?(se=(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,Q.jsx)(D,{type:`button`,variant:`secondary`,disabled:!s||m||A===s||M===s,onClick:()=>void I(),children:A===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,Q.jsx)(D,{type:`button`,variant:F(s)?`secondary`:`primary`,disabled:!s||M===s,onClick:()=>{s&&L(s,{useDetailProvider:!0})},children:M===s?n.uploading:F(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,Q.jsxs)(Q.Fragment,{children:[y?(0,Q.jsx)(D,{type:`button`,variant:`secondary`,disabled:!s||P===s,onClick:()=>{s&&R(s,!1)},children:P===s?n.uploading:n.detailModalDisable}):(0,Q.jsx)(D,{type:`button`,variant:`primary`,disabled:!s||P===s,onClick:()=>{s&&R(s,!0)},children:P===s?n.uploading:n.detailModalEnable}),(0,Q.jsx)(D,{type:`button`,variant:`secondary`,disabled:!s||!y||m||A===s||P===s,title:y?void 0:n.useRequiresEnabled,onClick:()=>void I(),children:A===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[44]=y,t[45]=m,t[46]=a,t[47]=s,t[48]=M,t[49]=F,t[50]=L,t[51]=R,t[52]=I,t[53]=i,t[54]=n.cancel,t[55]=n.detailModalDisable,t[56]=n.detailModalEnable,t[57]=n.marketplaceInstall,t[58]=n.marketplaceReinstall,t[59]=n.previewUseInChat,t[60]=n.previewUseInChatBusy,t[61]=n.uploading,t[62]=n.useRequiresEnabled,t[63]=P,t[64]=A,t[65]=se):se=t[65];let ce;t[66]!==oe||t[67]!==se?(ce=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[oe,se]}),t[66]=oe,t[67]=se,t[68]=ce):ce=t[68];let le;t[69]!==ne||t[70]!==re||t[71]!==ce?(le=(0,Q.jsxs)(S,{children:[U,(0,Q.jsxs)(C,{className:W,children:[ne,re,ce]})]}),t[69]=ne,t[70]=re,t[71]=ce,t[72]=le):le=t[72];let de;return t[73]!==r||t[74]!==H||t[75]!==le?(de=(0,Q.jsx)(T,{open:r,onOpenChange:H,children:le}),t[73]=r,t[74]=H,t[75]=le,t[76]=de):de=t[76],de}function Fe(e){return(0,Q.jsx)(`div`,{className:g(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function Ie(e){let t=(0,Z.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:c,uploading:l,onModalDragOver:u,onModalDragLeave:d,onModalDrop:f,onFileInputChange:p,onInstallSubmit:m}=e,_;t[0]!==c||t[1]!==i||t[2]!==o?(_=e=>{i(e),e||(o(null),c(!1))},t[0]=c,t[1]=i,t[2]=o,t[3]=_):_=t[3];let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=v):v=t[4];let y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=g(`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]=y):y=t[5];let E;t[6]===n.installModalTitle?E=t[7]:(E=(0,Q.jsx)(w,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=E);let D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=g(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,z.focusRingPanel),t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(h,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=O):O=t[9];let k;t[10]===n.installClose?k=t[11]:(k=(0,Q.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,Q.jsx)(x,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:D,"aria-label":n.installClose,children:[O,k]})}),t[12]=n.installClose,t[13]=k,t[14]=A):A=t[14];let j;t[15]!==E||t[16]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,A]}),t[15]=E,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=g(`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]!==p||t[21]!==n.installModalDropHint||t[22]!==l?(P=(0,Q.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:l,onChange:p}),t[20]=p,t[21]=n.installModalDropHint,t[22]=l,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(U,{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,Q.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,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=L);let R;t[29]!==d||t[30]!==u||t[31]!==f||t[32]!==N||t[33]!==P||t[34]!==I||t[35]!==L?(R=(0,Q.jsxs)(`label`,{className:N,onDragLeave:d,onDragOver:u,onDrop:f,children:[P,F,I,L]}),t[29]=d,t[30]=u,t[31]=f,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,Q.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,Q.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=V);let H;t[41]===n.installModalReq2?H=t[42]:(H=(0,Q.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=H);let W;t[43]!==V||t[44]!==H?(W=(0,Q.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]=W):W=t[45];let G;t[46]!==B||t[47]!==W?(G=(0,Q.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[B,W]}),t[46]=B,t[47]=W,t[48]=G):G=t[48];let K=!a||l,q=!a||l?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,J;t[49]===q?J=t[50]:(J=g(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,q,z.focusRingPanel),t[49]=q,t[50]=J);let Y;t[51]===m?Y=t[52]:(Y=()=>void m(),t[51]=m,t[52]=Y);let ee=l?n.uploading:n.installAction,te;t[53]!==K||t[54]!==J||t[55]!==Y||t[56]!==ee?(te=(0,Q.jsx)(`button`,{type:`button`,disabled:K,className:J,onClick:Y,children:ee}),t[53]=K,t[54]=J,t[55]=Y,t[56]=ee,t[57]=te):te=t[57];let ne;t[58]!==R||t[59]!==G||t[60]!==te||t[61]!==j?(ne=(0,Q.jsxs)(S,{children:[v,(0,Q.jsxs)(C,{className:y,children:[j,R,G,te]})]}),t[58]=R,t[59]=G,t[60]=te,t[61]=j,t[62]=ne):ne=t[62];let re;return t[63]!==r||t[64]!==_||t[65]!==ne?(re=(0,Q.jsx)(T,{open:r,onOpenChange:_,children:ne}),t[63]=r,t[64]=_,t[65]=ne,t[66]=re):re=t[66],re}function Le(e){let t=(0,Z.c)(30),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:c,marketCategoryId:l,setMarketCategoryId:d,mpHasMore:f,onLoadMoreMarket:p,onRetryMarket:m,isSkillInstalledByName:h,openMarketplaceDetail:_,onMarketInstall:v,installingMarketName:y,onUseSkillInChat:b,usingSkillInChatName:x,searchInputActive:S,searchQuery:C,setSearchQuery:w,registeredProviders:T,marketBrowseProvider:E,setMarketBrowseProvider:O}=e,k=!S,A;t[0]===E?A=t[1]:(A=e=>e.id!==E,t[0]=E,t[1]=A);let j=T.filter(A),M=C.trim(),N;t[2]===n.marketplaceCategoryAll?N=t[3]:(N={id:``,label:n.marketplaceCategoryAll},t[2]=n.marketplaceCategoryAll,t[3]=N);let P;t[4]!==r||t[5]!==N?(P=[N,...r.map(Ue)],t[4]=r,t[5]=N,t[6]=P):P=t[6];let F=P,I;t[7]===r?I=t[8]:(I=new Map(r.map(He)),t[7]=r,t[8]=I);let L=I,R=(0,X.useRef)(null),B,H;t[9]!==c||t[10]!==f||t[11]!==s||t[12]!==p?(B=()=>{let e=R.current;if(!e||!f||s||c)return;let t=new IntersectionObserver(e=>{e.some(Ve)&&p()},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},H=[f,s,c,p],t[9]=c,t[10]=f,t[11]=s,t[12]=p,t[13]=B,t[14]=H):(B=t[13],H=t[14]),(0,X.useEffect)(B,H);let U;t[15]!==F||t[16]!==l||t[17]!==r.length||t[18]!==i||t[19]!==d||t[20]!==k||t[21]!==n.marketplaceCategoriesAria?(U=k?r.length>0?(0,Q.jsx)(W,{items:F,activeTab:l,onChange:d,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,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,Q.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:none] [&::-webkit-scrollbar]:hidden`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Be)}):null:null,t[15]=F,t[16]=l,t[17]=r.length,t[18]=i,t[19]=d,t[20]=k,t[21]=n.marketplaceCategoriesAria,t[22]=U):U=t[22];let G;t[23]!==a||t[24]!==k?(G=k&&a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[23]=a,t[24]=k,t[25]=G):G=t[25];let K=!o&&!c?(0,Q.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:Ce.map(ze)}):c&&!o?(0,Q.jsxs)(`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:[(0,Q.jsx)(`p`,{children:c}),(0,Q.jsx)(D,{className:`mt-2`,onClick:m,children:n.marketplaceRetry})]}):o?(0,Q.jsxs)(`div`,{className:`relative`,children:[o.items.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{className:`px-4`,children:S&&M?le(n.marketplaceEmptySearch,{query:M}):n.marketplaceEmpty}),(0,Q.jsx)(pe,{sk:n,findingSkills:e.findingSkills,onFindSkills:e.onFindSkills,secondary:!0}),S?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[j.map(e=>(0,Q.jsx)(D,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>O(e.id),children:le(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,Q.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>w(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,Q.jsx)(`div`,{className:g(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`),children:o.items.map(e=>{let t=re(e,e.providerId??E),r=h(t),i=e.category??e.categories?.[0],a=i?L.get(i)??i:null;return(0,Q.jsxs)(`article`,{className:g(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover [content-visibility:auto] [contain-intrinsic-size:auto_220px]`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:g(`min-w-0 flex-1 rounded-lg text-left outline-none`,z.focusRingPanel),onClick:()=>void _(t,e.name,e.providerId??void 0),children:(0,Q.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name})}),r?(0,Q.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,Q.jsx)(u,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):(0,Q.jsx)(D,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:y===t,onClick:()=>void v(t,{providerOverride:e.providerId??null}),children:y===t?n.uploading:n.marketplaceInstall})]}),(0,Q.jsx)(`button`,{type:`button`,className:g(`mt-2 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 _(t,e.name,e.providerId??void 0),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),a?(0,Q.jsx)(`span`,{className:`w-fit max-w-full truncate rounded-full bg-surface-subtle px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:a}):null,(0,Q.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,Q.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,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,Q.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,Q.jsx)(V,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,Q.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]})]})})}),r?(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:(0,Q.jsx)(D,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===t,onClick:()=>void b({name:t,source:`store`,providerOverride:e.providerId??null}),children:x===t?n.previewUseInChatBusy:n.previewUseInChat})}):null]},e.id)})}),(0,Q.jsx)(`div`,{ref:R,className:`h-1`,"aria-hidden":!0}),s?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:Ce.slice(0,3).map(Re)}):c?(0,Q.jsxs)(`div`,{className:`mt-4 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-sm text-fg-muted`,children:c}),(0,Q.jsx)(D,{onClick:m,children:n.marketplaceRetry})]}):!f&&o.items.length>0?(0,Q.jsx)(`p`,{className:`mt-4 text-center text-xs text-fg-subtle`,children:S?n.marketplaceSearchEnd:n.marketplaceEnd}):null]}):null,q;return t[26]!==U||t[27]!==G||t[28]!==K?(q=(0,Q.jsxs)(Q.Fragment,{children:[U,G,K]}),t[26]=U,t[27]=G,t[28]=K,t[29]=q):q=t[29],q}function Re(e){return(0,Q.jsx)(_e,{},e)}function ze(e){return(0,Q.jsx)(_e,{},e)}function Be(e){return(0,Q.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 Ve(e){return e.isIntersecting}function He(e){return[e.id,e.label]}function Ue(e){return{id:e.id,label:e.label,title:e.label}}function We(e){let t=(0,Z.c)(129),{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:_,setCatalogStatusFilter:v,marketSort:y,setMarketSort:b,marketBrowseProvider:x,setMarketBrowseProvider:S,registeredProviders:C,inSettingsShell:w,searchInputActive:T,resultTab:E,setResultTab:D,aggregatedTabCounts:O,aggregatedProviderStatus:k}=n,A,j,M,N,P,F,I,L;if(t[0]!==o||t[1]!==k||t[2]!==O||t[3]!==p||t[4]!==a||t[5]!==i||t[6]!==C||t[7]!==r.diagnosticsTitle||t[8]!==r.marketplaceLoadFailed||t[9]!==r.marketplaceResultsTabAll||t[10]!==r.needToken||t[11]!==r.tabDiscover||t[12]!==r.tabInstalled||t[13]!==s||t[14]!==m||t[15]!==n){L=Symbol.for(`react.early_return_sentinel`);bb0:{let e=de(s);if(!i){let e;t[24]===n?e=t[25]:(e=(0,Q.jsx)(Je,{vm:n}),t[24]=n,t[25]=e);let i;t[26]===r.needToken?i=t[27]:(i=(0,Q.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[26]=r.needToken,t[27]=i);let a;t[28]!==e||t[29]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[e,i]}),t[28]=e,t[29]=i,t[30]=a):a=t[30],L=a;break bb0}let c=p.total+m.total,l;t[31]!==c||t[32]!==r.tabInstalled?(l={id:`installed`,label:r.tabInstalled,count:c},t[31]=c,t[32]=r.tabInstalled,t[33]=l):l=t[33];let u;t[34]===r.tabDiscover?u=t[35]:(u={id:`marketplace`,label:r.tabDiscover},t[34]=r.tabDiscover,t[35]=u);let d;t[36]!==l||t[37]!==u?(d=[l,u],t[36]=l,t[37]=u,t[38]=d):d=t[38],A=d;let f;t[39]===C?f=t[40]:(f=[`all`,...C.map(qe)],t[39]=C,t[40]=f);let h=f,_;t[41]!==k||t[42]!==O||t[43]!==C||t[44]!==r.marketplaceLoadFailed||t[45]!==r.marketplaceResultsTabAll||t[46]!==h?(_=h.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:C.find(t=>t.id===e)?.displayName??e,n=O[e]??0,i=e===`all`?null:k[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,Q.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,Q.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[41]=k,t[42]=O,t[43]=C,t[44]=r.marketplaceLoadFailed,t[45]=r.marketplaceResultsTabAll,t[46]=h,t[47]=_):_=t[47],j=_,t[48]===n?I=t[49]:(I=(0,Q.jsx)(Je,{vm:n}),t[48]=n,t[49]=I),F=`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,M=`mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,t[50]!==o||t[51]!==a?(N=o?(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:g(`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,Q.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[50]=o,t[51]=a,t[52]=N):N=t[52],P=e.length>0?(0,Q.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,Q.jsx)(`div`,{className:`font-medium`,children:le(r.diagnosticsTitle,{count:e.length})}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.slice(0,3).map(Ke)})]}):null}t[0]=o,t[1]=k,t[2]=O,t[3]=p,t[4]=a,t[5]=i,t[6]=C,t[7]=r.diagnosticsTitle,t[8]=r.marketplaceLoadFailed,t[9]=r.marketplaceResultsTabAll,t[10]=r.needToken,t[11]=r.tabDiscover,t[12]=r.tabInstalled,t[13]=s,t[14]=m,t[15]=n,t[16]=A,t[17]=j,t[18]=M,t[19]=N,t[20]=P,t[21]=F,t[22]=I,t[23]=L}else A=t[16],j=t[17],M=t[18],N=t[19],P=t[20],F=t[21],I=t[22],L=t[23];if(L!==Symbol.for(`react.early_return_sentinel`))return L;let R;t[53]!==w||t[54]!==n.findingSkills||t[55]!==n.loading||t[56]!==n.mainTab||t[57]!==n.onFindSkills||t[58]!==n.onReloadClick||t[59]!==n.searchQuery||t[60]!==n.setInstallOpen||t[61]!==n.setPendingFile||t[62]!==n.setSearchQuery||t[63]!==n.sk?(R=w?(0,Q.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,Q.jsx)(me,{findingSkills:n.findingSkills,onFindSkills:n.onFindSkills,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[53]=w,t[54]=n.findingSkills,t[55]=n.loading,t[56]=n.mainTab,t[57]=n.onFindSkills,t[58]=n.onReloadClick,t[59]=n.searchQuery,t[60]=n.setInstallOpen,t[61]=n.setPendingFile,t[62]=n.setSearchQuery,t[63]=n.sk,t[64]=R):R=t[64];let z;t[65]!==c||t[66]!==A||t[67]!==u||t[68]!==r.skillsNavAria?(z=(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Q.jsx)(W,{items:A,activeTab:c,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[65]=c,t[66]=A,t[67]=u,t[68]=r.skillsNavAria,t[69]=z):z=t[69];let B;t[70]!==h||t[71]!==_||t[72]!==c||t[73]!==x||t[74]!==y||t[75]!==C||t[76]!==E||t[77]!==j||t[78]!==T||t[79]!==v||t[80]!==S||t[81]!==b||t[82]!==D||t[83]!==f||t[84]!==r.discoverHeading||t[85]!==r.filterAll||t[86]!==r.filterDisabledOnly||t[87]!==r.filterEnabled||t[88]!==r.filterExtra||t[89]!==r.filterGlobal||t[90]!==r.filterInstalled||t[91]!==r.filterWorkspace||t[92]!==r.installedHeading||t[93]!==r.marketplaceBrowseSwitchAria||t[94]!==r.marketplaceResultsTabsAria||t[95]!==r.marketplaceSortDownloads||t[96]!==r.marketplaceSortLabel||t[97]!==r.marketplaceSortNewest||t[98]!==r.sourceFilterAria||t[99]!==r.statusFilterAria||t[100]!==r.tabBuiltin||t[101]!==d?(B=c===`installed`?(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.installedHeading})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[(0,Q.jsx)(l,{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,Q.jsx)(l,{value:_,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:le(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=>v(e)})]})]})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.discoverHeading})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[T?null:(0,Q.jsx)(l,{value:x??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:C.map(Ge),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:S}),(0,Q.jsx)(l,{value:y,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=>b(e)})]})]}),T?(0,Q.jsx)(W,{items:j,activeTab:E,onChange:D,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[70]=h,t[71]=_,t[72]=c,t[73]=x,t[74]=y,t[75]=C,t[76]=E,t[77]=j,t[78]=T,t[79]=v,t[80]=S,t[81]=b,t[82]=D,t[83]=f,t[84]=r.discoverHeading,t[85]=r.filterAll,t[86]=r.filterDisabledOnly,t[87]=r.filterEnabled,t[88]=r.filterExtra,t[89]=r.filterGlobal,t[90]=r.filterInstalled,t[91]=r.filterWorkspace,t[92]=r.installedHeading,t[93]=r.marketplaceBrowseSwitchAria,t[94]=r.marketplaceResultsTabsAria,t[95]=r.marketplaceSortDownloads,t[96]=r.marketplaceSortLabel,t[97]=r.marketplaceSortNewest,t[98]=r.sourceFilterAria,t[99]=r.statusFilterAria,t[100]=r.tabBuiltin,t[101]=d,t[102]=B):B=t[102];let V;t[103]!==c||t[104]!==n?(V=c===`marketplace`?(0,Q.jsx)(Le,{...n}):(0,Q.jsx)(Te,{...n}),t[103]=c,t[104]=n,t[105]=V):V=t[105];let H;t[106]!==V||t[107]!==z||t[108]!==B?(H=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[z,B,V]}),t[106]=V,t[107]=z,t[108]=B,t[109]=H):H=t[109];let U;t[110]!==M||t[111]!==H||t[112]!==N||t[113]!==P||t[114]!==R?(U=(0,Q.jsxs)(`div`,{className:M,children:[N,P,R,H]}),t[110]=M,t[111]=H,t[112]=N,t[113]=P,t[114]=R,t[115]=U):U=t[115];let G,K,q;t[116]===n?(G=t[117],K=t[118],q=t[119]):(G=(0,Q.jsx)(Pe,{...n}),K=(0,Q.jsx)(Ie,{...n}),q=(0,Q.jsx)(De,{...n}),t[116]=n,t[117]=G,t[118]=K,t[119]=q);let J;t[120]!==U||t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==F?(J=(0,Q.jsxs)(`div`,{className:F,children:[U,G,K,q]}),t[120]=U,t[121]=G,t[122]=K,t[123]=q,t[124]=F,t[125]=J):J=t[125];let Y;return t[126]!==J||t[127]!==I?(Y=(0,Q.jsxs)(Q.Fragment,{children:[I,J]}),t[126]=J,t[127]=I,t[128]=Y):Y=t[128],Y}function Ge(e){return{value:e.id,label:e.displayName}}function Ke(e,t){return(0,Q.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function qe(e){return e.id}function Je(e){let t=(0,Z.c)(19),{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=B(Xe),m=B(Ye),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||t[8]!==n.findingSkills||t[9]!==n.onFindSkills?(h=(0,Q.jsx)(me,{findingSkills:n.findingSkills,onFindSkills:n.onFindSkills,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]=n.findingSkills,t[9]=n.onFindSkills,t[10]=h):h=t[10];let g=h,_,v;return t[11]!==m||t[12]!==i||t[13]!==f||t[14]!==p||t[15]!==r.title||t[16]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[11]=m,t[12]=i,t[13]=f,t[14]=p,t[15]=r.title,t[16]=g,t[17]=_,t[18]=v):(_=t[17],v=t[18]),(0,X.useLayoutEffect)(_,v),null}function Ye(e){return e.clearPageHeader}function Xe(e){return e.setPageHeader}async function Ze(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 Qe(e){let t=(0,Z.c)(33),n=_(nt),r=_($),i;t[0]!==n||t[1]!==e.category||t[2]!==e.enabled||t[3]!==e.provider||t[4]!==e.sort||t[5]!==r?(i=(t,i)=>!e.enabled||!e.provider||i&&(!i.items.length||i.meta.page>=i.meta.totalPages)?null:[`skills-feed`,n,r,e.provider,e.category,e.sort,t+1],t[0]=n,t[1]=e.category,t[2]=e.enabled,t[3]=e.provider,t[4]=e.sort,t[5]=r,t[6]=i):i=t[6];let a=i,o;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateFirstPage:!1,revalidateOnFocus:!1,shouldRetryOnError:!1,persistSize:!1},t[7]=o):o=t[7];let{data:s,error:c,size:l,setSize:u,isValidating:d,mutate:f}=E(a,tt,o),p=(0,X.useRef)(null),m;t[8]===a?m=t[9]:(m=JSON.stringify(a(0,null)),t[8]=a,t[9]=m);let h=m,g;t[10]===s?g=t[11]:(g=s?.at(-1),t[10]=s,t[11]=g);let v=g,y;t[12]===s?y=t[13]:(y=[...new Map((s??[]).flatMap(et).map($e)).values()],t[12]=s,t[13]=y);let b=y,x=e.enabled&&!c&&(d||!s||l>s.length),S=!!(v?.items.length&&v.meta.page<v.meta.totalPages),C;t[14]!==b||t[15]!==v?(C=v?{...v,items:b}:null,t[14]=b,t[15]=v,t[16]=C):C=t[16];let w;t[17]!==c||t[18]!==S||t[19]!==x||t[20]!==h||t[21]!==u||t[22]!==l?(w=()=>{if(x||c||!S||p.current?.scope===h)return;let e=u(l+1);p.current={scope:h,request:e},e.finally(()=>{p.current?.request===e&&(p.current=null)})},t[17]=c,t[18]=S,t[19]=x,t[20]=h,t[21]=u,t[22]=l,t[23]=w):w=t[23];let T;t[24]===f?T=t[25]:(T=()=>{f()},t[24]=f,t[25]=T);let D;return t[26]!==c||t[27]!==S||t[28]!==x||t[29]!==C||t[30]!==w||t[31]!==T?(D={payload:C,loading:x,error:c,hasMore:S,loadMore:w,retry:T},t[26]=c,t[27]=S,t[28]=x,t[29]=C,t[30]=w,t[31]=T,t[32]=D):D=t[32],D}function $e(e){return[e.id,e]}function et(e){return e.items}function tt(e){let[,,,t,n,r,i]=e;return ce({provider:t,category:n,sort:r,page:i,pageSize:20})}function $(e){return e.sessionKey}function nt(e){return e.baseUrl}function rt(){let e=v(e=>e.language),t=y(e).skills,n=!!_(e=>e.sessionKey),r=a(),[i,s]=o(),l=i.get(`mprov`)?.trim()||null,[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),g=i.get(`q`)??``,b=i.get(`tab`),x=i.get(`source`),S=i.get(`status`),C=ye.has(b)?b:`installed`,w=be.has(x)?x:`all`,T=xe.has(S)?S:`all`,[E,D]=(0,X.useState)(g),[A]=k(E,250),j=A.trim(),M=E.trim().length>0,N=j.length>0,[F,L]=(0,X.useState)(null),[z,B]=(0,X.useState)(C),[V,U]=(0,X.useState)(w),[W,re]=(0,X.useState)(``),[oe,le]=(0,X.useState)(T),[ue,de]=(0,X.useState)(!1),[Z,Q]=(0,X.useState)(null),[pe,me]=(0,X.useState)(!1),[he,ge]=(0,X.useState)(!1),[_e,ve]=(0,X.useState)(null),[Ce,Te]=(0,X.useState)(null),[Ee,De]=(0,X.useState)({}),[Oe,ke]=(0,X.useState)(!1),[Ae,je]=(0,X.useState)(`catalog`),[Me,Ne]=(0,X.useState)(``),[Pe,Fe]=(0,X.useState)(null),[Ie,Le]=(0,X.useState)(null),[Re,ze]=(0,X.useState)(!1),[Be,Ve]=(0,X.useState)(null),[He,Ue]=(0,X.useState)(`downloads`),[We,Ge]=(0,X.useState)(1),[Ke,qe]=(0,X.useState)(0),[Je,Ye]=(0,X.useState)(null),[Xe,$e]=(0,X.useState)(null),[et,tt]=(0,X.useState)(``),[$,nt]=(0,X.useState)(()=>l),[rt,it]=(0,X.useState)(0),[at,ot]=(0,X.useState)(0),[st,ct]=(0,X.useState)([]),lt=(0,X.useRef)(null),ut=(0,X.useRef)(l),dt=(0,X.useRef)(null),ft=(0,X.useRef)(``),pt=(0,X.useRef)(null),mt=(0,X.useRef)(!1),[ht,gt]=(0,X.useState)({query:``,byProvider:{}}),[_t,vt]=(0,X.useState)(`all`),yt=(0,X.useRef)(0),bt=(0,X.useRef)(j);bt.current!==j&&(bt.current=j,vt(e=>e===`all`?e:`all`));let xt=H(()=>P().then(e=>(ct(e.diagnostics??[]),e.catalog.map(se))),[n,at],{enabled:n,initial:[],errorData:[]}),{data:St,loading:Ct,setData:wt}=xt,Tt=H(async()=>{try{let{providers:e,current:t}=await ee();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await Y()).provider}}catch{return{providers:[],current:`store`}}}},[n,rt],{enabled:n,initial:{providers:[],current:null}}),Et=u||Ct,Dt=Tt.data.providers;(0,X.useEffect)(()=>{let e=e=>{if(O(e.detail)===`skills`){if(mt.current){mt.current=!1;return}ot(e=>e+1)}else it(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let Ot=i.toString(),kt=(0,X.useRef)(Ot);if(kt.current!==Ot){kt.current=Ot;let e=i.get(`q`)??``,t=i.get(`tab`),n=i.get(`source`),r=i.get(`status`),a=ye.has(t)?t:`installed`,o=be.has(n)?n:`all`,s=xe.has(r)?r:`all`;D(t=>t===e?t:e),B(e=>e===a?e:a),U(e=>e===o?e:o),le(e=>e===s?e:s);let c=i.get(`mcat`)??``;tt(a===`marketplace`?e=>e===c?e:c:``)}let At=(0,X.useRef)(n);!n&&At.current&&(nt(null),lt.current=null),At.current=n,n&&l&&ut.current!==l&&(ut.current=l,nt(l)),n&&l==null&&Tt.data.current&&Tt.data.current!==dt.current&&(dt.current=Tt.data.current,nt(e=>e??Tt.data.current));let jt=`${j}|${He}|${z}|${et}|${$??``}|${_t}`;ft.current!==jt&&(ft.current=jt,Ge(1)),z===`marketplace`&&$&&pt.current!=null&&pt.current!==$&&tt(``),pt.current=$;let Mt=Qe({enabled:n&&z===`marketplace`&&!!$&&!M,provider:$,category:et.trim(),sort:He});(0,X.useEffect)(()=>{if(!n||!N||z!==`marketplace`||Dt.length===0)return;let e=++yt.current,r={};for(let e of Dt)r[e.id]={status:`loading`,rows:[]};gt({query:j,byProvider:r});let i=[],a=[];for(let n of Dt){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),ce({provider:n.id,q:j,page:1,pageSize:40,sort:He,signal:r.signal}).then(t=>{if(window.clearTimeout(o),e!==yt.current)return;let r=t.items.map(e=>({...e,providerId:n.id}));gt(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),e!==yt.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?t.marketplaceLoadFailed:r instanceof Error?r.message:t.marketplaceLoadFailed;gt(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{yt.current+=1;for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[n,z,N,j,Dt,He,Ke,t.marketplaceLoadFailed]);let Nt=H(()=>ie({provider:$,locale:e}).then(e=>e.items),[n,z,$,e],{enabled:n&&z===`marketplace`&&!!$,initial:[],errorData:[]}),Pt=(0,X.useMemo)(()=>{if(!N||ht.query!==j)return[];let e=Dt.map(e=>({id:e.id,rows:[...ht.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,ht,Dt]),Ft=(0,X.useMemo)(()=>{if(!N)return{};let e={all:Pt.length};for(let t of Dt)e[t.id]=Pt.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[N,Pt,Dt]),It=(0,X.useMemo)(()=>N?_t===`all`?Pt:Pt.filter(e=>e.providerId===_t||(e.additionalSources??[]).some(e=>e.providerId===_t)):[],[N,Pt,_t]),Lt=(0,X.useMemo)(()=>{if(!N)return{};let e={};for(let t of Dt)e[t.id]=ht.byProvider[t.id]?.status??`loading`;return e},[N,ht,Dt]),Rt=(0,X.useMemo)(()=>Object.values(Lt).some(e=>e===`loading`),[Lt]),zt=(0,X.useMemo)(()=>{if(!N)return!1;let e=Object.values(Lt);return e.length>0&&e.every(e=>e===`error`)},[N,Lt]),Bt=(0,X.useMemo)(()=>{if(!N||Pt.length===0&&Rt)return null;let e=It.length;return{items:It.slice(0,We*20),meta:{page:We,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:_t}},[N,Pt,Rt,It,We,_t]),Vt=z===`marketplace`?M?N?Bt:null:Mt.payload:null,Ht=z===`marketplace`?M?N?Rt:!0:Mt.loading:!1,Ut=N?zt?t.marketplaceLoadFailed:null:Mt.error instanceof Error?Mt.error.message:Mt.error?t.marketplaceLoadFailed:null,Wt=z===`marketplace`?Nt.data:[],Gt=z===`marketplace`?Nt.loading:!1,Kt=Nt.error instanceof Error?Nt.error.message:Nt.error?t.marketplaceCategoriesFailed:null;et.trim()&&Wt.length>0&&!Wt.some(e=>e.id===et)&&tt(``);let qt=(0,X.useCallback)(async e=>{let n=e?.silent===!0;n||d(!0),p(null);try{let e=await P();return ct(e.diagnostics??[]),wt(e.catalog.map(se)),{ok:!0}}catch(e){let n=e instanceof Error?e.message:t.loadFailed;return p(n),{ok:!1,message:n}}finally{n||d(!1)}},[wt,t.loadFailed]),Jt=!u&&xt.error?xt.error instanceof Error?xt.error.message:t.loadFailed:null,Yt=f??Jt;(0,X.useEffect)(()=>{s(e=>{let t=new URLSearchParams(e);return j?t.set(`q`,j):t.delete(`q`),z===`marketplace`?t.set(`tab`,z):t.delete(`tab`),V===`all`?t.delete(`source`):t.set(`source`,V),z===`installed`&&oe!==`all`?t.set(`status`,oe):t.delete(`status`),z===`marketplace`&&et.trim()?t.set(`mcat`,et.trim()):t.delete(`mcat`),z===`marketplace`&&$?t.set(Se,$):t.delete(Se),t.toString()===e.toString()?e:t},{replace:!0})},[z,et,$,j,oe,s,V]);let Xt=(0,X.useCallback)((e,t,n=5e3)=>{L({kind:e,message:t}),window.setTimeout(()=>L(null),n)},[]),Zt=(0,X.useCallback)(e=>{let n=e.availability;if(!n)return t.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.`},[t.installSuccess]),Qt=(0,X.useCallback)(async e=>{je(`catalog`),ke(!0),Ne(e.name),Fe(null),Le(null),Ve(null),ze(!0);try{let t=await ae(e.name);Fe(t),Ne(t.name)}catch(e){Fe(null),Ve(e instanceof Error?e.message:t.detailLoadFailed)}finally{ze(!1)}},[t.detailLoadFailed]),$t=(0,X.useCallback)(async e=>{let n=e.trim();if(n){je(`catalog`),ke(!0),Ne(n),Fe(null),Le(null),Ve(null),ze(!0);try{let e=await ae(n);Fe(e),Ne(e.name)}catch(e){Fe(null),Ve(e instanceof Error?e.message:t.detailLoadFailed)}finally{ze(!1)}}},[t.detailLoadFailed]),en=(0,X.useCallback)(async(e,n,r)=>{let i=r?.trim()||$;if(i){lt.current=i,je(`store`),ke(!0),Ne(n?.trim()||e),Fe(null),Le(null),Ve(null),ze(!0);try{let t=await fe(e,{provider:i});Ne(t.name),Le(t.skillDocPreview)}catch(e){Le(null),Ve(e instanceof Error?e.message:t.detailLoadFailed)}finally{ze(!1)}}},[$,t.detailLoadFailed]),tn=(0,X.useCallback)(async(e,n)=>{Te(e),De(t=>({...t,[e]:n})),L(null);try{return await te(e,n),await qt({silent:!0}),!0}catch(n){return De(t=>{let{[e]:n,...r}=t;return r}),Xt(`error`,n instanceof Error?n.message:t.skillToggleFailed),!1}finally{Te(null),De(t=>{let{[e]:n,...r}=t;return r})}},[qt,Xt,t.skillToggleFailed]),nn=(0,X.useCallback)(async()=>{L(null),d(!0),p(null);try{await G()}catch(e){p(e instanceof Error?e.message:t.reloadFailed),d(!1);return}await qt()},[qt,t.reloadFailed]),rn=(0,X.useMemo)(()=>{let e=E.trim().toLowerCase();return e?St.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):St},[St,E]),an=(0,X.useMemo)(()=>{let e=St.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>Ee[e.name]??e.enabled).length}},[St,Ee]),on=(0,X.useMemo)(()=>{let e=St.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>Ee[e.name]??e.enabled).length}},[St,Ee]),sn=(0,X.useMemo)(()=>Me?St.find(e=>e.name===Me):void 0,[St,Me]),cn=sn==null?!0:Ee[Me]??sn.enabled,ln=sn?.directoryId??null,un=sn?.managed??!1,dn=(0,X.useMemo)(()=>Ae!==`store`||!Me?null:q(lt.current??$,Me),[Ae,Me,$]),fn=(0,X.useMemo)(()=>{let e=rn;return z===`installed`&&V!==`all`&&(e=V===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===V)),e},[rn,z,V]),pn=(0,X.useMemo)(()=>{let e=new Set,t=[];for(let n of fn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=we.indexOf(e),r=we.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[fn]),mn=(0,X.useCallback)(e=>t.categoryLabel?.[e]||e,[t.categoryLabel]),hn=(0,X.useMemo)(()=>W?fn.filter(e=>e.category===W):fn,[fn,W]);(0,X.useEffect)(()=>{re(``)},[V]);let gn=(0,X.useCallback)(e=>Ee[e.name]??e.enabled,[Ee]),_n=(0,X.useMemo)(()=>hn.filter(e=>!gn(e)).length,[hn,gn]),vn=(0,X.useMemo)(()=>{let e=hn;return oe===`disabled`&&(e=e.filter(e=>!gn(e))),oe===`enabled`&&(e=e.filter(e=>gn(e))),[...e].toSorted((e,t)=>{let n=gn(e);return n===gn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[hn,oe,gn]),yn=async e=>{L(null),h(!0),p(null);try{let n;try{n=await Ze(e)}catch{p(t.invalidFile),Xt(`error`,t.invalidFile);return}let r=await K(n,{overwrite:!0});mt.current=!0,await qt(),Xt(`success`,Zt(r)),de(!1),Q(null),B(`installed`),U(`installed`),await $t(r.availability?.skillName||r.skillId)}catch(e){p(e instanceof Error?e.message:t.uploadFailed),Xt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{h(!1)}},bn=()=>{Z&&yn(Z)},xn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&Q(t)},Sn=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(me(!0),e.dataTransfer.dropEffect=`copy`)},Cn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||me(!1)},wn=e=>{e.preventDefault(),e.stopPropagation(),me(!1);let t=e.dataTransfer?.files?.[0];t&&Q(t)},Tn=e=>{if(e.origin===`agents-global`)return t.source.agentsGlobal;if(e.origin===`agents-workspace`)return t.source.agentsWorkspace;switch(e.source){case`builtin`:return t.source.builtin;case`workspace`:return t.source.workspace;case`global`:return t.source.global;case`extra`:return t.source.extra;default:return e.source}},En=async()=>{let e=_e,n=Oe&&Ae===`catalog`&&ln===e;if(ge(!1),ve(null),e){L(null);try{await J(e),mt.current=!0,await qt(),n&&(ke(!1),je(`catalog`),Ne(``),Fe(null),Le(null),Ve(null))}catch(e){p(e instanceof Error?e.message:t.deleteFailed)}}},Dn=(0,X.useCallback)(e=>St.some(t=>t.name===e),[St]),On=(0,X.useRef)(!1),[kn,An]=(0,X.useState)(!1),jn=(0,X.useCallback)(async()=>{if(!On.current){On.current=!0,An(!0),L(null);try{let{defaultId:e}=await I(),{skills:n}=await R(e,void 0,!0);if(!n.some(e=>e.name===`find-skills`&&e.availableForCurrentAgent))throw Error(t.findUnavailable);let i=new URLSearchParams({projectScope:`none`,scene:`find-skills`,skill:`find-skills`});E.trim()&&i.set(`draft`,t.findQuery.replace(`{{query}}`,E.trim())),r(`/chat/new?${i}`,{state:{forceNewChat:!0,agentId:e}})}catch(e){Xt(`error`,e instanceof Error?e.message:t.findFailed)}finally{On.current=!1,An(!1)}}},[r,E,Xt,t.findUnavailable,t.findFailed,t.findQuery]),Mn=(0,X.useCallback)(async e=>{let n=(e?.name??Me).trim();if(!n)return;let i=e?.source??Ae;if(i===`catalog`){let e=St.find(e=>e.name===n);if(e&&!(Ee[e.name]??e.enabled))return}L(null);let a=i===`store`&&!Dn(n);$e(n);try{if(a){let t=e?.providerOverride?.trim()||lt.current||$;await ne({name:n,overwrite:!1,...t?{provider:t}:{}}),mt.current=!0,await qt({silent:!0})}ke(!1),r(`/chat/new?skill=${encodeURIComponent(n)}`)}catch(e){Xt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{$e(null)}},[St,Me,Ae,Ee,Dn,qt,r,Xt,t.uploadFailed,$]),Nn=(0,X.useCallback)(async(e,n)=>{let r=Dn(e);if(!(r&&!window.confirm(t.marketplaceReinstallConfirm))){L(null),Ye(e);try{let t=n?.providerOverride?.trim()||(n?.useDetailProvider?lt.current??$:$),i=await ne({name:e,overwrite:r,...t?{provider:t}:{}});mt.current=!0,await qt({silent:!0}),Xt(`success`,Zt(i)),B(`installed`),U(`installed`),await $t(i.availability?.skillName||i.skillId||e)}catch(e){Xt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{Ye(null)}}},[Dn,Zt,qt,$,$t,Xt,t.marketplaceReinstallConfirm,t.uploadFailed]),{pathname:Pn}=c(),Fn=Pn.startsWith(`/settings/`);return{sk:t,hasToken:n,catalog:St,loading:Et,error:Yt,uploading:m,searchQuery:E,setSearchQuery:D,actionFeedback:F,skillDiagnostics:st,mainTab:z,setMainTab:B,sourceFilter:V,setSourceFilter:U,builtinCategoryFilter:W,setBuiltinCategoryFilter:re,installOpen:ue,setInstallOpen:de,pendingFile:Z,setPendingFile:Q,dropActive:pe,setDropActive:me,confirmOpen:he,setConfirmOpen:ge,confirmId:_e,setConfirmId:ve,togglingSkillName:Ce,enabledOverride:Ee,detailOpen:Oe,setDetailOpen:ke,detailSource:Ae,setDetailSource:je,detailTitle:Me,setDetailTitle:Ne,detailCatalogPreview:Pe,setDetailCatalogPreview:Fe,detailMarketplacePreview:Ie,setDetailMarketplacePreview:Le,detailLoading:Re,detailError:Be,setDetailError:Ve,marketSort:He,setMarketSort:Ue,mpHasMore:M?!!(Bt&&Bt.items.length<Bt.meta.total):Mt.hasMore,onLoadMoreMarket:()=>{M?Ht||Ge(e=>e+1):Mt.loadMore()},onRetryMarket:()=>{M?qe(e=>e+1):Mt.retry()},mpLoading:Ht,mpError:Ut,mpPayload:Vt,searchActive:N,searchInputActive:M,resultTab:_t,setResultTab:vt,aggregatedTabCounts:Ft,aggregatedProviderStatus:Lt,aggregatedAllFailed:zt,installingMarketName:Je,usingSkillInChatName:Xe,onUseSkillInChat:Mn,onFindSkills:jn,findingSkills:kn,marketCategoryId:et,setMarketCategoryId:tt,mpCategories:Wt,mpCategoriesError:Kt,mpCategoriesLoading:Gt,marketBrowseProvider:$,setMarketBrowseProvider:nt,registeredProviders:Dt,builtinTabStats:an,userTabStats:on,detailEnabled:cn,detailDirectoryId:ln,detailManaged:un,detailExternalUrl:dn,filteredCatalog:fn,builtinCategories:pn,categoryFilteredCatalog:hn,catalogDisplayRows:vn,catalogDisabledCount:_n,catalogStatusFilter:oe,setCatalogStatusFilter:le,resolveSkillEnabled:gn,inSettingsShell:Fn,categoryLabel:mn,onReloadClick:nn,openSkillDetail:Qt,openMarketplaceDetail:en,onSkillToggle:tn,onInstallSubmit:bn,onFileInputChange:xn,onModalDragOver:Sn,onModalDragLeave:Cn,onModalDrop:wn,sourceLabel:Tn,runDelete:En,onMarketInstall:Nn,isSkillInstalledByName:Dn}}function it(){let e=(0,Z.c)(2),t=rt(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(We,{vm:t}),e[0]=t,e[1]=n),n}export{it as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{c as r,i,r as a}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{c as r,i,r as a}from"./locale-store-DlOv7896.js";import{vn as o}from"./index-ChIrvv3t.js";import"./skill-reload-api-wSXJRSxX.js";async function s(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??`global`);let i=new Headers,o=await fetch(a(`/api/skills/upload`),{method:`POST`,headers:i,body:n});o.status===401&&r.getState().onUnauthorized();let s=await o.json().catch(()=>({}));if(!o.ok)throw Error(s.error||`HTTP ${o.status}`);if(!s.payload?.skillId)throw Error(`Invalid response`);return s.payload}async function c(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await i(a(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await o(r))}async function l(e,t){let n=await i(a(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await o(n))}function u(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function d(e){let t=new URLSearchParams;u(t,e?.provider),e?.locale?.trim()&&t.set(`locale`,e.locale.trim());let n=t.toString(),r=await i(a(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload||!Array.isArray(s.payload.items))throw Error(`Invalid response`);return{items:s.payload.items}}async function f(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()),u(t,e.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload?.items||!s.payload.meta)throw Error(`Invalid response`);return s.payload}async function p(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;u(r,t?.provider);let s=r.toString(),c=await i(a(`/api/skills/marketplace/packages/${n}${s?`?${s}`:``}`),{cache:`no-store`});if(!c.ok)throw Error(await o(c));let l=(await c.json()).payload;if(!l?.name||!l.skillDocPreview||typeof l.skillDocPreview.name!=`string`||typeof l.skillDocPreview.description!=`string`||typeof l.skillDocPreview.bodyMarkdown!=`string`||typeof l.skillDocPreview.disableModelInvocation!=`boolean`||!l.skillDocPreview.metadata||typeof l.skillDocPreview.metadata!=`object`||typeof l.skillDocPreview.metadata.name!=`string`||typeof l.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return l}async function m(e){let t=await i(a(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`global`,...e})});if(!t.ok)throw Error(await o(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function h(e){let t=await i(a(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await o(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 g(){let e=await i(a(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function _(){let e=await i(a(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}var v=e(),y=t(),b=[{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 x(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 S(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 C(e){let t=(0,v.c)(9),{name:r,className:i}=e,a;t[0]===r?a=t[1]:(a=S(r),t[0]=r,t[1]=a);let o=a,s=b[x(r)%b.length],c;t[2]!==i||t[3]!==s.dark||t[4]!==s.light?(c=n(`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`,s.light,s.dark,i),t[2]=i,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,y.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}var w=`https://skillhub.cn`,T=`https://clawhub.ai`;function E(e){let t=e.trim();return t?`${w}/skills/${encodeURIComponent(t)}`:null}function D(e){let t=e.trim();return t?`${T}/${encodeURIComponent(t)}`:null}function O(e,t){return e===`skillhub`?E(t):e===`clawhub`?D(t):null}function k(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function j(e){return e.filter(e=>e.type!==`collision`)}function M(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 N(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}export{s as _,O as a,c,g as d,_ as f,l as g,m as h,k as i,d as l,h as m,M as n,N as o,f as p,A as r,C as s,j as t,p as u};
|
|
@@ -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"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{n as a}from"./locale-store-1urrBBCQ.js";import{t as o}from"./messages-DYFcjtmG.js";import{t as s}from"./electron-env-DH5wF8X8.js";import{Gt as c,Ht as l,Pu as u,Ut as d,Wt as f,gc as p,kc as m,na as h,vs as g}from"./index-CHgOG1aR.js";import{n as _,r as v}from"./settings-page-layout-DYelDcMV.js";import{r as y,t as b}from"./settings-form-section-Dg6chotg.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!s()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=o(a(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(f),[r,i]=(0,x.useState)(null),[s,p]=(0,x.useState)(!1),m=async t=>{if(!t){n(c({enabled:!1})),i(null);return}p(!0);try{let t=await l();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(c({enabled:!0})),i(await d(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{p(!1)}},h=e=>{n(c(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{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,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?m(t.target.checked):h({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){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 E(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 D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(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 k(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 A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{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 P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=o(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 I(e,t,n){let r=o(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 L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=a(e=>e.language),t=o(e),n=t.systemSettings,[c,l]=(0,x.useReducer)(h,L),{behavior:u,perms:d,loadError:f,permFeedback:A,permBusy:N,refreshing:R}=c,z=typeof window<`u`?window.electronAPI?.system:void 0,B=(0,x.useCallback)(async e=>{if(z){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{behavior:await z.getBehavior(),perms:await z.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:n.refreshDone}:{}}})}catch(t){l({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[z,n.refreshDone]),V=(0,x.useCallback)(async()=>{if(!(R||N)){l({type:`patch`,patch:{refreshing:!0}});try{await B({showRefreshFeedback:!0})}finally{l({type:`patch`,patch:{refreshing:!1}})}}},[B,N,R]);if((0,x.useEffect)(()=>{let e=new Set([n.refreshDone,n.openSettingsDone,n.openSettingsFailed,n.desktopNotify.testShown]);if(!A||!e.has(A))return;let t=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(t)},[A,n.openSettingsDone,n.openSettingsFailed,n.refreshDone,n.desktopNotify.testShown]),(0,x.useEffect)(()=>{s()&&z&&B()},[z,B]),!s()||!z)return(0,C.jsx)(w,{});let H=async e=>{try{let{behavior:t}=await z.setBehavior(e);l({type:`patch`,patch:{behavior:t}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},U=async e=>{if(!e){await H({notifyEnabled:!1});return}l({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(n.desktopNotify.testTitle,n.desktopNotify.testBody);if(e===`unsupported`){l({type:`patch`,patch:{permFeedback:n.notificationsFeedback.unsupported}});return}if(e===`denied`){l({type:`patch`,patch:{permFeedback:n.desktopNotify.denied}});return}if(e==="default"){l({type:`patch`,patch:{permFeedback:n.notificationsFeedback.default}});return}await H({notifyEnabled:!0}),l({type:`patch`,patch:{perms:await z.getPermissions()}}),l({type:`patch`,patch:{permFeedback:n.desktopNotify.testShown}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},W=async e=>{l({type:`patch`,patch:{permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{(await z.openPrivacy(e)).ok?l({type:`patch`,patch:{permFeedback:n.openSettingsDone}}):l({type:`patch`,patch:{permFeedback:n.openSettingsFailed}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},G=async()=>{l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await z.requestMicrophone(),t=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();l({type:`patch`,patch:{perms:await z.getPermissions()}}),l({type:`patch`,patch:{permFeedback:E(e,t,n.permFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},K=async()=>{if(z.requestAccessibility){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await z.requestAccessibility();l({type:`patch`,patch:{perms:await z.getPermissions()}}),l({type:`patch`,patch:{permFeedback:D(e,n.accessibilityFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(z.requestNotifications){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await z.requestNotifications();l({type:`patch`,patch:{perms:await z.getPermissions()}}),l({type:`patch`,patch:{permFeedback:O(e,n.notificationsFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},J=async()=>{if(z.requestScreen){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await z.requestScreen();l({type:`patch`,patch:{perms:await z.getPermissions()}}),l({type:`patch`,patch:{permFeedback:k(e,n.screenFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},Y=u?u.platform===`win32`?n.permissionsHintWin:u.platform===`linux`?n.permissionsHintLinux:u.platform===`darwin`?n.permissionsHintDarwin:n.permissionsHint:n.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:n.title}),f?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:f}):null,A?(0,C.jsx)(`p`,{className:i(`text-sm`,A===n.refreshDone||A===n.openSettingsDone||A===n.permFeedback.granted||A===n.permFeedback.alreadyGranted||A===n.accessibilityFeedback.granted||A===n.accessibilityFeedback.alreadyGranted||A===n.notificationsFeedback.granted||A===n.notificationsFeedback.alreadyGranted||A===n.screenFeedback.granted||A===n.screenFeedback.alreadyGranted||A===n.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:A}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(p,{className:`size-4 text-accent`,strokeWidth:1.75}),n.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.endpointToolsSettings.deviceAccess.background}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.endpointToolsSettings.deviceAccess.sleep})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u?.backgroundSupported,checked:!!u?.runInBackground,onChange:e=>void H({runInBackground:e.target.checked})})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.openAtLogin,onChange:e=>{H({openAtLogin:e.target.checked})}})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.keepAwakePreferred,onChange:e=>{H({keepAwakePreferred:e.target.checked})}})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u||N,checked:!!u?.notifyEnabled,onChange:e=>{U(e.target.checked)}})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.notifySoundEnabled,onChange:e=>{H({notifySoundEnabled:e.target.checked})}})]})]})]}),u&&d?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:Y}),u.platform===`darwin`&&!u.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:n.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:R||N,"aria-busy":R,className:i(`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`,g.press),onClick:()=>void V(),children:[(0,C.jsx)(m,{className:i(`size-3.5`,R&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),R?n.refreshing:n.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(u.platform).map(({key:t,pane:a})=>{let o=F(e,d[t]),s=n.perm[t],c=d[t]===`unknown`?I(e,t,u.platform):null;return s?(0,C.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,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${o.className}`,children:o.label}),c?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[t===`notifications`&&j(t,d[t],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,g.press),onClick:()=>void q(),children:n.requestAccess}):null,t===`microphone`&&j(t,d[t],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,g.press),onClick:()=>void G(),children:n.requestAccess}):null,t===`accessibility`&&j(t,d[t],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,g.press),onClick:()=>void K(),children:n.requestAccess}):null,t===`screen`&&j(t,d[t],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,g.press),onClick:()=>void J(),children:n.requestAccess}):null,M(t,d[t],u.platform)?(0,C.jsxs)(`button`,{type:`button`,className:i(`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`,g.press),onClick:()=>void W(a),children:[n.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},t):null})})]}):null]})}export{R 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"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{n as a}from"./locale-store-DlOv7896.js";import{t as o}from"./messages-Ls1Aaiqd.js";import{t as s}from"./electron-env-DH5wF8X8.js";import{Dc as c,Gt as l,Ht as u,Mu as d,Ut as f,Wt as p,ea as m,gs as h,mc as g}from"./index-ChIrvv3t.js";import{n as _,r as v}from"./settings-page-layout-DYelDcMV.js";import{r as y,t as b}from"./settings-form-section-wcAdCkK8.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!s()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=o(a(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(p),[r,i]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),m=async t=>{if(!t){n(l({enabled:!1})),i(null);return}c(!0);try{let t=await u();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(l({enabled:!0})),i(await f(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},h=e=>{n(l(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{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,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?m(t.target.checked):h({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){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 E(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 D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(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 k(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 A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{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 P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=o(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 I(e,t,n){let r=o(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 L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=a(e=>e.language),t=o(e),n=t.systemSettings,[l,u]=(0,x.useReducer)(m,L),{behavior:d,perms:f,loadError:p,permFeedback:A,permBusy:N,refreshing:R}=l,z=typeof window<`u`?window.electronAPI?.system:void 0,B=(0,x.useCallback)(async e=>{if(z){u({type:`patch`,patch:{loadError:null}});try{u({type:`patch`,patch:{behavior:await z.getBehavior(),perms:await z.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:n.refreshDone}:{}}})}catch(t){u({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[z,n.refreshDone]),V=(0,x.useCallback)(async()=>{if(!(R||N)){u({type:`patch`,patch:{refreshing:!0}});try{await B({showRefreshFeedback:!0})}finally{u({type:`patch`,patch:{refreshing:!1}})}}},[B,N,R]);if((0,x.useEffect)(()=>{let e=new Set([n.refreshDone,n.openSettingsDone,n.openSettingsFailed,n.desktopNotify.testShown]);if(!A||!e.has(A))return;let t=window.setTimeout(()=>{u({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(t)},[A,n.openSettingsDone,n.openSettingsFailed,n.refreshDone,n.desktopNotify.testShown]),(0,x.useEffect)(()=>{s()&&z&&B()},[z,B]),!s()||!z)return(0,C.jsx)(w,{});let H=async e=>{try{let{behavior:t}=await z.setBehavior(e);u({type:`patch`,patch:{behavior:t}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},U=async e=>{if(!e){await H({notifyEnabled:!1});return}u({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(n.desktopNotify.testTitle,n.desktopNotify.testBody);if(e===`unsupported`){u({type:`patch`,patch:{permFeedback:n.notificationsFeedback.unsupported}});return}if(e===`denied`){u({type:`patch`,patch:{permFeedback:n.desktopNotify.denied}});return}if(e==="default"){u({type:`patch`,patch:{permFeedback:n.notificationsFeedback.default}});return}await H({notifyEnabled:!0}),u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:n.desktopNotify.testShown}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}},W=async e=>{u({type:`patch`,patch:{permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{(await z.openPrivacy(e)).ok?u({type:`patch`,patch:{permFeedback:n.openSettingsDone}}):u({type:`patch`,patch:{permFeedback:n.openSettingsFailed}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},G=async()=>{u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestMicrophone(),t=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:E(e,t,n.permFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}},K=async()=>{if(z.requestAccessibility){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestAccessibility();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:D(e,n.accessibilityFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(z.requestNotifications){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestNotifications();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:O(e,n.notificationsFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},J=async()=>{if(z.requestScreen){u({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),u({type:`patch`,patch:{loadError:null}});try{let e=await z.requestScreen();u({type:`patch`,patch:{perms:await z.getPermissions()}}),u({type:`patch`,patch:{permFeedback:k(e,n.screenFeedback)}})}catch(e){u({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{u({type:`patch`,patch:{permBusy:!1}})}}},Y=d?d.platform===`win32`?n.permissionsHintWin:d.platform===`linux`?n.permissionsHintLinux:d.platform===`darwin`?n.permissionsHintDarwin:n.permissionsHint:n.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:n.title}),p?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:p}):null,A?(0,C.jsx)(`p`,{className:i(`text-sm`,A===n.refreshDone||A===n.openSettingsDone||A===n.permFeedback.granted||A===n.permFeedback.alreadyGranted||A===n.accessibilityFeedback.granted||A===n.accessibilityFeedback.alreadyGranted||A===n.notificationsFeedback.granted||A===n.notificationsFeedback.alreadyGranted||A===n.screenFeedback.granted||A===n.screenFeedback.alreadyGranted||A===n.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:A}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),n.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.endpointToolsSettings.deviceAccess.background}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.endpointToolsSettings.deviceAccess.sleep})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d?.backgroundSupported,checked:!!d?.runInBackground,onChange:e=>void H({runInBackground:e.target.checked})})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.openAtLogin,onChange:e=>{H({openAtLogin:e.target.checked})}})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.keepAwakePreferred,onChange:e=>{H({keepAwakePreferred:e.target.checked})}})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d||N,checked:!!d?.notifyEnabled,onChange:e=>{U(e.target.checked)}})]}),(0,C.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,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.notifySoundEnabled,onChange:e=>{H({notifySoundEnabled:e.target.checked})}})]})]})]}),d&&f?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:Y}),d.platform===`darwin`&&!d.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:n.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:R||N,"aria-busy":R,className:i(`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`,h.press),onClick:()=>void V(),children:[(0,C.jsx)(c,{className:i(`size-3.5`,R&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),R?n.refreshing:n.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(d.platform).map(({key:t,pane:a})=>{let o=F(e,f[t]),s=n.perm[t],c=f[t]===`unknown`?I(e,t,d.platform):null;return s?(0,C.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,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${o.className}`,children:o.label}),c?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[t===`notifications`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,h.press),onClick:()=>void q(),children:n.requestAccess}):null,t===`microphone`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,h.press),onClick:()=>void G(),children:n.requestAccess}):null,t===`accessibility`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,h.press),onClick:()=>void K(),children:n.requestAccess}):null,t===`screen`&&j(t,f[t],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:i(`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`,h.press),onClick:()=>void J(),children:n.requestAccess}):null,M(t,f[t],d.platform)?(0,C.jsxs)(`button`,{type:`button`,className:i(`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`,h.press),onClick:()=>void W(a),children:[n.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},t):null})})]}):null]})}export{R as SystemSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,h as o,p as s,t as c}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as l,r as u}from"./popover-select-DGmMQt4t.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./external-link-DjqjBmc3.js";import{d as p,p as m,t as h}from"./markdown-view-6oYdBahT.js";import{t as g}from"./message-square-fVE7Ghj1.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{c as ee,n as te}from"./locale-store-DlOv7896.js";import{i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./dist-BGTk37IG.js";import{t as y}from"./button-BA45yciM.js";import{t as b}from"./activity-store-B0BTIk9j.js";import{t as x}from"./skeleton-BwbyijEw.js";import{An as S,As as ce,Br as le,Bt as C,Di as w,Dn as ue,En as de,Es as fe,Fc as T,Fs as pe,Ma as E,Ms as D,Ns as me,On as he,P as ge,Ps as O,Rl as _e,Ru as k,Si as A,Ss as j,Tn as M,Ul as N,Vc as P,Xi as F,Yl as ve,_s as ye,ar as be,bs as xe,ca as Se,du as Ce,kn as we,ks as Te,mi as I,mo as Ee,n as De,pi as Oe,uu as ke,ys as Ae,zl as je,zs as Me}from"./index-ChIrvv3t.js";import{t as L}from"./date-picker-DXOvbHCr.js";import{t as R}from"./dependency-picker-BEnC-eS0.js";var z=r(),B=e(t(),1),V=i();function Ne({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function h(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await xe(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),b({tone:`success`,title:p?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,V.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),h()},children:[p?(0,V.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,V.jsx)(`p`,{children:e.reason}),(0,V.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(y,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void h(`approve`),children:n?`批准`:`Approve`}),(0,V.jsx)(y,{type:`button`,disabled:o||u,onClick:()=>void h(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,V.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),m.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,V.jsx)(y,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,V.jsx)(y,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}var Pe=e(n(),1);function Fe(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function Ie({uri:e,zh:t}){let[n,r]=(0,B.useState)(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``);async function p(){a(!0),u(``);try{let n=Fe(e,(await w()).payload.shares);r(n),s(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{a(!1)}}async function m(){if(!(!n||i)){a(!0),u(``);try{let e=await A(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{a(!1)}}}return(0,V.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(y,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),o&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,V.jsx)(y,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,V.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,V.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),o&&(0,V.jsx)(c,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function Le(e){let t=(0,z.c)(14),{evidence:n,projectId:r,sessionKey:i,language:a}=e,o=Oe(Re);if(!n.length)return null;let s=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,c;if(t[0]!==n||t[1]!==a||t[2]!==r||t[3]!==i||t[4]!==o){let e;t[6]!==a||t[7]!==r||t[8]!==i||t[9]!==o?(e=(e,t)=>{let n=e.uri?.trim(),s=n&&/^https?:\/\//i.test(n),c=n&&!s&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),l=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,V.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[s?(0,V.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(f,{className:`size-4 shrink-0`}),l]}):c&&(r||i)?(0,V.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,onClick:()=>o(n,null,r,i),children:[(0,V.jsx)(N,{className:`size-4 shrink-0`}),l]}):(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l}),s&&e.kind===`artifact`&&(0,V.jsx)(Ie,{uri:n,zh:a===`zh`},n),e.summary?(0,V.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:e.summary}):null,(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[6]=a,t[7]=r,t[8]=i,t[9]=o,t[10]=e):e=t[10],c=n.map(e),t[0]=n,t[1]=a,t[2]=r,t[3]=i,t[4]=o,t[5]=c}else c=t[5];let l;return t[11]!==s||t[12]!==c?(l=(0,V.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":s,children:c}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Re(e){return e.setPath}function ze(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Be(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function Ve(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function He(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(x,{className:`h-32 rounded-2xl`}),(0,V.jsx)(x,{className:`h-52 rounded-2xl`}),(0,V.jsx)(x,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ue(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function We(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Ge=[`backlog`,`ready`,`active`,`review`,`closed`],Ke=[`low`,`normal`,`high`,`critical`],qe=(0,B.memo)(function(e){let t=(0,z.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===c?m=t[6]:(m=(0,V.jsx)(`span`,{children:c}),t[5]=c,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=Ge.map(e=>(0,V.jsx)(u,{value:e,disabled:p(e),children:Ve(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),Je=(0,B.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let d;t[4]===a?d=t[5]:(d=Ke.map(e=>(0,V.jsx)(u,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==c||t[8]!==d||t[9]!==n?(f=(0,V.jsx)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:d}),t[6]=r,t[7]=c,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Ye=(0,B.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(L,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Xe=(0,B.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,V.jsx)(u,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(mt),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,V.jsxs)(l,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==c||t[15]!==m?(h=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16],h}),Ze=(0,B.memo)(function(e){let t=(0,z.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(ht),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,V.jsx)(R,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Qe=`xopc.taskDetail.chatPanelPercent`,$e=42;function et(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?$e:Math.min(r,Math.max(n,e))}function tt(){try{let e=Number(window.localStorage.getItem(Qe));return Number.isFinite(e)&&e>=30&&e<=60?e:$e}catch{return $e}}function nt(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.waits.some(e=>e.kind===`paused`)?`paused`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`ready`:e.operationalState}function rt(e){return e===`needsUser`||e===`blocked`?`bg-warning/10 text-warning`:e===`completed`?`bg-success-soft text-success`:e===`running`||e===`verifying`||e===`review`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function H(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(t===`passed`?d:t===`failed`?Ce:ke,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,V.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function it({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),s=a(),l=te(e=>e.language),u=ee(e=>e.sessionKey),_=(0,B.useMemo)(()=>pe(l),[l]),ne=Ee(e=>e.setPageHeader),re=Ee(e=>e.clearPageHeader),ie=I(e=>e.open),ae=I(e=>e.sessionKeyOverride),oe=I(e=>e.openForSession),se=be(e=>e.setOpen),{data:b,error:x,mutate:C,lastChange:w,conversationLoading:A,conversationError:N}=ye(e),[Ce,Oe]=(0,B.useState)(null),[ke,L]=(0,B.useState)(null),[R,z]=(0,B.useState)(()=>new Set),[Fe,Ie]=(0,B.useState)([]),[Re,Ve]=(0,B.useState)(null),[Ge,Ke]=(0,B.useState)([]),[it,U]=(0,B.useState)(!1),[at,ot]=(0,B.useState)(``),[st,W]=(0,B.useState)(!1),[ct,lt]=(0,B.useState)(``),[G,ut]=(0,B.useState)(tt),[dt,ft]=(0,B.useState)(!1),pt=(0,B.useRef)(null),mt=(0,B.useRef)(!1),ht=(0,B.useRef)(!1),gt=(0,B.useRef)(``),_t=(0,B.useRef)(null),vt=(0,B.useRef)(null),yt=(0,B.useRef)(null),bt=(0,B.useRef)(b),[xt,K]=(0,B.useState)(null),[St,Ct]=(0,B.useState)(null),[wt,Tt]=(0,B.useState)(!1),Et=(0,B.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),Dt=b?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,Ot=(0,B.useMemo)(()=>p(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]),kt=(0,B.useCallback)(e=>t===`modal`&&n?O(n,e):m(`/tasks/${encodeURIComponent(e)}`,Ot),[n,t,Ot]);bt.current=b;let q=(0,B.useCallback)((e,t)=>{z(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,B.useEffect)(()=>{L(null),K(null),U(!1),W(!1),Ct(null),Tt(!1)},[e]),(0,B.useEffect)(()=>{let e=!0;return Se().then(t=>{e&&Ke(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,B.useEffect)(()=>{if(!w||w.source===`user`)return;Ct(w);let e=window.setTimeout(()=>Ct(null),3500);return()=>window.clearTimeout(e)},[w]),(0,B.useEffect)(()=>{let t=b?.task.projectId,n=b?.dependencies??[];if(!t){yt.current=null,Ve(null),Ie(n);return}yt.current!==t&&(yt.current=t,Ve(null));let r=!0;return E(t).then(t=>{if(!r)return;Ve(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ie([...i.values()])}).catch(()=>{r&&Ie(n)}),()=>{r=!1}},[Dt,b?.task.projectId,e]);let J=(0,B.useCallback)(async(t,n=`command`)=>{let r=bt.current;if(r){q(n,!0),L(null);try{await C(await xe(e,t,r.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{q(n,!1)}}},[_.actionFailed,C,q,e]),Y=(0,B.useCallback)(async(t,n)=>{let r=bt.current;if(!r)return!1;n&&q(n,!0),L(null);try{return await C(ce(e,t,r.task.version),{optimisticData:Be(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(_.actionFailed),!1}finally{n&&q(n,!1)}},[_.actionFailed,C,q,e]),At=async()=>{if(!b)return;if(mt.current){mt.current=!1;return}let e=at.trim(),t=_t.current;if(ze(t,b.task.version,b.task.title,e)){K(`title`);return}if(!e||e===b.task.title){ot(b.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},jt=async()=>{if(!b)return;if(ht.current){ht.current=!1;return}let e=ct.trim(),t=vt.current;if(ze(t,b.task.version,b.task.body??``,e)){K(`description`);return}if(ct===gt.current||e===(b.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},Mt=(0,B.useCallback)(async e=>{let t=bt.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),Nt=(0,B.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),Pt=(0,B.useCallback)(e=>{Y({dueAt:We(e)},`dueAt`)},[Y]),Ft=(0,B.useCallback)(e=>{ut(e);try{window.localStorage.setItem(Qe,String(e))}catch{}},[]),It=(0,B.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=pt.current?.clientWidth??0;Ft(et(e.key===`Home`?$e:G+(e.key===`ArrowLeft`?2:-2),t))},[G,Ft]),Lt=(0,B.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=pt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),ft(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=et((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}ft(!1),Ft(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[G,Ft]),Rt=(0,B.useCallback)(async t=>{let n=bt.current;if(n){q(`dependencies`,!0),L(null);try{await C(await D(e,t,n.task.version),{revalidate:!1})}catch{L(_.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[_.dependencyUpdateFailed,C,q,e]),zt=(0,B.useCallback)(async t=>{let n=bt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),L(null);try{await C(await fe(e,t,n.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[_.actionFailed,C,q,e]),Bt=(0,B.useCallback)(async()=>{q(`delete`,!0),L(null);try{await j(e),r?r():s(Ot,{replace:!0})}catch(e){L(e instanceof Error?e.message:_.actionFailed)}finally{q(`delete`,!1)}},[_.actionFailed,s,r,Ot,q,e]);if((0,B.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,V.jsx)(c,{to:Ot,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,V.jsx)(k,{className:`size-4`})}),main:b?(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:Re?`${Re} / ${_.taskLabel}`:_.taskLabel}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:_.detailStatuses[nt(b)]})]}):null,end:(0,V.jsx)(`div`,{ref:Oe,className:`flex min-w-0 items-center justify-end`})}),re},[re,_.backToWork,_.detailStatuses,_.taskLabel,b,t,Re,Ot,ne]),x&&!b)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:_.taskNotFound});if(!b)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(He,{})});let Vt=b.waits[0],Ht=b.waits.find(e=>e.kind===`paused`),X=b.receipts[0],Ut=nt(b),Wt=_.detailStatuses[Ut],Gt=b.task.body?.trim()||b.task.contract?.objective.trim(),Kt=b.runs.find(e=>e.id===X?.runId)?.contractVersion===b.task.latestContractVersion?X:void 0,qt=Me(Kt),Jt=new Map(Kt?.verification.checks.map(e=>[e.criterion,e.status===`passed`&&!qt.has(e.criterion)?`unverified`:e.status])),Yt=b.allowedCommands.includes(`mark_ready`),Xt=b.allowedCommands.includes(`start`),Zt=b.allowedCommands.includes(`add_wait`),Qt=!Vt&&b.task.phase===`review`&&b.allowedCommands.includes(`close`),$t=b.allowedCommands.includes(`reopen`),Z=b.conversation.activeSessionKey,en=b.conversation.currentExecutorAgentId??b.task.delegateAgentId??b.task.ownerId,tn=Ge.find(e=>e.id===en),nn=!!(Z&&ie&&ae===Z),rn=b.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),an=b.task.contract?.acceptanceCriteria??[],on=an.filter(e=>Jt.get(e)===`passed`).length,sn=b.task.contract?.expectedOutputs??[],cn=b.task.contract?.constraints??[],ln=b.task.contract?.approvalRequired??[],un=b.task.contract?.assumptions??[],dn=b.task.contract?.risks??[],Q=(...e)=>!!St?.changedFields.some(t=>e.includes(t)),fn=b.allowedCommands.includes(`move`),$=R.has(`command`),pn=R.has(`delete`),mn=b.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),hn=mn!==void 0,gn=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Yt?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,V.jsx)(T,{className:`size-4`}),_.scheduleTask]}):null,Ht&&b.allowedCommands.includes(`resolve_wait`)?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Ht.id}),children:[(0,V.jsx)(T,{className:`size-4`}),_.resumeTask]}):null,!Vt&&Xt&&en?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:en}}),children:[(0,V.jsx)(T,{className:`size-4`}),_.runTask]}):null,Qt?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,V.jsx)(d,{className:`size-4`}),_.approveTask]}):null,$t?(0,V.jsxs)(y,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(T,{className:`size-4`}),_.reopenTask]}):null,!Ht&&Zt?(0,V.jsxs)(y,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(P,{className:`size-4`}),_.pauseTask]}):null,(0,V.jsxs)(he,{children:[(0,V.jsx)(S,{asChild:!0,children:(0,V.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||pn,"aria-label":_.moreActions,children:(0,V.jsx)(ve,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(ue,{children:(0,V.jsxs)(M,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[mn?(0,V.jsx)(de,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{q(`command`,!0),L(null),C(Ae(e,mn.id,mn.version),{revalidate:!1}).catch(()=>L(_.actionFailed)).finally(()=>q(`command`,!1))},children:_.cancelActiveRun}):null,mn?(0,V.jsx)(we,{className:`my-1 h-px bg-edge`}):null,b.task.phase===`closed`?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(de,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:_.cancelTask}),(0,V.jsx)(we,{className:`my-1 h-px bg-edge`})]}),(0,V.jsx)(de,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(hn){L(_.deleteActiveTaskBlocked);return}Tt(!0)},children:_.deleteTask})]})})]})]}),Z&&t!==`modal`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(y,{type:`button`,variant:`ghost`,className:v(`h-8 shrink-0 px-2 text-xs`,nn&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":nn,onClick:()=>{se(Z,!1),oe(Z)},children:[(0,V.jsx)(_e,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,V.jsx)(y,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,V.jsxs)(c,{to:me(e),children:[(0,V.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,V.jsxs)(`div`,{ref:pt,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${dt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[t===`page`&&Ce?(0,Pe.createPortal)(gn,Ce):null,(0,V.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,V.jsxs)(`header`,{className:v(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Re?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(je,{className:`size-3.5`,"aria-hidden":!0}),Re]}):null,(0,V.jsx)(`span`,{children:`/`}),(0,V.jsx)(`span`,{children:_.taskLabel}),(0,V.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-[11px] font-medium`,rt(Ut)),children:Wt}),(0,V.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,le(b.task.updatedAt,l))}),St?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:St.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),it?(0,V.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:at,onChange:e=>ot(e.target.value),onBlur:()=>void At(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),mt.current=!0,ot(b.task.title),U(!1),queueMicrotask(()=>{mt.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,V.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{_t.current={value:b.task.title,version:b.task.version},K(null),ot(b.task.title),U(!0)},children:(0,V.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:b.task.title})}),xt===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{ot(b.task.title),K(null),U(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:at.trim()}).then(e=>{e&&(K(null),U(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),ke?(0,V.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:ke}):null]}),b.attention.length>0?(0,V.jsxs)(`section`,{className:v(`mb-4 rounded-xl border border-warning/20 bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:rn?_.needsAttention:_.waitingStatus}),(0,V.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm leading-6 text-fg-muted`,children:b.attention.map((t,n)=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1`,children:t.summary}),t.kind===`input_required`||t.kind===`approval_required`?(0,V.jsx)(c,{className:`inline-flex min-h-11 items-center rounded-lg bg-surface-panel px-3 text-sm font-medium text-accent`,to:me(e),children:l===`zh`?t.kind===`approval_required`?`查看并决定`:`补充信息`:t.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${t.kind}-${n}`))})]}):null,b.task.phase!==`closed`&&!Ht&&b.waits.filter(e=>(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`).map(e=>(0,V.jsx)(Ne,{wait:e,detail:b,zh:l===`zh`,onUpdated:e=>{C(e,{revalidate:!1})}},e.id)),(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`main`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDescription}),st?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:ct,onChange:e=>lt(e.target.value),onBlur:()=>void jt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ht.current=!0,lt(b.task.body??b.task.contract?.objective??``),W(!1),queueMicrotask(()=>{ht.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=b.task.body??b.task.contract?.objective??``;gt.current=e,vt.current={value:b.task.body??``,version:b.task.version},K(null),lt(e),W(!0)},children:(0,V.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Gt&&Gt!==b.task.title?Gt:_.noTaskDescription})}),xt===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{lt(b.task.body??``),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:ct.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:_.successDefinition}),an.length>0?(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:_.criteriaProgress.replace(`{{verified}}`,String(on)).replace(`{{total}}`,String(an.length))}):null]}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:an,empty:_.noDefinition,verificationByCriterion:Jt})})]}),sn.length>0?(0,V.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:_.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:sn,empty:_.noDefinition})})]}):null,cn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:cn,empty:_.noDefinition})})]}):null,ln.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:ln,empty:_.noDefinition})})]}):null,un.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:un,empty:_.noDefinition})})]}):null,dn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:dn,empty:_.noDefinition})})]}):null]}),X?(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.latestResult}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?X.completionVerdict===`achieved`?`本次执行报告目标已达成,请结合下方验证依据验收。`:`这是阶段性结果,尚不能代表任务全部完成。`:X.completionVerdict===`achieved`?`The run reports the goal achieved. Review the evidence below.`:`This is a partial result; the task is not yet fully complete.`}),(0,V.jsx)(h,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[_.receiptStatuses[X.status],` · `,_.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.remainingWork}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(H,{items:X.remainingWork,empty:_.noRemainingWork})})]}):null,X.nextAction?(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_.nextAction}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(y,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void Te(X.runId,`helpful`),children:_.doneWell}),(0,V.jsx)(y,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void Te(X.runId,`not_helpful`),children:_.needsFix})]}),(0,V.jsx)(Le,{evidence:X.evidence,projectId:b.task.projectId,sessionKey:Z??void 0,language:l}),b.receipts.length>1?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.executionHistory.replace(`{{count}}`,String(b.receipts.length-1))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:b.receipts.slice(1).map(e=>(0,V.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:_.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,b.context.length>0?(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:b.context.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(qe,{value:b.task.phase,disabled:R.has(`phase`),canMove:fn,canApprove:Qt,canReopen:$t,language:l,label:_.taskPhase,onChange:Mt}),(0,V.jsx)(Je,{value:b.task.priority,disabled:R.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:Nt}),(0,V.jsx)(Ye,{value:Ue(b.task.dueAt),disabled:R.has(`dueAt`),label:_.dueDate,onChange:Pt}),(0,V.jsx)(Xe,{value:b.conversation.currentExecutorAgentId??``,disabled:R.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ge,onChange:zt})]})]}),(0,V.jsxs)(`section`,{className:v(`p-5`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskRelations}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,V.jsx)(Ze,{candidates:Fe,selected:b.dependencies,disabled:R.has(`dependencies`),labels:Et,getTaskHref:kt,onChange:Rt})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),b.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:b.dependents.map(e=>(0,V.jsx)(c,{to:kt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:e.title},e.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(G),tabIndex:0,onPointerDown:Lt,onKeyDown:It,onDoubleClick:()=>Ft($e),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${dt?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[en?(0,V.jsx)(ge,{agentId:en,avatar:tn?.avatar,size:28,className:`shrink-0`}):null,(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,V.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[tn?.name??en??_.unassigned,` · `,Wt]})]})]})}),t===`modal`?gn:null]}),Z?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(De,{embedded:!0,sessionKey:Z,taskId:e})}):A?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):N?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:N instanceof Error?N.message:String(N)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(g,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,V.jsx)(F,{open:wt,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,b.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{Tt(!1),Bt()},onCancel:()=>Tt(!1)})]})}function U(){let e=(0,z.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(it,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function at(e){let t=(0,z.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(pt),{data:o}=ye(n),s=o?.conversation.activeSessionKey??null,l=I(ft),u=I(dt),d=I(ut),p=I(G),m=be(lt),h=Oe(ct),g=Oe(W),ee=l?u:0,y;t[0]!==i||t[1]!==g?(y=e=>{e||(g(null),i())},t[0]=i,t[1]=g,t[2]=y):y=t[2];let b=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==g?(x=()=>{g(null),i()},t[3]=i,t[4]=g,t[5]=x):x=t[5];let S;t[6]!==b||t[7]!==x?(S=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":b,onClick:x}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let ce=l?`true`:`false`,le=`${ee/2}px`,w=`${ee}px`,ue;t[9]!==le||t[10]!==w?(ue={"--task-detail-workspace-offset":le,"--task-detail-workspace-width":w},t[9]=le,t[10]=w,t[11]=ue):ue=t[11];let de=ue,fe=a===`zh`?`任务详情`:`Task details`,T;t[12]===fe?T=t[13]:(T=(0,V.jsx)(oe,{className:`font-medium text-fg`,children:fe}),t[12]=fe,t[13]=T);let pe=a===`zh`?`查看并操作任务详情`:`View and manage task details`,E;t[14]===pe?E=t[15]:(E=(0,V.jsx)(ne,{className:`sr-only`,children:pe}),t[14]=pe,t[15]=E);let D;t[16]!==s||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==l||t[22]!==d?(D=s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:v(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===s,onClick:()=>{m(s,!1),p(s)},children:(0,V.jsx)(_e,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(c,{to:me(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=l,t[22]=d,t[23]=D):D=t[23];let he=a===`zh`?`关闭任务详情`:`Close task details`,ge;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,V.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[24]=ge):ge=t[24];let O;t[25]===he?O=t[26]:(O=(0,V.jsx)(re,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":he,children:ge}),t[25]=he,t[26]=O);let k;t[27]!==D||t[28]!==O?(k=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[D,O]}),t[27]=D,t[28]=O,t[29]=k):k=t[29];let A;t[30]!==T||t[31]!==E||t[32]!==k?(A=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[T,E,k]}),t[30]=T,t[31]=E,t[32]=k,t[33]=A):A=t[33];let j;t[34]!==i||t[35]!==g?(j=()=>{g(null),i()},t[34]=i,t[35]=g,t[36]=j):j=t[36];let M;t[37]!==r||t[38]!==j||t[39]!==n?(M=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(it,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:j})}),t[37]=r,t[38]=j,t[39]=n,t[40]=M):M=t[40];let N;t[41]!==A||t[42]!==M||t[43]!==ce||t[44]!==de?(N=(0,V.jsxs)(ae,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":ce,style:de,onEscapeKeyDown:st,onInteractOutside:ot,children:[A,M]}),t[41]=A,t[42]=M,t[43]=ce,t[44]=de,t[45]=N):N=t[45];let P;t[46]!==h||t[47]!==l||t[48]!==u||t[49]!==d?(P=h?(0,V.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,V.jsx)(C,{allowOutsideChat:!0,sessionKey:d??void 0})}):null,t[46]=h,t[47]=l,t[48]=u,t[49]=d,t[50]=P):P=t[50];let F;t[51]!==N||t[52]!==P||t[53]!==S?(F=(0,V.jsxs)(ie,{children:[S,N,P]}),t[51]=N,t[52]=P,t[53]=S,t[54]=F):F=t[54];let ve;return t[55]!==y||t[56]!==F?(ve=(0,V.jsx)(se,{modal:!1,open:!0,onOpenChange:y,children:F}),t[55]=y,t[56]=F,t[57]=ve):ve=t[57],ve}function ot(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function st(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function W(e){return e.setPath}function ct(e){return e.path}function lt(e){return e.setOpen}function G(e){return e.openForSession}function ut(e){return e.sessionKeyOverride}function dt(e){return e.widthPx}function ft(e){return e.open}function pt(e){return e.language}function mt(e){return(0,V.jsx)(u,{value:e.id,children:e.name||e.id},e.id)}function ht(e){return e.id}export{at as TaskDetailModal,U as TaskDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-DlOv7896.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#f7f8fa`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#14171c`,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==="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{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"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,c as l,i as u,n as d,r as f}from"./locale-store-1urrBBCQ.js";import{t as ee}from"./messages-DYFcjtmG.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as te}from"./button-BA45yciM.js";import{n as m,r as h}from"./gateway-config-swr-Cpmyrr6j.js";import{t as g}from"./skeleton-BwbyijEw.js";import{Li as _,Pc as v,bo as y,jo as b}from"./index-CHgOG1aR.js";import{n as ne,t as re}from"./settings-form-section-Dg6chotg.js";var x=e(t(),1),S=n(),C=r();function w(e){let t=(0,S.c)(10),{language:n,label:r,section:a,className:o}=e,c;t[0]!==n||t[1]!==a?(c=y(n,a),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=s(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;return t[6]!==r||t[7]!==c||t[8]!==l?(d=(0,C.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:l,children:[r,u]}),t[6]=r,t[7]=c,t[8]=l,t[9]=d):d=t[9],d}async function T(){let e=await u(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function E(e=`serve`){let t=await u(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function D(){let e=await u(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var O=`https://tailscale.com/download`;function k(e){let t=(0,S.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function A({embedded:e=!1}){let t=d(e=>e.language),n=ee(t).remoteAccess.tailscale,r=(0,x.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:ee(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!l(e=>e.sessionKey),[s,c]=(0,x.useState)(!1),[u,f]=(0,x.useState)(null),{data:m,mutate:h,isLoading:y}=p(i?`exposure-status`:null,T,{refreshInterval:3e4}),b=m?.tailscale.hostname,S=m?.tailscale.active===!0,O=m?.tailscale.cliAvailable!==!1,A=b?`https://${b}/`:null,ie=(0,x.useCallback)(async()=>{c(!0),f(null);try{await E(`serve`),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]),ae=(0,x.useCallback)(async()=>{c(!0),f(null);try{await D(),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]);if(!i)return null;let j=(0,C.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,C.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,C.jsxs)(`span`,{children:[n.stepInstallBefore,(0,C.jsx)(k,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,C.jsx)(`span`,{children:n.stepEnable})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,C.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&m?.tailscale.cliAvailable===!1?(0,C.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,C.jsx)(k,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,y&&!m?(0,C.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,C.jsx)(g,{className:`h-20 rounded-lg`}),(0,C.jsx)(g,{className:`h-20 rounded-lg`})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(re,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),A?(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(_,{text:A,labels:r})}):null,u?(0,C.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,C.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,C.jsxs)(te,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void ae(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,C.jsxs)(te,{type:`button`,disabled:s||!O,onClick:()=>void ie(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,C.jsx)(v,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,C.jsx)(w,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?j:(0,C.jsxs)(re,{children:[(0,C.jsx)(ne,{icon:a,title:n.title,subtitle:n.subtitle}),j]})}async function ie(e){let t=await u(f(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ae(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function j(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function oe(){return(0,x.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||j(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function se(){return s(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function M(){let e=(0,S.c)(85),t=d(ue),n;e[0]===t?n=e[1]:(n=ee(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!l(le),c=oe(),u=h(i).data?.payload?.config,f;e[2]===u?f=e[3]:(f=ce(u),e[2]=u,e[3]=f);let p=f,[g,_]=(0,x.useState)(``),v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={busy:!1,result:null},e[4]=v):v=e[4];let[y,b]=(0,x.useState)(v),w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w={busy:!1,error:null},e[5]=w):w=e[5];let[T,E]=(0,x.useState)(w),D,O;e[6]!==p||e[7]!==c||e[8]!==g?(D=()=>{g||(p?_(p):c&&_(c))},O=[p,c,g],e[6]=p,e[7]=c,e[8]=g,e[9]=D,e[10]=O):(D=e[9],O=e[10]),(0,x.useEffect)(D,O);let k;bb0:{let t;e[11]===g?t=e[12]:(t=g.trim(),e[11]=g,e[12]=t);let n=t;if(n){k=n;break bb0}k=p??c??``}let A=k,j=!p&&!!c&&A===c,M;e[13]!==g||e[14]!==A?(M=async()=>{let e=g.trim()||A;if(e){b({busy:!0,result:null});try{b({busy:!1,result:await ie(e)})}catch(e){let t=e;b({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=g,e[14]=A,e[15]=M):M=e[15];let fe=M,N;e[16]===A?N=e[17]:(N=async()=>{let e=A.trim();if(e){E({busy:!0,error:null});try{await ae(e),await m(),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=A,e[17]=N);let pe=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{E({busy:!0,error:null});try{await ae(null),await m(),_(``),b({busy:!1,result:null}),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,C.jsx)(ne,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,C.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=s(se(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{_(e.target.value),b({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==g||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,C.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:g,onChange:R}),e[26]=g,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===fe?B=e[31]:(B=()=>void fe(),e[30]=fe,e[31]=B);let V;e[32]!==g||e[33]!==y.busy?(V=y.busy||!g.trim(),e[32]=g,e[33]=y.busy,e[34]=V):V=e[34];let H;e[35]===y.busy?H=e[36]:(H=y.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=y.busy,e[36]=H);let he=y.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,C.jsxs)(te,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==c||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&c?(0,C.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,C.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:c}),(0,C.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=c,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==y.result||e[53]!==r.probeStatus?(q=y.result?(0,C.jsx)(de,{result:y.result,labels:r.probeStatus}):null,e[52]=y.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==A||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==T.busy?(J=A&&p!==A?(0,C.jsxs)(te,{type:`button`,onClick:()=>void pe(),disabled:T.busy,children:[T.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,T.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=A,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=T.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==T.busy?(Y=p?(0,C.jsx)(te,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:T.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=T.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===T.error?Z=e[70]:(Z=T.error?(0,C.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:T.error}):null,e[69]=T.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,C.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,C.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,C.jsxs)(re,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function le(e){return e.sessionKey}function ue(e){return e.language}function de(e){let t=(0,S.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,C.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,C.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,C.jsxs)(C.Fragment,{children:[` · `,(0,C.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,C.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,C.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,C.jsxs)(C.Fragment,{children:[` — `,(0,C.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,C.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function fe(){return(await c(f(`/api/devices`))).devices}async function N(){let e=await c(f(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function pe(e){try{return{kind:`ready`,setup:(await c(f(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function P(e){return c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function me(e){await c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function F(e,t){await c(f(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function I(e){await c(f(`/api/devices/${encodeURIComponent(e)}`),{method:`DELETE`})}async function L(){let e=await u(f(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var R=`https://console.xopc.ai/access/client`;function z(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.error;if(!n||typeof n!=`object`)return;let r=n.code;return typeof r==`string`?r:void 0}function B(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(z(e)??``)}async function V(){return c(f(`/api/tunnel/status`))}async function H(){await c(f(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function he(){await c(f(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function U(){return c(f(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function W(e){return c(f(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function G(){let e=(await c(f(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function K(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{w as S,P as _,H as a,A as b,W as c,me as d,pe as f,N as g,fe as h,he as i,z as l,L as m,V as n,G as o,F as p,K as r,U as s,R as t,B as u,I as v,T as x,M as y};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,c as l,i as u,n as d,r as f}from"./locale-store-DlOv7896.js";import{t as ee}from"./messages-Ls1Aaiqd.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as te}from"./button-BA45yciM.js";import{n as m,r as h}from"./gateway-config-swr-G2lQt7Ak.js";import{t as g}from"./skeleton-BwbyijEw.js";import{Fi as _,Mc as v,ko as y,vo as b}from"./index-ChIrvv3t.js";import{n as ne,t as re}from"./settings-form-section-wcAdCkK8.js";var x=e(t(),1),S=n(),C=r();function w(e){let t=(0,S.c)(10),{language:n,label:r,section:a,className:o}=e,c;t[0]!==n||t[1]!==a?(c=b(n,a),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=s(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;return t[6]!==r||t[7]!==c||t[8]!==l?(d=(0,C.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:l,children:[r,u]}),t[6]=r,t[7]=c,t[8]=l,t[9]=d):d=t[9],d}async function T(){let e=await u(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function E(e=`serve`){let t=await u(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function D(){let e=await u(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var O=`https://tailscale.com/download`;function k(e){let t=(0,S.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,C.jsx)(`a`,{href:O,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function A({embedded:e=!1}){let t=d(e=>e.language),n=ee(t).remoteAccess.tailscale,r=(0,x.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:ee(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!l(e=>e.sessionKey),[s,c]=(0,x.useState)(!1),[u,f]=(0,x.useState)(null),{data:m,mutate:h,isLoading:y}=p(i?`exposure-status`:null,T,{refreshInterval:3e4}),b=m?.tailscale.hostname,S=m?.tailscale.active===!0,O=m?.tailscale.cliAvailable!==!1,A=b?`https://${b}/`:null,ie=(0,x.useCallback)(async()=>{c(!0),f(null);try{await E(`serve`),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]),ae=(0,x.useCallback)(async()=>{c(!0),f(null);try{await D(),await h()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[h]);if(!i)return null;let j=(0,C.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,C.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,C.jsxs)(`span`,{children:[n.stepInstallBefore,(0,C.jsx)(k,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,C.jsx)(`span`,{children:n.stepEnable})]}),(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,C.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&m?.tailscale.cliAvailable===!1?(0,C.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,C.jsx)(k,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,y&&!m?(0,C.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,C.jsx)(g,{className:`h-20 rounded-lg`}),(0,C.jsx)(g,{className:`h-20 rounded-lg`})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(re,{children:[(0,C.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S?n.statusActive:n.statusOff}),A?(0,C.jsx)(`div`,{className:`mt-3`,children:(0,C.jsx)(_,{text:A,labels:r})}):null,u?(0,C.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,C.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:S?(0,C.jsxs)(te,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void ae(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,C.jsxs)(te,{type:`button`,disabled:s||!O,onClick:()=>void ie(),children:[s?(0,C.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,C.jsx)(v,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,C.jsx)(w,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?j:(0,C.jsxs)(re,{children:[(0,C.jsx)(ne,{icon:a,title:n.title,subtitle:n.subtitle}),j]})}async function ie(e){let t=await u(f(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ae(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function j(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function oe(){return(0,x.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||j(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function se(){return s(`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 ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function M(){let e=(0,S.c)(85),t=d(ue),n;e[0]===t?n=e[1]:(n=ee(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!l(le),c=oe(),u=h(i).data?.payload?.config,f;e[2]===u?f=e[3]:(f=ce(u),e[2]=u,e[3]=f);let p=f,[g,_]=(0,x.useState)(``),v;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(v={busy:!1,result:null},e[4]=v):v=e[4];let[y,b]=(0,x.useState)(v),w;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(w={busy:!1,error:null},e[5]=w):w=e[5];let[T,E]=(0,x.useState)(w),D,O;e[6]!==p||e[7]!==c||e[8]!==g?(D=()=>{g||(p?_(p):c&&_(c))},O=[p,c,g],e[6]=p,e[7]=c,e[8]=g,e[9]=D,e[10]=O):(D=e[9],O=e[10]),(0,x.useEffect)(D,O);let k;bb0:{let t;e[11]===g?t=e[12]:(t=g.trim(),e[11]=g,e[12]=t);let n=t;if(n){k=n;break bb0}k=p??c??``}let A=k,j=!p&&!!c&&A===c,M;e[13]!==g||e[14]!==A?(M=async()=>{let e=g.trim()||A;if(e){b({busy:!0,result:null});try{b({busy:!1,result:await ie(e)})}catch(e){let t=e;b({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=g,e[14]=A,e[15]=M):M=e[15];let fe=M,N;e[16]===A?N=e[17]:(N=async()=>{let e=A.trim();if(e){E({busy:!0,error:null});try{await ae(e),await m(),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=A,e[17]=N);let pe=N,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{E({busy:!0,error:null});try{await ae(null),await m(),_(``),b({busy:!1,result:null}),E({busy:!1,error:null})}catch(e){let t=e;E({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,C.jsx)(ne,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,C.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=s(se(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{_(e.target.value),b({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==g||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,C.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:g,onChange:R}),e[26]=g,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===fe?B=e[31]:(B=()=>void fe(),e[30]=fe,e[31]=B);let V;e[32]!==g||e[33]!==y.busy?(V=y.busy||!g.trim(),e[32]=g,e[33]=y.busy,e[34]=V):V=e[34];let H;e[35]===y.busy?H=e[36]:(H=y.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=y.busy,e[36]=H);let he=y.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,C.jsxs)(te,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,C.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==c||e[48]!==j||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=j&&c?(0,C.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,C.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:c}),(0,C.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=c,e[48]=j,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==y.result||e[53]!==r.probeStatus?(q=y.result?(0,C.jsx)(de,{result:y.result,labels:r.probeStatus}):null,e[52]=y.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==A||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==T.busy?(J=A&&p!==A?(0,C.jsxs)(te,{type:`button`,onClick:()=>void pe(),disabled:T.busy,children:[T.busy?(0,C.jsx)(o,{className:`size-3.5 animate-spin`}):null,T.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=A,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=T.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==T.busy?(Y=p?(0,C.jsx)(te,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:T.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=T.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===T.error?Z=e[70]:(Z=T.error?(0,C.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:T.error}):null,e[69]=T.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,C.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,C.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,C.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,C.jsxs)(re,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function le(e){return e.sessionKey}function ue(e){return e.language}function de(e){let t=(0,S.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,C.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,C.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,C.jsxs)(C.Fragment,{children:[` · `,(0,C.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,C.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,C.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,C.jsxs)(C.Fragment,{children:[` — `,(0,C.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,C.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function fe(){return(await c(f(`/api/devices`))).devices}async function N(){let e=await c(f(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function pe(e){try{return{kind:`ready`,setup:(await c(f(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function P(e){return c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function me(e){await c(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function F(e,t){await c(f(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function I(e){await c(f(`/api/devices/${encodeURIComponent(e)}`),{method:`DELETE`})}async function L(){let e=await u(f(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var R=`https://console.xopc.ai/access/client`;function z(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.error;if(!n||typeof n!=`object`)return;let r=n.code;return typeof r==`string`?r:void 0}function B(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(z(e)??``)}async function V(){return c(f(`/api/tunnel/status`))}async function H(){await c(f(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function he(){await c(f(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function U(){return c(f(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function W(e){return c(f(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function G(){let e=(await c(f(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function K(e){await c(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{w as S,P as _,H as a,A as b,W as c,me as d,pe as f,N as g,fe as h,he as i,z as l,L as m,V as n,G as o,F as p,K as r,U as s,R as t,B as u,I as v,T as x,M as y};
|
package/dist/gateway/static/root/assets/{use-autosave-CkVlrFk1.js → use-autosave-BSyxRHt2.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-DlOv7896.js";import{_u as c}from"./index-ChIrvv3t.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`;if(n===`idle`)return null;let m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:``,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),(0,p.useEffect)(()=>{if(s!==`saved`)return;let e=window.setTimeout(()=>c(`idle`),1600);return()=>window.clearTimeout(e)},[s]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
|