@xopcai/xopc 0.0.157 → 0.0.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/dashscope/src/image-generation-provider.js +1 -1
- package/dist/extensions/fal/src/image-generation-provider.js +1 -1
- package/dist/extensions/google/src/image-generation-provider.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{action-boundary-settings-panel-zQ_w0sPl.js → action-boundary-settings-panel-CaRK2vIy.js} +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CddlQHam.js → activity-store-C-57rvkX.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DOfTopIk.js → agent-avatar-dicebear-BeVf03hx.js} +1 -1
- package/dist/gateway/static/root/assets/agents-P05C4A-3.js +2 -0
- package/dist/gateway/static/root/assets/{api-NUlcaaV9.js → api-BjcBIV2O.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-J0-z_uc1.js → app-management-settings-panel-BG2ulMYw.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CMaQOx2C.js → appearance-settings-0Kjenr2T.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DANGrBpN.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BVwE70GV.js → archive-plugin-ChiNnH1e.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-aj5U56K9.js → attachment-load-pbBlQR-g.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CKz8rxAb.js → automation-suggestion-card-CTZDOyDy.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BXfGL_cm.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Ie6owbEw.js → binary-plugins-BeZGzpGF.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BaDrd5GJ.js → block-editor-BnDmhN5Z.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-534luV0B.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BjO4YD-O.js → capability-presets-api-Ii36j_7v.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-bwezWQpF.js → capability-presets-settings-panel-Cl3dw4yh.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-BisDU_DH.js → channel-recipient-api-CFqrSi5K.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-M91zFJVi.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-vooEF4lG.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-DGjjzBIH.js → connector-logo-CiLxuZ8S.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CV5UulW6.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CoQ4Edck.js → desktop-pet-Cil2eSpW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings--sjUYeNX.js → desktop-pet-settings-DwsC6l5F.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CpmfFDx3.js → directory-picker-path-field-CC2VL5Mc.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-D7rRROE7.js → dreaming-settings-KY7ZfVsy.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-BzqW3ssG.js → extension-debug-page-C8KBeucs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CKDbBzVR.js → extension-page-CV-5Kcyk.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DjNMSdRz.js → extension-settings-page-DvUtDrAu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CUEAZEld.js → gateway-config-api-DXfVeJLc.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BpJ0v56l.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CbMPgpHX.js → gateway-startup-retry-cxQ94qMm.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-lMHD-2CX.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-yPmF-G7b.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-C-Vq8VR9.js → goals-config-api-P8VhLqYF.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BHTCKobG.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DVrTDWYS.js → goals-settings-DHXyaH_O.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Dv8qA4E7.js → heartbeat-settings-CNckP_Dv.js} +1 -1
- package/dist/gateway/static/root/assets/index-BgZhEOkN.css +1 -0
- package/dist/gateway/static/root/assets/{index-DHRxn7Sy.js → index-BuqGh2SW.js} +65 -65
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DEKtMZbg.js → keyboard-shortcuts-settings-jXmv1RVX.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-zpp_wciE.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DQT2lZk7.js → local-apps-page-Cs5LKjtc.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-C_M71MK9.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-B4CRYqYR.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-Cp6NxQJr.js → markdown-split-BFqeSNte.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dv1cQK2J.js → media-plugins-Cc8379gq.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-Bwu1tG3T.js → messages-BuT0SR1R.js} +4 -4
- package/dist/gateway/static/root/assets/models-hub-panel-1hdoAoB_.js +2 -0
- package/dist/gateway/static/root/assets/{notes-page-CePZ2we1.js → notes-page-DlGU4ipo.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DQEAZTA5.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-C1jBfKTZ.js → page-tabs-kFOswGlG.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cl9anbg0.js → preview-open-alternatives-CvjuvABg.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Bp9bC7A6.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-RNorFXTw.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BqRTcM_6.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-CWu_o1ta.js → save-bar-controls-DwrD7ODx.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DuZbqL7X.js → schedule-field-Ba4WzTmE.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Bixut-2d.js → schema-form-DvydL8eF.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B2EfW1cm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CklL85T4.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-C_7lCtCp.js → settings-collapsible-section-LaQqGGej.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-D0DPTbO0.js → settings-form-section-DruI__qO.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-tN-9u8dj.js → settings-loading-skeleton-UvA-eDhF.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C2L9g3kd.js → settings-page-5oCGSebm.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CBUOPmx_.js → settings-page-layout-DG-XMIPu.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D3my1HgB.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BiSh0nLu.js → share-preview-page-FLVeTrRt.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DVxgjrsP.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-Bcu58ZaF.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CDd-84FE.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-h7uqbQ-n.js → system-settings-panel-CeK93xVi.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DjYRaF0J.js → theme-store-C8ohIHhw.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BkqBD32C.js → typed-models-lib-D1Lr2gG0.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DiWtF12K.js → use-channel-catalog-BWzou5ar.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-1OyJnTyR.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-C4770AsA.js → voice-api-key-field-B2ncRwHS.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BZlY4PZL.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DPXMrneY.js +1 -0
- package/dist/gateway/static/root/assets/work-page-CTERoqyv.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-Bynqe4kV.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-CLgsnqFQ.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.js +14 -0
- package/dist/src/agent/image/generation/openai-compatible-image-provider.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +10 -3
- package/dist/src/agent/tools/send-media.js +20 -70
- package/dist/src/agent/tools/tool-media.d.ts +9 -0
- package/dist/src/agent/tools/tool-media.js +58 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/connectors/catalog.js +2 -3
- package/dist/src/connectors/composio-catalog.d.ts +11 -1
- package/dist/src/connectors/composio-catalog.js +37 -7
- package/dist/src/connectors/composio.js +2 -1
- package/dist/src/gateway/agent-run-relay.d.ts +2 -0
- package/dist/src/gateway/agent-run-relay.js +114 -14
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.d.ts +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +27 -42
- package/dist/src/gateway/chat-stream/thinking-delta-coalescer.d.ts +7 -0
- package/dist/src/gateway/chat-stream/thinking-delta-coalescer.js +103 -0
- package/dist/src/gateway/hono/routes/connectors.js +10 -22
- package/dist/src/gateway/hono/sse.d.ts +1 -1
- package/dist/src/gateway/hono/sse.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +5 -1
- package/dist/src/media/session-references.js +9 -6
- package/dist/src/session/client-history.d.ts +1 -0
- package/dist/src/session/client-history.js +56 -12
- package/dist/src/session/types.d.ts +1 -0
- package/dist/src/storage/sqlite/connector-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/connector-repository.js +12 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-RZNd9xMI.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BOeTZgdL.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-wYN1N-Il.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DD3djQtX.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Bohv9YRy.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-h3VHD5Uq.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-LIAkMlN-.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-h1wWBrxD.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-xfO0R5Bx.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CVVKF2hY.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-W666NFIU.js +0 -2
- package/dist/gateway/static/root/assets/index-gpwk8Nro.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-y5WmNSyZ.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-d9Cylz62.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DMQaC4Jn.js +0 -7
- package/dist/gateway/static/root/assets/models-hub-panel-CoYDJvX_.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-C9B-7EsK.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DG_P8S7e.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-C1pro-bG.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DDj6t0SQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C1aZFTTX.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CwRP1Nsl.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DFjG5i48.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bh2T05Hp.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ppRtNzpM.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Dnw1xKKm.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-09T5O8lO.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-D__GQy1R.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-CAIgG4im.js +0 -1
- package/dist/gateway/static/root/assets/work-page-CkZvIUpT.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-qqixrSRL.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-THxdPWzb.js +0 -11
- package/dist/src/connectors/registries/modelscope.d.ts +0 -2
- package/dist/src/connectors/registries/modelscope.js +0 -228
- package/dist/src/connectors/registries/official-mcp.d.ts +0 -2
- package/dist/src/connectors/registries/official-mcp.js +0 -140
- package/dist/src/connectors/registries/search.d.ts +0 -12
- package/dist/src/connectors/registries/search.js +0 -87
- package/dist/src/connectors/registries/smithery.d.ts +0 -2
- package/dist/src/connectors/registries/smithery.js +0 -97
- package/dist/src/connectors/registries/types.d.ts +0 -20
- package/dist/src/connectors/registries/types.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{c as a,d as o,l as s}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as c}from"./cn-BQ_8x0bT.js";import{t as l}from"./circle-alert-RzVebuX2.js";import{t as u}from"./messages-Bwu1tG3T.js";import{l as d,n as f,o as p,r as m}from"./locale-store-d9Cylz62.js";import{t as h}from"./config-reload-event-Bjh2zoKp.js";import{$l as g,Ao as _,Bc as v,Dl as y,Fo as b,Hs as x,Io as S,Ms as C,No as w,Oo as T,Po as E,Wo as D,Yi as O,Zl as k,ei as A,eu as j,gc as M,hs as N,jo as P,js as F,kl as I,ko as L,ls as ee,nc as R,qi as z,rl as B,sa as V,ti as H,ys as U}from"./index-DHRxn7Sy.js";import{t as W}from"./page-tabs-C1jBfKTZ.js";import{t as te}from"./skill-reload-api-ppRtNzpM.js";var ne=n(),G=e(t(),1),K=r(),re=(0,G.memo)(function(e){let t=(0,ne.c)(23),{loading:n,onReloadClick:r,searchQuery:i,setSearchQuery:a,mainTab:o,sk:s,setPendingFile:c,setInstallOpen:l}=e,u;t[0]!==n||t[1]!==r||t[2]!==s.reloadDiskAria||t[3]!==s.reloadRuntime?(u=(0,K.jsx)(V,{className:`size-9 shrink-0 p-0`,loading:n,label:s.reloadDiskAria,title:s.reloadRuntime,onClick:r}),t[0]=n,t[1]=r,t[2]=s.reloadDiskAria,t[3]=s.reloadRuntime,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(R,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=d):d=t[5];let f;t[6]===a?f=t[7]:(f=e=>a(e.target.value),t[6]=a,t[7]=f);let p=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,m;t[8]!==i||t[9]!==f||t[10]!==p?(m=(0,K.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,K.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:f,placeholder:p,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[8]=i,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==l||t[13]!==c?(h=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,K.jsx)(M,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=g):g=t[15];let _;t[16]!==s.installCta||t[17]!==h?(_=(0,K.jsxs)(N,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:h,children:[g,s.installCta]}),t[16]=s.installCta,t[17]=h,t[18]=_):_=t[18];let v;return t[19]!==u||t[20]!==m||t[21]!==_?(v=(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,m,_]}),t[19]=u,t[20]=m,t[21]=_,t[22]=v):v=t[22],v}),q=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function J(){let e=(0,ne.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:c(`h-4 min-w-0 flex-1`,q)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,K.jsx)(`div`,{className:c(`size-8 shrink-0 rounded-lg`,q)}),(0,K.jsx)(`div`,{className:c(`h-8 w-[4.5rem] shrink-0 rounded-lg`,q)})]})]}),r=(0,K.jsx)(`div`,{className:c(`h-3 w-full`,q)}),i=(0,K.jsx)(`div`,{className:c(`h-3 w-[92%]`,q)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,K.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,K.jsx)(`div`,{className:c(`h-3 w-full`,q)}),(0,K.jsx)(`div`,{className:c(`h-2.5 w-4/5`,q)})]})]})})}),e[4]=a):a=e[4],a}function Y(){let e=(0,ne.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(J,{}),e[0]=t):t=e[0],t}var X=new Set([`installed`,`marketplace`]),Z=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),ie=new Set([`all`,`enabled`,`disabled`]),ae=`mprov`,oe=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],se=[`business`,`creative`,`documents`,`engineering`,`tools`];function ce(e){let t=(0,ne.c)(27),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:u,catalogDisplayRows:d,catalogStatusFilter:f,resolveSkillEnabled:p,categoryLabel:m,sourceLabel:h,openSkillDetail:g,onSkillToggle:_,onUseSkillInChat:v,usingSkillInChatName:y,togglingSkillName:b}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=oe.map(le),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(i.length===0){let e;return t[3]===n.empty?e=t[4]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.empty}),t[3]=n.empty,t[4]=e),e}if(a.length===0){let e;return t[5]===n.noSearchResults?e=t[6]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.noSearchResults}),t[5]=n.noSearchResults,t[6]=e),e}let x;t[7]!==o||t[8]!==s||t[9]!==m||t[10]!==u||t[11]!==n?(x=o.length>1?(0,K.jsx)(W,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:m(e),title:m(e)}))],activeTab:s,onChange:u,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[7]=o,t[8]=s,t[9]=m,t[10]=u,t[11]=n,t[12]=x):x=t[12];let S;t[13]!==d||t[14]!==f||t[15]!==_||t[16]!==v||t[17]!==g||t[18]!==p||t[19]!==n||t[20]!==h||t[21]!==b||t[22]!==y?(S=d.length===0?(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:f===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:d.map(e=>{let t=p(e);return(0,K.jsxs)(`article`,{className:c(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,K.jsx)(`button`,{type:`button`,className:c(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,ee.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void g(e),children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,K.jsxs)(`span`,{className:c(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:[t?(0,K.jsx)(k,{className:`size-3`,"aria-hidden":!0}):(0,K.jsx)(l,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,K.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:h(e.source)}),e.managed?(0,K.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,K.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]})]})})}),(0,K.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:t?(0,K.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:y===e.name||b===e.name,onClick:()=>void v({name:e.name,source:`catalog`}),children:y===e.name?n.previewUseInChatBusy:n.previewUseInChat}):(0,K.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:b===e.name,onClick:()=>void _(e.name,!0),children:b===e.name?n.uploading:n.detailModalEnable})})]},`${e.directoryId}-${e.path}`)})}),t[13]=d,t[14]=f,t[15]=_,t[16]=v,t[17]=g,t[18]=p,t[19]=n,t[20]=h,t[21]=b,t[22]=y,t[23]=S):S=t[23];let C;return t[24]!==x||t[25]!==S?(C=(0,K.jsxs)(K.Fragment,{children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26],C}function le(e){return(0,K.jsx)(Y,{},e)}var ue=`https://skillhub.cn`,de=`https://clawhub.ai`;function fe(e){let t=e.trim();return t?`${ue}/skills/${encodeURIComponent(t)}`:null}function Q(e){let t=e.trim();return t?`${de}/${encodeURIComponent(t)}`:null}function pe(e,t){return e===`skillhub`?fe(t):e===`clawhub`?Q(t):null}function me(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function he(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function ge(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function _e(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}function ve(e){let t=(0,ne.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,K.jsx)(b,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?he(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let f;t[9]===d?f=t[10]:(f=(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]!==n.cancel||t[14]!==p?(m=(0,K.jsx)(N,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=m):m=t[15];let h;t[16]===s?h=t[17]:(h=()=>void s(),t[16]=s,t[17]=h);let g;t[18]!==n.deleteConfirm||t[19]!==h?(g=(0,K.jsx)(N,{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,K.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,K.jsxs)(E,{children:[l,(0,K.jsxs)(P,{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,K.jsx)(L,{open:r,onOpenChange:c,children:v}),t[28]=r,t[29]=c,t[30]=v,t[31]=y):y=t[31],y}var ye=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function be(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function xe(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function Se(e){let t=(0,ne.c)(9),{name:n,className:r}=e,i;t[0]===n?i=t[1]:(i=xe(n),t[0]=n,t[1]=i);let a=i,o=ye[be(n)%ye.length],s;t[2]!==r||t[3]!==o.dark||t[4]!==o.light?(s=c(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,o.light,o.dark,r),t[2]=r,t[3]=o.dark,t[4]=o.light,t[5]=s):s=t[5];let l;return t[6]!==a||t[7]!==s?(l=(0,K.jsx)(`div`,{className:s,"aria-hidden":!0,children:a}),t[6]=a,t[7]=s,t[8]=l):l=t[8],l}function Ce(e){let t=(0,ne.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,K.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,K.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function we(e){let t=(0,ne.c)(118),{preview:n,sk:r}=e,i=n.metadata,a=n.toolConditions,o=!!a&&(a.requiresTools.length>0||a.requiresToolsets.length>0||a.fallbackForTools.length>0||a.fallbackForToolsets.length>0),s=i.requires,l=s&&((s.bins?.length??0)>0||(s.env?.length??0)>0||(s.anyBins?.length??0)>0),u,d,f,p,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==i.emoji||t[4]!==i.homepage||t[5]!==i.install||t[6]!==i.os||t[7]!==n.description||t[8]!==n.disableModelInvocation||t[9]!==n.requiredEnvVarNames||t[10]!==s||t[11]!==r.detailEnvVarsLabel||t[12]!==r.detailHomepageLabel||t[13]!==r.detailInstallLabel||t[14]!==r.detailNotInjectedNote||t[15]!==r.detailPlatformsLabel||t[16]!==r.detailRequiresAnyBins||t[17]!==r.detailRequiresBins||t[18]!==r.detailRequiresEnv||t[19]!==r.detailRequiresLabel||t[20]!==r.detailSummaryHeading||t[21]!==r.detailToolGatingLabel||t[22]!==r.detailToolsFallbackList||t[23]!==r.detailToolsRequiresList||t[24]!==r.detailToolsetsFallbackList||t[25]!==r.detailToolsetsRequiresList){let e=i.install?.filter(De)??[],T=n.requiredEnvVarNames?.filter(Ee)??[];g=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(0,K.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailSummaryHeading}),t[41]=r.detailSummaryHeading,t[42]=h),v=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?y=t[44]:(y=i.emoji?.trim()?(0,K.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=y);let E;t[45]===i.emoji?E=t[46]:(E=i.emoji?.trim()?`mt-2`:``,t[45]=i.emoji,t[46]=E);let D;t[47]===E?D=t[48]:(D=c(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(b=(0,K.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=b):b=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(x=n.disableModelInvocation?(0,K.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:r.detailNotInjectedNote}):null,t[52]=n.disableModelInvocation,t[53]=r.detailNotInjectedNote,t[54]=x):x=t[54];let O;t[55]===i.homepage?O=t[56]:(O=i.homepage?.trim()?(0,K.jsx)(`a`,{href:i.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:i.homepage.trim()}):null,t[55]=i.homepage,t[56]=O),t[57]!==r.detailHomepageLabel||t[58]!==O?(S=(0,K.jsx)(Ce,{label:r.detailHomepageLabel,children:O}),t[57]=r.detailHomepageLabel,t[58]=O,t[59]=S):S=t[59];let k;t[60]===i.os?k=t[61]:(k=i.os&&i.os.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:i.os.join(`, `)}):null,t[60]=i.os,t[61]=k),t[62]!==r.detailPlatformsLabel||t[63]!==k?(C=(0,K.jsx)(Ce,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=C):C=t[64];let A;t[65]!==l||t[66]!==s||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=l&&s?(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[s.bins&&s.bins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),s.bins.join(`, `)]}):null,s.env&&s.env.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,K.jsx)(`span`,{className:`font-mono text-xs`,children:s.env.join(`, `)})]}):null,s.anyBins&&s.anyBins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresAnyBins,`: `]}),s.anyBins.join(`, `)]}):null]}):null,t[65]=l,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?(w=(0,K.jsx)(Ce,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=w):w=t[73];let j=e.length>0?(0,K.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Te)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,K.jsx)(Ce,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=f):f=t[76];let M;t[77]!==a||t[78]!==o||t[79]!==r.detailToolsFallbackList||t[80]!==r.detailToolsRequiresList||t[81]!==r.detailToolsetsFallbackList||t[82]!==r.detailToolsetsRequiresList?(M=o&&a?(0,K.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[a.requiresTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),a.requiresTools.join(`, `)]}):null,a.requiresToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),a.requiresToolsets.join(`, `)]}):null,a.fallbackForTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),a.fallbackForTools.join(`, `)]}):null,a.fallbackForToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsFallbackList,`: `]}),a.fallbackForToolsets.join(`, `)]}):null]}):null,t[77]=a,t[78]=o,t[79]=r.detailToolsFallbackList,t[80]=r.detailToolsRequiresList,t[81]=r.detailToolsetsFallbackList,t[82]=r.detailToolsetsRequiresList,t[83]=M):M=t[83],t[84]!==r.detailToolGatingLabel||t[85]!==M?(p=(0,K.jsx)(Ce,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],u=Ce,d=r.detailEnvVarsLabel,_=T.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:T.join(`, `)}):null,t[0]=a,t[1]=l,t[2]=o,t[3]=i.emoji,t[4]=i.homepage,t[5]=i.install,t[6]=i.os,t[7]=n.description,t[8]=n.disableModelInvocation,t[9]=n.requiredEnvVarNames,t[10]=s,t[11]=r.detailEnvVarsLabel,t[12]=r.detailHomepageLabel,t[13]=r.detailInstallLabel,t[14]=r.detailNotInjectedNote,t[15]=r.detailPlatformsLabel,t[16]=r.detailRequiresAnyBins,t[17]=r.detailRequiresBins,t[18]=r.detailRequiresEnv,t[19]=r.detailRequiresLabel,t[20]=r.detailSummaryHeading,t[21]=r.detailToolGatingLabel,t[22]=r.detailToolsFallbackList,t[23]=r.detailToolsRequiresList,t[24]=r.detailToolsetsFallbackList,t[25]=r.detailToolsetsRequiresList,t[26]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=x,t[38]=S,t[39]=C,t[40]=w}else u=t[26],d=t[27],f=t[28],p=t[29],m=t[30],h=t[31],g=t[32],_=t[33],v=t[34],y=t[35],b=t[36],x=t[37],S=t[38],C=t[39],w=t[40];let T;t[87]!==u||t[88]!==d||t[89]!==_?(T=(0,K.jsx)(u,{label:d,children:_}),t[87]=u,t[88]=d,t[89]=_,t[90]=T):T=t[90];let E;t[91]!==f||t[92]!==p||t[93]!==T||t[94]!==v||t[95]!==y||t[96]!==b||t[97]!==x||t[98]!==S||t[99]!==C||t[100]!==w?(E=(0,K.jsxs)(`div`,{className:v,children:[y,b,x,S,C,w,f,p,T]}),t[91]=f,t[92]=p,t[93]=T,t[94]=v,t[95]=y,t[96]=b,t[97]=x,t[98]=S,t[99]=C,t[100]=w,t[101]=E):E=t[101];let D;t[102]!==m||t[103]!==h||t[104]!==E?(D=(0,K.jsxs)(`section`,{"aria-labelledby":m,children:[h,E]}),t[102]=m,t[103]=h,t[104]=E,t[105]=D):D=t[105];let k;t[106]===r.detailInstructionsHeading?k=t[107]:(k=(0,K.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailInstructionsHeading}),t[106]=r.detailInstructionsHeading,t[107]=k);let A;t[108]!==n.bodyMarkdown||t[109]!==r.detailNoInstructionsBody?(A=n.bodyMarkdown.trim()?(0,K.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,K.jsx)(O,{content:n.bodyMarkdown})}):(0,K.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:r.detailNoInstructionsBody}),t[108]=n.bodyMarkdown,t[109]=r.detailNoInstructionsBody,t[110]=A):A=t[110];let j;t[111]!==k||t[112]!==A?(j=(0,K.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[k,A]}),t[111]=k,t[112]=A,t[113]=j):j=t[113];let M;return t[114]!==g||t[115]!==D||t[116]!==j?(M=(0,K.jsxs)(`div`,{className:g,children:[D,j]}),t[114]=g,t[115]=D,t[116]=j,t[117]=M):M=t[117],M}function Te(e,t){return(0,K.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,K.jsx)(`span`,{className:`text-fg`,children:ge(e)})},e.id||`${e.kind}-${t}`)}function Ee(e){return e.trim()}function De(e){return e&&typeof e.kind==`string`}var Oe=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function ke(e){let t=(0,ne.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:l,detailCatalogPreview:u,setDetailCatalogPreview:d,detailMarketplacePreview:f,setDetailMarketplacePreview:p,detailLoading:m,detailError:h,setDetailError:g,detailEnabled:v,detailDirectoryId:y,detailManaged:x,detailExternalUrl:S,usingSkillInChatName:T,installingMarketName:D,togglingSkillName:O,isSkillInstalledByName:k,onUseSkillInChat:A,onMarketInstall:j,onSkillToggle:M,setConfirmId:R,setConfirmOpen:z}=e,V;t[0]!==d||t[1]!==g||t[2]!==p||t[3]!==i||t[4]!==o||t[5]!==l?(V=e=>{i(e),e||(o(`catalog`),d(null),p(null),g(null),l(``))},t[0]=d,t[1]=g,t[2]=p,t[3]=i,t[4]=o,t[5]=l,t[6]=V):V=t[6];let H;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,K.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=H):H=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=c(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[8]=W):W=t[8];let te=s||`?`,G;t[9]===te?G=t[10]:(G=(0,K.jsx)(Se,{name:te}),t[9]=te,t[10]=G);let re=s||`—`,q;t[11]===re?q=t[12]:(q=(0,K.jsx)(b,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:re}),t[11]=re,t[12]=q);let J;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(J=c(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ee.focusRingPanel),t[13]=J):J=t[13];let Y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,K.jsx)(U,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=Y):Y=t[14];let X;t[15]===n.detailCloseAria?X=t[16]:(X=(0,K.jsx)(_,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,className:J,"aria-label":n.detailCloseAria,children:Y})}),t[15]=n.detailCloseAria,t[16]=X);let Z;t[17]!==G||t[18]!==q||t[19]!==X?(Z=(0,K.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[G,q,X]}),t[17]=G,t[18]=q,t[19]=X,t[20]=Z):Z=t[20];let ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,K.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ie):ie=t[21];let ae=a===`store`&&f?n.detailModalBanner:a===`store`?n.detailModalBannerStore:n.detailModalBanner,oe;t[22]===ae?oe=t[23]:(oe=(0,K.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[ie,(0,K.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:ae})]}),t[22]=ae,t[23]=oe);let se;t[24]!==u||t[25]!==v||t[26]!==h||t[27]!==m||t[28]!==f||t[29]!==a||t[30]!==n?(se=(0,K.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:m?(0,K.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:Oe.map(Ae)}):h?(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h}):a===`catalog`&&u?(0,K.jsxs)(K.Fragment,{children:[v?null:(0,K.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,K.jsx)(F,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,K.jsx)(we,{preview:u,sk:n})]}):a===`store`&&f?(0,K.jsx)(we,{preview:f,sk:n}):(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[24]=u,t[25]=v,t[26]=h,t[27]=m,t[28]=f,t[29]=a,t[30]=n,t[31]=se):se=t[31];let ce;t[32]!==S||t[33]!==a||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(ce=a===`store`&&S?(0,K.jsxs)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,className:c(`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`,ee.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,K.jsx)(I,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=S,t[33]=a,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=ce):ce=t[36];let le;t[37]!==y||t[38]!==x||t[39]!==a||t[40]!==R||t[41]!==z||t[42]!==n.delete?(le=a===`catalog`&&x&&y?(0,K.jsxs)(N,{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:()=>{R(y),z(!0)},children:[(0,K.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=y,t[38]=x,t[39]=a,t[40]=R,t[41]=z,t[42]=n.delete,t[43]=le):le=t[43];let ue;t[44]!==ce||t[45]!==le?(ue=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ce,le]}),t[44]=ce,t[45]=le,t[46]=ue):ue=t[46];let de;t[47]!==v||t[48]!==m||t[49]!==a||t[50]!==s||t[51]!==D||t[52]!==k||t[53]!==j||t[54]!==M||t[55]!==A||t[56]!==i||t[57]!==n.cancel||t[58]!==n.detailModalDisable||t[59]!==n.detailModalEnable||t[60]!==n.marketplaceInstall||t[61]!==n.marketplaceReinstall||t[62]!==n.previewUseInChat||t[63]!==n.previewUseInChatBusy||t[64]!==n.uploading||t[65]!==n.useRequiresEnabled||t[66]!==O||t[67]!==T?(de=(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(N,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,K.jsx)(N,{type:`button`,variant:`secondary`,disabled:!s||m||T===s||D===s,onClick:()=>void A(),children:T===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,K.jsx)(N,{type:`button`,variant:k(s)?`secondary`:`primary`,disabled:!s||D===s,onClick:()=>{s&&j(s,{useDetailProvider:!0})},children:D===s?n.uploading:k(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,K.jsxs)(K.Fragment,{children:[v?(0,K.jsx)(N,{type:`button`,variant:`secondary`,disabled:!s||O===s,onClick:()=>{s&&M(s,!1)},children:O===s?n.uploading:n.detailModalDisable}):(0,K.jsx)(N,{type:`button`,variant:`primary`,disabled:!s||O===s,onClick:()=>{s&&M(s,!0)},children:O===s?n.uploading:n.detailModalEnable}),(0,K.jsx)(N,{type:`button`,variant:`secondary`,disabled:!s||!v||m||T===s||O===s,title:v?void 0:n.useRequiresEnabled,onClick:()=>void A(),children:T===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=v,t[48]=m,t[49]=a,t[50]=s,t[51]=D,t[52]=k,t[53]=j,t[54]=M,t[55]=A,t[56]=i,t[57]=n.cancel,t[58]=n.detailModalDisable,t[59]=n.detailModalEnable,t[60]=n.marketplaceInstall,t[61]=n.marketplaceReinstall,t[62]=n.previewUseInChat,t[63]=n.previewUseInChatBusy,t[64]=n.uploading,t[65]=n.useRequiresEnabled,t[66]=O,t[67]=T,t[68]=de):de=t[68];let fe;t[69]!==ue||t[70]!==de?(fe=(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[ue,de]}),t[69]=ue,t[70]=de,t[71]=fe):fe=t[71];let Q;t[72]!==Z||t[73]!==oe||t[74]!==se||t[75]!==fe?(Q=(0,K.jsxs)(E,{children:[H,(0,K.jsxs)(P,{className:W,children:[Z,oe,se,fe]})]}),t[72]=Z,t[73]=oe,t[74]=se,t[75]=fe,t[76]=Q):Q=t[76];let pe;return t[77]!==r||t[78]!==V||t[79]!==Q?(pe=(0,K.jsx)(L,{open:r,onOpenChange:V,children:Q}),t[77]=r,t[78]=V,t[79]=Q,t[80]=pe):pe=t[80],pe}function Ae(e){return(0,K.jsx)(`div`,{className:c(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function je(e){let t=(0,ne.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:l,uploading:u,onModalDragOver:d,onModalDragLeave:f,onModalDrop:p,onFileInputChange:m,onInstallSubmit:h}=e,g;t[0]!==l||t[1]!==i||t[2]!==o?(g=e=>{i(e),e||(o(null),l(!1))},t[0]=l,t[1]=i,t[2]=o,t[3]=g):g=t[3];let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=v):v=t[4];let x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=c(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),t[5]=x):x=t[5];let S;t[6]===n.installModalTitle?S=t[7]:(S=(0,K.jsx)(b,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=S);let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=c(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ee.focusRingPanel),t[8]=C):C=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,K.jsx)(U,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=T):T=t[9];let D;t[10]===n.installClose?D=t[11]:(D=(0,K.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=D);let O;t[12]!==n.installClose||t[13]!==D?(O=(0,K.jsx)(_,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:C,"aria-label":n.installClose,children:[T,D]})}),t[12]=n.installClose,t[13]=D,t[14]=O):O=t[14];let k;t[15]!==S||t[16]!==O?(k=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,O]}),t[15]=S,t[16]=O,t[17]=k):k=t[17];let A=s?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,j;t[18]===A?j=t[19]:(j=c(`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`,A),t[18]=A,t[19]=j);let M;t[20]!==m||t[21]!==n.installModalDropHint||t[22]!==u?(M=(0,K.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:u,onChange:m}),t[20]=m,t[21]=n.installModalDropHint,t[22]=u,t[23]=M):M=t[23];let N;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,K.jsx)(y,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=N):N=t[24];let F;t[25]===n.installModalDropHint?F=t[26]:(F=(0,K.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=F);let I;t[27]===a?I=t[28]:(I=a?(0,K.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=I);let R;t[29]!==f||t[30]!==d||t[31]!==p||t[32]!==j||t[33]!==M||t[34]!==F||t[35]!==I?(R=(0,K.jsxs)(`label`,{className:j,onDragLeave:f,onDragOver:d,onDrop:p,children:[M,N,F,I]}),t[29]=f,t[30]=d,t[31]=p,t[32]=j,t[33]=M,t[34]=F,t[35]=I,t[36]=R):R=t[36];let z;t[37]===n.installModalReqTitle?z=t[38]:(z=(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=z);let B;t[39]===n.installModalReq1?B=t[40]:(B=(0,K.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=B);let V;t[41]===n.installModalReq2?V=t[42]:(V=(0,K.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=V);let H;t[43]!==B||t[44]!==V?(H=(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[B,V]}),t[43]=B,t[44]=V,t[45]=H):H=t[45];let W;t[46]!==z||t[47]!==H?(W=(0,K.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[z,H]}),t[46]=z,t[47]=H,t[48]=W):W=t[48];let te=!a||u,G=!a||u?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,re;t[49]===G?re=t[50]:(re=c(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,G,ee.focusRingPanel),t[49]=G,t[50]=re);let q;t[51]===h?q=t[52]:(q=()=>void h(),t[51]=h,t[52]=q);let J=u?n.uploading:n.installAction,Y;t[53]!==te||t[54]!==re||t[55]!==q||t[56]!==J?(Y=(0,K.jsx)(`button`,{type:`button`,disabled:te,className:re,onClick:q,children:J}),t[53]=te,t[54]=re,t[55]=q,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==R||t[59]!==W||t[60]!==Y||t[61]!==k?(X=(0,K.jsxs)(E,{children:[v,(0,K.jsxs)(P,{className:x,children:[k,R,W,Y]})]}),t[58]=R,t[59]=W,t[60]=Y,t[61]=k,t[62]=X):X=t[62];let Z;return t[63]!==r||t[64]!==g||t[65]!==X?(Z=(0,K.jsx)(L,{open:r,onOpenChange:g,children:X}),t[63]=r,t[64]=g,t[65]=X,t[66]=Z):Z=t[66],Z}function Me(e){let t=(0,ne.c)(66),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:l,marketCategoryId:u,setMarketCategoryId:d,marketPage:f,setMarketPage:p,isSkillInstalledByName:m,openMarketplaceDetail:h,onMarketInstall:_,installingMarketName:y,onUseSkillInChat:b,usingSkillInChatName:S,searchInputActive:C,searchQuery:w,setSearchQuery:T,registeredProviders:E,marketBrowseProvider:D,setMarketBrowseProvider:O}=e,A=!C,M,P,F;if(t[0]!==y||t[1]!==m||t[2]!==D||t[3]!==u||t[4]!==f||t[5]!==r||t[6]!==a||t[7]!==i||t[8]!==l||t[9]!==s||t[10]!==o||t[11]!==_||t[12]!==b||t[13]!==h||t[14]!==E||t[15]!==C||t[16]!==w||t[17]!==O||t[18]!==d||t[19]!==p||t[20]!==T||t[21]!==A||t[22]!==n.loading||t[23]!==n.marketplaceAuthor||t[24]!==n.marketplaceCategoriesAria||t[25]!==n.marketplaceCategoryAll||t[26]!==n.marketplaceDownloads||t[27]!==n.marketplaceEmpty||t[28]!==n.marketplaceEmptySearch||t[29]!==n.marketplaceEmptySearchClear||t[30]!==n.marketplaceEmptySearchTryProvider||t[31]!==n.marketplaceInstall||t[32]!==n.marketplaceInstalled||t[33]!==n.marketplacePageNext||t[34]!==n.marketplacePagePrev||t[35]!==n.marketplacePageStatus||t[36]!==n.marketplaceVersion||t[37]!==n.previewUseInChat||t[38]!==n.previewUseInChatBusy||t[39]!==n.uploading||t[40]!==S){let e;t[44]===D?e=t[45]:(e=e=>e.id!==D,t[44]=D,t[45]=e);let I=E.filter(e),L=w.trim(),R;t[46]===n.marketplaceCategoryAll?R=t[47]:(R={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=R);let z;t[48]!==r||t[49]!==R?(z=[R,...r.map(Ie)],t[48]=r,t[49]=R,t[50]=z):z=t[50];let B=z;t[51]!==B||t[52]!==u||t[53]!==r.length||t[54]!==i||t[55]!==d||t[56]!==A||t[57]!==n.marketplaceCategoriesAria?(M=A?r.length>0?(0,K.jsx)(W,{items:B,activeTab:u,onChange:d,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,K.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Fe)}):null:null,t[51]=B,t[52]=u,t[53]=r.length,t[54]=i,t[55]=d,t[56]=A,t[57]=n.marketplaceCategoriesAria,t[58]=M):M=t[58],t[59]!==a||t[60]!==A?(P=A&&a?(0,K.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[59]=a,t[60]=A,t[61]=P):P=t[61],F=!o&&!l?(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:oe.map(Pe)}):l&&!o?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:l}):o?(0,K.jsxs)(`div`,{className:`relative`,children:[s?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":n.loading,children:(0,K.jsx)(v,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,o.items.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-edge py-12 text-center text-sm text-fg-muted`,children:[(0,K.jsx)(`p`,{className:`px-4`,children:C&&L?he(n.marketplaceEmptySearch,{query:L}):n.marketplaceEmpty}),C?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[I.map(e=>(0,K.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>O(e.id),children:he(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,K.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>T(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,K.jsx)(`div`,{className:c(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,s&&`pointer-events-none opacity-[0.52] motion-reduce:opacity-100`),children:o.items.map(e=>{let t=me(e,e.providerId??D),r=m(t);return(0,K.jsxs)(`article`,{className:c(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,K.jsx)(`button`,{type:`button`,className:c(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,ee.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void h(t,e.name,e.providerId??void 0),children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),r?(0,K.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,K.jsx)(k,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):null]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,K.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${r?` · ${n.marketplaceInstalled}`:``}`,children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,K.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,K.jsx)(x,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,K.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),(0,K.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:r?(0,K.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||S===t,onClick:()=>void b({name:t,source:`store`,providerOverride:e.providerId??null}),children:S===t?n.previewUseInChatBusy:n.previewUseInChat}):(0,K.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||y===t,onClick:()=>void _(t,{providerOverride:e.providerId??null}),children:y===t?n.uploading:n.marketplaceInstall})})]},e.id)})}),o.items.length>0?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,K.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:he(n.marketplacePageStatus,{page:o.meta.page,totalPages:o.meta.totalPages,total:o.meta.total})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f<=1,"aria-label":n.marketplacePagePrev,onClick:()=>p(Ne),children:[(0,K.jsx)(j,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePagePrev})]}),(0,K.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f>=o.meta.totalPages,"aria-label":n.marketplacePageNext,onClick:()=>p(e=>Math.min(o.meta.totalPages,e+1)),children:[(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePageNext}),(0,K.jsx)(g,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]}):null]}):null,t[0]=y,t[1]=m,t[2]=D,t[3]=u,t[4]=f,t[5]=r,t[6]=a,t[7]=i,t[8]=l,t[9]=s,t[10]=o,t[11]=_,t[12]=b,t[13]=h,t[14]=E,t[15]=C,t[16]=w,t[17]=O,t[18]=d,t[19]=p,t[20]=T,t[21]=A,t[22]=n.loading,t[23]=n.marketplaceAuthor,t[24]=n.marketplaceCategoriesAria,t[25]=n.marketplaceCategoryAll,t[26]=n.marketplaceDownloads,t[27]=n.marketplaceEmpty,t[28]=n.marketplaceEmptySearch,t[29]=n.marketplaceEmptySearchClear,t[30]=n.marketplaceEmptySearchTryProvider,t[31]=n.marketplaceInstall,t[32]=n.marketplaceInstalled,t[33]=n.marketplacePageNext,t[34]=n.marketplacePagePrev,t[35]=n.marketplacePageStatus,t[36]=n.marketplaceVersion,t[37]=n.previewUseInChat,t[38]=n.previewUseInChatBusy,t[39]=n.uploading,t[40]=S,t[41]=M,t[42]=P,t[43]=F}else M=t[41],P=t[42],F=t[43];let I;return t[62]!==M||t[63]!==P||t[64]!==F?(I=(0,K.jsxs)(K.Fragment,{children:[M,P,F]}),t[62]=M,t[63]=P,t[64]=F,t[65]=I):I=t[65],I}function Ne(e){return Math.max(1,e-1)}function Pe(e){return(0,K.jsx)(J,{},e)}function Fe(e){return(0,K.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function Ie(e){return{id:e.id,label:e.label,title:e.label}}function Le(e){let t=(0,ne.c)(118),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:l,setMainTab:u,sourceFilter:d,setSourceFilter:f,builtinTabStats:p,userTabStats:m,catalogDisabledCount:h,catalogStatusFilter:g,setCatalogStatusFilter:_,marketSort:v,setMarketSort:y,marketBrowseProvider:b,setMarketBrowseProvider:x,registeredProviders:S,inSettingsShell:C,searchInputActive:w,resultTab:T,setResultTab:E,aggregatedTabCounts:O,aggregatedProviderStatus:k}=n;if(!i){let e;t[0]===n?e=t[1]:(e=(0,K.jsx)(Ue,{vm:n}),t[0]=n,t[1]=e);let i;t[2]===r.needToken?i=t[3]:(i=(0,K.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.needToken}),t[2]=r.needToken,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,K.jsxs)(K.Fragment,{children:[e,i]}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}let A=p.total+m.total,j=p.enabled+m.enabled,M=p.total+m.total-p.enabled-m.enabled,N;t[7]!==A||t[8]!==j||t[9]!==M||t[10]!==m.total?(N={total:A,ready:j,needsAttention:M,added:m.total},t[7]=A,t[8]=j,t[9]=M,t[10]=m.total,t[11]=N):N=t[11];let P=N,F;t[12]!==P.total||t[13]!==r.tabInstalled?(F={id:`installed`,label:r.tabInstalled,count:P.total},t[12]=P.total,t[13]=r.tabInstalled,t[14]=F):F=t[14];let I;t[15]===r.tabDiscover?I=t[16]:(I={id:`marketplace`,label:r.tabDiscover},t[15]=r.tabDiscover,t[16]=I);let L;t[17]!==F||t[18]!==I?(L=[F,I],t[17]=F,t[18]=I,t[19]=L):L=t[19];let ee=L,R;t[20]===S?R=t[21]:(R=[`all`,...S.map(He)],t[20]=S,t[21]=R);let z=R,B;t[22]!==k||t[23]!==O||t[24]!==S||t[25]!==r.marketplaceLoadFailed||t[26]!==r.marketplaceResultsTabAll||t[27]!==z?(B=z.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:S.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,K.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,K.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,K.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[22]=k,t[23]=O,t[24]=S,t[25]=r.marketplaceLoadFailed,t[26]=r.marketplaceResultsTabAll,t[27]=z,t[28]=B):B=t[28];let V=B,H;t[29]===n?H=t[30]:(H=(0,K.jsx)(Ue,{vm:n}),t[29]=n,t[30]=H);let U;t[31]!==o||t[32]!==a?(U=o?(0,K.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:c(`rounded-xl border px-3 py-2 text-sm`,o.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:o.message}):a?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:a}):null,t[31]=o,t[32]=a,t[33]=U):U=t[33];let te;t[34]!==r.diagnosticsHint||t[35]!==r.diagnosticsTitle||t[36]!==s?(te=s.length>0?(0,K.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,K.jsx)(`div`,{className:`font-medium`,children:he(r.diagnosticsTitle,{count:s.length})}),(0,K.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:r.diagnosticsHint}),(0,K.jsx)(`ul`,{className:`mt-1 space-y-1`,children:s.slice(0,3).map(Ve)})]}):null,t[34]=r.diagnosticsHint,t[35]=r.diagnosticsTitle,t[36]=s,t[37]=te):te=t[37];let G;t[38]!==C||t[39]!==n.loading||t[40]!==n.mainTab||t[41]!==n.onReloadClick||t[42]!==n.searchQuery||t[43]!==n.setInstallOpen||t[44]!==n.setPendingFile||t[45]!==n.setSearchQuery||t[46]!==n.sk?(G=C?(0,K.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,K.jsx)(re,{loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[38]=C,t[39]=n.loading,t[40]=n.mainTab,t[41]=n.onReloadClick,t[42]=n.searchQuery,t[43]=n.setInstallOpen,t[44]=n.setPendingFile,t[45]=n.setSearchQuery,t[46]=n.sk,t[47]=G):G=t[47];let q;t[48]!==l||t[49]!==ee||t[50]!==u||t[51]!==r.skillsNavAria?(q=(0,K.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,K.jsx)(W,{items:ee,activeTab:l,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[48]=l,t[49]=ee,t[50]=u,t[51]=r.skillsNavAria,t[52]=q):q=t[52];let J;t[53]!==h||t[54]!==g||t[55]!==P.added||t[56]!==P.needsAttention||t[57]!==P.ready||t[58]!==l||t[59]!==b||t[60]!==v||t[61]!==S||t[62]!==T||t[63]!==V||t[64]!==w||t[65]!==_||t[66]!==x||t[67]!==y||t[68]!==E||t[69]!==f||t[70]!==r.discoverHeading||t[71]!==r.discoverHint||t[72]!==r.filterAll||t[73]!==r.filterDisabledOnly||t[74]!==r.filterEnabled||t[75]!==r.filterExtra||t[76]!==r.filterGlobal||t[77]!==r.filterInstalled||t[78]!==r.filterWorkspace||t[79]!==r.installedHeading||t[80]!==r.installedHint||t[81]!==r.marketplaceBrowseSwitchAria||t[82]!==r.marketplaceResultsTabsAria||t[83]!==r.marketplaceSortDownloads||t[84]!==r.marketplaceSortLabel||t[85]!==r.marketplaceSortNewest||t[86]!==r.sourceFilterAria||t[87]!==r.statusFilterAria||t[88]!==r.summaryAdded||t[89]!==r.summaryNeedsAttention||t[90]!==r.summaryReady||t[91]!==r.tabBuiltin||t[92]!==d?(J=l===`installed`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.installedHeading}),(0,K.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.installedHint})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[(0,K.jsx)(D,{value:d,placeholder:r.filterAll,ariaLabel:r.sourceFilterAria,options:[{value:`all`,label:r.filterAll},{value:`builtin`,label:r.tabBuiltin},{value:`installed`,label:r.filterInstalled},{value:`workspace`,label:r.filterWorkspace},{value:`global`,label:r.filterGlobal},{value:`extra`,label:r.filterExtra}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>f(e)}),(0,K.jsx)(D,{value:g,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:he(r.filterDisabledOnly,{count:h})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>_(e)})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,"aria-label":r.installedHeading,children:[(0,K.jsxs)(`button`,{type:`button`,className:c(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`enabled`&&`border-emerald-500/40 bg-emerald-500/5`),"aria-pressed":g===`enabled`,onClick:()=>_(Be),children:[(0,K.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:P.ready}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryReady})]}),(0,K.jsxs)(`button`,{type:`button`,className:c(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`disabled`&&`border-amber-500/50 bg-amber-500/5`),"aria-pressed":g===`disabled`,onClick:()=>_($),children:[(0,K.jsx)(`div`,{className:c(`text-xl font-semibold tabular-nums`,P.needsAttention>0?`text-warning`:`text-fg`),children:P.needsAttention}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryNeedsAttention})]}),(0,K.jsxs)(`button`,{type:`button`,className:c(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,d===`installed`&&`border-accent/40 bg-accent/5`),"aria-pressed":d===`installed`,onClick:()=>f(ze),children:[(0,K.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:P.added}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryAdded})]})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.discoverHeading}),(0,K.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.discoverHint})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[w?null:(0,K.jsx)(D,{value:b??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:S.map(Re),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:x}),(0,K.jsx)(D,{value:v,placeholder:r.marketplaceSortLabel,ariaLabel:r.marketplaceSortLabel,options:[{value:`downloads`,label:r.marketplaceSortDownloads},{value:`newest`,label:r.marketplaceSortNewest}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>y(e)})]})]}),w?(0,K.jsx)(W,{items:V,activeTab:T,onChange:E,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`min-h-9 gap-1 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):null]}),t[53]=h,t[54]=g,t[55]=P.added,t[56]=P.needsAttention,t[57]=P.ready,t[58]=l,t[59]=b,t[60]=v,t[61]=S,t[62]=T,t[63]=V,t[64]=w,t[65]=_,t[66]=x,t[67]=y,t[68]=E,t[69]=f,t[70]=r.discoverHeading,t[71]=r.discoverHint,t[72]=r.filterAll,t[73]=r.filterDisabledOnly,t[74]=r.filterEnabled,t[75]=r.filterExtra,t[76]=r.filterGlobal,t[77]=r.filterInstalled,t[78]=r.filterWorkspace,t[79]=r.installedHeading,t[80]=r.installedHint,t[81]=r.marketplaceBrowseSwitchAria,t[82]=r.marketplaceResultsTabsAria,t[83]=r.marketplaceSortDownloads,t[84]=r.marketplaceSortLabel,t[85]=r.marketplaceSortNewest,t[86]=r.sourceFilterAria,t[87]=r.statusFilterAria,t[88]=r.summaryAdded,t[89]=r.summaryNeedsAttention,t[90]=r.summaryReady,t[91]=r.tabBuiltin,t[92]=d,t[93]=J):J=t[93];let Y;t[94]!==l||t[95]!==n?(Y=l===`marketplace`?(0,K.jsx)(Me,{...n}):(0,K.jsx)(ce,{...n}),t[94]=l,t[95]=n,t[96]=Y):Y=t[96];let X;t[97]!==q||t[98]!==J||t[99]!==Y?(X=(0,K.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[q,J,Y]}),t[97]=q,t[98]=J,t[99]=Y,t[100]=X):X=t[100];let Z;t[101]!==U||t[102]!==te||t[103]!==G||t[104]!==X?(Z=(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[U,te,G,X]}),t[101]=U,t[102]=te,t[103]=G,t[104]=X,t[105]=Z):Z=t[105];let ie,ae,oe;t[106]===n?(ie=t[107],ae=t[108],oe=t[109]):(ie=(0,K.jsx)(ke,{...n}),ae=(0,K.jsx)(je,{...n}),oe=(0,K.jsx)(ve,{...n}),t[106]=n,t[107]=ie,t[108]=ae,t[109]=oe);let se;t[110]!==Z||t[111]!==ie||t[112]!==ae||t[113]!==oe?(se=(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[Z,ie,ae,oe]}),t[110]=Z,t[111]=ie,t[112]=ae,t[113]=oe,t[114]=se):se=t[114];let le;return t[115]!==H||t[116]!==se?(le=(0,K.jsxs)(K.Fragment,{children:[H,se]}),t[115]=H,t[116]=se,t[117]=le):le=t[117],le}function Re(e){return{value:e.id,label:e.displayName}}function ze(e){return e===`installed`?`all`:`installed`}function $(e){return e===`disabled`?`all`:`disabled`}function Be(e){return e===`enabled`?`all`:`enabled`}function Ve(e,t){return(0,K.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function He(e){return e.id}function Ue(e){let t=(0,ne.c)(17),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=S(Ge),m=S(We),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r?(h=(0,K.jsx)(re,{loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=h):h=t[8];let g=h,_,v;return t[9]!==m||t[10]!==i||t[11]!==f||t[12]!==p||t[13]!==r.title||t[14]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[9]=m,t[10]=i,t[11]=f,t[12]=p,t[13]=r.title,t[14]=g,t[15]=_,t[16]=v):(_=t[15],v=t[16]),(0,G.useLayoutEffect)(_,v),null}function We(e){return e.clearPageHeader}function Ge(e){return e.setPageHeader}async function Ke(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`workspace`);let r=d.getState().token,i=new Headers;r&&i.set(`Authorization`,`Bearer ${r}`);let a=await fetch(m(`/api/skills/upload`),{method:`POST`,headers:i,body:n});a.status===401&&d.getState().onUnauthorized();let o=await a.json().catch(()=>({}));if(!a.ok)throw Error(o.error||`HTTP ${a.status}`);if(!o.payload?.skillId)throw Error(`Invalid response`);return o.payload}async function qe(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await p(m(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await H(r))}async function Je(e,t){let n=await p(m(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await H(n))}function Ye(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function Xe(e){let t=new URLSearchParams;Ye(t,e?.provider);let n=t.toString(),r=await p(m(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await H(r));let i=await r.json();if(!i.payload||!Array.isArray(i.payload.items))throw Error(`Invalid response`);return{items:i.payload.items}}async function Ze(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),Ye(t,e.provider);let n=t.toString(),r=await p(m(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await H(r));let i=await r.json();if(!i.payload?.items||!i.payload.meta)throw Error(`Invalid response`);return i.payload}async function Qe(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;Ye(r,t?.provider);let i=r.toString(),a=await p(m(`/api/skills/marketplace/packages/${n}${i?`?${i}`:``}`),{cache:`no-store`});if(!a.ok)throw Error(await H(a));let o=(await a.json()).payload;if(!o?.name||!o.skillDocPreview||typeof o.skillDocPreview.name!=`string`||typeof o.skillDocPreview.description!=`string`||typeof o.skillDocPreview.bodyMarkdown!=`string`||typeof o.skillDocPreview.disableModelInvocation!=`boolean`||!o.skillDocPreview.metadata||typeof o.skillDocPreview.metadata!=`object`||typeof o.skillDocPreview.metadata.name!=`string`||typeof o.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return o}async function $e(e){let t=await p(m(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`workspace`,...e})});if(!t.ok)throw Error(await H(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function et(e){let t=await p(m(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await H(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function tt(){let e=await p(m(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await H(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function nt(){let e=await p(m(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await H(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}async function rt(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function it(){let e=u(f(e=>e.language)).skills,t=!!d(e=>e.token),n=s(),[r,i]=o(),c=r.get(`mprov`)?.trim()||null,[l,p]=(0,G.useState)(!1),[m,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(!1),y=r.get(`q`)??``,b=r.get(`tab`),x=r.get(`source`),S=r.get(`status`),C=X.has(b)?b:`installed`,w=b===`builtin`?`builtin`:b===`user`?`installed`:null,E=Z.has(x)?x:w??`all`,D=ie.has(S)?S:`all`,[O,k]=(0,G.useState)(y),[j]=z(O,250),M=j.trim(),N=O.trim().length>0,P=M.length>0,[F,I]=(0,G.useState)(null),[L,ee]=(0,G.useState)(C),[R,B]=(0,G.useState)(E),[V,H]=(0,G.useState)(``),[U,W]=(0,G.useState)(D),[ne,K]=(0,G.useState)(!1),[re,q]=(0,G.useState)(null),[J,Y]=(0,G.useState)(!1),[oe,ce]=(0,G.useState)(!1),[le,ue]=(0,G.useState)(null),[de,fe]=(0,G.useState)(null),[Q,me]=(0,G.useState)({}),[he,ge]=(0,G.useState)(!1),[ve,ye]=(0,G.useState)(`catalog`),[be,xe]=(0,G.useState)(``),[Se,Ce]=(0,G.useState)(null),[we,Te]=(0,G.useState)(null),[Ee,De]=(0,G.useState)(!1),[Oe,ke]=(0,G.useState)(null),[Ae,je]=(0,G.useState)(`downloads`),[Me,Ne]=(0,G.useState)(1),[Pe,Fe]=(0,G.useState)(null),[Ie,Le]=(0,G.useState)(null),[Re,ze]=(0,G.useState)(``),[$,Be]=(0,G.useState)(()=>c),[Ve,He]=(0,G.useState)(0),[Ue,We]=(0,G.useState)(0),[Ge,Ye]=(0,G.useState)([]),it=(0,G.useRef)(null),at=(0,G.useRef)(c),ot=(0,G.useRef)(null),st=(0,G.useRef)(``),ct=(0,G.useRef)(null),lt=(0,G.useRef)(!1),[ut,dt]=(0,G.useState)({query:``,byProvider:{}}),[ft,pt]=(0,G.useState)(`all`),mt=(0,G.useRef)(0),ht=(0,G.useRef)(M);ht.current!==M&&(ht.current=M,pt(e=>e===`all`?e:`all`));let gt=T(()=>A().then(e=>(Ye(e.diagnostics??[]),e.catalog.map(_e))),[t,Ue],{enabled:t,initial:[],errorData:[]}),{data:_t,loading:vt,setData:yt}=gt,bt=T(async()=>{try{let{providers:e,current:t}=await nt();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await tt()).provider}}catch{return{providers:[],current:`store`}}}},[t,Ve],{enabled:t,initial:{providers:[],current:null}}),xt=l||vt,St=bt.data.providers;(0,G.useEffect)(()=>{let e=e=>{if(h(e.detail)===`skills`){if(lt.current){lt.current=!1;return}We(e=>e+1)}else He(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let Ct=r.toString(),wt=(0,G.useRef)(Ct);if(wt.current!==Ct){wt.current=Ct;let e=r.get(`q`)??``,t=r.get(`tab`),n=r.get(`source`),i=r.get(`status`),a=X.has(t)?t:`installed`,o=t===`builtin`?`builtin`:t===`user`?`installed`:null,s=Z.has(n)?n:o??`all`,c=ie.has(i)?i:`all`;k(t=>t===e?t:e),ee(e=>e===a?e:a),B(e=>e===s?e:s),W(e=>e===c?e:c);let l=r.get(`mcat`)??``;ze(a===`marketplace`?e=>e===l?e:l:``)}let Tt=(0,G.useRef)(t);!t&&Tt.current&&(Be(null),it.current=null),Tt.current=t,t&&c&&at.current!==c&&(at.current=c,Be(c)),t&&c==null&&bt.data.current&&bt.data.current!==ot.current&&(ot.current=bt.data.current,Be(e=>e??bt.data.current));let Et=`${M}|${Ae}|${L}|${Re}|${$??``}|${ft}`;st.current!==Et&&(st.current=Et,Ne(1)),L===`marketplace`&&$&&ct.current!=null&&ct.current!==$&&ze(``),ct.current=$;let Dt=T(()=>Ze({page:Me,pageSize:20,sort:Ae,category:Re.trim()||void 0,provider:$}),[t,L,Re,Me,Ae,P,$],{enabled:t&&L===`marketplace`&&!!$&&!P,initial:null,errorData:null});(0,G.useEffect)(()=>{if(!t||!P||L!==`marketplace`||St.length===0)return;let n=++mt.current,r={};for(let e of St)r[e.id]={status:`loading`,rows:[]};dt({query:M,byProvider:r});let i=[],a=[];for(let t of St){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),Ze({provider:t.id,q:M,page:1,pageSize:40,sort:Ae,signal:r.signal}).then(e=>{if(window.clearTimeout(o),n!==mt.current)return;let r=e.items.map(e=>({...e,providerId:t.id}));dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),n!==mt.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?e.marketplaceLoadFailed:r instanceof Error?r.message:e.marketplaceLoadFailed;dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[t,L,P,M,St,Ae,e.marketplaceLoadFailed]);let Ot=T(()=>Xe({provider:$}).then(e=>e.items),[t,L,$],{enabled:t&&L===`marketplace`&&!!$,initial:[],errorData:[]}),kt=(0,G.useMemo)(()=>{if(!P||ut.query!==M)return[];let e=St.map(e=>({id:e.id,rows:[...ut.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[P,M,ut,St]),At=(0,G.useMemo)(()=>{if(!P)return{};let e={all:kt.length};for(let t of St)e[t.id]=kt.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[P,kt,St]),jt=(0,G.useMemo)(()=>P?ft===`all`?kt:kt.filter(e=>e.providerId===ft||(e.additionalSources??[]).some(e=>e.providerId===ft)):[],[P,kt,ft]),Mt=(0,G.useMemo)(()=>{if(!P)return{};let e={};for(let t of St)e[t.id]=ut.byProvider[t.id]?.status??`loading`;return e},[P,ut,St]),Nt=(0,G.useMemo)(()=>Object.values(Mt).some(e=>e===`loading`),[Mt]),Pt=(0,G.useMemo)(()=>{if(!P)return!1;let e=Object.values(Mt);return e.length>0&&e.every(e=>e===`error`)},[P,Mt]),Ft=(0,G.useMemo)(()=>{if(!P||kt.length===0&&Nt)return null;let e=jt.length,t=(Me-1)*20;return{items:jt.slice(t,t+20),meta:{page:Me,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:ft}},[P,kt,Nt,jt,Me,ft]),It=L===`marketplace`?N?P?Ft:null:Dt.data:null,Lt=L===`marketplace`?N?P?Nt:!0:Dt.loading:!1,Rt=P?Pt?e.marketplaceLoadFailed:null:Dt.error instanceof Error?Dt.error.message:Dt.error?e.marketplaceLoadFailed:null,zt=L===`marketplace`?Ot.data:[],Bt=L===`marketplace`?Ot.loading:!1,Vt=Ot.error instanceof Error?Ot.error.message:Ot.error?e.marketplaceCategoriesFailed:null;Re.trim()&&zt.length>0&&!zt.some(e=>e.id===Re)&&ze(``);let Ht=(0,G.useCallback)(async t=>{let n=t?.silent===!0;n||p(!0),g(null);try{let e=await A();return Ye(e.diagnostics??[]),yt(e.catalog.map(_e)),{ok:!0}}catch(t){let n=t instanceof Error?t.message:e.loadFailed;return g(n),{ok:!1,message:n}}finally{n||p(!1)}},[yt,e.loadFailed]),Ut=!l&>.error?gt.error instanceof Error?gt.error.message:e.loadFailed:null,Wt=m??Ut;(0,G.useEffect)(()=>{i(e=>{let t=new URLSearchParams(e);return M?t.set(`q`,M):t.delete(`q`),L===`marketplace`?t.set(`tab`,L):t.delete(`tab`),R===`all`?t.delete(`source`):t.set(`source`,R),L===`installed`&&U!==`all`?t.set(`status`,U):t.delete(`status`),L===`marketplace`&&Re.trim()?t.set(`mcat`,Re.trim()):t.delete(`mcat`),L===`marketplace`&&$?t.set(ae,$):t.delete(ae),t.toString()===e.toString()?e:t},{replace:!0})},[L,Re,$,M,U,i,R]);let Gt=(0,G.useCallback)((e,t,n=5e3)=>{I({kind:e,message:t}),window.setTimeout(()=>I(null),n)},[]),Kt=(0,G.useCallback)(t=>{let n=t.availability;if(!n)return e.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[e.installSuccess]),qt=(0,G.useCallback)(async t=>{ye(`catalog`),ge(!0),xe(t.name),Ce(null),Te(null),ke(null),De(!0);try{let e=await et(t.name);Ce(e),xe(e.name)}catch(t){Ce(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}},[e.detailLoadFailed]),Jt=(0,G.useCallback)(async t=>{let n=t.trim();if(n){ye(`catalog`),ge(!0),xe(n),Ce(null),Te(null),ke(null),De(!0);try{let e=await et(n);Ce(e),xe(e.name)}catch(t){Ce(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}}},[e.detailLoadFailed]),Yt=(0,G.useCallback)(async(t,n,r)=>{let i=r?.trim()||$;if(i){it.current=i,ye(`store`),ge(!0),xe(n?.trim()||t),Ce(null),Te(null),ke(null),De(!0);try{let e=await Qe(t,{provider:i});xe(e.name),Te(e.skillDocPreview)}catch(t){Te(null),ke(t instanceof Error?t.message:e.detailLoadFailed)}finally{De(!1)}}},[$,e.detailLoadFailed]),Xt=(0,G.useCallback)(async(t,n)=>{fe(t),me(e=>({...e,[t]:n})),I(null);try{return await Je(t,n),await Ht({silent:!0}),!0}catch(n){return me(e=>{let{[t]:n,...r}=e;return r}),Gt(`error`,n instanceof Error?n.message:e.skillToggleFailed),!1}finally{fe(null),me(e=>{let{[t]:n,...r}=e;return r})}},[Ht,Gt,e.skillToggleFailed]),Zt=(0,G.useCallback)(async()=>{I(null),p(!0),g(null);try{await te()}catch(t){g(t instanceof Error?t.message:e.reloadFailed),p(!1);return}await Ht()},[Ht,e.reloadFailed]),Qt=(0,G.useMemo)(()=>{let e=O.trim().toLowerCase();return e?_t.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):_t},[_t,O]),$t=(0,G.useMemo)(()=>{let e=_t.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>Q[e.name]??e.enabled).length}},[_t,Q]),en=(0,G.useMemo)(()=>{let e=_t.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>Q[e.name]??e.enabled).length}},[_t,Q]),tn=(0,G.useMemo)(()=>be?_t.find(e=>e.name===be):void 0,[_t,be]),nn=tn==null?!0:Q[be]??tn.enabled,rn=tn?.directoryId??null,an=tn?.managed??!1,on=(0,G.useMemo)(()=>ve!==`store`||!be?null:pe(it.current??$,be),[ve,be,$]),sn=(0,G.useMemo)(()=>{let e=Qt;return L===`installed`&&R!==`all`&&(e=R===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===R)),e},[Qt,L,R]),cn=(0,G.useMemo)(()=>{let e=new Set,t=[];for(let n of sn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=se.indexOf(e),r=se.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[sn]),ln=(0,G.useCallback)(t=>e.categoryLabel?.[t]||t,[e.categoryLabel]),un=(0,G.useMemo)(()=>V?sn.filter(e=>e.category===V):sn,[sn,V]);(0,G.useEffect)(()=>{H(``)},[R]);let dn=(0,G.useCallback)(e=>Q[e.name]??e.enabled,[Q]),fn=(0,G.useMemo)(()=>un.filter(e=>!dn(e)).length,[un,dn]),pn=(0,G.useMemo)(()=>{let e=un;return U===`disabled`&&(e=e.filter(e=>!dn(e))),U===`enabled`&&(e=e.filter(e=>dn(e))),[...e].toSorted((e,t)=>{let n=dn(e);return n===dn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[un,U,dn]),mn=async t=>{I(null),v(!0),g(null);try{let n;try{n=await rt(t)}catch{g(e.invalidFile),Gt(`error`,e.invalidFile);return}let r=await Ke(n,{overwrite:!0});lt.current=!0,await Ht(),Gt(`success`,Kt(r)),K(!1),q(null),ee(`installed`),B(`installed`),await Jt(r.availability?.skillName||r.skillId)}catch(t){g(t instanceof Error?t.message:e.uploadFailed),Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{v(!1)}},hn=()=>{re&&mn(re)},gn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&q(t)},_n=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(Y(!0),e.dataTransfer.dropEffect=`copy`)},vn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||Y(!1)},yn=e=>{e.preventDefault(),e.stopPropagation(),Y(!1);let t=e.dataTransfer?.files?.[0];t&&q(t)},bn=t=>{switch(t){case`builtin`:return e.source.builtin;case`workspace`:return e.source.workspace;case`global`:return e.source.global;case`extra`:return e.source.extra;default:return t}},xn=async()=>{let t=le,n=he&&ve===`catalog`&&rn===t;if(ce(!1),ue(null),t){I(null);try{await qe(t),lt.current=!0,await Ht(),n&&(ge(!1),ye(`catalog`),xe(``),Ce(null),Te(null),ke(null))}catch(t){g(t instanceof Error?t.message:e.deleteFailed)}}},Sn=(0,G.useCallback)(e=>_t.some(t=>t.name===e),[_t]),Cn=(0,G.useCallback)(async t=>{let r=(t?.name??be).trim();if(!r)return;let i=t?.source??ve;if(i===`catalog`){let e=_t.find(e=>e.name===r);if(e&&!(Q[e.name]??e.enabled))return}I(null);let a=i===`store`&&!Sn(r);Le(r);try{if(a){let e=t?.providerOverride?.trim()||it.current||$;await $e({name:r,overwrite:!1,...e?{provider:e}:{}}),lt.current=!0,await Ht({silent:!0})}ge(!1),n(`/chat/new?skill=${encodeURIComponent(r)}`)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Le(null)}},[_t,be,ve,Q,Sn,Ht,n,Gt,e.uploadFailed,$]),wn=(0,G.useCallback)(async(t,n)=>{let r=Sn(t);if(!(r&&!window.confirm(e.marketplaceReinstallConfirm))){I(null),Fe(t);try{let e=n?.providerOverride?.trim()||(n?.useDetailProvider?it.current??$:$),i=await $e({name:t,overwrite:r,...e?{provider:e}:{}});lt.current=!0,await Ht({silent:!0}),Gt(`success`,Kt(i)),ee(`installed`),B(`installed`),await Jt(i.availability?.skillName||i.skillId||t)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Fe(null)}}},[Sn,Kt,Ht,$,Jt,Gt,e.marketplaceReinstallConfirm,e.uploadFailed]),{pathname:Tn}=a();return{sk:e,hasToken:t,catalog:_t,loading:xt,error:Wt,uploading:_,searchQuery:O,setSearchQuery:k,actionFeedback:F,skillDiagnostics:Ge,mainTab:L,setMainTab:ee,sourceFilter:R,setSourceFilter:B,builtinCategoryFilter:V,setBuiltinCategoryFilter:H,installOpen:ne,setInstallOpen:K,pendingFile:re,setPendingFile:q,dropActive:J,setDropActive:Y,confirmOpen:oe,setConfirmOpen:ce,confirmId:le,setConfirmId:ue,togglingSkillName:de,enabledOverride:Q,detailOpen:he,setDetailOpen:ge,detailSource:ve,setDetailSource:ye,detailTitle:be,setDetailTitle:xe,detailCatalogPreview:Se,setDetailCatalogPreview:Ce,detailMarketplacePreview:we,setDetailMarketplacePreview:Te,detailLoading:Ee,detailError:Oe,setDetailError:ke,marketSort:Ae,setMarketSort:je,marketPage:Me,setMarketPage:Ne,mpLoading:Lt,mpError:Rt,mpPayload:It,searchActive:P,searchInputActive:N,resultTab:ft,setResultTab:pt,aggregatedTabCounts:At,aggregatedProviderStatus:Mt,aggregatedAllFailed:Pt,installingMarketName:Pe,usingSkillInChatName:Ie,onUseSkillInChat:Cn,marketCategoryId:Re,setMarketCategoryId:ze,mpCategories:zt,mpCategoriesError:Vt,mpCategoriesLoading:Bt,marketBrowseProvider:$,setMarketBrowseProvider:Be,registeredProviders:St,builtinTabStats:$t,userTabStats:en,detailEnabled:nn,detailDirectoryId:rn,detailManaged:an,detailExternalUrl:on,filteredCatalog:sn,builtinCategories:cn,categoryFilteredCatalog:un,catalogDisplayRows:pn,catalogDisabledCount:fn,catalogStatusFilter:U,setCatalogStatusFilter:W,resolveSkillEnabled:dn,inSettingsShell:Tn.startsWith(`/settings/`),categoryLabel:ln,onReloadClick:Zt,openSkillDetail:qt,openMarketplaceDetail:Yt,onSkillToggle:Xt,onInstallSubmit:hn,onFileInputChange:gn,onModalDragOver:_n,onModalDragLeave:vn,onModalDrop:yn,sourceLabel:bn,runDelete:xn,onMarketInstall:wn,isSkillInstalledByName:Sn}}function at(){let e=(0,ne.c)(2),t=it(),n;return e[0]===t?n=e[1]:(n=(0,K.jsx)(Le,{vm:t}),e[0]=t,e[1]=n),n}export{at as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./check-BODqo66o.js";import{t as c}from"./messages-Bwu1tG3T.js";import{n as l}from"./locale-store-d9Cylz62.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$l as d,$t as f,Ao as p,Cn as m,Fo as h,Go as g,Io as _,Is as v,Kl as y,Ks as b,Ml as x,Mo as S,Ms as C,Nl as w,No as T,Os as E,Po as D,Ro as O,Sc as k,Xs as A,Yc as j,_n as M,an as N,ao as P,au as F,cl as I,cn as L,dn as R,en as z,et as B,fn as V,gc as ee,gn as te,hn as ne,hs as H,in as re,jo as U,ko as W,ks as G,ln as ie,ls as ae,mn as oe,nn as se,on as K,pn as ce,qo as q,rn as le,rr as ue,sn as de,tn as fe,ul as pe,un as me,uu as he,vn as ge,wn as _e,xn as ve,ys as ye}from"./index-DHRxn7Sy.js";import{t as be}from"./page-tabs-C1jBfKTZ.js";import{t as xe}from"./connector-logo-DGjjzBIH.js";var J=n(),Y=e(t(),1),X=r();function Se(e){let t=(0,J.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:s}=e,c;t[0]===n.timezone?c=t[1]:(c=()=>m.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=c);let[l,u]=(0,Y.useState)(c),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!m.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=d);let[f,p]=(0,Y.useState)(d),h;t[4]===n.pronouns?h=t[5]:(h=()=>!!n.pronouns&&!ve.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=h);let[_,v]=(0,Y.useState)(h),y;bb0:{if(f){y=`__custom__`;break bb0}y=m.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let b=y,x;t[6]!==r||t[7]!==n?(x=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=x):x=t[8];let S=x,C;t[9]===a?C=t[10]:(C=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=C);let w=C,T;t[11]===i.callName?T=t[12]:(T=(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=T);let E;t[13]===S?E=t[14]:(E=e=>S({callName:e.target.value}),t[13]=S,t[14]=E);let D;t[15]!==s||t[16]!==i.callNamePlaceholder||t[17]!==E||t[18]!==n.callName?(D=(0,X.jsx)(`input`,{className:s,value:n.callName,onChange:E,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=s,t[16]=i.callNamePlaceholder,t[17]=E,t[18]=n.callName,t[19]=D):D=t[19];let O;t[20]!==T||t[21]!==D?(O=(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[T,D]}),t[20]=T,t[21]=D,t[22]=O):O=t[22];let k;t[23]===i.pronouns?k=t[24]:(k=(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=k);let A=_?`__custom__`:n.pronouns,j;t[25]!==S||t[26]!==n.pronouns?(j=e=>{if(e.target.value===`__custom__`){v(!0),ve.some(e=>e.value===n.pronouns)&&S({pronouns:``});return}v(!1),S({pronouns:e.target.value})},t[25]=S,t[26]=n.pronouns,t[27]=j):j=t[27];let M;t[28]===i.pronounsPlaceholder?M=t[29]:(M=(0,X.jsx)(q,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=M);let N;t[30]===w?N=t[31]:(N=ve.map(e=>(0,X.jsx)(q,{value:e.value,children:w(e.labelEn,e.labelZh)},e.value)),t[30]=w,t[31]=N);let P;t[32]===i.custom?P=t[33]:(P=(0,X.jsx)(q,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=P);let F;t[34]!==s||t[35]!==A||t[36]!==j||t[37]!==M||t[38]!==N||t[39]!==P?(F=(0,X.jsxs)(g,{className:s,value:A,onChange:j,children:[M,N,P]}),t[34]=s,t[35]=A,t[36]=j,t[37]=M,t[38]=N,t[39]=P,t[40]=F):F=t[40];let I;t[41]!==s||t[42]!==i.pronounsPlaceholder||t[43]!==_||t[44]!==S||t[45]!==n.pronouns?(I=_?(0,X.jsx)(`input`,{className:o(s,`mt-1 text-xs`),value:n.pronouns,onChange:e=>S({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=s,t[42]=i.pronounsPlaceholder,t[43]=_,t[44]=S,t[45]=n.pronouns,t[46]=I):I=t[46];let L;t[47]!==k||t[48]!==F||t[49]!==I?(L=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[k,F,I]}),t[47]=k,t[48]=F,t[49]=I,t[50]=L):L=t[50];let R;t[51]===i.timezone?R=t[52]:(R=(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=R);let z;t[53]===s?z=t[54]:(z=o(s,`min-w-0 flex-1`),t[53]=s,t[54]=z);let B;t[55]===S?B=t[56]:(B=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),S({timezone:e.target.value})},t[55]=S,t[56]=B);let V;t[57]===w?V=t[58]:(V=m.map(e=>(0,X.jsx)(q,{value:e.value,children:w(e.labelEn,e.labelZh)},e.value)),t[57]=w,t[58]=V);let ee;t[59]===i.timezoneCustom?ee=t[60]:(ee=(0,X.jsx)(q,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=ee);let te;t[61]!==z||t[62]!==B||t[63]!==V||t[64]!==ee||t[65]!==b?(te=(0,X.jsxs)(g,{className:z,value:b,onChange:B,children:[V,ee]}),t[61]=z,t[62]=B,t[63]=V,t[64]=ee,t[65]=b,t[66]=te):te=t[66];let ne;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ne=o(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,ae.press),t[67]=ne):ne=t[67];let H;t[68]===S?H=t[69]:(H=()=>{let e=_e();if(!e)return;let t=m.some(t=>t.value===e);p(!t),u(t?``:e),S({timezone:e})},t[68]=S,t[69]=H);let re;t[70]!==i.timezoneDetect||t[71]!==H?(re=(0,X.jsx)(`button`,{type:`button`,className:ne,onClick:H,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=H,t[72]=re):re=t[72];let U;t[73]!==te||t[74]!==re?(U=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[te,re]}),t[73]=te,t[74]=re,t[75]=U):U=t[75];let W;t[76]!==l||t[77]!==s||t[78]!==f||t[79]!==S?(W=f?(0,X.jsx)(`input`,{className:o(s,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),S({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=s,t[78]=f,t[79]=S,t[80]=W):W=t[80];let G;t[81]!==R||t[82]!==U||t[83]!==W?(G=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[R,U,W]}),t[81]=R,t[82]=U,t[83]=W,t[84]=G):G=t[84];let ie;t[85]===i.notes?ie=t[86]:(ie=(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=ie);let oe;t[87]===s?oe=t[88]:(oe=o(s,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=s,t[88]=oe);let se;t[89]===S?se=t[90]:(se=e=>S({notes:e.target.value}),t[89]=S,t[90]=se);let K;t[91]!==i.notesPlaceholder||t[92]!==oe||t[93]!==se||t[94]!==n.notes?(K=(0,X.jsx)(`textarea`,{className:oe,value:n.notes,onChange:se,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=oe,t[93]=se,t[94]=n.notes,t[95]=K):K=t[95];let ce;t[96]!==ie||t[97]!==K?(ce=(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ie,K]}),t[96]=ie,t[97]=K,t[98]=ce):ce=t[98];let le;return t[99]!==O||t[100]!==L||t[101]!==G||t[102]!==ce?(le=(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[O,L,G,ce]}),t[99]=O,t[100]=L,t[101]=G,t[102]=ce,t[103]=le):le=t[103],le}var Ce={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function we(e){if(e.branding?.logoUrl)return e.branding;let t=Ce[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function Te(e){let t=(0,J.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:s}=e,l=c(r).you,[u,d]=(0,Y.useState)(!1),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?l.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),m,g;t[0]===n?(m=t[1],g=t[2]):(m=()=>{n&&d(!1)},g=[n],t[0]=n,t[1]=m,t[2]=g),(0,Y.useEffect)(m,g);let _;t[3]!==i||t[4]!==a?(_=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=v):v=t[6];let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(ye,{className:`size-4`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>d(!1),t[8]=b):b=t[8];let x=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,E;t[9]===x?E=t[10]:(E=o(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,x),t[9]=x,t[10]=E);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=O):O=t[11];let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>d(!0),t[12]=k):k=t[12];let A=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,j;t[13]===A?j=t[14]:(j=o(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,A),t[13]=A,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(C,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=M):M=t[15];let N=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),P;t[16]===N?P=t[17]:(P=(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:N}),t[16]=N,t[17]=P);let F;t[18]!==i||t[19]!==l.cancel?(F=(0,X.jsx)(p,{asChild:!0,children:(0,X.jsx)(H,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=F):F=t[20];let I=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,L;t[21]!==u||t[22]!==s?(L=()=>s(u),t[21]=u,t[22]=s,t[23]=L):L=t[23];let R;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,X.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[24]=R):R=t[24];let z=i?l.disconnecting:l.disconnectAction,B;t[25]!==i||t[26]!==I||t[27]!==L||t[28]!==z?(B=(0,X.jsxs)(H,{type:`button`,variant:`secondary`,className:I,disabled:i,onClick:L,children:[R,z]}),t[25]=i,t[26]=I,t[27]=L,t[28]=z,t[29]=B):B=t[29];let V;return t[30]!==F||t[31]!==B?(V=(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[F,B]}),t[30]=F,t[31]=B,t[32]=V):V=t[32],(0,X.jsx)(W,{open:n!==null,onOpenChange:_,children:(0,X.jsxs)(D,{children:[v,(0,X.jsxs)(U,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(h,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,X.jsx)(S,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,X.jsx)(p,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:y})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:l.disconnectAccount.replace(`{{account}}`,f)}):null,(0,X.jsx)(`p`,{children:l.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:b,className:E,children:[O,(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:k,disabled:!n?.derivedUnderstandingCount,className:j,children:[M,(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),P]})]})]}),V]})]})})}var Ee=new Set([`overview`,`profile`,`understanding`,`sources`,`controls`]),De=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],Oe=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function ke(e,t){return e.replace(`{{count}}`,String(t))}function Ae(e,t){let n=Date.parse(e);return Number.isFinite(n)?B(n,t):e}function je(e){return e===`review`?`understanding`:e===`privacy`?`controls`:e&&Ee.has(e)?e:`overview`}function Me(){let e=(0,J.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(P,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,X.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,X.jsx)(P,{className:`h-64 rounded-2xl`}),(0,X.jsx)(P,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function Ne(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function Pe(e){let t=(0,J.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(n.statement),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),x=n.status!==`active`,S=x?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,w;t[0]===S?w=t[1]:(w=o(`rounded-xl border p-3.5`,S),t[0]=S,t[1]=w);let T;t[2]!==a||t[3]!==m||t[4]!==f||t[5]!==g||t[6]!==v||t[7]!==n||t[8]!==r||t[9]!==x||t[10]!==c||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(T=f?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`textarea`,{className:o(Oe,`min-h-20 resize-y`),value:m,onChange:e=>h(e.target.value),placeholder:i.updatePlaceholder}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{h(n.statement),p(!1)},children:i.cancel}),(0,X.jsx)(H,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!m.trim(),onClick:()=>{u(m.trim()),p(!1)},children:i.save})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(b,{className:`size-3 text-accent`,"aria-hidden":!0}),Ne(n,i)]}),(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>1?(0,X.jsx)(`span`,{children:ke(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,X.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,Ae(n.latestEvidenceAt,r))}):null]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,X.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,X.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,X.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,X.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,X.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:v,onClick:()=>{if(g){_(null);return}y(!0),K(n.id).then(e=>_(e.history)).finally(()=>y(!1))},children:[(0,X.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,X.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,X.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,X.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,X.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,X.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,X.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,X.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Ae(n.updatedAt,r)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,X.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ke(i.evidenceCount,n.evidenceCount)})]})]})]}),g?(0,X.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),g.map(e=>(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,X.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,X.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:Ae(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=m,t[4]=f,t[5]=g,t[6]=v,t[7]=n,t[8]=r,t[9]=x,t[10]=c,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=T):T=t[15];let E;return t[16]!==w||t[17]!==T?(E=(0,X.jsx)(`article`,{className:w,children:T}),t[16]=w,t[17]=T,t[18]=E):E=t[18],E}function Fe(e){let t=(0,J.c)(84),{source:n,language:r,t:i,onConfigure:a,onDisconnect:s}=e,c=n.installed?n.enabled?i.connected:i.paused:i.available,l;t[0]!==n.accountCount||t[1]!==n.accountLabel||t[2]!==n.accountOrdinal||t[3]!==i.sourceAccountFallback?(l=n.accountLabel??(n.accountCount&&n.accountCount>1&&n.accountOrdinal?i.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),t[0]=n.accountCount,t[1]=n.accountLabel,t[2]=n.accountOrdinal,t[3]=i.sourceAccountFallback,t[4]=l):l=t[4];let u=l,d;t[5]!==n.lastHealthStatus||t[6]!==i.healthIssue||t[7]!==i.healthOk||t[8]!==i.sourceHealth?(d=n.lastHealthStatus?i.sourceHealth.replace(`{{status}}`,n.lastHealthStatus===`ok`?i.healthOk:i.healthIssue):null,t[5]=n.lastHealthStatus,t[6]=i.healthIssue,t[7]=i.healthOk,t[8]=i.sourceHealth,t[9]=d):d=t[9];let f=d,p=`${i.manageSources}: ${n.displayName}`,m;t[10]===a?m=t[11]:(m=e=>{e.target===e.currentTarget&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a()))},t[10]=a,t[11]=m);let h=n.displayName,g;t[12]===n?g=t[13]:(g=we(n),t[12]=n,t[13]=g);let _;t[14]!==n.displayName||t[15]!==g?(_=(0,X.jsx)(xe,{connector:{displayName:h,branding:g},size:`sm`}),t[14]=n.displayName,t[15]=g,t[16]=_):_=t[16];let v;t[17]===n.displayName?v=t[18]:(v=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.displayName}),t[17]=n.displayName,t[18]=v);let y;t[19]===u?y=t[20]:(y=u?(0,X.jsx)(`p`,{className:`mt-0.5 truncate text-xs font-medium text-fg-muted`,children:u}):null,t[19]=u,t[20]=y);let b;t[21]===n.description?b=t[22]:(b=(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.description}),t[21]=n.description,t[22]=b);let x;t[23]!==b||t[24]!==v||t[25]!==y?(x=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[v,y,b]}),t[23]=b,t[24]=v,t[25]=y,t[26]=x):x=t[26];let S;t[27]!==x||t[28]!==_?(S=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[_,x]}),t[27]=x,t[28]=_,t[29]=S):S=t[29];let C=n.installed&&n.enabled?`bg-success-soft text-fg`:`bg-surface-hover text-fg-muted`,w;t[30]===C?w=t[31]:(w=o(`shrink-0 rounded-full px-2 py-1 text-[11px] font-medium`,C),t[30]=C,t[31]=w);let T;t[32]!==c||t[33]!==w?(T=(0,X.jsx)(`span`,{className:w,children:c}),t[32]=c,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==S||t[36]!==T?(E=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,T]}),t[35]=S,t[36]=T,t[37]=E):E=t[37];let D;t[38]!==n.access.context||t[39]!==i.sourceContext?(D=n.access.context?(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceContext}):null,t[38]=n.access.context,t[39]=i.sourceContext,t[40]=D):D=t[40];let O;t[41]!==n.access.memory||t[42]!==i.sourceMemory?(O=n.access.memory?(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceMemory}):null,t[41]=n.access.memory,t[42]=i.sourceMemory,t[43]=O):O=t[43];let k;t[44]!==n.access.read||t[45]!==i.sourceRead?(k=n.access.read?(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceRead}):null,t[44]=n.access.read,t[45]=i.sourceRead,t[46]=k):k=t[46];let A;t[47]!==n.access.write||t[48]!==i.sourceWrite?(A=n.access.write?(0,X.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-fg`,children:i.sourceWrite}):null,t[47]=n.access.write,t[48]=i.sourceWrite,t[49]=A):A=t[49];let j;t[50]!==D||t[51]!==O||t[52]!==k||t[53]!==A?(j=(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[D,O,k,A]}),t[50]=D,t[51]=O,t[52]=k,t[53]=A,t[54]=j):j=t[54];let M;t[55]!==f||t[56]!==r||t[57]!==n.derivedUnderstandingCount||t[58]!==n.installed||t[59]!==n.knowledgeItemCount||t[60]!==n.lastActivityAt||t[61]!==n.lastSyncAt||t[62]!==n.lastSyncError||t[63]!==n.lastSyncStatus||t[64]!==i.sourceDerivedCount||t[65]!==i.sourceKnowledgeCount||t[66]!==i.sourceLastSync||t[67]!==i.sourceLastUsed||t[68]!==i.sourceNeverUsed||t[69]!==i.sourceSyncFailed?(M=n.installed?(0,X.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-edge-subtle pt-3 text-xs text-fg-muted`,children:[f?(0,X.jsx)(`p`,{children:f}):null,(0,X.jsx)(`p`,{children:n.lastActivityAt?i.sourceLastUsed.replace(`{{time}}`,Ae(n.lastActivityAt,r)):i.sourceNeverUsed}),n.lastSyncAt?(0,X.jsx)(`p`,{children:i.sourceLastSync.replace(`{{time}}`,Ae(n.lastSyncAt,r))}):null,n.lastSyncStatus===`failed`&&n.lastSyncError?(0,X.jsx)(`p`,{className:`text-danger`,children:i.sourceSyncFailed.replace(`{{error}}`,n.lastSyncError)}):null,(0,X.jsx)(`p`,{children:i.sourceKnowledgeCount.replace(`{{count}}`,String(n.knowledgeItemCount))}),(0,X.jsx)(`p`,{children:i.sourceDerivedCount.replace(`{{count}}`,String(n.derivedUnderstandingCount))})]}):null,t[55]=f,t[56]=r,t[57]=n.derivedUnderstandingCount,t[58]=n.installed,t[59]=n.knowledgeItemCount,t[60]=n.lastActivityAt,t[61]=n.lastSyncAt,t[62]=n.lastSyncError,t[63]=n.lastSyncStatus,t[64]=i.sourceDerivedCount,t[65]=i.sourceKnowledgeCount,t[66]=i.sourceLastSync,t[67]=i.sourceLastUsed,t[68]=i.sourceNeverUsed,t[69]=i.sourceSyncFailed,t[70]=M):M=t[70];let N;t[71]!==s||t[72]!==n.installed||t[73]!==n.instanceId||t[74]!==i.disconnect?(N=n.installed&&n.instanceId?(0,X.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-danger hover:bg-danger-soft hover:text-danger`,onClick:e=>{e.stopPropagation(),s()},children:i.disconnect})}):null,t[71]=s,t[72]=n.installed,t[73]=n.instanceId,t[74]=i.disconnect,t[75]=N):N=t[75];let P;return t[76]!==a||t[77]!==E||t[78]!==j||t[79]!==M||t[80]!==N||t[81]!==p||t[82]!==m?(P=(0,X.jsxs)(`article`,{role:`button`,tabIndex:0,"aria-label":p,className:`cursor-pointer rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-accent/30 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:a,onKeyDown:m,children:[E,j,M,N]}),t[76]=a,t[77]=E,t[78]=j,t[79]=M,t[80]=N,t[81]=p,t[82]=m,t[83]=P):P=t[83],P}function Ie(e){let t=(0,J.c)(58),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:s,onUpdate:c,onDelete:l}=e,[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(``),g=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,_;t[0]===g?_=t[1]:(_=o(`rounded-xl border p-4`,g),t[0]=g,t[1]=_);let v=i.playbookNames[n.id],y;t[2]===v?y=t[3]:(y=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v}),t[2]=v,t[3]=y);let b;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(b=ke(i.playbookRuleCount,n.rules.filter(Le).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=b):b=t[6];let x;t[7]===b?x=t[8]:(x=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:b}),t[7]=b,t[8]=x);let S;t[9]!==y||t[10]!==x?(S=(0,X.jsxs)(`div`,{children:[y,x]}),t[9]=y,t[10]=x,t[11]=S):S=t[11];let w=n.enabled?i.pausePlaybook:i.resumePlaybook,T;t[12]!==r||t[13]!==a||t[14]!==w?(T=(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:w}),t[12]=r,t[13]=a,t[14]=w,t[15]=T):T=t[15];let E;t[16]!==S||t[17]!==T?(E=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,T]}),t[16]=S,t[17]=T,t[18]=E):E=t[18];let D;t[19]!==r||t[20]!==f||t[21]!==m||t[22]!==l||t[23]!==c||t[24]!==n.rules||t[25]!==i.cancel||t[26]!==i.deleteRule||t[27]!==i.disableRule||t[28]!==i.edit||t[29]!==i.enableRule||t[30]!==i.moveDown||t[31]!==i.moveUp||t[32]!==i.save?(D=n.rules.map((e,t)=>(0,X.jsx)(`li`,{className:o(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:f===e.id?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`textarea`,{className:o(Oe,`min-h-16 resize-y`),value:m,onChange:e=>h(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>p(null),children:i.cancel}),(0,X.jsx)(H,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!m.trim(),onClick:()=>{c(e.id,{statement:m.trim()}),p(null)},children:i.save})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>c(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>c(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>c(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,X.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{p(e.id),h(e.statement)},children:[(0,X.jsx)(k,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,X.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,X.jsx)(C,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]})]})},e.id)),t[19]=r,t[20]=f,t[21]=m,t[22]=l,t[23]=c,t[24]=n.rules,t[25]=i.cancel,t[26]=i.deleteRule,t[27]=i.disableRule,t[28]=i.edit,t[29]=i.enableRule,t[30]=i.moveDown,t[31]=i.moveUp,t[32]=i.save,t[33]=D):D=t[33];let O;t[34]===D?O=t[35]:(O=(0,X.jsx)(`ul`,{className:`mt-3 space-y-2`,children:D}),t[34]=D,t[35]=O);let A;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>d(e.target.value),t[36]=A):A=t[36];let j;t[37]!==u||t[38]!==i.newRulePlaceholder?(j=(0,X.jsx)(`input`,{className:Oe,value:u,onChange:A,placeholder:i.newRulePlaceholder}),t[37]=u,t[38]=i.newRulePlaceholder,t[39]=j):j=t[39];let M;t[40]!==r||t[41]!==u?(M=r||!u.trim(),t[40]=r,t[41]=u,t[42]=M):M=t[42];let N;t[43]!==u||t[44]!==s?(N=()=>{s(u.trim()),d(``)},t[43]=u,t[44]=s,t[45]=N):N=t[45];let P;t[46]!==i.addRule||t[47]!==M||t[48]!==N?(P=(0,X.jsx)(H,{type:`button`,variant:`secondary`,disabled:M,onClick:N,children:i.addRule}),t[46]=i.addRule,t[47]=M,t[48]=N,t[49]=P):P=t[49];let F;t[50]!==j||t[51]!==P?(F=(0,X.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[j,P]}),t[50]=j,t[51]=P,t[52]=F):F=t[52];let I;return t[53]!==E||t[54]!==O||t[55]!==F||t[56]!==_?(I=(0,X.jsxs)(`article`,{className:_,children:[E,O,F]}),t[53]=E,t[54]=O,t[55]=F,t[56]=_,t[57]=I):I=t[57],I}function Le(e){return e.enabled}function Re(e){let t=(0,J.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:s,onLater:c,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,X.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,p;t[6]===f?p=t[7]:(p=(0,X.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let m;t[8]===l.callName?m=t[9]:(m=(0,X.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=m);let h;t[10]===a?h=t[11]:(h=e=>a(e.target.value),t[10]=a,t[11]=h);let g;t[12]!==i||t[13]!==r||t[14]!==s?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&s()},t[12]=i,t[13]=r,t[14]=s,t[15]=g):g=t[15];let _=l.meetPlaceholder,v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=o(Oe,`h-10 flex-1 bg-surface-base/90`),t[16]=v):v=t[16];let y;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==h||t[20]!==g?(y=(0,X.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:h,onKeyDown:g,placeholder:_,className:v}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=h,t[20]=g,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==r?(b=i||!r.trim(),t[22]=i,t[23]=r,t[24]=b):b=t[24];let x=i?l.meetSaving:l.meetSave,S;t[25]!==s||t[26]!==b||t[27]!==x?(S=(0,X.jsx)(H,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:b,onClick:s,children:x}),t[25]=s,t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;t[29]!==y||t[30]!==S||t[31]!==m?(C=(0,X.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[m,y,S]}),t[29]=y,t[30]=S,t[31]=m,t[32]=C):C=t[32];let w;t[33]!==n||t[34]!==l.meetSource?(w=n?(0,X.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,X.jsx)(A,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=w):w=t[35];let T;t[36]!==i||t[37]!==c||t[38]!==l.meetLater?(T=(0,X.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:c,children:l.meetLater}),t[36]=i,t[37]=c,t[38]=l.meetLater,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==w||t[42]!==T||t[43]!==d||t[44]!==p?(E=(0,X.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,X.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,C,w,T]})}),t[40]=C,t[41]=w,t[42]=T,t[43]=d,t[44]=p,t[45]=E):E=t[45],E}function ze(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,p]=i(),m=je(r.get(`tab`)),h=_(e=>e.setPageHeader),b=_(e=>e.clearPageHeader),{data:S,error:C,isLoading:T,mutate:D}=u(`/api/you`,de),[P,I]=(0,Y.useState)(null),[B,U]=(0,Y.useState)(!1),[W,G]=(0,Y.useState)(``),[ae,K]=(0,Y.useState)(`preference`),[ve,ye]=(0,Y.useState)(null),[xe,J]=(0,Y.useState)(!1),[Ce,we]=(0,Y.useState)(null),[Ee,Le]=(0,Y.useState)(!1),[ze,Be]=(0,Y.useState)(``),[Ve,He]=(0,Y.useState)(!1),[Ue,We]=(0,Y.useState)(null),[Ge,Ke]=(0,Y.useState)(!1),[qe,Je]=(0,Y.useState)(null),[Ye,Xe]=(0,Y.useState)(!1),[Ze,Qe]=(0,Y.useState)(null),$e=(0,Y.useRef)(null),et=(0,Y.useRef)(null),Z=S?.profile??{callName:``,pronouns:``,timezone:``,notes:``},tt=(0,Y.useMemo)(()=>S?.understanding.filter(e=>e.status===`active`)??[],[S]),Q=(0,Y.useMemo)(()=>S?.understanding.filter(e=>e.status!==`active`)??[],[S]),nt=(0,Y.useMemo)(()=>new Map(De.map(e=>[e,tt.filter(t=>t.facet===e)])),[tt]),rt=Ue??S?.controls??null,it=S?.sources.filter(e=>e.installed&&e.enabled)??[],at=it.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)),$=(e,t)=>{let n=new URLSearchParams(r);e===`overview`?n.delete(`tab`):n.set(`tab`,e),t?n.set(`status`,t):n.delete(`status`),p(n,{replace:!0})},ot=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)};(0,Y.useLayoutEffect)(()=>(h({startExtra:null,main:(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,X.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:null}),()=>b()),[b,h,t.subtitle,t.title]),(0,Y.useEffect)(()=>{!S||S.profile.callName||Be(S.profileSetup.callNameSuggestion?.value??``)},[S,S?.profile.callName,S?.profileSetup.callNameSuggestion?.id]);async function st(e,n,r){I(e.id);try{let t=await ne(e.id,{action:n,content:r});await D(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),D()}catch{O({type:`error`,title:t.title,message:t.saveError})}finally{I(null)}}async function ct(e,n){I(`consent:${e}`);try{await se(e,n),await D(),O({type:`success`,title:t.title,message:t.saved})}catch{O({type:`error`,title:t.title,message:t.saveError})}finally{I(null)}}async function lt(){let e=W.trim();if(e){I(`understanding:new`);try{await fe({content:e,kind:ae}),G(``),U(!1),await D(),O({type:`success`,title:t.understandingTitle,message:t.saved})}catch{O({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{I(null)}}}async function ut(){if(Q.length){I(`understanding:batch`);try{await f(Q.map(e=>e.id),`confirm`),await D()}catch{O({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{I(null)}}}async function dt(e,n){I(`conflict:${e}`);try{await me(e,n),await D()}catch{O({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{I(null)}}async function ft(e){I(`grant:${e}`);try{await R(e),await D()}catch{O({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{I(null)}}async function pt(r,i){I(`insight:${r.id}`);try{let t=await ce(r.id,{action:i,uiLocale:e});await D(),i===`apply`&&t.href&&n(t.href)}catch{O({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{I(null)}}async function mt(e){I(`playbook:${e.id}`);try{await V(e.id,!e.enabled),await D()}catch{O({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{I(null)}}async function ht(e,n){I(`playbook:${e}`);try{await n(),await D()}catch{O({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{I(null)}}async function gt(){if(ve){I(ve.id);try{await L(ve.id);let e=ve.id;ye(null),await D(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),D()}catch{O({type:`error`,title:t.title,message:t.saveError})}finally{I(null)}}}async function _t(){if(Ce){Le(!0);try{let e=await M(Ce);J(!1),we(null),await D(t=>t&&{...t,...e},{revalidate:!1})}catch{O({type:`error`,title:t.title,message:t.saveError})}finally{Le(!1)}}}async function vt(){let e=ze.trim();if(!(!e||Ve)){He(!0);try{let t=await M({callName:e,timezone:Z.timezone||_e()});await D(e=>e&&{...e,...t},{revalidate:!1})}catch{O({type:`error`,title:t.title,message:t.saveError})}finally{He(!1)}}}async function yt(){if(!Ve){He(!0);try{let e=await ge(`snooze`);await D(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{O({type:`error`,title:t.title,message:t.saveError})}finally{He(!1)}}}function bt(){we(Z),J(!0),$(`profile`),requestAnimationFrame(()=>$e.current?.scrollIntoView({behavior:`smooth`,block:`start`}))}function xt(e){K(e),U(!0),$(`understanding`)}async function St(){if(rt){Ke(!0);try{We(await te(rt)),await D(),O({type:`success`,title:t.title,message:t.saved})}catch{O({type:`error`,title:t.title,message:t.saveError})}finally{Ke(!1)}}}async function Ct(e){if(!(!qe?.instanceId||Ye)){Xe(!0);try{let n=await re(qe.instanceId,e);Je(null),await D(),O({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{O({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{Xe(!1)}}}async function wt(){if(!Ze){Qe(`export`);try{let e=await N(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{O({type:`error`,title:t.transferTitle,message:t.saveError})}finally{Qe(null)}}}async function Tt(e){if(!(!e||Ze)){Qe(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await ie(JSON.parse(await e.text()));await D(),$(`understanding`,`review`),O({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{O({type:`error`,title:t.transferTitle,message:t.importError})}finally{et.current&&(et.current.value=``),Qe(null)}}}return(0,X.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(be,{items:[{id:`overview`,label:t.tabs.overview,icon:pe},{id:`profile`,label:t.tabs.profile,icon:y},{id:`understanding`,label:t.tabs.understanding,icon:F,count:Q.length||void 0},{id:`sources`,label:t.tabs.sources,icon:w},{id:`controls`,label:t.tabs.controls,icon:A}],activeTab:m,onChange:$,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),T?(0,X.jsx)(Me,{}):C||!S?(0,X.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,S&&m===`overview`?(0,X.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Z.callName&&S.profileSetup.shouldPrompt?(0,X.jsx)(Re,{suggestion:S.profileSetup.callNameSuggestion,draft:ze,busy:Ve,onDraftChange:Be,onSave:()=>void vt(),onLater:()=>void yt(),t}):null,Q.length>0||at.length>0||!Z.callName?(0,X.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[Q.length>0?(0,X.jsxs)(H,{type:`button`,variant:`secondary`,onClick:()=>$(`understanding`,`review`),children:[ke(t.reviewCount,Q.length),(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0})]}):null,at.length>0?(0,X.jsxs)(H,{type:`button`,variant:`secondary`,onClick:()=>$(`sources`),children:[ke(t.sourceIssues,at.length),(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0})]}):null,Z.callName?null:(0,X.jsxs)(H,{type:`button`,variant:`secondary`,onClick:bt,children:[t.completeProfile,(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,X.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-gradient-to-br from-accent-soft/55 via-surface-panel to-surface-panel p-5`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.heroTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.heroBody}),(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>$(`understanding`),children:[(0,X.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:tt.length}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,X.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>$(`sources`),children:[(0,X.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:it.length}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,X.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>$(`understanding`,`review`),children:[(0,X.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Q.length}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})]}),S.insights.length>0?(0,X.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(j,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.insightsHint}),(0,X.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:S.insights.map(e=>(0,X.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?ke(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,X.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:P===`insight:${e.id}`,onClick:()=>void pt(e,`dismiss`),children:t.notNow}),(0,X.jsx)(H,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:P===`insight:${e.id}`,onClick:()=>void pt(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,X.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(y,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>$(`profile`),children:(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0})})]}),(0,X.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,X.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Z.callName||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,X.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Z.timezone||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,X.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Z.pronouns||`—`})]}),Z.notes?(0,X.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,X.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:Z.notes})]}):null]})]}),(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(F,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>$(`understanding`),children:(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0})})]}),(0,X.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[tt.slice(0,4).map(e=>(0,X.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),tt.length===0?(0,X.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,S&&m===`profile`?(0,X.jsxs)(`div`,{id:`you-panel-profile`,role:`tabpanel`,"aria-labelledby":`you-tab-profile`,className:`space-y-5`,children:[(0,X.jsx)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:t.profileOwnershipHint}),(0,X.jsxs)(`section`,{ref:$e,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,X.jsx)(y,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),xe?null:(0,X.jsxs)(H,{type:`button`,variant:`secondary`,onClick:bt,children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),xe&&Ce?(0,X.jsxs)(`div`,{className:`mt-5`,children:[(0,X.jsx)(Se,{value:Ce,onChange:we,language:e,inputClassName:Oe,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,X.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,X.jsx)(H,{type:`button`,variant:`ghost`,onClick:()=>{J(!1),we(null)},children:t.cancel}),(0,X.jsx)(H,{type:`button`,variant:`primary`,disabled:Ee,onClick:()=>void _t(),children:Ee?t.saving:t.save})]})]}):(0,X.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,X.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Z.callName||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,X.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Z.timezone||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,X.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Z.pronouns||`—`})]}),(0,X.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,X.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:Z.notes||`—`})]})]})]}),(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.structuredContextHint}),(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>xt(`preference`),children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,X.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>xt(`boundary`),children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,X.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>xt(`current_state`),children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]})]})]}),(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,X.jsx)(he,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.playbooksHint}),S.playbooks.length>0?(0,X.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:S.playbooks.map(e=>(0,X.jsx)(Ie,{playbook:e,busy:P===`playbook:${e.id}`,t,onToggleGroup:()=>void mt(e),onCreate:t=>void ht(e.id,()=>z(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void ht(e.id,()=>oe(e.id,t,n)),onDelete:t=>void ht(e.id,()=>le(e.id,t))},e.id))}):(0,X.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,S&&m===`understanding`?(0,X.jsxs)(`div`,{id:`you-panel-understanding`,role:`tabpanel`,"aria-labelledby":`you-tab-understanding`,className:`space-y-6`,children:[(0,X.jsx)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs text-fg-muted`,children:t.memoryScope}),(0,X.jsxs)(`section`,{className:`border-b border-edge pb-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.addUnderstanding}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.addUnderstandingHint})]}),B?null:(0,X.jsxs)(H,{type:`button`,variant:`secondary`,onClick:()=>U(!0),children:[(0,X.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t.add]})]}),B?(0,X.jsxs)(`div`,{className:`mt-3 rounded-xl border border-edge bg-surface-panel p-3`,children:[(0,X.jsx)(`textarea`,{className:o(Oe,`min-h-24 resize-y`),value:W,onChange:e=>G(e.target.value),placeholder:t.understandingPlaceholder}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[(0,X.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,X.jsx)(g,{value:ae,onChange:e=>K(e.target.value),children:Object.entries(t.understandingKinds).map(([e,t])=>(0,X.jsx)(q,{value:e,children:t},e))})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(H,{type:`button`,variant:`ghost`,onClick:()=>{U(!1),G(``)},children:t.cancel}),(0,X.jsx)(H,{type:`button`,variant:`primary`,disabled:!W.trim()||P===`understanding:new`,onClick:()=>void lt(),children:t.add})]})]})]}):null]}),S.conflictGroups.some(e=>e.unresolved)?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,X.jsx)(`div`,{className:`mt-3 space-y-3`,children:S.conflictGroups.filter(e=>e.unresolved).map(n=>(0,X.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[Ne(r,t),` · `,Ae(r.updatedAt,e)]})]}),(0,X.jsx)(H,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:P===`conflict:${n.id}`,onClick:()=>void dt(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,S.consentRequests.length>0?(0,X.jsxs)(`section`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),S.consentRequests.map(e=>(0,X.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,X.jsx)(H,{type:`button`,variant:`ghost`,disabled:P===`consent:${e.id}`,onClick:()=>void ct(e.id,`deny`),children:t.consentDeny}),(0,X.jsx)(H,{type:`button`,variant:`secondary`,disabled:P===`consent:${e.id}`,onClick:()=>void ct(e.id,`once`),children:t.consentOnce}),(0,X.jsx)(H,{type:`button`,variant:`secondary`,disabled:P===`consent:${e.id}`,onClick:()=>void ct(e.id,`session`),children:t.consentSession}),(0,X.jsx)(H,{type:`button`,variant:`primary`,disabled:P===`consent:${e.id}`,onClick:()=>void ct(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,Q.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,X.jsx)(H,{type:`button`,variant:`secondary`,disabled:P===`understanding:batch`,onClick:()=>void ut(),children:t.reviewAll})]}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Q.map(n=>(0,X.jsx)(Pe,{item:n,language:e,t,busy:P===n.id,onConfirm:()=>void st(n,`confirm`),onReject:()=>void st(n,`reject`),onUpdate:e=>void st(n,`update`,e),onForget:()=>ye(n)},n.id))})]}):tt.length>0?(0,X.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,X.jsx)(s,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null,De.map(n=>{let r=nt.get(n)??[];return r.length===0?null:(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,X.jsx)(Pe,{item:n,language:e,t,busy:P===n.id,onConfirm:()=>void st(n,`confirm`),onReject:()=>void st(n,`reject`),onUpdate:e=>void st(n,`update`,e),onForget:()=>ye(n)},n.id))})]},n)}),S.understanding.length===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,S&&m===`sources`?(0,X.jsxs)(`div`,{id:`you-panel-sources`,role:`tabpanel`,"aria-labelledby":`you-tab-sources`,className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.sourcesTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.sourcesHint})]}),(0,X.jsxs)(H,{type:`button`,variant:`primary`,onClick:()=>n(`/connectors?tab=connected&personalContext=1`),children:[t.manageSources,(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0})]})]}),S.sourceRecommendations.length>0?(0,X.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/25 p-5`,children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(v,{className:`size-4 text-accent`,"aria-hidden":!0}),t.recommendationsTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.recommendationsHint}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-2 lg:grid-cols-3`,children:S.sourceRecommendations.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>ot({id:e.sourceId}),children:[(0,X.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e.sourceName}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.recommendationReason.replace(`{{goal}}`,e.goalTitle)})]},e.sourceId))})]}):null,(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:S.sources.map(n=>(0,X.jsx)(Fe,{source:n,language:e,t,onConfigure:()=>ot(n),onDisconnect:()=>Je(n)},`${n.id}:${n.instanceId??`catalog`}`))}),S.sources.length===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.noSources}):null]}):null,S&&m===`controls`&&rt?(0,X.jsxs)(`div`,{id:`you-panel-controls`,role:`tabpanel`,"aria-labelledby":`you-tab-controls`,className:`space-y-6`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.controlHint}),(0,X.jsxs)(`div`,{className:`mt-4 max-w-2xl space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,X.jsx)(g,{value:rt.mode,onChange:e=>We({...rt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,X.jsx)(q,{value:e,children:t},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,X.jsx)(g,{value:rt.sensitiveWritePolicy,onChange:e=>We({...rt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,X.jsx)(q,{value:e,children:t},e))})]}),(0,X.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-accent-soft/40 p-3 text-xs leading-5 text-fg-muted`,children:[(0,X.jsx)(A,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:t.transientPromise})]}),(0,X.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,X.jsx)(H,{type:`button`,variant:`primary`,disabled:Ge,onClick:()=>void St(),children:Ge?t.saving:t.save})})]})]}),(0,X.jsxs)(`section`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.actionBoundaryMovedTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.actionBoundaryMovedHint})]}),(0,X.jsxs)(H,{type:`button`,variant:`secondary`,onClick:()=>n(`/settings/action-boundary`),children:[t.manageActionBoundary,(0,X.jsx)(d,{className:`size-4`,"aria-hidden":!0})]})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),S.referenceGrants.length>0?(0,X.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:S.referenceGrants.map(n=>(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${Ae(n.expiresAt,e)}`:``]})]}),(0,X.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:P===`grant:${n.id}`,onClick:()=>void ft(n.id),children:t.revoke})]},n.id))}):(0,X.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.transferHint}),(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,X.jsxs)(H,{type:`button`,variant:`secondary`,disabled:Ze!==null,onClick:()=>void wt(),children:[(0,X.jsx)(x,{className:`size-4`,"aria-hidden":!0}),Ze===`export`?t.exporting:t.exportAction]}),(0,X.jsxs)(H,{type:`button`,variant:`secondary`,disabled:Ze!==null,onClick:()=>et.current?.click(),children:[(0,X.jsx)(E,{className:`size-4`,"aria-hidden":!0}),Ze===`import`?t.importing:t.importAction]}),(0,X.jsx)(`input`,{ref:et,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>void Tt(e.target.files?.[0])})]}),(0,X.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:t.importPromise})]})]}):null,(0,X.jsx)(ue,{open:ve!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void gt(),onCancel:()=>ye(null)}),(0,X.jsx)(Te,{source:qe,language:e,busy:Ye,onOpenChange:e=>{e||Je(null)},onConfirm:e=>void Ct(e)})]})}export{ze as UserContextPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{d as r,l as i}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as a}from"./check-BODqo66o.js";import{t as o}from"./messages-Bwu1tG3T.js";import{n as ee}from"./locale-store-d9Cylz62.js";import{$l as s,At as te,Bc as c,Bt as l,Cl as ne,Gt as re,Ht as u,Kt as d,Pt as f,Ut as p,Vl as m,Vt as h,Wt as ie,Xs as g,ao as _,gs as ae,hl as oe,hs as v,qt as y,tu as b,yl as x,ys as S,zt as se}from"./index-DHRxn7Sy.js";var C=e(t(),1),w=n(),T=[`folder_structure`,`recent_progress`,`next_steps`];function E(e){return e instanceof Error?e.message:String(e)}function D(){let e=ee(e=>e.language),t=o(e).onboarding.workDiscovery,n=o(e).chat.workingDirectory,D=i(),[O]=r(),k=O.get(`new`)===`1`,[A,j]=(0,C.useState)(`loading`),[M,N]=(0,C.useState)(null),[P,F]=(0,C.useState)(null),[I,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(!1),[H,U]=(0,C.useState)(``),[W,G]=(0,C.useState)(!1),K=(0,C.useCallback)(e=>{F(e),e.status===`completed`?j(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?j(`error`):j(`running`)},[]),q=f({onPicked:(0,C.useCallback)(async e=>{L(!0),z(null);try{N(await p(e)),j(`consent`)}catch(e){z(E(e)),j(`intro`)}finally{L(!1)}},[])});(0,C.useEffect)(()=>{let e=!1;return h().then(async({enabled:t,state:n})=>{if(!e){if(!t){D(`/chat`,{replace:!0});return}if(!k&&n.activeRunId)try{let t=await u(n.activeRunId);e||K(t);return}catch{}e||j(`intro`)}}).catch(t=>{e||(z(E(t)),j(`intro`))}),()=>{e=!0}},[K,D,k]),(0,C.useEffect)(()=>{if(!P||A!==`running`)return;let e=!1,t=async()=>{try{let t=await u(P.id);e||K(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===P.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[K,A,P]);let J=async()=>{L(!0);try{await l()}finally{D(`/chat`,{replace:!0})}},ce=async()=>{if(M){L(!0),z(null);try{K(await d(M.canonicalRootPath))}catch(e){z(E(e)),j(`consent`)}finally{L(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;D(`/chat/${encodeURIComponent(e)}${n}`)},X=async(t,n)=>{if(!P)return;await re(P.id,t.id).catch(()=>{});let r=n?`${e===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${t.actionPrompt}`:t.actionPrompt;Y(P.sessionKey,r)},le=async()=>{if(P){L(!0),z(null);try{F(await y(P.id,`confirmed`)),j(`recommendation`)}catch(e){z(E(e))}finally{L(!1)}}},Z=async e=>{if(!(!P||!H.trim())){L(!0),z(null);try{let t=await y(P.id,e,H.trim());F(t),Y(t.sessionKey,H.trim())}catch(e){z(E(e)),L(!1)}}},ue=async()=>{if(P){L(!0);try{Y((await y(P.id,`dismissed`)).sessionKey)}catch(e){z(E(e)),L(!1)}}},Q=P?.result?.suggestions.find(e=>e.id===P.result?.primarySuggestionId)??P?.result?.suggestions[0],$=P?.result?.suggestions.filter(e=>e.id!==Q?.id)??[];return(0,w.jsxs)(`div`,{className:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[(0,w.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,w.jsx)(ae,{className:`size-11`})}),A===`loading`?(0,w.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,w.jsx)(_,{className:`mx-auto h-8 w-64`}),(0,w.jsx)(_,{className:`mx-auto h-4 w-full max-w-lg`}),(0,w.jsx)(_,{className:`mx-auto size-4/5 max-w-md`}),(0,w.jsx)(_,{className:`mt-8 h-12 w-full rounded-xl`})]}):null,A===`intro`?(0,w.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,w.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,w.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.title}),(0,w.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:t.subtitle})]}),(0,w.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[(0,w.jsxs)(v,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:q.pick,disabled:I||q.picking,children:[I||q.picking?(0,w.jsx)(c,{className:`size-4 animate-spin`}):(0,w.jsx)(x,{className:`size-4`}),t.chooseFolder]}),(0,w.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,w.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,w.jsx)(`span`,{children:t.readOnlyNote})]}),R?(0,w.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:R}):null]}),(0,w.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),disabled:I,children:t.skip})]}):null,A===`consent`&&M?(0,w.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,w.jsxs)(`div`,{className:`text-center`,children:[(0,w.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.selectedTitle}),(0,w.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.selectedSubtitle})]}),(0,w.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,w.jsx)(x,{className:`size-5 shrink-0 text-accent-fg`}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:M.displayName}),(0,w.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:M.canonicalRootPath})]}),(0,w.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:M.projectKind===`coding`?t.codingProject:M.projectKind===`general`?t.generalProject:t.unknownProject})]}),(0,w.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.localFingerprint}),(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:M.fingerprint.branch?t.branchValue.replace(`{{branch}}`,M.fingerprint.branch):t.noGitBranch})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentActivity}),(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:t.changedFiles.replace(`{{count}}`,String(M.fingerprint.changedFileCount))})]}),M.fingerprint.recentAreas.length>0?(0,w.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,w.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentAreas}),(0,w.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:M.fingerprint.recentAreas.map(e=>(0,w.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,w.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,w.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,w.jsx)(ne,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willRead}),(0,w.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willReadValue})]})]}),(0,w.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,w.jsx)(S,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willIgnore}),(0,w.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willIgnoreValue})]})]}),(0,w.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,w.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,w.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:M.remoteModel?t.providerDisclosure.replace(`{{provider}}`,M.provider):t.localDisclosure})]})]})]}),R?(0,w.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:R}):null,(0,w.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,w.jsxs)(v,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:I,onClick:()=>void ce(),children:[I?(0,w.jsx)(c,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,w.jsx)(v,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:I,onClick:q.pick,children:t.changeFolder})]}),(0,w.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),children:t.skip})]}):null,A===`running`&&P?(0,w.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,w.jsxs)(`div`,{className:`text-center`,children:[(0,w.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.analyzingTitle}),(0,w.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.analyzingSubtitle})]}),(0,w.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:T.map((e,n)=>{let r=Math.max(0,T.indexOf(P.stage??`folder_structure`)),i=n<r,o=n===r;return(0,w.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,w.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${i?`bg-accent text-white`:o?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:i?(0,w.jsx)(a,{className:`size-4`}):o?(0,w.jsx)(c,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,w.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,w.jsx)(`span`,{className:o||i?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:t.stages[e]})]},e)})}),(0,w.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:P.rootPath}),(0,w.jsx)(`button`,{type:`button`,className:`mx-auto mt-7 block text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void se(P.id).then(K),children:t.cancelAnalysis})]}):null,A===`recognition`&&P?.result?(0,w.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,w.jsxs)(`div`,{className:`text-center`,children:[(0,w.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.recognitionEyebrow}),(0,w.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:P.result.lowConfidence?t.lowConfidenceTitle:t.recognitionTitle})]}),(0,w.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,w.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:P.result.projectSummary}),(0,w.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:P.result.currentState}),!P.result.lowConfidence&&Q?.evidence.length?(0,w.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,w.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,w.jsx)(oe,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,w.jsxs)(`span`,{children:[e.path?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),P.result.lowConfidence?(0,w.jsxs)(`div`,{className:`mt-5`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:P.result.contextQuestion}),(0,w.jsx)(`textarea`,{value:H,onChange:e=>U(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,w.jsx)(v,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:I||!H.trim(),onClick:()=>void Z(`different_goal`),children:t.continueWithCorrection})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,w.jsxs)(v,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:I,onClick:()=>void le(),children:[I?(0,w.jsx)(c,{className:`size-4 animate-spin`}):(0,w.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,w.jsx)(v,{variant:`secondary`,className:`h-11 flex-1`,disabled:I,onClick:()=>V(e=>!e),children:t.notQuiteRight})]}),B?(0,w.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,w.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:t.correctionLabel}),(0,w.jsx)(`textarea`,{id:`work-discovery-correction`,value:H,onChange:e=>U(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,w.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,w.jsx)(v,{variant:`ghost`,disabled:I||!H.trim(),onClick:()=>void Z(`different_goal`),children:t.differentGoal}),(0,w.jsx)(v,{variant:`primary`,disabled:I||!H.trim(),onClick:()=>void Z(`corrected`),children:t.useCorrection})]})]}):null]}),R?(0,w.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:R}):null,(0,w.jsx)(`button`,{type:`button`,disabled:I,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void ue(),children:t.openConversation})]}):null,A===`recommendation`&&P?.result&&Q?(0,w.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,w.jsxs)(`div`,{className:`text-center`,children:[(0,w.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.understandingConfirmed}),(0,w.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:t.primaryRecommendationTitle})]}),(0,w.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,w.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,w.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,w.jsx)(s,{className:`size-5`})}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,w.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,w.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,w.jsx)(m,{className:`size-3.5`}),t.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,w.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:(e=>e===`command`?t.riskCommand:e===`file_write`?t.riskFileWrite:t.riskAnalysis)(Q.risk)})]}),(0,w.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,w.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.expectedOutcome}),(0,w.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedOutcome})]}),(0,w.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,w.jsx)(v,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:t.startRecommendedAction}),(0,w.jsx)(v,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:t.explainFirst})]})]})]})}),$.length>0?(0,w.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>G(e=>!e),children:[t.otherDirections,(0,w.jsx)(b,{className:`size-4 transition-transform ${W?`rotate-180`:``}`})]}),W?(0,w.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:$.map(e=>(0,w.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,w.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,w.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedOutcome})]})]},e.id))}):null]}):null,(0,w.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(P.sessionKey),children:t.doSomethingElse}),(0,w.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{V(!0),j(`recognition`)},children:t.correctUnderstanding})]})]}):null,A===`error`&&P?(0,w.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,w.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,w.jsx)(S,{className:`size-5`})}),(0,w.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:t.errorTitle}),(0,w.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:P.errorMessage}),(0,w.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,w.jsx)(v,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void ie(P.id).then(K),children:t.retry}),(0,w.jsx)(v,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{F(null),N(null),j(`intro`)},children:t.chooseDifferent})]}),(0,w.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(P.sessionKey),children:t.openConversation})]}):null]}),q.hasNativePicker?null:(0,w.jsx)(te,{open:q.modalOpen,onOpenChange:q.setModalOpen,initialAbsolutePath:M?.canonicalRootPath,onConfirm:q.confirmPick,wd:n})]})}export{D as WorkDiscoveryPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./messages-Bwu1tG3T.js";import{n as l}from"./locale-store-d9Cylz62.js";import{Cl as u,Fc as d,Go as ee,Io as f,Is as p,La as te,Ml as m,Ms as ne,Tc as re,Zl as ie,a as ae,cc as oe,et as h,f as se,gc as g,gu as _,hl as v,hs as y,iu as b,kl as ce,l as le,lc as ue,m as de,o as fe,p as pe,qo as x,s as S,u as C,yt as me}from"./index-DHRxn7Sy.js";var w=n(),T=e(t(),1),E=r();function he(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function D(e){return e?h(new Date(e)):``}function ge(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function _e(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function O(e){let t=(0,w.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,E.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,E.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ve(e){let t=(0,w.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,E.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,E.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,E.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:D(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,E.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function k(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function A(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=k(i),s=0;for(let e of k(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function ye(e,t,n){return[...n].sort((n,r)=>A(e,t,r)-A(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=o(),t=i(),n=c(l(e=>e.language)).projectDetailPage.workItems,[r,h]=(0,T.useState)(null),[w,k]=(0,T.useState)(null),[j,M]=(0,T.useState)([]),[N,be]=(0,T.useState)([]),[P,F]=(0,T.useState)(``),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(!0),[B,V]=(0,T.useState)(!1),[H,U]=(0,T.useState)(null),W=(0,T.useRef)(null),G=f(e=>e.setPageHeader),K=f(e=>e.clearPageHeader),q=(0,T.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,T.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([le(e),C(e).catch(()=>({events:[]}))]);h(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([te(t.item.projectId).catch(()=>null),me().catch(()=>[])]),a=ye(t.item,r,i);k(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,T.useEffect)(()=>{J()},[J]);let Y=(0,T.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await se(r.id);h(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,T.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await ae(r.id);h(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,T.useCallback)(async e=>{M((await C(e).catch(()=>({events:[]}))).events)},[]),xe=(0,T.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await pe(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});h(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,T.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await de(r.id,e);h(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,T.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await fe(r.id,e.id);h(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,T.useCallback)(async e=>{if(r){U(null);try{await S(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,T.useMemo)(()=>r?N.filter(e=>A(r,w,e)>0).slice(0,3):[],[r,w,N]),$=(0,T.useMemo)(()=>(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,E.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,E.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,E.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,E.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,T.useLayoutEffect)(()=>(G({startExtra:(0,E.jsx)(a,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":w?.name?n.detail.backToProject.replace(`{{name}}`,w.name):n.detail.backToProjects,children:(0,E.jsx)(_,{className:`size-4`,"aria-hidden":!0})}),main:(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(b,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,E.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,E.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,w?.name||r.projectId,` · `,n.updated,`: `,D(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,w?.name,q,G,n,w]),R?(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,E.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,E.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,E.jsxs)(a,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,E.jsx)(_,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,E.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,E.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface sm:px-5`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(b,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,E.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,E.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,E.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,he(r.status)),children:n.statuses[r.status]}),(0,E.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,E.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,E.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,E.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,E.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,E.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,E.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,E.jsx)(O,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,E.jsx)(O,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,E.jsx)(O,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,E.jsx)(O,{label:n.updated,value:D(r.updatedAt)})]})]}),(0,E.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,E.jsxs)(`section`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,E.jsx)(u,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,E.jsx)(ve,{events:j,t:n})]}),(0,E.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,E.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,E.jsx)(v,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,E.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,E.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,E.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,E.jsxs)(ee,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,E.jsx)(x,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,E.jsx)(x,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[(0,E.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,E.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,E.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,E.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,E.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,E.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,E.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,E.jsx)(re,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,E.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,E.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,E.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,E.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base p-2 text-sm`,children:[(0,E.jsx)(u,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,E.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,ge(e.size)]})]}),(0,E.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,E.jsx)(m,{className:`size-3.5`,"aria-hidden":!0})}),(0,E.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,E.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,E.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,E.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,E.jsxs)(a,{to:_e(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,E.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,E.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,E.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,E.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,E.jsxs)(a,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,E.jsx)(ie,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`min-w-0 truncate`,children:w?.name||r.projectId})]})]})]})]})]})}export{j as WorkItemDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./check-BODqo66o.js";import{t as c}from"./circle-alert-RzVebuX2.js";import{t as l}from"./messages-Bwu1tG3T.js";import{n as u,r as d,s as f}from"./locale-store-d9Cylz62.js";import{n as p}from"./activity-store-CddlQHam.js";import{$l as m,Ao as h,Bc as g,Fa as _,Fo as v,Io as y,Ks as b,Lc as x,Mo as S,Ms as C,No as w,Ol as T,Po as E,R as D,Ua as O,Vl as k,Zl as A,ao as j,bl as M,et as N,gc as ee,hs as P,hu as F,jo as te,js as I,ko as ne,nc as re,nu as ie,rl as ae,xu as L,ys as R}from"./index-DHRxn7Sy.js";import{t as oe}from"./sliding-segmented-uWmrxE3P.js";var z=n(),B=e(t(),1),V=r(),H=3,U={info:{Icon:ae,className:`text-accent-fg bg-accent-soft`},success:{Icon:A,className:`text-success bg-success-soft`},warning:{Icon:I,className:`text-warning bg-warning-soft`},error:{Icon:c,className:`text-danger bg-danger-soft`}};function W(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function G(e){let t=(0,z.c)(52),{item:n}=e,r=u(se),i;t[0]===r?i=t[1]:(i=l(r),t[0]=r,t[1]=i);let s=i.projectsPage.workHome,c=p(K),{Icon:d,className:f}=U[n.tone],h;t[2]===f?h=t[3]:(h=o(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,f),t[2]=f,t[3]=h);let _;t[4]!==d||t[5]!==n.status?(_=n.status===`running`?(0,V.jsx)(g,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,V.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t[4]=d,t[5]=n.status,t[6]=_):_=t[6];let v;t[7]!==h||t[8]!==_?(v=(0,V.jsx)(`div`,{className:h,children:_}),t[7]=h,t[8]=_,t[9]=v):v=t[9];let y;t[10]===n.title?y=t[11]:(y=(0,V.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=y);let b;t[12]!==s.activityUnread||t[13]!==n.read?(b=n.read?null:(0,V.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=b):b=t[14];let x;t[15]!==y||t[16]!==b?(x=(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[y,b]}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;t[18]===n.message?S=t[19]:(S=n.message?(0,V.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=S);let C;t[20]===n.source?C=t[21]:(C=n.source?(0,V.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=C);let w;t[22]!==n.updatedAt||t[23]!==r?(w=W(n.updatedAt,r),t[22]=n.updatedAt,t[23]=r,t[24]=w):w=t[24];let T;t[25]===w?T=t[26]:(T=(0,V.jsx)(`span`,{children:w}),t[25]=w,t[26]=T);let E;t[27]===n.occurrences?E=t[28]:(E=n.occurrences>1?(0,V.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=E);let D;t[29]!==s.activityViewRelated||t[30]!==n.href?(D=n.href?(0,V.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,V.jsx)(m,{className:`size-3`,"aria-hidden":!0})]}):null,t[29]=s.activityViewRelated,t[30]=n.href,t[31]=D):D=t[31];let O;t[32]!==T||t[33]!==E||t[34]!==D||t[35]!==C?(O=(0,V.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[C,T,E,D]}),t[32]=T,t[33]=E,t[34]=D,t[35]=C,t[36]=O):O=t[36];let k;t[37]!==O||t[38]!==x||t[39]!==S?(k=(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S,O]}),t[37]=O,t[38]=x,t[39]=S,t[40]=k):k=t[40];let A;t[41]!==n.id||t[42]!==c?(A=()=>c(n.id),t[41]=n.id,t[42]=c,t[43]=A):A=t[43];let j;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,V.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),t[44]=j):j=t[44];let M;t[45]!==s.activityRemove||t[46]!==A?(M=(0,V.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:A,children:j}),t[45]=s.activityRemove,t[46]=A,t[47]=M):M=t[47];let N;return t[48]!==k||t[49]!==M||t[50]!==v?(N=(0,V.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[v,k,M]}),t[48]=k,t[49]=M,t[50]=v,t[51]=N):N=t[51],N}function K(e){return e.remove}function se(e){return e.language}function ce(){let e=(0,z.c)(8),t=l(u(de)).projectsPage.workHome,n=p(ue),r=p(Q),i=p(le),[a,o]=(0,B.useState)(!1),c;e[0]===n?c=e[1]:(c=n.filter(Z),e[0]=n,e[1]=c);let d=c.length,f;e[2]===n?f=e[3]:(f=n.filter(X),e[2]=n,e[3]=f);let m=f.length,h;e[4]!==a||e[5]!==n?(h=a?n:n.slice(0,H),e[4]=a,e[5]=n,e[6]=h):h=e[6];let _=h,v;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,V.jsx)(L,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[7]=v):v=e[7],(0,V.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[v,(0,V.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),d>0?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,V.jsx)(g,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),d,` `,t.running]}):m>0?(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[m,` `,t.activityNew]}):null]}),n.length>0?(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.activityHint}):null]}),a&&n.length>0?(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[m>0?(0,V.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,V.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(Y)?(0,V.jsxs)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,V.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,V.jsxs)(`div`,{className:`mt-3 px-1`,children:[_.map(J),n.length>H?(0,V.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,V.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>o(q),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,V.jsx)(k,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`p`,{children:t.activityEmpty})]})]})}function q(e){return!e}function J(e){return(0,V.jsx)(G,{item:e},e.id)}function Y(e){return e.status===`done`}function X(e){return!e.read}function Z(e){return e.status===`running`}function le(e){return e.clearFinished}function Q(e){return e.markAllRead}function ue(e){return e.items}function de(e){return e.language}function fe(e){return f(d(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function pe(e,t){return f(d(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function $(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function me(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:N(n)}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-5`,"aria-busy":!0,children:[(0,V.jsx)(j,{className:`h-20 rounded-2xl`}),(0,V.jsx)(j,{className:`h-72 rounded-2xl`}),(0,V.jsx)(j,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function ge(e){let t=(0,z.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,V.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=o);let s;t[2]===n.projectName?s=t[3]:(s=(0,V.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[2]=n.projectName,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:r}),t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==n.blockedReason||t[13]!==n.nextAction?(d=n.blockedReason||n.nextAction?(0,V.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[12]=n.blockedReason,t[13]=n.nextAction,t[14]=d):d=t[14];let f;return t[15]!==i||t[16]!==u||t[17]!==d?(f=(0,V.jsxs)(a,{to:i,className:`group block rounded-lg px-1 py-2.5 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[15]=i,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function _e(e){let t=(0,z.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,V.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,V.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,V.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,V.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,V.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,V.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,V.jsx)(P,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,V.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function ve(e){let t=(0,z.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,V.jsx)(M,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,V.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,V.jsx)(F,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,V.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=me(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,V.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let g;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(g=(0,V.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=g):g=t[18],g}function ye(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=i(),o=y(e=>e.setPageHeader),s=y(e=>e.clearPageHeader),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)([]),[g,C]=(0,B.useState)(!0),[A,j]=(0,B.useState)(null),[M,N]=(0,B.useState)(null),[F,I]=(0,B.useState)(``),[ae,L]=(0,B.useState)(!1),[z,H]=(0,B.useState)(`delegate`),[U,W]=(0,B.useState)(``),[G,K]=(0,B.useState)(!1),[se,q]=(0,B.useState)(null),J=(0,B.useCallback)(async()=>{C(!0),j(null);try{let[t,n]=await Promise.all([fe(e),O({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})]);f(t),m(n.items)}catch(e){j(e instanceof Error?e.message:String(e))}finally{C(!1)}},[e]);(0,B.useEffect)(()=>{J()},[J]);let Y=(0,B.useMemo)(()=>{let e=F.trim().toLocaleLowerCase(),t=p.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,6)},[p,F]),X=(0,B.useMemo)(()=>d?.decisions??[],[d]),Z=(0,B.useMemo)(()=>d?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[d]),le=(0,B.useCallback)(async t=>{t.preventDefault();let n=U.trim();if(!(!n||G)){if(z===`watch`){let t=e===`zh`?`持续关注以下事项,在发生有意义的变化时通知我:\n${n}`:`Keep watching the following and notify me when something meaningfully changes:\n${n}`;W(``),L(!1),r(`/automations?draft=${encodeURIComponent(t)}&autogenerate=1`);return}K(!0),N(null);try{let t=await _({outcome:n,uiLocale:e});W(``),L(!1),r(`/projects/${encodeURIComponent(t.project.id)}`)}catch(e){N(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[z,G,e,r,U]),Q=(0,B.useMemo)(()=>(0,V.jsxs)(P,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>{H(`delegate`),L(!0)},children:[(0,V.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),n.workHome.newWork]}),[n.workHome.newWork]),ue=(0,B.useMemo)(()=>[{value:`delegate`,label:n.workHome.delegateMode,icon:b},{value:`watch`,label:n.workHome.watchMode,icon:T}],[n.workHome.delegateMode,n.workHome.watchMode]),de=(0,B.useCallback)(async(e,t)=>{if(e.response){q(e.id),j(null);try{await pe(e.response,t),await J()}catch(e){j(e instanceof Error?e.message:String(e))}finally{q(null)}}},[J]);return(0,B.useLayoutEffect)(()=>(o({startExtra:null,main:(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,V.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:Q}),()=>s()),[s,Q,o,n.title,n.workHome.subtitle]),(0,V.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,V.jsx)(ne,{open:ae,onOpenChange:e=>{!e&&G||(L(e),e||N(null))},children:(0,V.jsxs)(E,{children:[(0,V.jsx)(w,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,V.jsxs)(te,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(v,{className:`text-base font-semibold text-fg`,children:z===`watch`?n.workHome.watchTitle:n.workHome.delegateTitle}),(0,V.jsx)(S,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:z===`watch`?n.workHome.watchDescription:n.workHome.delegateDescription})]}),(0,V.jsx)(h,{asChild:!0,children:(0,V.jsx)(P,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,disabled:G,children:(0,V.jsx)(R,{className:`size-4`,"aria-hidden":!0})})})]}),(0,V.jsxs)(`form`,{onSubmit:le,className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,V.jsx)(oe,{value:z,onChange:e=>{H(e),N(null)},options:ue,"aria-label":n.workHome.createModeLabel,className:`mb-4 shrink-0`,buttonClassName:`h-9`}),(0,V.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:z===`watch`?n.workHome.watchLabel:n.workHome.outcomeLabel}),(0,V.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:U,onChange:e=>W(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:z===`watch`?n.workHome.watchPlaceholder:n.workHome.outcomePlaceholder,maxLength:12e3,disabled:G,autoFocus:!0}),(0,V.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,V.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,V.jsxs)(`span`,{className:`tabular-nums`,children:[U.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),M?(0,V.jsx)(`p`,{className:`mt-3 rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:M}):null]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3 border-t border-edge px-5 py-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:z===`watch`?n.workHome.watchSetupHint:n.workHome.autoSetupHint}),(0,V.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,V.jsx)(h,{asChild:!0,children:(0,V.jsx)(P,{type:`button`,variant:`ghost`,disabled:G,children:n.cancel})}),(0,V.jsxs)(P,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:G||!U.trim(),children:[(0,V.jsx)(b,{className:`size-4`,"aria-hidden":!0}),G?n.workHome.delegating:z===`watch`?n.workHome.designWatch:n.workHome.delegate]})]})]})]})]})]})}),A?(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,V.jsx)(`span`,{children:A}),(0,V.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void J(),children:n.workHome.retry})]}):null,g?(0,V.jsx)(he,{}):d?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,V.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:d.decisions.length>0?$(n.workHome.todaySummary,{attention:d.decisions.length,moving:d.briefing.progress.movingCount}):$(n.workHome.todaySummaryClear,{moving:d.briefing.progress.movingCount})}),d.briefing.summary?(0,V.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:d.briefing.summary}):null]}),d.work.current.length===0&&d.workflowRuns.active.length===0&&d.decisions.length===0&&d.upcomingAutomations.length===0?(0,V.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,V.jsx)(x,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,V.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,V.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,V.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,V.jsx)(P,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:n.workHome.startChat}),(0,V.jsx)(P,{type:`button`,variant:`secondary`,onClick:()=>{H(`delegate`),L(!0)},children:n.workHome.startLongWork})]})]}):null,(0,V.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[X.length>0?(0,V.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(c,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,V.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.needsYou})]}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.needsYouHint}),(0,V.jsx)(`div`,{className:`mt-4 space-y-2`,children:X.map(e=>(0,V.jsx)(_e,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:se===e.id,onRespond:t=>void de(e,t)},e.id))})]}):(0,V.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,V.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),n.workHome.nothingNeedsYou]}),(0,V.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(k,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.continueTitle})]}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.continueHint}),(0,V.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[d.workflowRuns.active.map(e=>(0,V.jsxs)(a,{to:D(e.id),className:`flex items-center justify-between gap-3 rounded-lg px-2 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),Z.map(e=>(0,V.jsx)(`div`,{className:`py-1`,children:(0,V.jsx)(ge,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),d.workflowRuns.active.length===0&&Z.length===0?(0,V.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.workHome.noCurrentWork}):null]})]})]}),(0,V.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,V.jsxs)(`div`,{className:`px-1`,children:[(0,V.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.nowHint})]}),d.upcomingAutomations.length>0?(0,V.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(ie,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,V.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:d.upcomingAutomations.slice(0,3).map(e=>(0,V.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,V.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:me(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,V.jsx)(ce,{}),d.briefing.wins.length>0?(0,V.jsxs)(a,{to:d.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,V.jsx)(`span`,{children:$(n.workHome.completedSummary,{count:d.briefing.wins.length})}),(0,V.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]})]}):null,(0,V.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.spacesTitle}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.workHome.spacesHint})]}),(0,V.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),p.filter(e=>e.status!==`archived`).length>6?(0,V.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,V.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,V.jsx)(re,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:F,onChange:e=>I(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,V.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Y.map(e=>(0,V.jsx)(ve,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!g&&Y.length===0?(0,V.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{ye as WorkPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bwu1tG3T.js";import{o,r as s}from"./locale-store-d9Cylz62.js";import{Ao as c,D as l,Es as u,Fo as d,Go as f,H as p,Is as m,Js as h,Ks as g,M as _,No as v,Ol as y,Po as b,Q as x,Ws as S,Yi as C,Z as w,el as T,hs as E,jo as D,ko as O,lc as ee,qo as k,tu as A,ys as j}from"./index-DHRxn7Sy.js";var M=e(t(),1),N=n();function P(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function F(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function I(e,t={}){let n=P(e.split(`
|
|
2
|
-
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
3
|
-
`));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(F(n));return null}async function L(e,t={}){let n=await o(s(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,c=``,l=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=I(e,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=I(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.trim()||void 0}}function te(){let[e,t]=(0,M.useState)(``),[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,M.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await L(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,M.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var R=r(),ne=5;function re(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function z(e){let t=(0,N.c)(232),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:l,intent:u,locale:f,context:p,disabled:m,className:h,showLabel:_}=e,x=s===void 0?`generic.text`:s,w=l===void 0?`plain`:l,T=u===void 0?`improve`:u,k=_===void 0?!0:_,[P,F]=(0,M.useState)(!1),[I,L]=(0,M.useState)(n),[z,B]=(0,M.useState)(`preview`),[V,H]=(0,M.useState)(``),[U,oe]=(0,M.useState)(`edit`),[W,G]=(0,M.useState)(!0),se=(0,M.useRef)(null),K=(0,M.useRef)(!0),{suggestion:q,thinking:J,loading:Y,error:X,generate:ce,reset:le}=te(),ue;t[0]===f?ue=t[1]:(ue=re(f),t[0]=f,t[1]=ue);let Z=ue,de;t[2]!==Y||t[3]!==J?(de=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=de):de=t[4];let Q=de,fe,pe;t[5]!==P||t[6]!==n?(fe=()=>{P||L(n)},pe=[P,n],t[5]=P,t[6]=n,t[7]=fe,t[8]=pe):(fe=t[7],pe=t[8]),(0,M.useEffect)(fe,pe);let me,he;t[9]===q?(me=t[10],he=t[11]):(he=()=>{H(q)},me=[q],t[9]=q,t[10]=me,t[11]=he),(0,M.useEffect)(he,me);let ge,_e;t[12]===J?(ge=t[13],_e=t[14]):(ge=()=>{J.trim()&&G(!0)},_e=[J],t[12]=J,t[13]=ge,t[14]=_e),(0,M.useEffect)(ge,_e);let ve;t[15]!==Q||t[16]!==W?(ve=()=>{let e=se.current;!e||!Q||!W||K.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=W,t[17]=ve):ve=t[17];let ye;t[18]!==Q||t[19]!==J||t[20]!==W?(ye=[Q,J,W],t[18]=Q,t[19]=J,t[20]=W,t[21]=ye):ye=t[21],(0,M.useLayoutEffect)(ve,ye);let be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{let e=se.current;e&&(K.current=e.scrollHeight-e.scrollTop-e.clientHeight<=ne)},t[22]=be):be=t[22];let xe=be,Se;t[23]!==p||t[24]!==a||t[25]!==o||t[26]!==w||t[27]!==ce||t[28]!==T||t[29]!==f||t[30]!==x?(Se=async e=>{oe(`edit`),G(!0),K.current=!0,await ce({intent:T,scenario:x,input:e,locale:f,field:{id:a,label:o,format:w},context:p})},t[23]=p,t[24]=a,t[25]=o,t[26]=w,t[27]=ce,t[28]=T,t[29]=f,t[30]=x,t[31]=Se):Se=t[31];let Ce=Se,we;t[32]!==le||t[33]!==n?(we=()=>{L(n),B(`preview`),H(``),oe(`edit`),G(!0),le(),F(!0)},t[32]=le,t[33]=n,t[34]=we):we=t[34];let Te=we,Ee;t[35]!==I||t[36]!==Ce?(Ee=async()=>{await Ce(I)},t[35]=I,t[36]=Ce,t[37]=Ee):Ee=t[37];let De=Ee,Oe;t[38]!==le||t[39]!==n?(Oe=()=>{F(!1),L(n),B(`preview`),H(``),oe(`edit`),G(!0),le()},t[38]=le,t[39]=n,t[40]=Oe):Oe=t[40];let $=Oe,ke;t[41]!==$||t[42]!==I||t[43]!==r?(ke=()=>{r(I),$()},t[41]=$,t[42]=I,t[43]=r,t[44]=ke):ke=t[44];let Ae=ke,je;t[45]!==$||t[46]!==V||t[47]!==r?(je=()=>{V.trim()&&(r(V),$())},t[45]=$,t[46]=V,t[47]=r,t[48]=je):je=t[48];let Me=je,Ne;t[49]!==$||t[50]!==I||t[51]!==V||t[52]!==r?(Ne=()=>{if(!V.trim())return;let e=I.trimEnd();r(e?`${e}\n\n${V}`:V),$()},t[49]=$,t[50]=I,t[51]=V,t[52]=r,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==V||t[55]!==X||t[56]!==Y?(Fe=!Y&&!X&&V.trim().length>0,t[54]=V,t[55]=X,t[56]=Y,t[57]=Fe):Fe=t[57];let Ie=Fe,Le=I!==n,Re;t[58]!==V||t[59]!==X||t[60]!==J?(Re=V.trim().length>0||J.trim().length>0||!!X,t[58]=V,t[59]=X,t[60]=J,t[61]=Re):Re=t[61];let ze=Re,Be=!k&&`size-7 p-0`,Ve;t[62]!==h||t[63]!==Be?(Ve=i(`h-7 gap-1 px-2 text-xs`,Be,h),t[62]=h,t[63]=Be,t[64]=Ve):Ve=t[64];let He=m||Y,Ue;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,R.jsx)(g,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=Ue):Ue=t[65];let We=k?Z.buttonTitle:null,Ge;t[66]!==Z.buttonTitle||t[67]!==Te||t[68]!==Ve||t[69]!==He||t[70]!==We?(Ge=(0,R.jsxs)(E,{type:`button`,variant:`ghost`,className:Ve,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:He,onClick:Te,children:[Ue,We]}),t[66]=Z.buttonTitle,t[67]=Te,t[68]=Ve,t[69]=He,t[70]=We,t[71]=Ge):Ge=t[71];let Ke;t[72]===$?Ke=t[73]:(Ke=e=>e?F(!0):$(),t[72]=$,t[73]=Ke);let qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,R.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[74]=qe):qe=t[74];let Je;t[75]===Z.title?Je=t[76]:(Je=(0,R.jsx)(d,{className:`text-base font-semibold text-fg`,children:Z.title}),t[75]=Z.title,t[76]=Je);let Ye;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,R.jsx)(j,{className:`size-5`,strokeWidth:1.75}),t[77]=Ye):Ye=t[77];let Xe;t[78]===Z.close?Xe=t[79]:(Xe=(0,R.jsx)(c,{asChild:!0,children:(0,R.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:Ye})}),t[78]=Z.close,t[79]=Xe);let Ze;t[80]!==Je||t[81]!==Xe?(Ze=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Je,Xe]}),t[80]=Je,t[81]=Xe,t[82]=Ze):Ze=t[82];let Qe;t[83]===Z.current?Qe=t[84]:(Qe=(0,R.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[83]=Z.current,t[84]=Qe);let $e=z===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,et;t[85]===$e?et=t[86]:(et=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,$e),t[85]=$e,t[86]=et);let tt,nt;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>B(`edit`),nt=(0,R.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[87]=tt,t[88]=nt):(tt=t[87],nt=t[88]);let rt;t[89]!==Z.edit||t[90]!==et?(rt=(0,R.jsxs)(`button`,{type:`button`,className:et,onClick:tt,children:[nt,Z.edit]}),t[89]=Z.edit,t[90]=et,t[91]=rt):rt=t[91];let it=z===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,at;t[92]===it?at=t[93]:(at=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,it),t[92]=it,t[93]=at);let ot,st;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>B(`preview`),st=(0,R.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[94]=ot,t[95]=st):(ot=t[94],st=t[95]);let ct;t[96]!==Z.preview||t[97]!==at?(ct=(0,R.jsxs)(`button`,{type:`button`,className:at,onClick:ot,children:[st,Z.preview]}),t[96]=Z.preview,t[97]=at,t[98]=ct):ct=t[98];let lt;t[99]!==rt||t[100]!==ct?(lt=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[rt,ct]}),t[99]=rt,t[100]=ct,t[101]=lt):lt=t[101];let ut;t[102]!==Qe||t[103]!==lt?(ut=(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[Qe,lt]}),t[102]=Qe,t[103]=lt,t[104]=ut):ut=t[104];let dt;t[105]!==I||t[106]!==z||t[107]!==w||t[108]!==Z.current||t[109]!==Z.empty?(dt=z===`preview`?(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:w===`markdown`?(0,R.jsx)(C,{content:I||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:I||Z.empty})}):(0,R.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:I,onChange:e=>L(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[105]=I,t[106]=z,t[107]=w,t[108]=Z.current,t[109]=Z.empty,t[110]=dt):dt=t[110];let ft;t[111]!==ut||t[112]!==dt?(ft=(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[ut,dt]}),t[111]=ut,t[112]=dt,t[113]=ft):ft=t[113];let pt;t[114]===Z.editedSuggestion?pt=t[115]:(pt=(0,R.jsx)(`span`,{children:Z.editedSuggestion}),t[114]=Z.editedSuggestion,t[115]=pt);let mt;t[116]!==Z.loading||t[117]!==Y?(mt=Y?(0,R.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[116]=Z.loading,t[117]=Y,t[118]=mt):mt=t[118];let ht;t[119]!==pt||t[120]!==mt?(ht=(0,R.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[pt,mt]}),t[119]=pt,t[120]=mt,t[121]=ht):ht=t[121];let gt=U===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,_t;t[122]===gt?_t=t[123]:(_t=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,gt),t[122]=gt,t[123]=_t);let vt,yt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>oe(`edit`),yt=(0,R.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[124]=vt,t[125]=yt):(vt=t[124],yt=t[125]);let bt;t[126]!==Z.edit||t[127]!==_t?(bt=(0,R.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,Z.edit]}),t[126]=Z.edit,t[127]=_t,t[128]=bt):bt=t[128];let xt=U===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,St;t[129]===xt?St=t[130]:(St=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,xt),t[129]=xt,t[130]=St);let Ct,wt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=()=>oe(`preview`),wt=(0,R.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[131]=Ct,t[132]=wt):(Ct=t[131],wt=t[132]);let Tt;t[133]!==Z.preview||t[134]!==St?(Tt=(0,R.jsxs)(`button`,{type:`button`,className:St,onClick:Ct,children:[wt,Z.preview]}),t[133]=Z.preview,t[134]=St,t[135]=Tt):Tt=t[135];let Et;t[136]!==bt||t[137]!==Tt?(Et=(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[bt,Tt]}),t[136]=bt,t[137]=Tt,t[138]=Et):Et=t[138];let Dt;t[139]!==ht||t[140]!==Et?(Dt=(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[ht,Et]}),t[139]=ht,t[140]=Et,t[141]=Dt):Dt=t[141];let Ot=Q?`opacity-100`:`pointer-events-none opacity-0`,kt;t[142]===Ot?kt=t[143]:(kt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ot),t[142]=Ot,t[143]=kt);let At=!Q,jt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>G(ie),t[144]=jt):jt=t[144];let Mt;t[145]!==Z.thinkingLoading||t[146]!==Y?(Mt=Y?(0,R.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[145]=Z.thinkingLoading,t[146]=Y,t[147]=Mt):Mt=t[147];let Nt;t[148]!==Z.thinking||t[149]!==Mt?(Nt=(0,R.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,Mt]}),t[148]=Z.thinking,t[149]=Mt,t[150]=Nt):Nt=t[150];let Pt=W&&`rotate-180`,Ft;t[151]===Pt?Ft=t[152]:(Ft=i(`size-3.5 shrink-0 transition-transform`,Pt),t[151]=Pt,t[152]=Ft);let It;t[153]===Ft?It=t[154]:(It=(0,R.jsx)(A,{className:Ft,strokeWidth:1.75,"aria-hidden":!0}),t[153]=Ft,t[154]=It);let Lt;t[155]!==Nt||t[156]!==It?(Lt=(0,R.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:jt,children:[Nt,It]}),t[155]=Nt,t[156]=It,t[157]=Lt):Lt=t[157];let Rt;t[158]!==J||t[159]!==W?(Rt=W?(0,R.jsx)(`pre`,{ref:se,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:xe,children:J}):null,t[158]=J,t[159]=W,t[160]=Rt):Rt=t[160];let zt;t[161]!==Lt||t[162]!==Rt?(zt=(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Lt,Rt]}),t[161]=Lt,t[162]=Rt,t[163]=zt):zt=t[163];let Bt;t[164]!==kt||t[165]!==At||t[166]!==zt?(Bt=(0,R.jsx)(`div`,{className:kt,"aria-hidden":At,children:zt}),t[164]=kt,t[165]=At,t[166]=zt,t[167]=Bt):Bt=t[167];let Vt=Q?`pointer-events-none opacity-0`:`opacity-100`,Ht;t[168]===Vt?Ht=t[169]:(Ht=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Vt),t[168]=Vt,t[169]=Ht);let Ut;t[170]!==V||t[171]!==X||t[172]!==w||t[173]!==Z.empty||t[174]!==Z.loading||t[175]!==Z.suggestion||t[176]!==Y||t[177]!==U?(Ut=X?(0,R.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):U===`preview`?(0,R.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!V.trim()?(0,R.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):w===`markdown`?(0,R.jsx)(C,{content:V||Z.empty,compact:!0,className:`text-sm`}):(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:V||Z.empty})}):(0,R.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:V,onChange:e=>H(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[170]=V,t[171]=X,t[172]=w,t[173]=Z.empty,t[174]=Z.loading,t[175]=Z.suggestion,t[176]=Y,t[177]=U,t[178]=Ut):Ut=t[178];let Wt;t[179]!==Ht||t[180]!==Ut?(Wt=(0,R.jsx)(`div`,{className:Ht,children:Ut}),t[179]=Ht,t[180]=Ut,t[181]=Wt):Wt=t[181];let Gt;t[182]!==Bt||t[183]!==Wt?(Gt=(0,R.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Bt,Wt]}),t[182]=Bt,t[183]=Wt,t[184]=Gt):Gt=t[184];let Kt;t[185]!==Dt||t[186]!==Gt?(Kt=(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Dt,Gt]}),t[185]=Dt,t[186]=Gt,t[187]=Kt):Kt=t[187];let qt;t[188]!==ft||t[189]!==Kt?(qt=(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[ft,Kt]}),t[188]=ft,t[189]=Kt,t[190]=qt):qt=t[190];let Jt;t[191]!==$||t[192]!==Z.cancel?(Jt=(0,R.jsx)(E,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[191]=$,t[192]=Z.cancel,t[193]=Jt):Jt=t[193];let Yt=!Le,Xt;t[194]!==Ae||t[195]!==Z.applyCurrent||t[196]!==Yt?(Xt=(0,R.jsx)(E,{type:`button`,variant:`secondary`,disabled:Yt,onClick:Ae,children:Z.applyCurrent}),t[194]=Ae,t[195]=Z.applyCurrent,t[196]=Yt,t[197]=Xt):Xt=t[197];let Zt;t[198]===De?Zt=t[199]:(Zt=()=>void De(),t[198]=De,t[199]=Zt);let Qt;t[200]===ze?Qt=t[201]:(Qt=ze?(0,R.jsx)(ee,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,R.jsx)(g,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[200]=ze,t[201]=Qt);let $t=ze?Z.regenerate:Z.generate,en;t[202]!==Y||t[203]!==Zt||t[204]!==Qt||t[205]!==$t?(en=(0,R.jsxs)(E,{type:`button`,variant:`secondary`,disabled:Y,onClick:Zt,children:[Qt,$t]}),t[202]=Y,t[203]=Zt,t[204]=Qt,t[205]=$t,t[206]=en):en=t[206];let tn=!Ie,nn;t[207]!==Pe||t[208]!==Z.append||t[209]!==tn?(nn=(0,R.jsx)(E,{type:`button`,variant:`secondary`,disabled:tn,onClick:Pe,children:Z.append}),t[207]=Pe,t[208]=Z.append,t[209]=tn,t[210]=nn):nn=t[210];let rn=!Ie,an;t[211]!==Me||t[212]!==Z.replace||t[213]!==rn?(an=(0,R.jsx)(E,{type:`button`,variant:`primary`,disabled:rn,onClick:Me,children:Z.replace}),t[211]=Me,t[212]=Z.replace,t[213]=rn,t[214]=an):an=t[214];let on;t[215]!==Jt||t[216]!==Xt||t[217]!==en||t[218]!==nn||t[219]!==an?(on=(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Jt,Xt,en,nn,an]}),t[215]=Jt,t[216]=Xt,t[217]=en,t[218]=nn,t[219]=an,t[220]=on):on=t[220];let sn;t[221]!==Ze||t[222]!==qt||t[223]!==on?(sn=(0,R.jsxs)(b,{children:[qe,(0,R.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,R.jsxs)(D,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ae,children:[Ze,qt,on]})})]}),t[221]=Ze,t[222]=qt,t[223]=on,t[224]=sn):sn=t[224];let cn;t[225]!==P||t[226]!==Ke||t[227]!==sn?(cn=(0,R.jsx)(O,{open:P,onOpenChange:Ke,children:sn}),t[225]=P,t[226]=Ke,t[227]=sn,t[228]=cn):cn=t[228];let ln;return t[229]!==cn||t[230]!==Ge?(ln=(0,R.jsxs)(R.Fragment,{children:[Ge,cn]}),t[229]=cn,t[230]=Ge,t[231]=ln):ln=t[231],ln}function ie(e){return!e}function ae(e){return e.preventDefault()}function B(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function V(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function H(e,t){return!B(e)||!e?!0:V(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function U(e,t){if(e)return B(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:l(t.argValues)}function oe(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=x(e,t);if(B(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.join(` · `):r.noInputSummary}function W(e,t,n=!0){return e?n?B(e.inputSchema)?H(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(p[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function G(e,t){return e[t]??t}function se(e,t){let n=p[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function K(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function q(e){let t=(0,N.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:m}=e,h;t[0]===u?h=t[1]:(h=u===void 0?[]:u,t[0]=u,t[1]=h);let g=h,_=d===void 0?!0:d,v,y,b,x,S,C,T;if(t[2]!==m||t[3]!==o||t[4]!==g||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==_||t[11]!==n){b=a(r).workflows;let e=p[n]??[];y=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{w(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],v=d,x=`flex flex-col gap-3`,S=e.map(e=>{let t=G(b.args,e.labelKey),a=G(b.args,e.placeholderKey),c=o[e.key]??``;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&m?(0,R.jsx)(z,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:m.argScenario??`workflow.arg`,locale:r,context:{...m.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:m.disabled,showLabel:!1}):null]}),e.multiline?(0,R.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,R.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),C=y&&g.length>0?(0,R.jsx)(K,{examples:g,labels:b,onSelect:v}):null,T=_?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:b.goalLabel}),m?(0,R.jsx)(z,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:b.goalLabel,scenario:m.goalScenario??`cron.workflowGoal`,locale:r,context:{...m.context,workflowName:n,workflowArgs:o},disabled:m.disabled,showLabel:!1}):null]}),(0,R.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:b.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=m,t[3]=o,t[4]=g,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=_,t[11]=n,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=T}else v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],T=t[18];let E;t[23]!==v||t[24]!==g||t[25]!==y||t[26]!==b?(E=!y&&g.length>0?(0,R.jsx)(K,{examples:g,labels:b,onSelect:v}):null,t[23]=v,t[24]=g,t[25]=y,t[26]=b,t[27]=E):E=t[27];let D;return t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==T||t[32]!==E?(D=(0,R.jsxs)(`div`,{className:x,children:[S,C,T,E]}),t[28]=x,t[29]=S,t[30]=C,t[31]=T,t[32]=E,t[33]=D):D=t[33],D}var J=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function Y({schema:e,value:t,onChange:n,labels:r,aiAssist:a,onValidChange:o}){let s=(0,M.useMemo)(()=>V(e),[e]),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,M.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!1)}};return(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,R.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(J,`min-h-40 font-mono text-xs leading-5`)}),f?(0,R.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,R.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,R.jsx)(X,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function X(e){let t=(0,N.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,p;t[0]===n.schema.enum?p=t[1]:(p=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=p);let m=p,h=!!o&&!m.length&&(d===`string`||!d),g=String(l),_=n.required?` *`:``,v;t[2]!==g||t[3]!==_?(v=(0,R.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[g,_]}),t[2]=g,t[3]=_,t[4]=v):v=t[4];let y;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==h||t[11]!==l||t[12]!==r?(y=h&&o?(0,R.jsx)(z,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=h,t[11]=l,t[12]=r,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]===u?x=t[18]:(x=u?(0,R.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=x);let S;t[19]!==u||t[20]!==m||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(S=m.length>0?(0,R.jsxs)(f,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:J,children:[(0,R.jsx)(k,{value:``}),m.map(ce)]}):d===`boolean`?(0,R.jsxs)(f,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:J,children:[(0,R.jsx)(k,{value:``}),(0,R.jsx)(k,{value:`true`,children:a.booleanTrue}),(0,R.jsx)(k,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,R.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(e.target.value===``?void 0:Number(e.target.value)),className:J}):(0,R.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>c(e.target.value),className:i(J,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=m,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,R.jsxs)(`div`,{className:`block`,children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}function ce(e){return(0,R.jsx)(k,{value:String(e),children:String(e)},String(e))}function le(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,R.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ue(e){let t=(0,N.c)(114),{definition:n,language:r,value:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=x(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,M.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=B(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,S,C,w,T,E,D,O,ee,k,A;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(W(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let x=y,j;t[42]!==d||t[43]!==o?(j=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=j):j=t[44];let M=j,N;if(t[45]!==_||t[46]!==x||t[47]!==o.schemaInput?(N=e=>{if(e.field===`goal`){_(e.text);return}x({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=x,t[47]=o.schemaInput,t[48]=N):N=t[48],S=N,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==M||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,R.jsx)(q,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:M,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=M,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],E=i;break bb0}w=`flex flex-col gap-3`,t[65]!==c||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==u||t[75]!==x||t[76]!==o?(T=n.inputSchema?(0,R.jsx)(Y,{schema:n.inputSchema,value:o.schemaInput,onChange:x,onValidChange:(e,t)=>{g(e),u?.(W(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=c,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=u,t[75]=x,t[76]=o,t[77]=T):T=t[77],A=`flex flex-col gap-1`;let P;t[78]===f.goalLabel?P=t[79]:(P=(0,R.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=P);let F;t[80]!==c||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==o.goal||t[89]!==o.schemaInput?(F=c?(0,R.jsx)(z,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=o.goal,t[89]=o.schemaInput,t[90]=F):F=t[90],t[91]!==P||t[92]!==F?(C=(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[P,F]}),t[91]=P,t[92]=F,t[93]=C):C=t[93],D=o.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),ee=f.goalPlaceholder,k=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=ee,t[29]=k,t[30]=A}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],ee=t[28],k=t[29],A=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let j;t[96]!==D||t[97]!==O||t[98]!==ee||t[99]!==k?(j=(0,R.jsx)(`textarea`,{value:D,onChange:O,placeholder:ee,className:k}),t[96]=D,t[97]=O,t[98]=ee,t[99]=k,t[100]=j):j=t[100];let P;t[101]!==C||t[102]!==j||t[103]!==A?(P=(0,R.jsxs)(`div`,{className:A,children:[C,j]}),t[101]=C,t[102]=j,t[103]=A,t[104]=P):P=t[104];let F;t[105]!==S||t[106]!==v||t[107]!==f?(F=(0,R.jsx)(le,{examples:v,labels:f,onSelect:S}),t[105]=S,t[106]=v,t[107]=f,t[108]=F):F=t[108];let I;return t[109]!==w||t[110]!==T||t[111]!==P||t[112]!==F?(I=(0,R.jsxs)(`div`,{className:w,children:[T,P,F]}),t[109]=w,t[110]=T,t[111]=P,t[112]=F,t[113]=I):I=t[113],I}function Z(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?_(t.agentScaleExact,{count:n.min}):_(t.agentScaleRange,{min:n.min,max:n.max}):_(t.agentScaleExact,{count:e.defaults.maxSubagents})}function de(e){let t=(0,N.c)(41),{definition:n,language:r,value:o,onChange:s,mode:c,badgeLabel:l,aiAssist:d,inputClassName:f,showTimeout:p,defaultAdvancedOpen:g,onValidityChange:v}=e,y=p===void 0?!1:p,b=g===void 0?!1:g,S=a(r).workflows,[C,w]=(0,M.useState)(b),E;t[0]!==n||t[1]!==r?(E=x(n,r),t[0]=n,t[1]=r,t[2]=E):E=t[2];let D=E,O;t[3]!==n.defaults||t[4]!==o.concurrency?(O=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=O):O=t[5];let ee=O,k;t[6]!==n.defaults||t[7]!==o.maxSubagents?(k=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=k):k=t[8];let j=k,P;t[9]!==n||t[10]!==r||t[11]!==o?(P=oe(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=P):P=t[12];let F=P,I=l??S.readyToStart,L;t[13]!==s||t[14]!==o?(L=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=L):L=t[15];let te=L,ne=c===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,re;t[16]===ne?re=t[17]:(re=i(`space-y-4`,ne),t[16]=ne,t[17]=re);let z=F||D.description,ie;t[18]===z?ie=t[19]:(ie=(0,R.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:z}),t[18]=z,t[19]=ie);let ae;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,R.jsx)(T,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ae):ae=t[20];let B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,R.jsx)(u,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=B):B=t[21];let V;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,R.jsx)(h,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=V):V=t[22];let H;t[23]!==s||t[24]!==o?(H=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=H):H=t[25];let U;t[26]===v?U=t[27]:(U=e=>{v?.(e)},t[26]=v,t[27]=U);let W;t[28]!==d||t[29]!==n||t[30]!==f||t[31]!==r||t[32]!==H||t[33]!==U||t[34]!==o?(W=(0,R.jsx)(ue,{definition:n,language:r,value:o,onChange:H,onValidityChange:U,aiAssist:d,inputClassName:f}),t[28]=d,t[29]=n,t[30]=f,t[31]=r,t[32]=H,t[33]=U,t[34]=o,t[35]=W):W=t[35];let G;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>w(Q),t[36]=G):G=t[36];let se=S.advancedSettings,K=C&&`rotate-180`,q;t[37]===K?q=t[38]:(q=i(`size-4 transition-transform`,K),t[37]=K,t[38]=q);let J;return t[39]===q?J=t[40]:(J=(0,R.jsx)(A,{className:q}),t[39]=q,t[40]=J),(0,R.jsxs)(`div`,{className:re,children:[(0,R.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:S.runPlanPreview}),ie]}),(0,R.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:I})]}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ae,(0,R.jsx)(`span`,{children:_(S.phaseCount,{count:n.phases.length})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[B,(0,R.jsx)(`span`,{children:Z(n,S)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,R.jsx)(`span`,{children:_(S.runLimitsSummary,{concurrency:ee,max:j})})]})]}),n.phases.length>0?(0,R.jsxs)(`div`,{className:`mt-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,R.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),S.startPlanPhases]}),(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(fe)})]}):null]}),W,(0,R.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:G,children:[se,J]}),C?(0,R.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,R.jsx)(`input`,{value:o.concurrency,onChange:e=>te({concurrency:e.target.value}),placeholder:_(S.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,R.jsx)(`input`,{value:o.maxSubagents,onChange:e=>te({maxSubagents:e.target.value}),placeholder:_(S.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),y?(0,R.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>te({timeoutSeconds:e.target.value}),placeholder:_(S.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function Q(e){return!e}function fe(e,t){return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,R.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,R.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{z as a,W as i,se as n,U as r,de as t};
|